fix: use exact quantity when adding gear items by StoreItem (#2310)
Closes #2304 Reviewed-on: #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.
|
// - Blueprints for Ancient Protector Specter, Shield Osprey Specter, etc. have num=1 despite giving their purchaseQuantity.
|
||||||
if (!exactQuantity) {
|
if (!exactQuantity) {
|
||||||
quantity *= ExportGear[typeName].purchaseQuantity ?? 1;
|
quantity *= ExportGear[typeName].purchaseQuantity ?? 1;
|
||||||
|
logger.debug(`non-exact acquisition of ${typeName}; factored quantity is ${quantity}`);
|
||||||
}
|
}
|
||||||
const consumablesChanges = [
|
const consumablesChanges = [
|
||||||
{
|
{
|
||||||
|
@ -371,18 +371,28 @@ export const handleStoreItemAcquisition = async (
|
|||||||
} else {
|
} else {
|
||||||
const storeCategory = getStoreItemCategory(storeItemName);
|
const storeCategory = getStoreItemCategory(storeItemName);
|
||||||
const internalName = fromStoreItem(storeItemName);
|
const internalName = fromStoreItem(storeItemName);
|
||||||
logger.debug(`store category ${storeCategory}`);
|
|
||||||
if (!ignorePurchaseQuantity) {
|
if (!ignorePurchaseQuantity) {
|
||||||
if (internalName in ExportGear) {
|
if (internalName in ExportGear) {
|
||||||
quantity *= ExportGear[internalName].purchaseQuantity || 1;
|
quantity *= ExportGear[internalName].purchaseQuantity || 1;
|
||||||
|
logger.debug(`factored quantity is ${quantity}`);
|
||||||
} else if (internalName in ExportResources) {
|
} else if (internalName in ExportResources) {
|
||||||
quantity *= ExportResources[internalName].purchaseQuantity || 1;
|
quantity *= ExportResources[internalName].purchaseQuantity || 1;
|
||||||
|
logger.debug(`factored quantity is ${quantity}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logger.debug(`store category ${storeCategory}`);
|
||||||
switch (storeCategory) {
|
switch (storeCategory) {
|
||||||
default: {
|
default: {
|
||||||
purchaseResponse = {
|
purchaseResponse = {
|
||||||
InventoryChanges: await addItem(inventory, internalName, quantity, premiumPurchase, seed)
|
InventoryChanges: await addItem(
|
||||||
|
inventory,
|
||||||
|
internalName,
|
||||||
|
quantity,
|
||||||
|
premiumPurchase,
|
||||||
|
seed,
|
||||||
|
undefined,
|
||||||
|
true
|
||||||
|
)
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -524,7 +534,9 @@ const handleTypesPurchase = async (
|
|||||||
logger.debug(`type category ${typeCategory}`);
|
logger.debug(`type category ${typeCategory}`);
|
||||||
switch (typeCategory) {
|
switch (typeCategory) {
|
||||||
default:
|
default:
|
||||||
return { InventoryChanges: await addItem(inventory, typesName, quantity, premiumPurchase, seed) };
|
return {
|
||||||
|
InventoryChanges: await addItem(inventory, typesName, quantity, premiumPurchase, seed, undefined, true)
|
||||||
|
};
|
||||||
case "BoosterPacks":
|
case "BoosterPacks":
|
||||||
return handleBoosterPackPurchase(typesName, inventory, quantity);
|
return handleBoosterPackPurchase(typesName, inventory, quantity);
|
||||||
case "SlotItems":
|
case "SlotItems":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user