fix: don't attempt to subtract a cost of 0 for unlocking focus school (#2731)
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:
parent
6de9f0dcdb
commit
d4c477769a
@ -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({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user