Advertisement
Guest User

Untitled

a guest
Dec 10th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 63.71 KB | None | 0 0
  1. private void ExecuteCommandRaw(string pCommand)
  2. {
  3.     <ExecuteCommandRaw>c__AnonStoreyBA yba = new <ExecuteCommandRaw>c__AnonStoreyBA();
  4.     pCommand = pCommand.Trim();
  5.     string str = pCommand.ToLower();
  6.     char[] separator = new char[] { ' ' };
  7.     yba.splitList = str.Split(separator);
  8.     char[] chArray2 = new char[] { ' ' };
  9.     string[] strArray = pCommand.Split(chArray2);
  10.     object[] args = new object[] { str };
  11.     if (Interface.CallHook("OnRunCommand", args) == null)
  12.     {
  13.         Debug.Log("> " + pCommand + "\n");
  14.         if (yba.splitList[0] == "connect")
  15.         {
  16.             try
  17.             {
  18.                 if (yba.splitList[1].IndexOf(':') > 0)
  19.                 {
  20.                     char[] chArray3 = new char[] { ':' };
  21.                     string[] strArray2 = yba.splitList[1].Split(chArray3);
  22.                     int port = int.Parse(strArray2[1]);
  23.                     Singleton<GameManager>.Instance.Connect(strArray2[0], port);
  24.                 }
  25.                 else
  26.                 {
  27.                     Singleton<GameManager>.Instance.Connect(yba.splitList[1], 0x3247);
  28.                 }
  29.             }
  30.             catch
  31.             {
  32.                 Debug.Log("Invalid format, host must be of the format 192.168.1.1:123");
  33.             }
  34.         }
  35.         else if (yba.splitList[0] == "addadmin")
  36.         {
  37.             try
  38.             {
  39.                 ulong ulSteamID = Convert.ToUInt64(yba.splitList[1]);
  40.                 Singleton<GameManager>.Instance.SetAdmin(new CSteamID(ulSteamID));
  41.                 Debug.Log("Admin user added");
  42.             }
  43.             catch
  44.             {
  45.                 Debug.Log("Invalid format, you must enter steamid64 (use playerid to query)");
  46.             }
  47.         }
  48.         else if (yba.splitList[0] == "testhost")
  49.         {
  50.             Singleton<GameManager>.Instance.Host(0x3247, null, "zonetest");
  51.         }
  52.         else if (yba.splitList[0] == "adminmessage")
  53.         {
  54.             if (Singleton<GameManager>.Instance.State == EGameState.Hosting)
  55.             {
  56.                 Singleton<ChatManager>.Instance.AppendNotice(pCommand.Substring(13), Color.red);
  57.             }
  58.         }
  59.         else if (yba.splitList[0] == "find")
  60.         {
  61.             foreach (MeshFilter filter in Object.FindObjectsOfType<MeshFilter>())
  62.             {
  63.                 if (filter.sharedMesh == null)
  64.                 {
  65.                     Debug.Log("Found missing mesh ", filter.gameObject);
  66.                 }
  67.             }
  68.         }
  69.         else if (yba.splitList[0] == "host")
  70.         {
  71.             try
  72.             {
  73.                 int num4 = int.Parse(yba.splitList[1]);
  74.                 if (yba.splitList.Length > 3)
  75.                 {
  76.                     Singleton<GameManager>.Instance.Host(num4, yba.splitList[3], yba.splitList[2]);
  77.                 }
  78.                 else if (yba.splitList.Length > 2)
  79.                 {
  80.                     Singleton<GameManager>.Instance.Host(num4, null, yba.splitList[2]);
  81.                 }
  82.                 else if (yba.splitList.Length == 2)
  83.                 {
  84.                     Singleton<GameManager>.Instance.Host(num4, null, "DiemensLand");
  85.                 }
  86.                 else
  87.                 {
  88.                     Debug.Log("Invalid format. Expected: host <port> <map> <loadgame>");
  89.                 }
  90.             }
  91.             catch
  92.             {
  93.                 Debug.Log("Invalid format. Expected: host <port> <map> <loadgame>");
  94.             }
  95.         }
  96.         else if (yba.splitList[0] == "stockvehicles")
  97.         {
  98.             if (Network.isServer)
  99.             {
  100.                 foreach (VehicleController4Wheel wheel in Object.FindObjectsOfType<VehicleController4Wheel>())
  101.                 {
  102.                     RestrictedInventory component = wheel.GetComponent<RestrictedInventory>();
  103.                     <ExecuteCommandRaw>c__AnonStoreyB7 yb = new <ExecuteCommandRaw>c__AnonStoreyB7();
  104.                     SlotRestriction[] restrictions = component.Restrictions;
  105.                     for (int i = 0; i < restrictions.Length; i++)
  106.                     {
  107.                         yb.slotRestriction = restrictions[i];
  108.                         if (component.Items[yb.slotRestriction.SlotNumber] == null)
  109.                         {
  110.                             IItem item = Singleton<GlobalItemManager>.Instance.GetItems().Values.FirstOrDefault<IItem>(new Func<IItem, bool>(yb.<>m__BA));
  111.                             if (item != null)
  112.                             {
  113.                                 component.Items[yb.slotRestriction.SlotNumber] = new ItemInstance(item, item.MaxStackSize);
  114.                             }
  115.                         }
  116.                         component.Invalidate(false);
  117.                     }
  118.                 }
  119.             }
  120.         }
  121.         else if (yba.splitList[0] == "freezetime")
  122.         {
  123.             if (Network.isServer)
  124.             {
  125.                 int num7 = 0x15180;
  126.                 float dayPercentage = Singleton<TimeManager>.Instance.GetCurrentGameTime().DayPercentage;
  127.                 Singleton<TimeManager>.Instance.DayLength = 9999999f;
  128.                 Singleton<TimeManager>.Instance.NightLength = 9999999f;
  129.                 Singleton<TimeManager>.Instance.InitialTimeOffset = dayPercentage * num7;
  130.             }
  131.             else
  132.             {
  133.                 Debug.LogError("SetTime must be executed on the server!");
  134.             }
  135.         }
  136.         else if (yba.splitList[0] == "setbiome")
  137.         {
  138.             <ExecuteCommandRaw>c__AnonStoreyB8 yb2 = new <ExecuteCommandRaw>c__AnonStoreyB8 {
  139.                 biomeString = (yba.splitList.Length != 1) ? yba.splitList[1] : "None"
  140.             };
  141.             EBiomePreset preset = ((EBiomePreset[]) Enum.GetValues(typeof(EBiomePreset))).FirstOrDefault<EBiomePreset>(new Func<EBiomePreset, bool>(yb2.<>m__BB));
  142.             if (BiomeManager.Instance != null)
  143.             {
  144.                 BiomeManager.Instance.OverridePreset = preset;
  145.                 Debug.Log("Forcing biome " + preset.ToString());
  146.             }
  147.         }
  148.         else if (yba.splitList[0] == "settime")
  149.         {
  150.             if (yba.splitList.Length != 0)
  151.             {
  152.                 if (!Network.isServer)
  153.                 {
  154.                     Debug.LogError("SetTime must be executed on the server!");
  155.                 }
  156.                 else
  157.                 {
  158.                     try
  159.                     {
  160.                         int num9 = 0x15180;
  161.                         float num10 = float.Parse(yba.splitList[1]);
  162.                         float num11 = Singleton<TimeManager>.Instance.GetCurrentGameTime().DayPercentage;
  163.                         float initialTimeOffset = Singleton<TimeManager>.Instance.InitialTimeOffset;
  164.                         float num13 = ((num10 - num11) * num9) + initialTimeOffset;
  165.                         Singleton<TimeManager>.Instance.InitialTimeOffset = num13;
  166.                     }
  167.                     catch
  168.                     {
  169.                         Debug.Log("format settime <percentage through the day(0.5)>");
  170.                     }
  171.                 }
  172.             }
  173.         }
  174.         else if (yba.splitList[0] == "lowlod")
  175.         {
  176.             <ExecuteCommandRaw>c__AnonStoreyB9 yb3 = new <ExecuteCommandRaw>c__AnonStoreyB9();
  177.             CharacterAnimationInputs[] source = Object.FindObjectsOfType<CharacterAnimationInputs>();
  178.             yb3.lowLod = yba.splitList[1] == "1";
  179.             if (<>f__am$cache6 == null)
  180.             {
  181.                 <>f__am$cache6 = x => !x.networkView.isMine;
  182.             }
  183.             source.Where<CharacterAnimationInputs>(<>f__am$cache6).ToList<CharacterAnimationInputs>().ForEach(new Action<CharacterAnimationInputs>(yb3.<>m__BD));
  184.             Debug.Log(string.Concat(new object[] { "Set ", source.Length - 1, " players to ", !yb3.lowLod ? "High" : "Low", " lod" }));
  185.         }
  186.         else if (yba.splitList[0] == "autobackupinterval")
  187.         {
  188.             if (yba.splitList.Length == 1)
  189.             {
  190.                 Debug.Log("autobackupinterval = " + Singleton<GameManager>.Instance.ServerConfig.AutoBackupInterval);
  191.             }
  192.             else
  193.             {
  194.                 try
  195.                 {
  196.                     float num14 = float.Parse(yba.splitList[1]);
  197.                     Singleton<GameManager>.Instance.ServerConfig.AutoBackupInterval = num14;
  198.                 }
  199.                 catch
  200.                 {
  201.                     Debug.Log("format: autobackupinterval <seconds>");
  202.                 }
  203.             }
  204.         }
  205.         else if (yba.splitList[0] == "expandpools")
  206.         {
  207.             try
  208.             {
  209.                 int amount = int.Parse(yba.splitList[1]);
  210.                 base.StartCoroutine(this.ExpandPools(amount));
  211.             }
  212.             catch (Exception)
  213.             {
  214.                 Debug.Log("Must supply a number");
  215.             }
  216.         }
  217.         else if (yba.splitList[0] == "warmshaders")
  218.         {
  219.             Shader.WarmupAllShaders();
  220.         }
  221.         else if (yba.splitList[0] == "dumpview")
  222.         {
  223.             try
  224.             {
  225.                 int viewId = int.Parse(yba.splitList[1]);
  226.                 Singleton<NetworkManager>.Instance.Logger.DumpView(viewId);
  227.             }
  228.             catch (Exception)
  229.             {
  230.                 Debug.Log("Format: dumpview <viewsubid>");
  231.                 throw;
  232.             }
  233.         }
  234.         else if ((yba.splitList[0] == "g") && (yba.splitList[1] == "all"))
  235.         {
  236.             GlobalItemManager manager = Object.FindObjectOfType<GlobalItemManager>();
  237.             int num17 = manager.MaxStaticItemId();
  238.             for (int j = 1; j <= num17; j++)
  239.             {
  240.                 IItem item2 = manager.GetItem(j);
  241.                 if (item2 != null)
  242.                 {
  243.                     manager.GiveItemClient(j, item2.MaxStackSize);
  244.                 }
  245.             }
  246.         }
  247.         else if (yba.splitList[0] == "g")
  248.         {
  249.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  250.             {
  251.                 Debug.Log("Must be client connected to a server.");
  252.             }
  253.             else
  254.             {
  255.                 try
  256.                 {
  257.                     int num19;
  258.                     int count = int.Parse(yba.splitList[2]);
  259.                     if (!int.TryParse(yba.splitList[1], out num19))
  260.                     {
  261.                         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>>();
  262.                         foreach (KeyValuePair<int, IItem> pair in list)
  263.                         {
  264.                             Object.FindObjectOfType<GlobalItemManager>().GiveItemClient(pair.Key, count);
  265.                         }
  266.                         if (list.Count == 0)
  267.                         {
  268.                             Debug.Log("No items found under the name " + yba.splitList[1]);
  269.                         }
  270.                     }
  271.                     else
  272.                     {
  273.                         Object.FindObjectOfType<GlobalItemManager>().GiveItemClient(num19, count);
  274.                     }
  275.                 }
  276.                 catch (Exception exception)
  277.                 {
  278.                     Debug.Log("Invalid format. Expceted: give <itemid / itemname> <count>");
  279.                     Debug.Log(exception.Message);
  280.                 }
  281.             }
  282.         }
  283.         else if (yba.splitList[0] == "unloadassets")
  284.         {
  285.             Resources.UnloadUnusedAssets();
  286.             long totalMemory = GC.GetTotalMemory(false);
  287.             Debug.Log("Unloaded assets, current Mono memory allocated: " + ((totalMemory / 0x400L) / 0x400L) + "mb");
  288.         }
  289.         else if (yba.splitList[0] == "queryport")
  290.         {
  291.             if (yba.splitList.Length == 1)
  292.             {
  293.                 Debug.Log("queryport = " + Singleton<GameManager>.Instance.ServerConfig.MasterServerPort);
  294.             }
  295.             else
  296.             {
  297.                 try
  298.                 {
  299.                     int num22 = int.Parse(yba.splitList[1]);
  300.                     Singleton<GameManager>.Instance.ServerConfig.MasterServerPort = num22;
  301.                 }
  302.                 catch
  303.                 {
  304.                     Debug.Log("format: queryport <port>");
  305.                 }
  306.             }
  307.         }
  308.         else if (yba.splitList[0] == "loadbalancerframebudget")
  309.         {
  310.             if (yba.splitList.Length == 1)
  311.             {
  312.                 Debug.Log("loadbalancerframebudget = " + Singleton<GameManager>.Instance.ServerConfig.FrameBudget);
  313.             }
  314.             else
  315.             {
  316.                 try
  317.                 {
  318.                     int num23 = int.Parse(yba.splitList[1]);
  319.                     Singleton<GameManager>.Instance.ServerConfig.FrameBudget = Mathf.Clamp(num23, 50, 500);
  320.                 }
  321.                 catch
  322.                 {
  323.                     Debug.Log("format: loadbalancerframebudget <budget>");
  324.                 }
  325.             }
  326.         }
  327.         else if (yba.splitList[0] == "itemlist")
  328.         {
  329.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  330.             {
  331.                 Debug.Log("Must be client connected to a server.");
  332.             }
  333.             else
  334.             {
  335.                 if (<>f__am$cache7 == null)
  336.                 {
  337.                     <>f__am$cache7 = x => x.ItemId;
  338.                 }
  339.                 List<IItem> list2 = Singleton<GlobalItemManager>.Instance.GetItems().Values.OrderBy<IItem, int>(<>f__am$cache7).ToList<IItem>();
  340.                 if (yba.splitList.Length > 1)
  341.                 {
  342.                     list2 = list2.Where<IItem>(new Func<IItem, bool>(yba.<>m__C0)).ToList<IItem>();
  343.                 }
  344.                 StringBuilder builder = new StringBuilder();
  345.                 foreach (IItem item3 in list2)
  346.                 {
  347.                     if (!item3.IsUnique())
  348.                     {
  349.                         builder.Append(string.Format("{0} : {1}\n", item3.ItemId, LocalizationUtilities.CleanUp(item3.GetNameKey())));
  350.                     }
  351.                 }
  352.                 Debug.Log(builder.ToString());
  353.             }
  354.         }
  355.         else if (yba.splitList[0] == "refreshai")
  356.         {
  357.             Singleton<GameManager>.Instance.RefreshAIClient();
  358.         }
  359.         else if (yba.splitList[0] == "changeskin")
  360.         {
  361.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  362.             {
  363.                 Debug.Log("Must be client connected to a server.");
  364.             }
  365.             else if (yba.splitList.Length > 1)
  366.             {
  367.                 int skin = int.Parse(yba.splitList[1]);
  368.                 Singleton<GameManager>.Instance.FocusedPlayer.GetComponent<SkinChanger>().ChangeSkinOwner(skin);
  369.             }
  370.         }
  371.         else if (yba.splitList[0] == "changebeard")
  372.         {
  373.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  374.             {
  375.                 Debug.Log("Must be client connected to a server.");
  376.             }
  377.             else if (yba.splitList.Length > 2)
  378.             {
  379.                 int itemCode = int.Parse(yba.splitList[1]);
  380.                 int color = int.Parse(yba.splitList[2]);
  381.                 Singleton<GameManager>.Instance.FocusedPlayer.GetComponent<SkinChanger>().ChangeBeardOwner(itemCode, color);
  382.             }
  383.         }
  384.         else if (yba.splitList[0] == "maxplayers")
  385.         {
  386.             try
  387.             {
  388.                 int num27 = int.Parse(yba.splitList[1]);
  389.                 if ((Singleton<GameManager>.Instance.State == EGameState.Hosting) && (Network.maxConnections < num27))
  390.                 {
  391.                     Debug.Log("Can't increase max players while a server is running");
  392.                 }
  393.                 else
  394.                 {
  395.                     Singleton<GameManager>.Instance.ServerConfig.MaxPlayers = Math.Min(60, num27);
  396.                 }
  397.             }
  398.             catch (Exception)
  399.             {
  400.                 Debug.Log("Inavlid format");
  401.                 throw;
  402.             }
  403.         }
  404.         else if (yba.splitList[0] == "servername")
  405.         {
  406.             try
  407.             {
  408.                 if (yba.splitList.Length == 1)
  409.                 {
  410.                     Debug.Log("Server name: " + Singleton<GameManager>.Instance.ServerConfig.GameName);
  411.                 }
  412.                 else
  413.                 {
  414.                     Singleton<GameManager>.Instance.ServerConfig.GameName = pCommand.Substring(11);
  415.                     Singleton<GameManager>.Instance.InvalidateServerConfig();
  416.                 }
  417.             }
  418.             catch (Exception)
  419.             {
  420.                 Debug.Log("Inavlid format");
  421.                 throw;
  422.             }
  423.         }
  424.         else if (yba.splitList[0] == "targetfps")
  425.         {
  426.             try
  427.             {
  428.                 if (yba.splitList.Length == 1)
  429.                 {
  430.                     Debug.Log("Target fps: " + Singleton<GameManager>.Instance.ServerConfig.TargetFPS);
  431.                 }
  432.                 else
  433.                 {
  434.                     Singleton<GameManager>.Instance.ServerConfig.TargetFPS = int.Parse(yba.splitList[1]);
  435.                     Singleton<GameManager>.Instance.InvalidateServerConfig();
  436.                 }
  437.             }
  438.             catch (Exception)
  439.             {
  440.                 Debug.Log("Inavlid format");
  441.                 throw;
  442.             }
  443.         }
  444.         else if (yba.splitList[0] == "quit")
  445.         {
  446.             if (yba.splitList.Length == 1)
  447.             {
  448.                 Singleton<GameManager>.Instance.Quit(0);
  449.             }
  450.             else if (yba.splitList.Length == 2)
  451.             {
  452.                 Singleton<GameManager>.Instance.Quit(int.Parse(yba.splitList[1]));
  453.             }
  454.         }
  455.         else if (yba.splitList[0] == "cancelquit")
  456.         {
  457.             Singleton<GameManager>.Instance.CancelQuit();
  458.         }
  459.         else if (yba.splitList[0] == "creativemode")
  460.         {
  461.             try
  462.             {
  463.                 if (int.Parse(yba.splitList[1]) == 0)
  464.                 {
  465.                     ConstructionItem.CreativeMode = false;
  466.                 }
  467.                 else
  468.                 {
  469.                     ConstructionItem.CreativeMode = true;
  470.                 }
  471.             }
  472.             catch (Exception)
  473.             {
  474.                 Debug.Log("creativemode <1/0>");
  475.             }
  476.         }
  477.         else if (yba.splitList[0] == "slack")
  478.         {
  479.             Singleton<GameManager>.Instance.EnableSlackNotifications = true;
  480.         }
  481.         else if (yba.splitList[0] == "dumpbiome")
  482.         {
  483.             if (Network.isClient)
  484.             {
  485.                 GameObject focusedPlayer = Singleton<GameManager>.Instance.FocusedPlayer;
  486.                 if (focusedPlayer != null)
  487.                 {
  488.                     BiomeCellData data = new BiomeCellData();
  489.                     BiomeManager.Instance.FillGenerateBiomeData(focusedPlayer.transform.position.xz(), data);
  490.                     for (int k = 0; k < data.Biome.Length; k++)
  491.                     {
  492.                         Debug.Log(string.Format("Biome: {0}\tWeight: {1}", (EBiomePreset) data.Biome[k], data.Weights[k]));
  493.                     }
  494.                 }
  495.             }
  496.         }
  497.         else if (yba.splitList[0] == "serverstatus")
  498.         {
  499.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  500.             {
  501.                 Debug.Log("Not connected to a server");
  502.             }
  503.             else
  504.             {
  505.                 Singleton<GameManager>.Instance.RPC("GetServerStatus", RPCMode.Server, new object[0]);
  506.             }
  507.         }
  508.         else if (yba.splitList[0] == "playerid")
  509.         {
  510.             Debug.Log(Singleton<GameManager>.Instance.LocalIdentifier.ToString());
  511.         }
  512.         else if (yba.splitList[0] == "rcon")
  513.         {
  514.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  515.             {
  516.                 Debug.Log("Must be connect to a server");
  517.             }
  518.             else
  519.             {
  520.                 object[] objArray2 = new object[] { pCommand.Substring(yba.splitList[0].Length + 1) };
  521.                 base.RPC("RCON", RPCMode.Server, objArray2);
  522.             }
  523.         }
  524.         else if (yba.splitList[0] == "kick")
  525.         {
  526.             if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
  527.             {
  528.                 Debug.Log("Must be executed on the server");
  529.             }
  530.             else
  531.             {
  532.                 if (yba.splitList.Length == 1)
  533.                 {
  534.                     Debug.Log("kick <start of playerid> <reason>");
  535.                 }
  536.                 if (yba.splitList.Length == 2)
  537.                 {
  538.                     Debug.Log("Must supply a reason");
  539.                 }
  540.                 try
  541.                 {
  542.                     Singleton<GameManager>.Instance.KickPlayer(yba.splitList[1], pCommand.Substring((yba.splitList[0].Length + yba.splitList[1].Length) + 2));
  543.                 }
  544.                 catch (Exception)
  545.                 {
  546.                     Debug.LogError("Parse failed! Expected format is:\nkickplayer <statusindex> <reason>");
  547.                 }
  548.             }
  549.         }
  550.         else if (yba.splitList[0] == "changelevel")
  551.         {
  552.             if ((Singleton<GameManager>.Instance.State != EGameState.ClientReady) && (Singleton<GameManager>.Instance.State != EGameState.Hosting))
  553.             {
  554.                 Debug.Log("Not connected to a server");
  555.             }
  556.             else
  557.             {
  558.                 Singleton<GameManager>.Instance.ChangeLevel(yba.splitList[1]);
  559.             }
  560.         }
  561.         else if (yba.splitList[0] == "teleport")
  562.         {
  563.             if ((Singleton<GameManager>.Instance.State != EGameState.ClientReady) && (Singleton<GameManager>.Instance.State != EGameState.Hosting))
  564.             {
  565.                 Debug.Log("Not connected to a server");
  566.             }
  567.             else if (yba.splitList.Length != 3)
  568.             {
  569.                 Debug.Log("invalid format: teleport <fromplayer> <toplayer>");
  570.             }
  571.             else
  572.             {
  573.                 object[] objArray3 = new object[] { yba.splitList[1], yba.splitList[2] };
  574.                 Singleton<GameManager>.Instance.RPC("TeleportPlayer", RPCMode.Server, objArray3);
  575.             }
  576.         }
  577.         else if (yba.splitList[0] == "saveserver")
  578.         {
  579.             if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
  580.             {
  581.                 Debug.Log("Must be executed on the server");
  582.             }
  583.             else if (yba.splitList.Length > 1)
  584.             {
  585.                 base.StartCoroutine(Singleton<GameSerializer>.Instance.SaveServer(yba.splitList[1], true));
  586.             }
  587.             else
  588.             {
  589.                 base.StartCoroutine(Singleton<GameSerializer>.Instance.SaveServer("autosave_" + Singleton<GameManager>.Instance.ServerConfig.Map, true));
  590.             }
  591.         }
  592.         else if (yba.splitList[0] == "destroyall")
  593.         {
  594.             if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
  595.             {
  596.                 Debug.Log("Must be executed on the server");
  597.             }
  598.             else if (yba.splitList.Length != 2)
  599.             {
  600.                 Debug.Log("Usage: destroyall <partialname>");
  601.             }
  602.             else
  603.             {
  604.                 NetworkView[] viewArray = Object.FindObjectsOfType<NetworkView>();
  605.                 int num30 = 0;
  606.                 foreach (NetworkView view in viewArray)
  607.                 {
  608.                     if (view.isActiveAndEnabled && view.name.ToLower().Contains(yba.splitList[1].ToLower()))
  609.                     {
  610.                         Singleton<NetworkManager>.Instance.NetDestroy(view);
  611.                         num30++;
  612.                     }
  613.                 }
  614.                 Debug.Log("Destroyed " + num30 + " objects");
  615.             }
  616.         }
  617.         else if (yba.splitList[0] == "kill")
  618.         {
  619.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  620.             {
  621.                 Debug.Log("Not connected to a server");
  622.             }
  623.             else
  624.             {
  625.                 Singleton<GameManager>.Instance.KillPlayerClient();
  626.             }
  627.         }
  628.         else if (yba.splitList[0] == "loadserver")
  629.         {
  630.             if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
  631.             {
  632.                 Debug.Log("Must be executed on a server");
  633.             }
  634.             else
  635.             {
  636.                 Singleton<GameManager>.Instance.LoadServer(yba.splitList[1]);
  637.             }
  638.         }
  639.         else if (yba.splitList[0] == "changename")
  640.         {
  641.             if ((yba.splitList[1].Length <= 13) && (yba.splitList[1].Length >= 3))
  642.             {
  643.                 if (Singleton<GameManager>.Instance.State == EGameState.ClientReady)
  644.                 {
  645.                     Singleton<GameManager>.Instance.ChangeNameClient(yba.splitList[1]);
  646.                 }
  647.             }
  648.             else
  649.             {
  650.                 Debug.LogError("Names must be between 3 and 13 characters");
  651.             }
  652.         }
  653.         else if (yba.splitList[0] == "spawn")
  654.         {
  655.             Singleton<NetworkManager>.Instance.SpawnPrefabClient(yba.splitList[1]);
  656.         }
  657.         else
  658.         {
  659.             string str2;
  660.             Dictionary<string, int> dictionary2;
  661.             int num33;
  662.             if (yba.splitList[0] == "debug")
  663.             {
  664.                 if (yba.splitList.Length != 2)
  665.                 {
  666.                     Debug.Log("Invalid use of debug - format is `debug 1` or `debug 0`");
  667.                 }
  668.                 str2 = yba.splitList[1];
  669.                 if (str2 != null)
  670.                 {
  671.                     if (<>f__switch$map9 == null)
  672.                     {
  673.                         dictionary2 = new Dictionary<string, int>(2);
  674.                         dictionary2.Add("1", 0);
  675.                         dictionary2.Add("0", 1);
  676.                         <>f__switch$map9 = dictionary2;
  677.                     }
  678.                     if (<>f__switch$map9.TryGetValue(str2, out num33))
  679.                     {
  680.                         if (num33 == 0)
  681.                         {
  682.                             Singleton<InstantDebug>.Instance.SetEnabled(true);
  683.                             return;
  684.                         }
  685.                         if (num33 == 1)
  686.                         {
  687.                             Singleton<InstantDebug>.Instance.SetEnabled(false);
  688.                             return;
  689.                         }
  690.                     }
  691.                 }
  692.                 Debug.Log("Invalid use of debug - format is `debug 1` or `debug 0`");
  693.             }
  694.             else if (yba.splitList[0] == "playerlootmode")
  695.             {
  696.                 if (yba.splitList.Length != 2)
  697.                 {
  698.                     Debug.Log("Usage: playerlootmode <modenumber>");
  699.                     Debug.Log("0: Drop nothing");
  700.                     Debug.Log("1: Drop backpack contents only");
  701.                     Debug.Log("2: Drop backpack + random items depending on infamy level");
  702.                     Debug.Log("3: Everything");
  703.                 }
  704.                 str2 = yba.splitList[1];
  705.                 if (str2 != null)
  706.                 {
  707.                     if (<>f__switch$mapA == null)
  708.                     {
  709.                         dictionary2 = new Dictionary<string, int>(4);
  710.                         dictionary2.Add("0", 0);
  711.                         dictionary2.Add("1", 1);
  712.                         dictionary2.Add("2", 2);
  713.                         dictionary2.Add("3", 3);
  714.                         <>f__switch$mapA = dictionary2;
  715.                     }
  716.                     if (<>f__switch$mapA.TryGetValue(str2, out num33))
  717.                     {
  718.                         switch (num33)
  719.                         {
  720.                             case 0:
  721.                                 Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.None;
  722.                                 return;
  723.  
  724.                             case 1:
  725.                                 Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.BackpackOnly;
  726.                                 return;
  727.  
  728.                             case 2:
  729.                                 Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.BackpackOnlyWithInfamy;
  730.                                 return;
  731.  
  732.                             case 3:
  733.                                 Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.Everything;
  734.                                 return;
  735.                         }
  736.                     }
  737.                 }
  738.                 Debug.Log("Invalid use of playerlootmode - Usage: playerlootmode <modenumber>");
  739.             }
  740.             else if (yba.splitList[0] == "deleteprefs")
  741.             {
  742.                 PlayerPrefs.DeleteAll();
  743.                 Debug.Log("Deleted all player preferences.");
  744.             }
  745.             else if (yba.splitList[0] == "deletepreference")
  746.             {
  747.                 if (yba.splitList.Length < 2)
  748.                 {
  749.                     Debug.LogError("Format Exception: expected deletepreference <key>");
  750.                 }
  751.                 else
  752.                 {
  753.                     StringBuilder builder2 = new StringBuilder(strArray[1]);
  754.                     for (int m = 2; m < strArray.Length; m++)
  755.                     {
  756.                         builder2.Append(" ");
  757.                         builder2.Append(strArray[m]);
  758.                     }
  759.                     if (!PlayerPrefs.HasKey(builder2.ToString()))
  760.                     {
  761.                         Debug.LogError(string.Format("No key with name '{0}' found!", builder2));
  762.                     }
  763.                     else
  764.                     {
  765.                         PlayerPrefs.DeleteKey(builder2.ToString());
  766.                         Debug.Log(string.Format("Deleted key with name '{0}'", builder2));
  767.                     }
  768.                 }
  769.             }
  770.             else if (yba.splitList[0] == "dumpleaks")
  771.             {
  772.                 StringBuilder sb = new StringBuilder();
  773.                 sb.AppendLine("Ref tracked behaviors: ");
  774.                 foreach (KeyValuePair<Type, Expression<Func<string>>> pair2 in LeakTracker.RegisteredLeakers)
  775.                 {
  776.                     sb.AppendLine("\t" + pair2.Key.ToString() + " : " + pair2.Value.Compile()());
  777.                 }
  778.                 sb.AppendLine("BitStream Counts: ");
  779.                 Singleton<NetworkManager>.Instance.BitStreamPool.DumpStreamLeaks(sb);
  780.                 sb.AppendLine("Generic Pools: ");
  781.                 Singleton<ClassInstancePool>.Instance.DumpPoolCounts(sb);
  782.                 Debug.Log(sb.ToString());
  783.             }
  784.             else if (yba.splitList[0] == "time")
  785.             {
  786.                 if (Singleton<TimeManager>.HasInstance())
  787.                 {
  788.                     Debug.Log(Singleton<TimeManager>.Instance.GetCurrentGameTime().ToString());
  789.                 }
  790.             }
  791.             else if (yba.splitList[0] == "analytics")
  792.             {
  793.                 try
  794.                 {
  795.                     if (Singleton<UnityAnalyticsIntegration>.HasInstance() && (yba.splitList.Length == 2))
  796.                     {
  797.                         Singleton<UnityAnalyticsIntegration>.Instance.AnalyticsEnabled = int.Parse(yba.splitList[1]) == 1;
  798.                     }
  799.                     else
  800.                     {
  801.                         Debug.LogError("Error! Expected: analytics <0-1>");
  802.                     }
  803.                 }
  804.                 catch (Exception)
  805.                 {
  806.                     Debug.LogError("Error! Expected: analytics <0-1>");
  807.                 }
  808.             }
  809.             else
  810.             {
  811.                 Debug.Log("Unknown command: " + yba.splitList[0]);
  812.             }
  813.         }
  814.     }
  815. }
  816.  
  817.  
  818.  
  819.  
  820.   private void ExecuteCommandRaw(string pCommand)
  821. {
  822.     <ExecuteCommandRaw>c__AnonStoreyBA yba = new <ExecuteCommandRaw>c__AnonStoreyBA();
  823.     pCommand = pCommand.Trim();
  824.     string str = pCommand.ToLower();
  825.     char[] separator = new char[] { ' ' };
  826.     yba.splitList = str.Split(separator);
  827.     char[] chArray2 = new char[] { ' ' };
  828.     string[] strArray = pCommand.Split(chArray2);
  829.     object[] args = new object[] { str };
  830.     if (Interface.CallHook("OnRunCommand", args) == null)
  831.     {
  832.         Debug.Log("> " + pCommand + "\n");
  833.         if (yba.splitList[0] == "connect")
  834.         {
  835.             try
  836.             {
  837.                 if (yba.splitList[1].IndexOf(':') > 0)
  838.                 {
  839.                     char[] chArray3 = new char[] { ':' };
  840.                     string[] strArray2 = yba.splitList[1].Split(chArray3);
  841.                     int port = int.Parse(strArray2[1]);
  842.                     Singleton<GameManager>.Instance.Connect(strArray2[0], port);
  843.                 }
  844.                 else
  845.                 {
  846.                     Singleton<GameManager>.Instance.Connect(yba.splitList[1], 0x3247);
  847.                 }
  848.             }
  849.             catch
  850.             {
  851.                 Debug.Log("Invalid format, host must be of the format 192.168.1.1:123");
  852.             }
  853.         }
  854.         else if (yba.splitList[0] == "addadmin")
  855.         {
  856.             try
  857.             {
  858.                 ulong ulSteamID = Convert.ToUInt64(yba.splitList[1]);
  859.                 Singleton<GameManager>.Instance.SetAdmin(new CSteamID(ulSteamID));
  860.                 Debug.Log("Admin user added");
  861.             }
  862.             catch
  863.             {
  864.                 Debug.Log("Invalid format, you must enter steamid64 (use playerid to query)");
  865.             }
  866.         }
  867.         else if (yba.splitList[0] == "testhost")
  868.         {
  869.             Singleton<GameManager>.Instance.Host(0x3247, null, "zonetest");
  870.         }
  871.         else if (yba.splitList[0] == "adminmessage")
  872.         {
  873.             if (Singleton<GameManager>.Instance.State == EGameState.Hosting)
  874.             {
  875.                 Singleton<ChatManager>.Instance.AppendNotice(pCommand.Substring(13), Color.red);
  876.             }
  877.         }
  878.         else if (yba.splitList[0] == "find")
  879.         {
  880.             foreach (MeshFilter filter in Object.FindObjectsOfType<MeshFilter>())
  881.             {
  882.                 if (filter.sharedMesh == null)
  883.                 {
  884.                     Debug.Log("Found missing mesh ", filter.gameObject);
  885.                 }
  886.             }
  887.         }
  888.         else if (yba.splitList[0] == "host")
  889.         {
  890.             try
  891.             {
  892.                 int num4 = int.Parse(yba.splitList[1]);
  893.                 if (yba.splitList.Length > 3)
  894.                 {
  895.                     Singleton<GameManager>.Instance.Host(num4, yba.splitList[3], yba.splitList[2]);
  896.                 }
  897.                 else if (yba.splitList.Length > 2)
  898.                 {
  899.                     Singleton<GameManager>.Instance.Host(num4, null, yba.splitList[2]);
  900.                 }
  901.                 else if (yba.splitList.Length == 2)
  902.                 {
  903.                     Singleton<GameManager>.Instance.Host(num4, null, "DiemensLand");
  904.                 }
  905.                 else
  906.                 {
  907.                     Debug.Log("Invalid format. Expected: host <port> <map> <loadgame>");
  908.                 }
  909.             }
  910.             catch
  911.             {
  912.                 Debug.Log("Invalid format. Expected: host <port> <map> <loadgame>");
  913.             }
  914.         }
  915.         else if (yba.splitList[0] == "stockvehicles")
  916.         {
  917.             if (Network.isServer)
  918.             {
  919.                 foreach (VehicleController4Wheel wheel in Object.FindObjectsOfType<VehicleController4Wheel>())
  920.                 {
  921.                     RestrictedInventory component = wheel.GetComponent<RestrictedInventory>();
  922.                     <ExecuteCommandRaw>c__AnonStoreyB7 yb = new <ExecuteCommandRaw>c__AnonStoreyB7();
  923.                     SlotRestriction[] restrictions = component.Restrictions;
  924.                     for (int i = 0; i < restrictions.Length; i++)
  925.                     {
  926.                         yb.slotRestriction = restrictions[i];
  927.                         if (component.Items[yb.slotRestriction.SlotNumber] == null)
  928.                         {
  929.                             IItem item = Singleton<GlobalItemManager>.Instance.GetItems().Values.FirstOrDefault<IItem>(new Func<IItem, bool>(yb.<>m__BA));
  930.                             if (item != null)
  931.                             {
  932.                                 component.Items[yb.slotRestriction.SlotNumber] = new ItemInstance(item, item.MaxStackSize);
  933.                             }
  934.                         }
  935.                         component.Invalidate(false);
  936.                     }
  937.                 }
  938.             }
  939.         }
  940.         else if (yba.splitList[0] == "freezetime")
  941.         {
  942.             if (Network.isServer)
  943.             {
  944.                 int num7 = 0x15180;
  945.                 float dayPercentage = Singleton<TimeManager>.Instance.GetCurrentGameTime().DayPercentage;
  946.                 Singleton<TimeManager>.Instance.DayLength = 9999999f;
  947.                 Singleton<TimeManager>.Instance.NightLength = 9999999f;
  948.                 Singleton<TimeManager>.Instance.InitialTimeOffset = dayPercentage * num7;
  949.             }
  950.             else
  951.             {
  952.                 Debug.LogError("SetTime must be executed on the server!");
  953.             }
  954.         }
  955.         else if (yba.splitList[0] == "setbiome")
  956.         {
  957.             <ExecuteCommandRaw>c__AnonStoreyB8 yb2 = new <ExecuteCommandRaw>c__AnonStoreyB8 {
  958.                 biomeString = (yba.splitList.Length != 1) ? yba.splitList[1] : "None"
  959.             };
  960.             EBiomePreset preset = ((EBiomePreset[]) Enum.GetValues(typeof(EBiomePreset))).FirstOrDefault<EBiomePreset>(new Func<EBiomePreset, bool>(yb2.<>m__BB));
  961.             if (BiomeManager.Instance != null)
  962.             {
  963.                 BiomeManager.Instance.OverridePreset = preset;
  964.                 Debug.Log("Forcing biome " + preset.ToString());
  965.             }
  966.         }
  967.         else if (yba.splitList[0] == "settime")
  968.         {
  969.             if (yba.splitList.Length != 0)
  970.             {
  971.                 if (!Network.isServer)
  972.                 {
  973.                     Debug.LogError("SetTime must be executed on the server!");
  974.                 }
  975.                 else
  976.                 {
  977.                     try
  978.                     {
  979.                         int num9 = 0x15180;
  980.                         float num10 = float.Parse(yba.splitList[1]);
  981.                         float num11 = Singleton<TimeManager>.Instance.GetCurrentGameTime().DayPercentage;
  982.                         float initialTimeOffset = Singleton<TimeManager>.Instance.InitialTimeOffset;
  983.                         float num13 = ((num10 - num11) * num9) + initialTimeOffset;
  984.                         Singleton<TimeManager>.Instance.InitialTimeOffset = num13;
  985.                     }
  986.                     catch
  987.                     {
  988.                         Debug.Log("format settime <percentage through the day(0.5)>");
  989.                     }
  990.                 }
  991.             }
  992.         }
  993.         else if (yba.splitList[0] == "lowlod")
  994.         {
  995.             <ExecuteCommandRaw>c__AnonStoreyB9 yb3 = new <ExecuteCommandRaw>c__AnonStoreyB9();
  996.             CharacterAnimationInputs[] source = Object.FindObjectsOfType<CharacterAnimationInputs>();
  997.             yb3.lowLod = yba.splitList[1] == "1";
  998.             if (<>f__am$cache6 == null)
  999.             {
  1000.                 <>f__am$cache6 = x => !x.networkView.isMine;
  1001.             }
  1002.             source.Where<CharacterAnimationInputs>(<>f__am$cache6).ToList<CharacterAnimationInputs>().ForEach(new Action<CharacterAnimationInputs>(yb3.<>m__BD));
  1003.             Debug.Log(string.Concat(new object[] { "Set ", source.Length - 1, " players to ", !yb3.lowLod ? "High" : "Low", " lod" }));
  1004.         }
  1005.         else if (yba.splitList[0] == "autobackupinterval")
  1006.         {
  1007.             if (yba.splitList.Length == 1)
  1008.             {
  1009.                 Debug.Log("autobackupinterval = " + Singleton<GameManager>.Instance.ServerConfig.AutoBackupInterval);
  1010.             }
  1011.             else
  1012.             {
  1013.                 try
  1014.                 {
  1015.                     float num14 = float.Parse(yba.splitList[1]);
  1016.                     Singleton<GameManager>.Instance.ServerConfig.AutoBackupInterval = num14;
  1017.                 }
  1018.                 catch
  1019.                 {
  1020.                     Debug.Log("format: autobackupinterval <seconds>");
  1021.                 }
  1022.             }
  1023.         }
  1024.         else if (yba.splitList[0] == "expandpools")
  1025.         {
  1026.             try
  1027.             {
  1028.                 int amount = int.Parse(yba.splitList[1]);
  1029.                 base.StartCoroutine(this.ExpandPools(amount));
  1030.             }
  1031.             catch (Exception)
  1032.             {
  1033.                 Debug.Log("Must supply a number");
  1034.             }
  1035.         }
  1036.         else if (yba.splitList[0] == "warmshaders")
  1037.         {
  1038.             Shader.WarmupAllShaders();
  1039.         }
  1040.         else if (yba.splitList[0] == "dumpview")
  1041.         {
  1042.             try
  1043.             {
  1044.                 int viewId = int.Parse(yba.splitList[1]);
  1045.                 Singleton<NetworkManager>.Instance.Logger.DumpView(viewId);
  1046.             }
  1047.             catch (Exception)
  1048.             {
  1049.                 Debug.Log("Format: dumpview <viewsubid>");
  1050.                 throw;
  1051.             }
  1052.         }
  1053.         else if ((yba.splitList[0] == "g") && (yba.splitList[1] == "all"))
  1054.         {
  1055.             GlobalItemManager manager = Object.FindObjectOfType<GlobalItemManager>();
  1056.             int num17 = manager.MaxStaticItemId();
  1057.             for (int j = 1; j <= num17; j++)
  1058.             {
  1059.                 IItem item2 = manager.GetItem(j);
  1060.                 if (item2 != null)
  1061.                 {
  1062.                     manager.GiveItemClient(j, item2.MaxStackSize);
  1063.                 }
  1064.             }
  1065.         }
  1066.         else if (yba.splitList[0] == "g")
  1067.         {
  1068.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  1069.             {
  1070.                 Debug.Log("Must be client connected to a server.");
  1071.             }
  1072.             else
  1073.             {
  1074.                 try
  1075.                 {
  1076.                     int num19;
  1077.                     int count = int.Parse(yba.splitList[2]);
  1078.                     if (!int.TryParse(yba.splitList[1], out num19))
  1079.                     {
  1080.                         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>>();
  1081.                         foreach (KeyValuePair<int, IItem> pair in list)
  1082.                         {
  1083.                             Object.FindObjectOfType<GlobalItemManager>().GiveItemClient(pair.Key, count);
  1084.                         }
  1085.                         if (list.Count == 0)
  1086.                         {
  1087.                             Debug.Log("No items found under the name " + yba.splitList[1]);
  1088.                         }
  1089.                     }
  1090.                     else
  1091.                     {
  1092.                         Object.FindObjectOfType<GlobalItemManager>().GiveItemClient(num19, count);
  1093.                     }
  1094.                 }
  1095.                 catch (Exception exception)
  1096.                 {
  1097.                     Debug.Log("Invalid format. Expceted: give <itemid / itemname> <count>");
  1098.                     Debug.Log(exception.Message);
  1099.                 }
  1100.             }
  1101.         }
  1102.         else if (yba.splitList[0] == "unloadassets")
  1103.         {
  1104.             Resources.UnloadUnusedAssets();
  1105.             long totalMemory = GC.GetTotalMemory(false);
  1106.             Debug.Log("Unloaded assets, current Mono memory allocated: " + ((totalMemory / 0x400L) / 0x400L) + "mb");
  1107.         }
  1108.         else if (yba.splitList[0] == "queryport")
  1109.         {
  1110.             if (yba.splitList.Length == 1)
  1111.             {
  1112.                 Debug.Log("queryport = " + Singleton<GameManager>.Instance.ServerConfig.MasterServerPort);
  1113.             }
  1114.             else
  1115.             {
  1116.                 try
  1117.                 {
  1118.                     int num22 = int.Parse(yba.splitList[1]);
  1119.                     Singleton<GameManager>.Instance.ServerConfig.MasterServerPort = num22;
  1120.                 }
  1121.                 catch
  1122.                 {
  1123.                     Debug.Log("format: queryport <port>");
  1124.                 }
  1125.             }
  1126.         }
  1127.         else if (yba.splitList[0] == "loadbalancerframebudget")
  1128.         {
  1129.             if (yba.splitList.Length == 1)
  1130.             {
  1131.                 Debug.Log("loadbalancerframebudget = " + Singleton<GameManager>.Instance.ServerConfig.FrameBudget);
  1132.             }
  1133.             else
  1134.             {
  1135.                 try
  1136.                 {
  1137.                     int num23 = int.Parse(yba.splitList[1]);
  1138.                     Singleton<GameManager>.Instance.ServerConfig.FrameBudget = Mathf.Clamp(num23, 50, 500);
  1139.                 }
  1140.                 catch
  1141.                 {
  1142.                     Debug.Log("format: loadbalancerframebudget <budget>");
  1143.                 }
  1144.             }
  1145.         }
  1146.         else if (yba.splitList[0] == "itemlist")
  1147.         {
  1148.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  1149.             {
  1150.                 Debug.Log("Must be client connected to a server.");
  1151.             }
  1152.             else
  1153.             {
  1154.                 if (<>f__am$cache7 == null)
  1155.                 {
  1156.                     <>f__am$cache7 = x => x.ItemId;
  1157.                 }
  1158.                 List<IItem> list2 = Singleton<GlobalItemManager>.Instance.GetItems().Values.OrderBy<IItem, int>(<>f__am$cache7).ToList<IItem>();
  1159.                 if (yba.splitList.Length > 1)
  1160.                 {
  1161.                     list2 = list2.Where<IItem>(new Func<IItem, bool>(yba.<>m__C0)).ToList<IItem>();
  1162.                 }
  1163.                 StringBuilder builder = new StringBuilder();
  1164.                 foreach (IItem item3 in list2)
  1165.                 {
  1166.                     if (!item3.IsUnique())
  1167.                     {
  1168.                         builder.Append(string.Format("{0} : {1}\n", item3.ItemId, LocalizationUtilities.CleanUp(item3.GetNameKey())));
  1169.                     }
  1170.                 }
  1171.                 Debug.Log(builder.ToString());
  1172.             }
  1173.         }
  1174.         else if (yba.splitList[0] == "refreshai")
  1175.         {
  1176.             Singleton<GameManager>.Instance.RefreshAIClient();
  1177.         }
  1178.         else if (yba.splitList[0] == "changeskin")
  1179.         {
  1180.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  1181.             {
  1182.                 Debug.Log("Must be client connected to a server.");
  1183.             }
  1184.             else if (yba.splitList.Length > 1)
  1185.             {
  1186.                 int skin = int.Parse(yba.splitList[1]);
  1187.                 Singleton<GameManager>.Instance.FocusedPlayer.GetComponent<SkinChanger>().ChangeSkinOwner(skin);
  1188.             }
  1189.         }
  1190.         else if (yba.splitList[0] == "changebeard")
  1191.         {
  1192.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  1193.             {
  1194.                 Debug.Log("Must be client connected to a server.");
  1195.             }
  1196.             else if (yba.splitList.Length > 2)
  1197.             {
  1198.                 int itemCode = int.Parse(yba.splitList[1]);
  1199.                 int color = int.Parse(yba.splitList[2]);
  1200.                 Singleton<GameManager>.Instance.FocusedPlayer.GetComponent<SkinChanger>().ChangeBeardOwner(itemCode, color);
  1201.             }
  1202.         }
  1203.         else if (yba.splitList[0] == "maxplayers")
  1204.         {
  1205.             try
  1206.             {
  1207.                 int num27 = int.Parse(yba.splitList[1]);
  1208.                 if ((Singleton<GameManager>.Instance.State == EGameState.Hosting) && (Network.maxConnections < num27))
  1209.                 {
  1210.                     Debug.Log("Can't increase max players while a server is running");
  1211.                 }
  1212.                 else
  1213.                 {
  1214.                     Singleton<GameManager>.Instance.ServerConfig.MaxPlayers = Math.Min(60, num27);
  1215.                 }
  1216.             }
  1217.             catch (Exception)
  1218.             {
  1219.                 Debug.Log("Inavlid format");
  1220.                 throw;
  1221.             }
  1222.         }
  1223.         else if (yba.splitList[0] == "servername")
  1224.         {
  1225.             try
  1226.             {
  1227.                 if (yba.splitList.Length == 1)
  1228.                 {
  1229.                     Debug.Log("Server name: " + Singleton<GameManager>.Instance.ServerConfig.GameName);
  1230.                 }
  1231.                 else
  1232.                 {
  1233.                     Singleton<GameManager>.Instance.ServerConfig.GameName = pCommand.Substring(11);
  1234.                     Singleton<GameManager>.Instance.InvalidateServerConfig();
  1235.                 }
  1236.             }
  1237.             catch (Exception)
  1238.             {
  1239.                 Debug.Log("Inavlid format");
  1240.                 throw;
  1241.             }
  1242.         }
  1243.         else if (yba.splitList[0] == "targetfps")
  1244.         {
  1245.             try
  1246.             {
  1247.                 if (yba.splitList.Length == 1)
  1248.                 {
  1249.                     Debug.Log("Target fps: " + Singleton<GameManager>.Instance.ServerConfig.TargetFPS);
  1250.                 }
  1251.                 else
  1252.                 {
  1253.                     Singleton<GameManager>.Instance.ServerConfig.TargetFPS = int.Parse(yba.splitList[1]);
  1254.                     Singleton<GameManager>.Instance.InvalidateServerConfig();
  1255.                 }
  1256.             }
  1257.             catch (Exception)
  1258.             {
  1259.                 Debug.Log("Inavlid format");
  1260.                 throw;
  1261.             }
  1262.         }
  1263.         else if (yba.splitList[0] == "quit")
  1264.         {
  1265.             if (yba.splitList.Length == 1)
  1266.             {
  1267.                 Singleton<GameManager>.Instance.Quit(0);
  1268.             }
  1269.             else if (yba.splitList.Length == 2)
  1270.             {
  1271.                 Singleton<GameManager>.Instance.Quit(int.Parse(yba.splitList[1]));
  1272.             }
  1273.         }
  1274.         else if (yba.splitList[0] == "cancelquit")
  1275.         {
  1276.             Singleton<GameManager>.Instance.CancelQuit();
  1277.         }
  1278.         else if (yba.splitList[0] == "creativemode")
  1279.         {
  1280.             try
  1281.             {
  1282.                 if (int.Parse(yba.splitList[1]) == 0)
  1283.                 {
  1284.                     ConstructionItem.CreativeMode = false;
  1285.                 }
  1286.                 else
  1287.                 {
  1288.                     ConstructionItem.CreativeMode = true;
  1289.                 }
  1290.             }
  1291.             catch (Exception)
  1292.             {
  1293.                 Debug.Log("creativemode <1/0>");
  1294.             }
  1295.         }
  1296.         else if (yba.splitList[0] == "slack")
  1297.         {
  1298.             Singleton<GameManager>.Instance.EnableSlackNotifications = true;
  1299.         }
  1300.         else if (yba.splitList[0] == "dumpbiome")
  1301.         {
  1302.             if (Network.isClient)
  1303.             {
  1304.                 GameObject focusedPlayer = Singleton<GameManager>.Instance.FocusedPlayer;
  1305.                 if (focusedPlayer != null)
  1306.                 {
  1307.                     BiomeCellData data = new BiomeCellData();
  1308.                     BiomeManager.Instance.FillGenerateBiomeData(focusedPlayer.transform.position.xz(), data);
  1309.                     for (int k = 0; k < data.Biome.Length; k++)
  1310.                     {
  1311.                         Debug.Log(string.Format("Biome: {0}\tWeight: {1}", (EBiomePreset) data.Biome[k], data.Weights[k]));
  1312.                     }
  1313.                 }
  1314.             }
  1315.         }
  1316.         else if (yba.splitList[0] == "serverstatus")
  1317.         {
  1318.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  1319.             {
  1320.                 Debug.Log("Not connected to a server");
  1321.             }
  1322.             else
  1323.             {
  1324.                 Singleton<GameManager>.Instance.RPC("GetServerStatus", RPCMode.Server, new object[0]);
  1325.             }
  1326.         }
  1327.         else if (yba.splitList[0] == "playerid")
  1328.         {
  1329.             Debug.Log(Singleton<GameManager>.Instance.LocalIdentifier.ToString());
  1330.         }
  1331.         else if (yba.splitList[0] == "rcon")
  1332.         {
  1333.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  1334.             {
  1335.                 Debug.Log("Must be connect to a server");
  1336.             }
  1337.             else
  1338.             {
  1339.                 object[] objArray2 = new object[] { pCommand.Substring(yba.splitList[0].Length + 1) };
  1340.                 base.RPC("RCON", RPCMode.Server, objArray2);
  1341.             }
  1342.         }
  1343.         else if (yba.splitList[0] == "kick")
  1344.         {
  1345.             if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
  1346.             {
  1347.                 Debug.Log("Must be executed on the server");
  1348.             }
  1349.             else
  1350.             {
  1351.                 if (yba.splitList.Length == 1)
  1352.                 {
  1353.                     Debug.Log("kick <start of playerid> <reason>");
  1354.                 }
  1355.                 if (yba.splitList.Length == 2)
  1356.                 {
  1357.                     Debug.Log("Must supply a reason");
  1358.                 }
  1359.                 try
  1360.                 {
  1361.                     Singleton<GameManager>.Instance.KickPlayer(yba.splitList[1], pCommand.Substring((yba.splitList[0].Length + yba.splitList[1].Length) + 2));
  1362.                 }
  1363.                 catch (Exception)
  1364.                 {
  1365.                     Debug.LogError("Parse failed! Expected format is:\nkickplayer <statusindex> <reason>");
  1366.                 }
  1367.             }
  1368.         }
  1369.         else if (yba.splitList[0] == "changelevel")
  1370.         {
  1371.             if ((Singleton<GameManager>.Instance.State != EGameState.ClientReady) && (Singleton<GameManager>.Instance.State != EGameState.Hosting))
  1372.             {
  1373.                 Debug.Log("Not connected to a server");
  1374.             }
  1375.             else
  1376.             {
  1377.                 Singleton<GameManager>.Instance.ChangeLevel(yba.splitList[1]);
  1378.             }
  1379.         }
  1380.         else if (yba.splitList[0] == "teleport")
  1381.         {
  1382.             if ((Singleton<GameManager>.Instance.State != EGameState.ClientReady) && (Singleton<GameManager>.Instance.State != EGameState.Hosting))
  1383.             {
  1384.                 Debug.Log("Not connected to a server");
  1385.             }
  1386.             else if (yba.splitList.Length != 3)
  1387.             {
  1388.                 Debug.Log("invalid format: teleport <fromplayer> <toplayer>");
  1389.             }
  1390.             else
  1391.             {
  1392.                 object[] objArray3 = new object[] { yba.splitList[1], yba.splitList[2] };
  1393.                 Singleton<GameManager>.Instance.RPC("TeleportPlayer", RPCMode.Server, objArray3);
  1394.             }
  1395.         }
  1396.         else if (yba.splitList[0] == "saveserver")
  1397.         {
  1398.             if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
  1399.             {
  1400.                 Debug.Log("Must be executed on the server");
  1401.             }
  1402.             else if (yba.splitList.Length > 1)
  1403.             {
  1404.                 base.StartCoroutine(Singleton<GameSerializer>.Instance.SaveServer(yba.splitList[1], true));
  1405.             }
  1406.             else
  1407.             {
  1408.                 base.StartCoroutine(Singleton<GameSerializer>.Instance.SaveServer("autosave_" + Singleton<GameManager>.Instance.ServerConfig.Map, true));
  1409.             }
  1410.         }
  1411.         else if (yba.splitList[0] == "destroyall")
  1412.         {
  1413.             if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
  1414.             {
  1415.                 Debug.Log("Must be executed on the server");
  1416.             }
  1417.             else if (yba.splitList.Length != 2)
  1418.             {
  1419.                 Debug.Log("Usage: destroyall <partialname>");
  1420.             }
  1421.             else
  1422.             {
  1423.                 NetworkView[] viewArray = Object.FindObjectsOfType<NetworkView>();
  1424.                 int num30 = 0;
  1425.                 foreach (NetworkView view in viewArray)
  1426.                 {
  1427.                     if (view.isActiveAndEnabled && view.name.ToLower().Contains(yba.splitList[1].ToLower()))
  1428.                     {
  1429.                         Singleton<NetworkManager>.Instance.NetDestroy(view);
  1430.                         num30++;
  1431.                     }
  1432.                 }
  1433.                 Debug.Log("Destroyed " + num30 + " objects");
  1434.             }
  1435.         }
  1436.         else if (yba.splitList[0] == "kill")
  1437.         {
  1438.             if (Singleton<GameManager>.Instance.State != EGameState.ClientReady)
  1439.             {
  1440.                 Debug.Log("Not connected to a server");
  1441.             }
  1442.             else
  1443.             {
  1444.                 Singleton<GameManager>.Instance.KillPlayerClient();
  1445.             }
  1446.         }
  1447.         else if (yba.splitList[0] == "loadserver")
  1448.         {
  1449.             if (Singleton<GameManager>.Instance.State != EGameState.Hosting)
  1450.             {
  1451.                 Debug.Log("Must be executed on a server");
  1452.             }
  1453.             else
  1454.             {
  1455.                 Singleton<GameManager>.Instance.LoadServer(yba.splitList[1]);
  1456.             }
  1457.         }
  1458.         else if (yba.splitList[0] == "changename")
  1459.         {
  1460.             if ((yba.splitList[1].Length <= 13) && (yba.splitList[1].Length >= 3))
  1461.             {
  1462.                 if (Singleton<GameManager>.Instance.State == EGameState.ClientReady)
  1463.                 {
  1464.                     Singleton<GameManager>.Instance.ChangeNameClient(yba.splitList[1]);
  1465.                 }
  1466.             }
  1467.             else
  1468.             {
  1469.                 Debug.LogError("Names must be between 3 and 13 characters");
  1470.             }
  1471.         }
  1472.         else if (yba.splitList[0] == "spawn")
  1473.         {
  1474.             Singleton<NetworkManager>.Instance.SpawnPrefabClient(yba.splitList[1]);
  1475.         }
  1476.         else
  1477.         {
  1478.             string str2;
  1479.             Dictionary<string, int> dictionary2;
  1480.             int num33;
  1481.             if (yba.splitList[0] == "debug")
  1482.             {
  1483.                 if (yba.splitList.Length != 2)
  1484.                 {
  1485.                     Debug.Log("Invalid use of debug - format is `debug 1` or `debug 0`");
  1486.                 }
  1487.                 str2 = yba.splitList[1];
  1488.                 if (str2 != null)
  1489.                 {
  1490.                     if (<>f__switch$map9 == null)
  1491.                     {
  1492.                         dictionary2 = new Dictionary<string, int>(2);
  1493.                         dictionary2.Add("1", 0);
  1494.                         dictionary2.Add("0", 1);
  1495.                         <>f__switch$map9 = dictionary2;
  1496.                     }
  1497.                     if (<>f__switch$map9.TryGetValue(str2, out num33))
  1498.                     {
  1499.                         if (num33 == 0)
  1500.                         {
  1501.                             Singleton<InstantDebug>.Instance.SetEnabled(true);
  1502.                             return;
  1503.                         }
  1504.                         if (num33 == 1)
  1505.                         {
  1506.                             Singleton<InstantDebug>.Instance.SetEnabled(false);
  1507.                             return;
  1508.                         }
  1509.                     }
  1510.                 }
  1511.                 Debug.Log("Invalid use of debug - format is `debug 1` or `debug 0`");
  1512.             }
  1513.             else if (yba.splitList[0] == "playerlootmode")
  1514.             {
  1515.                 if (yba.splitList.Length != 2)
  1516.                 {
  1517.                     Debug.Log("Usage: playerlootmode <modenumber>");
  1518.                     Debug.Log("0: Drop nothing");
  1519.                     Debug.Log("1: Drop backpack contents only");
  1520.                     Debug.Log("2: Drop backpack + random items depending on infamy level");
  1521.                     Debug.Log("3: Everything");
  1522.                 }
  1523.                 str2 = yba.splitList[1];
  1524.                 if (str2 != null)
  1525.                 {
  1526.                     if (<>f__switch$mapA == null)
  1527.                     {
  1528.                         dictionary2 = new Dictionary<string, int>(4);
  1529.                         dictionary2.Add("0", 0);
  1530.                         dictionary2.Add("1", 1);
  1531.                         dictionary2.Add("2", 2);
  1532.                         dictionary2.Add("3", 3);
  1533.                         <>f__switch$mapA = dictionary2;
  1534.                     }
  1535.                     if (<>f__switch$mapA.TryGetValue(str2, out num33))
  1536.                     {
  1537.                         switch (num33)
  1538.                         {
  1539.                             case 0:
  1540.                                 Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.None;
  1541.                                 return;
  1542.  
  1543.                             case 1:
  1544.                                 Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.BackpackOnly;
  1545.                                 return;
  1546.  
  1547.                             case 2:
  1548.                                 Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.BackpackOnlyWithInfamy;
  1549.                                 return;
  1550.  
  1551.                             case 3:
  1552.                                 Singleton<GameManager>.Instance.ServerConfig.PlayerLootMode = EServerPlayerLootMode.Everything;
  1553.                                 return;
  1554.                         }
  1555.                     }
  1556.                 }
  1557.                 Debug.Log("Invalid use of playerlootmode - Usage: playerlootmode <modenumber>");
  1558.             }
  1559.             else if (yba.splitList[0] == "deleteprefs")
  1560.             {
  1561.                 PlayerPrefs.DeleteAll();
  1562.                 Debug.Log("Deleted all player preferences.");
  1563.             }
  1564.             else if (yba.splitList[0] == "deletepreference")
  1565.             {
  1566.                 if (yba.splitList.Length < 2)
  1567.                 {
  1568.                     Debug.LogError("Format Exception: expected deletepreference <key>");
  1569.                 }
  1570.                 else
  1571.                 {
  1572.                     StringBuilder builder2 = new StringBuilder(strArray[1]);
  1573.                     for (int m = 2; m < strArray.Length; m++)
  1574.                     {
  1575.                         builder2.Append(" ");
  1576.                         builder2.Append(strArray[m]);
  1577.                     }
  1578.                     if (!PlayerPrefs.HasKey(builder2.ToString()))
  1579.                     {
  1580.                         Debug.LogError(string.Format("No key with name '{0}' found!", builder2));
  1581.                     }
  1582.                     else
  1583.                     {
  1584.                         PlayerPrefs.DeleteKey(builder2.ToString());
  1585.                         Debug.Log(string.Format("Deleted key with name '{0}'", builder2));
  1586.                     }
  1587.                 }
  1588.             }
  1589.             else if (yba.splitList[0] == "dumpleaks")
  1590.             {
  1591.                 StringBuilder sb = new StringBuilder();
  1592.                 sb.AppendLine("Ref tracked behaviors: ");
  1593.                 foreach (KeyValuePair<Type, Expression<Func<string>>> pair2 in LeakTracker.RegisteredLeakers)
  1594.                 {
  1595.                     sb.AppendLine("\t" + pair2.Key.ToString() + " : " + pair2.Value.Compile()());
  1596.                 }
  1597.                 sb.AppendLine("BitStream Counts: ");
  1598.                 Singleton<NetworkManager>.Instance.BitStreamPool.DumpStreamLeaks(sb);
  1599.                 sb.AppendLine("Generic Pools: ");
  1600.                 Singleton<ClassInstancePool>.Instance.DumpPoolCounts(sb);
  1601.                 Debug.Log(sb.ToString());
  1602.             }
  1603.             else if (yba.splitList[0] == "time")
  1604.             {
  1605.                 if (Singleton<TimeManager>.HasInstance())
  1606.                 {
  1607.                     Debug.Log(Singleton<TimeManager>.Instance.GetCurrentGameTime().ToString());
  1608.                 }
  1609.             }
  1610.             else if (yba.splitList[0] == "analytics")
  1611.             {
  1612.                 try
  1613.                 {
  1614.                     if (Singleton<UnityAnalyticsIntegration>.HasInstance() && (yba.splitList.Length == 2))
  1615.                     {
  1616.                         Singleton<UnityAnalyticsIntegration>.Instance.AnalyticsEnabled = int.Parse(yba.splitList[1]) == 1;
  1617.                     }
  1618.                     else
  1619.                     {
  1620.                         Debug.LogError("Error! Expected: analytics <0-1>");
  1621.                     }
  1622.                 }
  1623.                 catch (Exception)
  1624.                 {
  1625.                     Debug.LogError("Error! Expected: analytics <0-1>");
  1626.                 }
  1627.             }
  1628.             else
  1629.             {
  1630.                 Debug.Log("Unknown command: " + yba.splitList[0]);
  1631.             }
  1632.         }
  1633.     }
  1634. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement