From 608e0a00541c025c84d4f096f8f065be98d8ed44 Mon Sep 17 00:00:00 2001 From: David Fontenot Date: Tue, 23 Aug 2022 18:34:48 -0500 Subject: [PATCH] Replace Exalted with Divine (#706) * Add divine price on item check overlay * Missed exa -> div * generalize ex to stable orb * poeprices is not updated yet Co-authored-by: Alexander Drozdov --- renderer/public/images/divine.png | Bin 0 -> 5711 bytes renderer/src/web/background/Prices.ts | 32 ++++++------ .../src/web/price-check/PriceCheckWindow.vue | 16 +++--- .../price-prediction/FeedbackOption.vue | 4 +- .../price-check/price-prediction/poeprices.ts | 10 ++-- .../price-check/stack-value/StackValue.vue | 2 +- .../src/web/price-check/trade/TradeBulk.vue | 48 +++++++++--------- .../web/price-check/trade/pathofexile-bulk.ts | 2 +- .../src/web/price-check/trends/PriceTrend.vue | 2 +- renderer/src/web/ui/ItemQuickPrice.vue | 16 +++--- 10 files changed, 68 insertions(+), 64 deletions(-) create mode 100644 renderer/public/images/divine.png diff --git a/renderer/public/images/divine.png b/renderer/public/images/divine.png new file mode 100644 index 0000000000000000000000000000000000000000..aad382417f2fa563fa95789a6f3028d7bc1bd90b GIT binary patch literal 5711 zcmV-V7O?4wP)T zM%YHOjRG);MFLCRt)=(9-`Z96>eXJAS-I!EcRt8CXhKUf@|+L(B{MRA@sE?|WHP+X z+BliRaO5Hx)A7)q+o49H%6U|_@l+WglJ@G()B9p+u+vf2z z_ur1~Tjy~6!Jqr!F*%U&+*!(28U(VsituUSNI*4p+nh&bmpRqX+&OOVmi zPd`Ngh)OAk2i~FOM#>Kgeg( zKfS#akLmF!*D@Jd-gXeT-TQNL6^a1|In&MqLKM{ zKBG;Rv)m3<5-p6=UH3dh=jJyPB^o0{kI;BJL&xT}l8G&Q>Eu*Krs+s1zRx?O;LcWO znD}>}`24pn9)DU{Zw+NUs^gaJ6})nx_V)1kgoVxaRvUeJ_UbxXz0psO-@UmA&+}p0A$jbP zTiC&Q%HRLk*Z**`l>X3q%MT15vgt~R9^O?Z&tGX_p>3emH{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 ns: string, url: string, lines: string }> let PRICES_DB: PriceDatabase = [] @@ -31,9 +31,9 @@ async function load (force: boolean = false) { if (leagueAtStartOfLoad === selectedLeague.value) { PRICES_DB = splitJsonBlob(jsonBlob) - const exalted = findPriceByQuery({ ns: 'ITEM', name: 'Exalted Orb', variant: undefined }) - if (exalted && exalted.chaos >= 15) { - chaosExaRate.value = exalted.chaos + const divine = findPriceByQuery({ ns: 'ITEM', name: 'Divine Orb', variant: undefined }) + if (divine && divine.chaos >= 30) { + xchgRate.value = divine.chaos } lastUpdateTime = Date.now() @@ -143,29 +143,29 @@ export function findPriceByQuery (query: DbQuery) { return null } -export function autoCurrency (value: number, currency: 'chaos' | 'exa'): { min: number, max: number, currency: 'chaos' | 'exa' } { +export function autoCurrency (value: number, currency: 'chaos' | 'div'): { min: number, max: number, currency: 'chaos' | 'div' } { if (currency === 'chaos') { - if (value > ((chaosExaRate.value || 9999) * 0.94)) { - if (value < ((chaosExaRate.value || 9999) * 1.06)) { - return { min: 1, max: 1, currency: 'exa' } + if (value > ((xchgRate.value || 9999) * 0.94)) { + if (value < ((xchgRate.value || 9999) * 1.06)) { + return { min: 1, max: 1, currency: 'div' } } else { - return { min: chaosToExa(value), max: chaosToExa(value), currency: 'exa' } + return { min: chaosToStable(value), max: chaosToStable(value), currency: 'div' } } } - } else if (currency === 'exa') { + } else if (currency === 'div') { if (value < 1) { - return { min: exaToChaos(value), max: exaToChaos(value), currency: 'chaos' } + return { min: stableToChaos(value), max: stableToChaos(value), currency: 'chaos' } } } return { min: value, max: value, currency } } -function chaosToExa (count: number) { - return count / (chaosExaRate.value || 9999) +function chaosToStable (count: number) { + return count / (xchgRate.value || 9999) } -function exaToChaos (count: number) { - return count * (chaosExaRate.value || 9999) +function stableToChaos (count: number) { + return count * (xchgRate.value || 9999) } export function displayRounding (value: number, fraction: boolean = false): string { @@ -187,7 +187,7 @@ setInterval(() => { }, RETRY_TIME) watch(selectedLeague, () => { - chaosExaRate.value = undefined + xchgRate.value = undefined PRICES_DB = [] load(true) }) diff --git a/renderer/src/web/price-check/PriceCheckWindow.vue b/renderer/src/web/price-check/PriceCheckWindow.vue index ff62fa89..8342c2ec 100644 --- a/renderer/src/web/price-check/PriceCheckWindow.vue +++ b/renderer/src/web/price-check/PriceCheckWindow.vue @@ -11,17 +11,17 @@
- + @@ -71,7 +71,7 @@ import { useI18n } from 'vue-i18n' import CheckedItem from './CheckedItem.vue' import BackgroundInfo from './BackgroundInfo.vue' import { MainProcess } from '@/web/background/IPC' -import { chaosExaRate } from '../background/Prices' +import { xchgRate } from '../background/Prices' import { selected as league } from '@/web/background/Leagues' import { AppConfig } from '@/web/Config' import { ItemCategory, ItemRarity, parseClipboard, ParsedItem } from '@/parser' @@ -162,7 +162,7 @@ export default defineComponent({ }) const title = computed(() => league.value || 'Awakened PoE Trade') - const exaltedCost = computed(() => (chaosExaRate.value) ? Math.round(chaosExaRate.value) : null) + const stableOrbCost = computed(() => (xchgRate.value) ? Math.round(xchgRate.value) : null) const isBrowserShown = computed(() => props.config.wmFlags.includes('has-browser')) const overlayKey = computed(() => AppConfig().overlayKey) const showCheckPos = computed(() => wm.active.value && props.config.showCursor) @@ -227,7 +227,7 @@ export default defineComponent({ poeUiWidth: wm.poePanelWidth, closePriceCheck, title, - exaltedCost, + stableOrbCost, showCheckPos, checkPosition, item, diff --git a/renderer/src/web/price-check/price-prediction/FeedbackOption.vue b/renderer/src/web/price-check/price-prediction/FeedbackOption.vue index 62d99dea..9e428d61 100644 --- a/renderer/src/web/price-check/price-prediction/FeedbackOption.vue +++ b/renderer/src/web/price-check/price-prediction/FeedbackOption.vue @@ -31,7 +31,7 @@ export default defineComponent({ required: true }, prediction: { - type: Object as PropType<{ min: number, max: number, currency: 'chaos' | 'exa' }>, + type: Object as PropType<{ min: number, max: number, currency: 'chaos' | 'div' }>, required: true }, item: { @@ -60,7 +60,7 @@ export default defineComponent({ }, { min: props.prediction.min, max: props.prediction.max, - currency: (props.prediction.currency === 'exa') ? 'exalt' : 'chaos' + currency: (props.prediction.currency === 'div') ? 'divine' : 'chaos' }, props.item) } diff --git a/renderer/src/web/price-check/price-prediction/poeprices.ts b/renderer/src/web/price-check/price-prediction/poeprices.ts index baae01b8..7b8dc6c3 100644 --- a/renderer/src/web/price-check/price-prediction/poeprices.ts +++ b/renderer/src/web/price-check/price-prediction/poeprices.ts @@ -6,7 +6,7 @@ import { Cache } from '../trade/Cache' const cache = new Cache() interface PoepricesApiResponse { /* eslint-disable camelcase */ - currency: 'chaos' | 'exalt' + currency: 'chaos' | 'divine' error: number error_msg: string warning_msg: string @@ -20,7 +20,7 @@ export interface RareItemPrice { max: number min: number confidence: number - currency: 'chaos' | 'exa' + currency: 'chaos' | 'div' explanation: Array<{ name: string contrib: number @@ -50,8 +50,12 @@ export async function requestPoeprices (item: ParsedItem): Promise(query, data, 300) } + if (data.currency !== 'divine' && data.currency !== 'chaos') { + throw new Error('poeprices.info gave the price in Exalted Orbs.') + } + return { - currency: (data.currency === 'exalt') ? 'exa' : 'chaos', + currency: (data.currency === 'divine') ? 'div' : 'chaos', min: data.min, max: data.max, confidence: Math.round(data.pred_confidence_score), diff --git a/renderer/src/web/price-check/stack-value/StackValue.vue b/renderer/src/web/price-check/stack-value/StackValue.vue index b57270bd..759d6a0a 100644 --- a/renderer/src/web/price-check/stack-value/StackValue.vue +++ b/renderer/src/web/price-check/stack-value/StackValue.vue @@ -33,7 +33,7 @@ export default defineComponent({ function getPriceFor (n: number) { const one = findPriceByQuery(getDetailsId(props.item)!)! - const price = (props.item.info.refName === 'Exalted Orb') + const price = (props.item.info.refName === 'Divine Orb') ? { min: n * one.chaos, max: n * one.chaos, currency: 'chaos' as const } : autoCurrency(n * one.chaos, 'chaos') diff --git a/renderer/src/web/price-check/trade/TradeBulk.vue b/renderer/src/web/price-check/trade/TradeBulk.vue index 281156b9..5fc957d7 100644 --- a/renderer/src/web/price-check/trade/TradeBulk.vue +++ b/renderer/src/web/price-check/trade/TradeBulk.vue @@ -6,15 +6,15 @@ {{ t('Matched:') }} ...
- -
@@ -101,7 +101,7 @@ import TradeLinks from './TradeLinks.vue' const slowdown = artificialSlowdown(900) function useBulkApi () { - type BulkSearchExtended = Record<'exa' | 'chaos', { + type BulkSearchExtended = Record<'xchgChaos' | 'xchgStable', { listed: Ref listedLazy: ComputedRef }> @@ -120,17 +120,17 @@ function useBulkApi () { // override, because at league start many players set wrong price, and this breaks optimistic search const have = (item.info.refName === 'Chaos Orb') - ? ['exalted'] - : (item.info.refName === 'Exalted Orb') + ? ['divine'] + : (item.info.refName === 'Divine Orb') ? ['chaos'] - : ['exalted', 'chaos'] + : ['divine', 'chaos'] const optimisticSearch = await execBulkSearch( item, filters, have, { accountName: AppConfig().accountName }) if (_searchId === searchId) { result.value = { - exa: getResultsByHave(item, filters, optimisticSearch, 'exalted'), - chaos: getResultsByHave(item, filters, optimisticSearch, 'chaos') + xchgStable: getResultsByHave(item, filters, optimisticSearch, 'divine'), + xchgChaos: getResultsByHave(item, filters, optimisticSearch, 'chaos') } } } catch (err) { @@ -142,7 +142,7 @@ function useBulkApi () { item: ParsedItem, filters: ItemFilters, preloaded: Array, - have: 'exalted' | 'chaos' + have: 'divine' | 'chaos' ) { const _result = shallowRef( preloaded.some(res => res?.haveTag === have) @@ -160,9 +160,9 @@ function useBulkApi () { item, filters, [have], { accountName: AppConfig().accountName }))[0]! ) items.value = _result.value.listed - const otherHave = (have === 'exalted') - ? result.value?.chaos?.listed.value! - : result.value?.exa?.listed.value! + const otherHave = (have === 'divine') + ? result.value?.xchgChaos?.listed.value! + : result.value?.xchgStable?.listed.value! // fix best guess we did while making optimistic search otherHave.total -= _result.value.total } catch (err) { @@ -196,7 +196,7 @@ export default defineComponent({ const widget = computed(() => AppConfig('price-check')!) const { error, result, search } = useBulkApi() - const selectedCurr = shallowRef<'chaos' | 'exa'>('chaos') + const selectedCurr = shallowRef<'xchgChaos' | 'xchgStable'>('xchgChaos') watch(() => props.item, (item) => { slowdown.reset(item) @@ -212,14 +212,14 @@ export default defineComponent({ }) watch(result, () => { - const exaTotal = result.value?.exa.listed.value?.total - const chaosTotal = result.value?.chaos.listed.value?.total - if (exaTotal == null) { - selectedCurr.value = 'chaos' + const stableTotal = result.value?.xchgStable.listed.value?.total + const chaosTotal = result.value?.xchgChaos.listed.value?.total + if (stableTotal == null) { + selectedCurr.value = 'xchgChaos' } else if (chaosTotal == null) { - selectedCurr.value = 'exa' + selectedCurr.value = 'xchgStable' } else { - selectedCurr.value = (exaTotal > chaosTotal) ? 'exa' : 'chaos' + selectedCurr.value = (stableTotal > chaosTotal) ? 'xchgStable' : 'xchgChaos' } }) diff --git a/renderer/src/web/price-check/trade/pathofexile-bulk.ts b/renderer/src/web/price-check/trade/pathofexile-bulk.ts index 08f39311..70289a9c 100644 --- a/renderer/src/web/price-check/trade/pathofexile-bulk.ts +++ b/renderer/src/web/price-check/trade/pathofexile-bulk.ts @@ -170,7 +170,7 @@ export async function execBulkSearch ( .map(result => toPricingResult(result, opts, offer)) const chaosIsLoaded = ( - tradeTag === 'exalted' && + tradeTag === 'divine' && resultsTag.length < results.length && ((results.length - resultsTag.length) >= SHOW_RESULTS || query.total <= API_FETCH_LIMIT) ) diff --git a/renderer/src/web/price-check/trends/PriceTrend.vue b/renderer/src/web/price-check/trends/PriceTrend.vue index 518d1b1b..f867770a 100644 --- a/renderer/src/web/price-check/trends/PriceTrend.vue +++ b/renderer/src/web/price-check/trends/PriceTrend.vue @@ -87,7 +87,7 @@ export default defineComponent({ const trend = detailsId && findPriceByQuery(detailsId) if (!trend) return - const price = (props.item.info.refName === 'Exalted Orb') + const price = (props.item.info.refName === 'Divine Orb') ? { min: trend.chaos, max: trend.chaos, currency: 'chaos' as const } : autoCurrency(trend.chaos, 'chaos') diff --git a/renderer/src/web/ui/ItemQuickPrice.vue b/renderer/src/web/ui/ItemQuickPrice.vue index 58054663..64dde68d 100644 --- a/renderer/src/web/ui/ItemQuickPrice.vue +++ b/renderer/src/web/ui/ItemQuickPrice.vue @@ -8,14 +8,14 @@
~ - {{ minText }} + {{ minText }} ~ - {{ maxText }} - × -  {{ price.currency }} + {{ maxText }} + × +  {{ price.currency }}
- +
@@ -28,7 +28,7 @@ import { displayRounding } from '../background/Prices' export default defineComponent({ props: { price: { - type: Object as PropType<{ min: number, max: number, currency: 'exa' | 'chaos' }>, + type: Object as PropType<{ min: number, max: number, currency: 'div' | 'chaos' }>, default: undefined }, approx: { @@ -56,14 +56,14 @@ export default defineComponent({ minText, maxText, isRange: computed(() => { return minText.value !== maxText.value }), - isExa: computed(() => { return props.price?.currency === 'exa' }) + isValuable: computed(() => { return props.price?.currency !== 'chaos' }) } } })