示例#1
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;
                }

                ArrayList lastTen = context.Items;

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

                break;
            }

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

                ArrayList lastTen = context.Items;

                if (index >= 0 && index < lastTen.Count)
                {
                    m_From.SendGump(new CraftGumpItem(m_From, system, (CraftItem)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;
            }
            }
        }
示例#2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_MakeTimer != null)
            {
                m_MakeTimer.Stop();
            }

            if (info.ButtonID <= 0)
            {
                return;                 // Canceled
            }
            int type  = info.ButtonID / 1000;
            int index = info.ButtonID % 1000;

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

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

                CraftItem item = system.CraftItems.GetAt(index);

                if (item != null)
                {
                    CraftItem(item);
                }

                break;
            }

            case 1:                     // Item Details && Make Last
            {
                if (context == null)
                {
                    break;
                }

                switch (index)
                {
                case 999:                                         // Make Last
                {
                    CraftItem item = context.LastMade;

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

                    break;
                }

                default:                                         // Item Details
                {
                    CraftItem item = system.CraftItems.GetAt(index);

                    if (item != null)
                    {
                        m_From.SendGump(new CraftGumpItem(m_From, system, item, m_Tool));
                    }

                    break;
                }
                }

                break;
            }

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

                break;
            }

            case 3:                     // 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 4:                     // 2nd resource selected
            {
                if (index >= 0 && index < system.CraftSubRes2.Count)
                {
                    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 5:                     // Resource selected
            {
                if (index >= 0 && index < system.CraftSubRes.Count)
                {
                    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));
                    }
                }

                break;
            }

            case 6:                     // Craft system features
            {
                if (context == null)
                {
                    break;
                }

                switch (index)
                {
                case 0:                                         // Toggle mark option
                {
                    if (!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 1:                                         // Toggle mark option (KR Version)
                {
                    if (!system.MarkOption)
                    {
                        break;
                    }

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

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

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

                    break;
                }

                case 2:                                         // Toggle quest item option
                {
                    context.QuestItem = !context.QuestItem;

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

                    break;
                }

                case 3:                                         // Make last
                {
                    context.MakeLast = !context.MakeLast;

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

                    break;
                }

                case 4:                                         // Reset Make number
                {
                    context.Total = 1;

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

                    break;
                }

                case 5:                                         // Make Max
                {
                    if (!context.MakeMax)
                    {
                        context.Total = 9999;
                    }
                    else
                    {
                        context.Total  = 1;
                        context.Making = null;
                    }

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

                    break;
                }

                default:                                         // Make number
                {
                    int amount = index - 100;
                    Utility.FixMinMax(ref amount, 1, 100);

                    context.Total = amount;

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

                    break;
                }
                }

                break;
            }

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

                break;
            }

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

                break;
            }

            case 9:                     // Show group && Last 10
            {
                if (context == null)
                {
                    break;
                }

                switch (index)
                {
                case 0:                                         // Alter Item (Gargoyle)
                {
                    if (system.Alter)
                    {
                        Alter.Do(m_From, system, m_Tool);
                    }

                    break;
                }

                case 99:                                         // Last 10
                {
                    context.LastGroupIndex = 501;
                    m_From.SendGump(new CraftGump(m_From, system, m_Tool, null));

                    break;
                }

                default:                                         // Show group
                {
                    index--;

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

                    break;
                }
                }

                break;
            }

            case 12:                     // Cancel Make
            {
                context.Total = 1;

                m_From.SendLocalizedMessage(501806);                                   // Request cancelled.
                m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page));

                break;
            }
            }
        }
示例#3
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);

//I ADDED
            if (context != null)
            {
                context.Count      = 0;
                context.TotalCount = 0;
                TextRelay text = info.GetTextEntry(100);
                if (text.Text != null)
                {
                    string   keywordstring = text.Text;
                    string[] keywords      = keywordstring.Split(' ');
                    if (keywords.Length > 0)
                    {
                        string keyword = keywords[0];
                        try
                        {
                            int value;
                            if (Int32.TryParse(keyword, out value))
                            {
                                if (value > 0)
                                {
                                    context.TotalCount = value;
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
//I ADDED

            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;
                }

//I ADDED
                case 11:                                 // LOOP
                {
                    if (context == null)
                    {
                        break;
                    }
                    context.AutoLoop = (!context.AutoLoop);
                    m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page));
                    break;
                }
//I ADDED
                }

                break;
            }
            }
        }
示例#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  = this.m_CraftSystem;
            CraftGroupCol groups  = system.CraftGroups;
            CraftContext  context = system.GetContext(this.m_From);

            #region Stygian Abyss
            if (Locked)
            {
                if (type == 6 && index == 11)
                {
                    // Cancel Make
                    AutoCraftTimer.EndTimer(m_From);
                }
                return;
            }
            #endregion

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

                if (index >= 0 && index < groups.Count)
                {
                    context.LastGroupIndex = index;
                    this.m_From.SendGump(new CraftGump(this.m_From, system, this.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)
                    {
                        this.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)
                    {
                        this.m_From.SendGump(new CraftGumpItem(this.m_From, system, group.CraftItems.GetAt(index), this.m_Tool));
                    }
                }

                break;
            }

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

                List <CraftItem> lastTen = context.Items;

                if (index >= 0 && index < lastTen.Count)
                {
                    this.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)
                {
                    this.m_From.SendGump(new CraftGumpItem(this.m_From, system, lastTen[index], this.m_Tool));
                }

                break;
            }

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

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

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

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

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

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

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

                break;
            }

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

                    break;
                }

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

                    break;
                }

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

                    CraftItem item = context.LastMade;

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

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

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

                    break;
                }

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

                    context.DoNotColor = !context.DoNotColor;

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

                    break;
                }

                case 5:             // Repair item
                {
                    if (system.Repair)
                    {
                        Repair.Do(this.m_From, system, this.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;
                    }

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

                    break;
                }

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

                    break;
                }

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

                    break;
                }

                    #region Stygian Abyss
                case 9:             // Alter Item (Gargoyle)
                {
                    if (system.CanAlter)
                    {
                        if (Server.SkillHandlers.Imbuing.CheckSoulForge(m_From, 1, false))
                        {
                            AlterItem.BeginTarget(this.m_From, system, this.m_Tool);
                        }
                        else
                        {
                            m_From.SendLocalizedMessage(1111867);                 // You must be near a soulforge to alter an item.
                        }
                    }
                    break;
                }

                case 10:             // Quest Item/Non Quest Item toggle
                {
                    //if (context == null || !system.QuestOption)
                    //break;
                    switch (context.QuestOption)
                    {
                    case CraftQuestOption.QuestItem:
                        context.QuestOption = CraftQuestOption.NonQuestItem;
                        break;

                    case CraftQuestOption.NonQuestItem:
                        context.QuestOption = CraftQuestOption.QuestItem;
                        break;
                    }

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

                    break;
                }

                case 11:             // Cancel Make
                {
                    AutoCraftTimer.EndTimer(m_From);
                    break;
                }
                    #endregion
                }
                break;
            }
            }
        }
示例#5
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            //Cancel
            if (info.ButtonID <= 0)
            {
                return;
            }

            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);

            //Guide
            if (info.ButtonID == 1000)
            {
                string url = "http://www.uoancorp.com";
                sender.Mobile.LaunchBrowser(url);

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

            //Crafting
            else
            {
                switch (type)
                {
                //Group
                case 0:
                {
                    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;
                }

                //Create Item
                case 1:
                {
                    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;
                }

                //Item Details
                case 2:
                {
                    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;
                }

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

                    List <CraftItem> lastTen = context.Items;

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

                    break;
                }

                //Item Details: Last Ten
                case 4:
                {
                    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;
                }

                //Resource Selected
                case 5:
                {
                    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;
                }

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

                        break;
                    }

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

                        break;
                    }

                    //Make Last
                    case 2:
                    {
                        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;
                    }

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

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

                        break;
                    }

                    //Toggle Resource Hue
                    case 4:
                    {
                        if (context == null)
                        {
                            break;
                        }

                        context.DoNotColor = !context.DoNotColor;

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

                        break;
                    }

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

                        break;
                    }

                    //Toggle Mark Option
                    case 6:
                    {
                        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;
                    }

                    //Toggle Smelt option
                    case 9:
                    {
                        if (context == null || !system.Recycle)
                        {
                            break;
                        }

                        switch (context.RecycleOption)
                        {
                        case CraftRecycleOption.RecycleItem: context.RecycleOption = CraftRecycleOption.RecycleAllNonExceptional; break;

                        case CraftRecycleOption.RecycleAllNonExceptional: context.RecycleOption = CraftRecycleOption.RecycleAll; break;

                        case CraftRecycleOption.RecycleAll: context.RecycleOption = CraftRecycleOption.RecycleItem; break;
                        }

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

                        break;
                    }

                    //Highlight Skill Gain
                    case 10:
                    {
                        if (context == null)
                        {
                            break;
                        }

                        context.HighlightSkillGainItems = !context.HighlightSkillGainItems;

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

                        break;
                    }
                    }

                    break;
                }
                }
            }
        }