Skip to content

Commit 57c1030

Browse files
author
Firebottle
committed
fix: Fix cost of training.
1 parent 7cc0ffb commit 57c1030

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/firebot/commands/rpg-trainer.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,19 @@ async function shopTrainStat(
2424
const { upgrades } = await getWorldMeta();
2525
const characterName = await getUserName(username);
2626
const { trainer } = upgrades;
27-
const statLimit = trainer + 1 * getTrainingLevelLimit(); // Players start at 10, so add one level to trainer for stat limit.
27+
28+
// We need to calculate the stat limit now based on user settings. We need to add a number to the trainer level so that the stat limit takes into account stats starting at 10.
29+
const trainerModifier = 10 / getTrainingLevelLimit();
30+
31+
const statLimit = Math.floor(
32+
(trainer + trainerModifier) * getTrainingLevelLimit()
33+
);
2834
const userdata = await getUserData(username);
2935
const currencyName = getCurrencyName();
3036
const characterCurrencyTotal = await getUserCurrencyTotal(username);
3137

32-
const baseCost = userdata[stat] * getTrainingBaseCost();
38+
// Subtract 9 from user stat to account for initial stat of 10 across the board.
39+
const baseCost = (userdata[stat] - 9) * getTrainingBaseCost();
3340
const costToTrain =
3441
baseCost + baseCost * (getTrainingCostMultiplier() / 100);
3542
const totalCost = await calculateShopCost(costToTrain);

0 commit comments

Comments
 (0)