示例#1
0
        public void CreateItemList(int selectedGroup)
        {
            if (selectedGroup == 501)               // 501 : Last 10
            {
                CreateMakeLastList();
                return;
            }

            CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
            CraftGroup    craftGroup    = craftGroupCol.GetAt(selectedGroup);
            CraftItemCol  craftItemCol  = craftGroup.CraftItems;

            for (int i = 0; i < craftItemCol.Count; ++i)
            {
                int index = i % 10;

                CraftItem craftItem = craftItemCol.GetAt(i);

                if (index == 0)
                {
                    if (i > 0)
                    {
                        AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1);
                        AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false);                           // NEXT PAGE
                    }

                    AddPage((i / 10) + 1);

                    if (i > 0)
                    {
                        AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
                        AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false);                           // PREV PAGE
                    }
                }

                // jakob, this will check the (bool whatever(Mobile)) method if you specified one
                if (craftItem.Conditional == null || craftItem.Conditional(m_From))
                {
                    AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);

                    if (craftItem.NameNumber > 0)
                    {
                        AddHtmlLocalized(255, 63 + (index * 20), 220, 18, craftItem.NameNumber, LabelColor, false, false);
                    }
                    else
                    {
                        AddLabel(255, 60 + (index * 20), LabelHue, craftItem.NameString);
                    }

                    AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
                }
                // end
            }
        }
示例#2
0
        public void CreateMakeLastList()
        {
            CraftContext context = m_CraftSystem.GetContext(m_From);

            if (context == null)
            {
                return;
            }

            List <CraftItem> items = context.Items;

            if (items.Count > 0)
            {
                for (int i = 0; i < items.Count; ++i)
                {
                    int index = i % 10;

                    CraftItem craftItem = items[i];

                    if (index == 0)
                    {
                        if (i > 0)
                        {
                            AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1);
                            AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false);                               // NEXT PAGE
                        }

                        AddPage((i / 10) + 1);

                        if (i > 0)
                        {
                            AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
                            AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false);                               // PREV PAGE
                        }
                    }

                    // jakob, this will check the (bool whatever(Mobile)) method if you specified one
                    if (craftItem.Conditional == null || craftItem.Conditional(m_From))
                    {
                        AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(3, i), GumpButtonType.Reply, 0);

                        if (craftItem.NameNumber > 0)
                        {
                            AddHtmlLocalized(255, 63 + (index * 20), 220, 18, craftItem.NameNumber, LabelColor, false, false);
                        }
                        else
                        {
                            AddLabel(255, 60 + (index * 20), LabelHue, craftItem.NameString);
                        }

                        AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(4, i), GumpButtonType.Reply, 0);
                    }
                    // end
                }
            }
            else
            {
                // NOTE: This is not as OSI; it is an intentional difference

                AddHtmlLocalized(230, 62, 200, 22, 1044165, LabelColor, false, false);                   // You haven't made anything yet.
            }
        }