fix: scale non-standard prices by quantity
This commit is contained in:
parent
6d3ea67273
commit
ae4fa79dec
@ -65,7 +65,7 @@ export const handlePurchase = async (purchaseRequest: IPurchaseRequest, accountI
|
|||||||
for (const item of offer.itemPrices) {
|
for (const item of offer.itemPrices) {
|
||||||
const invItem: IMiscItem = {
|
const invItem: IMiscItem = {
|
||||||
ItemType: item.ItemType,
|
ItemType: item.ItemType,
|
||||||
ItemCount: item.ItemCount * -1
|
ItemCount: item.ItemCount * purchaseRequest.PurchaseParams.Quantity * -1
|
||||||
};
|
};
|
||||||
|
|
||||||
addMiscItems(inventory, [invItem]);
|
addMiscItems(inventory, [invItem]);
|
||||||
@ -75,7 +75,7 @@ export const handlePurchase = async (purchaseRequest: IPurchaseRequest, accountI
|
|||||||
x => x.ItemType == item.ItemType
|
x => x.ItemType == item.ItemType
|
||||||
);
|
);
|
||||||
if (change) {
|
if (change) {
|
||||||
change.ItemCount -= item.ItemCount;
|
change.ItemCount += invItem.ItemCount;
|
||||||
} else {
|
} else {
|
||||||
(purchaseResponse.InventoryChanges.MiscItems as IMiscItem[]).push(invItem);
|
(purchaseResponse.InventoryChanges.MiscItems as IMiscItem[]).push(invItem);
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ export const handlePurchase = async (purchaseRequest: IPurchaseRequest, accountI
|
|||||||
if (offer.RegularPrice) {
|
if (offer.RegularPrice) {
|
||||||
const invItem: IMiscItem = {
|
const invItem: IMiscItem = {
|
||||||
ItemType: "/Lotus/Types/Items/MiscItems/SchismKey",
|
ItemType: "/Lotus/Types/Items/MiscItems/SchismKey",
|
||||||
ItemCount: offer.RegularPrice * -1
|
ItemCount: offer.RegularPrice * purchaseRequest.PurchaseParams.Quantity * -1
|
||||||
};
|
};
|
||||||
|
|
||||||
addMiscItems(inventory, [invItem]);
|
addMiscItems(inventory, [invItem]);
|
||||||
@ -109,7 +109,7 @@ export const handlePurchase = async (purchaseRequest: IPurchaseRequest, accountI
|
|||||||
purchaseResponse.InventoryChanges.MiscItems ??= [];
|
purchaseResponse.InventoryChanges.MiscItems ??= [];
|
||||||
(purchaseResponse.InventoryChanges.MiscItems as IMiscItem[]).push(invItem);
|
(purchaseResponse.InventoryChanges.MiscItems as IMiscItem[]).push(invItem);
|
||||||
} else {
|
} else {
|
||||||
inventory.PrimeTokens -= offer.PrimePrice!;
|
inventory.PrimeTokens -= offer.PrimePrice! * purchaseRequest.PurchaseParams.Quantity;
|
||||||
}
|
}
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user