New eveal #32

Merged
Sirttas merged 115 commits from new-eveal into main 2026-07-14 17:15:11 +02:00
6 changed files with 43 additions and 65 deletions
Showing only changes of commit 6dac42bbbe - Show all commits
+2
View File
@@ -7,6 +7,7 @@ import {
CharacterRuleBookApi,
LedgerApi,
MarketApi,
ReprocessingApi,
RuleBookApi,
TransactionApi
} from "@/generated/mammon";
@@ -31,3 +32,4 @@ export const characterRuleBookApi = new CharacterRuleBookApi(undefined, mammonUr
export const activityApi = new ActivityApi(undefined, mammonUrl, mammonAxiosInstance);
export const acquisitionApi = new AcquisitionApi(undefined, mammonUrl, mammonAxiosInstance);
export const marketApi = new MarketApi(undefined, mammonUrl, mammonAxiosInstance);
export const reprocessingApi = new ReprocessingApi(undefined, mammonUrl, mammonAxiosInstance);
+16 -11
View File
@@ -1,31 +1,36 @@
<script setup lang="ts">
import { ReprocessInput, ReprocessItemValues, ReprocessResultTable, reprocess } from '@/reprocess';
import { useCharactersStore } from '@/characters';
import { ReprocessItemValues, ReprocessResultTable, reprocess } from '@/reprocess';
import { useStorage } from '@vueuse/core';
import { ref } from 'vue';
const items = ref("");
const materials = ref("");
const efficiency = useStorage('reprocess-efficiency', 0.55);
const charactersStore = useCharactersStore();
const characterId = useStorage<number | undefined>('reprocess-character', undefined);
const items = ref('');
const result = ref<ReprocessItemValues[]>([]);
const send = async () => result.value = await reprocess(items.value, materials.value, efficiency.value);
const send = async () => result.value = await reprocess(characterId.value, items.value);
</script>
<template>
<div class="grid mb-2 mt-4">
<div class="justify-self-end">
<span>Reprocess efficiency: </span>
<input type="number" min="0" max="1" step="0.05" v-model="efficiency" />
<span>Character: </span>
<select v-model="characterId">
<option v-for="character in charactersStore.characters" :key="character.characterId" :value="character.characterId">{{ character.name }}</option>
</select>
</div>
</div>
<div class="flex items-stretch">
<ReprocessInput name="Item JSON" v-model="items" />
<ReprocessInput name="Materials JSON" v-model="materials" />
<div class="flex-1 mx-1">
<span>Items</span>
<textarea class="mt-1" v-model="items" placeholder="Paste an EVE inventory listing" />
</div>
</div>
<div class="grid my-2">
<button class="justify-self-end" @click="send">Send</button>
<button class="justify-self-end" @click="send" :disabled="!characterId || !items.trim()">Send</button>
</div>
<template v-if="result.length > 0">
<hr />
-34
View File
@@ -1,34 +0,0 @@
<script setup lang="ts">
import { evepraisalAxiosInstance } from '@/market/appraisal/evepraisal';
interface Props {
name: string;
}
const modelValue = defineModel({ default: '' });
defineProps<Props>();
const loadFromId = async (e: Event) => {
const input = e.target as HTMLInputElement;
const id = input.value;
if (!id) {
return;
}
const response = await evepraisalAxiosInstance.get(`/a/${id}.json`);
if (response.status !== 200) {
return;
}
modelValue.value = JSON.stringify(response.data);
input.value = '';
}
</script>
<template>
<div class="flex-1 mx-1">
<span>{{ name }}</span><input type="text" class="ms-2" @change="loadFromId" placeholder="id evepraisal" />
<textarea class="mt-1" v-model="modelValue" />
</div>
</template>
+8 -8
View File
@@ -1,11 +1,11 @@
<script setup lang="ts">
import { SortableHeader, useSort, VirtualScrollTable } from '@/components/table';
import { formatIsk, percentFormater } from '@/formaters';
import { MarketTypeLabel } from '@/market/type';
import { useStorage } from '@vueuse/core';
import { computed } from 'vue';
import {SortableHeader, useSort, VirtualScrollTable} from '@/components/table';
import {formatIsk, percentFormater} from '@/formaters';
import {MarketTypeLabel} from '@/market/type';
import {useStorage} from '@vueuse/core';
import {computed} from 'vue';
import BuySellSlider from './BuySellSlider.vue';
import { ReprocessItemValues } from './reprocess';
import {ReprocessItemValues} from './reprocess';
interface Props {
result?: ReprocessItemValues[];
@@ -26,8 +26,8 @@ const { sortedArray, headerProps } = useSort(computed(() => props.result.map(r =
return { ...r, market, materials, ratio };
})), {
defaultSortKey: 'name',
defaultSortDirection: 'asc'
defaultSortKey: 'ratio',
defaultSortDirection: 'desc'
})
</script>
-1
View File
@@ -1,5 +1,4 @@
export * from './reprocess';
export { default as ReprocessInput } from './ReprocessInput.vue';
export { default as ReprocessResultTable } from './ReprocessResultTable.vue';
+17 -11
View File
@@ -1,3 +1,6 @@
import { reprocessingApi } from '@/mammon';
import { getMarketTypes } from '@/market';
export type ReprocessItemValues = {
typeID: number;
name: string;
@@ -7,18 +10,21 @@ export type ReprocessItemValues = {
sell_reprocess: number;
}
export const reprocess = async (items: string, minerals: string, efficiency?: number): Promise<ReprocessItemValues[]> => {
if (!items || !minerals || (efficiency && (efficiency < 0 || efficiency > 1))) {
export const reprocess = async (characterId?: number, items?: string, locationId?: number): Promise<ReprocessItemValues[]> => {
if (!characterId || !items?.trim()) {
return [];
}
const itemsJson = JSON.parse(items);
const mineralsJson = JSON.parse(minerals);
const sourceJson = {
"ep_items": itemsJson,
"ep_mat": mineralsJson
};
const source = JSON.stringify(sourceJson);
const results = await reprocessingApi.reprocessRawItems(characterId, items, locationId).then(r => r.data);
const names = await getMarketTypes(results.map(r => r.input.marketTypeId))
.then(types => new Map(types.map(t => [t.id, t.name])));
return []
};
return results.map(({ input, output }) => ({
typeID: input.marketTypeId,
name: names.get(input.marketTypeId) ?? '',
buy: input.buy,
sell: input.sell,
buy_reprocess: output.reduce((sum, o) => sum + o.buy, 0),
sell_reprocess: output.reduce((sum, o) => sum + o.sell, 0),
}));
};