improve: purchases #161

Merged
Sainan merged 7 commits from stonks into main 2024-05-08 16:27:33 -07:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 32160dfede - Show all commits

View File

@ -27,7 +27,7 @@ export const inventorySlotsController: RequestHandler = async (req, res) => {
//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);
//console.log({ InventoryChanges: currencyChanges }, " added loadout changes:");

View File

@ -97,11 +97,11 @@ export const updateCurrency = async (price: number, usePremium: boolean, account
if (usePremium) {
if (inventory.PremiumCreditsFree > 0) {
inventory.PremiumCreditsFree += price;
inventory.PremiumCreditsFree -= price;
}
inventory.PremiumCredits += price;
inventory.PremiumCredits -= price;
} else {
inventory.RegularCredits += price;
inventory.RegularCredits -= price;
}
const modifiedPaths = inventory.modifiedPaths();