forked from OpenWF/SpaceNinjaServer
		
	feat: worldState.duviriOverride config (#2206)
Closes #2205 Reviewed-on: OpenWF/SpaceNinjaServer#2206 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									e136c0494e
								
							
						
					
					
						commit
						05382beaaf
					
				@ -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
 | 
			
		||||
 | 
			
		||||
@ -58,6 +58,7 @@
 | 
			
		||||
    "starDays": true,
 | 
			
		||||
    "eidolonOverride": "",
 | 
			
		||||
    "vallisOverride": "",
 | 
			
		||||
    "duviriOverride": "",
 | 
			
		||||
    "nightwaveOverride": "",
 | 
			
		||||
    "circuitGameModes": null
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
@ -64,6 +64,7 @@ export interface IConfig {
 | 
			
		||||
        starDays?: boolean;
 | 
			
		||||
        eidolonOverride?: string;
 | 
			
		||||
        vallisOverride?: string;
 | 
			
		||||
        duviriOverride?: string;
 | 
			
		||||
        nightwaveOverride?: string;
 | 
			
		||||
        circuitGameModes?: string[];
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user