Exemple #1
0
        private CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page)
            : base((Int32)40, (Int32)40)
        {
            m_From        = from;
            m_CraftSystem = craftSystem;
            m_Tool        = tool;
            m_Page        = page;

            if (m_CraftSystem == DefAlchemy.CraftSystem)
            {
                m_CraftSystem = new DefAlchemy();
                m_CraftSystem.CustomSystem(from);
            }
            else if (m_CraftSystem == DefBowFletching.CraftSystem)
            {
                m_CraftSystem = new DefBowFletching();
                m_CraftSystem.CustomSystem(from);
            }
            else if (m_CraftSystem == DefBlacksmithy.CraftSystem)
            {
                m_CraftSystem = new DefBlacksmithy();
                m_CraftSystem.CustomSystem(from);
            }
            else if (m_CraftSystem == DefCarpentry.CraftSystem)
            {
                m_CraftSystem = new DefCarpentry();
                m_CraftSystem.CustomSystem(from);
            }
            else if (m_CraftSystem == DefTinkering.CraftSystem)
            {
                m_CraftSystem = new DefTinkering();
                m_CraftSystem.CustomSystem(from);
            }
            else if (m_CraftSystem == DefTailoring.CraftSystem)
            {
                m_CraftSystem = new DefTailoring();
                m_CraftSystem.CustomSystem(from);
            }
            else if (m_CraftSystem == DefCooking.CraftSystem)
            {
                m_CraftSystem = new DefCooking();
                m_CraftSystem.CustomSystem(from);
            }

            CraftContext context = craftSystem.GetContext(from);

            from.CloseGump(typeof(CraftGump));
            from.CloseGump(typeof(CraftGumpItem));

            AddPage(0);

            AddBackground(0, 0, 530, 437, 5054);
            AddImageTiled(10, 10, 510, 22, 2624);
            AddImageTiled(10, 292, 150, 45, 2624);
            AddImageTiled(165, 292, 355, 45, 2624);
            AddImageTiled(10, 342, 510, 85, 2624);
            AddImageTiled(10, 37, 200, 250, 2624);
            AddImageTiled(215, 37, 305, 250, 2624);
            AddAlphaRegion(10, 10, 510, 417);

            if (craftSystem.GumpTitleNumber > 0)
            {
                AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
            }
            else
            {
                AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false);
            }

            AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor, false, false);               // <CENTER>CATEGORIES</CENTER>
            AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor, false, false);              // <CENTER>SELECTIONS</CENTER>
            AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor, false, false);              // <CENTER>NOTICES</CENTER>

            AddButton(15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor, false, false);               // EXIT

            AddButton(270, 402, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0);
            AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor, false, false);               // MAKE LAST

            // Mark option
            if (craftSystem.MarkOption)
            {
                AddButton(270, 362, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0);
                AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor, false, false);                   // MARK ITEM
            }
            // ****************************************

            // Resmelt option
            if (craftSystem.Resmelt)
            {
                AddButton(15, 342, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0);
                AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor, false, false);                   // SMELT ITEM
            }
            // ****************************************

            // Repair option
            if (craftSystem.Repair)
            {
                AddButton(270, 342, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0);
                AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor, false, false);                   // REPAIR ITEM
            }
            // ****************************************

            // Enhance option
            if (craftSystem.CanEnhance)
            {
                AddButton(270, 382, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0);
                AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor, false, false);                   // ENHANCE ITEM
            }
            // ****************************************

            // Polish option
            if (craftSystem.CanFinish)
            {
                AddButton(400, 342, 4005, 4007, GetButtonID(6, 9), GumpButtonType.Reply, 0);
                AddHtml(435, 345, 150, 18, "<BASEFONT COLOR=#FFFFFF>FINISH ITEM</BASEFONT>", false, false); // FINISH ITEM

                AddButton(400, 382, 4005, 4007, GetButtonID(6, 10), GumpButtonType.Reply, 0);
                AddHtml(435, 385, 150, 18, "<BASEFONT COLOR=#FFFFFF>POLISH ITEM</BASEFONT>", false, false); // POLISH ITEM
            }
            // ****************************************

            if (notice is int && (int)notice > 0)
            {
                AddHtmlLocalized(170, 295, 350, 40, (int)notice, LabelColor, false, false);
            }
            else if (notice is string)
            {
                AddHtml(170, 295, 350, 40, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice), false, false);
            }

            // If the system has more than one resource
            if (craftSystem.CraftSubRes.Init)
            {
                string nameString = craftSystem.CraftSubRes.NameString;
                int    nameNumber = craftSystem.CraftSubRes.NameNumber;

                int resIndex = (context == null ? -1 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    CraftSubRes subResource = craftSystem.CraftSubRes.GetAt(resIndex);

                    nameString = subResource.NameString;
                    nameNumber = subResource.NameNumber;
                }

                AddButton(15, 362, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0);

                if (nameNumber > 0)
                {
                    AddHtmlLocalized(50, 365, 250, 18, nameNumber, LabelColor, false, false);
                }
                else
                {
                    //rw3 color hack
                    //AddLabel( 50, 362, LabelHue, nameString );
                    AddHtml(50, 365, 250, 18, "<basefont color=\"" + LabelColor + "\">" + nameString + "</basefont>", false, false);
                }
            }
            // ****************************************

            // For dragon scales
            if (craftSystem.CraftSubRes2.Init)
            {
                string nameString = craftSystem.CraftSubRes2.NameString;
                int    nameNumber = craftSystem.CraftSubRes2.NameNumber;

                int resIndex = (context == null ? -1 : context.LastResourceIndex2);

                if (resIndex > -1)
                {
                    CraftSubRes subResource = craftSystem.CraftSubRes2.GetAt(resIndex);

                    nameString = subResource.NameString;
                    nameNumber = subResource.NameNumber;
                }

                AddButton(15, 382, 4005, 4007, GetButtonID(6, 7), GumpButtonType.Reply, 0);

                if (nameNumber > 0)
                {
                    AddHtmlLocalized(50, 385, 250, 18, nameNumber, LabelColor, false, false);
                }
                else
                {
                    AddLabel(50, 385, LabelHue, nameString);
                }
            }
            // ****************************************

            CreateGroupList();

            if (page == CraftPage.PickResource)
            {
                CreateResList(false);
            }
            else if (page == CraftPage.PickResource2)
            {
                CreateResList(true);
            }
            else if (context != null && context.LastGroupIndex > -1)
            {
                CreateItemList(context.LastGroupIndex);
            }
        }