返回提交历史
Modified
package-lock.json
+4
-4
Modified
package.json
+1
-1
Modified
src/services/purchaseService.ts
+19
-17
XFEstudio/SpaceNinjaServer
fix: purchasing flawed mods from iron wake (#802)
734ca845
代码差异
3 个文件
+24
-22
@@ -12,7 +12,7 @@
12
12
"copyfiles": "^2.4.1",
13
13
"express": "^5",
14
14
"mongoose": "^8.9.4",
15
"warframe-public-export-plus": "^0.5.22",
15
"warframe-public-export-plus": "^0.5.23",
16
16
"warframe-riven-info": "^0.1.2",
17
17
"winston": "^3.17.0",
18
18
"winston-daily-rotate-file": "^5.0.0"
@@ -3778,9 +3778,9 @@
3778
3778
}
3779
3779
},
3780
3780
"node_modules/warframe-public-export-plus": {
3781
"version": "0.5.22",
3782
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.22.tgz",
3783
"integrity": "sha512-IbOW7ndE17ceyd7IjRy1U1p3P0Q7Q1/E26N04+ha/gG5FIdLpZDR9kLzyHGlnBLDSl2Jro6rxgOq0wZ/0i0w3g=="
3781
"version": "0.5.23",
3782
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.23.tgz",
3783
"integrity": "sha512-AJLivzXpon+UDm+SYq3wIXiP4OXCDOgXvCG1VLawJrHW3VDff+NpsUJApBPA4S8oZ8N8NPyBVKBvuoF2Pplaeg=="
3784
3784
},
3785
3785
"node_modules/warframe-riven-info": {
3786
3786
"version": "0.1.2",
@@ -16,7 +16,7 @@
16
16
"copyfiles": "^2.4.1",
17
17
"express": "^5",
18
18
"mongoose": "^8.9.4",
19
"warframe-public-export-plus": "^0.5.22",
19
"warframe-public-export-plus": "^0.5.23",
20
20
"warframe-riven-info": "^0.1.2",
21
21
"winston": "^3.17.0",
22
22
"winston-daily-rotate-file": "^5.0.0"
@@ -50,23 +50,25 @@ export const handlePurchase = async (
50
50
const inventoryChanges: IInventoryChanges = {};
51
51
if (purchaseRequest.PurchaseParams.Source == 7) {
52
52
const manifest = getVendorManifestByOid(purchaseRequest.PurchaseParams.SourceId!);
53
if (!manifest) {
54
throw new Error(`unknown vendor id: ${purchaseRequest.PurchaseParams.SourceId!}`);
55
}
56
const ItemId = (JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson!) as { ItemId: string }).ItemId;
57
const offer = manifest.VendorInfo.ItemManifest.find(x => x.Id.$oid == ItemId);
58
if (!offer) {
59
throw new Error(`unknown vendor offer: ${ItemId}`);
60
}
61
if (offer.ItemPrices) {
62
await handleItemPrices(
63
accountId,
64
offer.ItemPrices,
65
purchaseRequest.PurchaseParams.Quantity,
66
inventoryChanges
67
);
53
if (manifest) {
54
const ItemId = (JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson!) as { ItemId: string })
55
.ItemId;
56
const offer = manifest.VendorInfo.ItemManifest.find(x => x.Id.$oid == ItemId);
57
if (!offer) {
58
throw new Error(`unknown vendor offer: ${ItemId}`);
59
}
60
if (offer.ItemPrices) {
61
await handleItemPrices(
62
accountId,
63
offer.ItemPrices,
64
purchaseRequest.PurchaseParams.Quantity,
65
inventoryChanges
66
);
67
}
68
purchaseRequest.PurchaseParams.Quantity *= offer.QuantityMultiplier;
69
} else if (!ExportVendors[purchaseRequest.PurchaseParams.SourceId!]) {
70
throw new Error(`unknown vendor: ${purchaseRequest.PurchaseParams.SourceId!}`);
68
71
}
69
purchaseRequest.PurchaseParams.Quantity *= offer.QuantityMultiplier;
70
72
}
71
73
72
74
const purchaseResponse = await handleStoreItemAcquisition(
@@ -126,7 +128,7 @@ export const handlePurchase = async (
126
128
if (purchaseRequest.PurchaseParams.SourceId! in ExportVendors) {
127
129
const vendor = ExportVendors[purchaseRequest.PurchaseParams.SourceId!];
128
130
const offer = vendor.items.find(x => x.storeItem == purchaseRequest.PurchaseParams.StoreItem);
129
if (offer) {
131
if (offer && offer.itemPrices) {
130
132
await handleItemPrices(
131
133
accountId,
132
134
offer.itemPrices,