//Upgraded copy of Run.Start public void LoadData() { if (trialArtifact != -1) { ArtifactTrialMissionController.trialArtifact = ArtifactCatalog.GetArtifactDef((ArtifactIndex)trialArtifact); } var instance = Run.instance; instance.seed = ulong.Parse(seed); instance.selectedDifficulty = (DifficultyIndex)difficulty; instance.fixedTime = fixedTime; instance.shopPortalCount = shopPortalCount; var stopwatch = instance.GetFieldValue <Run.RunStopwatch>("runStopwatch"); stopwatch.offsetFromFixedTime = offsetFromFixedTime; stopwatch.isPaused = isPaused; instance.SetFieldValue("runStopwatch", stopwatch); if (NetworkServer.active) { runRng.LoadData(instance); instance.InvokeMethod("GenerateStageRNG"); typeof(Run).GetMethod("PopulateValidStages", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, null); } instance.SetFieldValue("allowNewParticipants", true); UnityEngine.Object.DontDestroyOnLoad(instance.gameObject); var onlyInstancesList = NetworkUser.readOnlyInstancesList; for (int index = 0; index < onlyInstancesList.Count; ++index) { instance.OnUserAdded(onlyInstancesList[index]); } instance.SetFieldValue("allowNewParticipants", false); if (NetworkServer.active) { instance.nextStageScene = SceneCatalog.GetSceneDefFromSceneName(nextSceneName); NetworkManager.singleton.ServerChangeScene(sceneName); ProperSave.Instance.StartCoroutine(WaitForSceneChange()); } itemMask.LoadData(out instance.availableItems); equipmentMask.LoadData(out instance.availableEquipment); instance.InvokeMethod("BuildUnlockAvailability"); instance.BuildDropTable(); foreach (var flag in eventFlags) { instance.SetEventFlag(flag); } if (typeof(Run).GetField("onRunStartGlobal", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null) is MulticastDelegate onRunStartGlobal && onRunStartGlobal != null) { foreach (var handler in onRunStartGlobal.GetInvocationList()) { handler.Method.Invoke(handler.Target, new object[] { instance }); } } }
//Upgraded copy of Run.Start public void LoadData() { if (trialArtifact != -1) { ArtifactTrialMissionController.trialArtifact = ArtifactCatalog.GetArtifactDef((ArtifactIndex)trialArtifact); } var instance = Run.instance; onRuleBookUpdateMethod.Invoke(instance, new object[] { instance.GetFieldValue <NetworkRuleBook>("networkRuleBookComponent") }); if (NetworkServer.active) { instance.seed = seed; instance.selectedDifficulty = (DifficultyIndex)difficulty; instance.fixedTime = fixedTime; instance.shopPortalCount = shopPortalCount; var stopwatch = instance.GetFieldValue <Run.RunStopwatch>("runStopwatch"); stopwatch.offsetFromFixedTime = offsetFromFixedTime; stopwatch.isPaused = isPaused; instance.SetFieldValue("runStopwatch", stopwatch); runRng.LoadData(instance); generateStageRNGMethod.Invoke(instance, null); } instance.SetFieldValue("allowNewParticipants", true); UnityEngine.Object.DontDestroyOnLoad(instance.gameObject); var onlyInstancesList = NetworkUser.readOnlyInstancesList; for (int index = 0; index < onlyInstancesList.Count; ++index) { instance.OnUserAdded(onlyInstancesList[index]); } instance.SetFieldValue("allowNewParticipants", false); if (NetworkServer.active) { instance.nextStageScene = SceneCatalog.GetSceneDefFromSceneName(nextSceneName); NetworkManager.singleton.ServerChangeScene(sceneName); } instance.stageClearCount = stageClearCount; itemMask.LoadData(out instance.availableItems); equipmentMask.LoadData(out instance.availableEquipment); buildUnlockAvailabilityMethod.Invoke(instance, null); instance.BuildDropTable(); foreach (var flag in eventFlags) { instance.SetEventFlag(flag); } if (onRunStartGlobalDelegate.GetValue(null) is MulticastDelegate onRunStartGlobal && onRunStartGlobal != null) { foreach (var handler in onRunStartGlobal.GetInvocationList()) { handler.Method.Invoke(handler.Target, new object[] { instance }); } } }