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 SetStackCategoryCommand(IPlayer player, string command, string[] args) { if (args.Length != 2) { player.Reply( string.Format(GetMessage("NotEnoughArguments", player.Id), 2)); } ItemCategory itemCategory = (ItemCategory)Enum.Parse(typeof(ItemCategory), args[0], true); if (itemCategory.IsNull <ItemCategory>()) { player.Reply(GetMessage("InvalidCategory", player.Id)); } _config.CategoryStackMultipliers[itemCategory.ToString()] = Convert.ToInt32(args[1].TrimEnd('x')); SaveConfig(); SetStackSizes(); player.Reply(GetMessage("OperationSuccessful", player.Id)); }