Ejemplo n.º 1
0
        public ItemListEntry[] CreateGroupList()
        {
            CraftGroupCol        craftGroupCol = CurrentCraftSystem.CraftGroups;
            List <ItemListEntry> toReturn      = new List <ItemListEntry>();

            int hue = 0;

            if (SelectedResourceIndex > 0)
            {
                hue = ResourceInfoList[CurrentCraftSystem.CraftSubRes.GetAt(SelectedResourceIndex)].Hue;
            }

            if (hue > 1)
            {
                --hue;
            }

            for (int i = 0; i < craftGroupCol.Count; i++)
            {
                int        itemID;
                CraftGroup craftGroup = craftGroupCol.GetAt(i);

                if (craftGroup.CraftItems.Count >= 1)
                {
                    itemID = CraftItem.ItemIDOf(craftGroup.CraftItems.GetAt(0).ItemType);
                }
                else
                {
                    itemID = 5360; //Deed ID
                }
                if (craftGroup.NameNumber > 0)
                {
                    ItemListEntry ile = new ItemListEntry(CliLoc.LocToString(craftGroup.NameNumber), itemID, hue);

                    if (!FilterIndex(i))
                    {
                        toReturn.Add(ile);
                    }

                    localGroupIndexList.Add(ile, i);
                }
                else
                {
                    ItemListEntry ile = new ItemListEntry(craftGroup.NameString, itemID, hue);

                    if (!FilterIndex(i))
                    {
                        toReturn.Add(ile);
                    }

                    localGroupIndexList.Add(ile, i);
                }
            }
            toReturn.AddRange(AddSpecialGroups());

            return(toReturn.ToArray());
        }
Ejemplo n.º 2
0
        public ItemListEntry[] CreateItemList()
        {
            CraftGroupCol craftGroupCol = CurrentCraftSystem.CraftGroups;
            CraftGroup    craftGroup    = craftGroupCol.GetAt(SelectedGroupIndex);
            CraftItemCol  craftItemCol  = craftGroup.CraftItems;

            ItemListEntry[] toReturn = new ItemListEntry[craftItemCol.Count + 1];
            toReturn[0] = new ItemListEntry("Previous menu", 4766);//Previous page

            int hue = 0;

            if (CurrentCraftSystem.CraftSubRes.Init && CurrentCraftSystem.CraftSubRes.Count >= 1 && SelectedResType != CurrentCraftSystem.CraftSubRes.GetAt(0).ItemType)
            {
                hue = ResourceInfoList[CurrentCraftSystem.CraftSubRes.GetAt(SelectedResourceIndex)].Hue;
            }

            if (hue > 1)
            {
                --hue;
            }

            string resourceList = string.Empty;

            for (int i = 0; i < craftItemCol.Count; ++i)
            {
                CraftItem craftItem = craftItemCol.GetAt(i);

                //Get the item id and resources required for the items
                int itemID;
                if (craftItemCol.Count >= 1)
                {
                    itemID = CraftItem.ItemIDOf(craftItemCol.GetAt(i).ItemType);

                    int amount = CurrentCraftSystem.CraftGroups.GetAt(SelectedGroupIndex).CraftItems.GetAt(i).Resources.GetAt(0).Amount;

                    if (SelectedResType == null)
                    {
                        if (!string.IsNullOrEmpty(CurrentCraftSystem.CraftGroups.GetAt(SelectedGroupIndex).CraftItems.GetAt(i).Resources.GetAt(0).NameString))
                        {
                            resourceList = string.Format(" [{0} {1}]", resourceList, amount);
                        }
                        else if (CurrentCraftSystem.CraftGroups.GetAt(SelectedGroupIndex).CraftItems.GetAt(i).Resources.GetAt(0).NameNumber > 0)
                        {
                            resourceList = string.Format(" [{0} {1}]", amount, CliLoc.LocToString(CurrentCraftSystem.CraftGroups.GetAt(SelectedGroupIndex).CraftItems.GetAt(i).Resources.GetAt(0).NameNumber));
                        }
                    }
                    else
                    {
                        resourceList = string.Format(" [{0} {1}]", amount, CraftResources.GetName(CraftResources.GetFromType(SelectedResType)));
                    }
                }
                else
                {
                    itemID = 5360; //Deed ID
                }
                //Becomes 0 if we use a string instead
                if (craftItem.NameNumber > 0)
                {
                    toReturn[i + 1] = new ItemListEntry(CliLoc.LocToString(craftItem.NameNumber) + resourceList, itemID, hue);
                }
                else
                {
                    toReturn[i + 1] = new ItemListEntry(craftItem.NameString + resourceList, itemID, hue);
                }
            }

            return(toReturn);
        }