fix: don't attempt to subtract a cost of 0 for unlocking focus school (#2731)
All checks were successful
Build Docker image / docker-arm64 (push) Successful in 1m1s
Build / build (push) Successful in 1m16s
Build Docker image / docker-amd64 (push) Successful in 49s

Closes #2730

Reviewed-on: #2731
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-08-31 18:47:14 -07:00 committed by Sainan
parent 6de9f0dcdb
commit d4c477769a

View File

@ -38,12 +38,12 @@ export const focusController: RequestHandler = async (req, res) => {
case FocusOperation.UnlockWay: {
const focusType = (JSON.parse(String(req.body)) as IWayRequest).FocusType;
const focusPolarity = focusTypeToPolarity(focusType);
const inventory = await getInventory(accountId);
const inventory = await getInventory(accountId, "FocusAbility FocusUpgrades FocusXP");
const cost = inventory.FocusAbility ? 50_000 : 0;
inventory.FocusAbility ??= focusType;
inventory.FocusUpgrades.push({ ItemType: focusType });
if (inventory.FocusXP) {
inventory.FocusXP[focusPolarity]! -= cost;
if (cost) {
inventory.FocusXP![focusPolarity]! -= cost;
}
await inventory.save();
res.json({