public void OpenScreen(CoopSteamNGUI.Screens screen) { this.ClearLoadingAndError(); this._prevScreen = this._currentScreen; this._modalScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.ModalScreen && !ForestVR.Enabled); this._inviteReceivedScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.InviteReceivedScreen); this._lobbySetupScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.LobbySetup); this._lobbyScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.Lobby); this._gameBrowserScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.GameBrowser); if (this._gameBrowserScreenDS._screen) { this._gameBrowserScreenDS._screen.SetActive(screen == CoopSteamNGUI.Screens.GameBrowserDS); } this._gameBrowserScreen._sources.SetActive(screen == CoopSteamNGUI.Screens.GameBrowser || screen == CoopSteamNGUI.Screens.GameBrowserDS); if (this._joinDsScreen._screen) { this._joinDsScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.JoinDS); } if (this._joinP2PScreen._screen) { this._joinP2PScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.JoinP2P); } this._currentScreen = screen; if (screen == CoopSteamNGUI.Screens.GameBrowser || screen == CoopSteamNGUI.Screens.GameBrowserDS) { this._previouslyPlayedServers = SaveSlotUtils.GetPreviouslyPlayedServers(); } }
private IEnumerator DelayedInviteReceived(CoopLobbyInfo lobby) { lobby.RequestData(); while (!lobby.Destroyed && (string.IsNullOrEmpty(lobby.Name) || string.IsNullOrEmpty(lobby.Guid) || this._inviteReceivedScreen._screen.activeSelf)) { lobby.UpdateData(); yield return(null); } if (lobby.Destroyed) { this._inviteReceivedScreen._screen.SetActive(false); yield break; } yield return(YieldPresets.WaitPointFiveSeconds); lobby.UpdateData(); Debug.Log(string.Concat(new string[] { "Received MP invite for lobby name='", lobby.Name, "', guid='", lobby.Guid, "'" })); this._currentInvitelobby = lobby; this._inviteReceivedScreen._continueSaveButton.isEnabled = SaveSlotUtils.GetPreviouslyPlayedServers().Contains(lobby.Guid); this._inviteReceivedScreen._gameName.text = lobby.Name; this.OpenScreen(CoopSteamNGUI.Screens.InviteReceivedScreen); yield break; }
public static bool HasMPCharacterSave() { string mpClientLocalPath = SaveSlotUtils.GetMpClientLocalPath(); string clientSaveFileName = PlayerSpawn.GetClientSaveFileName(); return(File.Exists(mpClientLocalPath + clientSaveFileName)); }
public static void ConvertToSlotSystem(string name, TitleScreen.GameSetup.PlayerModes mode) { string text = PlayerPrefsFile.GetPath(name); if (mode == TitleScreen.GameSetup.PlayerModes.Multiplayer) { text += "MP"; } if (File.Exists(text)) { string localSlotPath = SaveSlotUtils.GetLocalSlotPath(mode, TitleScreen.GameSetup.Slots.Slot1); if (!Directory.Exists(localSlotPath)) { Directory.CreateDirectory(localSlotPath); } File.Move(text, localSlotPath + name); } if (CoopSteamCloud.ShouldUseCloud() && CoopSteamCloud.CloudFileExist(name)) { Debug.Log("Converting cloud file: '" + name + "' to slot system"); byte[] buffer = CoopSteamCloud.CloudLoad(name); CoopSteamCloud.CloudDelete(name); if (CoopSteamCloud.CloudSave(SaveSlotUtils.GetCloudSlotPath() + name, buffer)) { Debug.Log(name + " converted successfully"); } else { Debug.Log(name + " update failed"); } } }
private void Launch() { CoopSteamManager.Initialize(); CoopPeerStarter.Dedicated = true; CoopPeerStarter.DedicatedHost = true; CoopLobby.SetActive(new CoopLobbyInfo(SteamGameServer.GetSteamID()) { Name = SteamDSConfig.ServerName, Joinable = true, MemberLimit = SteamDSConfig.ServerPlayers }); if (GameSetup.IsSavedGame) { SaveSlotUtils.LoadHostGameGUID(); } if (string.IsNullOrEmpty(CoopLobby.Instance.Info.Guid) || GameSetup.IsNewGame) { CoopLobby.Instance.SetGuid(Guid.NewGuid().ToString()); } SteamDSConfig.ServerGUID = CoopLobby.Instance.Info.Guid; GameSetup.SetMpType(MpTypes.Server); GameSetup.SetPlayerMode(PlayerModes.Multiplayer); FMOD_StudioSystem.ForceFmodOff = true; GameObject gameObject = new GameObject("CoopSteamServerStarter"); CoopSteamServerStarter coopSteamServerStarter = gameObject.AddComponent <CoopSteamServerStarter>(); coopSteamServerStarter.mapState = CoopPeerStarter.MapState.None; coopSteamServerStarter._async = this.loadAsync; UnityEngine.Object.DontDestroyOnLoad(gameObject); }
private static void LobbyCreated(LobbyCreated_t param) { Debug.Log(string.Concat(new object[] { "LobbyCreated param.m_eResult=", param.m_eResult, ", lobbyId=", param.m_ulSteamIDLobby })); try { if (param.m_eResult == EResult.k_EResultOK) { CSteamID cSteamID = new CSteamID(param.m_ulSteamIDLobby); if (cSteamID.IsValid()) { CoopLobbyInfo coopLobbyInfo = new CoopLobbyInfo(param.m_ulSteamIDLobby); coopLobbyInfo.IsOwner = true; coopLobbyInfo.Name = CoopLobbyManager.createValues.Name; coopLobbyInfo.MemberLimit = CoopLobbyManager.createValues.MemberLimit; CoopLobbyManager.LobbyMatchList_Result = new List <CoopLobbyInfo>(); CoopLobbyManager.LobbyMatchList_Result.Add(coopLobbyInfo); CoopLobby.SetActive(coopLobbyInfo); if (TitleScreen.StartGameSetup.Type == TitleScreen.GameSetup.InitTypes.Continue) { SaveSlotUtils.LoadHostGameGUID(); } if (CoopLobbyManager.createCallback != null) { try { CoopLobbyManager.createCallback(); } catch (Exception var_1_E2) { } } goto IL_10C; } } if (CoopLobbyManager.createFailCallback != null) { try { CoopLobbyManager.createFailCallback(); } catch (Exception var_2_106) { } } IL_10C :; } finally { CoopLobbyManager.createValues = null; CoopLobbyManager.createCallback = null; CoopLobbyManager.createFailCallback = null; } }
public static void NAAUpdateSaveSlot() { noAutoAggressionSaveSlot = noAutoAggressionMainSavePath + SaveSlotUtils.GetLocalSlotPath().Substring(SaveSlotUtils.GetLocalSlotPath().Length - 6); if (debugSaveSlot) { ModAPI.Log.Write("Current SaveSlot: " + noAutoAggressionSaveSlot); } }
public static string GetString(string name, string defaultValue = "", bool useSlots = true) { string path = ((!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath()) + name; if (!File.Exists(path)) { return(defaultValue); } return(File.ReadAllText(path)); }
public static void DeleteMpCharacter() { bool flag = PlayerSpawn.HasMPCharacterSave(); if (flag) { File.Delete(SaveSlotUtils.GetMpClientLocalPath() + PlayerSpawn.GetClientSaveFileName()); UnityEngine.Debug.Log("Deleted MP client local save"); } }
public static byte[] GetBytes(string name, byte[] defaultValue, bool useSlots = true) { string path = ((!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath()) + name; if (!File.Exists(path)) { return(defaultValue); } return(File.ReadAllBytes(path)); }
private void OpenScreen(CoopSteamNGUI.Screens screen) { this.ClearLoadingAndError(); this._prevScreen = this._currentScreen; this._modalScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.ModalScreen); this._inviteReceivedScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.InviteReceivedScreen); this._lobbySetupScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.LobbySetup); this._lobbyScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.Lobby); this._gameBrowserScreen._screen.SetActive(screen == CoopSteamNGUI.Screens.GameBrowser); this._currentScreen = screen; if (screen == CoopSteamNGUI.Screens.GameBrowser) { this._previouslyPlayedServers = SaveSlotUtils.GetPreviouslyPlayedServers(); } }
public void ToggleNextSteamUser() { if (!base.enabled) { int num = (int)Mathf.Repeat((float)(LoadSavesSteamUsers.Current + 1), (float)LoadSavesSteamUsers.SteamUserIDs.Length); if (LoadSavesSteamUsers.Current != num) { LoadSavesSteamUsers.Current = num; SaveSlotUtils.SetUserId(LoadSavesSteamUsers.SteamUserIDs[LoadSavesSteamUsers.Current].ToString()); this._label.text = LoadSavesSteamUsers.SteamUserNames[LoadSavesSteamUsers.Current]; this._routineStep = 0; this._nextRoutineStep = 0f; base.enabled = true; } } }
public static void DeleteKey(string name, bool useSlots = true) { string path = ((!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath()) + name; string filename = ((!useSlots) ? string.Empty : SaveSlotUtils.GetCloudSlotPath()) + name; bool flag = File.Exists(path); bool flag2 = CoopSteamCloud.CloudFileExist(filename); if (flag) { File.Delete(path); } if (flag2 && CoopSteamCloud.ShouldUseCloud()) { CoopSteamCloud.CloudDelete(filename); } }
private IEnumerator LoadMpCharacterDelayed() { yield return(null); if (!SaveGameManager.Instance.requiredObjects.Contains(this._playerPrefab)) { SaveGameManager.Instance.requiredObjects = new UnityEngine.Object[] { this._playerPrefab }; LevelSerializer.InitPrefabList(); } File.ReadAllBytes(SaveSlotUtils.GetMpClientLocalPath() + PlayerSpawn.GetClientSaveFileName()).LoadObjectTree(null); Debug.Log("Client player loaded from local file"); LocalPlayer.Rigidbody.useGravity = false; LocalPlayer.Rigidbody.isKinematic = true; yield break; }
private IEnumerator LoadImageRoutine() { string path = SaveSlotUtils.GetLocalSlotPath(this._slot); string thumbnailPath = path + "thumb.png"; if (File.Exists(thumbnailPath)) { string url = "file: WWW www = new WWW(url); yield return www; this._texture.mainTexture = www.texture; this._texture.mainTexture.mipMapBias = -0.5f; this._texture.enabled = true; } else if (!File.Exists(path + "__RESUME__")) { this._texture.enabled = false; } yield break; }
private IEnumerator DelayedServerInviteReceived(uint ip, ushort port) { this.QueryingIp = ip; ISteamMatchmakingPingResponse response = new ISteamMatchmakingPingResponse(new ISteamMatchmakingPingResponse.ServerResponded(this.ServerResponded), new ISteamMatchmakingPingResponse.ServerFailedToRespond(this.ServerFailedToRespond1)); HServerQuery query = SteamMatchmakingServers.PingServer(ip, port, response); while (SteamClientDSConfig.Server == null) { if (string.IsNullOrEmpty(this.invitedToIP)) { yield break; } yield return(null); } yield return(YieldPresets.WaitPointFiveSeconds); Debug.Log("Received DS invite for server name='" + SteamClientDSConfig.Server.GetServerName() + "'"); this._inviteReceivedScreen._continueSaveButton.isEnabled = SaveSlotUtils.GetPreviouslyPlayedServers().Contains(SteamClientDSConfig.Guid); this._inviteReceivedScreen._gameName.text = SteamClientDSConfig.Server.GetServerName(); this._inviteReceivedScreen._screen.SetActive(true); this._menu.SetActive(false); UICamera.hoveredObject = null; yield break; }
public static void SetBytes(string name, byte[] data, bool useSlots = true) { string text = (!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath(); string text2 = text + name; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } if (File.Exists(text2)) { string text3 = text2 + "prev"; if (File.Exists(text3)) { File.Delete(text3); } File.Move(text2, text3); } File.WriteAllBytes(text2, data); if (CoopSteamCloud.ShouldUseCloud()) { CoopSteamCloud.CloudSave(((!useSlots) ? string.Empty : SaveSlotUtils.GetCloudSlotPath()) + name, data); } }
public static void SaveMpCharacter(GameObject playerGO) { byte[] data = playerGO.SaveObjectTree(); data.WriteToFile(SaveSlotUtils.GetMpClientLocalPath() + PlayerSpawn.GetClientSaveFileName()); }
public static void SaveGame() { GameSetup.SetSlot((Slots)SteamDSConfig.GameSaveSlot); LevelSerializer.Checkpoint(); SaveSlotUtils.SaveHostGameGUID(); }
public void OnSlotSelection(Slots slotNum) { this._pendingConfirmationSlot = slotNum; if ((slotNum == GameSetup.Slot && SaveSlotUtils.UserId == GameSetup.SaveUserId && GameSetup.Init != InitTypes.New) || !SaveSlotUtils.HasLocalFile(slotNum, "__RESUME__")) { this.OnSlotConfirmed(); } else { this._confirmPanel.SetActive(true); base.gameObject.SetActive(false); } }
public static void SyncWithCloud(string name, TitleScreen.GameSetup.PlayerModes mode, TitleScreen.GameSetup.Slots slot) { string localSlotPath = SaveSlotUtils.GetLocalSlotPath(mode, slot); string path = localSlotPath + name; string filename = SaveSlotUtils.GetCloudSlotPath(mode, slot) + name; bool flag = File.Exists(path); bool flag2 = CoopSteamCloud.CloudFileExist(filename); long num = 0L; long num2 = 0L; if (flag2 && flag) { num = CoopSteamCloud.CloudTimestamp(filename); num2 = File.GetCreationTime(path).ToUnixTimestamp(); flag2 = (num > num2); flag = (num < num2); } if (flag2) { Debug.Log(string.Concat(new object[] { "Syncing ", mode, "/", slot, "/", name, " from cloud(", num, ") to local(", num2, ")" })); if (!Directory.Exists(localSlotPath)) { Directory.CreateDirectory(localSlotPath); } File.WriteAllBytes(path, CoopSteamCloud.CloudLoad(filename)); File.SetCreationTime(path, DateEx.UnixTimeStampToDateTime(num)); Debug.Log(string.Concat(new object[] { "Local file (", name, ") Creation Time: ", File.GetCreationTime(path).ToUnixTimestamp(), " - ", num, " = ", File.GetCreationTime(path).ToUnixTimestamp() - num, "?" })); } else if (flag) { byte[] buffer = File.ReadAllBytes(path); bool flag3 = CoopSteamCloud.CloudSave(filename, buffer); Debug.Log(string.Concat(new object[] { "Cloud file (", name, ") Creation time: ", CoopSteamCloud.CloudTimestamp(filename), " - ", File.GetCreationTime(path).ToUnixTimestamp(), " = ", CoopSteamCloud.CloudTimestamp(filename) - File.GetCreationTime(path).ToUnixTimestamp(), "?" })); } }
private void LoadStats() { string localSlotPath = SaveSlotUtils.GetLocalSlotPath(this._slot); string path = localSlotPath + "info"; if (!File.Exists(localSlotPath + "__RESUME__")) { this._labelSlot.text = UiTranslationDatabase.TranslateKey("SLOT_" + this._slotNum, "Slot " + this._slotNum, false); if (this._labelStat) { this._labelStat.gameObject.SetActive(false); } if (this._labelDateTime) { this._labelDateTime.gameObject.SetActive(false); } if (Application.loadedLevelName.Equals("TitleScene")) { base.transform.parent.GetComponent<Collider>().enabled = false; } } else { base.transform.parent.GetComponent<Collider>().enabled = true; try { if (File.Exists(path)) { GameStats.Stats gameStats = GameStats.Stats.LoadFromBytes(File.ReadAllBytes(path)); this._labelSlot.text = UiTranslationDatabase.TranslateKey("SLOT_" + this._slotNum, "Slot " + this._slotNum, false) + UiTranslationDatabase.TranslateKey("_DAY_", ": day ", false) + gameStats._day; if (this._labelStat) { FieldInfo[] array = (from f in gameStats.GetType().GetFields() where (int)f.GetValue(gameStats) > 0 select f).ToArray<FieldInfo>(); if (array != null && array.Length > 0) { int num = UnityEngine.Random.Range(0, array.Length); string name = array[num].Name; string text; switch (name) { case "_treeCutDown": text = "Trees Cut Down: "; goto IL_4BC; case "_enemiesKilled": text = "Enemies Killed: "; goto IL_4BC; case "_rabbitKilled": text = "Rabbits Killed: "; goto IL_4BC; case "_lizardKilled": text = "Lizards Killed: "; goto IL_4BC; case "_raccoonKilled": text = "Raccoons Killed: "; goto IL_4BC; case "_deerKilled": text = "Deer Killed: "; goto IL_4BC; case "_turtleKilled": text = "Turtles Killed: "; goto IL_4BC; case "_birdKilled": text = "Birds Killed: "; goto IL_4BC; case "_cookedFood": text = "Cooked Food: "; goto IL_4BC; case "_burntFood": text = "Burnt Food: "; goto IL_4BC; case "_cancelledStructures": text = "Cancelled Structures: "; goto IL_4BC; case "_builtStructures": text = "Built Structures: "; goto IL_4BC; case "_destroyedStructures": text = "Destroyed Structures: "; goto IL_4BC; case "_repairedStructures": text = "Repaired Structures: "; goto IL_4BC; case "_edibleItemsUsed": text = "Edible Items Used: "; goto IL_4BC; case "_itemsCrafted": text = "Items Crafted: "; goto IL_4BC; case "_upgradesAdded": text = "Upgrades Added: "; goto IL_4BC; case "_arrowsFired": text = "Arrows Fired: "; goto IL_4BC; case "_litArrows": text = "Lit Arrows: "; goto IL_4BC; case "_litWeapons": text = "Lit Weapons: "; goto IL_4BC; case "_burntEnemies": text = "Burnt Enemies: "; goto IL_4BC; case "_explodedEnemies": text = "Exploded Enemies: "; goto IL_4BC; } text = string.Empty; IL_4BC: if (string.IsNullOrEmpty(text)) { this._labelStat.gameObject.SetActive(false); } else { this._labelStat.gameObject.SetActive(true); this._labelStat.text = text + array[num].GetValue(gameStats); } } else { this._labelStat.gameObject.SetActive(false); } } } else { this._labelSlot.text = "Slot " + this._slotNum; } } catch (Exception exception) { Debug.LogException(exception); } UILabel labelSlot = this._labelSlot; labelSlot.text += "\n"; try { string path2 = localSlotPath + "difficulty"; if (File.Exists(path2)) { string text2 = File.ReadAllText(path2); if (text2 != null) { if (text2 == "Peaceful" || text2 == "Hard" || text2 == "HardSurvival" || text2 == "Creative" || text2 == "Normal") { string text3 = text2.ToUpper(); UILabel labelSlot2 = this._labelSlot; labelSlot2.text += UiTranslationDatabase.TranslateKey(text3, text3, false); } } } } catch (Exception ex) { } if (this._labelDateTime) { this._labelDateTime.text = File.GetLastWriteTime(localSlotPath + "__RESUME__").ToString(CultureInfo.CurrentCulture.DateTimeFormat); this._labelDateTime.gameObject.SetActive(true); } } }
private void Awake() { LoadSavesSteamUsers.Current = -1; if (Directory.Exists(Application.persistentDataPath)) { DirectoryInfo directoryInfo = new DirectoryInfo(Application.persistentDataPath); directoryInfo.Refresh(); IEnumerable <CSteamID> enumerable = from d in directoryInfo.GetDirectories() where d.Name.All((char c) => c >= '0' && c <= '9') select new CSteamID(Convert.ToUInt64(d.Name)); if (SteamManager.Initialized) { CSteamID steamID = SteamUser.GetSteamID(); if (!enumerable.Contains(steamID)) { enumerable = enumerable.Concat(new CSteamID[] { steamID }); } LoadSavesSteamUsers.Current = enumerable.IndexOf(steamID) - 1; LoadSavesSteamUsers.SteamUserNames = (from cs in enumerable select(cs.m_SteamID != 0UL) ? SteamFriends.GetFriendPersonaName(cs).ToUpperInvariant() : "ANONYMOUS").ToArray <string>(); } else { LoadSavesSteamUsers.SteamUserNames = (from cs in enumerable select(cs.m_SteamID != 0UL) ? cs.ToString() : "ANONYMOUS").ToArray <string>(); } LoadSavesSteamUsers.SteamUserIDs = enumerable.ToArray <CSteamID>(); } else { try { LoadSavesSteamUsers.SteamUserIDs = new CSteamID[] { SteamUser.GetSteamID() }; LoadSavesSteamUsers.SteamUserNames = new string[] { SteamFriends.GetPersonaName() }; } catch (Exception ex) { LoadSavesSteamUsers.SteamUserIDs = new CSteamID[] { new CSteamID(0UL) }; LoadSavesSteamUsers.SteamUserNames = new string[] { "ANONYMOUS" }; } } if (LoadSavesSteamUsers.SteamUserIDs.Count <CSteamID>() <= 1) { this._nextUserButton.SetActive(false); } LoadSavesSteamUsers.Current++; SaveSlotUtils.SetUserId(LoadSavesSteamUsers.SteamUserIDs[LoadSavesSteamUsers.Current].ToString()); this._label.text = LoadSavesSteamUsers.SteamUserNames[LoadSavesSteamUsers.Current]; base.enabled = false; }
public static bool KeyExist(string name) { return(File.Exists(SaveSlotUtils.GetLocalSlotPath() + name) || CoopSteamCloud.CloudFileExist(name + ((!BoltNetwork.isRunning) ? string.Empty : "MP"))); }
private TeleportMod() { path = SaveSlotUtils.GetLocalPath(); }
private static void LobbyCreated(LobbyCreated_t param) { Debug.Log(string.Concat(new object[] { "LobbyCreated param.m_eResult=", param.m_eResult, ", lobbyId=", param.m_ulSteamIDLobby })); try { if (param.m_eResult == EResult.k_EResultOK) { CSteamID csteamID = new CSteamID(param.m_ulSteamIDLobby); if (csteamID.IsValid()) { CoopLobbyInfo coopLobbyInfo = new CoopLobbyInfo(param.m_ulSteamIDLobby); coopLobbyInfo.IsOwner = true; coopLobbyInfo.Name = CoopLobbyManager.createValues.Name; coopLobbyInfo.MemberLimit = CoopLobbyManager.createValues.MemberLimit; CoopLobbyManager.LobbyMatchList_Result = new List <CoopLobbyInfo>(); CoopLobbyManager.LobbyMatchList_Result.Add(coopLobbyInfo); CoopLobby.SetActive(coopLobbyInfo); if (GameSetup.IsSavedGame) { SaveSlotUtils.LoadHostGameGUID(); } if (CoopLobbyManager.createCallback != null) { try { CoopLobbyManager.createCallback(); } catch (Exception exception) { BoltLog.Exception(exception); } } goto IL_112; } } if (CoopLobbyManager.createFailCallback != null) { try { CoopLobbyManager.createFailCallback(); } catch (Exception exception2) { BoltLog.Exception(exception2); } } IL_112 :; } finally { CoopLobbyManager.createValues = null; CoopLobbyManager.createCallback = null; CoopLobbyManager.createFailCallback = null; } }
public static void Recv(string command, string data, BoltConnection source) { if (CoopPeerStarter.DedicatedHost && source.IsDedicatedServerAdmin() && command != null) { if (CoopAdminCommand.< > f__switch$map2 == null) { CoopAdminCommand.< > f__switch$map2 = new Dictionary <string, int>(12) { { "save", 0 }, { "restart", 1 }, { "shutdown", 2 }, { "openlogs", 3 }, { "closelogs", 4 }, { "kick", 5 }, { "ban", 6 }, { "unban", 7 }, { "treeregrowmode", 8 }, { "allowbuildingdestruction", 9 }, { "allowenemiescreative", 10 }, { "allowcheats", 11 } }; } int num; if (CoopAdminCommand.< > f__switch$map2.TryGetValue(command, out num)) { switch (num) { case 0: { int slot; if (!string.IsNullOrEmpty(data) && int.TryParse(data, out slot)) { GameSetup.SetSlot((Slots)slot); } LevelSerializer.Checkpoint(); SaveSlotUtils.SaveHostGameGUID(); CoopAdminCommand.SendNetworkMessage("Game saved to slot " + (int)GameSetup.Slot, source); break; } case 1: CoopAdminCommand.SendNetworkMessageAll("Server shuting down for restart, please reconnect."); TheForest.Utils.Scene.ActiveMB.StartCoroutine(CoopAdminCommand.ShutDownRoutine(true)); break; case 2: CoopAdminCommand.SendNetworkMessageAll("Server is shuting down (no restart)"); TheForest.Utils.Scene.ActiveMB.StartCoroutine(CoopAdminCommand.ShutDownRoutine(false)); break; case 3: if (!SteamDSConfig.ShowLogs) { ConsoleWriter.Open(); if (CoopAdminCommand.< > f__mg$cache0 == null) { CoopAdminCommand.< > f__mg$cache0 = new Application.LogCallback(CoopAdminCommand.Application_logMessageReceived); } Application.logMessageReceived += CoopAdminCommand.< > f__mg$cache0; SteamDSConfig.ShowLogs = true; CoopAdminCommand.SendNetworkMessage("Opened logs console", source); } else { CoopAdminCommand.SendNetworkMessage("Error: console already opened", source); } break; case 4: ConsoleWriter.Close(); if (CoopAdminCommand.< > f__mg$cache1 == null) { CoopAdminCommand.< > f__mg$cache1 = new Application.LogCallback(CoopAdminCommand.Application_logMessageReceived); } Application.logMessageReceived -= CoopAdminCommand.< > f__mg$cache1; SteamDSConfig.ShowLogs = false; CoopAdminCommand.SendNetworkMessage("Closed logs console", source); break; case 5: { ulong num2; if (ulong.TryParse(data, out num2)) { BoltEntity entityFromSteamID = MpPlayerList.GetEntityFromSteamID(num2); if (entityFromSteamID) { CoopKick.KickPlayer(entityFromSteamID, 1, "ADMIN_KICKED_YOU"); CoopAdminCommand.SendNetworkMessage("Kicked " + data, source); } else { CoopAdminCommand.SendNetworkMessage("Failed to kick " + data, source); } } else { BoltEntity entityFromName = MpPlayerList.GetEntityFromName(data, source); if (entityFromName) { CoopKick.KickPlayer(entityFromName, 1, "ADMIN_KICKED_YOU"); CoopAdminCommand.SendNetworkMessage("Kicked " + data, source); } else { CoopAdminCommand.SendNetworkMessage("Invalid SteamId or Name, kick failed (data=" + data + ")", source); } } break; } case 6: { ulong num2; if (ulong.TryParse(data, out num2)) { BoltEntity entityFromSteamID2 = MpPlayerList.GetEntityFromSteamID(num2); if (entityFromSteamID2) { CoopKick.BanPlayer(entityFromSteamID2); CoopAdminCommand.SendNetworkMessage("Banned " + data, source); } else { CoopAdminCommand.SendNetworkMessage("Failed to ban " + data, source); } } else { BoltEntity entityFromName2 = MpPlayerList.GetEntityFromName(data, source); if (entityFromName2) { CoopKick.BanPlayer(entityFromName2); CoopAdminCommand.SendNetworkMessage("Banned " + data, source); } else { CoopAdminCommand.SendNetworkMessage("Invalid SteamId or Name, ban failed (data=" + data + ")", source); } } break; } case 7: { ulong num2; if (ulong.TryParse(data, out num2)) { CoopKick.UnBanPlayer(num2); CoopAdminCommand.SendNetworkMessage("Unbanned " + data, source); } else if (CoopKick.UnBanPlayer(data)) { CoopAdminCommand.SendNetworkMessage("Unbanned " + data, source); } else { CoopAdminCommand.SendNetworkMessage("Invalid SteamId or Name, unban failed (data=" + data + ")", source); } break; } case 8: if (data == "on") { SteamDSConfig.TreeRegrowMode = true; PlayerPreferences.SetLocalTreeRegrowth(SteamDSConfig.TreeRegrowMode); CoopAdminCommand.SendNetworkMessage("TreeRegrowMode set to on", source); } else if (data == "off") { SteamDSConfig.TreeRegrowMode = false; PlayerPreferences.SetLocalTreeRegrowth(SteamDSConfig.TreeRegrowMode); CoopAdminCommand.SendNetworkMessage("TreeRegrowMode set to off", source); } else { CoopAdminCommand.SendNetworkMessage("Invalid parameter (data=" + data + ")", source); } break; case 9: if (data == "on") { SteamDSConfig.AllowBuildingDestruction = true; PlayerPreferences.SetLocalNoDestructionMode(!SteamDSConfig.AllowBuildingDestruction); CoopAdminCommand.SendNetworkMessage("allowbuildingdestruction set to on", source); } else if (data == "off") { SteamDSConfig.AllowBuildingDestruction = false; PlayerPreferences.SetLocalNoDestructionMode(!SteamDSConfig.AllowBuildingDestruction); CoopAdminCommand.SendNetworkMessage("allowbuildingdestruction set to off", source); } else { CoopAdminCommand.SendNetworkMessage("Invalid parameter (data=" + data + ")", source); } break; case 10: if (data == "on") { SteamDSConfig.AllowEnemiesCreative = true; PlayerPreferences.SetLocalAllowEnemiesCreativeMode(SteamDSConfig.AllowEnemiesCreative); CoopAdminCommand.SendNetworkMessage("AllowEnemiesCreative set to on", source); } else if (data == "off") { SteamDSConfig.AllowEnemiesCreative = false; PlayerPreferences.SetLocalAllowEnemiesCreativeMode(SteamDSConfig.AllowEnemiesCreative); CoopAdminCommand.SendNetworkMessage("AllowEnemiesCreative set to off", source); } else { CoopAdminCommand.SendNetworkMessage("Invalid parameter (data=" + data + ")", source); } break; case 11: if (data == "on") { SteamDSConfig.AllowCheats = true; PlayerPreferences.SetAllowCheatsMode(SteamDSConfig.AllowCheats); CoopAdminCommand.SendNetworkMessage("allowcheats set to on", source); } else if (data == "off") { SteamDSConfig.AllowCheats = false; PlayerPreferences.SetAllowCheatsMode(SteamDSConfig.AllowCheats); CoopAdminCommand.SendNetworkMessage("allowcheats set to off", source); } else { CoopAdminCommand.SendNetworkMessage("Invalid parameter (data=" + data + ")", source); } break; } } } }