forked from OpenWF/SpaceNinjaServer
fix: use exact quantity when adding gear items by StoreItem (#2310)
Closes #2304 Reviewed-on: OpenWF/SpaceNinjaServer#2310 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
a3be376489
commit
eb7b51852b
@ -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}; factored quantity is ${quantity}`);
|
||||
}
|
||||
const consumablesChanges = [
|
||||
{
|
||||
|
@ -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":
|
||||
|
Loading…
x
Reference in New Issue
Block a user