fix: use exact quantity when adding gear items by StoreItem
All checks were successful
Build / build (pull_request) Successful in 56s

This commit is contained in:
Sainan 2025-06-26 20:12:37 +02:00
parent a3be376489
commit abf609060e
2 changed files with 16 additions and 3 deletions

View File

@ -499,6 +499,7 @@ export const addItem = async (
// - Blueprints for Ancient Protector Specter, Shield Osprey Specter, etc. have num=1 despite giving their purchaseQuantity.
if (!exactQuantity) {
quantity *= ExportGear[typeName].purchaseQuantity ?? 1;
logger.debug(`non-exact acquisition of ${typeName}, updated quantity to ${quantity}`);
}
const consumablesChanges = [
{

View File

@ -371,18 +371,28 @@ export const handleStoreItemAcquisition = async (
} else {
const storeCategory = getStoreItemCategory(storeItemName);
const internalName = fromStoreItem(storeItemName);
logger.debug(`store category ${storeCategory}`);
if (!ignorePurchaseQuantity) {
if (internalName in ExportGear) {
quantity *= ExportGear[internalName].purchaseQuantity || 1;
logger.debug(`factored quantity is ${quantity}`);
} else if (internalName in ExportResources) {
quantity *= ExportResources[internalName].purchaseQuantity || 1;
logger.debug(`factored quantity is ${quantity}`);
}
}
logger.debug(`store category ${storeCategory}`);
switch (storeCategory) {
default: {
purchaseResponse = {
InventoryChanges: await addItem(inventory, internalName, quantity, premiumPurchase, seed)
InventoryChanges: await addItem(
inventory,
internalName,
quantity,
premiumPurchase,
seed,
undefined,
true
)
};
break;
}
@ -524,7 +534,9 @@ const handleTypesPurchase = async (
logger.debug(`type category ${typeCategory}`);
switch (typeCategory) {
default:
return { InventoryChanges: await addItem(inventory, typesName, quantity, premiumPurchase, seed) };
return {
InventoryChanges: await addItem(inventory, typesName, quantity, premiumPurchase, seed, undefined, true)
};
case "BoosterPacks":
return handleBoosterPackPurchase(typesName, inventory, quantity);
case "SlotItems":