forked from OpenWF/SpaceNinjaServer
		
	feat: lock worldState time via config (#1361)
Reviewed-on: OpenWF/SpaceNinjaServer#1361 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
							
								
									a7899d1c18
								
							
						
					
					
						commit
						1bdc5126b3
					
				@ -12,3 +12,4 @@ To get an idea of what functionality you can expect to be missing [have a look t
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
- `logger.level` can be `fatal`, `error`, `warn`, `info`, `http`, `debug`, or `trace`.
 | 
					- `logger.level` can be `fatal`, `error`, `warn`, `info`, `http`, `debug`, or `trace`.
 | 
				
			||||||
- `myIrcAddresses` can be used to point to an IRC server. If not provided, defaults to `[ myAddress ]`.
 | 
					- `myIrcAddresses` can be used to point to an IRC server. If not provided, defaults to `[ myAddress ]`.
 | 
				
			||||||
 | 
					- `worldState.lockTime` will lock the time provided in worldState if nonzero, e.g. `1743202800` for night in POE.
 | 
				
			||||||
 | 
				
			|||||||
@ -38,10 +38,11 @@
 | 
				
			|||||||
  "noDojoResearchTime": false,
 | 
					  "noDojoResearchTime": false,
 | 
				
			||||||
  "fastClanAscension": false,
 | 
					  "fastClanAscension": false,
 | 
				
			||||||
  "spoofMasteryRank": -1,
 | 
					  "spoofMasteryRank": -1,
 | 
				
			||||||
  "events": {
 | 
					  "worldState": {
 | 
				
			||||||
    "creditBoost": false,
 | 
					    "creditBoost": false,
 | 
				
			||||||
    "affinityBoost": false,
 | 
					    "affinityBoost": false,
 | 
				
			||||||
    "resourceBoost": false,
 | 
					    "resourceBoost": false,
 | 
				
			||||||
    "starDays": true
 | 
					    "starDays": true,
 | 
				
			||||||
 | 
					    "lockTime": 0
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,7 @@ export const worldStateController: RequestHandler = (req, res) => {
 | 
				
			|||||||
            typeof req.query.buildLabel == "string"
 | 
					            typeof req.query.buildLabel == "string"
 | 
				
			||||||
                ? req.query.buildLabel.split(" ").join("+")
 | 
					                ? req.query.buildLabel.split(" ").join("+")
 | 
				
			||||||
                : buildConfig.buildLabel,
 | 
					                : buildConfig.buildLabel,
 | 
				
			||||||
        Time: Math.round(Date.now() / 1000),
 | 
					        Time: config.worldState?.lockTime || Math.round(Date.now() / 1000),
 | 
				
			||||||
        Goals: [],
 | 
					        Goals: [],
 | 
				
			||||||
        GlobalUpgrades: [],
 | 
					        GlobalUpgrades: [],
 | 
				
			||||||
        LiteSorties: [],
 | 
					        LiteSorties: [],
 | 
				
			||||||
@ -68,7 +68,7 @@ export const worldStateController: RequestHandler = (req, res) => {
 | 
				
			|||||||
        ...staticWorldState
 | 
					        ...staticWorldState
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (config.events?.starDays) {
 | 
					    if (config.worldState?.starDays) {
 | 
				
			||||||
        worldState.Goals.push({
 | 
					        worldState.Goals.push({
 | 
				
			||||||
            _id: { $oid: "67a4dcce2a198564d62e1647" },
 | 
					            _id: { $oid: "67a4dcce2a198564d62e1647" },
 | 
				
			||||||
            Activation: { $date: { $numberLong: "1738868400000" } },
 | 
					            Activation: { $date: { $numberLong: "1738868400000" } },
 | 
				
			||||||
@ -117,7 +117,7 @@ export const worldStateController: RequestHandler = (req, res) => {
 | 
				
			|||||||
        Nodes: []
 | 
					        Nodes: []
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (config.events?.creditBoost) {
 | 
					    if (config.worldState?.creditBoost) {
 | 
				
			||||||
        worldState.GlobalUpgrades.push({
 | 
					        worldState.GlobalUpgrades.push({
 | 
				
			||||||
            _id: { $oid: "5b23106f283a555109666672" },
 | 
					            _id: { $oid: "5b23106f283a555109666672" },
 | 
				
			||||||
            Activation: { $date: { $numberLong: "1740164400000" } },
 | 
					            Activation: { $date: { $numberLong: "1740164400000" } },
 | 
				
			||||||
@ -129,7 +129,7 @@ export const worldStateController: RequestHandler = (req, res) => {
 | 
				
			|||||||
            LocalizeDescTag: ""
 | 
					            LocalizeDescTag: ""
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (config.events?.affinityBoost) {
 | 
					    if (config.worldState?.affinityBoost) {
 | 
				
			||||||
        worldState.GlobalUpgrades.push({
 | 
					        worldState.GlobalUpgrades.push({
 | 
				
			||||||
            _id: { $oid: "5b23106f283a555109666673" },
 | 
					            _id: { $oid: "5b23106f283a555109666673" },
 | 
				
			||||||
            Activation: { $date: { $numberLong: "1740164400000" } },
 | 
					            Activation: { $date: { $numberLong: "1740164400000" } },
 | 
				
			||||||
@ -141,7 +141,7 @@ export const worldStateController: RequestHandler = (req, res) => {
 | 
				
			|||||||
            LocalizeDescTag: ""
 | 
					            LocalizeDescTag: ""
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (config.events?.resourceBoost) {
 | 
					    if (config.worldState?.resourceBoost) {
 | 
				
			||||||
        worldState.GlobalUpgrades.push({
 | 
					        worldState.GlobalUpgrades.push({
 | 
				
			||||||
            _id: { $oid: "5b23106f283a555109666674" },
 | 
					            _id: { $oid: "5b23106f283a555109666674" },
 | 
				
			||||||
            Activation: { $date: { $numberLong: "1740164400000" } },
 | 
					            Activation: { $date: { $numberLong: "1740164400000" } },
 | 
				
			||||||
 | 
				
			|||||||
@ -64,11 +64,12 @@ interface IConfig {
 | 
				
			|||||||
    noDojoResearchTime?: boolean;
 | 
					    noDojoResearchTime?: boolean;
 | 
				
			||||||
    fastClanAscension?: boolean;
 | 
					    fastClanAscension?: boolean;
 | 
				
			||||||
    spoofMasteryRank?: number;
 | 
					    spoofMasteryRank?: number;
 | 
				
			||||||
    events?: {
 | 
					    worldState?: {
 | 
				
			||||||
        creditBoost?: boolean;
 | 
					        creditBoost?: boolean;
 | 
				
			||||||
        affinityBoost?: boolean;
 | 
					        affinityBoost?: boolean;
 | 
				
			||||||
        resourceBoost?: boolean;
 | 
					        resourceBoost?: boolean;
 | 
				
			||||||
        starDays?: boolean;
 | 
					        starDays?: boolean;
 | 
				
			||||||
 | 
					        lockTime?: number;
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user