fix not removing the temporary miscitem from inventory
All checks were successful
Build / build (18) (push) Successful in 42s
Build / build (22) (push) Successful in 1m7s
Build / build (20) (push) Successful in 1m1s
Build / build (18) (pull_request) Successful in 43s
Build / build (20) (pull_request) Successful in 1m7s
Build / build (22) (pull_request) Successful in 1m3s
All checks were successful
Build / build (18) (push) Successful in 42s
Build / build (22) (push) Successful in 1m7s
Build / build (20) (push) Successful in 1m1s
Build / build (18) (pull_request) Successful in 43s
Build / build (20) (pull_request) Successful in 1m7s
Build / build (22) (pull_request) Successful in 1m3s
This commit is contained in:
parent
5426fe0874
commit
ad50f61ab6
@ -51,12 +51,17 @@ export const handlePurchase = async (
|
||||
logger.debug("purchase request", purchaseRequest);
|
||||
|
||||
const prePurchaseInventoryChanges: IInventoryChanges = {};
|
||||
if (purchaseRequest.PurchaseParams.Source == 7 && purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson) {
|
||||
if (purchaseRequest.PurchaseParams.Source == 7) {
|
||||
const manifest = getVendorManifestByOid(purchaseRequest.PurchaseParams.SourceId!);
|
||||
if (manifest) {
|
||||
const ItemId = (JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson) as { ItemId: string })
|
||||
.ItemId;
|
||||
const offer = manifest.VendorInfo.ItemManifest.find(x => x.Id.$oid == ItemId);
|
||||
let ItemId: string | undefined;
|
||||
if (purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson) {
|
||||
ItemId = (JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson) as { ItemId: string })
|
||||
.ItemId;
|
||||
}
|
||||
const offer = ItemId
|
||||
? manifest.VendorInfo.ItemManifest.find(x => x.Id.$oid == ItemId)
|
||||
: manifest.VendorInfo.ItemManifest.find(x => x.StoreItem == purchaseRequest.PurchaseParams.StoreItem);
|
||||
if (!offer) {
|
||||
throw new Error(`unknown vendor offer: ${ItemId}`);
|
||||
}
|
||||
@ -68,7 +73,7 @@ export const handlePurchase = async (
|
||||
prePurchaseInventoryChanges
|
||||
);
|
||||
}
|
||||
if (!config.noVendorPurchaseLimits) {
|
||||
if (!config.noVendorPurchaseLimits && ItemId) {
|
||||
inventory.RecentVendorPurchases ??= [];
|
||||
let vendorPurchases = inventory.RecentVendorPurchases.find(
|
||||
x => x.VendorType == manifest.VendorInfo.TypeName
|
||||
|
Loading…
x
Reference in New Issue
Block a user