返回提交历史
Modified
src/services/purchaseService.ts
+20
-9
Modified
src/types/purchaseTypes.ts
+1
-1
XFEstudio/SpaceNinjaServer
chore: handle SyndicateFavor that costs credits instead of standing (#4431)
Closes #4430 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4431 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
fe5e4923
代码差异
2 个文件
+21
-10
@@ -6,6 +6,7 @@ import {
6
6
addMiscItems,
7
7
combineInventoryChanges,
8
8
handleOneTimePurchasable,
9
updateCredits,
9
10
updateCurrency,
10
11
updateSlots
11
12
} from "./inventoryService.ts";
@@ -306,15 +307,25 @@ export const handlePurchase = async (
306
307
x => x.storeItem == purchaseRequest.PurchaseParams.StoreItem
307
308
);
308
309
if (favour) {
309
const affiliation = inventory.Affiliations.find(x => x.Tag == syndicateTag);
310
if (affiliation) {
311
purchaseResponse.Standing = [
312
{
313
Tag: syndicateTag,
314
Standing: favour.standingCost * purchaseRequest.PurchaseParams.Quantity
315
}
316
];
317
affiliation.Standing -= favour.standingCost * purchaseRequest.PurchaseParams.Quantity;
310
if (favour.creditsCost) {
311
updateCredits(
312
inventory,
313
favour.creditsCost * purchaseRequest.PurchaseParams.Quantity,
314
purchaseResponse.InventoryChanges
315
);
316
}
317
if (favour.standingCost) {
318
const affiliation = inventory.Affiliations.find(x => x.Tag == syndicateTag);
319
if (affiliation) {
320
purchaseResponse.Standing = [
321
{
322
Tag: syndicateTag,
323
Standing: favour.standingCost * purchaseRequest.PurchaseParams.Quantity
324
}
325
];
326
affiliation.Standing -=
327
favour.standingCost * purchaseRequest.PurchaseParams.Quantity;
328
}
318
329
}
319
330
}
320
331
}
@@ -10,7 +10,7 @@ import type {
10
10
export const ePurchaseSource = {
11
11
Market: 0, // platinum, from metadata
12
12
VoidTrader: 1, // ducat + credits
13
SyndicateFavor: 2, // standing
13
SyndicateFavor: 2, // standing or credits
14
14
DailyDeal: 3, // platinum, from server
15
15
Arsenal: 4, // platinum, from metadata
16
16
Profile: 5, // ???