Пример #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  = 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;
            }
            }
        }
Пример #2
0
        private void CheckResource(Mobile from, Item item, CraftResource res)
        {
            bool completed = false;

            if (m_System is DefTailoring)//

            {
                switch (res)
                {
                case CraftResource.RegularLeather:
                case CraftResource.SpinedLeather:
                case CraftResource.HornedLeather:
                case CraftResource.BarbedLeather:
                case CraftResource.DragonLeather:
                case CraftResource.DaemonLeather:
                    //default:
                    completed = AlterItem.TryToAlter(from, item);
                    break;
                }
            }
            else
            {
                from.SendMessage("You cannot use this to alter that");
            }
            if (m_System is DefBlacksmithy)
            {
                switch (res)
                {
                // default: // Not listing ores, it's the only logical remainder.

                case CraftResource.Iron:
                case CraftResource.DullCopper:
                case CraftResource.ShadowIron:
                case CraftResource.Copper:
                case CraftResource.Bronze:
                case CraftResource.Gold:
                case CraftResource.Agapite:
                case CraftResource.Verite:
                case CraftResource.Valorite:
                case CraftResource.Silver:
                case CraftResource.Jade:
                case CraftResource.Moonstone:
                case CraftResource.Sunstone:

                    //if (m_Tool is SmithHammer)
                    completed = AlterItem.TryToAlter(from, item);
                    break;
                }
            }
            if (m_System is DefCarpentry)
            {
                switch (res)
                {
                case CraftResource.Log:
                case CraftResource.Oak:
                case CraftResource.Ash:
                case CraftResource.Yew:
                case CraftResource.Heartwood:
                case CraftResource.Bloodwood:
                case CraftResource.Frostwood:
                case CraftResource.Pine:
                case CraftResource.Cedar:
                case CraftResource.Cherry:
                case CraftResource.Mahogany:

                    //if (m_Tool is Hammer)
                    completed = AlterItem.TryToAlter(from, item);
                    break;
                }
            }
            else
            {
                from.SendMessage("You cannot use this to alter that");
            }


            if (completed)
            {
                from.SendMessage("The item has been turned into a gargish item.");
            }
            else
            {
                from.SendMessage("You cannot use this to alter that");
            }
        }