Ejemplo n.º 1
0
        /// <summary>
        /// Returns the item ID of the item with the given name
        /// </summary>
        /// <param name="itemName">Name of the item</param>
        /// <param name="rarity">Rarity of the item</param>
        /// <param name="level">Level of the item</param>
        /// <returns>item ID of the item with the given name, or -1 if not found</returns>
        public int GetItemID(string itemName, Data.Enums.ItemRarity rarity, int level)
        {
            var item = this.ItemsDB.FirstOrDefault(itm => itm.Value.Name == itemName &&
                                                   itm.Value.Rarity == rarity &&
                                                   itm.Value.Level == level);

            if (item.Key != 0 || item.Value != null)
            {
                return(item.Key);
            }
            else
            {
                return(-1);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the item information for the item with the given names
        /// </summary>
        /// <param name="itemName">Name of the item</param>
        /// <param name="rarity">Rarity of the item</param>
        /// <param name="level">Level of the item</param>
        /// <returns>Item object containing all item information, or null if the itemName is invalid</returns>
        public GW2PAO.API.Data.Item GetItem(string itemName, Data.Enums.ItemRarity rarity, int level)
        {
            GW2PAO.API.Data.Item item = null;

            KeyValuePair <int, ItemDBEntry> itemEntry;

            itemEntry = this.ItemsDB.FirstOrDefault(itm => itm.Value.Name == itemName &&
                                                    itm.Value.Rarity == rarity &&
                                                    itm.Value.Level == level);

            if (itemEntry.Key != 0 || itemEntry.Value != null)
            {
                item = this.GetItem(itemEntry.Key);
            }

            return(item);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns true if the given item exists, else false
 /// </summary>
 /// <param name="itemName">Name of the item</param>
 /// <param name="rarity">Rarity of the item</param>
 /// <param name="level">Level of the item</param>
 /// <returns>true if the given item exists, else false</returns>
 public bool DoesItemExist(string itemName, Data.Enums.ItemRarity rarity, int level)
 {
     return(this.ItemsDB.Values.Any(item => item.Name == itemName &&
                                    item.Rarity == rarity &&
                                    item.Level == level));
 }