diff --git a/README.md b/README.md index dc57e796..0bd7de22 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ SpaceNinjaServer requires a `config.json`. To set it up, you can copy the [confi - `myIrcAddresses` can be used to point to an IRC server. If not provided, defaults to `[ myAddress ]`. - `worldState.eidolonOverride` can be set to `day` or `night` to lock the time to day/fass and night/vome on Plains of Eidolon/Cambion Drift. - `worldState.vallisOverride` can be set to `warm` or `cold` to lock the temperature on Orb Vallis. +- `worldState.duviriOverride` can be set to `joy`, `anger`, `envy`, `sorrow`, or `fear` to lock the Duviri spiral. - `worldState.nightwaveOverride` will lock the nightwave season, assuming the client is new enough for it. Valid values: - `RadioLegionIntermission13Syndicate` for Nora's Mix Vol. 9 - `RadioLegionIntermission12Syndicate` for Nora's Mix Vol. 8 diff --git a/config.json.example b/config.json.example index 8f839751..4c5fafb5 100644 --- a/config.json.example +++ b/config.json.example @@ -58,6 +58,7 @@ "starDays": true, "eidolonOverride": "", "vallisOverride": "", + "duviriOverride": "", "nightwaveOverride": "", "circuitGameModes": null }, diff --git a/src/services/configService.ts b/src/services/configService.ts index 0c09eb23..a45645a2 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -64,6 +64,7 @@ export interface IConfig { starDays?: boolean; eidolonOverride?: string; vallisOverride?: string; + duviriOverride?: string; nightwaveOverride?: string; circuitGameModes?: string[]; }; diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index 5f2df857..8fa82eed 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -1068,6 +1068,27 @@ const doesTimeSatsifyConstraints = (timeSecs: number): boolean => { } } + if (config.worldState?.duviriOverride) { + const duviriMoods = ["sorrow", "fear", "joy", "anger", "envy"]; + const desiredMood = duviriMoods.indexOf(config.worldState.duviriOverride); + if (desiredMood == -1) { + logger.warn(`ignoring invalid config value for worldState.duviriOverride`, { + value: config.worldState.duviriOverride, + valid_values: duviriMoods + }); + } else { + const moodIndex = Math.trunc(timeSecs / 7200); + const moodStart = moodIndex * 7200; + const moodEnd = moodStart + 7200; + if ( + moodIndex % 5 != desiredMood || + isBeforeNextExpectedWorldStateRefresh(timeSecs * 1000, moodEnd * 1000) + ) { + return false; + } + } + } + return true; };