示例#1
0
文件: Gumps.cs 项目: Evad-lab/ServUOX
        private bool HasMetPrerequisite(ReforgingOption option)
        {
            switch (option)
            {
            case ReforgingOption.None: return(true);

            case ReforgingOption.Powerful: return(true);

            case ReforgingOption.Structural: return(true);

            case ReforgingOption.Fortified: return((m_Options & ReforgingOption.Structural) != 0);

            case ReforgingOption.Fundamental: return(true);

            case ReforgingOption.Integral: return((m_Options & ReforgingOption.Fundamental) != 0);

            case ReforgingOption.GrandArtifice: return(true);

            case ReforgingOption.InspiredArtifice: return((m_Options & ReforgingOption.GrandArtifice) != 0);

            case ReforgingOption.ExaltedArtifice: return((m_Options & ReforgingOption.GrandArtifice) != 0);

            case ReforgingOption.SublimeArtifice: return((m_Options & ReforgingOption.ExaltedArtifice) != 0 && (m_Options & ReforgingOption.GrandArtifice) != 0);
            }
            return(true);
        }
示例#2
0
文件: Gumps.cs 项目: Evad-lab/ServUOX
        private int GetCliloc(ReforgingOption option)
        {
            switch (option)
            {
            default:
            case ReforgingOption.None: return(0);

            case ReforgingOption.Powerful: return(1151954);

            case ReforgingOption.Structural: return(1151955);

            case ReforgingOption.Fortified: return(1151956);

            case ReforgingOption.Fundamental: return(1151957);

            case ReforgingOption.Integral: return(1151958);

            case ReforgingOption.GrandArtifice: return(1151961);

            case ReforgingOption.InspiredArtifice: return(1151962);

            case ReforgingOption.ExaltedArtifice: return(1151963);

            case ReforgingOption.SublimeArtifice: return(1151964);
            }
        }
示例#3
0
文件: Gumps.cs 项目: Evad-lab/ServUOX
            public ItemNameGump(Item toreforge, BaseRunicTool tool, ReforgingOption options, ReforgedPrefix prefix, ReforgedSuffix suffix, bool isprefix)
                : base(100, 100)
            {
                m_Tool      = tool;
                m_ToReforge = toreforge;
                m_Options   = options;
                m_Prefix    = prefix;
                m_Suffix    = suffix;
                m_IsPrefix  = isprefix;

                AddBackground(0, 0, 370, 440, 83);

                AddHtmlLocalized(10, 10, 350, 18, 1114513, "#1152089", 0x4BB7, false, false); // Runic Crafting - Item Name Selection

                int buttonID  = 4005;
                int buttonHue = 0x4BB2;
                int y         = 50;

                foreach (int i in Enum.GetValues(typeof(ReforgedPrefix)))
                {
                    if (i == 0)
                    {
                        continue;
                    }

                    if ((isprefix && prefix == (ReforgedPrefix)i) || (!isprefix && suffix == (ReforgedSuffix)i))
                    {
                        buttonID  = 4006;
                        buttonHue = Green;
                    }
                    else
                    {
                        buttonID  = 4005;
                        buttonHue = White;
                    }

                    if (RunicReforging.HasSelection(i, toreforge, tool, m_Options, (int)m_Prefix, (int)m_Suffix))
                    {
                        AddButton(15, y, buttonID, buttonID, 100 + i, GumpButtonType.Reply, 0);
                    }
                    else
                    {
                        buttonHue = Yellow;
                    }

                    AddHtmlLocalized(55, y, 250, 20, RunicReforging.GetName(i), buttonHue, false, false);

                    y += 25;
                }

                AddHtmlLocalized(45, 412, 100, 20, 1060675, White, false, false);
                AddButton(10, 412, 4017, 4019, 0, GumpButtonType.Reply, 0);
            }
示例#4
0
文件: Gumps.cs 项目: Evad-lab/ServUOX
        private void InvalidatePrerequisite(ReforgingOption option)
        {
            switch (option)
            {
            case ReforgingOption.None:
            case ReforgingOption.Powerful: break;

            case ReforgingOption.Structural:
                if ((m_Options & ReforgingOption.Fortified) != 0)
                {
                    m_Options ^= ReforgingOption.Fortified;
                }
                break;

            case ReforgingOption.Fortified: break;

            case ReforgingOption.Fundamental:
                if ((m_Options & ReforgingOption.Integral) != 0)
                {
                    m_Options ^= ReforgingOption.Integral;
                }
                break;

            case ReforgingOption.Integral: break;

            case ReforgingOption.GrandArtifice:
                if ((m_Options & ReforgingOption.InspiredArtifice) != 0)
                {
                    m_Options ^= ReforgingOption.InspiredArtifice;
                }
                if ((m_Options & ReforgingOption.ExaltedArtifice) != 0)
                {
                    m_Options ^= ReforgingOption.ExaltedArtifice;
                }
                if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
                {
                    m_Options ^= ReforgingOption.SublimeArtifice;
                }
                break;

            case ReforgingOption.InspiredArtifice: break;

            case ReforgingOption.ExaltedArtifice:
                if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
                {
                    m_Options ^= ReforgingOption.SublimeArtifice;
                }
                break;

            case ReforgingOption.SublimeArtifice: break;
            }
        }
示例#5
0
        private int GetTotalCharges()
        {
            int count = 1;

            for (var index = 0; index < Options.Length; index++)
            {
                ReforgingOption option = Options[index];

                if ((m_Options & option) != 0)
                {
                    count++;
                }
            }

            return(Math.Min(10, count));
        }
示例#6
0
            public ItemNameGump(Item toreforge, BaseRunicTool tool, ReforgingOption options, ReforgedPrefix prefix, ReforgedSuffix suffix, bool isprefix)
                : base(25, 25)
            {
                m_Tool      = tool;
                m_ToReforge = toreforge;
                m_Options   = options;
                m_Prefix    = prefix;
                m_Suffix    = suffix;
                m_IsPrefix  = isprefix;

                AddBackground(0, 0, 376, 445, 83);

                AddHtmlObject(72, 10, 250, 100, 1152089, DarkGreen, false, false);

                int buttonID  = 4005;
                int buttonHue = White;
                int y         = 50;

                foreach (int i in Enum.GetValues(typeof(ReforgedPrefix)))
                {
                    if ((isprefix && prefix == (ReforgedPrefix)i) || (!isprefix && suffix == (ReforgedSuffix)i))
                    {
                        buttonID  = 4006;
                        buttonHue = LightGreen;
                    }
                    else
                    {
                        buttonID  = 4005;
                        buttonHue = White;
                    }

                    if (HasSelection(i, toreforge, tool))
                    {
                        AddButton(15, y, buttonID, buttonID, 100 + i, GumpButtonType.Reply, 0);
                        AddHtmlObject(55, y, 250, 20, RunicReforging.GetName(i), buttonHue, false, false);
                    }

                    y += 25;
                }

                AddHtmlObject(55, 410, 100, 20, "CLOSE", White, false, false);
                AddButton(15, 410, 4017, 4019, 0, GumpButtonType.Reply, 0);
            }
示例#7
0
        public ReforgingContext(GenericReader reader)
        {
            Contexts = new Dictionary <BaseTool, ReforgingInfo>();

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    BaseTool tool = reader.ReadItem() as BaseTool;
                    var      info = new ReforgingInfo((ReforgingOption)reader.ReadInt(), (ReforgedPrefix)reader.ReadInt(), (ReforgedSuffix)reader.ReadInt());

                    if (tool != null)
                    {
                        Contexts[tool] = info;
                    }
                }
                break;

            case 0:
                reader.ReadInt();
                reader.ReadInt();

                int count2 = reader.ReadInt();
                for (int i = 0; i < count2; i++)
                {
                    BaseTool        tool   = reader.ReadItem() as BaseTool;
                    ReforgingOption option = (ReforgingOption)reader.ReadInt();

                    if (tool != null)
                    {
                        Contexts[tool] = new ReforgingInfo(option);
                    }
                }
                break;
            }
        }
示例#8
0
        public ReforgingContext(GenericReader reader)
        {
            Contexts = new Dictionary <BaseTool, ReforgingOption>();

            int version = reader.ReadInt();

            Prefix = (ReforgedPrefix)reader.ReadInt();
            Suffix = (ReforgedSuffix)reader.ReadInt();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                BaseTool        tool   = reader.ReadItem() as BaseTool;
                ReforgingOption option = (ReforgingOption)reader.ReadInt();

                if (tool != null)
                {
                    Contexts[tool] = option;
                }
            }
        }
示例#9
0
文件: Gumps.cs 项目: Evad-lab/ServUOX
        private bool CanReforge(Mobile from, ReforgingOption option)
        {
            double skill = from.Skills[SkillName.Imbuing].Value;

            switch (option)
            {
            default:
            case ReforgingOption.None:
            case ReforgingOption.Powerful: return(skill >= 65.0);

            case ReforgingOption.Structural:
            case ReforgingOption.Fortified: return(skill >= 85.0);

            case ReforgingOption.Fundamental:
            case ReforgingOption.Integral: return(skill >= 97.0);

            case ReforgingOption.GrandArtifice:
            case ReforgingOption.InspiredArtifice: return(skill >= 100.1);

            case ReforgingOption.ExaltedArtifice:
            case ReforgingOption.SublimeArtifice: return(skill >= 110.1);
            }
        }
示例#10
0
文件: Gumps.cs 项目: Crome696/ServUO
 private int GetCliloc(ReforgingOption option)
 {
     switch (option)
     {
         default:
         case ReforgingOption.None: return 0;
         case ReforgingOption.Powerful: return 1151954;
         case ReforgingOption.Structural: return 1151955;
         case ReforgingOption.Fortified: return 1151956;
         case ReforgingOption.Fundamental: return 1151957;
         case ReforgingOption.Integral: return 1151958;
         case ReforgingOption.GrandArtifice: return 1151961;
         case ReforgingOption.InspiredArtifice: return 1151962;
         case ReforgingOption.ExaltedArtifice: return 1151963;
         case ReforgingOption.SublimeArtifice: return 1151964;
     }
 }
示例#11
0
文件: Gumps.cs 项目: Crome696/ServUO
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
                case 0: break;
                case 1: // prefix
                    from.SendGump(new ItemNameGump(m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix, true));
                    break;
                case 2: // suffix
                    from.SendGump(new ItemNameGump(m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix, false));
                    break;
                case 3: // Reforge Item
                    {
                        int totalCharges = GetTotalCharges();

                        if (m_Tool.UsesRemaining >= totalCharges)
                        {
                            CraftResourceInfo resInfo = CraftResources.GetInfo(m_Tool.Resource);

                            if (resInfo == null)
                                return;

                            CraftAttributeInfo attrs = resInfo.AttributeInfo;
                            int budget = GetBudget();

                            int min = 10;
                            int max = 40;

                            if (attrs != null)
                            {
                                min = attrs.RunicMinIntensity;
                                max = attrs.RunicMaxIntensity;
                            }

                            if (min < 10) min = 10;
                            if (max > 100) max = 100;

                            if (m_Prefix == ReforgedPrefix.None && (m_Options & ReforgingOption.GrandArtifice) != 0)
                            {
                                m_Prefix = RunicReforging.ChooseRandomPrefix(m_ToReforge);
                                budget = Math.Min(800, budget + 50);
                            }

                            if (m_Suffix == ReforgedSuffix.None && (m_Options & ReforgingOption.ExaltedArtifice) != 0)
                            {
                                m_Suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, m_Prefix);
                                budget = Math.Min(800, budget + 50);
                            }

                            int maxprops;

                            if (attrs != null)
                                maxprops = Utility.RandomMinMax(attrs.RunicMinAttributes, attrs.RunicMaxAttributes);
                            else
                                maxprops = Math.Min(5, (budget / 110) + 1);

                            if (maxprops == 5 && 0.25 > Utility.RandomDouble())
                                maxprops = 6;

                            if (maxprops == 6 && budget >= 650 && 0.10 > Utility.RandomDouble())
                                maxprops = 7;

                            RunicReforging.ApplyReforgedProperties(m_ToReforge, m_Prefix, m_Suffix, true, budget, min, max, maxprops, 0, m_Tool, m_Options);

                            OnAfterReforged(m_ToReforge);
                            from.SendLocalizedMessage(1152286); // You re-forge the item!
                            m_Tool.UsesRemaining -= totalCharges;

                            if (m_Tool != null && m_Tool.CraftSystem != null)
                                m_Tool.CraftSystem.PlayCraftEffect(from);

                            if (m_Tool.UsesRemaining <= 0)
                            {
                                m_Tool.Delete();
                                from.SendLocalizedMessage(1044038); // You have worn out your tool!
                            }
                        }

                        break;
                    }
                case 4:
                    from.SendGump(new ReforgingHelpGump());
                    break;
                default: // Option
                    {
                        ReforgingOption option = Options[info.ButtonID - 100];

                        if (HasMetPrerequisite(option))
                        {
                            if ((m_Options & option) == 0)
                                m_Options |= option;
                            else
                            {
                                m_Options ^= option;
                                InvalidatePrerequisite(option);
                            }
                        }

                        from.SendGump(new RunicReforgingGump(from, m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix));
                        break;
                    }
            }
        }
示例#12
0
 public ReforgingInfo(ReforgingOption option, ReforgedPrefix prefix, ReforgedSuffix suffix)
 {
     Options = option;
     Prefix  = prefix;
     Suffix  = suffix;
 }
示例#13
0
 public ReforgingInfo(ReforgingOption option)
 {
     Options = option;
 }
示例#14
0
        private static int GetPrerequisiteIndex(ReforgingOption option)
        {
            if ((option & ReforgingOption.Powerful) != 0 &&
                (option & ReforgingOption.Structural) != 0 &&
                (option & ReforgingOption.Fundamental) != 0)
                return 6;

            if ((option & ReforgingOption.Structural) != 0 &&
                (option & ReforgingOption.Fundamental) != 0)
                return 5;

            if ((option & ReforgingOption.Powerful) != 0 &&
                (option & ReforgingOption.Structural) != 0)
                return 4;

            if ((option & ReforgingOption.Fundamental) != 0)
                return 3;

            if ((option & ReforgingOption.Structural) != 0)
                return 2;

            if ((option & ReforgingOption.Powerful) != 0)
                return 1;

            return 0;
        }
示例#15
0
文件: Gumps.cs 项目: Evad-lab/ServUOX
        public RunicReforgingGump(Mobile from, Item toReforge, BaseRunicTool tool)
            : base(100, 100)
        {
            from.CloseGump(typeof(RunicReforgingGump));
            from.CloseGump(typeof(ImbueGump));

            m_Context = ReforgingContext.GetContext(from);

            if (!m_Context.Contexts.ContainsKey(tool))
            {
                m_Context.Contexts[tool] = ReforgingOption.None;
            }

            m_Tool      = tool;
            m_ToReforge = toReforge;
            m_Options   = m_Context.Contexts[tool];

            m_Prefix = m_Context.Prefix;
            m_Suffix = m_Context.Suffix;

            AddBackground(0, 0, 370, 440, 83);
            AddHtmlLocalized(10, 10, 350, 18, 1114513, "#1151952", 0x4BB7, false, false); // Runic Crafting Options

            int buttonHue = 0x4BB2;
            int buttonID  = 0x4005;
            int y         = 40;
            int idx       = 0;

            for (int i = 0; i < Options.Length; i++)
            {
                ReforgingOption option = Options[i];

                if ((m_Options & option) != 0)
                {
                    if (CanReforge(from, option) && HasMetPrerequisite(option))
                    {
                        buttonHue = 0x4BB2;
                        buttonID  = 4006;
                    }
                    else
                    {
                        buttonHue = 0x7652;
                        buttonID  = 4006;
                    }
                }
                else
                {
                    if (CanReforge(from, option) && HasMetPrerequisite(option))
                    {
                        buttonHue = 0x6F7B;
                        buttonID  = 4005;
                    }
                    else
                    {
                        buttonHue = 0x7652;
                        buttonID  = 4006;
                    }
                }

                if (HasMetPrerequisite(option) && CanReforge(from, option))
                {
                    AddButton(15, y, buttonID, buttonID, i + 100, GumpButtonType.Reply, 0);
                }

                AddHtmlLocalized(55, y, 250, 20, GetCliloc(option), buttonHue, false, false);

                y += 25;
                idx++;
            }

            int totalCharges = GetTotalCharges();

            if ((m_Options & ReforgingOption.InspiredArtifice) != 0)
            {
                AddButton(15, 305, 4005, 4007, 1, GumpButtonType.Reply, 0);
                AddHtmlLocalized(55, 305, 250, 20, 1152087, 0x6F7B, false, false);
                AddHtmlLocalized(190, 305, 250, 20, RunicReforging.GetName((int)m_Prefix), 0x5757, false, false);
            }

            if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
            {
                AddButton(15, 330, 4005, 4007, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(55, 330, 250, 20, 1152088, 0x6F7B, false, false);
                AddHtmlLocalized(190, 330, 250, 20, RunicReforging.GetName((int)m_Suffix), 0x5757, false, false);
            }

            AddHtmlLocalized(10, 363, 140, 22, 1114514, "#1152078", 0x4BB2, false, false); // CHARGES NEEDED:
            AddLabel(160, 363, 0x113, totalCharges.ToString());

            AddHtmlLocalized(10, 385, 140, 22, 1114514, "#1152077", 0x6F7B, false, false); // TOOL CHARGES:
            AddLabel(160, 385, 0x44E, m_Tool.UsesRemaining.ToString());

            AddButton(10, 412, 4017, 4018, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 410, 200, 20, 1060675, 0x6F7B, false, false); // CLOSE

            AddButton(330, 363, 4014, 4016, 3, GumpButtonType.Reply, 0);
            AddHtmlLocalized(190, 363, 135, 22, 1114514, "#1152080", 0x6F7B, false, false); // REFORGE ITEM

            AddButton(330, 412, 4011, 4013, 4, GumpButtonType.Reply, 0);
            AddHtmlLocalized(185, 412, 140, 18, 1114514, "#1149735", 0x6F7B, false, false); // HELP
        }
示例#16
0
文件: Gumps.cs 项目: Crome696/ServUO
 private void InvalidatePrerequisite(ReforgingOption option)
 {
     switch (option)
     {
         case ReforgingOption.None:
         case ReforgingOption.Powerful: break;
         case ReforgingOption.Structural:
             if ((m_Options & ReforgingOption.Fortified) != 0)
                 m_Options ^= ReforgingOption.Fortified;
             break;
         case ReforgingOption.Fortified: break;
         case ReforgingOption.Fundamental:
             if ((m_Options & ReforgingOption.Integral) != 0)
                 m_Options ^= ReforgingOption.Integral;
             break;
         case ReforgingOption.Integral: break;
         case ReforgingOption.GrandArtifice:
             if ((m_Options & ReforgingOption.InspiredArtifice) != 0)
                 m_Options ^= ReforgingOption.InspiredArtifice;
             if ((m_Options & ReforgingOption.ExaltedArtifice) != 0)
                 m_Options ^= ReforgingOption.ExaltedArtifice;
             if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
                 m_Options ^= ReforgingOption.SublimeArtifice;
             break;
         case ReforgingOption.InspiredArtifice: break;
         case ReforgingOption.ExaltedArtifice:
             if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
                 m_Options ^= ReforgingOption.SublimeArtifice;
             break;
         case ReforgingOption.SublimeArtifice: break;
     }
 }
示例#17
0
        public RunicReforgingGump(Mobile from, Item toReforge, BaseRunicTool tool, ReforgingOption options, ReforgedPrefix prefix, ReforgedSuffix suffix)
            : base(25, 25)
        {
            from.CloseGump(typeof(RunicReforgingGump));
            from.CloseGump(typeof(ImbuingGumpC));

            m_Tool      = tool;
            m_ToReforge = toReforge;
            m_Options   = options;
            m_Prefix    = prefix;
            m_Suffix    = suffix;

            AddBackground(0, 0, 374, 444, 83);

            AddHtmlObject(120, 13, 200, 20, 1151952, DarkGreen, false, false); // Runic Crafting Options

            int buttonHue = White;
            int buttonID  = 0x4005;
            int y         = 40;
            int idx       = 0;

            for (int i = 0; i < Options.Length; i++)
            {
                ReforgingOption option = Options[i];

                if ((m_Options & option) != 0)
                {
                    if (CanReforge(from, option) && HasMetPrerequisite(option))
                    {
                        buttonHue = LightGreen;
                        buttonID  = 4006;
                    }
                    else
                    {
                        buttonHue = Orange;
                        buttonID  = 4006;
                    }
                }
                else
                {
                    if (CanReforge(from, option) && HasMetPrerequisite(option))
                    {
                        buttonHue = White;
                        buttonID  = 4005;
                    }
                    else
                    {
                        buttonHue = Orange;
                        buttonID  = 4006;
                    }
                }

                if (HasMetPrerequisite(option) && CanReforge(from, option))
                {
                    AddButton(15, y, buttonID, buttonID, i + 100, GumpButtonType.Reply, 0);
                }

                AddHtmlObject(55, y, 250, 20, GetCliloc(option), buttonHue, false, false);

                y += 25;
                idx++;
            }

            int totalCharges = GetTotalCharges();

            if ((m_Options & ReforgingOption.InspiredArtifice) != 0)
            {
                AddButton(15, 305, 4005, 4007, 1, GumpButtonType.Reply, 0);
                AddHtmlObject(55, 305, 250, 20, 1152087, White, false, false);
                AddHtmlObject(190, 305, 250, 20, RunicReforging.GetName((int)m_Prefix), LightGreen, false, false);
            }

            if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
            {
                AddButton(15, 330, 4005, 4007, 2, GumpButtonType.Reply, 0);
                AddHtmlObject(55, 330, 250, 20, 1152088, White, false, false);
                AddHtmlObject(190, 330, 250, 20, RunicReforging.GetName((int)m_Suffix), LightGreen, false, false);
            }

            AddHtmlObject(30, 360, 200, 20, 1152078, LightGreen, false, false); // CHARGES NEEDED:
            AddHtmlObject(160, 360, 50, 20, totalCharges.ToString(), LightGreen, false, false);

            AddHtmlObject(45, 380, 200, 20, 1152077, LightGreen, false, false); // TOOL CHARGES:
            AddHtmlObject(160, 380, 50, 20, m_Tool.UsesRemaining.ToString(), LightGreen, false, false);

            AddButton(15, 410, 4017, 4018, 0, GumpButtonType.Reply, 0);
            AddHtmlObject(55, 410, 200, 20, "CLOSE", White, false, false);

            AddButton(330, 360, 4014, 4016, 3, GumpButtonType.Reply, 0);
            AddHtmlObject(230, 360, 200, 20, 1152080, White, false, false); // REFORGE ITEM

            AddButton(330, 410, 4011, 4013, 4, GumpButtonType.Reply, 0);
            AddHtmlObject(290, 410, 100, 20, "HELP", White, false, false);
        }
示例#18
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 0: break;

            case 1:     // prefix
                from.SendGump(new ItemNameGump(m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix, true));
                break;

            case 2:     // suffix
                from.SendGump(new ItemNameGump(m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix, false));
                break;

            case 3:     // Reforge Item
            {
                if (!RunicReforging.CanReforge(from, m_ToReforge, m_Tool.CraftSystem))
                {
                    return;
                }

                int totalCharges = GetTotalCharges();

                if (m_Tool.UsesRemaining >= totalCharges)
                {
                    CraftResourceInfo resInfo = CraftResources.GetInfo(m_Tool.Resource);

                    if (resInfo == null)
                    {
                        return;
                    }

                    CraftAttributeInfo attrs = resInfo.AttributeInfo;
                    int budget = GetBudget();

                    int min = 10;
                    int max = 40;

                    if (attrs != null)
                    {
                        min = attrs.RunicMinIntensity;
                        max = attrs.RunicMaxIntensity;
                    }

                    if (min < 10)
                    {
                        min = 10;
                    }
                    if (max > 100)
                    {
                        max = 100;
                    }

                    if (m_Prefix == ReforgedPrefix.None && (m_Options & ReforgingOption.GrandArtifice) != 0)
                    {
                        m_Prefix = RunicReforging.ChooseRandomPrefix(m_ToReforge);
                        budget   = Math.Min(800, budget + 50);
                    }

                    if (m_Suffix == ReforgedSuffix.None && (m_Options & ReforgingOption.ExaltedArtifice) != 0)
                    {
                        m_Suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, m_Prefix);
                        budget   = Math.Min(800, budget + 50);
                    }

                    int maxprops;

                    if (attrs != null)
                    {
                        maxprops = Utility.RandomMinMax(attrs.RunicMinAttributes, attrs.RunicMaxAttributes);
                    }
                    else
                    {
                        maxprops = Math.Min(5, (budget / 110) + 1);
                    }

                    if (maxprops == 5 && 0.25 > Utility.RandomDouble())
                    {
                        maxprops = 6;
                    }

                    if (maxprops == 6 && budget >= 650 && 0.10 > Utility.RandomDouble())
                    {
                        maxprops = 7;
                    }

                    RunicReforging.ApplyReforgedProperties(m_ToReforge, m_Prefix, m_Suffix, true, budget, min, max, maxprops, 0, m_Tool, m_Options);

                    OnAfterReforged(m_ToReforge);
                    from.SendLocalizedMessage(1152286);         // You re-forge the item!
                    m_Tool.UsesRemaining -= totalCharges;

                    if (m_Tool != null && m_Tool.CraftSystem != null)
                    {
                        m_Tool.CraftSystem.PlayCraftEffect(from);
                    }

                    if (m_Tool.UsesRemaining <= 0)
                    {
                        m_Tool.Delete();
                        from.SendLocalizedMessage(1044038);         // You have worn out your tool!
                    }
                }

                break;
            }

            case 4:
                from.SendGump(new ReforgingHelpGump());
                break;

            default:     // Option
            {
                ReforgingOption option = Options[info.ButtonID - 100];

                if (HasMetPrerequisite(option))
                {
                    if ((m_Options & option) == 0)
                    {
                        m_Options |= option;
                    }
                    else
                    {
                        m_Options ^= option;
                        InvalidatePrerequisite(option);
                    }
                }

                from.SendGump(new RunicReforgingGump(from, m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix));
                break;
            }
            }
        }
示例#19
0
文件: Gumps.cs 项目: Crome696/ServUO
            public ItemNameGump(Item toreforge, BaseRunicTool tool, ReforgingOption options, ReforgedPrefix prefix, ReforgedSuffix suffix, bool isprefix)
                : base(25, 25)
            {
                m_Tool = tool;
                m_ToReforge = toreforge;
                m_Options = options;
                m_Prefix = prefix;
                m_Suffix = suffix;
                m_IsPrefix = isprefix;

                AddBackground(0, 0, 376, 445, 83);

                AddHtmlObject(72, 10, 250, 100, 1152089, DarkGreen, false, false);

                int buttonID = 4005;
                int buttonHue = White;
                int y = 50;

                foreach (int i in Enum.GetValues(typeof(ReforgedPrefix)))
                {
                    if ((isprefix && prefix == (ReforgedPrefix)i) || (!isprefix && suffix == (ReforgedSuffix)i))
                    {
                        buttonID = 4006;
                        buttonHue = LightGreen;
                    }
                    else
                    {
                        buttonID = 4005;
                        buttonHue = White;
                    }

                    if(HasSelection(i, toreforge, tool))
                    {
                        AddButton(15, y, buttonID, buttonID, 100 + i, GumpButtonType.Reply, 0);
                        AddHtmlObject(55, y, 250, 20, RunicReforging.GetName(i), buttonHue, false, false);
                    }

                    y += 25;
                }

                AddHtmlObject(55, 410, 100, 20, "CLOSE", White, false, false);
                AddButton(15, 410, 4017, 4019, 0, GumpButtonType.Reply, 0);
            }
示例#20
0
文件: Gumps.cs 项目: Crome696/ServUO
        private bool CanReforge(Mobile from, ReforgingOption option)
        {
            double skill = from.Skills[SkillName.Imbuing].Value;

            switch (option)
            {
                default:
                case ReforgingOption.None:
                case ReforgingOption.Powerful: return skill >= 65.0;
                case ReforgingOption.Structural:
                case ReforgingOption.Fortified: return skill >= 85.0;
                case ReforgingOption.Fundamental:
                case ReforgingOption.Integral: return skill >= 97.0;
                case ReforgingOption.GrandArtifice:
                case ReforgingOption.InspiredArtifice: return skill >= 100.1;
                case ReforgingOption.ExaltedArtifice:
                case ReforgingOption.SublimeArtifice: return skill >= 110.1;
            }
        }
示例#21
0
        private static int CalculateMinIntensity(int perclow, int perchi, ReforgingOption option)
        {
            if (option == ReforgingOption.None)
                return perclow;

            return perclow + (int)((double)(perchi - perclow) * ((double)(GetPrerequisiteIndex(option) * 5.0) / 100.0));
        }
示例#22
0
文件: Gumps.cs 项目: Evad-lab/ServUOX
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!BaseTool.CheckAccessible(m_Tool, from, true))
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 0: break;

            case 1:     // prefix
                from.SendGump(new ItemNameGump(m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix, true));
                break;

            case 2:     // suffix
                from.SendGump(new ItemNameGump(m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix, false));
                break;

            case 3:     // Reforge Item
            {
                if (!RunicReforging.CanReforge(from, m_ToReforge, m_Tool.CraftSystem))
                {
                    return;
                }

                int totalCharges = GetTotalCharges();

                if (m_Tool.UsesRemaining >= totalCharges)
                {
                    CraftResourceInfo resInfo = CraftResources.GetInfo(m_Tool.Resource);

                    if (resInfo == null)
                    {
                        return;
                    }

                    CraftAttributeInfo attrs = resInfo.AttributeInfo;

                    int min = 10;
                    int max = 80;

                    if (min < 10)
                    {
                        min = 10;
                    }
                    if (max > 100)
                    {
                        max = 100;
                    }

                    int budget = GetBudget();

                    ReforgedPrefix prefix = ReforgedPrefix.None;
                    ReforgedSuffix suffix = ReforgedSuffix.None;

                    if ((m_Options & ReforgingOption.GrandArtifice) != 0)
                    {
                        // choosing name 1
                        if ((m_Options & ReforgingOption.InspiredArtifice) != 0)
                        {
                            prefix = m_Prefix;

                            if (prefix == ReforgedPrefix.None)
                            {
                                from.SendLocalizedMessage(1152287);         // Re-forging failed. You did not choose a name! Please try again.
                                return;
                            }
                        }
                        else
                        {
                            // Not choosing name 1 or 2
                            if ((m_Options & ReforgingOption.SublimeArtifice) == 0)
                            {
                                // random prefix AND suffix
                                if ((m_Options & ReforgingOption.ExaltedArtifice) != 0)
                                {
                                    prefix = RunicReforging.ChooseRandomPrefix(m_ToReforge, budget);
                                    suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, budget, m_Prefix);
                                }
                                else         // random prefix OR suffix
                                {
                                    if (0.5 > Utility.RandomDouble())
                                    {
                                        prefix = RunicReforging.ChooseRandomPrefix(m_ToReforge, budget);
                                    }
                                    else
                                    {
                                        suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, budget, m_Prefix);
                                    }
                                }
                            }
                        }
                    }

                    if ((m_Options & ReforgingOption.ExaltedArtifice) != 0)
                    {
                        if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
                        {
                            suffix = m_Suffix;

                            if (suffix == ReforgedSuffix.None)
                            {
                                from.SendLocalizedMessage(1152287);         // Re-forging failed. You did not choose a name! Please try again.
                                return;
                            }
                        }
                        else
                        {
                            suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, budget, m_Prefix);
                            budget = Math.Min(800, budget + 50);
                        }
                    }

                    // 50% chance to switch prefix/suffix around
                    if ((prefix != ReforgedPrefix.None || suffix != ReforgedSuffix.None) && 0.5 > Utility.RandomDouble())
                    {
                        int pre = (int)prefix;
                        int suf = (int)suffix;

                        prefix = (ReforgedPrefix)suf;
                        suffix = (ReforgedSuffix)pre;
                    }

                    RunicReforging.ApplyReforgedProperties(m_ToReforge, prefix, suffix, budget, min, max, RunicReforging.GetPropertyCount(m_Tool), 0, m_Tool, m_Options);

                    OnAfterReforged(m_ToReforge);
                    from.SendLocalizedMessage(1152286);         // You re-forge the item!

                    from.PlaySound(0x665);

                    m_Tool.UsesRemaining -= totalCharges;

                    if (m_Tool.UsesRemaining <= 0)
                    {
                        m_Tool.Delete();
                        from.SendLocalizedMessage(1044038);         // You have worn out your tool!
                    }
                }

                break;
            }

            case 4:
                from.SendGump(new ReforgingHelpGump());
                break;

            default:     // Option
            {
                ReforgingOption option = Options[info.ButtonID - 100];

                if (HasMetPrerequisite(option))
                {
                    if ((m_Options & option) == 0)
                    {
                        m_Options |= option;

                        if (m_Prefix != ReforgedPrefix.None && !RunicReforging.HasSelection((int)m_Prefix, m_ToReforge, m_Tool, m_Options, -1, -1))
                        {
                            m_Prefix         = ReforgedPrefix.None;
                            m_Context.Prefix = ReforgedPrefix.None;
                        }

                        if (m_Suffix != ReforgedSuffix.None && !RunicReforging.HasSelection((int)m_Suffix, m_ToReforge, m_Tool, m_Options, -1, -1))
                        {
                            m_Suffix         = ReforgedSuffix.None;
                            m_Context.Suffix = ReforgedSuffix.None;
                        }
                    }
                    else
                    {
                        m_Options ^= option;
                        InvalidatePrerequisite(option);
                    }

                    m_Context.Contexts[m_Tool] = m_Options;
                }

                from.SendGump(new RunicReforgingGump(from, m_ToReforge, m_Tool));
                break;
            }
            }
        }
示例#23
0
文件: Gumps.cs 项目: Crome696/ServUO
        public RunicReforgingGump(Mobile from, Item toReforge, BaseRunicTool tool, ReforgingOption options, ReforgedPrefix prefix, ReforgedSuffix suffix)
            : base(25, 25)
        {
            m_Tool = tool;
            m_ToReforge = toReforge;
            m_Options = options;
            m_Prefix = prefix;
            m_Suffix = suffix;

            AddBackground(0, 0, 374, 444, 83);

            AddHtmlObject(120, 13, 200, 20, 1151952, DarkGreen, false, false); // Runic Crafting Options

            int buttonHue = White;
            int buttonID = 0x4005;
            int y = 40;
            int idx = 0;

            for(int i = 0; i < Options.Length; i++)
            {
                ReforgingOption option = Options[i];

                if ((m_Options & option) != 0)
                {
                    if (CanReforge(from, option) && HasMetPrerequisite(option))
                    {
                        buttonHue = LightGreen;
                        buttonID = 4006;
                    }
                    else
                    {
                        buttonHue = Orange;
                        buttonID = 4006;
                    }
                }
                else
                {
                    if (CanReforge(from, option) && HasMetPrerequisite(option))
                    {
                        buttonHue = White;
                        buttonID = 4005;
                    }
                    else
                    {
                        buttonHue = Orange;
                        buttonID = 4006;
                    }
                }

                if(HasMetPrerequisite(option) && CanReforge(from, option))
                    AddButton(15, y, buttonID, buttonID, i + 100, GumpButtonType.Reply, 0);

                AddHtmlObject(55, y, 250, 20, GetCliloc(option), buttonHue, false, false);

                y += 25;
                idx++;
            }

            int totalCharges = GetTotalCharges();

            if ((m_Options & ReforgingOption.InspiredArtifice) != 0)
            {
                AddButton(15, 305, 4005, 4007, 1, GumpButtonType.Reply, 0);
                AddHtmlObject(55, 305, 250, 20, 1152087, White, false, false);
                AddHtmlObject(190, 305, 250, 20, RunicReforging.GetName((int)m_Prefix), LightGreen, false, false);
            }

            if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
            {
                AddButton(15, 330, 4005, 4007, 2, GumpButtonType.Reply, 0);
                AddHtmlObject(55, 330, 250, 20, 1152088, White, false, false);
                AddHtmlObject(190, 330, 250, 20, RunicReforging.GetName((int)m_Suffix), LightGreen, false, false);
            }

            AddHtmlObject(30, 360, 200, 20, 1152078, LightGreen, false, false); // CHARGES NEEDED:
            AddHtmlObject(160, 360, 50, 20, totalCharges.ToString(), LightGreen, false, false);

            AddHtmlObject(45, 380, 200, 20, 1152077, LightGreen, false, false); // TOOL CHARGES:
            AddHtmlObject(160, 380, 50, 20, m_Tool.UsesRemaining.ToString(), LightGreen, false, false);

            AddButton(15, 410, 4017, 4018, 0, GumpButtonType.Reply, 0);
            AddHtmlObject(55, 410, 200, 20, "CLOSE", White, false, false);

            AddButton(330, 360, 4014, 4016, 3, GumpButtonType.Reply, 0);
            AddHtmlObject(230, 360, 200, 20, 1152080, White, false, false); // REFORGE ITEM

            AddButton(330, 410, 4011, 4013, 4, GumpButtonType.Reply, 0);
            AddHtmlObject(290, 410, 100, 20, "HELP", White, false, false);
        }
示例#24
0
        public static void ApplyReforgedProperties(Item item, ReforgedPrefix prefix, ReforgedSuffix suffix, bool playermade, int budget, int perclow, int perchigh, int maxmods, int luckchance, BaseRunicTool tool = null, ReforgingOption option = ReforgingOption.None)
        {
            if (prefix == ReforgedPrefix.None && suffix == ReforgedSuffix.None)
            {
                for (int i = 0; i < maxmods; i++)
                    ApplyRunicAttributes(item, perclow, perchigh, ref budget, i, luckchance);
                ApplyItemPower(item, playermade);
            }
            else
            {
                int prefixID = (int)prefix;
                int suffixID = (int)suffix;

                int index = GetCollectionIndex(item);
                int resIndex = -1;
                int preIndex = -1;

                if (tool != null)
                {
                    resIndex = GetResourceIndex(tool.Resource);
                    preIndex = GetPrerequisiteIndex(option);
                }

                if (index == -1)
                    return;

                List<NamedInfoCol> prefixCol = null;
                List<NamedInfoCol> suffixCol = null;

                if (prefix != ReforgedPrefix.None)
                {
                    try
                    {
                        prefixCol = new List<NamedInfoCol>();
                        prefixCol.AddRange(m_PrefixSuffixInfo[prefixID][index]);
                    }
                    catch
                    {
                        Console.WriteLine("Error: Prefix not in collection: {0}", prefixID);
                    }
                }

                if (suffix != ReforgedSuffix.None)
                {
                    if (suffixCol == null)
                        suffixCol = new List<NamedInfoCol>();

                    try
                    {
                        suffixCol.AddRange(m_PrefixSuffixInfo[suffixID][index]);
                    }
                    catch
                    {
                        Console.WriteLine("Error: Suffix not in collection: {0}", suffixID);
                    }
                }

                //Removes things like blood drinking/balanced/splintering
                CheckAttributes(item, prefixCol, playermade);
                CheckAttributes(item, suffixCol, playermade);

                int i = 0;
                int mods = 0;
                bool addedprefix = false;
                bool addedsuffix = false;

                int moddedPercLow = CalculateMinIntensity(perclow, perchigh, option);
                int moddedPercHigh = perchigh;

                if (prefix != ReforgedPrefix.None && suffix == ReforgedSuffix.None && prefixCol != null)
                {
                    int specialAdd = GetModsPer(index, prefixID, maxmods, false);

                    while (budget > 25 && mods < maxmods && i < 25)
                    {
                        if (prefixCol.Count > 0 && specialAdd > 0)
                        {
                            int random = Utility.Random(prefixCol.Count);
                            if (ApplyAttribute(item, prefixCol[random].Attribute, prefixCol[random].Min(resIndex, preIndex, item), prefixCol[random].Max(resIndex, preIndex, item), moddedPercLow, moddedPercHigh, ref budget, luckchance))
                            {
                                addedprefix = true;
                                specialAdd--;
                                mods++;
                            }

                            prefixCol.RemoveAt(random);
                        }
                        else if (ApplyRunicAttributes(item, perclow, perchigh, ref budget, i, luckchance))
                            mods++;

                        i++;
                    }

                    if (addedprefix)
                        ApplyPrefixName(item, prefix);
                }
                else if (prefix == ReforgedPrefix.None && suffix != ReforgedSuffix.None && suffixCol != null)
                {
                    int specialAdd = GetModsPer(index, suffixID, maxmods, false);

                    while (budget > 25 && mods < maxmods && i < 25)
                    {
                        if (suffixCol.Count > 0 && specialAdd > 0)
                        {
                            int random = Utility.Random(suffixCol.Count);
                            if (ApplyAttribute(item, suffixCol[random].Attribute, suffixCol[random].Min(resIndex, preIndex, item), suffixCol[random].Max(resIndex, preIndex, item), moddedPercLow, moddedPercHigh, ref budget, luckchance))
                            {
                                addedsuffix = true;
                                specialAdd--;
                                mods++;
                            }

                            suffixCol.RemoveAt(random);
                        }
                        else if (ApplyRunicAttributes(item, perclow, perchigh, ref budget, i, luckchance))
                            mods++;

                        i++;
                    }

                    if (addedsuffix)
                        ApplySuffixName(item, suffix);
                }
                else if (prefix != ReforgedPrefix.None && suffix != ReforgedSuffix.None && prefixCol != null && suffixCol != null)
                {
                    int specialAddPrefix = GetModsPer(index, prefixID, maxmods, true);
                    int specialAddSuffix = GetModsPer(index, suffixID, maxmods, true);

                    while (budget > 25 && mods < maxmods && i < 25)
                    {
                        if (prefixCol.Count > 0 && specialAddPrefix > 0)
                        {
                            int random = Utility.Random(prefixCol.Count);
                            if (ApplyAttribute(item, prefixCol[random].Attribute, prefixCol[random].Min(resIndex, preIndex, item), prefixCol[random].Max(resIndex, preIndex, item), moddedPercLow, moddedPercHigh, ref budget, luckchance))
                            {
                                addedprefix = true;
                                specialAddPrefix--;
                                mods++;
                            }

                            prefixCol.RemoveAt(random);
                        }
                        else if (suffixCol.Count > 0 && specialAddSuffix > 0)
                        {
                            int random = Utility.Random(suffixCol.Count);
                            if (ApplyAttribute(item, suffixCol[random].Attribute, suffixCol[random].Min(resIndex, preIndex, item), suffixCol[random].Max(resIndex, preIndex, item), moddedPercLow, moddedPercHigh, ref budget, luckchance))
                            {
                                addedsuffix = true;
                                specialAddSuffix--;
                                mods++;
                            }

                            suffixCol.RemoveAt(random);
                        }
                        else if (ApplyRunicAttributes(item, perclow, perchigh, ref budget, i, luckchance))
                            mods++;

                        i++;
                    }

                    if (addedprefix)
                        ApplyPrefixName(item, prefix);

                    if (addedsuffix)
                        ApplySuffixName(item, suffix);
                }

                ApplyItemPower(item, playermade);
            }
        }
示例#25
0
文件: Gumps.cs 项目: Crome696/ServUO
 private bool HasMetPrerequisite(ReforgingOption option)
 {
     switch (option)
     {
         case ReforgingOption.None: return true;
         case ReforgingOption.Powerful: return true;
         case ReforgingOption.Structural: return true;
         case ReforgingOption.Fortified: return (m_Options & ReforgingOption.Structural) != 0;
         case ReforgingOption.Fundamental: return true;
         case ReforgingOption.Integral: return (m_Options & ReforgingOption.Fundamental) != 0;
         case ReforgingOption.GrandArtifice: return true;
         case ReforgingOption.InspiredArtifice: return (m_Options & ReforgingOption.GrandArtifice) != 0;
         case ReforgingOption.ExaltedArtifice: return (m_Options & ReforgingOption.GrandArtifice) != 0;
         case ReforgingOption.SublimeArtifice: return (m_Options & ReforgingOption.ExaltedArtifice) != 0 && (m_Options & ReforgingOption.GrandArtifice) != 0;
     }
     return true;
 }