From c7870e4bee29c0a7f29bf8a94f71699ed3f27361 Mon Sep 17 00:00:00 2001 From: Stas Tserkovny Date: Sat, 21 Nov 2020 14:11:49 -0700 Subject: [PATCH] Fix an issue with MW calculation after burning Fixed an issue where stat exponents were being set to a string rather than a number after character burning. --- module/dialogs/burnerDataHelpers.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/module/dialogs/burnerDataHelpers.ts b/module/dialogs/burnerDataHelpers.ts index 71808c85..05dcc620 100644 --- a/module/dialogs/burnerDataHelpers.ts +++ b/module/dialogs/burnerDataHelpers.ts @@ -51,16 +51,16 @@ function costToString(cost: number): ShadeString { return "W"; } -function getStatData(html: JQuery, name: string): { exp: string, shade: ShadeString} { +function getStatData(html: JQuery, name: string): { exp: number, shade: ShadeString} { return { - exp: extractNamedString(html, `${name}Spent`), + exp: extractNamedNumber(html, `${name}Spent`), shade: costToString(extractNamedNumber(html, `${name}ShadeSpent`)) }; } -function getAttrData(html: JQuery, name: string): { exp: string, shade: ShadeString} { +function getAttrData(html: JQuery, name: string): { exp: number, shade: ShadeString} { return { - exp: extractNamedString(html, `${name}Stat`), + exp: extractNamedNumber(html, `${name}Stat`), shade: extractNamedString(html, `${name}Shade`) as ShadeString }; } @@ -197,15 +197,15 @@ export function extractPropertyData(html: JQuery, propertyList: Pro export function extractReputationData(html: JQuery): Partial[] { const reputations: Partial[] = []; let repName = ""; - let repDice = "0"; + let repDice = 0; html.find(".burner-reputations").each((_, e) => { repName = extractNamedChildString($(e), "reputationName"); - repDice = extractNamedChildString($(e), "reputationDice"); - if (!repName || !extractNamedChildNumber($(e), "reputationCost") || repDice === "0") { return; } + repDice = extractNamedChildNumber($(e), "reputationDice"); + if (!repName || !extractNamedChildNumber($(e), "reputationCost") || repDice === 0) { return; } if (!extractNamedChildCheck($(e), "reputationType")) { reputations.push({ data: { - dice: parseInt(repDice), + dice: repDice, description: "Unknown affiliation created during character burning. Update data accordingly." } as AffiliationData, type: "affiliation", @@ -214,7 +214,7 @@ export function extractReputationData(html: JQuery): Partial