fix: identify correct offer for when teshin has 2 kuva offers up (#797)
This commit is contained in:
		
							parent
							
								
									b3d2345894
								
							
						
					
					
						commit
						0ace5eb446
					
				@ -49,15 +49,16 @@ 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
 | 
					        }
 | 
				
			||||||
            );
 | 
					        const ItemId = (JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson!) as { ItemId: string }).ItemId;
 | 
				
			||||||
            if (offer) {
 | 
					        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;
 | 
					        purchaseRequest.PurchaseParams.Quantity *= offer.QuantityMultiplier;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const purchaseResponse = await handleStoreItemAcquisition(
 | 
					    const purchaseResponse = await handleStoreItemAcquisition(
 | 
				
			||||||
        purchaseRequest.PurchaseParams.StoreItem,
 | 
					        purchaseRequest.PurchaseParams.StoreItem,
 | 
				
			||||||
 | 
				
			|||||||
@ -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