forked from OpenWF/SpaceNinjaServer
		
	feat: unfaithful bug fixes (#2267)
Closes #2257 Reviewed-on: OpenWF/SpaceNinjaServer#2267 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
							
								
									122950034e
								
							
						
					
					
						commit
						9a034b1c8a
					
				@ -58,6 +58,10 @@
 | 
				
			|||||||
  "unlockAllSimarisResearchEntries": false,
 | 
					  "unlockAllSimarisResearchEntries": false,
 | 
				
			||||||
  "spoofMasteryRank": -1,
 | 
					  "spoofMasteryRank": -1,
 | 
				
			||||||
  "nightwaveStandingMultiplier": 1,
 | 
					  "nightwaveStandingMultiplier": 1,
 | 
				
			||||||
 | 
					  "unfaithfulBugFixes": {
 | 
				
			||||||
 | 
					    "ignore1999LastRegionPlayed": false,
 | 
				
			||||||
 | 
					    "fixXtraCheeseTimer": false
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
  "worldState": {
 | 
					  "worldState": {
 | 
				
			||||||
    "creditBoost": false,
 | 
					    "creditBoost": false,
 | 
				
			||||||
    "affinityBoost": false,
 | 
					    "affinityBoost": false,
 | 
				
			||||||
 | 
				
			|||||||
@ -65,6 +65,10 @@ export interface IConfig {
 | 
				
			|||||||
    unlockAllSimarisResearchEntries?: boolean;
 | 
					    unlockAllSimarisResearchEntries?: boolean;
 | 
				
			||||||
    spoofMasteryRank?: number;
 | 
					    spoofMasteryRank?: number;
 | 
				
			||||||
    nightwaveStandingMultiplier?: number;
 | 
					    nightwaveStandingMultiplier?: number;
 | 
				
			||||||
 | 
					    unfaithfulBugFixes?: {
 | 
				
			||||||
 | 
					        ignore1999LastRegionPlayed?: boolean;
 | 
				
			||||||
 | 
					        fixXtraCheeseTimer?: boolean;
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
    worldState?: {
 | 
					    worldState?: {
 | 
				
			||||||
        creditBoost?: boolean;
 | 
					        creditBoost?: boolean;
 | 
				
			||||||
        affinityBoost?: boolean;
 | 
					        affinityBoost?: boolean;
 | 
				
			||||||
 | 
				
			|||||||
@ -268,7 +268,9 @@ export const addMissionInventoryUpdates = async (
 | 
				
			|||||||
                addMissionComplete(inventory, value);
 | 
					                addMissionComplete(inventory, value);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case "LastRegionPlayed":
 | 
					            case "LastRegionPlayed":
 | 
				
			||||||
 | 
					                if (!(config.unfaithfulBugFixes?.ignore1999LastRegionPlayed && value === "1999MapName")) {
 | 
				
			||||||
                    inventory.LastRegionPlayed = value;
 | 
					                    inventory.LastRegionPlayed = value;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case "RawUpgrades":
 | 
					            case "RawUpgrades":
 | 
				
			||||||
                addMods(inventory, value);
 | 
					                addMods(inventory, value);
 | 
				
			||||||
 | 
				
			|||||||
@ -1325,6 +1325,17 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
 | 
				
			|||||||
    const cheeseInterval = hourInSeconds * 8;
 | 
					    const cheeseInterval = hourInSeconds * 8;
 | 
				
			||||||
    const cheeseDuration = hourInSeconds * 2;
 | 
					    const cheeseDuration = hourInSeconds * 2;
 | 
				
			||||||
    const cheeseIndex = Math.trunc(timeSecs / cheeseInterval);
 | 
					    const cheeseIndex = Math.trunc(timeSecs / cheeseInterval);
 | 
				
			||||||
 | 
					    let cheeseStart = cheeseIndex * cheeseInterval;
 | 
				
			||||||
 | 
					    let cheeseEnd = cheeseStart + cheeseDuration;
 | 
				
			||||||
 | 
					    let cheeseNext = (cheeseIndex + 1) * cheeseInterval;
 | 
				
			||||||
 | 
					    // Live servers only update the start time once it happens, which makes the
 | 
				
			||||||
 | 
					    // client show a negative countdown during off-hours. Optionally adjust the
 | 
				
			||||||
 | 
					    // times so the next activation is always in the future.
 | 
				
			||||||
 | 
					    if (config.unfaithfulBugFixes?.fixXtraCheeseTimer && timeSecs >= cheeseEnd) {
 | 
				
			||||||
 | 
					        cheeseStart = cheeseNext;
 | 
				
			||||||
 | 
					        cheeseEnd = cheeseStart + cheeseDuration;
 | 
				
			||||||
 | 
					        cheeseNext += cheeseInterval;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    const tmp: ITmp = {
 | 
					    const tmp: ITmp = {
 | 
				
			||||||
        cavabegin: "1690761600",
 | 
					        cavabegin: "1690761600",
 | 
				
			||||||
        PurchasePlatformLockEnabled: true,
 | 
					        PurchasePlatformLockEnabled: true,
 | 
				
			||||||
@ -1349,9 +1360,9 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
 | 
				
			|||||||
        ennnd: true,
 | 
					        ennnd: true,
 | 
				
			||||||
        mbrt: true,
 | 
					        mbrt: true,
 | 
				
			||||||
        fbst: {
 | 
					        fbst: {
 | 
				
			||||||
            a: cheeseIndex * cheeseInterval, // This has a bug where the client shows a negative time for "Xtra cheese starts in ..." until it refreshes the world state. This is because we're only providing the new activation as soon as that time/date is reached. However, this is 100% faithful to live.
 | 
					            a: cheeseStart,
 | 
				
			||||||
            e: cheeseIndex * cheeseInterval + cheeseDuration,
 | 
					            e: cheeseEnd,
 | 
				
			||||||
            n: (cheeseIndex + 1) * cheeseInterval
 | 
					            n: cheeseNext
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        sfn: [550, 553, 554, 555][halfHour % 4]
 | 
					        sfn: [550, 553, 554, 555][halfHour % 4]
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user