forked from OpenWF/SpaceNinjaServer
fix: identify correct offer for when teshin has 2 kuva offers up (#797)
This commit is contained in:
parent
b3d2345894
commit
0ace5eb446
@ -49,14 +49,15 @@ export const handlePurchase = async (
|
|||||||
|
|
||||||
if (purchaseRequest.PurchaseParams.Source == 7) {
|
if (purchaseRequest.PurchaseParams.Source == 7) {
|
||||||
const manifest = getVendorManifestByOid(purchaseRequest.PurchaseParams.SourceId!);
|
const manifest = getVendorManifestByOid(purchaseRequest.PurchaseParams.SourceId!);
|
||||||
if (manifest) {
|
if (!manifest) {
|
||||||
const offer = manifest.VendorInfo.ItemManifest.find(
|
throw new Error(`unknown vendor id: ${purchaseRequest.PurchaseParams.SourceId!}`);
|
||||||
x => x.StoreItem == purchaseRequest.PurchaseParams.StoreItem
|
|
||||||
);
|
|
||||||
if (offer) {
|
|
||||||
purchaseRequest.PurchaseParams.Quantity *= offer.QuantityMultiplier;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
const ItemId = (JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson!) as { ItemId: string }).ItemId;
|
||||||
|
const offer = manifest.VendorInfo.ItemManifest.find(x => x.Id.$oid == ItemId);
|
||||||
|
if (!offer) {
|
||||||
|
throw new Error(`unknown vendor offer: ${ItemId}`);
|
||||||
|
}
|
||||||
|
purchaseRequest.PurchaseParams.Quantity *= offer.QuantityMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
const purchaseResponse = await handleStoreItemAcquisition(
|
const purchaseResponse = await handleStoreItemAcquisition(
|
||||||
|
@ -17,6 +17,8 @@ export interface IPurchaseParams {
|
|||||||
ExpectedPrice: number;
|
ExpectedPrice: number;
|
||||||
SyndicateTag?: string; // for Source 2
|
SyndicateTag?: string; // for Source 2
|
||||||
UseFreeFavor?: boolean; // for Source 2
|
UseFreeFavor?: boolean; // for Source 2
|
||||||
|
ExtraPurchaseInfoJson?: string; // for Source 7
|
||||||
|
IsWeekly?: boolean; // for Source 7
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICurrencyChanges {
|
export interface ICurrencyChanges {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user