返回提交历史
Modified
config.json.example
+4
-1
Modified
src/controllers/dynamic/worldStateController.ts
+36
-0
Modified
src/services/configService.ts
+3
-0
Modified
static/fixed_responses/worldState/worldState.json
+1
-0
XFEstudio/XFESpaceNinjaServer
feat: config option for star days event (#1104)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1104 Co-authored-by: Sainan <sainan@calamity.inc> Co-committed-by: Sainan <sainan@calamity.inc>
6142b8d2
代码差异
4 个文件
+44
-1
@@ -35,5 +35,8 @@
35
35
"noDojoResearchCosts": true,
36
36
"noDojoResearchTime": true,
37
37
"fastClanAscension": true,
38
"spoofMasteryRank": -1
38
"spoofMasteryRank": -1,
39
"events": {
40
"starDays": true
41
}
39
42
}
@@ -7,6 +7,7 @@ import static1999WinterDays from "@/static/fixed_responses/worldState/1999_winte
7
7
import { buildConfig } from "@/src/services/buildConfigService";
8
8
import { IMongoDate, IOid } from "@/src/types/commonTypes";
9
9
import { unixTimesInMs } from "@/src/constants/timeConstants";
10
import { config } from "@/src/services/configService";
10
11
11
12
export const worldStateController: RequestHandler = (req, res) => {
12
13
const worldState: IWorldState = {
@@ -15,10 +16,28 @@ export const worldStateController: RequestHandler = (req, res) => {
15
16
? req.query.buildLabel.split(" ").join("+")
16
17
: buildConfig.buildLabel,
17
18
Time: Math.round(Date.now() / 1000),
19
Goals: [],
18
20
EndlessXpChoices: [],
19
21
...staticWorldState
20
22
};
21
23
24
if (config.events?.starDays) {
25
worldState.Goals.push({
26
_id: { $oid: "67a4dcce2a198564d62e1647" },
27
Activation: { $date: { $numberLong: "1738868400000" } },
28
Expiry: { $date: { $numberLong: "2000000000000" } },
29
Count: 0,
30
Goal: 0,
31
Success: 0,
32
Personal: true,
33
Desc: "/Lotus/Language/Events/ValentinesFortunaName",
34
ToolTip: "/Lotus/Language/Events/ValentinesFortunaName",
35
Icon: "/Lotus/Interface/Icons/WorldStatePanel/ValentinesEventIcon.png",
36
Tag: "FortunaValentines",
37
Node: "SolarisUnitedHub1"
38
});
39
}
40
22
41
const EPOCH = 1734307200 * 1000; // Monday, Dec 16, 2024 @ 00:00 UTC+0; should logically be winter in 1999 iteration 0
23
42
const day = Math.trunc((new Date().getTime() - EPOCH) / 86400000);
24
43
const week = Math.trunc(day / 7);
@@ -134,8 +153,10 @@ export const worldStateController: RequestHandler = (req, res) => {
134
153
};
135
154
136
155
interface IWorldState {
156
Version: number; // for goals
137
157
BuildLabel: string;
138
158
Time: number;
159
Goals: IGoal[];
139
160
SyndicateMissions: ISyndicateMission[];
140
161
NodeOverrides: INodeOverride[];
141
162
EndlessXpChoices: IEndlessXpChoice[];
@@ -143,6 +164,21 @@ interface IWorldState {
143
164
Tmp?: string;
144
165
}
145
166
167
interface IGoal {
168
_id: IOid;
169
Activation: IMongoDate;
170
Expiry: IMongoDate;
171
Count: number;
172
Goal: number;
173
Success: number;
174
Personal: boolean;
175
Desc: string;
176
ToolTip: string;
177
Icon: string;
178
Tag: string;
179
Node: string;
180
}
181
146
182
interface ISyndicateMission {
147
183
_id: IOid;
148
184
Activation: IMongoDate;
@@ -62,6 +62,9 @@ interface IConfig {
62
62
noDojoResearchTime?: boolean;
63
63
fastClanAscension?: boolean;
64
64
spoofMasteryRank?: number;
65
events?: {
66
starDays?: boolean;
67
};
65
68
}
66
69
67
70
interface ILoggerConfig {
@@ -1,4 +1,5 @@
1
1
{
2
"Version": 10,
2
3
"Events": [
3
4
{
4
5
"Msg": "Join the OpenWF Discord!",