Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void ExecuteCommandRaw(string pCommand)
- {
- <ExecuteCommandRaw>c__AnonStoreyBA yba = new <ExecuteCommandRaw>c__AnonStoreyBA();
- pCommand = pCommand.Trim();
- string str = pCommand.ToLower();
- char[] separator = new char[] { ' ' };
- yba.splitList = str.Split(separator);
- char[] chArray2 = new char[] { ' ' };
- string[] strArray = pCommand.Split(chArray2);
- object[] args = new object[] { str };
- if (Interface.CallHook("OnRunCommand", args) == null)
- {
- Debug.Log("> " + pCommand + "\n");
- if (yba.splitList[0] == "connect")
- {
- try
- {
- if (yba.splitList[1].IndexOf(':') > 0)
- {
- char[] chArray3 = new char[] { ':' };
- string[] strArray2 = yba.splitList[1].Split(chArray3);
- int port = int.Parse(strArray2[1]);
- Singleton<GameManager>.Instance.Connect(strArray2[0], port);
- }
- else
- {
- Singleton<GameManager>.Instance.Connect(yba.splitList[1], 0x3247);
- }
- }
- catch
- {
- Debug.Log("Invalid format, host must be of the format 192.168.1.1:123");
- }
- }
- else if (yba.splitList[0] == "addadmin")
- {
- try
- {
- ulong ulSteamID = Convert.ToUInt64(yba.splitList[1]);
- Singleton<GameManager>.Instance.SetAdmin(new CSteamID(ulSteamID));
- Debug.Log("Admin user added");
- }
- catch
- {
- Debug.Log("Invalid format, you must enter steamid64 (use playerid to query)");
- }
- }
- else if (yba.splitList[0] == "testhost")
- {
- Singleton<GameManager>.Instance.Host(0x3247, null, "zonetest");
- }
- else if (yba.splitList[0] == "adminmessage")
- {
- if (Singleton<GameManager>.Instance.State == EGameState.Hosting)
- {
- Singleton<ChatManager>.Instance.AppendNotice(pCommand.Substring(13), Color.red);
- }
- }
- else if (yba.splitList[0] == "find")
- {
- foreach (MeshFilter filter in Object.FindObjectsOfType<MeshFilter>())
- {
- if (filter.sharedMesh == null)
- {
- Debug.Log("Found missing mesh ", filter.gameObject);
- }
- }
- }
- else if (yba.splitList[0] == "host")
- {
- try
- {
- int num4 = int.Parse(yba.splitList[1]);
- if (yba.splitList.Length > 3)
- {
- Singleton<GameManager>.Instance.Host(num4, yba.splitList[3], yba.splitList[2]);
- }
- else if (yba.splitList.Length > 2)
- {
- Singleton<GameManager>.Instance.Host(num4, null, yba.splitList[2]);
- }
- else if (yba.splitList.Length == 2)
- {
- Singleton<GameManager>.Instance.Host(num4, null, "DiemensLand");
- }
- else
- {
- Debug.Log("Invalid format. Expected: host <port> <map> <loadgame>");
- }
- }
- catch
- {
- Debug.Log("Invalid format. Expected: host <port> <map> <loadgame>");
- }
- }
- else if (yba.splitList[0] == "stockvehicles")
- {
- if (Network.isServer)
- {
- foreach (VehicleController4Wheel wheel in Object.FindObjectsOfType<VehicleController4Wheel>())
- {
- RestrictedInventory component = wheel.GetComponent<RestrictedInventory>();
- <ExecuteCommandRaw>c__AnonStoreyB7 yb = new <ExecuteCommandRaw>c__AnonStoreyB7();
- SlotRestriction[] restrictions = component.Restrictions;
- for (int i = 0; i < restrictions.Length; i++)
- {
- yb.slotRestriction = restrictions[i];
- if (component.Items[yb.slotRestriction.SlotNumber] == null)
- {
- IItem item = Singleton<GlobalItemManager>.Instance.GetItems().Values.FirstOrDefault<IItem>(new Func<IItem, bool>(yb.<>m__BA));
- if (item != null)
- {
- component.Items[yb.slotRestriction.SlotNumber] = new ItemInstance(item, item.MaxStackSize);
- }
- }
- component.Invalidate(false);
- }
- }
- }
- }
- else if (yba.splitList[0] == "freezetime")
- {
- if (Network.isServer)
- {
- int num7 = 0x15180;
- float dayPercentage = Singleton<TimeManager>.Instance.GetCurrentGameTime().DayPercentage;
- Singleton<TimeManager>.Instance.DayLength = 9999999f;
- Singleton<TimeManager>.Instance.NightLength = 9999999f;
- Singleton<TimeManager>.Instance.InitialTimeOffset = dayPercentage * num7;
- }
- else
- {
- Debug.LogError("SetTime must be executed on the server!");
- }
- }
- else if (yba.splitList[0] == "setbiome")
- {
- <ExecuteCommandRaw>c__AnonStoreyB8 yb2 = new <ExecuteCommandRaw>c__AnonStoreyB8 {
- biomeString = (yba.splitList.Length != 1) ? yba.splitList[1] : "None"
- };
- EBiomePreset preset = ((EBiomePreset[]) Enum.GetValues(typeof(EBiomePreset))).FirstOrDefault<EBiomePreset>(new Func<EBiomePreset, bool>(yb2.<>m__BB));
- if (BiomeManager.Instance != null)
- {
- BiomeManager.Instance.OverridePreset = preset;
- Debug.Log("Forcing biome " + preset.ToString());
- }
- }
- else if (yba.splitList[0] == "settime")
- {
- if (yba.splitList.Length != 0)
- {
- if (!Network.isServer)
- {
- Debug.LogError("SetTime must be executed on the server!");
- }
- else
- {
- try
- {
- int num9 = 0x15180;
- float num10 = float.Parse(yba.splitList[1]);
- float num11 = Singleton<TimeManager>.Instance.GetCurrentGameTime().DayPercentage;
- float initialTimeOffset = Singleton<TimeManager>.Instance.InitialTimeOffset;
- float num13 = ((num10 - num11) * num9) + initialTimeOffset;
- Singleton<TimeManager>.Instance.InitialTimeOffset = num13;
- }
- catch
- {
- Debug.Log("format settime <percentage through the day(0.5)>");
- }
- }
- }
- }
- else if (yba.splitList[0] == "lowlod")
- {
- <ExecuteCommandRaw>c__AnonStoreyB9 yb3 = new <ExecuteCommandRaw>c__AnonStoreyB9();
- CharacterAnimationInputs[] source = Object.FindObjectsOfType<CharacterAnimationInputs>();
- yb3.lowLod = yba.splitList[1] == "1";
- if (<>f__am$cache6 == null)
- {
- <>f__am$cache6 = x => !x.networkView.isMine;
- }
- source.Where<CharacterAnimationInputs>(<>f__am$cache6).ToList<CharacterAnimationInputs>().ForEach(new Action<CharacterAnimationInputs>(yb3.<>m__BD));
- Debug.Log(string.Concat(new object[] { "Set ", source.Length - 1, " players to ", !yb3.lowLod ? "High" : "Low", " lod" }));
- }
- else if (yba.splitList[0] == "autobackupinterval")
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("autobackupinterval = " + Singleton<GameManager>.Instance.ServerConfig.AutoBackupInterval);
- }
- else
- {
- try
- {
- float num14 = float.Parse(yba.splitList[1]);
- Singleton<GameManager>.Instance.ServerConfig.AutoBackupInterval = num14;
- }
- catch
- {
- Debug.Log("format: autobackupinterval <seconds>");
- }
- }
- }
- else if (yba.splitList[0] == "expandpools")
- {
- try
- {
- int amount = int.Parse(yba.splitList[1]);
- base.StartCoroutine(this.ExpandPools(amount));
- }
- catch (Exception)
- {
- Debug.Log("Must supply a number");
- }
- }
- else if (yba.splitList[0] == "warmshaders")
- {
- Shader.WarmupAllShaders();
- }
- else if (yba.splitList[0] == "dumpview")
- {
- try
- {
- int viewId = int.Parse(yba.splitList[1]);
- Singleton<NetworkManager>.Instance.Logger.DumpView(viewId);
- }
- catch (Exception)
- {
- Debug.Log("Format: dumpview <viewsubid>");
- throw;
- }
- }
- else if ((yba.splitList[0] == "g") && (yba.splitList[1] == "all"))
- {
- GlobalItemManager manager = Object.FindObjectOfType<GlobalItemManager>();
- int num17 = manager.MaxStaticItemId();
- for (int j = 1; j <= num17; j++)
- {
- IItem item2 = manager.GetItem(j);
- if (item2 != null)
- {
- manager.GiveItemClient(j, item2.MaxStackSize);
- }
- }
- }
- else if (yba.splitList[0] == "g")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Must be client connected to a server.");
- }
- else
- {
- try
- {
- int num19;
- int count = int.Parse(yba.splitList[2]);
- if (!int.TryParse(yba.splitList[1], out num19))
- {
- List<KeyValuePair<int, IItem>> list = Singleton<GlobalItemManager>.Instance.GetItems().Where<KeyValuePair<int, IItem>>(new Func<KeyValuePair<int, IItem>, bool>(yba.<>m__BE)).ToList<KeyValuePair<int, IItem>>();
- foreach (KeyValuePair<int, IItem> pair in list)
- {
- Object.FindObjectOfType<GlobalItemManager>().GiveItemClient(pair.Key, count);
- }
- if (list.Count == 0)
- {
- Debug.Log("No items found under the name " + yba.splitList[1]);
- }
- }
- else
- {
- Object.FindObjectOfType<GlobalItemManager>().GiveItemClient(num19, count);
- }
- }
- catch (Exception exception)
- {
- Debug.Log("Invalid format. Expceted: give <itemid / itemname> <count>");
- Debug.Log(exception.Message);
- }
- }
- }
- else if (yba.splitList[0] == "unloadassets")
- {
- Resources.UnloadUnusedAssets();
- long totalMemory = GC.GetTotalMemory(false);
- Debug.Log("Unloaded assets, current Mono memory allocated: " + ((totalMemory / 0x400L) / 0x400L) + "mb");
- }
- else if (yba.splitList[0] == "queryport")
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("queryport = " + Singleton<GameManager>.Instance.ServerConfig.MasterServerPort);
- }
- else
- {
- try
- {
- int num22 = int.Parse(yba.splitList[1]);
- Singleton<GameManager>.Instance.ServerConfig.MasterServerPort = num22;
- }
- catch
- {
- Debug.Log("format: queryport <port>");
- }
- }
- }
- else if (yba.splitList[0] == "loadbalancerframebudget")
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("loadbalancerframebudget = " + Singleton<GameManager>.Instance.ServerConfig.FrameBudget);
- }
- else
- {
- try
- {
- int num23 = int.Parse(yba.splitList[1]);
- Singleton<GameManager>.Instance.ServerConfig.FrameBudget = Mathf.Clamp(num23, 50, 500);
- }
- catch
- {
- Debug.Log("format: loadbalancerframebudget <budget>");
- }
- }
- }
- else if (yba.splitList[0] == "itemlist")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Must be client connected to a server.");
- }
- else
- {
- if (<>f__am$cache7 == null)
- {
- <>f__am$cache7 = x => x.ItemId;
- }
- List<IItem> list2 = Singleton<GlobalItemManager>.Instance.GetItems().Values.OrderBy<IItem, int>(<>f__am$cache7).ToList<IItem>();
- if (yba.splitList.Length > 1)
- {
- list2 = list2.Where<IItem>(new Func<IItem, bool>(yba.<>m__C0)).ToList<IItem>();
- }
- StringBuilder builder = new StringBuilder();
- foreach (IItem item3 in list2)
- {
- if (!item3.IsUnique())
- {
- builder.Append(string.Format("{0} : {1}\n", item3.ItemId, LocalizationUtilities.CleanUp(item3.GetNameKey())));
- }
- }
- Debug.Log(builder.ToString());
- }
- }
- else if (yba.splitList[0] == "refreshai")
- {
- Singleton<GameManager>.Instance.RefreshAIClient();
- }
- else if (yba.splitList[0] == "changeskin")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Must be client connected to a server.");
- }
- else if (yba.splitList.Length > 1)
- {
- int skin = int.Parse(yba.splitList[1]);
- Singleton<GameManager>.Instance.FocusedPlayer.GetComponent<SkinChanger>().ChangeSkinOwner(skin);
- }
- }
- else if (yba.splitList[0] == "changebeard")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Must be client connected to a server.");
- }
- else if (yba.splitList.Length > 2)
- {
- int itemCode = int.Parse(yba.splitList[1]);
- int color = int.Parse(yba.splitList[2]);
- Singleton<GameManager>.Instance.FocusedPlayer.GetComponent<SkinChanger>().ChangeBeardOwner(itemCode, color);
- }
- }
- else if (yba.splitList[0] == "maxplayers")
- {
- try
- {
- int num27 = int.Parse(yba.splitList[1]);
- if ((Singleton<GameManager>.Instance.State == EGameState.Hosting) && (Network.maxConnections < num27))
- {
- Debug.Log("Can't increase max players while a server is running");
- }
- else
- {
- Singleton<GameManager>.Instance.ServerConfig.MaxPlayers = Math.Min(60, num27);
- }
- }
- catch (Exception)
- {
- Debug.Log("Inavlid format");
- throw;
- }
- }
- else if (yba.splitList[0] == "servername")
- {
- try
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("Server name: " + Singleton<GameManager>.Instance.ServerConfig.GameName);
- }
- else
- {
- Singleton<GameManager>.Instance.ServerConfig.GameName = pCommand.Substring(11);
- Singleton<GameManager>.Instance.InvalidateServerConfig();
- }
- }
- catch (Exception)
- {
- Debug.Log("Inavlid format");
- throw;
- }
- }
- else if (yba.splitList[0] == "targetfps")
- {
- try
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("Target fps: " + Singleton<GameManager>.Instance.ServerConfig.TargetFPS);
- }
- else
- {
- Singleton<GameManager>.Instance.ServerConfig.TargetFPS = int.Parse(yba.splitList[1]);
- Singleton<GameManager>.Instance.InvalidateServerConfig();
- }
- }
- catch (Exception)
- {
- Debug.Log("Inavlid format");
- throw;
- }
- }
- else if (yba.splitList[0] == "quit")
- {
- if (yba.splitList.Length == 1)
- {
- Singleton<GameManager>.Instance.Quit(0);
- }
- else if (yba.splitList.Length == 2)
- {
- Singleton<GameManager>.Instance.Quit(int.Parse(yba.splitList[1]));
- }
- }
- else if (yba.splitList[0] == "cancelquit")
- {
- Singleton<GameManager>.Instance.CancelQuit();
- }
- else if (yba.splitList[0] == "creativemode")
- {
- try
- {
- if (int.Parse(yba.splitList[1]) == 0)
- {
- ConstructionItem.CreativeMode = false;
- }
- else
- {
- ConstructionItem.CreativeMode = true;
- }
- }
- catch (Exception)
- {
- Debug.Log("creativemode <1/0>");
- }
- }
- else if (yba.splitList[0] == "slack")
- {
- Singleton<GameManager>.Instance.EnableSlackNotifications = true;
- }
- else if (yba.splitList[0] == "dumpbiome")
- {
- if (Network.isClient)
- {
- GameObject focusedPlayer = Singleton<GameManager>.Instance.FocusedPlayer;
- if (focusedPlayer != null)
- {
- BiomeCellData data = new BiomeCellData();
- BiomeManager.Instance.FillGenerateBiomeData(focusedPlayer.transform.position.xz(), data);
- for (int k = 0; k < data.Biome.Length; k++)
- {
- Debug.Log(string.Format("Biome: {0}\tWeight: {1}", (EBiomePreset) data.Biome[k], data.Weights[k]));
- }
- }
- }
- }
- else if (yba.splitList[0] == "serverstatus")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Not connected to a server");
- }
- else
- {
- Singleton<GameManager>.Instance.RPC("GetServerStatus", RPCMode.Server, new object[0]);
- }
- }
- else if (yba.splitList[0] == "playerid")
- {
- Debug.Log(Singleton<GameManager>.Instance.LocalIdentifier.ToString());
- }
- else if (yba.splitList[0] == "rcon")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Must be connect to a server");
- }
- else
- {
- object[] objArray2 = new object[] { pCommand.Substring(yba.splitList[0].Length + 1) };
- base.RPC("RCON", RPCMode.Server, objArray2);
- }
- }
- else if (yba.splitList[0] == "kick")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
- {
- Debug.Log("Must be executed on the server");
- }
- else
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("kick <start of playerid> <reason>");
- }
- if (yba.splitList.Length == 2)
- {
- Debug.Log("Must supply a reason");
- }
- try
- {
- Singleton<GameManager>.Instance.KickPlayer(yba.splitList[1], pCommand.Substring((yba.splitList[0].Length + yba.splitList[1].Length) + 2));
- }
- catch (Exception)
- {
- Debug.LogError("Parse failed! Expected format is:\nkickplayer <statusindex> <reason>");
- }
- }
- }
- else if (yba.splitList[0] == "changelevel")
- {
- if ((Singleton<GameManager>.Instance.State != EGameState.ClientReady) && (Singleton<GameManager>.Instance.State != EGameState.Hosting))
- {
- Debug.Log("Not connected to a server");
- }
- else
- {
- Singleton<GameManager>.Instance.ChangeLevel(yba.splitList[1]);
- }
- }
- else if (yba.splitList[0] == "teleport")
- {
- if ((Singleton<GameManager>.Instance.State != EGameState.ClientReady) && (Singleton<GameManager>.Instance.State != EGameState.Hosting))
- {
- Debug.Log("Not connected to a server");
- }
- else if (yba.splitList.Length != 3)
- {
- Debug.Log("invalid format: teleport <fromplayer> <toplayer>");
- }
- else
- {
- object[] objArray3 = new object[] { yba.splitList[1], yba.splitList[2] };
- Singleton<GameManager>.Instance.RPC("TeleportPlayer", RPCMode.Server, objArray3);
- }
- }
- else if (yba.splitList[0] == "saveserver")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
- {
- Debug.Log("Must be executed on the server");
- }
- else if (yba.splitList.Length > 1)
- {
- base.StartCoroutine(Singleton<GameSerializer>.Instance.SaveServer(yba.splitList[1], true));
- }
- else
- {
- base.StartCoroutine(Singleton<GameSerializer>.Instance.SaveServer("autosave_" + Singleton<GameManager>.Instance.ServerConfig.Map, true));
- }
- }
- else if (yba.splitList[0] == "destroyall")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
- {
- Debug.Log("Must be executed on the server");
- }
- else if (yba.splitList.Length != 2)
- {
- Debug.Log("Usage: destroyall <partialname>");
- }
- else
- {
- NetworkView[] viewArray = Object.FindObjectsOfType<NetworkView>();
- int num30 = 0;
- foreach (NetworkView view in viewArray)
- {
- if (view.isActiveAndEnabled && view.name.ToLower().Contains(yba.splitList[1].ToLower()))
- {
- Singleton<NetworkManager>.Instance.NetDestroy(view);
- num30++;
- }
- }
- Debug.Log("Destroyed " + num30 + " objects");
- }
- }
- else if (yba.splitList[0] == "kill")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Not connected to a server");
- }
- else
- {
- Singleton<GameManager>.Instance.KillPlayerClient();
- }
- }
- else if (yba.splitList[0] == "loadserver")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
- {
- Debug.Log("Must be executed on a server");
- }
- else
- {
- Singleton<GameManager>.Instance.LoadServer(yba.splitList[1]);
- }
- }
- else if (yba.splitList[0] == "changename")
- {
- if ((yba.splitList[1].Length <= 13) && (yba.splitList[1].Length >= 3))
- {
- if (Singleton<GameManager>.Instance.State == EGameState.ClientReady)
- {
- Singleton<GameManager>.Instance.ChangeNameClient(yba.splitList[1]);
- }
- }
- else
- {
- Debug.LogError("Names must be between 3 and 13 characters");
- }
- }
- else if (yba.splitList[0] == "spawn")
- {
- Singleton<NetworkManager>.Instance.SpawnPrefabClient(yba.splitList[1]);
- }
- else
- {
- string str2;
- Dictionary<string, int> dictionary2;
- int num33;
- if (yba.splitList[0] == "debug")
- {
- if (yba.splitList.Length != 2)
- {
- Debug.Log("Invalid use of debug - format is `debug 1` or `debug 0`");
- }
- str2 = yba.splitList[1];
- if (str2 != null)
- {
- if (<>f__switch$map9 == null)
- {
- dictionary2 = new Dictionary<string, int>(2);
- dictionary2.Add("1", 0);
- dictionary2.Add("0", 1);
- <>f__switch$map9 = dictionary2;
- }
- if (<>f__switch$map9.TryGetValue(str2, out num33))
- {
- if (num33 == 0)
- {
- Singleton<InstantDebug>.Instance.SetEnabled(true);
- return;
- }
- if (num33 == 1)
- {
- Singleton<InstantDebug>.Instance.SetEnabled(false);
- return;
- }
- }
- }
- Debug.Log("Invalid use of debug - format is `debug 1` or `debug 0`");
- }
- else if (yba.splitList[0] == "playerlootmode")
- {
- if (yba.splitList.Length != 2)
- {
- Debug.Log("Usage: playerlootmode <modenumber>");
- Debug.Log("0: Drop nothing");
- Debug.Log("1: Drop backpack contents only");
- Debug.Log("2: Drop backpack + random items depending on infamy level");
- Debug.Log("3: Everything");
- }
- str2 = yba.splitList[1];
- if (str2 != null)
- {
- if (<>f__switch$mapA == null)
- {
- dictionary2 = new Dictionary<string, int>(4);
- dictionary2.Add("0", 0);
- dictionary2.Add("1", 1);
- dictionary2.Add("2", 2);
- dictionary2.Add("3", 3);
- <>f__switch$mapA = dictionary2;
- }
- if (<>f__switch$mapA.TryGetValue(str2, out num33))
- {
- switch (num33)
- {
- case 0:
- Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.None;
- return;
- case 1:
- Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.BackpackOnly;
- return;
- case 2:
- Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.BackpackOnlyWithInfamy;
- return;
- case 3:
- Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.Everything;
- return;
- }
- }
- }
- Debug.Log("Invalid use of playerlootmode - Usage: playerlootmode <modenumber>");
- }
- else if (yba.splitList[0] == "deleteprefs")
- {
- PlayerPrefs.DeleteAll();
- Debug.Log("Deleted all player preferences.");
- }
- else if (yba.splitList[0] == "deletepreference")
- {
- if (yba.splitList.Length < 2)
- {
- Debug.LogError("Format Exception: expected deletepreference <key>");
- }
- else
- {
- StringBuilder builder2 = new StringBuilder(strArray[1]);
- for (int m = 2; m < strArray.Length; m++)
- {
- builder2.Append(" ");
- builder2.Append(strArray[m]);
- }
- if (!PlayerPrefs.HasKey(builder2.ToString()))
- {
- Debug.LogError(string.Format("No key with name '{0}' found!", builder2));
- }
- else
- {
- PlayerPrefs.DeleteKey(builder2.ToString());
- Debug.Log(string.Format("Deleted key with name '{0}'", builder2));
- }
- }
- }
- else if (yba.splitList[0] == "dumpleaks")
- {
- StringBuilder sb = new StringBuilder();
- sb.AppendLine("Ref tracked behaviors: ");
- foreach (KeyValuePair<Type, Expression<Func<string>>> pair2 in LeakTracker.RegisteredLeakers)
- {
- sb.AppendLine("\t" + pair2.Key.ToString() + " : " + pair2.Value.Compile()());
- }
- sb.AppendLine("BitStream Counts: ");
- Singleton<NetworkManager>.Instance.BitStreamPool.DumpStreamLeaks(sb);
- sb.AppendLine("Generic Pools: ");
- Singleton<ClassInstancePool>.Instance.DumpPoolCounts(sb);
- Debug.Log(sb.ToString());
- }
- else if (yba.splitList[0] == "time")
- {
- if (Singleton<TimeManager>.HasInstance())
- {
- Debug.Log(Singleton<TimeManager>.Instance.GetCurrentGameTime().ToString());
- }
- }
- else if (yba.splitList[0] == "analytics")
- {
- try
- {
- if (Singleton<UnityAnalyticsIntegration>.HasInstance() && (yba.splitList.Length == 2))
- {
- Singleton<UnityAnalyticsIntegration>.Instance.AnalyticsEnabled = int.Parse(yba.splitList[1]) == 1;
- }
- else
- {
- Debug.LogError("Error! Expected: analytics <0-1>");
- }
- }
- catch (Exception)
- {
- Debug.LogError("Error! Expected: analytics <0-1>");
- }
- }
- else
- {
- Debug.Log("Unknown command: " + yba.splitList[0]);
- }
- }
- }
- }
- private void ExecuteCommandRaw(string pCommand)
- {
- <ExecuteCommandRaw>c__AnonStoreyBA yba = new <ExecuteCommandRaw>c__AnonStoreyBA();
- pCommand = pCommand.Trim();
- string str = pCommand.ToLower();
- char[] separator = new char[] { ' ' };
- yba.splitList = str.Split(separator);
- char[] chArray2 = new char[] { ' ' };
- string[] strArray = pCommand.Split(chArray2);
- object[] args = new object[] { str };
- if (Interface.CallHook("OnRunCommand", args) == null)
- {
- Debug.Log("> " + pCommand + "\n");
- if (yba.splitList[0] == "connect")
- {
- try
- {
- if (yba.splitList[1].IndexOf(':') > 0)
- {
- char[] chArray3 = new char[] { ':' };
- string[] strArray2 = yba.splitList[1].Split(chArray3);
- int port = int.Parse(strArray2[1]);
- Singleton<GameManager>.Instance.Connect(strArray2[0], port);
- }
- else
- {
- Singleton<GameManager>.Instance.Connect(yba.splitList[1], 0x3247);
- }
- }
- catch
- {
- Debug.Log("Invalid format, host must be of the format 192.168.1.1:123");
- }
- }
- else if (yba.splitList[0] == "addadmin")
- {
- try
- {
- ulong ulSteamID = Convert.ToUInt64(yba.splitList[1]);
- Singleton<GameManager>.Instance.SetAdmin(new CSteamID(ulSteamID));
- Debug.Log("Admin user added");
- }
- catch
- {
- Debug.Log("Invalid format, you must enter steamid64 (use playerid to query)");
- }
- }
- else if (yba.splitList[0] == "testhost")
- {
- Singleton<GameManager>.Instance.Host(0x3247, null, "zonetest");
- }
- else if (yba.splitList[0] == "adminmessage")
- {
- if (Singleton<GameManager>.Instance.State == EGameState.Hosting)
- {
- Singleton<ChatManager>.Instance.AppendNotice(pCommand.Substring(13), Color.red);
- }
- }
- else if (yba.splitList[0] == "find")
- {
- foreach (MeshFilter filter in Object.FindObjectsOfType<MeshFilter>())
- {
- if (filter.sharedMesh == null)
- {
- Debug.Log("Found missing mesh ", filter.gameObject);
- }
- }
- }
- else if (yba.splitList[0] == "host")
- {
- try
- {
- int num4 = int.Parse(yba.splitList[1]);
- if (yba.splitList.Length > 3)
- {
- Singleton<GameManager>.Instance.Host(num4, yba.splitList[3], yba.splitList[2]);
- }
- else if (yba.splitList.Length > 2)
- {
- Singleton<GameManager>.Instance.Host(num4, null, yba.splitList[2]);
- }
- else if (yba.splitList.Length == 2)
- {
- Singleton<GameManager>.Instance.Host(num4, null, "DiemensLand");
- }
- else
- {
- Debug.Log("Invalid format. Expected: host <port> <map> <loadgame>");
- }
- }
- catch
- {
- Debug.Log("Invalid format. Expected: host <port> <map> <loadgame>");
- }
- }
- else if (yba.splitList[0] == "stockvehicles")
- {
- if (Network.isServer)
- {
- foreach (VehicleController4Wheel wheel in Object.FindObjectsOfType<VehicleController4Wheel>())
- {
- RestrictedInventory component = wheel.GetComponent<RestrictedInventory>();
- <ExecuteCommandRaw>c__AnonStoreyB7 yb = new <ExecuteCommandRaw>c__AnonStoreyB7();
- SlotRestriction[] restrictions = component.Restrictions;
- for (int i = 0; i < restrictions.Length; i++)
- {
- yb.slotRestriction = restrictions[i];
- if (component.Items[yb.slotRestriction.SlotNumber] == null)
- {
- IItem item = Singleton<GlobalItemManager>.Instance.GetItems().Values.FirstOrDefault<IItem>(new Func<IItem, bool>(yb.<>m__BA));
- if (item != null)
- {
- component.Items[yb.slotRestriction.SlotNumber] = new ItemInstance(item, item.MaxStackSize);
- }
- }
- component.Invalidate(false);
- }
- }
- }
- }
- else if (yba.splitList[0] == "freezetime")
- {
- if (Network.isServer)
- {
- int num7 = 0x15180;
- float dayPercentage = Singleton<TimeManager>.Instance.GetCurrentGameTime().DayPercentage;
- Singleton<TimeManager>.Instance.DayLength = 9999999f;
- Singleton<TimeManager>.Instance.NightLength = 9999999f;
- Singleton<TimeManager>.Instance.InitialTimeOffset = dayPercentage * num7;
- }
- else
- {
- Debug.LogError("SetTime must be executed on the server!");
- }
- }
- else if (yba.splitList[0] == "setbiome")
- {
- <ExecuteCommandRaw>c__AnonStoreyB8 yb2 = new <ExecuteCommandRaw>c__AnonStoreyB8 {
- biomeString = (yba.splitList.Length != 1) ? yba.splitList[1] : "None"
- };
- EBiomePreset preset = ((EBiomePreset[]) Enum.GetValues(typeof(EBiomePreset))).FirstOrDefault<EBiomePreset>(new Func<EBiomePreset, bool>(yb2.<>m__BB));
- if (BiomeManager.Instance != null)
- {
- BiomeManager.Instance.OverridePreset = preset;
- Debug.Log("Forcing biome " + preset.ToString());
- }
- }
- else if (yba.splitList[0] == "settime")
- {
- if (yba.splitList.Length != 0)
- {
- if (!Network.isServer)
- {
- Debug.LogError("SetTime must be executed on the server!");
- }
- else
- {
- try
- {
- int num9 = 0x15180;
- float num10 = float.Parse(yba.splitList[1]);
- float num11 = Singleton<TimeManager>.Instance.GetCurrentGameTime().DayPercentage;
- float initialTimeOffset = Singleton<TimeManager>.Instance.InitialTimeOffset;
- float num13 = ((num10 - num11) * num9) + initialTimeOffset;
- Singleton<TimeManager>.Instance.InitialTimeOffset = num13;
- }
- catch
- {
- Debug.Log("format settime <percentage through the day(0.5)>");
- }
- }
- }
- }
- else if (yba.splitList[0] == "lowlod")
- {
- <ExecuteCommandRaw>c__AnonStoreyB9 yb3 = new <ExecuteCommandRaw>c__AnonStoreyB9();
- CharacterAnimationInputs[] source = Object.FindObjectsOfType<CharacterAnimationInputs>();
- yb3.lowLod = yba.splitList[1] == "1";
- if (<>f__am$cache6 == null)
- {
- <>f__am$cache6 = x => !x.networkView.isMine;
- }
- source.Where<CharacterAnimationInputs>(<>f__am$cache6).ToList<CharacterAnimationInputs>().ForEach(new Action<CharacterAnimationInputs>(yb3.<>m__BD));
- Debug.Log(string.Concat(new object[] { "Set ", source.Length - 1, " players to ", !yb3.lowLod ? "High" : "Low", " lod" }));
- }
- else if (yba.splitList[0] == "autobackupinterval")
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("autobackupinterval = " + Singleton<GameManager>.Instance.ServerConfig.AutoBackupInterval);
- }
- else
- {
- try
- {
- float num14 = float.Parse(yba.splitList[1]);
- Singleton<GameManager>.Instance.ServerConfig.AutoBackupInterval = num14;
- }
- catch
- {
- Debug.Log("format: autobackupinterval <seconds>");
- }
- }
- }
- else if (yba.splitList[0] == "expandpools")
- {
- try
- {
- int amount = int.Parse(yba.splitList[1]);
- base.StartCoroutine(this.ExpandPools(amount));
- }
- catch (Exception)
- {
- Debug.Log("Must supply a number");
- }
- }
- else if (yba.splitList[0] == "warmshaders")
- {
- Shader.WarmupAllShaders();
- }
- else if (yba.splitList[0] == "dumpview")
- {
- try
- {
- int viewId = int.Parse(yba.splitList[1]);
- Singleton<NetworkManager>.Instance.Logger.DumpView(viewId);
- }
- catch (Exception)
- {
- Debug.Log("Format: dumpview <viewsubid>");
- throw;
- }
- }
- else if ((yba.splitList[0] == "g") && (yba.splitList[1] == "all"))
- {
- GlobalItemManager manager = Object.FindObjectOfType<GlobalItemManager>();
- int num17 = manager.MaxStaticItemId();
- for (int j = 1; j <= num17; j++)
- {
- IItem item2 = manager.GetItem(j);
- if (item2 != null)
- {
- manager.GiveItemClient(j, item2.MaxStackSize);
- }
- }
- }
- else if (yba.splitList[0] == "g")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Must be client connected to a server.");
- }
- else
- {
- try
- {
- int num19;
- int count = int.Parse(yba.splitList[2]);
- if (!int.TryParse(yba.splitList[1], out num19))
- {
- List<KeyValuePair<int, IItem>> list = Singleton<GlobalItemManager>.Instance.GetItems().Where<KeyValuePair<int, IItem>>(new Func<KeyValuePair<int, IItem>, bool>(yba.<>m__BE)).ToList<KeyValuePair<int, IItem>>();
- foreach (KeyValuePair<int, IItem> pair in list)
- {
- Object.FindObjectOfType<GlobalItemManager>().GiveItemClient(pair.Key, count);
- }
- if (list.Count == 0)
- {
- Debug.Log("No items found under the name " + yba.splitList[1]);
- }
- }
- else
- {
- Object.FindObjectOfType<GlobalItemManager>().GiveItemClient(num19, count);
- }
- }
- catch (Exception exception)
- {
- Debug.Log("Invalid format. Expceted: give <itemid / itemname> <count>");
- Debug.Log(exception.Message);
- }
- }
- }
- else if (yba.splitList[0] == "unloadassets")
- {
- Resources.UnloadUnusedAssets();
- long totalMemory = GC.GetTotalMemory(false);
- Debug.Log("Unloaded assets, current Mono memory allocated: " + ((totalMemory / 0x400L) / 0x400L) + "mb");
- }
- else if (yba.splitList[0] == "queryport")
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("queryport = " + Singleton<GameManager>.Instance.ServerConfig.MasterServerPort);
- }
- else
- {
- try
- {
- int num22 = int.Parse(yba.splitList[1]);
- Singleton<GameManager>.Instance.ServerConfig.MasterServerPort = num22;
- }
- catch
- {
- Debug.Log("format: queryport <port>");
- }
- }
- }
- else if (yba.splitList[0] == "loadbalancerframebudget")
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("loadbalancerframebudget = " + Singleton<GameManager>.Instance.ServerConfig.FrameBudget);
- }
- else
- {
- try
- {
- int num23 = int.Parse(yba.splitList[1]);
- Singleton<GameManager>.Instance.ServerConfig.FrameBudget = Mathf.Clamp(num23, 50, 500);
- }
- catch
- {
- Debug.Log("format: loadbalancerframebudget <budget>");
- }
- }
- }
- else if (yba.splitList[0] == "itemlist")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Must be client connected to a server.");
- }
- else
- {
- if (<>f__am$cache7 == null)
- {
- <>f__am$cache7 = x => x.ItemId;
- }
- List<IItem> list2 = Singleton<GlobalItemManager>.Instance.GetItems().Values.OrderBy<IItem, int>(<>f__am$cache7).ToList<IItem>();
- if (yba.splitList.Length > 1)
- {
- list2 = list2.Where<IItem>(new Func<IItem, bool>(yba.<>m__C0)).ToList<IItem>();
- }
- StringBuilder builder = new StringBuilder();
- foreach (IItem item3 in list2)
- {
- if (!item3.IsUnique())
- {
- builder.Append(string.Format("{0} : {1}\n", item3.ItemId, LocalizationUtilities.CleanUp(item3.GetNameKey())));
- }
- }
- Debug.Log(builder.ToString());
- }
- }
- else if (yba.splitList[0] == "refreshai")
- {
- Singleton<GameManager>.Instance.RefreshAIClient();
- }
- else if (yba.splitList[0] == "changeskin")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Must be client connected to a server.");
- }
- else if (yba.splitList.Length > 1)
- {
- int skin = int.Parse(yba.splitList[1]);
- Singleton<GameManager>.Instance.FocusedPlayer.GetComponent<SkinChanger>().ChangeSkinOwner(skin);
- }
- }
- else if (yba.splitList[0] == "changebeard")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Must be client connected to a server.");
- }
- else if (yba.splitList.Length > 2)
- {
- int itemCode = int.Parse(yba.splitList[1]);
- int color = int.Parse(yba.splitList[2]);
- Singleton<GameManager>.Instance.FocusedPlayer.GetComponent<SkinChanger>().ChangeBeardOwner(itemCode, color);
- }
- }
- else if (yba.splitList[0] == "maxplayers")
- {
- try
- {
- int num27 = int.Parse(yba.splitList[1]);
- if ((Singleton<GameManager>.Instance.State == EGameState.Hosting) && (Network.maxConnections < num27))
- {
- Debug.Log("Can't increase max players while a server is running");
- }
- else
- {
- Singleton<GameManager>.Instance.ServerConfig.MaxPlayers = Math.Min(60, num27);
- }
- }
- catch (Exception)
- {
- Debug.Log("Inavlid format");
- throw;
- }
- }
- else if (yba.splitList[0] == "servername")
- {
- try
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("Server name: " + Singleton<GameManager>.Instance.ServerConfig.GameName);
- }
- else
- {
- Singleton<GameManager>.Instance.ServerConfig.GameName = pCommand.Substring(11);
- Singleton<GameManager>.Instance.InvalidateServerConfig();
- }
- }
- catch (Exception)
- {
- Debug.Log("Inavlid format");
- throw;
- }
- }
- else if (yba.splitList[0] == "targetfps")
- {
- try
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("Target fps: " + Singleton<GameManager>.Instance.ServerConfig.TargetFPS);
- }
- else
- {
- Singleton<GameManager>.Instance.ServerConfig.TargetFPS = int.Parse(yba.splitList[1]);
- Singleton<GameManager>.Instance.InvalidateServerConfig();
- }
- }
- catch (Exception)
- {
- Debug.Log("Inavlid format");
- throw;
- }
- }
- else if (yba.splitList[0] == "quit")
- {
- if (yba.splitList.Length == 1)
- {
- Singleton<GameManager>.Instance.Quit(0);
- }
- else if (yba.splitList.Length == 2)
- {
- Singleton<GameManager>.Instance.Quit(int.Parse(yba.splitList[1]));
- }
- }
- else if (yba.splitList[0] == "cancelquit")
- {
- Singleton<GameManager>.Instance.CancelQuit();
- }
- else if (yba.splitList[0] == "creativemode")
- {
- try
- {
- if (int.Parse(yba.splitList[1]) == 0)
- {
- ConstructionItem.CreativeMode = false;
- }
- else
- {
- ConstructionItem.CreativeMode = true;
- }
- }
- catch (Exception)
- {
- Debug.Log("creativemode <1/0>");
- }
- }
- else if (yba.splitList[0] == "slack")
- {
- Singleton<GameManager>.Instance.EnableSlackNotifications = true;
- }
- else if (yba.splitList[0] == "dumpbiome")
- {
- if (Network.isClient)
- {
- GameObject focusedPlayer = Singleton<GameManager>.Instance.FocusedPlayer;
- if (focusedPlayer != null)
- {
- BiomeCellData data = new BiomeCellData();
- BiomeManager.Instance.FillGenerateBiomeData(focusedPlayer.transform.position.xz(), data);
- for (int k = 0; k < data.Biome.Length; k++)
- {
- Debug.Log(string.Format("Biome: {0}\tWeight: {1}", (EBiomePreset) data.Biome[k], data.Weights[k]));
- }
- }
- }
- }
- else if (yba.splitList[0] == "serverstatus")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Not connected to a server");
- }
- else
- {
- Singleton<GameManager>.Instance.RPC("GetServerStatus", RPCMode.Server, new object[0]);
- }
- }
- else if (yba.splitList[0] == "playerid")
- {
- Debug.Log(Singleton<GameManager>.Instance.LocalIdentifier.ToString());
- }
- else if (yba.splitList[0] == "rcon")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Must be connect to a server");
- }
- else
- {
- object[] objArray2 = new object[] { pCommand.Substring(yba.splitList[0].Length + 1) };
- base.RPC("RCON", RPCMode.Server, objArray2);
- }
- }
- else if (yba.splitList[0] == "kick")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
- {
- Debug.Log("Must be executed on the server");
- }
- else
- {
- if (yba.splitList.Length == 1)
- {
- Debug.Log("kick <start of playerid> <reason>");
- }
- if (yba.splitList.Length == 2)
- {
- Debug.Log("Must supply a reason");
- }
- try
- {
- Singleton<GameManager>.Instance.KickPlayer(yba.splitList[1], pCommand.Substring((yba.splitList[0].Length + yba.splitList[1].Length) + 2));
- }
- catch (Exception)
- {
- Debug.LogError("Parse failed! Expected format is:\nkickplayer <statusindex> <reason>");
- }
- }
- }
- else if (yba.splitList[0] == "changelevel")
- {
- if ((Singleton<GameManager>.Instance.State != EGameState.ClientReady) && (Singleton<GameManager>.Instance.State != EGameState.Hosting))
- {
- Debug.Log("Not connected to a server");
- }
- else
- {
- Singleton<GameManager>.Instance.ChangeLevel(yba.splitList[1]);
- }
- }
- else if (yba.splitList[0] == "teleport")
- {
- if ((Singleton<GameManager>.Instance.State != EGameState.ClientReady) && (Singleton<GameManager>.Instance.State != EGameState.Hosting))
- {
- Debug.Log("Not connected to a server");
- }
- else if (yba.splitList.Length != 3)
- {
- Debug.Log("invalid format: teleport <fromplayer> <toplayer>");
- }
- else
- {
- object[] objArray3 = new object[] { yba.splitList[1], yba.splitList[2] };
- Singleton<GameManager>.Instance.RPC("TeleportPlayer", RPCMode.Server, objArray3);
- }
- }
- else if (yba.splitList[0] == "saveserver")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
- {
- Debug.Log("Must be executed on the server");
- }
- else if (yba.splitList.Length > 1)
- {
- base.StartCoroutine(Singleton<GameSerializer>.Instance.SaveServer(yba.splitList[1], true));
- }
- else
- {
- base.StartCoroutine(Singleton<GameSerializer>.Instance.SaveServer("autosave_" + Singleton<GameManager>.Instance.ServerConfig.Map, true));
- }
- }
- else if (yba.splitList[0] == "destroyall")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
- {
- Debug.Log("Must be executed on the server");
- }
- else if (yba.splitList.Length != 2)
- {
- Debug.Log("Usage: destroyall <partialname>");
- }
- else
- {
- NetworkView[] viewArray = Object.FindObjectsOfType<NetworkView>();
- int num30 = 0;
- foreach (NetworkView view in viewArray)
- {
- if (view.isActiveAndEnabled && view.name.ToLower().Contains(yba.splitList[1].ToLower()))
- {
- Singleton<NetworkManager>.Instance.NetDestroy(view);
- num30++;
- }
- }
- Debug.Log("Destroyed " + num30 + " objects");
- }
- }
- else if (yba.splitList[0] == "kill")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
- {
- Debug.Log("Not connected to a server");
- }
- else
- {
- Singleton<GameManager>.Instance.KillPlayerClient();
- }
- }
- else if (yba.splitList[0] == "loadserver")
- {
- if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
- {
- Debug.Log("Must be executed on a server");
- }
- else
- {
- Singleton<GameManager>.Instance.LoadServer(yba.splitList[1]);
- }
- }
- else if (yba.splitList[0] == "changename")
- {
- if ((yba.splitList[1].Length <= 13) && (yba.splitList[1].Length >= 3))
- {
- if (Singleton<GameManager>.Instance.State == EGameState.ClientReady)
- {
- Singleton<GameManager>.Instance.ChangeNameClient(yba.splitList[1]);
- }
- }
- else
- {
- Debug.LogError("Names must be between 3 and 13 characters");
- }
- }
- else if (yba.splitList[0] == "spawn")
- {
- Singleton<NetworkManager>.Instance.SpawnPrefabClient(yba.splitList[1]);
- }
- else
- {
- string str2;
- Dictionary<string, int> dictionary2;
- int num33;
- if (yba.splitList[0] == "debug")
- {
- if (yba.splitList.Length != 2)
- {
- Debug.Log("Invalid use of debug - format is `debug 1` or `debug 0`");
- }
- str2 = yba.splitList[1];
- if (str2 != null)
- {
- if (<>f__switch$map9 == null)
- {
- dictionary2 = new Dictionary<string, int>(2);
- dictionary2.Add("1", 0);
- dictionary2.Add("0", 1);
- <>f__switch$map9 = dictionary2;
- }
- if (<>f__switch$map9.TryGetValue(str2, out num33))
- {
- if (num33 == 0)
- {
- Singleton<InstantDebug>.Instance.SetEnabled(true);
- return;
- }
- if (num33 == 1)
- {
- Singleton<InstantDebug>.Instance.SetEnabled(false);
- return;
- }
- }
- }
- Debug.Log("Invalid use of debug - format is `debug 1` or `debug 0`");
- }
- else if (yba.splitList[0] == "playerlootmode")
- {
- if (yba.splitList.Length != 2)
- {
- Debug.Log("Usage: playerlootmode <modenumber>");
- Debug.Log("0: Drop nothing");
- Debug.Log("1: Drop backpack contents only");
- Debug.Log("2: Drop backpack + random items depending on infamy level");
- Debug.Log("3: Everything");
- }
- str2 = yba.splitList[1];
- if (str2 != null)
- {
- if (<>f__switch$mapA == null)
- {
- dictionary2 = new Dictionary<string, int>(4);
- dictionary2.Add("0", 0);
- dictionary2.Add("1", 1);
- dictionary2.Add("2", 2);
- dictionary2.Add("3", 3);
- <>f__switch$mapA = dictionary2;
- }
- if (<>f__switch$mapA.TryGetValue(str2, out num33))
- {
- switch (num33)
- {
- case 0:
- Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.None;
- return;
- case 1:
- Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.BackpackOnly;
- return;
- case 2:
- Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.BackpackOnlyWithInfamy;
- return;
- case 3:
- Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.Everything;
- return;
- }
- }
- }
- Debug.Log("Invalid use of playerlootmode - Usage: playerlootmode <modenumber>");
- }
- else if (yba.splitList[0] == "deleteprefs")
- {
- PlayerPrefs.DeleteAll();
- Debug.Log("Deleted all player preferences.");
- }
- else if (yba.splitList[0] == "deletepreference")
- {
- if (yba.splitList.Length < 2)
- {
- Debug.LogError("Format Exception: expected deletepreference <key>");
- }
- else
- {
- StringBuilder builder2 = new StringBuilder(strArray[1]);
- for (int m = 2; m < strArray.Length; m++)
- {
- builder2.Append(" ");
- builder2.Append(strArray[m]);
- }
- if (!PlayerPrefs.HasKey(builder2.ToString()))
- {
- Debug.LogError(string.Format("No key with name '{0}' found!", builder2));
- }
- else
- {
- PlayerPrefs.DeleteKey(builder2.ToString());
- Debug.Log(string.Format("Deleted key with name '{0}'", builder2));
- }
- }
- }
- else if (yba.splitList[0] == "dumpleaks")
- {
- StringBuilder sb = new StringBuilder();
- sb.AppendLine("Ref tracked behaviors: ");
- foreach (KeyValuePair<Type, Expression<Func<string>>> pair2 in LeakTracker.RegisteredLeakers)
- {
- sb.AppendLine("\t" + pair2.Key.ToString() + " : " + pair2.Value.Compile()());
- }
- sb.AppendLine("BitStream Counts: ");
- Singleton<NetworkManager>.Instance.BitStreamPool.DumpStreamLeaks(sb);
- sb.AppendLine("Generic Pools: ");
- Singleton<ClassInstancePool>.Instance.DumpPoolCounts(sb);
- Debug.Log(sb.ToString());
- }
- else if (yba.splitList[0] == "time")
- {
- if (Singleton<TimeManager>.HasInstance())
- {
- Debug.Log(Singleton<TimeManager>.Instance.GetCurrentGameTime().ToString());
- }
- }
- else if (yba.splitList[0] == "analytics")
- {
- try
- {
- if (Singleton<UnityAnalyticsIntegration>.HasInstance() && (yba.splitList.Length == 2))
- {
- Singleton<UnityAnalyticsIntegration>.Instance.AnalyticsEnabled = int.Parse(yba.splitList[1]) == 1;
- }
- else
- {
- Debug.LogError("Error! Expected: analytics <0-1>");
- }
- }
- catch (Exception)
- {
- Debug.LogError("Error! Expected: analytics <0-1>");
- }
- }
- else
- {
- Debug.Log("Unknown command: " + yba.splitList[0]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement