Exemplo n.º 1
0
        public static void Add(string Item, int Line, string Class = "")           // Called on "Item" key
        {
            string OriginalItemName = Item;

            // Check item exists
            if (!ItemDatabase.Exists(OriginalItemName))
            {
                if (Program.Config.ReadBool("exp_bool_warn_invalid_item_name"))                   // TODO Refactor
                {
                    Warning.Write("{f:Yellow}Invalid{r} TF2 {f:Yellow}Item Name{r}: '{f:Yellow}{$0}{r}'", Line, 209, Item);
                }
                return;
            }
            Item = ItemDatabase.GetName(Item);

            // Check item equippable by class
            // TODO Fix MultiClass Banners

            /*if (!string.IsNullOrEmpty(Class) && !IsEquippable(Item, Class) && Program.Config.ReadBool("exp_bool_warn_tfbot_unequippable_item") && Program.GetSafetyLevel() == Program.ParserSafetyLevel.SAFE) {
             *      Warning.Write("TFBot {f:Yellow}Class{r} <{f:Yellow}{$0}{r}> cannot equip {f:Yellow}item{r}: '{f:Yellow}{$1}{r}'", Line, 218, Class, OriginalItemName);
             * }*/

            // Add item to slot
            string ItemSlot = ItemDatabase.GetSlot(Item).ToLower();

            if (concat_slots.Contains(ItemSlot))
            {
                Slot[ItemSlot].Add(Item);
            }
            else
            {
                Slot[ItemSlot] = Item;
            }
        }
Exemplo n.º 2
0
 public static void SetupClass(string Class)
 {
     ItemTracker.Class = Class;
     foreach (string StockItem in default_loadout[Class.ToUpper()])
     {
         string StockItemSlot = ItemDatabase.GetSlot(StockItem);
         if (Slot[StockItemSlot].Length == 0)
         {
             Slot[StockItemSlot] = StockItem;
         }
     }
 }
Exemplo n.º 3
0
        // Check if an item is in the inventory.
        public static bool IsEquipped(string item)
        {
            if (!ItemDatabase.Exists(item))
            {
                return(true);                // Assume true, TODO: warning handled elsewhere
            }
            string ItemSlot = ItemDatabase.GetSlot(item);

            if (concat_slots.Contains(ItemSlot))
            {
                foreach (string Equipped in Slot[ItemSlot])
                {
                    if (Equipped.ToUpper() == item.ToUpper())
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else
            {
                return(Regex.IsMatch(Slot[ItemSlot], item, RegexOptions.IgnoreCase));
            }
        }
Exemplo n.º 4
0
 public static bool IsEquippable(string ItemName, string Class)
 {
     return(ItemDatabase.GetSlot(ItemName, Class) != "0");
 }