use creditBundles
All checks were successful
Build / build (22) (pull_request) Successful in 41s
Build / build (18) (pull_request) Successful in 1m3s
Build / build (20) (pull_request) Successful in 1m1s

This commit is contained in:
nrbdev 2025-02-22 19:46:34 -05:00
parent af7df53799
commit ab111d5c57
2 changed files with 12 additions and 17 deletions

View File

@ -62,7 +62,9 @@ export const creditBundles: Record<string, number> = {
"/Lotus/Types/PickUps/Credits/CorpusArenaCreditRewards/CorpusArenaRewardTwoHard": 175000, "/Lotus/Types/PickUps/Credits/CorpusArenaCreditRewards/CorpusArenaRewardTwoHard": 175000,
"/Lotus/Types/PickUps/Credits/CorpusArenaCreditRewards/CorpusArenaRewardThreeHard": 250000, "/Lotus/Types/PickUps/Credits/CorpusArenaCreditRewards/CorpusArenaRewardThreeHard": 250000,
"/Lotus/Types/StoreItems/CreditBundles/Zariman/TableACreditsCommon": 15000, "/Lotus/Types/StoreItems/CreditBundles/Zariman/TableACreditsCommon": 15000,
"/Lotus/Types/StoreItems/CreditBundles/Zariman/TableACreditsUncommon": 30000 "/Lotus/Types/StoreItems/CreditBundles/Zariman/TableACreditsUncommon": 30000,
"/Lotus/Types/StoreItems/CreditBundles/CreditBundleA": 50000,
"/Lotus/Types/StoreItems/CreditBundles/CreditBundleC": 175000
}; };
export const fusionBundles: Record<string, number> = { export const fusionBundles: Record<string, number> = {

View File

@ -25,6 +25,7 @@ import {
} from "warframe-public-export-plus"; } from "warframe-public-export-plus";
import { config } from "./configService"; import { config } from "./configService";
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel"; import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
import { creditBundles } from "./missionInventoryUpdateService";
export const getStoreItemCategory = (storeItem: string): string => { export const getStoreItemCategory = (storeItem: string): string => {
const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/"); const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/");
@ -335,24 +336,16 @@ const handleCreditBundlePurchase = async (
inventory: TInventoryDatabaseDocument inventory: TInventoryDatabaseDocument
): Promise<IPurchaseResponse> => { ): Promise<IPurchaseResponse> => {
const bundleName = typeName.split("/").pop(); const bundleName = typeName.split("/").pop();
let creditsAmount = 0;
// CreditBundleA = 50.000 credits or CreditBundleC = 175.000 credits if (bundleName && bundleName in creditBundles) {
switch (bundleName) { const creditsAmount = creditBundles[bundleName];
case "CreditBundleA": inventory.RegularCredits += creditsAmount;
creditsAmount = 50_000; await inventory.save();
break;
case "CreditBundleC": return { InventoryChanges: { RegularCredits: creditsAmount } };
creditsAmount = 175_000; } else {
break; throw new Error(`unknown credit bundle: ${typeName}`);
default:
throw new Error("invalid credit bundle: " + bundleName);
} }
inventory.RegularCredits += creditsAmount;
await inventory.save();
return { InventoryChanges: { RegularCredits: creditsAmount } };
}; };
//TODO: change to getInventory, apply changes then save at the end //TODO: change to getInventory, apply changes then save at the end