Exemple #1
0
 public int GetCostFor(Item item)
 {
     return((int)((double)Imbuing.GetTotalWeight(item, -1, false, true) * 2.18));
 }
Exemple #2
0
            protected override void OnTarget(Mobile from, object o)
            {
                Item   item = o as Item;
                Mobile m    = o as Mobile;

                if (item == null && m == null)
                {
                    from.SendLocalizedMessage(500353); // You are not certain...
                    return;
                }

                if (!from.CheckTargetSkill(SkillName.ItemID, o, 0, 100))
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1041352, from.NetState); // You have no idea how much it might be worth.
                    return;
                }

                if (m != null)
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1041349, AffixType.Append, "  " + m.Name, "", from.NetState); // It appears to be:
                    return;
                }

                if (item.Name != null)
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, false, item.Name, from.NetState);
                    item.PrivateOverheadMessage(MessageType.Label, 0x3B2, false, item.Name, from.NetState);
                }
                else
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, item.LabelNumber, from.NetState);
                    item.PrivateOverheadMessage(MessageType.Label, 0x3B2, item.LabelNumber, from.NetState);
                }

                if (item is Meteorite)
                {
                    if (((Meteorite)item).Polished)
                    {
                        from.SendLocalizedMessage(1158697); // The brilliance of the meteorite shimmers in the light as you rotate it in your hands! Brightly hued veins of exotic minerals reflect against the polished surface. You think to yourself you have never seen anything so full of splendor!
                    }
                    else
                    {
                        from.SendLocalizedMessage(1158696); // The rock seems to be otherwordly. Judging by the pitting and charring, it appears to have crash landed here from the sky! The rock feels surprisingly dense given its size. Perhaps if you polished it with an oil cloth you may discover what is inside...
                    }

                    return;
                }

                from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1041351, AffixType.Append, "  " + GetPriceFor(item).ToString(), "", from.NetState); // You guess the value of that item at:

                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                {
                    if (Imbuing.TimesImbued(item) > 0)
                    {
                        from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111877, from.NetState); // You conclude that item cannot be magically unraveled. The magic in that item has been weakened due to either low durability or the imbuing process.
                    }
                    else
                    {
                        int    weight    = Imbuing.GetTotalWeight(item, -1, false, true);
                        string imbIngred = null;
                        double skill     = from.Skills[SkillName.Imbuing].Base;
                        bool   badSkill  = false;

                        if (!Imbuing.CanUnravelItem(from, item, false))
                        {
                            weight = 0;
                        }

                        if (weight > 0 && weight <= 200)
                        {
                            imbIngred = "Magical Residue";
                        }
                        else if (weight > 200 && weight < 480)
                        {
                            imbIngred = "Enchanted Essence";

                            if (skill < 45.0)
                            {
                                badSkill = true;
                            }
                        }
                        else if (weight >= 480)
                        {
                            imbIngred = "Relic Fragment";

                            if (skill < 95.0)
                            {
                                badSkill = true;
                            }
                        }

                        if (imbIngred != null)
                        {
                            if (badSkill)
                            {
                                from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111875, from.NetState); // Your Imbuing skill is not high enough to identify the imbuing ingredient.
                            }
                            else
                            {
                                from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111874, imbIngred, from.NetState); //You conclude that item will magically unravel into: ~1_ingredient~
                            }
                        }
                        else  // Cannot be Unravelled
                        {
                            from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111876, from.NetState); //You conclude that item cannot be magically unraveled. It appears to possess little to no magic.
                        }
                    }
                }
                else
                {
                    from.LocalOverheadMessage(MessageType.Emote, 0x3B2, 1111878); //You conclude that item cannot be magically unraveled.
                }
            }
Exemple #3
0
        private void DoRestock(bool wipe)
        {
            int count;

            if (Backpack == null)
            {
                var pack = new BuyBackpack();

                AddItem(pack);
            }

            if (wipe)
            {
                count = ItemCount;
                ColUtility.SafeDelete(Backpack.Items);
            }
            else
            {
                count = ItemCount - Backpack.Items.Count;
            }

            if (count > 0)
            {
                for (var i = 0; i < count; i++)
                {
                    Item item;

                    switch (Utility.Random(3))
                    {
                    default:
                    case 0: item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(false, false, true); break;

                    case 1: item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(false, true, false); break;

                    case 2: item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(true, false, false); break;
                    }

                    var  failSafe = 0;
                    bool success  = true;

                    do
                    {
                        RunicReforging.GenerateRandomItem(item, null, Utility.RandomMinMax(MinBudget, MaxBudget), 0, ReforgedPrefix.None, ReforgedSuffix.None);

                        if (++failSafe == 25 && Imbuing.GetTotalWeight(item, -1, false, true) == 0)
                        {
                            item.Delete();
                            success = false;
                            i--;
                            break;
                        }
                    }while (Imbuing.GetTotalWeight(item, -1, false, true) == 0);

                    if (success)
                    {
                        item.Movable = false;
                        PackItem(item);
                    }
                }
            }
        }
        public static int GetPointsForEquipment(Item item)
        {
            if (item is IEpiphanyArmor)
            {
                return(1000);
            }

            foreach (CraftSystem system in CraftSystem.Systems)
            {
                CraftItem crItem = null;

                if (system != null && system.CraftItems != null)
                {
                    var type = item.GetType();

                    if (type == typeof(SilverRing))
                    {
                        type = typeof(GoldRing);
                    }
                    else if (type == typeof(SilverBracelet))
                    {
                        type = typeof(GoldBracelet);
                    }

                    crItem = system.CraftItems.SearchFor(type);

                    if (crItem != null && crItem.Resources != null)
                    {
                        CraftRes craftRes = crItem.Resources.GetAt(0);
                        double   amount   = 1;

                        if (craftRes != null)
                        {
                            amount = craftRes.Amount;
                        }

                        double award = 1;

                        if (item is IResource)
                        {
                            switch (((IResource)item).Resource)
                            {
                            default: award = amount * .1; break;

                            case CraftResource.DullCopper: award = amount * .47; break;

                            case CraftResource.ShadowIron: award = amount * .73; break;

                            case CraftResource.Copper: award = amount * 1.0; break;

                            case CraftResource.Bronze: award = amount * 1.47; break;

                            case CraftResource.Gold: award = amount * 2.5; break;

                            case CraftResource.Agapite: award = amount * 5.0; break;

                            case CraftResource.Verite: award = amount * 8.5; break;

                            case CraftResource.Valorite: award = amount * 10; break;

                            case CraftResource.SpinedLeather: award = amount * 0.5; break;

                            case CraftResource.HornedLeather: award = amount * 1.0; break;

                            case CraftResource.BarbedLeather: award = amount * 2.0; break;

                            case CraftResource.OakWood: award = amount * .17; break;

                            case CraftResource.AshWood: award = amount * .33; break;

                            case CraftResource.YewWood: award = amount * .67; break;

                            case CraftResource.Heartwood: award = amount * 1.0; break;

                            case CraftResource.Bloodwood: award = amount * 2.17; break;

                            case CraftResource.Frostwood: award = amount * 3.17; break;
                            }
                        }

                        var weight = Imbuing.GetTotalWeight(item, -1, false, true);

                        if (weight > 0)
                        {
                            award += weight / 30;
                        }

                        return((int)award);
                    }
                }
            }

            return(0);
        }
Exemple #5
0
        public ImbuingGumpC(Mobile from, Item item, int mod, int value) : base(520, 340)
        {
            PlayerMobile m = from as PlayerMobile;

            from.CloseGump(typeof(ImbuingGump));
            from.CloseGump(typeof(ImbuingGumpB));

            // SoulForge Check
            if (!Imbuing.CheckSoulForge(from, 1))
            {
                return;
            }

            ImbuingContext context = Imbuing.GetContext(m);

            // = Check Type of Ingredients Needed
            if (!Imbuing.Table.ContainsKey(mod))
            {
                return;
            }

            m_Definition = Imbuing.Table[mod];

            if (value == -1)
            {
                value = m_Definition.IncAmount;
            }

            m_Item  = item;
            m_Mod   = mod;
            m_Value = value;

            int maxInt = GetMaxIntensity(item, m_Definition);
            int inc    = m_Definition.IncAmount;
            int weight = m_Definition.Weight;

            if (m_Item is BaseJewel && m_Mod == 12)
            {
                maxInt /= 2;
            }

            if (m_Value < inc)
            {
                m_Value = inc;
            }
            if (m_Value > maxInt)
            {
                m_Value = maxInt;
            }

            if (m_Value <= 0)
            {
                m_Value = 1;
            }

            double currentIntensity = Math.Floor((m_Value / (double)maxInt) * 100);

            //Set context
            context.LastImbued     = item;
            context.Imbue_Mod      = mod;
            context.Imbue_ModVal   = weight;
            context.ImbMenu_ModInc = inc;
            context.Imbue_ModInt   = value;

            // - Current Mod Weight
            m_TotalItemWeight = Imbuing.GetTotalWeight(m_Item, m_Mod);
            m_TotalProps      = Imbuing.GetTotalMods(m_Item, m_Mod);

            if (maxInt <= 1)
            {
                currentIntensity = 100;
            }

            m_PropWeight = (int)Math.Floor(((double)weight / (double)maxInt) * m_Value);

            // - Maximum allowed Property Weight & Item Mod Count
            m_MaxWeight = Imbuing.GetMaxWeight(m_Item);

            // = Times Item has been Imbued
            int timesImbued = 0;

            if (m_Item is BaseWeapon)
            {
                timesImbued = ((BaseWeapon)m_Item).TimesImbued;
            }
            if (m_Item is BaseArmor)
            {
                timesImbued = ((BaseArmor)m_Item).TimesImbued;
            }
            if (m_Item is BaseJewel)
            {
                timesImbued = ((BaseJewel)m_Item).TimesImbued;
            }
            if (m_Item is BaseHat)
            {
                timesImbued = ((BaseHat)m_Item).TimesImbued;
            }

            // = Check Ingredients needed at the current Intensity
            m_GemAmount     = Imbuing.GetGemAmount(m_Item, m_Mod, m_Value);
            m_PrimResAmount = Imbuing.GetPrimaryAmount(m_Item, m_Mod, m_Value);
            m_SpecResAmount = Imbuing.GetSpecialAmount(m_Item, m_Mod, m_Value);

            // ------------------------------ Gump Menu -------------------------------------------------------------
            AddPage(0);
            AddBackground(0, 0, 540, 450, 5054);
            AddImageTiled(10, 10, 520, 430, 2624);

            AddImageTiled(10, 35, 520, 10, 5058);
            AddImageTiled(260, 45, 15, 290, 5058);
            AddImageTiled(10, 185, 520, 10, 5058);
            AddImageTiled(10, 335, 520, 10, 5058);
            AddImageTiled(10, 405, 520, 10, 5058);

            AddAlphaRegion(10, 10, 520, 430);

            AddHtmlLocalized(10, 13, 520, 18, 1079717, LabelColor, false, false); //<CENTER>IMBUING CONFIRMATION</CENTER>
            AddHtmlLocalized(57, 49, 200, 18, 1114269, LabelColor, false, false); //PROPERTY INFORMATION

            // - Attribute to Imbue
            AddHtmlLocalized(30, 80, 80, 17, 1114270, LabelColor, false, false);  //Property:
            AddHtmlLocalized(100, 80, 150, 17, m_Definition.AttributeName, LabelColor, false, false);

            // - Weight Modifier
            AddHtmlLocalized(30, 120, 80, 17, 1114272, 0xFFFFFF, false, false);   //Weight:

            double w = (double)m_Definition.Weight / 100.0;

            AddHtml(90, 120, 80, 17, String.Format("<BASEFONT COLOR=#CCCCFF> {0}x", w), false, false);

            AddHtmlLocalized(30, 140, 80, 17, 1114273, LabelColor, false, false);   //Intensity:
            AddHtml(90, 140, 80, 17, String.Format("<BASEFONT COLOR=#CCCCFF> {0}%", currentIntensity), false, false);

            // - Materials needed
            AddHtmlLocalized(10, 199, 255, 18, 1044055, LabelColor, false, false); //<CENTER>MATERIALS</CENTER>
            AddHtmlLocalized(40, 230, 180, 17, m_Definition.PrimaryName, LabelColor, false, false);
            AddHtml(210, 230, 40, 17, String.Format("<BASEFONT COLOR=#CCCCFF> {0}", m_PrimResAmount.ToString()), false, false);
            AddHtmlLocalized(40, 255, 180, 17, m_Definition.GemName, LabelColor, false, false);
            AddHtml(210, 255, 40, 17, String.Format("<BASEFONT COLOR=#CCCCFF> {0}", m_GemAmount.ToString()), false, false);
            if (m_SpecResAmount > 0)
            {
                AddHtmlLocalized(40, 280, 180, 17, m_Definition.SpecialName, LabelColor, false, false);
                AddHtml(210, 280, 40, 17, String.Format("<BASEFONT COLOR=#CCCCFF> {0}", m_SpecResAmount.ToString()), false, false);
            }

            // - Mod Description
            AddHtmlLocalized(290, 65, 215, 110, m_Definition.Description, LabelColor, false, false);

            AddHtmlLocalized(365, 199, 150, 18, 1113650, LabelColor, false, false); //RESULTS

            AddHtmlLocalized(288, 220, 150, 17, 1113645, LabelColor, false, false); //Properties:
            AddHtml(443, 220, 80, 17, String.Format("<BASEFONT COLOR=#CCFFCC> {0}/5", m_TotalProps + 1), false, false);
            AddHtmlLocalized(288, 240, 150, 17, 1113646, LabelColor, false, false); //Total Property Weight:
            AddHtml(443, 240, 80, 17, String.Format("<BASEFONT COLOR=#CCFFCC> {0}/{1}", m_TotalItemWeight + (int)m_PropWeight, m_MaxWeight), false, false);

            // - Times Imbued
            AddHtmlLocalized(288, 260, 150, 17, 1113647, LabelColor, false, false);                                   //Times Imbued:
            AddHtml(443, 260, 80, 17, String.Format("<BASEFONT COLOR=#CCFFCC> {0}/20", timesImbued + 1), false, false);

            // - Name of Attribute to be Replaced
            int replace = WhatReplacesWhat(m_Mod, m_Item);

            AddHtmlLocalized(30, 100, 80, 17, 1114271, LabelColor, false, false);
            if (replace <= 0)
            {
                replace = m_Definition.AttributeName;
            }

            AddHtmlLocalized(100, 100, 150, 17, replace, LabelColor, false, false);

            // ===== CALCULATE DIFFICULTY =====
            double dif;
            double suc = Imbuing.GetSuccessChance(from, item, m_TotalItemWeight, m_PropWeight, out dif);

            int    Succ = Convert.ToInt32(suc);
            string color;

            // = Imbuing Success Chance %
            AddHtmlLocalized(305, 300, 150, 17, 1044057, 0xFFFFFF, false, false);
            if (Succ <= 1)
            {
                color = "#FF5511";
            }
            else if (Succ > 1 && Succ < 10)
            {
                color = "#EE6611";
            }
            else if (Succ >= 10 && Succ < 20)
            {
                color = "#DD7711";
            }
            else if (Succ >= 20 && Succ < 30)
            {
                color = "#CC8811";
            }
            else if (Succ >= 30 && Succ < 40)
            {
                color = "#BB9911";
            }
            else if (Succ >= 40 && Succ < 50)
            {
                color = "#AAAA11";
            }
            else if (Succ >= 50 && Succ < 60)
            {
                color = "#99BB11";
            }
            else if (Succ >= 60 && Succ < 70)
            {
                color = "#88CC11";
            }
            else if (Succ >= 70 && Succ < 80)
            {
                color = "#77DD11";
            }
            else if (Succ >= 80 && Succ < 90)
            {
                color = "#66EE11";
            }
            else if (Succ >= 90 && Succ < 100)
            {
                color = "#55FF11";
            }
            else if (Succ >= 100)
            {
                color = "#01FF01";
            }
            else
            {
                color = "#FFFFFF";
            }

            if (suc > 100)
            {
                suc = 100;
            }
            if (suc < 0)
            {
                suc = 0;
            }

            AddHtml(430, 300, 80, 17, String.Format("<BASEFONT COLOR={0}>\t{1}%", color, suc), false, false);

            // - Attribute Level
            if (maxInt > 1)
            {
                // - Set Intesity to Minimum
                if (m_Value <= 0)
                {
                    m_Value = 1;
                }

                // = New Value:
                AddHtmlLocalized(245, 350, 100, 17, 1062300, LabelColor, false, false);
                // - Mage Weapon Value ( i.e [Mage Weapon -25] )
                if (m_Mod == 41)
                {
                    AddHtml(254, 374, 50, 17, String.Format("<BASEFONT COLOR=#CCCCFF> -{0}", 30 - m_Value), false, false);
                }
                // - Show Property Value as % ( i.e [Hit Fireball 25%] )
                else if (maxInt <= 8 || m_Mod == 21 || m_Mod == 17)
                {
                    AddHtml(254, 374, 50, 17, String.Format("<BASEFONT COLOR=#CCCCFF> {0}", m_Value), false, false);
                }
                // - Show Property Value as just Number ( i.e [Mana Regen 2] )
                else
                {
                    AddHtml(254, 374, 50, 17, String.Format("<BASEFONT COLOR=#CCCCFF> {0}%", m_Value), false, false);
                }

                // == Buttons ==
                //0x1467???
                AddButton(192, 376, 5230, 5230, 10053, GumpButtonType.Reply, 0); // To Minimum Value
                AddButton(211, 376, 5230, 5230, 10052, GumpButtonType.Reply, 0); // Dec Value by %
                AddButton(230, 376, 5230, 5230, 10051, GumpButtonType.Reply, 0); // dec value by 1

                AddButton(331, 376, 5230, 5230, 10056, GumpButtonType.Reply, 0); //To Maximum Value
                AddButton(312, 376, 5230, 5230, 10055, GumpButtonType.Reply, 0); // Inc Value by %
                AddButton(293, 376, 5230, 5230, 10054, GumpButtonType.Reply, 0); // inc Value by 1

                AddLabel(341, 374, 0, ">");
                AddLabel(337, 374, 0, ">");
                AddLabel(333, 374, 0, ">");

                AddLabel(320, 374, 0, ">");
                AddLabel(316, 374, 0, ">");

                AddLabel(298, 374, 0, ">");

                AddLabel(235, 374, 0, "<");

                AddLabel(216, 374, 0, "<");
                AddLabel(212, 374, 0, "<");

                AddLabel(199, 374, 0, "<");
                AddLabel(195, 374, 0, "<");
                AddLabel(191, 374, 0, "<");
            }

            AddButton(19, 416, 4005, 4007, 10099, GumpButtonType.Reply, 0);
            AddHtmlLocalized(58, 417, 100, 18, 1114268, LabelColor, false, false);            //Back

            AddButton(400, 416, 4005, 4007, 10100, GumpButtonType.Reply, 0);
            AddHtmlLocalized(439, 417, 120, 18, 1114267, LabelColor, false, false);         //Imbue Item
        }
Exemple #6
0
        public ImbuingGumpC(Mobile from, Item item, int mod, int value) : base(520, 340)
        {
            PlayerMobile m = from as PlayerMobile;

            from.CloseGump(typeof(ImbuingGump));
            from.CloseGump(typeof(ImbuingGumpB));
            from.CloseGump(typeof(RunicReforgingGump));

            // SoulForge Check
            if (!Imbuing.CheckSoulForge(from, 1))
            {
                return;
            }

            ImbuingContext context = Imbuing.GetContext(m);

            // = Check Type of Ingredients Needed
            if (!Imbuing.Table.ContainsKey(mod))
            {
                return;
            }

            m_Definition = Imbuing.Table[mod];

            if (value == -1)
            {
                value = m_Definition.IncAmount;
            }

            m_Item  = item;
            m_Mod   = mod;
            m_Value = value;

            int maxInt = Imbuing.GetMaxIntensity(item, m_Definition);
            int inc    = m_Definition.IncAmount;
            int weight = m_Definition.Weight;

            if (m_Item is BaseJewel && m_Mod == 12)
            {
                maxInt /= 2;
            }

            if (m_Value < inc)
            {
                m_Value = inc;
            }
            if (m_Value > maxInt)
            {
                m_Value = maxInt;
            }

            if (m_Value <= 0)
            {
                m_Value = 1;
            }

            double currentIntensity = Math.Floor((m_Value / (double)maxInt) * 100);

            //Set context
            context.LastImbued     = item;
            context.Imbue_Mod      = mod;
            context.Imbue_ModVal   = weight;
            context.ImbMenu_ModInc = inc;
            context.Imbue_ModInt   = value;

            // - Current Mod Weight
            m_TotalItemWeight = Imbuing.GetTotalWeight(m_Item, m_Mod);
            m_TotalProps      = Imbuing.GetTotalMods(m_Item, m_Mod);

            if (maxInt <= 1)
            {
                currentIntensity = 100;
            }

            m_PropWeight = (int)Math.Floor(((double)weight / (double)maxInt) * m_Value);

            // - Maximum allowed Property Weight & Item Mod Count
            m_MaxWeight = Imbuing.GetMaxWeight(m_Item);

            // = Times Item has been Imbued
            int timesImbued = Imbuing.TimesImbued(m_Item);

            // = Check Ingredients needed at the current Intensity
            m_GemAmount     = Imbuing.GetGemAmount(m_Item, m_Mod, m_Value);
            m_PrimResAmount = Imbuing.GetPrimaryAmount(m_Item, m_Mod, m_Value);
            m_SpecResAmount = Imbuing.GetSpecialAmount(m_Item, m_Mod, m_Value);

            // ------------------------------ Gump Menu -------------------------------------------------------------
            AddPage(0);
            AddBackground(0, 0, 520, 440, 5054);
            AddImageTiled(10, 10, 500, 420, 2624);

            AddImageTiled(10, 30, 500, 10, 5058);
            AddImageTiled(250, 40, 10, 290, 5058);
            AddImageTiled(10, 180, 500, 10, 5058);
            AddImageTiled(10, 330, 500, 10, 5058);
            AddImageTiled(10, 400, 500, 10, 5058);

            AddAlphaRegion(10, 10, 500, 420);

            AddHtmlLocalized(10, 12, 520, 20, 1079717, LabelColor, false, false); //<CENTER>IMBUING CONFIRMATION</CENTER>
            AddHtmlLocalized(50, 50, 200, 20, 1114269, LabelColor, false, false); //PROPERTY INFORMATION

            AddHtmlLocalized(25, 80, 80, 20, 1114270, LabelColor, false, false);  //Property:
            AddHtmlLocalized(95, 80, 150, 20, m_Definition.AttributeName, LabelColor, false, false);

            AddHtmlLocalized(25, 100, 80, 20, 1114271, LabelColor, false, false); // Replaces:
            int replace = WhatReplacesWhat(m_Mod, m_Item);

            if (replace > 0)
            {
                AddHtmlLocalized(95, 100, 150, 20, replace, LabelColor, false, false);
            }

            // - Weight Modifier
            AddHtmlLocalized(25, 120, 80, 20, 1114272, 0xFFFFFF, false, false);   //Weight:
            AddLabel(95, 120, 1153, String.Format("{0}x", ((double)m_Definition.Weight / 100.0).ToString("0.0")));

            AddHtmlLocalized(25, 140, 80, 20, 1114273, LabelColor, false, false);   //Intensity:
            AddLabel(95, 140, 1153, String.Format("{0}%", currentIntensity));

            // - Materials needed
            AddHtmlLocalized(10, 200, 245, 20, 1044055, LabelColor, false, false); //<CENTER>MATERIALS</CENTER>

            AddHtmlLocalized(40, 230, 180, 20, m_Definition.PrimaryName, LabelColor, false, false);
            AddLabel(210, 230, 1153, m_PrimResAmount.ToString());

            AddHtmlLocalized(40, 255, 180, 20, m_Definition.GemName, LabelColor, false, false);
            AddLabel(210, 255, 1153, m_GemAmount.ToString());

            if (m_SpecResAmount > 0)
            {
                AddHtmlLocalized(40, 280, 180, 17, m_Definition.SpecialName, LabelColor, false, false);
                AddLabel(210, 280, 1153, m_SpecResAmount.ToString());
            }

            // - Mod Description
            AddHtmlLocalized(280, 55, 200, 110, m_Definition.Description, LabelColor, false, false);

            AddHtmlLocalized(350, 200, 150, 20, 1113650, LabelColor, false, false); //RESULTS

            AddHtmlLocalized(280, 220, 150, 20, 1113645, LabelColor, false, false); //Properties:
            AddLabel(430, 220, m_TotalProps + 1 >= 5 ? 54 : 64, String.Format("{0}/5", m_TotalProps + 1));

            int projWeight = m_TotalItemWeight + m_PropWeight;

            AddHtmlLocalized(280, 240, 150, 20, 1113646, LabelColor, false, false); //Total Property Weight:
            AddLabel(430, 240, projWeight >= m_MaxWeight ? 54 : 64, String.Format("{0}/{1}", projWeight, m_MaxWeight));

            AddHtmlLocalized(280, 260, 150, 20, 1113647, LabelColor, false, false); //Times Imbued:
            AddLabel(430, 260, timesImbued >= 20 ? 54 : 64, String.Format("{0}/20", timesImbued));

            // ===== CALCULATE DIFFICULTY =====
            double dif;
            double suc   = Imbuing.GetSuccessChance(from, item, m_TotalItemWeight, m_PropWeight, out dif);
            int    color = 64;

            AddHtmlLocalized(300, 300, 150, 20, 1044057, 0xFFFFFF, false, false); // Success Chance:

            if (suc > 100)
            {
                suc = 100;
            }
            if (suc < 0)
            {
                suc = 0;
            }

            if (suc < 75.0)
            {
                if (suc >= 50.0)
                {
                    color = 54;
                }
                else
                {
                    color = 46;
                }
            }

            AddLabel(420, 300, color, String.Format("{0}%", suc.ToString("0.0")));

            // - Attribute Level
            if (maxInt > 1)
            {
                // - Set Intesity to Minimum
                if (m_Value <= 0)
                {
                    m_Value = 1;
                }

                // = New Value:
                AddHtmlLocalized(235, 350, 100, 17, 1062300, LabelColor, false, false); // New Value:

                if (m_Mod == 41)                                                        // - Mage Weapon Value ( i.e [Mage Weapon -25] )
                {
                    AddHtml(240, 368, 40, 20, String.Format("<CENTER><BASEFONT COLOR=#CCCCFF> -{0}</CENTER>", 30 - m_Value), false, false);
                }
                else if (maxInt <= 8 || m_Mod == 21 || m_Mod == 17)  // - Show Property Value as just Number ( i.e [Mana Regen 2] )
                {
                    AddHtml(240, 368, 40, 20, String.Format("<CENTER><BASEFONT COLOR=#CCCCFF> {0}</CENTER>", m_Value), false, false);
                }
                else                                                 // - Show Property Value as % ( i.e [Hit Fireball 25%] )
                {
                    AddHtml(240, 368, 40, 20, String.Format("<CENTER><BASEFONT COLOR=#CCCCFF> {0}%</CENTER>", m_Value), false, false);
                }

                // == Buttons ==
                AddButton(180, 370, 5230, 5230, 10053, GumpButtonType.Reply, 0); // To Minimum Value
                AddButton(200, 370, 5230, 5230, 10052, GumpButtonType.Reply, 0); // Dec Value by %
                AddButton(220, 370, 5230, 5230, 10051, GumpButtonType.Reply, 0); // dec value by 1

                AddButton(320, 370, 5230, 5230, 10056, GumpButtonType.Reply, 0); //To Maximum Value
                AddButton(300, 370, 5230, 5230, 10055, GumpButtonType.Reply, 0); // Inc Value by %
                AddButton(280, 370, 5230, 5230, 10054, GumpButtonType.Reply, 0); // inc Value by 1

                AddLabel(322, 368, 0, ">");
                AddLabel(326, 368, 0, ">");
                AddLabel(330, 368, 0, ">");

                AddLabel(304, 368, 0, ">");
                AddLabel(308, 368, 0, ">");

                AddLabel(286, 368, 0, ">");

                AddLabel(226, 368, 0, "<");

                AddLabel(203, 368, 0, "<");
                AddLabel(207, 368, 0, "<");

                AddLabel(181, 368, 0, "<");
                AddLabel(185, 368, 0, "<");
                AddLabel(189, 368, 0, "<");
            }

            AddButton(15, 410, 4005, 4007, 10099, GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 410, 100, 18, 1114268, LabelColor, false, false);            //Back

            AddButton(390, 410, 4005, 4007, 10100, GumpButtonType.Reply, 0);
            AddHtmlLocalized(425, 410, 120, 18, 1114267, LabelColor, false, false);         //Imbue Item
        }
Exemple #7
0
        public override void AddGumpLayout()
        {
            // SoulForge Check
            if (!Imbuing.CheckSoulForge(User, 2))
            {
                return;
            }

            ImbuingContext context = Imbuing.GetContext(User);

            if (!ItemPropertyInfo.Table.ContainsKey(m_ID))
            {
                return;
            }

            m_Info = ItemPropertyInfo.Table[m_ID];

            int minInt = ItemPropertyInfo.GetMinIntensity(m_Item, m_ID);
            int maxInt = ItemPropertyInfo.GetMaxIntensity(m_Item, m_ID);
            int weight = m_Info.Weight;

            if (m_Value < minInt)
            {
                m_Value = minInt;
            }

            if (m_Value > maxInt)
            {
                m_Value = maxInt;
            }

            double currentIntensity = Math.Floor((m_Value / (double)maxInt) * 100);

            // Set context
            context.LastImbued     = m_Item;
            context.Imbue_Mod      = m_ID;
            context.Imbue_ModVal   = weight;
            context.ImbMenu_ModInc = ItemPropertyInfo.GetScale(m_Item, m_ID);

            // Current Mod Weight
            m_TotalItemWeight = Imbuing.GetTotalWeight(m_Item, m_ID);
            m_TotalProps      = Imbuing.GetTotalMods(m_Item, m_ID);

            if (maxInt <= 1)
            {
                currentIntensity = 100;
            }

            var propWeight = (int)Math.Floor(((double)weight / (double)maxInt) * m_Value);

            // Maximum allowed Property Weight & Item Mod Count
            m_MaxWeight = Imbuing.GetMaxWeight(m_Item);

            // Times Item has been Imbued
            int timesImbued = Imbuing.TimesImbued(m_Item);

            // Check Ingredients needed at the current Intensity
            var gemAmount     = Imbuing.GetGemAmount(m_Item, m_ID, m_Value);
            var primResAmount = Imbuing.GetPrimaryAmount(m_Item, m_ID, m_Value);
            var specResAmount = Imbuing.GetSpecialAmount(m_Item, m_ID, m_Value);

            AddPage(0);
            AddBackground(0, 0, 520, 440, 5054);
            AddImageTiled(10, 10, 500, 420, 2624);

            AddImageTiled(10, 30, 500, 10, 5058);
            AddImageTiled(250, 40, 10, 290, 5058);
            AddImageTiled(10, 180, 500, 10, 5058);
            AddImageTiled(10, 330, 500, 10, 5058);
            AddImageTiled(10, 400, 500, 10, 5058);

            AddAlphaRegion(10, 10, 500, 420);

            AddHtmlLocalized(10, 12, 520, 20, 1079717, LabelColor, false, false); // <CENTER>IMBUING CONFIRMATION</CENTER>
            AddHtmlLocalized(50, 50, 200, 20, 1114269, LabelColor, false, false); // PROPERTY INFORMATION

            AddHtmlLocalized(25, 80, 80, 20, 1114270, LabelColor, false, false);  // Property:

            if (m_Info.AttributeName != null)
            {
                AddHtmlLocalized(95, 80, 150, 20, 1114057, m_Info.AttributeName.ToString(), LabelColor, false, false);
            }

            AddHtmlLocalized(25, 100, 80, 20, 1114271, LabelColor, false, false); // Replaces:
            var replace = WhatReplacesWhat(m_ID, m_Item);

            if (replace != null)
            {
                AddHtmlLocalized(95, 100, 150, 20, 1114057, replace.ToString(), LabelColor, false, false);
            }

            // Weight Modifier
            AddHtmlLocalized(25, 120, 80, 20, 1114272, 0xFFFFFF, false, false); // Weight:
            AddLabel(95, 120, IceHue, String.Format("{0}x", ((double)m_Info.Weight / 100.0).ToString("0.0")));

            AddHtmlLocalized(25, 140, 80, 20, 1114273, LabelColor, false, false); // Intensity:
            AddLabel(95, 140, IceHue, String.Format("{0}%", currentIntensity));

            // Materials needed
            AddHtmlLocalized(10, 200, 245, 20, 1044055, LabelColor, false, false); // <CENTER>MATERIALS</CENTER>

            AddHtmlLocalized(40, 230, 180, 20, m_Info.PrimaryName, LabelColor, false, false);
            AddLabel(210, 230, IceHue, primResAmount.ToString());

            AddHtmlLocalized(40, 255, 180, 20, m_Info.GemName, LabelColor, false, false);
            AddLabel(210, 255, IceHue, gemAmount.ToString());

            if (specResAmount > 0)
            {
                AddHtmlLocalized(40, 280, 180, 17, m_Info.SpecialName, LabelColor, false, false);
                AddLabel(210, 280, IceHue, specResAmount.ToString());
            }

            // Mod Description
            AddHtmlLocalized(280, 55, 200, 110, m_Info.Description, LabelColor, false, false);

            AddHtmlLocalized(350, 200, 150, 20, 1113650, LabelColor, false, false); // RESULTS

            AddHtmlLocalized(280, 220, 150, 20, 1113645, LabelColor, false, false); // Properties:
            AddLabel(430, 220, GetColor(m_TotalProps + 1, 5), String.Format("{0}/{1}", m_TotalProps + 1, Imbuing.GetMaxProps(m_Item)));

            int projWeight = m_TotalItemWeight + propWeight;

            AddHtmlLocalized(280, 240, 150, 20, 1113646, LabelColor, false, false); // Total Property Weight:
            AddLabel(430, 240, GetColor(projWeight, m_MaxWeight), String.Format("{0}/{1}", projWeight, m_MaxWeight));

            AddHtmlLocalized(280, 260, 150, 20, 1113647, LabelColor, false, false); // Times Imbued:
            AddLabel(430, 260, GetColor(timesImbued, 20), String.Format("{0}/20", timesImbued));

            // ===== CALCULATE DIFFICULTY =====
            var truePropWeight  = (int)(((double)propWeight / (double)weight) * 100);
            var trueTotalWeight = Imbuing.GetTotalWeight(m_Item, -1, false);

            double dif;
            double suc = Imbuing.GetSuccessChance(User, m_Item, trueTotalWeight, truePropWeight, out dif);

            AddHtmlLocalized(300, 300, 150, 20, 1044057, 0xFFFFFF, false, false); // Success Chance:
            AddLabel(420, 300, GetSuccessChanceHue(suc), String.Format("{0}%", suc.ToString("0.0")));

            // - Attribute Level
            if (maxInt > 1)
            {
                AddHtmlLocalized(235, 350, 100, 17, 1062300, LabelColor, false, false); // New Value:

                if (m_ID == 41)                                                         // - Mage Weapon Value ( i.e [Mage Weapon -25] )
                {
                    AddLabel(250, 370, IceHue, String.Format("-{0}", 30 - m_Value));
                }
                else if (maxInt <= 8 || m_ID == 21 || m_ID == 17)                 // - Show Property Value as just Number ( i.e [Mana Regen 2] )
                {
                    AddLabel(256, 370, IceHue, String.Format("{0}", m_Value));    // - Show Property Value as % ( i.e [Hit Fireball 25%] )
                }
                else
                {
                    int val = m_Value;

                    if (m_ID >= 51 && m_ID <= 55)
                    {
                        var resistances = Imbuing.GetBaseResists(m_Item);

                        switch (m_ID)
                        {
                        case 51: val += resistances[0]; break;

                        case 52: val += resistances[1]; break;

                        case 53: val += resistances[2]; break;

                        case 54: val += resistances[3]; break;

                        case 55: val += resistances[4]; break;
                        }
                    }

                    AddLabel(256, 370, IceHue, String.Format("{0}%", val));
                }

                // Buttons
                AddButton(179, 372, 0x1464, 0x1464, 10053, GumpButtonType.Reply, 0);
                AddButton(187, 372, 0x1466, 0x1466, 10053, GumpButtonType.Reply, 0);

                AddButton(199, 372, 0x1464, 0x1464, 10052, GumpButtonType.Reply, 0);
                AddButton(207, 372, 0x1466, 0x1466, 10052, GumpButtonType.Reply, 0);

                AddButton(221, 372, 0x1464, 0x1464, 10051, GumpButtonType.Reply, 0);
                AddButton(229, 372, 0x1466, 0x1466, 10051, GumpButtonType.Reply, 0);

                AddButton(280, 372, 0x1464, 0x1464, 10054, GumpButtonType.Reply, 0);
                AddButton(288, 372, 0x1466, 0x1466, 10054, GumpButtonType.Reply, 0);

                AddButton(300, 372, 0x1464, 0x1464, 10055, GumpButtonType.Reply, 0);
                AddButton(308, 372, 0x1466, 0x1466, 10055, GumpButtonType.Reply, 0);

                AddButton(320, 372, 0x1464, 0x1464, 10056, GumpButtonType.Reply, 0);
                AddButton(328, 372, 0x1466, 0x1466, 10056, GumpButtonType.Reply, 0);

                AddLabel(322, 370, 0, ">");
                AddLabel(326, 370, 0, ">");
                AddLabel(330, 370, 0, ">");

                AddLabel(304, 370, 0, ">");
                AddLabel(308, 370, 0, ">");

                AddLabel(286, 370, 0, ">");

                AddLabel(226, 370, 0, "<");

                AddLabel(203, 370, 0, "<");
                AddLabel(207, 370, 0, "<");

                AddLabel(181, 370, 0, "<");
                AddLabel(185, 370, 0, "<");
                AddLabel(189, 370, 0, "<");
            }

            AddButton(15, 410, 4005, 4007, 10099, GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 410, 100, 18, 1114268, LabelColor, false, false); // Back

            AddButton(390, 410, 4005, 4007, 10100, GumpButtonType.Reply, 0);
            AddHtmlLocalized(425, 410, 120, 18, 1114267, LabelColor, false, false); // Imbue Item
        }
Exemple #8
0
            protected override void OnTarget(Mobile from, object o)
            {
                Item   item = o as Item;
                Mobile m    = o as Mobile;

                if (item == null && m == null)
                {
                    from.SendLocalizedMessage(500353); // You are not certain...
                    return;
                }

                if (!from.CheckTargetSkill(SkillName.ItemID, o, 0, 100))
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1041352, from.NetState); // You have no idea how much it might be worth.
                    return;
                }

                if (m != null)
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1041349, AffixType.Append, "  " + m.Name, "", from.NetState); // It appears to be:
                    return;
                }

                if (item.Name != null)
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, false, item.Name, from.NetState);
                    item.PrivateOverheadMessage(MessageType.Label, 0x3B2, false, item.Name, from.NetState);
                }
                else
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, item.LabelNumber, from.NetState);
                    item.PrivateOverheadMessage(MessageType.Label, 0x3B2, item.LabelNumber, from.NetState);
                }

                if (Core.AOS)
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1041351, AffixType.Append, "  " + GetPriceFor(item).ToString(), "", from.NetState); // You guess the value of that item at:

                    if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                    {
                        if (Imbuing.TimesImbued(item) > 0)
                        {
                            from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111877, from.NetState); // You conclude that item cannot be magically unraveled. The magic in that item has been weakened due to either low durability or the imbuing process.
                        }
                        else
                        {
                            int    weight    = Imbuing.GetTotalWeight(item);
                            string imbIngred = null;
                            double skill     = from.Skills[SkillName.Imbuing].Base;
                            bool   badSkill  = false;

                            if (!Imbuing.CanUnravelItem(from, item, false))
                            {
                                weight = 0;
                            }

                            if (weight > 0 && weight <= 200)
                            {
                                imbIngred = "Magical Residue";
                            }
                            else if (weight > 200 && weight < 480)
                            {
                                imbIngred = "Enchanted Essence";

                                if (skill < 45.0)
                                {
                                    badSkill = true;
                                }
                            }
                            else if (weight >= 480)
                            {
                                imbIngred = "Relic Fragment";

                                if (skill < 95.0)
                                {
                                    badSkill = true;
                                }
                            }

                            if (imbIngred != null)
                            {
                                if (badSkill)
                                {
                                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111875, from.NetState); // Your Imbuing skill is not high enough to identify the imbuing ingredient.
                                }
                                else
                                {
                                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111874, imbIngred, from.NetState); //You conclude that item will magically unravel into: ~1_ingredient~
                                }
                            }
                            else  // Cannot be Unravelled
                            {
                                from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111876, from.NetState); //You conclude that item cannot be magically unraveled. It appears to possess little to no magic.
                            }
                        }
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Emote, 0x3B2, 1111878); //You conclude that item cannot be magically unraveled.
                    }
                }
                else if (o is Item)
                {
                    if (from.CheckTargetSkill(SkillName.ItemID, o, 0, 100))
                    {
                        if (o is BaseWeapon)
                        {
                            ((BaseWeapon)o).Identified = true;
                        }
                        else if (o is BaseArmor)
                        {
                            ((BaseArmor)o).Identified = true;
                        }

                        if (!Core.AOS)
                        {
                            ((Item)o).OnSingleClick(from);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500353); // You are not certain...
                    }
                }
                else if (o is Mobile)
                {
                    ((Mobile)o).OnSingleClick(from);
                }
                else
                {
                    from.SendLocalizedMessage(500353); // You are not certain...
                }

                Server.Engines.XmlSpawner2.XmlAttach.RevealAttachments(from, o);
            }