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: elion workaround alert (#4197)

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

341042ab
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

5 个文件 +45 -5
Modified src/controllers/dynamic/worldStateController.ts +34 -4
@@ -7,26 +7,56 @@ import {
7 7 } from "../../services/worldStateService.ts";
8 8 import { getAccountForRequest, getBuildLabel } from "../../services/loginService.ts";
9 9 import { BL_LATEST } from "../../constants/gameVersions.ts";
10 import { getInventory2 } from "../../services/inventoryService.ts";
10 11
11 12 export const worldStateController: RequestHandler = async (req, res) => {
12 13 let buildLabel: string;
13 if (typeof req.query.buildLabel == "string") {
14 buildLabel = req.query.buildLabel.replaceAll(" ", "+");
15 } else if (req.query.accountId) {
14 let elionWorkaroundNeeded = false;
15 if (req.query.accountId) {
16 16 const account = await getAccountForRequest(req);
17 17 buildLabel = getBuildLabel(req, account);
18 if (buildLabel == "2013.07.04.20.17/") {
19 const inventory = await getInventory2(account._id, "Missions");
20 if (
21 !inventory.Missions.some(x => x.Tag == "SolNode12" && x.Completes > 0) && // Not done Elion yet?
22 (inventory.Missions.find(x => x.Tag == "SolNode119")?.Completes ?? 0) > 0 // but have done Caloris (mission before Elion)?
23 ) {
24 elionWorkaroundNeeded = true; // User is gonna need help in this buildLabel
25 }
26 }
27 } else if (typeof req.query.buildLabel == "string") {
28 buildLabel = req.query.buildLabel.replaceAll(" ", "+");
18 29 } else {
19 30 buildLabel = BL_LATEST;
20 31 }
21 32
22 33 const worldState = getWorldState(buildLabel);
23
24 34 await Promise.all([
25 35 populateDailyDeal(worldState),
26 36 populateFeaturedGuilds(worldState),
27 37 populateFissures(worldState)
28 38 ]);
29 39
40 if (elionWorkaroundNeeded) {
41 worldState.Alerts.push({
42 _id: { $id: "e1i03119f130000000000000" },
43 Activation: { sec: 0, usec: 0 },
44 Expiry: { sec: 2000000000, usec: 0 },
45 MissionInfo: {
46 location: "SolNode12",
47 completeTag: "SolNode12",
48 missionType: "MT_RESCUE",
49 faction: "FC_GRINEER",
50 difficulty: 0.1,
51 levelOverride: "/Lotus/Levels/Proc/Corpus/CorpusLevel", // The issue seems to be with "/Lotus/Levels/Proc/Grineer/SimpleGrineerGalleonLevel" + MT_RESCUE, which Elion is, so this fixes it.
52 enemySpec: "/Lotus/Types/Game/GrineerSquadOne",
53 minEnemyLevel: 1,
54 maxEnemyLevel: 3,
55 descText: "Elion is bugged in this version. Use this alert to complete it instead!"
56 }
57 });
58 }
59
30 60 if (req.query.l) {
31 61 for (const event of worldState.Events) {
32 62 const msg = event.Messages.find(x => x.LanguageCode == req.query.l)?.Message ?? event.Msg;
Modified src/services/inventoryService.ts +4 -1
@@ -2765,7 +2765,10 @@ export const addKahlProgress = (
2765 2765 }
2766 2766 };
2767 2767
2768 export const addMissionComplete = (inventory: TInventoryDatabaseDocument, { Tag, Completes, Tier }: IMission): void => {
2768 export const addMissionComplete = (
2769 inventory: Pick<TInventoryDatabaseDocument, "Missions">,
2770 { Tag, Completes, Tier }: IMission
2771 ): void => {
2769 2772 const { Missions } = inventory;
2770 2773 const itemIndex = Missions.findIndex(item => item.Tag === Tag);
2771 2774
Modified src/services/missionInventoryUpdateService.ts +5 -0
@@ -377,6 +377,11 @@ export const addMissionInventoryUpdates = async (
377 377 await ensureUserHasSteelPathRewards(inventory);
378 378 }
379 379 break;
380 case "CompletedAlerts":
381 if (value.indexOf("e1i03119f130000000000000") != -1) {
382 addMissionComplete(inventory, { Tag: "SolNode12", Completes: 1 });
383 }
384 break;
380 385 case "LastRegionPlayed":
381 386 if (!(config.unfaithfulBugFixes?.ignore1999LastRegionPlayed && value === "1999MapName")) {
382 387 inventory.LastRegionPlayed = value;
Modified src/types/requestTypes.ts +1 -0
@@ -83,6 +83,7 @@ export type IMissionInventoryUpdateRequest = {
83 83 AliveTime: number;
84 84 MissionTime: number;
85 85 Missions?: IMission;
86 CompletedAlerts?: string[];
86 87 Alerts?: IMission;
87 88 LastRegionPlayed?: TSolarMapRegion;
88 89 GameModeId: number;
Modified src/types/worldStateTypes.ts +1 -0
@@ -96,6 +96,7 @@ export interface IAlert {
96 96
97 97 export interface IAlertMissionInfo {
98 98 location: string;
99 completeTag?: string; // (U7~U8) unsure what this is actually for as it does not seem to produce a Missions field in the updateInventory request either way
99 100 missionType: TMissionType;
100 101 faction: TFaction;
101 102 difficulty: number;