feat: config option for star days event (#1104)
All checks were successful
Build / build (20) (push) Successful in 39s
Build Docker image / docker (push) Successful in 32s
Build / build (18) (push) Successful in 1m2s
Build / build (22) (push) Successful in 54s

Reviewed-on: #1104
Co-authored-by: Sainan <sainan@calamity.inc>
Co-committed-by: Sainan <sainan@calamity.inc>
This commit is contained in:
Sainan 2025-03-08 04:28:05 -08:00 committed by OrdisPrime
parent 537fe5dcd1
commit 6142b8d2dc
4 changed files with 44 additions and 1 deletions

View File

@ -35,5 +35,8 @@
"noDojoResearchCosts": true, "noDojoResearchCosts": true,
"noDojoResearchTime": true, "noDojoResearchTime": true,
"fastClanAscension": true, "fastClanAscension": true,
"spoofMasteryRank": -1 "spoofMasteryRank": -1,
"events": {
"starDays": true
}
} }

View File

@ -7,6 +7,7 @@ import static1999WinterDays from "@/static/fixed_responses/worldState/1999_winte
import { buildConfig } from "@/src/services/buildConfigService"; import { buildConfig } from "@/src/services/buildConfigService";
import { IMongoDate, IOid } from "@/src/types/commonTypes"; import { IMongoDate, IOid } from "@/src/types/commonTypes";
import { unixTimesInMs } from "@/src/constants/timeConstants"; import { unixTimesInMs } from "@/src/constants/timeConstants";
import { config } from "@/src/services/configService";
export const worldStateController: RequestHandler = (req, res) => { export const worldStateController: RequestHandler = (req, res) => {
const worldState: IWorldState = { const worldState: IWorldState = {
@ -15,10 +16,28 @@ export const worldStateController: RequestHandler = (req, res) => {
? req.query.buildLabel.split(" ").join("+") ? req.query.buildLabel.split(" ").join("+")
: buildConfig.buildLabel, : buildConfig.buildLabel,
Time: Math.round(Date.now() / 1000), Time: Math.round(Date.now() / 1000),
Goals: [],
EndlessXpChoices: [], EndlessXpChoices: [],
...staticWorldState ...staticWorldState
}; };
if (config.events?.starDays) {
worldState.Goals.push({
_id: { $oid: "67a4dcce2a198564d62e1647" },
Activation: { $date: { $numberLong: "1738868400000" } },
Expiry: { $date: { $numberLong: "2000000000000" } },
Count: 0,
Goal: 0,
Success: 0,
Personal: true,
Desc: "/Lotus/Language/Events/ValentinesFortunaName",
ToolTip: "/Lotus/Language/Events/ValentinesFortunaName",
Icon: "/Lotus/Interface/Icons/WorldStatePanel/ValentinesEventIcon.png",
Tag: "FortunaValentines",
Node: "SolarisUnitedHub1"
});
}
const EPOCH = 1734307200 * 1000; // Monday, Dec 16, 2024 @ 00:00 UTC+0; should logically be winter in 1999 iteration 0 const EPOCH = 1734307200 * 1000; // Monday, Dec 16, 2024 @ 00:00 UTC+0; should logically be winter in 1999 iteration 0
const day = Math.trunc((new Date().getTime() - EPOCH) / 86400000); const day = Math.trunc((new Date().getTime() - EPOCH) / 86400000);
const week = Math.trunc(day / 7); const week = Math.trunc(day / 7);
@ -134,8 +153,10 @@ export const worldStateController: RequestHandler = (req, res) => {
}; };
interface IWorldState { interface IWorldState {
Version: number; // for goals
BuildLabel: string; BuildLabel: string;
Time: number; Time: number;
Goals: IGoal[];
SyndicateMissions: ISyndicateMission[]; SyndicateMissions: ISyndicateMission[];
NodeOverrides: INodeOverride[]; NodeOverrides: INodeOverride[];
EndlessXpChoices: IEndlessXpChoice[]; EndlessXpChoices: IEndlessXpChoice[];
@ -143,6 +164,21 @@ interface IWorldState {
Tmp?: string; Tmp?: string;
} }
interface IGoal {
_id: IOid;
Activation: IMongoDate;
Expiry: IMongoDate;
Count: number;
Goal: number;
Success: number;
Personal: boolean;
Desc: string;
ToolTip: string;
Icon: string;
Tag: string;
Node: string;
}
interface ISyndicateMission { interface ISyndicateMission {
_id: IOid; _id: IOid;
Activation: IMongoDate; Activation: IMongoDate;

View File

@ -62,6 +62,9 @@ interface IConfig {
noDojoResearchTime?: boolean; noDojoResearchTime?: boolean;
fastClanAscension?: boolean; fastClanAscension?: boolean;
spoofMasteryRank?: number; spoofMasteryRank?: number;
events?: {
starDays?: boolean;
};
} }
interface ILoggerConfig { interface ILoggerConfig {

View File

@ -1,4 +1,5 @@
{ {
"Version": 10,
"Events": [ "Events": [
{ {
"Msg": "Join the OpenWF Discord!", "Msg": "Join the OpenWF Discord!",