返回提交历史
Modified
src/controllers/api/fishmongerController.ts
+2
-3
Modified
src/controllers/api/syndicateStandingBonusController.ts
+4
-3
Modified
src/helpers/syndicateStandingHelper.ts
+11
-0
Modified
src/services/inventoryService.ts
+27
-4
Modified
src/services/missionInventoryUpdateService.ts
+9
-10
XFEstudio/SpaceNinjaServer
feat: handle classic syndicate alignments when trading in medals (#2157)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2157 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
b67ddf6d
代码差异
5 个文件
+53
-20
@@ -30,15 +30,14 @@ export const fishmongerController: RequestHandler = async (req, res) => {
30
30
miscItemChanges.push({ ItemType: fish.ItemType, ItemCount: fish.ItemCount * -1 });
31
31
}
32
32
addMiscItems(inventory, miscItemChanges);
33
let affiliationMod;
34
if (gainedStanding && syndicateTag) affiliationMod = addStanding(inventory, syndicateTag, gainedStanding);
33
if (gainedStanding && syndicateTag) addStanding(inventory, syndicateTag, gainedStanding);
35
34
await inventory.save();
36
35
res.json({
37
36
InventoryChanges: {
38
37
MiscItems: miscItemChanges
39
38
},
40
39
SyndicateTag: syndicateTag,
41
StandingChange: affiliationMod?.Standing || 0
40
StandingChange: gainedStanding
42
41
});
43
42
};
44
43
@@ -5,7 +5,7 @@ import { IMiscItem, InventorySlot } from "@/src/types/inventoryTypes/inventoryTy
5
5
import { IOid } from "@/src/types/commonTypes";
6
6
import { ExportSyndicates, ExportWeapons } from "warframe-public-export-plus";
7
7
import { logger } from "@/src/utils/logger";
8
import { IInventoryChanges } from "@/src/types/purchaseTypes";
8
import { IAffiliationMods, IInventoryChanges } from "@/src/types/purchaseTypes";
9
9
import { EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
10
10
11
11
export const syndicateStandingBonusController: RequestHandler = async (req, res) => {
@@ -54,13 +54,14 @@ export const syndicateStandingBonusController: RequestHandler = async (req, res)
54
54
inventoryChanges[slotBin] = { count: -1, platinum: 0, Slots: 1 };
55
55
}
56
56
57
const affiliationMod = addStanding(inventory, request.Operation.AffiliationTag, gainedStanding, true);
57
const affiliationMods: IAffiliationMods[] = [];
58
addStanding(inventory, request.Operation.AffiliationTag, gainedStanding, affiliationMods, true);
58
59
59
60
await inventory.save();
60
61
61
62
res.json({
62
63
InventoryChanges: inventoryChanges,
63
AffiliationMods: [affiliationMod]
64
AffiliationMods: affiliationMods
64
65
});
65
66
};
66
67
@@ -10,3 +10,14 @@ export const getMaxStanding = (syndicate: ISyndicate, title: number): number =>
10
10
}
11
11
return syndicate.titles.find(x => x.level == title)!.maxStanding;
12
12
};
13
14
export const getMinStanding = (syndicate: ISyndicate, title: number): number => {
15
if (!syndicate.titles) {
16
// LibrarySyndicate
17
return 0;
18
}
19
if (title == 0) {
20
return syndicate.titles.find(x => x.level == -1)!.maxStanding;
21
}
22
return syndicate.titles.find(x => x.level == title)!.minStanding;
23
};
@@ -82,7 +82,7 @@ import { handleBundleAcqusition } from "./purchaseService";
82
82
import libraryDailyTasks from "@/static/fixed_responses/libraryDailyTasks.json";
83
83
import { getRandomElement, getRandomInt, getRandomWeightedReward, SRng } from "./rngService";
84
84
import { createMessage } from "./inboxService";
85
import { getMaxStanding } from "@/src/helpers/syndicateStandingHelper";
85
import { getMaxStanding, getMinStanding } from "@/src/helpers/syndicateStandingHelper";
86
86
import { getNightwaveSyndicateTag, getWorldState } from "./worldStateService";
87
87
import { generateNemesisProfile, INemesisProfile } from "../helpers/nemesisHelpers";
88
88
import { TAccountDocument } from "./loginService";
@@ -1202,8 +1202,10 @@ export const addStanding = (
1202
1202
inventory: TInventoryDatabaseDocument,
1203
1203
syndicateTag: string,
1204
1204
gainedStanding: number,
1205
isMedallion: boolean = false
1206
): IAffiliationMods => {
1205
affiliationMods: IAffiliationMods[] = [],
1206
isMedallion: boolean = false,
1207
propagateAlignments: boolean = true
1208
): void => {
1207
1209
let syndicate = inventory.Affiliations.find(x => x.Tag == syndicateTag);
1208
1210
const syndicateMeta = ExportSyndicates[syndicateTag];
1209
1211
@@ -1215,6 +1217,10 @@ export const addStanding = (
1215
1217
const max = getMaxStanding(syndicateMeta, syndicate.Title ?? 0);
1216
1218
if (syndicate.Standing + gainedStanding > max) gainedStanding = max - syndicate.Standing;
1217
1219
1220
if (syndicate.Title == -2 && syndicate.Standing + gainedStanding < -71000) {
1221
gainedStanding = -71000 + syndicate.Standing;
1222
}
1223
1218
1224
if (!isMedallion || syndicateMeta.medallionsCappedByDailyLimit) {
1219
1225
if (gainedStanding > getStandingLimit(inventory, syndicateMeta.dailyLimitBin)) {
1220
1226
gainedStanding = getStandingLimit(inventory, syndicateMeta.dailyLimitBin);
@@ -1223,10 +1229,27 @@ export const addStanding = (
1223
1229
}
1224
1230
1225
1231
syndicate.Standing += gainedStanding;
1226
return {
1232
const affiliationMod: IAffiliationMods = {
1227
1233
Tag: syndicateTag,
1228
1234
Standing: gainedStanding
1229
1235
};
1236
affiliationMods.push(affiliationMod);
1237
1238
if (syndicateMeta.alignments) {
1239
if (propagateAlignments) {
1240
for (const [tag, factor] of Object.entries(syndicateMeta.alignments)) {
1241
addStanding(inventory, tag, gainedStanding * factor, affiliationMods, isMedallion, false);
1242
}
1243
} else {
1244
while (syndicate.Standing < getMinStanding(syndicateMeta, syndicate.Title ?? 0)) {
1245
syndicate.Title ??= 0;
1246
syndicate.Title -= 1;
1247
affiliationMod.Title ??= 0;
1248
affiliationMod.Title -= 1;
1249
logger.debug(`${syndicateTag} is decreasing to title ${syndicate.Title} after applying alignment`);
1250
}
1251
}
1252
}
1230
1253
};
1231
1254
1232
1255
// TODO: AffiliationMods support (Nightwave).
@@ -1236,19 +1236,18 @@ export const addMissionRewards = async (
1236
1236
SyndicateXPItemReward = medallionAmount;
1237
1237
} else {
1238
1238
if (rewardInfo.JobTier! >= 0) {
1239
AffiliationMods.push(
1240
addStanding(
1241
inventory,
1242
syndicateEntry.Tag,
1243
Math.floor(currentJob.xpAmounts[rewardInfo.JobStage] / (rewardInfo.Q ? 0.8 : 1))
1244
)
1239
addStanding(
1240
inventory,
1241
syndicateEntry.Tag,
1242
Math.floor(currentJob.xpAmounts[rewardInfo.JobStage] / (rewardInfo.Q ? 0.8 : 1)),
1243
AffiliationMods
1245
1244
);
1246
1245
} else {
1247
1246
if (jobType.endsWith("Heists/HeistProfitTakerBountyOne") && rewardInfo.JobStage === 2) {
1248
AffiliationMods.push(addStanding(inventory, syndicateEntry.Tag, 1000));
1247
addStanding(inventory, syndicateEntry.Tag, 1000, AffiliationMods);
1249
1248
}
1250
1249
if (jobType.endsWith("Hunts/AllTeralystsHunt") && rewardInfo.JobStage === 2) {
1251
AffiliationMods.push(addStanding(inventory, syndicateEntry.Tag, 5000));
1250
addStanding(inventory, syndicateEntry.Tag, 5000, AffiliationMods);
1252
1251
}
1253
1252
if (
1254
1253
[
@@ -1259,7 +1258,7 @@ export const addMissionRewards = async (
1259
1258
"Heists/HeistExploiterBountyOne"
1260
1259
].some(ending => jobType.endsWith(ending))
1261
1260
) {
1262
AffiliationMods.push(addStanding(inventory, syndicateEntry.Tag, 1000));
1261
addStanding(inventory, syndicateEntry.Tag, 1000, AffiliationMods);
1263
1262
}
1264
1263
}
1265
1264
}
@@ -1284,7 +1283,7 @@ export const addMissionRewards = async (
1284
1283
let standingAmount = (tier + 1) * 1000;
1285
1284
if (tier > 5) standingAmount = 7500; // InfestedLichBounty
1286
1285
if (isSteelPath) standingAmount *= 1.5;
1287
AffiliationMods.push(addStanding(inventory, syndicateTag, standingAmount));
1286
addStanding(inventory, syndicateTag, standingAmount, AffiliationMods);
1288
1287
}
1289
1288
if (syndicateTag == "HexSyndicate" && chemistry && tier < 6) {
1290
1289
const seed = getWorldState().SyndicateMissions.find(x => x.Tag == "HexSyndicate")!.Seed;