Пример #1
0
        public int CreateGroupList()
        {
            CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;

            AddButton(15, 60, 4005, 4007, GetButtonID(6, 3), GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 63, 150, 18, 1044014, LabelColor, false, false); // LAST TEN

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

                AddButton(15, 80 + (i * 20), 4005, 4007, GetButtonID(0, i), GumpButtonType.Reply, 0);

                if (craftGroup.NameNumber > 0)
                {
                    AddHtmlLocalized(50, 83 + (i * 20), 150, 18, craftGroup.NameNumber, LabelColor, false, false);
                }
                else
                {
                    AddLabel(50, 80 + (i * 20), LabelHue, craftGroup.NameString);
                }
            }

            return(craftGroupCol.Count);
        }
Пример #2
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
                    }
                }

                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);
            }
        }
Пример #3
0
        public CraftSystem(int minCraftEffect, int maxCraftEffect, double delay)
        {
            m_MinCraftEffect = minCraftEffect;
            m_MaxCraftEffect = maxCraftEffect;
            m_Delay          = delay;

            m_CraftItems   = new CraftItemCol();
            m_CraftGroups  = new CraftGroupCol();
            m_CraftSubRes  = new CraftSubResCol();
            m_CraftSubRes2 = new CraftSubResCol();

            m_Recipes     = new List <int>();
            m_RareRecipes = new List <int>();

            InitCraftList();
        }
Пример #4
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID <= 0)
            {
                return; // Canceled
            }
            int buttonID = info.ButtonID - 1;
            int type     = buttonID % 7;
            int index    = buttonID / 7;

            CraftSystem   system  = m_CraftSystem;
            CraftGroupCol groups  = system.CraftGroups;
            CraftContext  context = system.GetContext(m_From);

            switch (type)
            {
            case 0:     // Show group
            {
                if (context == null)
                {
                    break;
                }

                if (index >= 0 && index < groups.Count)
                {
                    context.LastGroupIndex = index;
                    m_From.SendGump(new CraftGump(m_From, system, m_Tool, null));
                }

                break;
            }

            case 1:     // Create item
            {
                if (context == null)
                {
                    break;
                }

                int groupIndex = context.LastGroupIndex;

                if (groupIndex >= 0 && groupIndex < groups.Count)
                {
                    CraftGroup group = groups.GetAt(groupIndex);

                    if (index >= 0 && index < group.CraftItems.Count)
                    {
                        CraftItem(group.CraftItems.GetAt(index));
                    }
                }

                break;
            }

            case 2:     // Item details
            {
                if (context == null)
                {
                    break;
                }

                int groupIndex = context.LastGroupIndex;

                if (groupIndex >= 0 && groupIndex < groups.Count)
                {
                    CraftGroup group = groups.GetAt(groupIndex);

                    if (index >= 0 && index < group.CraftItems.Count)
                    {
                        m_From.SendGump(new CraftGumpItem(m_From, system, group.CraftItems.GetAt(index), m_Tool));
                    }
                }

                break;
            }

            case 3:     // Create item (last 10)
            {
                if (context == null)
                {
                    break;
                }

                List <CraftItem> lastTen = context.Items;

                if (index >= 0 && index < lastTen.Count)
                {
                    CraftItem(lastTen[index]);
                }

                break;
            }

            case 4:     // Item details (last 10)
            {
                if (context == null)
                {
                    break;
                }

                List <CraftItem> lastTen = context.Items;

                if (index >= 0 && index < lastTen.Count)
                {
                    m_From.SendGump(new CraftGumpItem(m_From, system, lastTen[index], m_Tool));
                }

                break;
            }

            case 5:     // Resource selected
            {
                if (m_Page == CraftPage.PickResource && index >= 0 && index < system.CraftSubRes.Count)
                {
                    int groupIndex = (context == null ? -1 : context.LastGroupIndex);

                    CraftSubRes res = system.CraftSubRes.GetAt(index);

                    if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill)
                    {
                        m_From.SendGump(new CraftGump(m_From, system, m_Tool, res.Message));
                    }
                    else
                    {
                        if (context != null)
                        {
                            context.LastResourceIndex = index;
                        }

                        m_From.SendGump(new CraftGump(m_From, system, m_Tool, null));
                    }
                }
                else if (m_Page == CraftPage.PickResource2 && index >= 0 && index < system.CraftSubRes2.Count)
                {
                    int groupIndex = (context == null ? -1 : context.LastGroupIndex);

                    CraftSubRes res = system.CraftSubRes2.GetAt(index);

                    if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill)
                    {
                        m_From.SendGump(new CraftGump(m_From, system, m_Tool, res.Message));
                    }
                    else
                    {
                        if (context != null)
                        {
                            context.LastResourceIndex2 = index;
                        }

                        m_From.SendGump(new CraftGump(m_From, system, m_Tool, null));
                    }
                }

                break;
            }

            case 6:     // Misc. buttons
            {
                switch (index)
                {
                case 0:             // Resource selection
                {
                    if (system.CraftSubRes.Init)
                    {
                        m_From.SendGump(new CraftGump(m_From, system, m_Tool, null, CraftPage.PickResource));
                    }

                    break;
                }

                case 1:             // Smelt item
                {
                    if (system.Resmelt)
                    {
                        Resmelt.Do(m_From, system, m_Tool);
                    }

                    break;
                }

                case 2:             // Make last
                {
                    if (context == null)
                    {
                        break;
                    }

                    CraftItem item = context.LastMade;

                    if (item != null)
                    {
                        CraftItem(item);
                    }
                    else
                    {
                        m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, 1044165, m_Page));                 // You haven't made anything yet.
                    }
                    break;
                }

                case 3:             // Last 10
                {
                    if (context == null)
                    {
                        break;
                    }

                    context.LastGroupIndex = 501;
                    m_From.SendGump(new CraftGump(m_From, system, m_Tool, null));

                    break;
                }

                case 4:             // Toggle use resource hue
                {
                    if (context == null)
                    {
                        break;
                    }

                    context.DoNotColor = !context.DoNotColor;

                    m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page));

                    break;
                }

                case 5:             // Repair item
                {
                    if (system.Repair)
                    {
                        Repair.Do(m_From, system, m_Tool);
                    }

                    break;
                }

                case 6:             // Toggle mark option
                {
                    if (context == null || !system.MarkOption)
                    {
                        break;
                    }

                    switch (context.MarkOption)
                    {
                    case CraftMarkOption.MarkItem: context.MarkOption = CraftMarkOption.DoNotMark; break;

                    case CraftMarkOption.DoNotMark: context.MarkOption = CraftMarkOption.PromptForMark; break;

                    case CraftMarkOption.PromptForMark: context.MarkOption = CraftMarkOption.MarkItem; break;
                    }

                    m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page));

                    break;
                }

                case 7:             // Resource selection 2
                {
                    if (system.CraftSubRes2.Init)
                    {
                        m_From.SendGump(new CraftGump(m_From, system, m_Tool, null, CraftPage.PickResource2));
                    }

                    break;
                }

                case 8:             // Enhance item
                {
                    if (system.CanEnhance)
                    {
                        Enhance.BeginTarget(m_From, system, m_Tool);
                    }

                    break;
                }
                }

                break;
            }
            }
        }