XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

feat: worldState.duviriOverride config (#2206)

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

05382bea
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

4 个文件 +24 -0
Modified README.md +1 -0
@@ -16,6 +16,7 @@ SpaceNinjaServer requires a `config.json`. To set it up, you can copy the [confi
16 16 - `myIrcAddresses` can be used to point to an IRC server. If not provided, defaults to `[ myAddress ]`.
17 17 - `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.
18 18 - `worldState.vallisOverride` can be set to `warm` or `cold` to lock the temperature on Orb Vallis.
19 - `worldState.duviriOverride` can be set to `joy`, `anger`, `envy`, `sorrow`, or `fear` to lock the Duviri spiral.
19 20 - `worldState.nightwaveOverride` will lock the nightwave season, assuming the client is new enough for it. Valid values:
20 21 - `RadioLegionIntermission13Syndicate` for Nora's Mix Vol. 9
21 22 - `RadioLegionIntermission12Syndicate` for Nora's Mix Vol. 8
Modified config.json.example +1 -0
@@ -58,6 +58,7 @@
58 58 "starDays": true,
59 59 "eidolonOverride": "",
60 60 "vallisOverride": "",
61 "duviriOverride": "",
61 62 "nightwaveOverride": "",
62 63 "circuitGameModes": null
63 64 },
Modified src/services/configService.ts +1 -0
@@ -64,6 +64,7 @@ export interface IConfig {
64 64 starDays?: boolean;
65 65 eidolonOverride?: string;
66 66 vallisOverride?: string;
67 duviriOverride?: string;
67 68 nightwaveOverride?: string;
68 69 circuitGameModes?: string[];
69 70 };
Modified src/services/worldStateService.ts +21 -0
@@ -1068,6 +1068,27 @@ const doesTimeSatsifyConstraints = (timeSecs: number): boolean => {
1068 1068 }
1069 1069 }
1070 1070
1071 if (config.worldState?.duviriOverride) {
1072 const duviriMoods = ["sorrow", "fear", "joy", "anger", "envy"];
1073 const desiredMood = duviriMoods.indexOf(config.worldState.duviriOverride);
1074 if (desiredMood == -1) {
1075 logger.warn(`ignoring invalid config value for worldState.duviriOverride`, {
1076 value: config.worldState.duviriOverride,
1077 valid_values: duviriMoods
1078 });
1079 } else {
1080 const moodIndex = Math.trunc(timeSecs / 7200);
1081 const moodStart = moodIndex * 7200;
1082 const moodEnd = moodStart + 7200;
1083 if (
1084 moodIndex % 5 != desiredMood ||
1085 isBeforeNextExpectedWorldStateRefresh(timeSecs * 1000, moodEnd * 1000)
1086 ) {
1087 return false;
1088 }
1089 }
1090 }
1091
1071 1092 return true;
1072 1093 };
1073 1094