From 172722a915f836dd74112c7649d1de6a3f815bb2 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 2 Aug 2023 16:15:33 +0100 Subject: [PATCH] Cleanup code and also check if standing is 0 --- project/src/helpers/TraderHelper.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/project/src/helpers/TraderHelper.ts b/project/src/helpers/TraderHelper.ts index 86ec88a1..0fe754a4 100644 --- a/project/src/helpers/TraderHelper.ts +++ b/project/src/helpers/TraderHelper.ts @@ -91,7 +91,7 @@ export class TraderHelper disabled: false, loyaltyLevel: rawProfileTemplate.initialLoyaltyLevel, salesSum: rawProfileTemplate.initialSalesSum, - standing: traderID === "638f541a29ffd1183d187f57" ? 0.01 : rawProfileTemplate.initialStanding, // edge case for Lightkeeper, 0 means seeing `Make Amends - Buyout` quest + standing: this.getStartingStanding(traderID, rawProfileTemplate), nextResupply: this.databaseServer.getTables().traders[traderID].base.nextResupply, unlocked: this.databaseServer.getTables().traders[traderID].base.unlockedByDefault }; @@ -102,6 +102,17 @@ export class TraderHelper } } + protected getStartingStanding(traderId: string, rawProfileTemplate: ProfileTraderTemplate): number + { + // Edge case for Lightkeeper, 0 standing means seeing `Make Amends - Buyout` quest + if (traderId === "638f541a29ffd1183d187f57" && rawProfileTemplate.initialStanding === 0) + { + return 0.01; + } + + return rawProfileTemplate.initialStanding; + } + /** * Alter a traders unlocked status * @param traderId Trader to alter