예제 #1
0
파일: CraftGump.cs 프로젝트: uotools/xrunuo
        public int CreateGroupList()
        {
            CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;

            AddButton(15, 60, 0xFAB, 0xFAC, 9099, GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 60, 150, 18, 1044014, FontColor, false, false);               // LAST TEN

            AddHtmlLocalized(215, 37, 305, 22, 1044011, FontColor, false, false);              // <CENTER>SELECTIONS</CENTER>

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

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

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

            return(craftGroupCol.Count);
        }
예제 #2
0
        public int CreateGroupList()
        {
            CraftGroupCol craftGroupCol = this.m_CraftSystem.CraftGroups;

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

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

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

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

            return(craftGroupCol.Count);
        }
예제 #3
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, 60 + (i * 20), 4005, 4007, GetButtonID(0, i), GumpButtonType.Reply, 0);                     // 60 = 80

                if (craftGroup.NameNumber > 0)
                {
                    AddHtmlLocalized(50, 63 + (i * 20), 150, 18, craftGroup.NameNumber, LabelColor, false, false);                       // 63 = 83
                }
                else
                {
                    //rw3 color hack
                    //AddLabel( 50, 80 + (i * 20), LabelHue, craftGroup.NameString );
                    AddHtml(50, 63 + (i * 20), 150, 18, "<basefont color=\"" + LabelColor + "\">" + craftGroup.NameString + "</basefont>", false, false);                       // 63=83
                }
            }


            return(craftGroupCol.Count);
        }
예제 #4
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 );
                    AddHtml(50, 83 + (i * 20), 150, 18, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, craftGroup.NameString), false, false);
                }
            }

            return(craftGroupCol.Count);
        }
예제 #5
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
            AddHtml(50, 63, 300, 20, "<h3><basefont color=#FFFFFF>Dernier Objets<basefont></h3>", false, false);

            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 );
                    AddHtml(50, 80 + (i * 20), 200, 20, "<h3><basefont color=#FFFFFF>" + craftGroup.NameString + "<basefont></h3>", false, false);
                }
            }

            return(craftGroupCol.Count);
        }
예제 #6
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 % numitemsPerPage;

                CraftItem craftItem = craftItemCol.GetAt(i);

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

                    AddPage((i / numitemsPerPage) + 1);

                    if (i > 0)
                    {
                        AddButton(220, 300, 4014, 4015, 0, GumpButtonType.Page, i / numitemsPerPage);
                        AddHtmlLocalized(255, 303, 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
                {
                    if (m_From.NetState.Version.Major <= 3)
                    {
                        AddHtml(255, 60 + (index * 20), 220, 18, "<BASEFONT COLOR=BLACK>" + craftItem.NameString, false, false);
                    }
                    else
                    {
                        AddHtml(255, 60 + (index * 20), 220, 18, "<BASEFONT COLOR=WHITE>" + craftItem.NameString, false, false);
                    }
                }

                //AddLabel( 255, 60 + (index * 20), LabelHue, craftItem.NameString );

                AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
            }
        }
예제 #7
0
파일: CraftGump.cs 프로젝트: uotools/xrunuo
        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;

            int i = 0;

            List <CraftItem> items = new List <CraftItem>(craftItemCol.Values);

            items.Sort();

            foreach (CraftItem craftItem in items)
            {
                int index = i % 10;

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

                    AddPage((i / 10) + 1);

                    if (i > 0)
                    {
                        AddHtmlLocalized(255, 263, 100, 18, 1044044, FontColor, false, false);                           // PREV PAGE
                        AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
                    }
                }
                // ********** End Next and Previous Buttons **********

                AddButton(220, 60 + (index * 20), 4005, 4007, craftItem.CraftId, GumpButtonType.Reply, 0);

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

                AddButton(480, 60 + (index * 20), 4011, 4012, craftItem.CraftId + 1000, GumpButtonType.Reply, 0);

                i++;
            }
        }
예제 #8
0
        public void CreateItemList(int selectedGroup)
        {
            if (selectedGroup == 501) // 501 : Last 10
            {
                CreateMakeLastList();
                return;
            }

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

            if (craftGroup == null)
            {
                return;
            }

            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);
            }
        }
예제 #9
0
        public void CreateItemList(int selectedGroup)
        {
            if (selectedGroup == 501)             // 501 : Last 10
            {
                CreateMakeLastList();
                return;
            }

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

            _ItemCache = craftGroup.CraftItems.Where(ci => ci != null && m_From.Expansion >= ci.RequiredExpansion).ToArray();

            for (int i = 0; i < _ItemCache.Length; ++i)
            {
                int index = i % 10;

                CraftItem craftItem = _ItemCache[i];

                if (craftItem.Recipe != null && m_From is PlayerMobile && !((PlayerMobile)m_From).HasRecipe(craftItem.Recipe))
                {
                    continue;
                }

                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);
            }
        }
예제 #10
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();

            InitCraftList();
        }
예제 #11
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();

            InitCraftList();
        }
예제 #12
0
        public int CreateGroupList()
        {
            CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;

            CraftContext context = m_CraftSystem.GetContext(m_From);

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

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

                bool skillGainPossible = false;
                bool allRequiredSkills = true;

                if (context != null)
                {
                    CraftItemCol craftItemCol = craftGroup.CraftItems;
                    Type         resourceType = m_CraftSystem.CraftSubRes.ResType;

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

                        if (craftItem.SkillGainPossible(m_From, resourceType, m_CraftSystem, false, ref allRequiredSkills))
                        {
                            skillGainPossible = true;
                        }
                    }

                    if (!context.HighlightSkillGainItems)
                    {
                        skillGainPossible = false;
                    }
                }

                int textHue = LabelHue;

                if (skillGainPossible)
                {
                    textHue = skillGainPossibleHue;
                }

                AddButton(15, 80 + (a * 20), 4005, 4007, GetButtonID(0, a), GumpButtonType.Reply, 0);
                AddLabel(50, 80 + (a * 20), textHue, craftGroup.NameString);
            }

            return(craftGroupCol.Count);
        }
예제 #13
0
        public CraftSystem(int minCraftEffect, int maxCraftEffect, double delay)
        {
            this.m_MinCraftEffect = minCraftEffect;
            this.m_MaxCraftEffect = maxCraftEffect;
            this.m_Delay = delay;

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

            this.InitCraftList();
            AddSystem(this);
        }
예제 #14
0
        public CraftSystem(int minCraftEffect, int maxCraftEffect, double delay)
        {
            MinCraftEffect = minCraftEffect;
            MaxCraftEffect = maxCraftEffect;
            Delay          = delay;

            CraftItems   = new CraftItemCol();
            CraftGroups  = new CraftGroupCol();
            CraftSubRes  = new CraftSubResCol();
            CraftSubRes2 = new CraftSubResCol();

            InitCraftList();
            AddSystem(this);
        }
예제 #15
0
        public CraftSystem(int minCraftEffect, int maxCraftEffect, double delay)
        {
            MinCraftEffect = minCraftEffect;
            MaxCraftEffect = maxCraftEffect;
            Delay          = delay;

            CraftItems   = new CraftItemCol();
            CraftGroups  = new CraftGroupCol();
            CraftSubRes  = new CraftSubResCol();
            CraftSubRes2 = new CraftSubResCol();

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

            InitCraftList();
        }
예제 #16
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;
            }
            }
        }
예제 #17
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;

            CraftContext context = m_CraftSystem.GetContext(m_From);

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

                CraftItem craftItem = craftItemCol.GetAt(i);

                if (index == 0)
                {
                    if (i > 0)
                    {
                        AddButton(395, 265, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1);
                        AddHtmlLocalized(430, 268, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
                    }

                    AddPage((i / 10) + 1);

                    if (i > 0)
                    {
                        AddButton(245, 265, 4014, 4015, 0, GumpButtonType.Page, i / 10);
                        AddHtmlLocalized(280, 268, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
                    }
                }

                AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);

                bool skillGainPossible = false;
                bool allRequiredSkills = true;

                if (context != null)
                {
                    Type resourceType = m_CraftSystem.CraftSubRes.ResType;

                    skillGainPossible = craftItem.SkillGainPossible(m_From, resourceType, m_CraftSystem, false, ref allRequiredSkills);

                    if (!context.HighlightSkillGainItems)
                    {
                        skillGainPossible = false;
                    }
                }

                string nameText = "";

                nameText += craftItem.NameString;

                if (craftItem.Count > 1)
                {
                    nameText += " (" + craftItem.Count.ToString() + ")";
                }

                if (skillGainPossible)
                {
                    AddLabel(255, 60 + (index * 20), skillGainPossibleHue, nameText);
                }

                else
                {
                    AddLabel(255, 60 + (index * 20), LabelHue, nameText);
                }

                AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
            }
        }
예제 #18
0
파일: CraftGump.cs 프로젝트: uotools/xrunuo
        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;
            }
            }
        }
예제 #19
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;
                }
                }
            }
        }
예제 #20
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;
            }
            }
        }
예제 #21
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)
            {
                CraftItem craftItem = craftItemCol.GetAt(i);


                int index = i % 10;


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



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

                // Plume : Section à décommenter si l'on souhaite que seul les items que le joueur peut crafter avec ses skills soient affichés
                bool CantDisplay = false;

                for (int t = 0; t < craftItem.Skills.Count; t++)
                {
                    CraftSkill skill = craftItem.Skills.GetAt(t);

                    if (skill.MinSkill > m_From.Skills[skill.SkillToMake].Value)
                    {
                        CantDisplay = true;
                        break;
                    }
                }

                if (CantDisplay)
                {
                    continue;
                }

                AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0); // Quick Create
                AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0); //Details
            }
        }
예제 #22
0
        public void CreateItemList(int selectedGroup)
        {
            if (selectedGroup == 501) // 501 : Last 10
            {
                this.CreateMakeLastList();
                return;
            }

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

            //daat99 OWLTR start - recipe craft
            bool b_BankHive     = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.CRAFTING_BANK_HIVE),
                 b_StorageDeeds = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.CRAFTING_STORAGE_DEEDS),
                 b_Forge        = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.CRAFTING_MOBILE_FORGE),
                 b_RecipeCraft  = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.RECIPE_CRAFT),
                 b_Alchemy      = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.ALCHEMY_RECIPES),
                 b_Blacksmithy  = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.BLACKSMITH_RECIPES),
                 b_BowFletching = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.BOWFLETCH_RECIPES),
                 b_Carpentry    = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.CARPENTRY_RECIPES),
                 b_Cooking      = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.COOKING_RECIPES),
                 b_Glassblowing = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.GLASSBLOWING_RECIPES),
                 b_Inscription  = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.INSCRIPTION_RECIPES),
                 b_Masonry      = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.MASONRY_RECIPES),
                 b_Tailoring    = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.TAILORING_RECIPES),
                 b_Tinkering    = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.TINKERING_RECIPES);

            if (b_RecipeCraft)
            {
                NewDaat99Holder dh = (NewDaat99Holder)daat99.Daat99OWLTR.TempHolders[m_From];

                int i, i_Length = 0;

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

                    CraftItem craftItem = craftItemCol.GetAt(i);

                    if (!dh.ItemTypeList.Contains(craftItem.ItemType) || (!b_Alchemy && m_CraftSystem is DefAlchemy) ||
                        (!b_Blacksmithy && m_CraftSystem is DefBlacksmithy) || (!b_BowFletching && m_CraftSystem is DefBowFletching) ||
                        (!b_Carpentry && m_CraftSystem is DefCarpentry) || (!b_Cooking && m_CraftSystem is DefCooking) ||
                        (!b_Glassblowing && m_CraftSystem is DefGlassblowing) || (!b_Inscription && m_CraftSystem is DefInscription) ||
                        (!b_Masonry && m_CraftSystem is DefMasonry) || (!b_Tailoring && m_CraftSystem is DefTailoring) ||
                        (!b_Tinkering && m_CraftSystem is DefTinkering))
                    {
                        if (index == 0)
                        {
                            if (i_Length > 0)
                            {
                                AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, (i_Length / 10) + 1);
                                AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false);                                   // NEXT PAGE
                            }

                            AddPage((i_Length / 10) + 1);

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

                        if (craftItem.ItemType == typeof(BankHive) && !b_BankHive)
                        {
                            continue;
                        }
                        else if (craftItem.ItemType == typeof(MobileForge) && !b_Forge)
                        {
                            continue;
                        }
                        else if (craftItem.ItemType == typeof(BaseStorageDeed) && !b_StorageDeeds)
                        {
                            continue;
                        }

                        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);
                        i_Length++;
                    }
                }
            }
            else
            {
                //daat99 OWLTR end - recipe craft
                for (int i = 0; i < craftItemCol.Count; ++i)
                {
                    int index = i % 10;

                    CraftItem craftItem = craftItemCol.GetAt(i);

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

                        this.AddPage((i / 10) + 1);

                        if (i > 0)
                        {
                            this.AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
                            this.AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
                        }
                    }
                    //daat99 OWLTR start - custom craftables
                    if (craftItem.ItemType == typeof(BankHive) && !b_BankHive)
                    {
                        continue;
                    }
                    else if (craftItem.ItemType == typeof(MobileForge) && !b_Forge)
                    {
                        continue;
                    }
                    else if (craftItem.ItemType == typeof(BaseStorageDeed) && !b_StorageDeeds)
                    {
                        continue;
                    }
                    //daat99 OWLTR end - custom craftables
                    this.AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);

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

                    this.AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
                }
            }
        }
예제 #23
0
        public void CreateItemList(int selectedGroup)
        {
            int numberOfPage = 0;

            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 % maxItemPerPage;

                CraftItem craftItem = craftItemCol.GetAt(i);

                if (index == 0)
                {
                    if (i > 0)
                    {
                        AddButton(780, 360, 4005, 4007, 0, GumpButtonType.Page, (i / maxItemPerPage) + 1);
                        //AddHtmlLocalized( 405, 263, 100, 18, 1044045, LabelColor, false, false ); // NEXT PAGE
                        AddHtml(655, 363, 200, 20, "<h3><basefont color=#FFFFFF>Page Suivante<basefont></h3>", false, false);
                    }

                    AddPage((i / maxItemPerPage) + 1);
                    numberOfPage++;

                    if (i > 0)
                    {
                        AddButton(220, 360, 4014, 4015, 0, GumpButtonType.Page, (i / maxItemPerPage));
                        //AddHtmlLocalized( 255, 263, 100, 18, 1044044, LabelColor, false, false ); // PREV PAGE
                        AddHtml(255, 363, 200, 20, "<h3><basefont color=#FFFFFF>Page Précédante<basefont></h3>", false, false);
                    }
                }

                if (i < (maxItemPerPage / 2 + ((numberOfPage - 1) * maxItemPerPage)))
                {
                    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 );
                        AddHtml(255, 60 + (index * 20), 200, 20, "<h3><basefont color=#FFFFFF>" + (i + 1) + ". " + craftItem.NameString + "<basefont></h3>", false, false);
                    }

                    AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
                }
                else
                {
                    AddButton(520, 60 + ((index - maxItemPerPage / 2) * 20), 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);

                    if (craftItem.NameNumber > 0)
                    {
                        AddHtmlLocalized(555, 63 + ((index - maxItemPerPage / 2) * 20), 220, 18, craftItem.NameNumber, LabelColor, false, false);
                    }
                    else
                    {
                        //AddLabel( 255, 60 + (index * 20), LabelHue, craftItem.NameString );
                        AddHtml(555, 60 + ((index - maxItemPerPage / 2) * 20), 200, 20, "<h3><basefont color=#FFFFFF>" + (i + 1) + ". " + craftItem.NameString + "<basefont></h3>", false, false);
                    }

                    AddButton(780, 60 + ((index - maxItemPerPage / 2) * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
                }
            }
        }
예제 #24
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;
            }
            }
        }