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: dynamically cycle ESO, holdfast bounties, hex bounties, & circuit choices (#643)

494f219d
Sainan <sainan@calamity.inc>
提交于

代码差异

2 个文件 +106 -30
Modified src/controllers/dynamic/worldStateController.ts +105 -9
@@ -1,16 +1,112 @@
1 1 import { RequestHandler } from "express";
2 import worldState from "@/static/fixed_responses/worldState.json";
2 import staticWorldState from "@/static/fixed_responses/worldState.json";
3 3 import buildConfig from "@/static/data/buildConfig.json";
4 import { IMongoDate, IOid } from "@/src/types/commonTypes";
4 5
5 const worldStateController: RequestHandler = (req, res) => {
6 const buildLabel: string =
7 typeof req.query.buildLabel == "string" ? req.query.buildLabel.split(" ").join("+") : buildConfig.buildLabel;
8
9 res.json({
10 ...worldState,
11 BuildLabel: buildLabel,
6 export const worldStateController: RequestHandler = (req, res) => {
7 const worldState: IWorldState = {
8 ...staticWorldState,
9 BuildLabel:
10 typeof req.query.buildLabel == "string"
11 ? req.query.buildLabel.split(" ").join("+")
12 : buildConfig.buildLabel,
12 13 Time: Math.round(Date.now() / 1000)
14 };
15
16 const week = Math.trunc(new Date().getTime() / 604800000);
17
18 // Elite Sanctuary Onslaught cycling every week
19 worldState.NodeOverrides.push({
20 _id: { $oid: "5ad9f9bb6df82a56eabf3d44" },
21 Node: "SolNode802",
22 Seed: week // unfaithful
13 23 });
24
25 // Holdfast & Hex bounties cycling every 2.5 hours; unfaithful implementation
26 const bountyCycle = Math.trunc(new Date().getTime() / 9000000);
27 const bountyCycleStart = bountyCycle * 9000000;
28 const bountyCycleEnd = bountyCycleStart + 9000000;
29 worldState.SyndicateMissions.push({
30 _id: { $oid: bountyCycleStart.toString(16) + "0000000000000029" },
31 Activation: { $date: { $numberLong: bountyCycleStart.toString() } },
32 Expiry: { $date: { $numberLong: bountyCycleEnd.toString() } },
33 Tag: "ZarimanSyndicate",
34 Seed: bountyCycle,
35 Nodes: []
36 });
37 worldState.SyndicateMissions.push({
38 _id: { $oid: bountyCycleStart.toString(16) + "0000000000000006" },
39 Activation: { $date: { $numberLong: bountyCycleStart.toString(10) } },
40 Expiry: { $date: { $numberLong: bountyCycleEnd.toString(10) } },
41 Tag: "HexSyndicate",
42 Seed: bountyCycle,
43 Nodes: []
44 });
45
46 // Circuit choices cycling every week
47 worldState.EndlessXpChoices.push({
48 Category: "EXC_NORMAL",
49 Choices: [
50 ["Nidus", "Octavia", "Harrow"],
51 ["Gara", "Khora", "Revenant"],
52 ["Garuda", "Baruuk", "Hildryn"],
53 ["Excalibur", "Trinity", "Ember"],
54 ["Loki", "Mag", "Rhino"],
55 ["Ash", "Frost", "Nyx"],
56 ["Saryn", "Vauban", "Nova"],
57 ["Nekros", "Valkyr", "Oberon"],
58 ["Hydroid", "Mirage", "Limbo"],
59 ["Mesa", "Chroma", "Atlas"],
60 ["Ivara", "Inaros", "Titania"]
61 ][week % 12]
62 });
63 worldState.EndlessXpChoices.push({
64 Category: "EXC_HARD",
65 Choices: [
66 ["Brunt", "Soma", "Vasto", "Solo", "Burston"],
67 ["Zylok", "Sibear", "Dread", "Despair", "Hate"],
68 ["Dera", "Sybaris", "Cestra", "Sicarus", "Okina"],
69 ["Braton", "Lato", "Skana", "Paris", "Kunai"],
70 ["Boar", "Gammacor", "Angstrum", "Gorgon", "Anku"],
71 ["Bo", "Latron", "Furis", "Furax", "Strun"],
72 ["Lex", "Magistar", "Boltor", "Bronco", "Dagger"],
73 ["Torid", "Toxocyst", "Ichor", "Miter", "Atomos"]
74 ][week % 8]
75 });
76
77 res.json(worldState);
14 78 };
15 79
16 export { worldStateController };
80 interface IWorldState {
81 BuildLabel: string;
82 Time: number;
83 SyndicateMissions: ISyndicateMission[];
84 NodeOverrides: INodeOverride[];
85 EndlessXpChoices: IEndlessXpChoice[];
86 }
87
88 interface ISyndicateMission {
89 _id: IOid;
90 Activation: IMongoDate;
91 Expiry: IMongoDate;
92 Tag: string;
93 Seed: number;
94 Nodes: string[];
95 }
96
97 interface INodeOverride {
98 _id: IOid;
99 Activation?: IMongoDate;
100 Expiry?: IMongoDate;
101 Node: string;
102 Hide?: boolean;
103 Seed?: number;
104 LevelOverride?: string;
105 Faction?: string;
106 CustomNpcEncounters?: string;
107 }
108
109 interface IEndlessXpChoice {
110 Category: string;
111 Choices: string[];
112 }
Modified static/fixed_responses/worldState.json +1 -21
@@ -479,22 +479,6 @@
479 479 "xpAmounts": [780, 780, 780, 780, 1540]
480 480 }
481 481 ]
482 },
483 {
484 "_id": { "$oid": "663a71c80000000000000029" },
485 "Activation": { "$date": { "$numberLong": "1715106248403" } },
486 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
487 "Tag": "ZarimanSyndicate",
488 "Seed": 99562,
489 "Nodes": []
490 },
491 {
492 "_id": { "$oid": "676b8d340000000000000006" },
493 "Activation": { "$date": { "$numberLong": "1735101748215" } },
494 "Expiry": { "$date": { "$numberLong": "2000000000000" } },
495 "Tag": "HexSyndicate",
496 "Seed": 33872,
497 "Nodes": []
498 482 }
499 483 ],
500 484 "ActiveMissions": [
@@ -690,7 +674,6 @@
690 674 { "_id": { "$oid": "549b18e9b029cef5991d6aec" }, "Node": "EuropaHUB", "Hide": true },
691 675 { "_id": { "$oid": "54a1737aeb658f6cbccf70ff" }, "Node": "ErisHUB", "Hide": true },
692 676 { "_id": { "$oid": "54a736ddec12f80bd6e9e326" }, "Node": "VenusHUB", "Hide": true },
693 { "_id": { "$oid": "5ad9f9bb6df82a56eabf3d44" }, "Node": "SolNode802", "Seed": 9969639 },
694 677 {
695 678 "_id": { "$oid": "5b8817c2bd4f253264d6aa91" },
696 679 "Node": "EarthHUB",
@@ -1103,10 +1086,7 @@
1103 1086 "ConstructionProjects": [],
1104 1087 "TwitchPromos": [],
1105 1088 "ExperimentRecommended": [],
1106 "EndlessXpChoices": [
1107 { "Category": "EXC_NORMAL", "Choices": ["Gara", "Khora", "Revenant"] },
1108 { "Category": "EXC_HARD", "Choices": ["Zylok", "Sibear", "Dread", "Despair", "Hate"] }
1109 ],
1089 "EndlessXpChoices": [],
1110 1090 "ForceLogoutVersion": 0,
1111 1091 "SeasonInfo": {
1112 1092 "Activation": { "$date": { "$numberLong": "1715796000000" } },