From df1727c16fe8d1a2fbb4cdf4d081a50dc7f9bfcb Mon Sep 17 00:00:00 2001 From: Alexander Drozdov Date: Tue, 8 Feb 2022 21:36:11 +0200 Subject: [PATCH] fix NaN for No Physical Damage --- package.json | 2 +- .../filters/pseudo/item-property.ts | 40 ++++++++++--------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 15ba08d5..c978986c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "awakened-poe-trade", - "version": "2.15.1", + "version": "3.17.10001", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/src/web/price-check/filters/pseudo/item-property.ts b/src/web/price-check/filters/pseudo/item-property.ts index 27da303d..7288c2ba 100644 --- a/src/web/price-check/filters/pseudo/item-property.ts +++ b/src/web/price-check/filters/pseudo/item-property.ts @@ -111,15 +111,15 @@ export const WEAPON_STATS = new Set([ function weaponProps (ctx: FiltersCreationContext) { const { item } = ctx - const attackSpeed = calcPropBounds(item.weaponAS!, { incr: ['#% increased Attack Speed'], flat: [] }, item) - const physQ20 = propAt20Quality(item.weaponPHYSICAL!, QUALITY_STATS.PHYSICAL_DAMAGE, item) + const attackSpeed = calcPropBounds(item.weaponAS ?? 0, { incr: ['#% increased Attack Speed'], flat: [] }, item) + const physQ20 = propAt20Quality(item.weaponPHYSICAL ?? 0, QUALITY_STATS.PHYSICAL_DAMAGE, item) const pdpsQ20: StatRoll = { value: physQ20.value * attackSpeed.value, min: physQ20.min * attackSpeed.min, max: physQ20.max * attackSpeed.max } - const eleDmg = calcPropBounds(item.weaponELEMENTAL!, { + const eleDmg = calcPropBounds(item.weaponELEMENTAL ?? 0, { flat: ['Adds # to # Lightning Damage', 'Adds # to # Cold Damage', 'Adds # to # Fire Damage'], incr: [] }, item) @@ -152,13 +152,15 @@ function weaponProps (ctx: FiltersCreationContext) { }, ctx)) } - ctx.filters.push(propToFilter({ - ref: 'Physical DPS: #', - tradeId: 'weapon.physical_dps', - roll: pdpsQ20, - disabled: !isPdpsImportant(item) || (pdpsQ20.value / dps.value < 0.67), - hidden: (pdpsQ20.value / dps.value < 0.67) ? 'Physical damage is not the main source of DPS' : undefined - }, ctx)) + if (item.weaponPHYSICAL) { + ctx.filters.push(propToFilter({ + ref: 'Physical DPS: #', + tradeId: 'weapon.physical_dps', + roll: pdpsQ20, + disabled: !isPdpsImportant(item) || (pdpsQ20.value / dps.value < 0.67), + hidden: (pdpsQ20.value / dps.value < 0.67) ? 'Physical damage is not the main source of DPS' : undefined + }, ctx)) + } ctx.filters.push(propToFilter({ ref: 'Attacks per Second: #', @@ -168,15 +170,17 @@ function weaponProps (ctx: FiltersCreationContext) { disabled: true }, ctx)) - const critChance = calcPropBounds(item.weaponCRIT!, { incr: ['#% increased Critical Strike Chance'], flat: [] }, item) + if (item.weaponCRIT) { + const critChance = calcPropBounds(item.weaponCRIT, { incr: ['#% increased Critical Strike Chance'], flat: [] }, item) - ctx.filters.push(propToFilter({ - ref: 'Critical Strike Chance: #%', - tradeId: 'weapon.crit', - roll: critChance, - dp: true, - disabled: true - }, ctx)) + ctx.filters.push(propToFilter({ + ref: 'Critical Strike Chance: #%', + tradeId: 'weapon.crit', + roll: critChance, + dp: true, + disabled: true + }, ctx)) + } if ( item.weaponAS ||