返回提交历史
Modified
src/services/purchaseService.ts
+8
-4
Modified
src/types/purchaseTypes.ts
+1
-0
XFEstudio/SpaceNinjaServer
fix: tell client of PrimeTokens inventory change when buying from varzia (#1243)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1243
b761ff1b
代码差异
2 个文件
+9
-4
@@ -50,7 +50,7 @@ export const handlePurchase = async (
50
50
): Promise<IPurchaseResponse> => {
51
51
logger.debug("purchase request", purchaseRequest);
52
52
53
const inventoryChanges: IInventoryChanges = {};
53
const prePurchaseInventoryChanges: IInventoryChanges = {};
54
54
if (purchaseRequest.PurchaseParams.Source == 7) {
55
55
const manifest = getVendorManifestByOid(purchaseRequest.PurchaseParams.SourceId!);
56
56
if (manifest) {
@@ -65,7 +65,7 @@ export const handlePurchase = async (
65
65
inventory,
66
66
offer.ItemPrices,
67
67
purchaseRequest.PurchaseParams.Quantity,
68
inventoryChanges
68
prePurchaseInventoryChanges
69
69
);
70
70
}
71
71
if (!config.noVendorPurchaseLimits) {
@@ -94,7 +94,7 @@ export const handlePurchase = async (
94
94
Expiry: new Date(parseInt(offer.Expiry.$date.$numberLong))
95
95
});
96
96
}
97
inventoryChanges.RecentVendorPurchases = [
97
prePurchaseInventoryChanges.RecentVendorPurchases = [
98
98
{
99
99
VendorType: manifest.VendorInfo.TypeName,
100
100
PurchaseHistory: [
@@ -121,7 +121,7 @@ export const handlePurchase = async (
121
121
inventory,
122
122
purchaseRequest.PurchaseParams.Quantity
123
123
);
124
combineInventoryChanges(purchaseResponse.InventoryChanges, inventoryChanges);
124
combineInventoryChanges(purchaseResponse.InventoryChanges, prePurchaseInventoryChanges);
125
125
126
126
const currencyChanges = updateCurrency(
127
127
inventory,
@@ -240,6 +240,10 @@ export const handlePurchase = async (
240
240
purchaseResponse.InventoryChanges.MiscItems.push(invItem);
241
241
} else if (!config.infiniteRegalAya) {
242
242
inventory.PrimeTokens -= offer.PrimePrice! * purchaseRequest.PurchaseParams.Quantity;
243
244
purchaseResponse.InventoryChanges.PrimeTokens ??= 0;
245
purchaseResponse.InventoryChanges.PrimeTokens -=
246
offer.PrimePrice! * purchaseRequest.PurchaseParams.Quantity;
243
247
}
244
248
}
245
249
break;
@@ -36,6 +36,7 @@ export type IInventoryChanges = {
36
36
RegularCredits?: number;
37
37
PremiumCredits?: number;
38
38
PremiumCreditsFree?: number;
39
PrimeTokens?: number;
39
40
InfestedFoundry?: IInfestedFoundryClient;
40
41
Drones?: IDroneClient[];
41
42
MiscItems?: IMiscItem[];