Skip to content

Commit

Permalink
Fix an issue with MW calculation after burning
Browse files Browse the repository at this point in the history
Fixed an issue where stat exponents were being set to a string rather
than a number after character burning.
  • Loading branch information
StasTserk committed Nov 21, 2020
1 parent 622b678 commit c7870e4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions module/dialogs/burnerDataHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ function costToString(cost: number): ShadeString {
return "W";
}

function getStatData(html: JQuery<HTMLElement>, name: string): { exp: string, shade: ShadeString} {
function getStatData(html: JQuery<HTMLElement>, 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<HTMLElement>, name: string): { exp: string, shade: ShadeString} {
function getAttrData(html: JQuery<HTMLElement>, name: string): { exp: number, shade: ShadeString} {
return {
exp: extractNamedString(html, `${name}Stat`),
exp: extractNamedNumber(html, `${name}Stat`),
shade: extractNamedString(html, `${name}Shade`) as ShadeString
};
}
Expand Down Expand Up @@ -197,15 +197,15 @@ export function extractPropertyData(html: JQuery<HTMLElement>, propertyList: Pro
export function extractReputationData(html: JQuery<HTMLElement>): Partial<ReputationDataRoot | AffiliationDataRoot>[] {
const reputations: Partial<AffiliationDataRoot | ReputationDataRoot>[] = [];
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",
Expand All @@ -214,7 +214,7 @@ export function extractReputationData(html: JQuery<HTMLElement>): Partial<Reputa
} else {
reputations.push({
data: {
dice: parseInt(repDice),
dice: repDice,
infamous: false,
description: "Unknown reputation created during character burning. Update data accordingly."
} as ReputationData,
Expand Down

0 comments on commit c7870e4

Please sign in to comment.