返回提交历史
Modified
src/controllers/api/syndicateStandingBonusController.ts
+23
-8
XFEstudio/SpaceNinjaServer
fix: limit standing gain from medallions for title's max (#772)
26f20bfb
代码差异
1 个文件
+23
-8
@@ -24,16 +24,19 @@ export const syndicateStandingBonusController: RequestHandler = async (req, res)
24
24
const inventory = await getInventory(accountId);
25
25
addMiscItems(inventory, request.Operation.Items);
26
26
27
const syndicate = inventory.Affiliations.find(x => x.Tag == request.Operation.AffiliationTag);
28
if (syndicate !== undefined) {
29
syndicate.Standing += gainedStanding;
30
} else {
31
inventory.Affiliations.push({
32
Tag: request.Operation.AffiliationTag,
33
Standing: gainedStanding
34
});
27
let syndicate = inventory.Affiliations.find(x => x.Tag == request.Operation.AffiliationTag);
28
if (!syndicate) {
29
syndicate =
30
inventory.Affiliations[inventory.Affiliations.push({ Tag: request.Operation.AffiliationTag, Standing: 0 })];
35
31
}
36
32
33
const max = getMaxStanding(request.Operation.AffiliationTag, syndicate.Title ?? 0);
34
if (syndicate.Standing + gainedStanding > max) {
35
gainedStanding = max - syndicate.Standing;
36
}
37
38
syndicate.Standing += gainedStanding;
39
37
40
// TODO: Subtract from daily limit bin; maybe also a cheat to skip that.
38
41
39
42
await inventory.save();
@@ -59,3 +62,15 @@ interface ISyndicateStandingBonusRequest {
59
62
};
60
63
ModularWeaponId: IOid; // Seems to just be "000000000000000000000000", also note there's a "Category" query field
61
64
}
65
66
const getMaxStanding = (affiliationTag: string, title: number): number => {
67
const syndicate = ExportSyndicates[affiliationTag];
68
if (!syndicate.titles) {
69
// LibrarySyndicate
70
return 125000;
71
}
72
if (title == 0) {
73
return syndicate.titles.find(x => x.level == 1)!.minStanding;
74
}
75
return syndicate.titles.find(x => x.level == title)!.maxStanding;
76
};