fix: purchases adding currency instead of subtracting
This commit is contained in:
parent
6eaa1d8959
commit
32160dfede
@ -27,7 +27,7 @@ export const inventorySlotsController: RequestHandler = async (req, res) => {
|
|||||||
|
|
||||||
//TODO: check which slot was purchased because pvpBonus is also possible
|
//TODO: check which slot was purchased because pvpBonus is also possible
|
||||||
|
|
||||||
const currencyChanges = await updateCurrency(-20, true, accountId);
|
const currencyChanges = await updateCurrency(20, true, accountId);
|
||||||
await updateSlots(accountId, SlotNameToInventoryName.LOADOUT, 1, 1);
|
await updateSlots(accountId, SlotNameToInventoryName.LOADOUT, 1, 1);
|
||||||
|
|
||||||
//console.log({ InventoryChanges: currencyChanges }, " added loadout changes:");
|
//console.log({ InventoryChanges: currencyChanges }, " added loadout changes:");
|
||||||
|
@ -97,11 +97,11 @@ export const updateCurrency = async (price: number, usePremium: boolean, account
|
|||||||
|
|
||||||
if (usePremium) {
|
if (usePremium) {
|
||||||
if (inventory.PremiumCreditsFree > 0) {
|
if (inventory.PremiumCreditsFree > 0) {
|
||||||
inventory.PremiumCreditsFree += price;
|
inventory.PremiumCreditsFree -= price;
|
||||||
}
|
}
|
||||||
inventory.PremiumCredits += price;
|
inventory.PremiumCredits -= price;
|
||||||
} else {
|
} else {
|
||||||
inventory.RegularCredits += price;
|
inventory.RegularCredits -= price;
|
||||||
}
|
}
|
||||||
|
|
||||||
const modifiedPaths = inventory.modifiedPaths();
|
const modifiedPaths = inventory.modifiedPaths();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user