示例#1
0
        public int getOwnedItems(string menuItemName)
        {
            int       total = 0;
            MenuValue name  = getValueByName(menuItemName);

            if (itemGroups.Count > 0)
            {
                foreach (KeyValuePair <MenuValue, List <ItemContainer> > pair in itemGroups)
                {
                    if (pair.Key == name)
                    {
                        foreach (ItemContainer ic in pair.Value)
                        {
                            foreach (RSItem rsi in ic.items)
                            {
                                if (rsi.ownedAmount > 0)
                                {
                                    total++;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                return(0);
            }

            return(total);
        }
示例#2
0
        /// <summary>
        /// Adds an item into an existing item container.
        /// </summary>
        /// <param name="itemCategory"></param>
        /// <param name="containerName"></param>
        /// <param name="addition"></param>
        public void addToItemContainer(string itemCategory, string containerName, RSItem addition)
        {
            MenuValue menuSpot = getValueByName(itemCategory);

            foreach (ItemContainer ic in itemGroups[menuSpot])
            {
                if (ic.CategoryName == containerName)
                {
                    ic.items.Add(addition);
                }
            }
        }
示例#3
0
        /// <summary>
        /// searches for an item in all items from a container.
        /// </summary>
        /// <param name="itemname"></param>
        /// <param name="containername"></param>
        /// <param name="rs_name"></param>
        /// <returns></returns>
        public RSItem getItem(string itemname, string containername, string rs_name)
        {
            MenuValue menuSpot = getValueByName(itemname);

            foreach (ItemContainer ic in itemGroups[menuSpot])
            {
                if (ic.CategoryName == containername)
                {
                    foreach (RSItem rsi in ic.items)
                    {
                        if (rsi.imageName == rs_name)
                        {
                            return(rsi);
                        }
                    }
                }
            }

            return(null);
        }
示例#4
0
        /// <summary>
        /// Adds an item container (like "Pest Control" in a category (like "Minigames")
        /// </summary>
        /// <param name="itemCategory"></param>
        /// <param name="addition"></param>
        public void addToItemGroup(string itemCategory, ItemContainer addition)
        {
            MenuValue menuSpot = getValueByName(itemCategory);

            itemGroups[menuSpot].Add(addition);
        }