예제 #1
0
        public static void scalars(ConsoleSystem.Arg args)
        {
            TextTable textTable = new TextTable();

            textTable.AddColumn("Type");
            textTable.AddColumn("Value");
            string[] str    = new string[] { "Player Fraction", null };
            float    single = SpawnHandler.PlayerFraction();

            str[1] = single.ToString();
            textTable.AddRow(str);
            string[] strArrays = new string[] { "Player Excess", null };
            single       = SpawnHandler.PlayerExcess();
            strArrays[1] = single.ToString();
            textTable.AddRow(strArrays);
            string[] str1 = new string[] { "Population Rate", null };
            single  = SpawnHandler.PlayerLerp(Spawn.min_rate, Spawn.max_rate);
            str1[1] = single.ToString();
            textTable.AddRow(str1);
            string[] strArrays1 = new string[] { "Population Density", null };
            single        = SpawnHandler.PlayerLerp(Spawn.min_density, Spawn.max_density);
            strArrays1[1] = single.ToString();
            textTable.AddRow(strArrays1);
            string[] str2 = new string[] { "Group Rate", null };
            single  = SpawnHandler.PlayerScale(Spawn.player_scale);
            str2[1] = single.ToString();
            textTable.AddRow(str2);
            args.ReplyWith(textTable.ToString());
        }
예제 #2
0
        static void Main(string[] args)
        {
            TextTable table = new TextTable();

            table.AddRow("TextTables.NET demo").WithColSpan(0, 4);
            table.AddRow("Multiple columns", "Or rows", 1.6180).WithColSpan(0, 2).WithRowSpan(1, 2);
            table.AddRow(3.14, "foo", "bar");
            Console.WriteLine(table);

            // +---------------------------------------+
            // |          TextTables.NET demo          |
            // +---------------------+---------+-------+
            // |  Multiple columns   |         | 1.618 |
            // +----------+----------+ Or rows +-------+
            // |   3.14   |   foo    |         |  bar  |
            // +----------+----------+---------+-------+

            table.Options.Charset = TextTableCharset.GetBoxCharset();
            Console.WriteLine(table);

            // ┌────────────────────────────────────────┐
            // │          TextTables.NET demo           │
            // ├──────────┬──────────┬─────────┬────────┤
            // │    1     │    2     │    3    │ 3.1415 │
            // ├──────────┴──────────┼─────────┼────────┤
            // │  Multiple columns   │         │ 1.618  │
            // ├──────────┬──────────┤ Or rows ├────────┤
            // │   foo    │   bar    │         │ 2.7182 │
            // └──────────┴──────────┴─────────┴────────┘

            Console.ReadLine();
        }
예제 #3
0
        public static void scalars(ConsoleSystem.Arg args)
        {
            TextTable textTable = new TextTable();

            textTable.AddColumn("Type");
            textTable.AddColumn("Value");
            textTable.AddRow(new string[2]
            {
                "Player Fraction",
                SpawnHandler.PlayerFraction().ToString()
            });
            textTable.AddRow(new string[2]
            {
                "Player Excess",
                SpawnHandler.PlayerExcess().ToString()
            });
            textTable.AddRow(new string[2]
            {
                "Population Rate",
                SpawnHandler.PlayerLerp(Spawn.min_rate, Spawn.max_rate).ToString()
            });
            textTable.AddRow(new string[2]
            {
                "Population Density",
                SpawnHandler.PlayerLerp(Spawn.min_density, Spawn.max_density).ToString()
            });
            textTable.AddRow(new string[2]
            {
                "Group Rate",
                SpawnHandler.PlayerScale(Spawn.player_scale).ToString()
            });
            args.ReplyWith(((object)textTable).ToString());
        }
예제 #4
0
        public static void status(Arg arg)
        {
            string @string = arg.GetString(0);
            string text    = string.Empty;

            if (@string.Length == 0)
            {
                text  = text + "hostname: " + Server.hostname + "\n";
                text  = text + "version : " + 2306 + " secure (secure mode enabled, connected to Steam3)\n";
                text  = text + "map     : " + Server.level + "\n";
                text += $"players : {BasePlayer.activePlayerList.Count()} ({Server.maxplayers} max) ({SingletonComponent<ServerMgr>.Instance.connectionQueue.Queued} queued) ({SingletonComponent<ServerMgr>.Instance.connectionQueue.Joining} joining)\n\n";
            }
            TextTable textTable = new TextTable();

            textTable.AddColumn("id");
            textTable.AddColumn("name");
            textTable.AddColumn("ping");
            textTable.AddColumn("connected");
            textTable.AddColumn("addr");
            textTable.AddColumn("owner");
            textTable.AddColumn("violation");
            textTable.AddColumn("kicks");
            foreach (BasePlayer activePlayer in BasePlayer.activePlayerList)
            {
                try
                {
                    if (!BaseEntityEx.IsValid(activePlayer))
                    {
                        continue;
                    }
                    string userIDString = activePlayer.UserIDString;
                    if (activePlayer.net.connection == null)
                    {
                        textTable.AddRow(userIDString, "NO CONNECTION");
                        continue;
                    }
                    string text2 = activePlayer.net.connection.ownerid.ToString();
                    string text3 = activePlayer.displayName.QuoteSafe();
                    string text4 = Network.Net.sv.GetAveragePing(activePlayer.net.connection).ToString();
                    string text5 = activePlayer.net.connection.ipaddress;
                    string text6 = activePlayer.violationLevel.ToString("0.0");
                    string text7 = activePlayer.GetAntiHackKicks().ToString();
                    if (!arg.IsAdmin && !arg.IsRcon)
                    {
                        text5 = "xx.xxx.xx.xxx";
                    }
                    string text8 = activePlayer.net.connection.GetSecondsConnected() + "s";
                    if (@string.Length <= 0 || text3.Contains(@string, CompareOptions.IgnoreCase) || userIDString.Contains(@string) || text2.Contains(@string) || text5.Contains(@string))
                    {
                        textTable.AddRow(userIDString, text3, text4, text8, text5, (text2 == userIDString) ? string.Empty : text2, text6, text7);
                    }
                }
                catch (Exception ex)
                {
                    textTable.AddRow(activePlayer.UserIDString, ex.Message.QuoteSafe());
                }
            }
            arg.ReplyWith(text + textTable.ToString());
        }
예제 #5
0
        public static void scalars(Arg args)
        {
            TextTable textTable = new TextTable();

            textTable.AddColumn("Type");
            textTable.AddColumn("Value");
            textTable.AddRow("Player Fraction", SpawnHandler.PlayerFraction().ToString());
            textTable.AddRow("Player Excess", SpawnHandler.PlayerExcess().ToString());
            textTable.AddRow("Population Rate", SpawnHandler.PlayerLerp(min_rate, max_rate).ToString());
            textTable.AddRow("Population Density", SpawnHandler.PlayerLerp(min_density, max_density).ToString());
            textTable.AddRow("Group Rate", SpawnHandler.PlayerScale(player_scale).ToString());
            args.ReplyWith(textTable.ToString());
        }
예제 #6
0
 void QuickSmeltInfoCommand(ConsoleSystem.Arg args)
 {
     if (!args.IsAdmin)
     {
         return;
     }
     TextTable table = new TextTable();
     table.AddColumns("Description", "Setting", "Console Command");
     table.AddRow("", "");
     table.AddRow($"Smelt Speed", $"{Settings.SmeltSpeed}x", "quicksmelt.smelt");
     table.AddRow($"Charcoal Rate", $"{Settings.CharcoalRate.ToString("0.0")}x", "quicksmelt.charcoal");
     table.AddRow($"Wood Rate", $"{Settings.WoodRate}x", "quicksmelt.wood");
     table.AddRow($"Will Food Cook In Furnace", $"{Settings.CanCookFoodInFurnace}", "quicksmelt.food");
     args.ReplyWith(table.ToString());
 }
예제 #7
0
        public static void print_assets(Arg arg)
        {
            if (AssetPool.storage.Count == 0)
            {
                arg.ReplyWith("Asset pool is empty.");
                return;
            }
            string    @string   = arg.GetString(0, string.Empty);
            TextTable textTable = new TextTable();

            textTable.AddColumn("type");
            textTable.AddColumn("allocated");
            textTable.AddColumn("available");
            foreach (KeyValuePair <Type, AssetPool.Pool> item in AssetPool.storage)
            {
                string text  = item.Key.ToString();
                string text2 = item.Value.allocated.ToString();
                string text3 = item.Value.available.ToString();
                if (string.IsNullOrEmpty(@string) || text.Contains(@string, CompareOptions.IgnoreCase))
                {
                    textTable.AddRow(text, text2, text3);
                }
            }
            arg.ReplyWith(textTable.ToString());
        }
예제 #8
0
        public static void print_prefabs(Arg arg)
        {
            PrefabPoolCollection pool = GameManager.server.pool;

            if (pool.storage.Count == 0)
            {
                arg.ReplyWith("Prefab pool is empty.");
                return;
            }
            string    @string   = arg.GetString(0, string.Empty);
            TextTable textTable = new TextTable();

            textTable.AddColumn("id");
            textTable.AddColumn("name");
            textTable.AddColumn("count");
            foreach (KeyValuePair <uint, PrefabPool> item in pool.storage)
            {
                string text  = item.Key.ToString();
                string text2 = StringPool.Get(item.Key);
                string text3 = item.Value.Count.ToString();
                if (string.IsNullOrEmpty(@string) || text2.Contains(@string, CompareOptions.IgnoreCase))
                {
                    textTable.AddRow(text, Path.GetFileNameWithoutExtension(text2), text3);
                }
            }
            arg.ReplyWith(textTable.ToString());
        }
예제 #9
0
        private void CommandGetComponents(IPlayer player, string command, string[] args)
        {
            var basePlayer = player.Object as BasePlayer;

            if (basePlayer == null)
            {
                return;
            }

            float radius;

            if (args.Length < 1 || !float.TryParse(args[0], out radius))
            {
                radius = 5f;
            }

            var output = new List <Component>();

            Vis.Components(basePlayer.transform.position, radius, output);

            var table = new TextTable();

            table.AddColumns("name", "class");

            foreach (var entry in output)
            {
                table.AddRow(entry.name, entry.GetType().FullName);
            }

            basePlayer.ConsoleMessage(table.ToString());
        }
예제 #10
0
        public static void print_approved_skins(ConsoleSystem.Arg arg)
        {
            if (Global.get_SteamServer() == null || ((BaseSteamworks)Global.get_SteamServer()).get_Inventory().Definitions == null)
            {
                return;
            }
            TextTable textTable = new TextTable();

            textTable.AddColumn("name");
            textTable.AddColumn("itemshortname");
            textTable.AddColumn("workshopid");
            textTable.AddColumn("workshopdownload");
            foreach (Inventory.Definition definition in (Inventory.Definition[])((BaseSteamworks)Global.get_SteamServer()).get_Inventory().Definitions)
            {
                string name            = definition.get_Name();
                string stringProperty1 = definition.GetStringProperty("itemshortname");
                string stringProperty2 = definition.GetStringProperty("workshopid");
                string stringProperty3 = definition.GetStringProperty("workshopdownload");
                textTable.AddRow(new string[4]
                {
                    name,
                    stringProperty1,
                    stringProperty2,
                    stringProperty3
                });
            }
            arg.ReplyWith(((object)textTable).ToString());
        }
예제 #11
0
        public static void print_prefabs(ConsoleSystem.Arg arg)
        {
            PrefabPoolCollection pool = GameManager.server.pool;

            if (pool.storage.Count == 0)
            {
                arg.ReplyWith("Prefab pool is empty.");
            }
            else
            {
                string    str1      = arg.GetString(0, string.Empty);
                TextTable textTable = new TextTable();
                textTable.AddColumn("id");
                textTable.AddColumn("name");
                textTable.AddColumn("count");
                foreach (KeyValuePair <uint, PrefabPool> keyValuePair in pool.storage)
                {
                    string str2 = keyValuePair.Key.ToString();
                    string path = StringPool.Get(keyValuePair.Key);
                    string str3 = keyValuePair.Value.Count.ToString();
                    if (string.IsNullOrEmpty(str1) || StringEx.Contains(path, str1, CompareOptions.IgnoreCase))
                    {
                        textTable.AddRow(new string[3]
                        {
                            str2,
                            Path.GetFileNameWithoutExtension(path),
                            str3
                        });
                    }
                }
                arg.ReplyWith(((object)textTable).ToString());
            }
        }
예제 #12
0
        public static string teaminfo(Arg arg)
        {
            ulong num = arg.GetUInt64(0, 0uL);

            if (num == 0L)
            {
                BasePlayer player = ArgEx.GetPlayer(arg, 0);
                if (player == null)
                {
                    return("Player not found");
                }
                num = player.userID;
            }
            RelationshipManager.PlayerTeam playerTeam = RelationshipManager.ServerInstance.FindPlayersTeam(num);
            if (playerTeam == null)
            {
                return("Player is not in a team");
            }
            TextTable textTable = new TextTable();

            textTable.AddColumn("steamID");
            textTable.AddColumn("username");
            textTable.AddColumn("online");
            textTable.AddColumn("leader");
            foreach (ulong memberId in playerTeam.members)
            {
                bool flag = Network.Net.sv.connections.FirstOrDefault((Connection c) => c.connected && c.userid == memberId) != null;
                textTable.AddRow(memberId.ToString(), GetPlayerName(memberId), flag ? "x" : "", (memberId == playerTeam.teamLeader) ? "x" : "");
            }
            return(textTable.ToString());
        }
예제 #13
0
        public static void players(Arg arg)
        {
            TextTable textTable = new TextTable();

            textTable.AddColumn("id");
            textTable.AddColumn("name");
            textTable.AddColumn("ping");
            textTable.AddColumn("snap");
            textTable.AddColumn("updt");
            textTable.AddColumn("posi");
            textTable.AddColumn("dist");
            foreach (BasePlayer activePlayer in BasePlayer.activePlayerList)
            {
                string userIDString = activePlayer.UserIDString;
                string text         = activePlayer.displayName.ToString();
                if (text.Length >= 14)
                {
                    text = text.Substring(0, 14) + "..";
                }
                string text2 = text;
                string text3 = Network.Net.sv.GetAveragePing(activePlayer.net.connection).ToString();
                string text4 = activePlayer.GetQueuedUpdateCount(BasePlayer.NetworkQueue.Update).ToString();
                string text5 = activePlayer.GetQueuedUpdateCount(BasePlayer.NetworkQueue.UpdateDistance).ToString();
                textTable.AddRow(userIDString, text2, text3, string.Empty, text4, string.Empty, text5);
            }
            arg.ReplyWith(textTable.ToString());
        }
예제 #14
0
        private static TextTable GetEntityTable(Func <EntityInfo, bool> filter)
        {
            TextTable textTable = new TextTable();

            textTable.AddColumn("realm");
            textTable.AddColumn("entity");
            textTable.AddColumn("group");
            textTable.AddColumn("parent");
            textTable.AddColumn("name");
            textTable.AddColumn("position");
            textTable.AddColumn("local");
            textTable.AddColumn("rotation");
            textTable.AddColumn("local");
            textTable.AddColumn("status");
            textTable.AddColumn("invokes");
            foreach (BaseNetworkable serverEntity in BaseNetworkable.serverEntities)
            {
                if (!(serverEntity == null))
                {
                    EntityInfo arg = new EntityInfo(serverEntity);
                    if (filter(arg))
                    {
                        textTable.AddRow("sv", arg.entityID.ToString(), arg.groupID.ToString(), arg.parentID.ToString(), arg.entity.ShortPrefabName, arg.entity.transform.position.ToString(), arg.entity.transform.localPosition.ToString(), arg.entity.transform.rotation.eulerAngles.ToString(), arg.entity.transform.localRotation.eulerAngles.ToString(), arg.status, arg.entity.InvokeString());
                    }
                }
            }
            return(textTable);
        }
예제 #15
0
        public static void print_assets(ConsoleSystem.Arg arg)
        {
            if (AssetPool.storage.Count == 0)
            {
                arg.ReplyWith("Asset pool is empty.");
                return;
            }
            string    str       = arg.GetString(0, string.Empty);
            TextTable textTable = new TextTable();

            textTable.AddColumn("type");
            textTable.AddColumn("allocated");
            textTable.AddColumn("available");
            foreach (KeyValuePair <Type, AssetPool.Pool> keyValuePair in AssetPool.storage)
            {
                string str1 = keyValuePair.Key.ToString();
                string str2 = keyValuePair.Value.allocated.ToString();
                string str3 = keyValuePair.Value.available.ToString();
                if (!string.IsNullOrEmpty(str) && !str1.Contains(str, CompareOptions.IgnoreCase))
                {
                    continue;
                }
                textTable.AddRow(new string[] { str1, str2, str3 });
            }
            arg.ReplyWith(textTable.ToString());
        }
예제 #16
0
        public static void print_prefabs(ConsoleSystem.Arg arg)
        {
            PrefabPoolCollection prefabPoolCollection = GameManager.server.pool;

            if (prefabPoolCollection.storage.Count == 0)
            {
                arg.ReplyWith("Prefab pool is empty.");
                return;
            }
            string    str       = arg.GetString(0, string.Empty);
            TextTable textTable = new TextTable();

            textTable.AddColumn("id");
            textTable.AddColumn("name");
            textTable.AddColumn("count");
            foreach (KeyValuePair <uint, PrefabPool> keyValuePair in prefabPoolCollection.storage)
            {
                string str1 = keyValuePair.Key.ToString();
                string str2 = StringPool.Get(keyValuePair.Key);
                string str3 = keyValuePair.Value.Count.ToString();
                if (!string.IsNullOrEmpty(str) && !str2.Contains(str, CompareOptions.IgnoreCase))
                {
                    continue;
                }
                textTable.AddRow(new string[] { str1, Path.GetFileNameWithoutExtension(str2), str3 });
            }
            arg.ReplyWith(textTable.ToString());
        }
예제 #17
0
        public static void players(ConsoleSystem.Arg arg)
        {
            TextTable textTable = new TextTable();

            textTable.AddColumn("id");
            textTable.AddColumn("name");
            textTable.AddColumn("ping");
            textTable.AddColumn("snap");
            textTable.AddColumn("updt");
            textTable.AddColumn("posi");
            textTable.AddColumn("dist");
            foreach (BasePlayer basePlayer in BasePlayer.activePlayerList)
            {
                string userIDString = basePlayer.UserIDString;
                string str          = basePlayer.displayName.ToString();
                if (str.Length >= 14)
                {
                    str = string.Concat(str.Substring(0, 14), "..");
                }
                string str1        = str;
                int    averagePing = Network.Net.sv.GetAveragePing(basePlayer.net.connection);
                string str2        = averagePing.ToString();
                string str3        = basePlayer.GetQueuedUpdateCount(BasePlayer.NetworkQueue.Update).ToString();
                string str4        = basePlayer.GetQueuedUpdateCount(BasePlayer.NetworkQueue.UpdateDistance).ToString();
                textTable.AddRow(new string[] { userIDString, str1, str2, string.Empty, str3, string.Empty, str4 });
            }
            arg.ReplyWith(textTable.ToString());
        }
예제 #18
0
        public static string packetlog(Arg arg)
        {
            if (!packetlog_enabled)
            {
                return("Packet log is not enabled.");
            }
            List <Tuple <Message.Type, ulong> > list = new List <Tuple <Message.Type, ulong> >();

            foreach (KeyValuePair <Message.Type, TimeAverageValue> item in SingletonComponent <ServerMgr> .Instance.packetHistory.dict)
            {
                list.Add(new Tuple <Message.Type, ulong>(item.Key, item.Value.Calculate()));
            }
            TextTable textTable = new TextTable();

            textTable.AddColumn("type");
            textTable.AddColumn("calls");
            foreach (Tuple <Message.Type, ulong> item2 in list.OrderByDescending((Tuple <Message.Type, ulong> entry) => entry.Item2))
            {
                if (item2.Item2 == 0L)
                {
                    break;
                }
                string text  = item2.Item1.ToString();
                string text2 = item2.Item2.ToString();
                textTable.AddRow(text, text2);
            }
            return(textTable.ToString());
        }
예제 #19
0
        public static void print_memory(ConsoleSystem.Arg arg)
        {
            if (Facepunch.Pool.directory.Count == 0)
            {
                arg.ReplyWith("Memory pool is empty.");
                return;
            }
            TextTable textTable = new TextTable();

            textTable.AddColumn("type");
            textTable.AddColumn("pooled");
            textTable.AddColumn("active");
            textTable.AddColumn("hits");
            textTable.AddColumn("misses");
            textTable.AddColumn("spills");
            foreach (KeyValuePair <Type, Facepunch.Pool.ICollection> keyValuePair in
                     from x in Facepunch.Pool.directory
                     orderby x.Value.ItemsCreated descending
                     select x)
            {
                string str = keyValuePair.Key.ToString().Replace("System.Collections.Generic.", "");
                Facepunch.Pool.ICollection value = keyValuePair.Value;
                textTable.AddRow(new string[] { str, value.ItemsInStack.FormatNumberShort(), value.ItemsInUse.FormatNumberShort(), value.ItemsTaken.FormatNumberShort(), value.ItemsCreated.FormatNumberShort(), value.ItemsSpilled.FormatNumberShort() });
            }
            arg.ReplyWith(textTable.ToString());
        }
예제 #20
0
        public static string rpclog(Arg arg)
        {
            if (!rpclog_enabled)
            {
                return("RPC log is not enabled.");
            }
            List <Tuple <uint, ulong> > list = new List <Tuple <uint, ulong> >();

            foreach (KeyValuePair <uint, TimeAverageValue> item in SingletonComponent <ServerMgr> .Instance.rpcHistory.dict)
            {
                list.Add(new Tuple <uint, ulong>(item.Key, item.Value.Calculate()));
            }
            TextTable textTable = new TextTable();

            textTable.AddColumn("id");
            textTable.AddColumn("name");
            textTable.AddColumn("calls");
            foreach (Tuple <uint, ulong> item2 in list.OrderByDescending((Tuple <uint, ulong> entry) => entry.Item2))
            {
                if (item2.Item2 == 0L)
                {
                    break;
                }
                string text  = item2.Item1.ToString();
                string text2 = StringPool.Get(item2.Item1);
                string text3 = item2.Item2.ToString();
                textTable.AddRow(text, text2, text3);
            }
            return(textTable.ToString());
        }
예제 #21
0
        public static void print_approved_skins(ConsoleSystem.Arg arg)
        {
            if (!SteamServer.IsValid)
            {
                return;
            }
            if (SteamInventory.Definitions == null)
            {
                return;
            }
            TextTable textTable = new TextTable();

            textTable.AddColumn("name");
            textTable.AddColumn("itemshortname");
            textTable.AddColumn("workshopid");
            textTable.AddColumn("workshopdownload");
            InventoryDef[] definitions = SteamInventory.Definitions;
            for (int i = 0; i < (int)definitions.Length; i++)
            {
                InventoryDef inventoryDef = definitions[i];
                string       name         = inventoryDef.Name;
                string       property     = inventoryDef.GetProperty("itemshortname");
                string       str          = inventoryDef.GetProperty("workshopid");
                string       property1    = inventoryDef.GetProperty("workshopdownload");
                textTable.AddRow(new string[] { name, property, str, property1 });
            }
            arg.ReplyWith(textTable.ToString());
        }
        private void ListCategoryItemsCommand(IPlayer player, string command, string[] args)
        {
            if (args.Length != 1)
            {
                player.Reply(string.Format(GetMessage("NotEnoughArguments", player.Id), 1));
            }

            ItemCategory itemCategory = (ItemCategory)Enum.Parse(typeof(ItemCategory), args[0]);

            if (itemCategory.IsNull <ItemCategory>())
            {
                player.Reply(GetMessage("InvalidCategory", player.Id));
            }

            TextTable output = new TextTable();

            output.AddColumns("Unique Id", "Shortname", "Category", "Vanilla Stack", "Custom Stack", "Multiplier");

            foreach (ItemDefinition itemDefinition in ItemManager.GetItemDefinitions()
                     .Where(itemDefinition => itemDefinition.category == itemCategory))
            {
                ItemInfo itemInfo = GetIndexedItem(itemDefinition.category, itemDefinition.itemid);

                output.AddRow(itemDefinition.itemid.ToString(), itemDefinition.shortname,
                              itemDefinition.category.ToString(), itemInfo.VanillaStackSize.ToString("N0"),
                              Mathf.Clamp(GetStackSize(itemDefinition), 0, int.MaxValue).ToString("N0"),
                              _config.CategoryStackMultipliers[itemDefinition.category.ToString()].ToString());
            }

            player.Reply(output.ToString());
        }
        private void ItemSearchCommand(IPlayer player, string command, string[] args)
        {
            if (args.Length != 1)
            {
                player.Reply(
                    string.Format(GetMessage("NotEnoughArguments", player.Id), 1));
            }

            List <ItemDefinition> itemDefinitions = ItemManager.itemList.Where(itemDefinition =>
                                                                               itemDefinition.displayName.english.Contains(args[0]) ||
                                                                               itemDefinition.displayDescription.english.Contains(args[0]) ||
                                                                               itemDefinition.shortname.Equals(args[0]) ||
                                                                               itemDefinition.shortname.Contains(args[0]))
                                                    .ToList();

            TextTable output = new TextTable();

            output.AddColumns("Unique Id", "Shortname", "Category", "Vanilla Stack", "Custom Stack");

            foreach (ItemDefinition itemDefinition in itemDefinitions)
            {
                ItemInfo itemInfo = GetIndexedItem(itemDefinition.category, itemDefinition.itemid);

                output.AddRow(itemDefinition.itemid.ToString(), itemDefinition.shortname,
                              itemDefinition.category.ToString(), itemInfo.VanillaStackSize.ToString("N0"),
                              Mathf.Clamp(GetStackSize(itemDefinition), 0, int.MaxValue).ToString("N0"));
            }

            player.Reply(output.ToString());
        }
예제 #24
0
        public static void subscriptions(ConsoleSystem.Arg arg)
        {
            TextTable textTable = new TextTable();

            textTable.AddColumn("realm");
            textTable.AddColumn("group");
            BasePlayer basePlayer = arg.Player();

            if (Object.op_Implicit((Object)basePlayer))
            {
                using (List <Group> .Enumerator enumerator = ((List <Group>)((Subscriber)basePlayer.net.subscriber).subscribed).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Group current = enumerator.Current;
                        // ISSUE: explicit non-virtual call
                        textTable.AddRow(new string[2]
                        {
                            "sv",
                            __nonvirtual(current.ID.ToString())
                        });
                    }
                }
            }
            arg.ReplyWith(((object)textTable).ToString());
        }
예제 #25
0
        public static void playerlistpos(Arg arg)
        {
            TextTable textTable = new TextTable();

            textTable.AddColumns("SteamID", "DisplayName", "POS", "ROT");
            foreach (BasePlayer activePlayer in BasePlayer.activePlayerList)
            {
                textTable.AddRow(activePlayer.userID.ToString(), activePlayer.displayName, activePlayer.transform.position.ToString(), activePlayer.transform.rotation.eulerAngles.ToString());
            }
            arg.ReplyWith(textTable.ToString());
        }
예제 #26
0
        private static string CodeLockAuthList(CodeLock codeLock)
        {
            if (codeLock.whitelistPlayers.Count == 0 && codeLock.guestPlayers.Count == 0)
            {
                return("Nobody is authed to this entity");
            }
            TextTable textTable = new TextTable();

            textTable.AddColumn("steamID");
            textTable.AddColumn("username");
            textTable.AddColumn("isGuest");
            foreach (ulong whitelistPlayer in codeLock.whitelistPlayers)
            {
                textTable.AddRow(whitelistPlayer.ToString(), GetPlayerName(whitelistPlayer), "");
            }
            foreach (ulong guestPlayer in codeLock.guestPlayers)
            {
                textTable.AddRow(guestPlayer.ToString(), GetPlayerName(guestPlayer), "x");
            }
            return(textTable.ToString());
        }
예제 #27
0
파일: AI.cs 프로젝트: Ailtop/RustDocuments
 private static void AddLBTableEntry(ref TextTable table, string name, LoadBalancedQueue lb)
 {
     if (lb != null)
     {
         float num = 0f;
         if (lb.updatedItemsCount > 0)
         {
             num = Mathf.Clamp(lb.updatesOverdueByTotal / (float)lb.updatedItemsCount - 0.02f, 0f, float.MaxValue);
         }
         table.AddRow(name, lb.itemCount.ToString(), num.ToString("N2"));
     }
 }
        private void ListCategoriesCommand(IPlayer player, string command, string[] args)
        {
            TextTable output = new TextTable();

            output.AddColumns("Category Name", "Items In Category");

            foreach (string category in Enum.GetNames(typeof(ItemCategory)))
            {
                output.AddRow(category, _data.ItemCategories[category].Count.ToString());
            }

            player.Reply(output.ToString());
        }
예제 #29
0
        private void ListCategoriesCommand(IPlayer player, string command, string[] args)
        {
            TextTable output = new TextTable();

            output.AddColumns("Category Name", "Items In Category");

            foreach (string category in Enum.GetNames(typeof(ItemCategory)))
            {
                output.AddRow(category, ItemManager.itemList.Where(x => x.category.ToString() == category).Count().ToString());
            }

            player.Reply(output.ToString());
        }
예제 #30
0
 public static void report(Arg args)
 {
     if ((bool)SingletonComponent <Climate> .Instance)
     {
         TextTable textTable = new TextTable();
         textTable.AddColumn(SingletonComponent <Climate> .Instance.WeatherStatePrevious.name);
         textTable.AddColumn("|");
         textTable.AddColumn(SingletonComponent <Climate> .Instance.WeatherStateTarget.name);
         textTable.AddColumn("|");
         textTable.AddColumn(SingletonComponent <Climate> .Instance.WeatherStateNext.name);
         int num = Mathf.RoundToInt(SingletonComponent <Climate> .Instance.WeatherStateBlend * 100f);
         if (num < 100)
         {
             textTable.AddRow("fading out (" + (100 - num) + "%)", "|", "fading in (" + num + "%)", "|", "up next");
         }
         else
         {
             textTable.AddRow("previous", "|", "current", "|", "up next");
         }
         args.ReplyWith(textTable.ToString() + Environment.NewLine + SingletonComponent <Climate> .Instance.WeatherState.ToString());
     }
 }