XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

feat: title/honoria challenge rewards (#3127)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3127 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

4dba9956
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

6 个文件 +38 -12
Modified package-lock.json +4 -4
@@ -17,7 +17,7 @@
17 17 "morgan": "^1.10.0",
18 18 "ncp": "^2.0.0",
19 19 "undici": "^7.10.0",
20 "warframe-public-export-plus": "^0.5.95",
20 "warframe-public-export-plus": "^0.5.96",
21 21 "warframe-riven-info": "^0.1.2",
22 22 "winston": "^3.17.0",
23 23 "winston-daily-rotate-file": "^5.0.0",
@@ -5421,9 +5421,9 @@
5421 5421 }
5422 5422 },
5423 5423 "node_modules/warframe-public-export-plus": {
5424 "version": "0.5.95",
5425 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.95.tgz",
5426 "integrity": "sha512-48Y9hwl+frr32n7yHa+ezCorL99Dyl70r9J9rnbeb2/sYw1phkt4W7BqFsu896958/qt5vF5H2R97jV0UA4Nrw=="
5424 "version": "0.5.96",
5425 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.96.tgz",
5426 "integrity": "sha512-ipOJEXzmrI+AryyrpHfd0ZzTV7arVQLm+ih9zi1FxlO96sDtNcZevqL32Q3OZvOk70aDywK1KeGc5gWshCcPxw=="
5427 5427 },
5428 5428 "node_modules/warframe-riven-info": {
5429 5429 "version": "0.1.2",
Modified package.json +1 -1
@@ -34,7 +34,7 @@
34 34 "morgan": "^1.10.0",
35 35 "ncp": "^2.0.0",
36 36 "undici": "^7.10.0",
37 "warframe-public-export-plus": "^0.5.95",
37 "warframe-public-export-plus": "^0.5.96",
38 38 "warframe-riven-info": "^0.1.2",
39 39 "winston": "^3.17.0",
40 40 "winston-daily-rotate-file": "^5.0.0",
Modified src/controllers/api/loginController.ts +5 -0
@@ -33,6 +33,11 @@ export const loginController: RequestHandler = async (request, response) => {
33 33 ? request.query.buildLabel.split(" ").join("+")
34 34 : buildConfig.buildLabel;
35 35
36 if (version_compare(buildLabel, "2025.10.29.12.05") > 0) {
37 response.status(400).json({ error: "do you want me to change your diapers, too?" });
38 return;
39 }
40
36 41 if (
37 42 !account &&
38 43 ((config.autoCreateAccount && loginRequest.ClientType != "webui") ||
Modified src/controllers/api/updateChallengeProgressController.ts +7 -4
@@ -3,7 +3,7 @@ import { getJSONfromString } from "../../helpers/stringHelpers.ts";
3 3 import { getAccountForRequest } from "../../services/loginService.ts";
4 4 import { addCalendarProgress, addChallenges, getInventory } from "../../services/inventoryService.ts";
5 5 import type { IChallengeProgress, ISeasonChallenge } from "../../types/inventoryTypes/inventoryTypes.ts";
6 import type { IAffiliationMods } from "../../types/purchaseTypes.ts";
6 import type { IAffiliationMods, IInventoryChanges } from "../../types/purchaseTypes.ts";
7 7 import { getEntriesUnsafe } from "../../utils/ts-utils.ts";
8 8 import { logger } from "../../utils/logger.ts";
9 9
@@ -14,15 +14,17 @@ export const updateChallengeProgressController: RequestHandler = async (req, res
14 14
15 15 const inventory = await getInventory(
16 16 account._id.toString(),
17 "ChallengesFixVersion ChallengeProgress SeasonChallengeHistory Affiliations CalendarProgress nightwaveStandingMultiplier"
17 "ChallengesFixVersion ChallengeProgress SeasonChallengeHistory Affiliations CalendarProgress nightwaveStandingMultiplier FlavourItems"
18 18 );
19 19 let affiliationMods: IAffiliationMods[] = [];
20 const inventoryChanges: IInventoryChanges = {};
20 21 if (challenges.ChallengeProgress) {
21 22 affiliationMods = await addChallenges(
22 23 account,
23 24 inventory,
24 25 challenges.ChallengeProgress,
25 challenges.SeasonChallengeCompletions
26 challenges.SeasonChallengeCompletions,
27 inventoryChanges
26 28 );
27 29 }
28 30 for (const [key, value] of getEntriesUnsafe(challenges)) {
@@ -62,7 +64,8 @@ export const updateChallengeProgressController: RequestHandler = async (req, res
62 64 await inventory.save();
63 65
64 66 res.json({
65 AffiliationMods: affiliationMods
67 AffiliationMods: affiliationMods,
68 InventoryChanges: inventoryChanges // U41+
66 69 });
67 70 };
68 71
Modified src/services/inventoryService.ts +14 -2
@@ -2206,7 +2206,8 @@ export const addChallenges = async (
2206 2206 account: TAccountDocument,
2207 2207 inventory: TInventoryDatabaseDocument,
2208 2208 ChallengeProgress: IChallengeProgress[],
2209 SeasonChallengeCompletions: ISeasonChallenge[] | undefined
2209 SeasonChallengeCompletions: ISeasonChallenge[] | undefined,
2210 inventoryChanges: IInventoryChanges
2210 2211 ): Promise<IAffiliationMods[]> => {
2211 2212 for (const { Name, Progress, Completed } of ChallengeProgress) {
2212 2213 let dbChallenge = inventory.ChallengeProgress.find(x => x.Name == Name);
@@ -2228,10 +2229,21 @@ export const addChallenges = async (
2228 2229 dbChallenge.Completed.push(completion);
2229 2230 if (completion == "challengeRewards") {
2230 2231 if (Name in challengeRewardsInboxMessages) {
2232 logger.debug(`did a challenge for evolving armour, sending inbox message`);
2231 2233 await createMessage(account._id, [challengeRewardsInboxMessages[Name]]);
2232 // Would love to somehow let the client know about inbox or inventory changes, but there doesn't seem to anything for updateChallengeProgress.
2233 2234 continue;
2234 2235 }
2236 if (`/Lotus/Types/Challenges/Titles/${Name}` in ExportChallenges) {
2237 if (ExportChallenges[`/Lotus/Types/Challenges/Titles/${Name}`].countedRewards) {
2238 const titleType = fromStoreItem(
2239 ExportChallenges[`/Lotus/Types/Challenges/Titles/${Name}`].countedRewards![0]
2240 .StoreItem
2241 );
2242 logger.debug(`${Name} completed, giving ${titleType}`);
2243 addCustomization(inventory, titleType, inventoryChanges);
2244 continue;
2245 }
2246 }
2235 2247 logger.warn(`ignoring unknown challenge completion`, { challenge: Name, completion });
2236 2248 dbChallenge.Progress = 0;
2237 2249 dbChallenge.Completed = [];
Modified src/services/missionInventoryUpdateService.ts +7 -1
@@ -343,7 +343,13 @@ export const addMissionInventoryUpdates = async (
343 343 addRecipes(inventory, value);
344 344 break;
345 345 case "ChallengeProgress":
346 await addChallenges(account, inventory, value, inventoryUpdates.SeasonChallengeCompletions);
346 await addChallenges(
347 account,
348 inventory,
349 value,
350 inventoryUpdates.SeasonChallengeCompletions,
351 inventoryChanges
352 );
347 353 break;
348 354 case "FusionTreasures":
349 355 addFusionTreasures(inventory, value);