// Update is called once per frame
    void Update()
    {
        if (Input.GetKey(leftKey)) //move left
        {
            rb2d.AddForce(Vector2.left * forceMod);
        }

        if (Input.GetKey(rightKey))  //move right
        {
            rb2d.AddForce(Vector2.right * forceMod);
        }

        if (Input.GetKeyDown(KeyCode.C)) //change to CursedShield
        {
            Destroy(shield);
            shield = gameObject.AddComponent <CursedShield>();
        }
        else if (Input.GetKeyDown(KeyCode.H))   //change to HalfDamageShield
        {
            Destroy(shield);
            shield = gameObject.AddComponent <HalfDamageShield>();
        }
        else if (Input.GetKeyDown(KeyCode.B))   //change to BaseShield
        {
            Destroy(shield);
            shield = gameObject.AddComponent <BaseShield>();
        }
    }
Пример #2
0
        public Shield(BaseShield Item, uint ContainerID)
        {
            Item.UpdateLocalizedProperties();
            Item.UpdateTextProperties();

            //General
            ID = Item.Serial.Value;
            this.ContainerID = ContainerID;
            ItemName         = Item.Tooltip.Split('|')[0];
            SC             = Item.Attributes.SpellChanneling;
            DI             = (sbyte)Item.Attributes.WeaponDamage;
            SSI            = (sbyte)Item.Attributes.WeaponSpeed;
            FC             = (sbyte)Item.Attributes.CastSpeed;
            RPD            = (sbyte)Item.Attributes.ReflectPhysical;
            DCI            = (sbyte)Item.Attributes.DefendChance;
            HCI            = (sbyte)Item.Attributes.AttackChance;
            STR            = (sbyte)Item.Attributes.BonusStr;
            DEX            = (sbyte)Item.Attributes.BonusDex;
            INTEL          = (sbyte)Item.Attributes.BonusInt;
            HP             = (sbyte)Item.Attributes.BonusHits;
            Stam           = (sbyte)Item.Attributes.BonusStam;
            Mana           = (sbyte)Item.Attributes.BonusMana;
            HPRegen        = (sbyte)Item.Attributes.RegenHits;
            StamRegen      = (sbyte)Item.Attributes.RegenStam;
            ManaRegen      = (sbyte)Item.Attributes.RegenMana;
            LMC            = (sbyte)Item.Attributes.LowerManaCost;
            LRC            = (sbyte)Item.Attributes.LowerRegCost;
            EnhancePotions = (sbyte)Item.Attributes.EnhancePotions;
            Luck           = (short)Item.Attributes.Luck;
            Brittle        = Item.Brittle;

            Added = DateTime.Now;
        }
Пример #3
0
        protected override void OnTarget(Mobile from, object o)
        {
            if (!(o is Item))
            {
                from.SendMessage("You cannot convert people into gargoyles using this.");
            }
            else if (o is BaseWeapon)
            {
                BaseWeapon bw = (BaseWeapon)o;

                CheckResource(from, bw, bw.Resource);
            }
            else if (o is BaseArmor)
            {
                BaseArmor ba = (BaseArmor)o;

                CheckResource(from, ba, ba.Resource);
            }
            else if (o is BaseShield)
            {
                BaseShield bs = (BaseShield)o;
                //((BaseShield)o).ResourceType = bs.ResourceType;
                CheckResource(from, bs, bs.Resource);
            }
        }
Пример #4
0
        /// <summary>
        /// Applies a 20% chance to bash the attacker at <code>PerkLevel.Fourth</code>
        /// </summary>
        public void TryBash(BaseShield shield, BaseWeapon attackerWeapon)
        {
            if (Level < PerkLevel.Fourth || !ShieldEquipped || attackerWeapon is BaseRanged)
            {
                return;
            }

            if (Utility.RandomDouble() < 0.20)
            {
                return;
            }

            Mobile aggressor = Player.Combatant as Mobile;

            if (aggressor == null || !Player.CanBeHarmful(aggressor, false))
            {
                return;
            }

            int damage = (int)((shield.ArmorRating / 2.0) + shield.Weight);

            damage += (int)(Player.Str * 0.05);

            aggressor.Damage(damage, Player);

            aggressor.FixedEffect(0x37B9, 10, 16);
            aggressor.PlaySound(0x141);

            Player.SendMessage("You strike your opponent with your shield!");
            Player.Emote("*Sheild-strike*");
        }
Пример #5
0
        public static bool isEscudoPequeno(BaseShield escudo)
        {
            if (escudo is Buckler ||
                escudo is WoodenShield)
            {
                return(true);
            }

            return(false);
        }
Пример #6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            m_RangedWeapon = reader.ReadItem() as BaseWeapon;
            m_MeleeWeapon  = reader.ReadItem() as BaseWeapon;
            m_MeleeShield  = reader.ReadItem() as BaseShield;
        }
Пример #7
0
        public static bool isEscudoGrande(BaseShield escudo)
        {
            if (escudo is HeaterShield ||
                escudo is MetalKiteShield ||
                escudo is WoodenKiteShield)
            {
                return(true);
            }

            return(false);
        }
Пример #8
0
        private bool HasShield()
        {
            BaseShield shield = Caster.FindItemOnLayer(Layer.TwoHanded) as BaseShield;

            if (shield == null)
            {
                Caster.SendLocalizedMessage(1156096); // You must be wielding a shield to use this ability!
                return(false);
            }

            return(true);
        }
Пример #9
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (XmlScript.HasTrigger(this, TriggerName.onSpeech) &&
                UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech))
            {
                return;
            }
            if (!e.Handled && e.HasKeyword(Keyword) && e.Mobile.InRange(Location, 2))
            {
                e.Handled = true;

                Mobile from = e.Mobile;
                var    g    = from.Guild as Guild;

                var ethic = Ethics.Player.Find(e.Mobile);

                if (g == null && ethic == null || g != null && g.Type != Type && ethic == null)
                {
                    Say(SignupNumber);
                }
                else if (ethic != null && Shield is OrderShield && ethic.Ethic is EvilEthic ||
                         ethic != null && Shield is ChaosShield && ethic.Ethic is HeroEthic)
                {
                    Say("Begone!  You do not follow the proper ethic to wield one of our order's shields.");
                }
                else
                {
                    Container  pack      = from.Backpack;
                    BaseShield shield    = Shield;
                    Item       twoHanded = from.FindItemOnLayer(Layer.TwoHanded);

                    if ((pack != null && pack.FindItemByType(shield.GetType()) != null) ||
                        (twoHanded != null && shield.GetType().IsInstanceOfType(twoHanded)))
                    {
                        Say(1007110);                         // Why dost thou ask about virtue guards when thou art one?
                        shield.Delete();
                    }
                    else if (from.PlaceInBackpack(shield))
                    {
                        Say(Utility.Random(1007101, 5));
                        Say(1007139);                         // I see you are in need of our shield, Here you go.
                        from.AddToBackpack(shield);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502868);                         // Your backpack is too full.
                        shield.Delete();
                    }
                }
            }

            base.OnSpeech(e);
        }
Пример #10
0
        public static bool isEscudoMedio(BaseShield escudo)
        {
            if (escudo is BronzeShield ||
                escudo is MetalShield ||
                escudo is ChaosShield ||
                escudo is OrderShield)
            {
                return(true);
            }

            return(false);
        }
Пример #11
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public static void PowerArtifactShield(Item artifact, string arty)
        {
            BaseShield shield = (BaseShield)artifact;

            ArtifactDurability(artifact);

            if (arty == "driftwood")
            {
                shield.Attributes.SpellChanneling = 1;
                shield.Attributes.ReflectPhysical = 30;
                shield.Attributes.DefendChance    = 10;
                shield.PhysicalBonus = 5;
                shield.EnergyBonus   = 10;
            }
            else if (arty == "bronzed")
            {
                shield.Attributes.BonusStr      = 5;
                shield.Attributes.BonusDex      = 5;
                shield.Attributes.BonusHits     = 5;
                shield.Attributes.BonusStam     = 5;
                shield.Attributes.RegenStam     = 3;
                shield.Attributes.LowerManaCost = 10;
                shield.PhysicalBonus            = 6;
                shield.FireBonus   = 11;
                shield.ColdBonus   = 6;
                shield.PoisonBonus = 8;
                shield.EnergyBonus = 6;
            }
            else if (arty == "invulnerable")
            {
                shield.PhysicalBonus = 8;
                shield.Attributes.SpellChanneling   = 1;
                shield.Attributes.ReflectPhysical   = 10;
                shield.Attributes.DefendChance      = 15;
                shield.ArmorAttributes.LowerStatReq = 100;
                shield.MaxHitPoints = 200;
                shield.HitPoints    = 200;
            }
            else if (arty == "barnacle")
            {
                shield.PhysicalBonus              = 30;
                shield.Attributes.DefendChance    = 15;
                shield.ArmorAttributes.SelfRepair = 5;
                shield.MaxHitPoints = 200;
                shield.HitPoints    = 200;
            }
            else if (arty == "neptune")
            {
                shield.Attributes.RegenStam = 10;
                shield.FireBonus            = 25;
            }
        }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(leftKey)) //move left
        {
            rb2d.AddForce(Vector2.left * forceMod);
        }

        if (Input.GetKey(rightKey))  //move right
        {
            rb2d.AddForce(Vector2.right * forceMod);
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            attack.Fire(transform.position);
        }

        if (Input.GetKeyDown(KeyCode.C)) //change to CursedShield
        {
            Destroy(shield);
            shield = gameObject.AddComponent <CursedShield>();
        }
        else if (Input.GetKeyDown(KeyCode.H))   //change to HalfDamageShield
        {
            Destroy(shield);
            shield = gameObject.AddComponent <HalfDamageShield>();
        }
        else if (Input.GetKeyDown(KeyCode.B))   //change to BaseShield
        {
            Destroy(shield);
            shield = gameObject.AddComponent <BaseShield>();
        }
        else if (Input.GetKeyDown(KeyCode.Q))
        {
            Destroy(shield);
            shield = gameObject.AddComponent <AbsorbShield>();
        }
        else if (Input.GetKeyDown(KeyCode.T))
        {
            Destroy(shield);
            shield = gameObject.AddComponent <TeleportShield>();
        }

        healthText.text = "Health: " + health;                   //update health display

        if (shield != null)                                      // if you have a shield
        {
            healthText.text += "\nShield: " + shield.ToString(); //update health display to show shield name
        }
    }
Пример #13
0
        public bool HasShieldOrWeapon()
        {
            BaseShield shield = Caster.FindItemOnLayer(Layer.TwoHanded) as BaseShield;

            if (shield == null)
            {
                BaseWeapon weapon = Caster.Weapon as BaseWeapon;

                if (weapon == null || weapon is Fists)
                {
                    Caster.SendLocalizedMessage(1156096); // You must be wielding a shield to use this ability!
                    return(false);
                }
            }

            return(true);
        }
Пример #14
0
        public static bool temTalentoParaEquiparEscudo(Jogador jogador, BaseShield escudo)
        {
            SistemaTalento sistemaTalento = jogador.getSistemaTalento();

            /*
             * if(isEscudoPequeno(escudo) && sistemaTalento.possuiTalento(IdHabilidadeTalento.escudoPequeno)) {
             *      return true;
             * }
             * else if(isEscudoMedio(escudo) && sistemaTalento.possuiTalento(IDTalento.escudoMedio)) {
             *      return true;
             * }
             * else if(isEscudoGrande(escudo) && sistemaTalento.possuiTalento(IDTalento.escudoGrande)) {
             *      return true;
             * }
             */

            return(false);
        }
Пример #15
0
        private void UpdateWeapon()
        {
            IRangedMelee rmel = m_Mobile as IRangedMelee;

            if (rmel != null && m_Mobile.Combatant != null)
            {
                BaseWeapon first  = m_Mobile.FindItemOnLayer(Layer.FirstValid) as BaseWeapon;
                BaseShield second = m_Mobile.FindItemOnLayer(Layer.TwoHanded) as BaseShield;
                bool       close  = m_Mobile.GetDistanceToSqrt(m_Mobile.Combatant) <= 1;
                if (rmel.RangedWeapon != null || rmel.MeleeWeapon != null)
                {
                    if (close)
                    {
                        if (first != rmel.MeleeWeapon && rmel.MeleeWeapon != null && rmel.MeleeWeapon.IsChildOf(m_Mobile.Backpack))
                        {
                            if (rmel.RangedWeapon != null && rmel.RangedWeapon.Parent == m_Mobile)
                            {
                                m_Mobile.AddToBackpack(rmel.RangedWeapon);
                            }

                            m_Mobile.AddItem(rmel.MeleeWeapon);

                            if (rmel.MeleeShield != null && rmel.MeleeShield.IsChildOf(m_Mobile.Backpack))
                            {
                                m_Mobile.AddItem(rmel.MeleeShield);
                            }
                        }
                    }
                    else if (rmel.RangedWeapon != null && first != rmel.RangedWeapon && rmel.RangedWeapon.IsChildOf(m_Mobile.Backpack))
                    {
                        if (rmel.MeleeWeapon != null && rmel.MeleeWeapon.Parent == m_Mobile)
                        {
                            m_Mobile.AddToBackpack(rmel.MeleeWeapon);
                        }
                        if (rmel.MeleeShield != null && rmel.MeleeShield.Parent == m_Mobile)
                        {
                            m_Mobile.AddToBackpack(rmel.MeleeShield);
                        }

                        m_Mobile.AddItem(rmel.RangedWeapon);
                    }
                }
            }
        }
Пример #16
0
    /// <summary>
    /// sets the shield slider to the value of the shield value equpied
    /// </summary>
    private void SliderShieldBar()
    {
        if (!sSlider)
        {
            sSlider          = shieldBar.GetComponent <Slider>();
            sSlider.minValue = 0;

            tmpShield     = shipMods.getModulesShields();
            tmpBaseShield = tmpShield.GetComponentInChildren <BaseShield>();
            if (shipMods && tmpShield && tmpBaseShield)
            {
                sSlider.maxValue = tmpBaseShield.GetMaxShield();
                sSlider.value    = tmpBaseShield.GetCurrentShield();
            }
        }
        else if (tmpBaseShield)
        {
            sSlider.value = tmpBaseShield.GetCurrentShield();
        }
    }
Пример #17
0
    /// <summary>
    /// finds a shield that is capable of blocking shots
    /// </summary>
    /// <returns>
    /// returns a shield that can block damage, otherwise return null
    /// </returns>
    public GameObject getModulesShields()
    {
        if (ShieldSlots.Length <= 0)
        {
            return(null);
        }

        foreach (GameObject g in ShieldSlots)
        {
            BaseShield bs = g.GetComponentInChildren <BaseShield>();
            if (bs)
            {
                if (bs.ShieldActive())
                {
                    return(g);
                }
            }
        }

        return(null);
    }
Пример #18
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (!e.Handled && e.HasKeyword(Keyword) && e.Mobile.InRange(this.Location, 2))
            {
                e.Handled = true;

                Mobile from = e.Mobile;
                Guild  g    = from.Guild as Guild;

                if (g == null || g.Type != Type)
                {
                    Say(SignupNumber);
                }
                else
                {
                    Container  pack      = from.Backpack;
                    BaseShield shield    = Shield;
                    Item       twoHanded = from.FindItemOnLayer(Layer.TwoHanded);

                    if ((pack != null && pack.FindItemByType(shield.GetType()) != null) || (twoHanded != null && shield.GetType().IsAssignableFrom(twoHanded.GetType())))
                    {
                        Say(1007110);                           // Why dost thou ask about virtue guards when thou art one?
                        shield.Delete();
                    }
                    else if (from.PlaceInBackpack(shield))
                    {
                        Say(Utility.Random(1007101, 5));
                        Say(1007139);                           // I see you are in need of our shield, Here you go.
                        from.AddToBackpack(shield);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502868);                           // Your backpack is too full.
                        shield.Delete();
                    }
                }
            }

            base.OnSpeech(e);
        }
    // Update is called once per frame
    void Update()
    {
        attack = GetComponent <BaseAttack>();

        if (Input.GetKeyDown(KeyCode.Space))
        {
            attack.Attack();
        }

        if (Input.GetKey(leftKey)) //move left
        {
            rb2d.AddForce(Vector2.left * forceMod);
        }

        if (Input.GetKey(rightKey))  //move right
        {
            rb2d.AddForce(Vector2.right * forceMod);
        }

        if (Input.GetKeyDown(KeyCode.B)) //change to BaseShield
        {
            Destroy(shield);
            shield = gameObject.AddComponent <BaseShield>();
        }

        if (Input.GetKeyDown(KeyCode.T))
        {
            Destroy(shield);
            shield = gameObject.AddComponent <TeleportShield>();
        }

        if (Input.GetKeyDown(KeyCode.H))
        {
            Destroy(shield);
            shield = gameObject.AddComponent <HalfDamangeShield>();
        }
    }
Пример #20
0
        public override bool CheckCast()
        {
            if (!base.CheckCast())
            {
                return(false);
            }

            if (Confidence.UnderEffect(Caster))
            {
                Caster.Send(new SetNewSpell(0x92, 0));

                Confidence.m_Table.Remove(Caster);
            }

            if (CounterAttack.UnderEffect(Caster))
            {
                Caster.Send(new SetNewSpell(0x94, 0));

                CounterAttack.m_Table.Remove(Caster);
            }

            BaseShield shield = Caster.FindItemOnLayer(Layer.TwoHanded) as BaseShield;

            BaseWeapon weapon1 = Caster.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;

            BaseWeapon weapon2 = Caster.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;

            if (shield == null && weapon1 == null && weapon2 == null)
            {
                Caster.SendLocalizedMessage(1062944);                   // You must have a weapon or a shield equipped to use this ability!

                return(false);
            }

            return(true);
        }
Пример #21
0
        public ArmsLoreGump(Mobile from, Item item, bool success, DisplayMode displayMode, BardMode bardMode) : base(50, 50)
        {
            if (from == null | item == null)
            {
                return;
            }
            if (from.Deleted || !from.Alive || item.Deleted)
            {
                return;
            }

            m_From        = from;
            m_Item        = item;
            m_Success     = success;
            m_DisplayMode = displayMode;
            m_BardMode    = bardMode;

            bool showDetailedInfo = true;
            bool showDurability   = m_Success;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            int textHue = 2036;

            AddPage(0);

            BaseWeapon     weapon     = item as BaseWeapon;
            BaseArmor      armor      = item as BaseArmor;
            BaseShield     shield     = item as BaseShield;
            BaseInstrument instrument = item as BaseInstrument;

            #region Weapon

            if (weapon != null)
            {
                AddImage(220, 123, 103);
                AddImage(220, 65, 103);
                AddImage(220, 4, 103);
                AddImage(98, 124, 103);
                AddImage(98, 65, 103);
                AddImage(98, 4, 103);
                AddImage(5, 124, 103);
                AddImage(5, 65, 103);
                AddImage(5, 4, 103);
                AddImage(18, 16, 3604, 2052);
                AddImage(18, 85, 3604, 2052);
                AddImage(102, 16, 3604, 2052);
                AddImage(102, 85, 3604, 2052);
                AddImage(222, 16, 3604, 2052);
                AddImage(223, 85, 3604, 2052);

                string weaponNameText = weapon.Name;

                if (weaponNameText == null)
                {
                    weaponNameText = "";
                }

                weaponNameText = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(weaponNameText);

                if (weaponNameText == null)
                {
                    weaponNameText = "";
                }

                string weaponTypeText = "";

                if (weapon.TierLevel > 0 && weapon.Dungeon != DungeonEnum.None)
                {
                    weaponTypeText = Item.GetDungeonName(weapon.Dungeon) + " Dungeon: Tier " + weapon.TierLevel.ToString();
                }

                else if (!(weapon.Resource == CraftResource.Iron || weapon.Resource == CraftResource.RegularWood))
                {
                    weaponTypeText = CraftResources.GetCraftResourceName(weapon.Resource);
                }

                double creatureAccuracyBonus = weapon.GetHitChanceBonus(true, false);
                double playerAccuracyBonus   = weapon.GetHitChanceBonus(true, true);

                double tacticsBonus = 0;

                double swingDelay = weapon.GetDelay(from, true).TotalSeconds;

                double accuracyVsCreature = weapon.GetSimulatedHitChance(from, 100, false);
                double accuracyVsPlayer   = weapon.GetSimulatedHitChance(from, 100, true);

                double armsLoreCreatureDamageScalarBonus = weapon.GetArmsLoreDamageBonus(from, false);
                double armsLorePlayerDamageScalarBonus   = weapon.GetArmsLoreDamageBonus(from, true);

                double damageVsCreatureScalar = (weapon.GetDamageScalar(from, true, false) + armsLoreCreatureDamageScalarBonus) * BaseWeapon.PlayerVsCreatureDamageScalar;
                int    damageVsCreatureMin    = (int)Math.Round((double)weapon.BaseMinDamage * damageVsCreatureScalar);
                int    damageVsCreatureMax    = (int)Math.Round((double)weapon.BaseMaxDamage * damageVsCreatureScalar);

                double damageVsCreatureSlayerScalar = (weapon.GetDamageScalar(from, true, false) + armsLoreCreatureDamageScalarBonus) + BaseWeapon.SlayerDamageScalarBonus * BaseWeapon.PlayerVsCreatureDamageScalar;
                int    damageVsCreatureSlayerMin    = (int)Math.Round((double)weapon.BaseMinDamage * damageVsCreatureSlayerScalar);
                int    damageVsCreatureSlayerMax    = (int)Math.Round((double)weapon.BaseMaxDamage * damageVsCreatureSlayerScalar);

                double damageVsPlayerScalar = (weapon.GetDamageScalar(from, true, true) + armsLorePlayerDamageScalarBonus) * BaseWeapon.PlayerVsPlayerDamageScalar;
                int    damageVsPlayerMin    = (int)Math.Round((double)weapon.BaseMinDamage * damageVsPlayerScalar);
                int    damageVsPlayerMax    = (int)Math.Round((double)weapon.BaseMaxDamage * damageVsPlayerScalar);

                if (damageVsCreatureMin < 1)
                {
                    damageVsCreatureMin = 1;
                }

                if (damageVsCreatureMax < 1)
                {
                    damageVsCreatureMax = 1;
                }

                if (damageVsCreatureSlayerMin < 1)
                {
                    damageVsCreatureSlayerMin = 1;
                }

                if (damageVsCreatureSlayerMax < 1)
                {
                    damageVsCreatureSlayerMax = 1;
                }

                if (damageVsPlayerMin < 1)
                {
                    damageVsPlayerMin = 1;
                }

                if (damageVsPlayerMax < 1)
                {
                    damageVsPlayerMax = 1;
                }

                if (weapon.m_SkillMod != null)
                {
                    if (weapon.m_SkillMod.Skill == SkillName.Tactics)
                    {
                        tacticsBonus = weapon.m_SkillMod.Value;
                    }
                }

                switch (displayMode)
                {
                case DisplayMode.Normal:
                    //Guide
                    AddButton(18, 15, 2094, 2095, 2, GumpButtonType.Reply, 0);
                    AddLabel(16, -3, 149, "Guide");

                    //Description
                    AddLabel(Utility.CenteredTextOffset(115, weaponNameText), 25, 2603, weaponNameText);
                    AddLabel(Utility.CenteredTextOffset(115, weaponTypeText), 45, 2603, weaponTypeText);

                    //Image
                    AddItem(100 + weapon.IconOffsetX, 95 + weapon.IconOffsetY, weapon.IconItemId, weapon.IconHue);

                    //Display Mode
                    AddLabel(235, 25, 149, "Base Values");
                    AddButton(327, 29, 1210, 1209, 1, GumpButtonType.Reply, 0);

                    //Speed
                    AddLabel(232, 45, textHue, "Speed:");
                    if (showDetailedInfo)
                    {
                        AddLabel(281, 45, 2603, weapon.Speed.ToString());
                    }
                    else
                    {
                        AddLabel(281, 45, 2603, "?");
                    }

                    //Damage
                    AddLabel(222, 65, textHue, "Damage:");
                    if (showDetailedInfo)
                    {
                        AddLabel(280, 65, 2603, weapon.BaseMinDamage + "-" + weapon.BaseMaxDamage);
                    }
                    else
                    {
                        AddLabel(280, 65, 2603, "?");
                    }

                    //Durability
                    AddLabel(209, 85, textHue, "Durability:");
                    if (showDetailedInfo && showDurability)
                    {
                        AddLabel(280, 85, 2603, weapon.HitPoints + "/" + weapon.MaxHitPoints);
                    }
                    else
                    {
                        AddLabel(280, 85, 2603, "?/?");
                    }

                    //Accuracy
                    AddLabel(212, 105, textHue, "Accuracy:");
                    AddLabel(280, 105, 2603, "+" + Utility.CreatePercentageString(creatureAccuracyBonus));

                    //Tactics
                    AddLabel(222, 125, textHue, "Tactics:");
                    AddLabel(280, 125, 2603, "+" + tacticsBonus);

                    //Slayer
                    if (weapon.SlayerGroup != SlayerGroupType.None)
                    {
                        string slayerName = weapon.SlayerGroup.ToString() + " Slaying";
                        AddLabel(Utility.CenteredTextOffset(280, slayerName), 145, 2603, slayerName);
                    }

                    //Arcane Charges
                    if (weapon.TierLevel > 0)
                    {
                        AddLabel(169, 165, textHue, "Arcane Charges:");
                        AddLabel(280, 165, 2603, weapon.ArcaneCharges.ToString());
                    }

                    //Experience
                    if (weapon.TierLevel > 0)
                    {
                        AddLabel(199, 185, textHue, "Experience:");
                        AddLabel(279, 185, 2603, weapon.Experience.ToString() + "/250");
                    }

                    //Effect Chance
                    if (weapon.TierLevel > 0)
                    {
                        AddLabel(26, 165, textHue, "Effect Chance:");
                        AddLabel(127, 165, 2603, "4.1%");
                    }

                    //Effect
                    if (weapon.TierLevel > 0)
                    {
                        AddLabel(25, 185, textHue, "Effect:");
                        AddLabel(75, 185, 2603, "Firestorm");
                    }
                    break;

                case DisplayMode.Adjusted:
                    //Guide
                    AddButton(18, 15, 2094, 2095, 2, GumpButtonType.Reply, 0);
                    AddLabel(16, -3, 149, "Guide");

                    //Display Mode
                    AddLabel(235, 25, 149, "Your Values");
                    AddButton(327, 29, 1210, 1209, 1, GumpButtonType.Reply, 0);

                    //Description
                    AddLabel(Utility.CenteredTextOffset(115, weaponNameText), 25, 2603, weaponNameText);
                    AddLabel(Utility.CenteredTextOffset(115, weaponTypeText), 45, 2603, weaponTypeText);

                    //Image
                    AddItem(100 + weapon.IconOffsetX, 95 + weapon.IconOffsetY, weapon.IconItemId, weapon.IconHue);

                    //Swing Speed
                    AddLabel(213, 45, textHue, "Swing Delay:");
                    if (showDetailedInfo)
                    {
                        AddLabel(297, 45, 2603, Utility.CreateDecimalString(swingDelay, 2) + "s");
                    }
                    else
                    {
                        AddLabel(297, 45, 2603, "?");
                    }

                    //Accuracy vs Creature
                    AddLabel(153, 82, textHue, "Accuracy vs Creature:");
                    if (showDetailedInfo)
                    {
                        AddLabel(297, 82, 2603, Utility.CreateDecimalPercentageString(accuracyVsCreature, 2));
                    }
                    else
                    {
                        AddLabel(297, 82, 2603, "?");
                    }

                    //Damage vs Creature
                    AddLabel(162, 102, textHue, "Damage vs Creature:");
                    if (showDetailedInfo)
                    {
                        AddLabel(297, 102, 2603, damageVsCreatureMin.ToString() + "-" + damageVsCreatureMax.ToString());
                    }
                    else
                    {
                        AddLabel(297, 102, 2603, "?");
                    }

                    //Damage If Slayer Type
                    if (weapon.SlayerGroup != SlayerGroupType.None)
                    {
                        AddLabel(147, 122, textHue, "Damage If Slayer Type:");

                        if (showDetailedInfo)
                        {
                            AddLabel(297, 122, 2603, damageVsCreatureSlayerMin.ToString() + "-" + damageVsCreatureSlayerMax.ToString());
                        }
                        else
                        {
                            AddLabel(297, 122, 2603, "?");
                        }
                    }

                    //Accuracy vs Player
                    AddLabel(168, 165, textHue, "Accuracy vs Player:");
                    if (showDetailedInfo)
                    {
                        AddLabel(297, 165, 2603, Utility.CreateDecimalPercentageString(accuracyVsPlayer, 2));
                    }
                    else
                    {
                        AddLabel(297, 165, 2603, "?");
                    }

                    //Daamge vs Player
                    AddLabel(177, 185, textHue, "Damage vs Player:");
                    if (showDetailedInfo)
                    {
                        AddLabel(297, 185, 2603, damageVsPlayerMin.ToString() + "-" + damageVsPlayerMax.ToString());
                    }
                    else
                    {
                        AddLabel(297, 185, 2603, "?");
                    }

                    //Effect Chance
                    if (weapon.TierLevel > 0)
                    {
                        AddLabel(26, 165, textHue, "Effect Chance:");
                        AddLabel(127, 165, 2603, "4.1%");
                    }

                    //Effect
                    if (weapon.TierLevel > 0)
                    {
                        AddLabel(25, 185, textHue, "Effect:");
                        AddLabel(75, 185, 2603, "Firestorm");
                    }
                    break;
                }
            }

            #endregion

            #region Armor

            if (armor != null && shield == null)
            {
                AddImage(220, 123, 103);
                AddImage(220, 65, 103);
                AddImage(220, 4, 103);
                AddImage(98, 124, 103);
                AddImage(98, 65, 103);
                AddImage(98, 4, 103);
                AddImage(5, 124, 103);
                AddImage(5, 65, 103);
                AddImage(5, 4, 103);
                AddImage(18, 16, 3604, 2052);
                AddImage(18, 85, 3604, 2052);
                AddImage(102, 16, 3604, 2052);
                AddImage(102, 85, 3604, 2052);
                AddImage(222, 16, 3604, 2052);
                AddImage(223, 85, 3604, 2052);

                string armorNameText = armor.Name;

                if (armorNameText == null)
                {
                    armorNameText = "";
                }

                armorNameText = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(armorNameText);

                if (armorNameText == null)
                {
                    armorNameText = "";
                }

                string armorTypeText = "";

                if (armor.TierLevel > 0 && armor.Dungeon != DungeonEnum.None)
                {
                    armorTypeText = Item.GetDungeonName(weapon.Dungeon) + " Dungeon: Tier " + armor.TierLevel.ToString();
                }

                else if (!(armor.Resource == CraftResource.Iron || armor.Resource == CraftResource.RegularWood || armor.Resource == CraftResource.RegularLeather))
                {
                    armorTypeText = CraftResources.GetCraftResourceName(armor.Resource);
                }

                double armorValue = (double)armor.RevertArmorBase;

                string meditationText = "0%";
                string suitThemeText  = "Resistance";

                double fullSuitArmorValue = armor.ArmorBase;
                double fullSuitDexPenalty = 0;
                double fullSuitMeditation = 0;

                string fullSuitMeditationText = "0%";

                List <string> m_SuitEffects      = new List <string>();
                List <string> m_SuitEffectValues = new List <string>();

                switch (armor.Dungeon)
                {
                }

                switch (armor.MeditationAllowance)
                {
                case ArmorMeditationAllowance.None: meditationText = "0%"; break;

                case ArmorMeditationAllowance.Quarter: meditationText = "25%"; break;

                case ArmorMeditationAllowance.Half: meditationText = "50%"; break;

                case ArmorMeditationAllowance.ThreeQuarter: meditationText = "75%"; break;

                case ArmorMeditationAllowance.All: meditationText = "100%"; break;
                }

                switch (displayMode)
                {
                case DisplayMode.Normal:
                    //Guide
                    AddButton(18, 15, 2094, 2095, 2, GumpButtonType.Reply, 0);
                    AddLabel(16, -3, 149, "Guide");

                    //Display Mode
                    if (armor.TierLevel > 0)
                    {
                        AddLabel(231, 25, 149, "Base Values");
                        AddButton(327, 29, 1210, 1209, 1, GumpButtonType.Reply, 0);
                    }

                    //Description
                    AddLabel(Utility.CenteredTextOffset(115, armorNameText), 25, 2603, armorNameText);
                    AddLabel(Utility.CenteredTextOffset(115, armorTypeText), 45, 2603, armorTypeText);

                    //Image
                    AddItem(85 + armor.IconOffsetX, 80 + armor.IconOffsetY, armor.IconItemId, armor.IconHue);

                    //Properties
                    AddLabel(231, 45, textHue, "Armor:");
                    AddLabel(281, 45, 2603, Utility.CreateDecimalString(armorValue, 1));

                    AddLabel(212, 65, textHue, "Dex Loss:");
                    AddLabel(280, 65, 2603, armor.DexBonus.ToString());

                    AddLabel(212, 85, textHue, "Durability:");
                    if (showDurability)
                    {
                        AddLabel(280, 85, 2603, armor.HitPoints.ToString() + "/" + armor.MaxHitPoints.ToString());
                    }
                    else
                    {
                        AddLabel(280, 85, 2603, "?/?");
                    }

                    AddLabel(207, 105, textHue, "Meditation:");
                    AddLabel(280, 105, 2603, meditationText);

                    if (armor.TierLevel > 0)
                    {
                        AddLabel(175, 165, textHue, "Arcane Charges:");
                        AddLabel(280, 165, 2603, armor.ArcaneCharges.ToString());
                    }

                    if (armor.TierLevel > 0)
                    {
                        AddLabel(207, 185, textHue, "Experience:");
                        AddLabel(279, 185, 2603, armor.Experience.ToString() + "/250");
                    }

                    //Theme
                    if (armor.TierLevel > 0)
                    {
                        AddLabel(Utility.CenteredTextOffset(113, "Suit Theme"), 165, textHue, "Suit Theme");
                        AddLabel(Utility.CenteredTextOffset(115, suitThemeText), 185, 2603, suitThemeText);
                    }
                    break;

                case DisplayMode.Adjusted:
                    //Guide
                    AddButton(18, 15, 2094, 2095, 2, GumpButtonType.Reply, 0);
                    AddLabel(16, -3, 149, "Guide");

                    //Display Mode
                    AddLabel(209, 25, 149, "Full Suit Effects");
                    AddButton(327, 29, 1210, 1209, 1, GumpButtonType.Reply, 0);

                    //Description
                    AddLabel(82, 25, 2603, "Full Suit");
                    AddLabel(54, 45, 2603, armorTypeText);

                    //Image
                    AddItem(85 + armor.IconOffsetX, 80 + armor.IconOffsetY, armor.IconItemId, armor.IconHue);

                    //Suit Effects
                    int startY = 45;

                    for (int a = 0; a < m_SuitEffects.Count; a++)
                    {
                        AddLabel(Utility.CenteredTextOffset(260, m_SuitEffects[a]), startY, textHue, m_SuitEffects[a]);
                        AddLabel(Utility.CenteredTextOffset(260, m_SuitEffectValues[a]), startY + 20, 2603, m_SuitEffectValues[a]);

                        startY += 40;
                    }

                    //Properties
                    AddLabel(33, 145, textHue, "Total Armor:");
                    AddLabel(115, 145, 2603, fullSuitArmorValue.ToString());

                    AddLabel(51, 165, textHue, "Dex Loss:");
                    AddLabel(115, 165, 2603, fullSuitDexPenalty.ToString());

                    AddLabel(46, 185, textHue, "Meditation:");
                    AddLabel(115, 185, 2603, fullSuitMeditationText);
                    break;
                }
            }

            #endregion

            #region Shield

            if (shield != null)
            {
                AddImage(220, 123, 103);
                AddImage(220, 65, 103);
                AddImage(220, 4, 103);
                AddImage(98, 124, 103);
                AddImage(98, 65, 103);
                AddImage(98, 4, 103);
                AddImage(5, 124, 103);
                AddImage(5, 65, 103);
                AddImage(5, 4, 103);
                AddImage(18, 16, 3604, 2052);
                AddImage(18, 85, 3604, 2052);
                AddImage(102, 16, 3604, 2052);
                AddImage(102, 85, 3604, 2052);
                AddImage(222, 16, 3604, 2052);
                AddImage(223, 85, 3604, 2052);

                string shieldNameText = shield.Name;

                if (shieldNameText == null)
                {
                    shieldNameText = "";
                }

                shieldNameText = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(shieldNameText);

                if (shieldNameText == null)
                {
                    shieldNameText = "";
                }

                string shieldTypeText = "";

                if (shield.TierLevel > 0 && shield.Dungeon != DungeonEnum.None)
                {
                    shieldTypeText = Item.GetDungeonName(weapon.Dungeon) + " Dungeon: Tier " + shield.TierLevel.ToString();
                }

                else if (!(shield.Resource == CraftResource.Iron || shield.Resource == CraftResource.RegularWood))
                {
                    shieldTypeText = CraftResources.GetCraftResourceName(shield.Resource);
                }

                double armorValue = shield.ArmorBase;
                double dexPenalty = shield.DexBonus;

                double parryChance     = from.Skills[SkillName.Parry].Value * BaseShield.ShieldParrySkillScalar;
                double damageReduction = 1.0 - BaseShield.ShieldParryDamageScalar;

                string meditationText = "0%";
                string effectText     = "Resistance";

                switch (displayMode)
                {
                case DisplayMode.Normal:
                    //Guide
                    AddButton(18, 15, 2094, 2095, 2, GumpButtonType.Reply, 0);
                    AddLabel(16, -3, 149, "Guide");

                    //Display Mode
                    AddButton(327, 29, 1210, 1209, 1, GumpButtonType.Reply, 0);
                    AddLabel(231, 25, 149, "Base Values");

                    //Description
                    AddLabel(Utility.CenteredTextOffset(115, shieldNameText), 25, 2603, shieldNameText);
                    AddLabel(Utility.CenteredTextOffset(115, shieldTypeText), 45, 2603, shieldTypeText);

                    //Image
                    AddItem(85 + shield.IconOffsetX, 80 + shield.IconOffsetY, shield.IconItemId, shield.IconHue);

                    //Properties
                    AddLabel(228, 45, textHue, "Armor:");
                    AddLabel(281, 45, 2603, armorValue.ToString());

                    AddLabel(210, 65, textHue, "Dex Loss:");
                    AddLabel(280, 65, 2603, dexPenalty.ToString());

                    AddLabel(210, 85, textHue, "Durability:");
                    if (success)
                    {
                        AddLabel(280, 85, 2603, shield.HitPoints.ToString() + "/" + shield.MaxHitPoints.ToString());
                    }
                    else
                    {
                        AddLabel(280, 85, 2603, "?/?");
                    }

                    AddLabel(205, 105, textHue, "Meditation:");
                    AddLabel(280, 105, 2603, meditationText);

                    if (shield.TierLevel > 0)
                    {
                        AddLabel(174, 165, textHue, "Arcane Charges:");
                        AddLabel(280, 165, 2603, shield.ArcaneCharges.ToString());
                    }

                    if (shield.TierLevel > 0)
                    {
                        AddLabel(206, 185, textHue, "Experience:");
                        AddLabel(279, 185, 2603, shield.Experience.ToString() + "/250");
                    }

                    //Shield Effect
                    if (shield.TierLevel > 0)
                    {
                        AddLabel(Utility.CenteredTextOffset(113, "Shield Effect"), 165, textHue, "Shield Effect");
                        AddLabel(Utility.CenteredTextOffset(115, effectText), 185, 2603, effectText);
                    }
                    break;

                case DisplayMode.Adjusted:
                    //Guide
                    AddButton(18, 15, 2094, 2095, 2, GumpButtonType.Reply, 0);
                    AddLabel(16, -3, 149, "Guide");

                    //Display Mode
                    AddLabel(231, 25, 149, "Your Values");
                    AddButton(327, 29, 1210, 1209, 1, GumpButtonType.Reply, 0);

                    //Description
                    AddLabel(Utility.CenteredTextOffset(115, shieldNameText), 25, 2603, shieldNameText);
                    AddLabel(Utility.CenteredTextOffset(115, shieldTypeText), 45, 2603, shieldTypeText);

                    //Image
                    AddItem(85 + shield.IconOffsetX, 80 + shield.IconOffsetY, shield.IconItemId, shield.IconHue);

                    //Values
                    string parryChanceText    = Utility.CreateDecimalPercentageString(parryChance, 1);
                    string parryReductionText = Utility.CreateDecimalPercentageString(damageReduction, 0);

                    AddLabel(218, 45, textHue, "Parry Chance");
                    AddLabel(Utility.CenteredTextOffset(260, parryChanceText), 65, 2603, parryChanceText);

                    AddLabel(190, 84, textHue, "Parry Damage Reduction");
                    AddLabel(Utility.CenteredTextOffset(260, parryReductionText), 104, 2603, parryReductionText);

                    //Properties
                    AddLabel(68, 145, textHue, "Armor:");
                    AddLabel(115, 145, 2603, armorValue.ToString());

                    AddLabel(49, 165, textHue, "Dex Loss:");
                    AddLabel(115, 165, 2603, dexPenalty.ToString());

                    AddLabel(44, 185, textHue, "Meditation:");
                    AddLabel(115, 185, 2603, meditationText);
                    break;
                }
            }

            #endregion

            #region Instrument

            if (instrument != null)
            {
                AddImage(220, 123, 103);
                AddImage(220, 65, 103);
                AddImage(220, 4, 103);
                AddImage(98, 124, 103);
                AddImage(98, 65, 103);
                AddImage(98, 4, 103);
                AddImage(5, 124, 103);
                AddImage(5, 65, 103);
                AddImage(5, 4, 103);
                AddImage(18, 16, 3604, 2052);
                AddImage(18, 85, 3604, 2052);
                AddImage(102, 16, 3604, 2052);
                AddImage(102, 85, 3604, 2052);
                AddImage(222, 16, 3604, 2052);
                AddImage(223, 85, 3604, 2052);

                string instrumentNameText = instrument.Name;

                if (instrumentNameText == null)
                {
                    instrumentNameText = "";
                }

                instrumentNameText = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(instrumentNameText);

                if (instrumentNameText == null)
                {
                    instrumentNameText = "";
                }

                string instrumentTypeText = "";

                if (instrument.TierLevel > 0 && instrument.Dungeon != DungeonEnum.None)
                {
                    instrumentTypeText = Item.GetDungeonName(instrument.Dungeon) + " Dungeon: Tier " + instrument.TierLevel.ToString();
                }

                else if (instrument.Resource != CraftResource.RegularWood)
                {
                    instrumentTypeText = CraftResources.GetCraftResourceName(instrument.Resource);
                }

                double bardSkillBonus = BaseInstrument.GetBardBonusSkill(m_From, null, instrument);
                double effectiveSkill = 0;

                switch (m_BardMode)
                {
                case BardMode.Provocation: effectiveSkill = m_From.Skills[SkillName.Provocation].Value + bardSkillBonus; break;

                case BardMode.Peacemaking: effectiveSkill = m_From.Skills[SkillName.Peacemaking].Value + bardSkillBonus; break;

                case BardMode.Discordance: effectiveSkill = m_From.Skills[SkillName.Discordance].Value + bardSkillBonus; break;
                }

                double normal10 = BaseInstrument.GetBardSuccessChance(effectiveSkill, 10);
                double slayer10 = BaseInstrument.GetBardSuccessChance(effectiveSkill + BaseInstrument.SlayerSkillBonus, 10);

                double normal20 = BaseInstrument.GetBardSuccessChance(effectiveSkill, 20);
                double slayer20 = BaseInstrument.GetBardSuccessChance(effectiveSkill + BaseInstrument.SlayerSkillBonus, 20);

                double normal30 = BaseInstrument.GetBardSuccessChance(effectiveSkill, 30);
                double slayer30 = BaseInstrument.GetBardSuccessChance(effectiveSkill + BaseInstrument.SlayerSkillBonus, 30);

                double normal40 = BaseInstrument.GetBardSuccessChance(effectiveSkill, 40);
                double slayer40 = BaseInstrument.GetBardSuccessChance(effectiveSkill + BaseInstrument.SlayerSkillBonus, 40);

                double normal50 = BaseInstrument.GetBardSuccessChance(effectiveSkill, 50);
                double slayer50 = BaseInstrument.GetBardSuccessChance(effectiveSkill + BaseInstrument.SlayerSkillBonus, 50);

                double normalMinimum = effectiveSkill * BaseInstrument.MinimumEffectiveChanceScalar;
                double slayerMinimum = (effectiveSkill + BaseInstrument.SlayerSkillBonus) * BaseInstrument.MinimumEffectiveChanceScalar;

                switch (displayMode)
                {
                case DisplayMode.Normal:
                    //Guide
                    AddButton(18, 15, 2094, 2095, 2, GumpButtonType.Reply, 0);
                    AddLabel(16, -3, 149, "Guide");

                    //Description
                    AddLabel(Utility.CenteredTextOffset(115, instrumentNameText), 25, 2603, instrumentNameText);
                    AddLabel(Utility.CenteredTextOffset(115, instrumentTypeText), 45, 2603, instrumentTypeText);

                    //Display Mode
                    AddLabel(231, 25, 149, "Base Values");
                    AddButton(327, 29, 1210, 1209, 1, GumpButtonType.Reply, 0);

                    //Image
                    AddItem(75 + instrument.IconOffsetX, 95 + instrument.IconOffsetY, instrument.IconItemId, instrument.IconHue);

                    //Properties
                    AddLabel(212, 45, textHue, "Durability:");
                    AddLabel(281, 45, 2603, instrument.UsesRemaining.ToString() + "/" + instrument.InitMaxUses.ToString());

                    AddLabel(207, 65, textHue, "Bard Skill:");
                    AddLabel(280, 65, 2603, "+" + bardSkillBonus);

                    if (instrument.SlayerGroup != SlayerGroupType.None)
                    {
                        string slayerName = instrument.SlayerGroup.ToString() + " Slaying";
                        AddLabel(Utility.CenteredTextOffset(280, slayerName), 85, 2603, slayerName);
                    }

                    if (instrument.TierLevel > 0)
                    {
                        AddLabel(169, 165, textHue, "Arcane Charges:");
                        AddLabel(280, 165, 2603, instrument.ArcaneCharges.ToString());
                    }

                    if (instrument.TierLevel > 0)
                    {
                        AddLabel(199, 185, textHue, "Experience:");
                        AddLabel(279, 185, 2603, instrument.Experience.ToString() + "/250");
                    }
                    break;

                case DisplayMode.Adjusted:
                    //Guide
                    AddButton(18, 15, 2094, 2095, 2, GumpButtonType.Reply, 0);
                    AddLabel(16, -3, 149, "Guide");

                    //Display Mode
                    AddButton(327, 29, 1210, 1209, 1, GumpButtonType.Reply, 0);
                    AddLabel(231, 25, 149, "Your Values");

                    //Description
                    AddLabel(Utility.CenteredTextOffset(115, instrumentNameText), 25, 2603, instrumentNameText);
                    AddLabel(Utility.CenteredTextOffset(115, instrumentTypeText), 45, 2603, instrumentTypeText);

                    //Image
                    AddItem(75 + instrument.IconOffsetX, 95 + instrument.IconOffsetY, instrument.IconItemId, instrument.IconHue);

                    //Skill Type
                    AddLabel(65, 149, 2562, "Displaying");
                    AddButton(33, 174, 2223, 2223, 3, GumpButtonType.Reply, 0);
                    AddButton(138, 174, 2224, 2224, 4, GumpButtonType.Reply, 0);

                    switch (m_BardMode)
                    {
                    case BardMode.Provocation: AddLabel(61, 170, BaseInstrument.ProvokedTextHue, "Provocation"); break;

                    case BardMode.Peacemaking: AddLabel(61, 170, BaseInstrument.PacifiedTextHue, "Peacemaking"); break;

                    case BardMode.Discordance: AddLabel(61, 170, BaseInstrument.DiscordedTextHue, "Discordance"); break;
                    }

                    AddLabel(40, 190, textHue, "Effective Skill:");
                    AddLabel(136, 190, 2603, Utility.CreateDecimalString(effectiveSkill, 1));

                    AddLabel(172, 50, 2562, "Success vs Difficulty Value");
                    AddLabel(245, 70, textHue, "Normal");
                    if (instrument.SlayerGroup != SlayerGroupType.None)
                    {
                        AddLabel(296, 70, textHue, "Slayer");
                    }

                    AddLabel(186, 90, textHue, "Diff");
                    AddLabel(221, 90, textHue, "10:");
                    AddLabel(250, 90, 2603, Utility.CreateDecimalPercentageString(normal10, 1));
                    if (instrument.SlayerGroup != SlayerGroupType.None)
                    {
                        AddLabel(298, 90, 2603, Utility.CreateDecimalPercentageString(slayer10, 1));
                    }

                    AddLabel(186, 110, textHue, "Diff 20:");
                    AddLabel(250, 110, 2603, Utility.CreateDecimalPercentageString(normal20, 1));
                    if (instrument.SlayerGroup != SlayerGroupType.None)
                    {
                        AddLabel(298, 110, 2603, Utility.CreateDecimalPercentageString(slayer20, 1));
                    }

                    AddLabel(186, 130, textHue, "Diff 30:");
                    AddLabel(250, 130, 2603, Utility.CreateDecimalPercentageString(normal30, 1));
                    if (instrument.SlayerGroup != SlayerGroupType.None)
                    {
                        AddLabel(298, 130, 2603, Utility.CreateDecimalPercentageString(slayer30, 1));
                    }

                    AddLabel(186, 150, textHue, "Diff 40:");
                    AddLabel(250, 150, 2603, Utility.CreateDecimalPercentageString(normal40, 1));
                    if (instrument.SlayerGroup != SlayerGroupType.None)
                    {
                        AddLabel(298, 150, 2603, Utility.CreateDecimalPercentageString(slayer40, 1));
                    }

                    AddLabel(186, 170, textHue, "Diff 50:");
                    AddLabel(250, 170, 2603, Utility.CreateDecimalPercentageString(normal50, 1));
                    if (instrument.SlayerGroup != SlayerGroupType.None)
                    {
                        AddLabel(298, 170, 2603, Utility.CreateDecimalPercentageString(slayer50, 1));
                    }

                    AddLabel(187, 190, textHue, "Minimum:");
                    AddLabel(250, 190, 2603, Utility.CreateDecimalPercentageString(normalMinimum, 1));
                    if (instrument.SlayerGroup != SlayerGroupType.None)
                    {
                        AddLabel(298, 190, 2603, Utility.CreateDecimalPercentageString(slayerMinimum, 1));
                    }
                    break;
                }
            }

            #endregion
        }
Пример #22
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_From == null || m_Item == null)
            {
                return;
            }
            if (m_From.Deleted || !m_From.Alive || m_Item.Deleted)
            {
                return;
            }

            BaseWeapon     weapon     = m_Item as BaseWeapon;
            BaseArmor      armor      = m_Item as BaseArmor;
            BaseShield     shield     = m_Item as BaseShield;
            BaseInstrument instrument = m_Item as BaseInstrument;

            bool isWeapon     = weapon != null;
            bool isArmor      = armor != null && shield == null;
            bool isShield     = shield != null;
            bool isInstrument = instrument != null;

            bool closeGump = true;

            switch (info.ButtonID)
            {
            //Display Made
            case 1:
                switch (m_DisplayMode)
                {
                case DisplayMode.Normal:
                    if (isArmor && !isShield)
                    {
                        if (armor.TierLevel > 0)
                        {
                            m_DisplayMode = DisplayMode.Adjusted;
                            m_From.SendSound(0x055);
                        }
                    }

                    else
                    {
                        m_DisplayMode = DisplayMode.Adjusted;
                        m_From.SendSound(0x055);
                    }
                    break;

                case DisplayMode.Adjusted:
                    m_DisplayMode = DisplayMode.Normal;
                    m_From.SendSound(0x055);
                    break;
                }

                closeGump = false;
                break;

            //Guide
            case 2:
                closeGump = false;
                break;

            //Barding Skill Previous
            case 3:
                if (isInstrument)
                {
                    switch (m_BardMode)
                    {
                    case BardMode.Provocation: m_BardMode = BardMode.Discordance; break;

                    case BardMode.Peacemaking: m_BardMode = BardMode.Provocation; break;

                    case BardMode.Discordance: m_BardMode = BardMode.Peacemaking; break;
                    }
                }

                closeGump = false;
                break;

            //Barding Skill Right
            case 4:
                if (isInstrument)
                {
                    switch (m_BardMode)
                    {
                    case BardMode.Provocation: m_BardMode = BardMode.Peacemaking; break;

                    case BardMode.Peacemaking: m_BardMode = BardMode.Discordance; break;

                    case BardMode.Discordance: m_BardMode = BardMode.Provocation; break;
                    }
                }

                closeGump = false;
                break;
            }

            if (!closeGump)
            {
                m_From.CloseGump(typeof(ArmsLoreGump));
                m_From.SendGump(new ArmsLoreGump(m_From, m_Item, m_Success, m_DisplayMode, m_BardMode));
            }
        }
Пример #23
0
        public DreadGuard() : base(AIType.AI_RangedMelee, FightMode.Closest, 10, 1, 0.1, 0.1)
        {
            Body      = 0x190;
            Name      = NameList.RandomName("male");
            SpeechHue = Utility.RandomDyedHue();
            Title     = "the dread guarded";

            Hue = Utility.RandomSkinHue();

            Utility.AssignRandomHair(this, true);
            if (Utility.RandomBool())
            {
                Utility.AssignRandomFacialHair(this, HairHue);
            }

            SetSkill(SkillName.Swords, 100.0);
            SetSkill(SkillName.Macing, 100.0);
            SetSkill(SkillName.Tactics, 100.0);
            SetSkill(SkillName.MagicResist, 85.0, 90.0);
            SetSkill(SkillName.Parry, 100.0, 120.0);
            SetSkill(SkillName.Wrestling, 120.0);
            SetSkill(SkillName.Archery, 120.0);
            SetSkill(SkillName.Anatomy, 120.0);

            Fame  = 9000;
            Karma = -9000;

            SetStr(425, 500);
            SetDex(120, 135);
            SetInt(48, 50);

            SetHits(650, 700);

            SetDamage(16, 19);

            SetDamageType(ResistanceType.Physical, 50);
            SetDamageType(ResistanceType.Fire, 25);
            SetDamageType(ResistanceType.Cold, 25);

            VirtualArmor = 15;

            AddItem(Rehued(new PlateChest(), 2407));
            AddItem(Rehued(new PlateArms(), 2407));
            AddItem(Rehued(new PlateHelm(), 2407));
            AddItem(Rehued(new PlateGloves(), 2407));
            AddItem(Rehued(new PlateLegs(), 2407));
            AddItem(Rehued(new PlateGorget(), 2407));
            m_RangedWeapon = (BaseWeapon)Resourced(new Crossbow(), CraftResource.Bronze);
            AddItem(NotCorpseCont(m_RangedWeapon));
            if (0.75 > Utility.RandomDouble())
            {
                m_MeleeWeapon = new ExecutionersAxe();
            }
            else
            {
                m_MeleeWeapon = new Longsword();
                m_MeleeShield = new HeaterShield();
                PackItem(Rehued(m_MeleeShield, 2407));
            }

            PackItem(Rehued(m_MeleeWeapon, 2407));
            AddItem(new BodySash(1636));
            AddItem(new Cloak(1636));

            //PackItem( new Gold( Utility.Random( 150, 200 ) ) );
            PackItem(new Bolt(50));
        }
Пример #24
0
        public BaseShieldGuard() : base(AIType.AI_Melee, FightMode.Aggressor, 14, 1, 0.8, 1.6)
        {
            InitStats(1000, 1000, 1000);
            Title = "the guard";

            SpeechHue = Utility.RandomDyedHue();

            Hue = Utility.RandomSkinHue();

            if (Female = Utility.RandomBool())
            {
                Body = 0x191;
                Name = NameList.RandomName("female");

                AddItem(new FemalePlateChest());
                AddItem(new PlateArms());
                AddItem(new PlateLegs());

                switch (Utility.Random(2))
                {
                case 0: AddItem(new Doublet(Utility.RandomNondyedHue())); break;

                case 1: AddItem(new BodySash(Utility.RandomNondyedHue())); break;
                }

                switch (Utility.Random(2))
                {
                case 0: AddItem(new Skirt(Utility.RandomNondyedHue())); break;

                case 1: AddItem(new Kilt(Utility.RandomNondyedHue())); break;
                }
            }
            else
            {
                Body = 0x190;
                Name = NameList.RandomName("male");

                AddItem(new PlateChest());
                AddItem(new PlateArms());
                AddItem(new PlateLegs());

                switch (Utility.Random(3))
                {
                case 0: AddItem(new Doublet(Utility.RandomNondyedHue())); break;

                case 1: AddItem(new Tunic(Utility.RandomNondyedHue())); break;

                case 2: AddItem(new BodySash(Utility.RandomNondyedHue())); break;
                }
            }

            Utility.AssignRandomHair(this);
            if (Utility.RandomBool())
            {
                Utility.AssignRandomFacialHair(this, HairHue);
            }

            VikingSword weapon = new VikingSword();

            weapon.Movable = false;
            AddItem(weapon);

            BaseShield shield = Shield;

            shield.Movable = false;
            AddItem(shield);

            PackGold(250, 300);

            Skills[SkillName.Anatomy].Base      = 120.0;
            Skills[SkillName.Tactics].Base      = 120.0;
            Skills[SkillName.Swords].Base       = 120.0;
            Skills[SkillName.MagicResist].Base  = 120.0;
            Skills[SkillName.DetectHidden].Base = 100.0;
        }
Пример #25
0
        public DreadLord() : base(AIType.AI_RangedMelee, FightMode.Closest, 10, 1, 0.1, 0.1)
        {
            Body      = 0x190;
            Name      = NameList.RandomName("male");
            SpeechHue = Utility.RandomDyedHue();
            Title     = "the dread lord";

            Hue = Utility.RandomSkinHue();

            Utility.AssignRandomHair(this, true);
            if (Utility.RandomBool())
            {
                Utility.AssignRandomFacialHair(this, HairHue);
            }

            SetSkill(SkillName.Swords, 120.0);
            SetSkill(SkillName.Macing, 120.0);
            SetSkill(SkillName.Tactics, 120.0);
            SetSkill(SkillName.MagicResist, 100.0);
            SetSkill(SkillName.Parry, 120.0);
            SetSkill(SkillName.Wrestling, 120.0);
            SetSkill(SkillName.Archery, 120.0);
            SetSkill(SkillName.Anatomy, 120.0);

            Fame  = 9000;
            Karma = -9000;

            SetStr(650, 700);
            SetDex(120, 135);
            SetInt(48, 50);

            SetHits(690, 750);

            SetDamage(20, 25);



            VirtualArmor = 100;

            AddItem(NotCorpseCont(Immovable(new RoyalPlateChest())));
            AddItem(NotCorpseCont(Immovable(new RoyalPlateArms())));
            AddItem(NotCorpseCont(Immovable(new RoyalPlateHelm())));
            AddItem(NotCorpseCont(Immovable(new RoyalPlateGloves())));
            AddItem(NotCorpseCont(Immovable(new RoyalPlateLegs())));
            AddItem(NotCorpseCont(Immovable(new RoyalPlateGorget())));
            AddItem(NotCorpseCont(Immovable(new RoyalPlateBoots())));
            m_RangedWeapon = (BaseWeapon)Resourced(new HeavyCrossbow(), CraftResource.Bronze);
            AddItem(Identify(NotCorpseCont(m_RangedWeapon)));
            if (0.75 > Utility.RandomDouble())
            {
                m_MeleeWeapon = new OrnateWarAxe();
            }
            else
            {
                m_MeleeWeapon = new RadiantWarSword();
                m_MeleeShield = new RoyalShield();
                PackItem(NotCorpseCont(m_MeleeShield));
            }

            PackItem(NotCorpseCont(m_MeleeWeapon));
            AddItem(new BodySash(1636));
            AddItem(NotCorpseCont(new RoyalCloak()));

            //PackItem( new Gold( Utility.Random( 300, 500 ) ) );
            PackItem(new Bolt(50));
        }
Пример #26
0
        public BaseShieldGuard() : base(AIType.AI_Melee, FightMode.Agressor, 14, 1, 0.8, 1.6)
        {
            Job = JobFragment.guard;

            Female = Utility.RandomBool();
            Body   = Female ? 401 : 400;
            Name   = NameList.RandomName(Female ? "female" : "male");
            Hue    = Utility.RandomSkinHue();
            SetStr(9000);
            SetDex(9000);
            SetInt(9000);
            Karma = 100;


            SetSkill(SkillName.Tactics, 90.1, 100);
            SetSkill(SkillName.MagicResist, 90.1, 100);
            SetSkill(SkillName.Parry, 90.1, 100);
            SetSkill(SkillName.Swords, 90.1, 100);
            SetSkill(SkillName.Macing, 90.1, 100);
            SetSkill(SkillName.Fencing, 90.1, 100);
            SetSkill(SkillName.Wrestling, 90.1, 100);
            SetSkill(SkillName.DetectHidden, 90.1, 100);
            SetSkill(SkillName.Forensics, 90.1, 100);


            Item item = null;

            if (!Female)
            {
                item     = AddRandomHair();
                item.Hue = Utility.RandomHairHue();
                item     = AddRandomFacialHair(item.Hue);
                item     = new Shirt();
                item.Hue = Utility.RandomNondyedHue();
                AddItem(item);
                item     = new ShortPants();
                item.Hue = Utility.RandomNondyedHue();
                AddItem(item);
                item = new PlateChest();
                AddItem(item);
                item = new PlateLegs();
                AddItem(item);
                item = new PlateArms();
                AddItem(item);
                item     = new Tunic();
                item.Hue = Utility.RandomRedHue();
                AddItem(item);
            }
            else
            {
                item     = AddRandomHair();
                item.Hue = Utility.RandomHairHue();
                item     = new Shirt();
                item.Hue = Utility.RandomNondyedHue();
                AddItem(item);
                item     = new Skirt();
                item.Hue = Utility.RandomNondyedHue();
                AddItem(item);
                item = new PlateChest();
                AddItem(item);
                item = new PlateLegs();
                AddItem(item);
                item = new PlateArms();
                AddItem(item);
                item     = new Tunic();
                item.Hue = Utility.RandomRedHue();
                AddItem(item);
            }

            VikingSword weapon = new VikingSword();

            weapon.Movable = false;
            AddItem(weapon);

            BaseShield shield = Shield;

            shield.Movable = false;
            AddItem(shield);
            PackGold(15, 100);
        }
Пример #27
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (!e.Handled && e.Mobile.InRange(this.Location, 2))
            {
                if (e.HasKeyword(Keyword))
                {
                    e.Handled = true;

                    Mobile from = e.Mobile;
                    Guild  g    = from.Guild as Server.Guilds.Guild;

                    if (from.Karma < (int)Noto.Great)
                    {
                        Say("Thou art not famous enough to join our ranks.");
                        return;
                    }
                    else if (g != null && g.Type != GuildType.Regular && g.Type != Type)
                    {
                        Say("Thou art not properly affiliated to join our ranks.");
                        return;
                    }
                    else
                    {
                        Container  pack      = from.Backpack;
                        BaseShield shield    = Shield;
                        Item       twoHanded = from.FindItemOnLayer(Layer.TwoHanded);

                        if ((pack != null && pack.FindItemByType(shield.GetType()) != null) || (twoHanded != null && shield.GetType().IsAssignableFrom(twoHanded.GetType())))
                        {
                            Say("Why dost thou ask about virtue guards when thou art one?");
                            shield.Delete();
                        }
                        else if (from.PlaceInBackpack(shield))
                        {
                            Say(Utility.Random(1007101, 5));
                            Say("Welcome to our ranks.  Here is thy shield.");
                            from.AddToBackpack(shield);
                        }
                        else
                        {
                            from.SendLocalizedMessage(502868);                               // Your backpack is too full.
                            shield.Delete();
                        }
                    }
                }
                else
                {
                    if (Utility.RandomBool())
                    {
                        if (SignupNumber > 0)
                        {
                            Say(SignupNumber);
                        }
                        else if (SignupString != "")
                        {
                            Say(SignupString);
                        }
                        e.Handled = true;
                    }
                }
            }

            base.OnSpeech(e);
        }
Пример #28
0
        public BaseShieldGuard() : base(AIType.AI_Melee, FightMode.Aggressor, 14, 1, 0.8, 1.6)
        {
            InitStats(1000, 1000, 1000);
            Title = "the guard";

            SpeechHue = Utility.RandomDyedHue();

            Hue = Utility.RandomSkinHue();

            if (Female = Utility.RandomBool())
            {
                Body = 0x191;
                Name = NameList.RandomName("female");

                AddItem(new FemalePlateChest());
                AddItem(new PlateArms());
                AddItem(new PlateLegs());

                switch (Utility.Random(2))
                {
                case 0: AddItem(new Doublet(Utility.RandomNondyedHue())); break;

                case 1: AddItem(new BodySash(Utility.RandomNondyedHue())); break;
                }

                switch (Utility.Random(2))
                {
                case 0: AddItem(new Skirt(Utility.RandomNondyedHue())); break;

                case 1: AddItem(new Kilt(Utility.RandomNondyedHue())); break;
                }
            }
            else
            {
                Body = 0x190;
                Name = NameList.RandomName("male");

                AddItem(new PlateChest());
                AddItem(new PlateArms());
                AddItem(new PlateLegs());

                switch (Utility.Random(3))
                {
                case 0: AddItem(new Doublet(Utility.RandomNondyedHue())); break;

                case 1: AddItem(new Tunic(Utility.RandomNondyedHue())); break;

                case 2: AddItem(new BodySash(Utility.RandomNondyedHue())); break;
                }
            }

            Item hair = new Item(Utility.RandomList(0x203B, 0x203C, 0x203D, 0x2044, 0x2045, 0x2047, 0x2049, 0x204A));

            hair.Hue     = Utility.RandomHairHue();
            hair.Layer   = Layer.Hair;
            hair.Movable = false;

            AddItem(hair);

            if (Utility.RandomBool() && !this.Female)
            {
                Item beard = new Item(Utility.RandomList(0x203E, 0x203F, 0x2040, 0x2041, 0x204B, 0x204C, 0x204D));

                beard.Hue     = hair.Hue;
                beard.Layer   = Layer.FacialHair;
                beard.Movable = false;

                AddItem(beard);
            }

            VikingSword weapon = new VikingSword();

            weapon.Movable = false;
            AddItem(weapon);

            BaseShield shield = Shield;

            shield.Movable = false;
            AddItem(shield);

            PackGold(250, 500);

            Skills[SkillName.Anatomy].Base      = 120.0;
            Skills[SkillName.Tactics].Base      = 120.0;
            Skills[SkillName.Swords].Base       = 120.0;
            Skills[SkillName.MagicResist].Base  = 120.0;
            Skills[SkillName.DetectHidden].Base = 100.0;
        }
Пример #29
0
        public static EnhanceResult Invoke(Mobile from, CraftSystem craftSystem, BaseTool tool, Item item, CraftResource resource, Type resType, ref object resMessage)
        {
            if (item == null)
            {
                return(EnhanceResult.BadItem);
            }

            if (!item.IsChildOf(from.Backpack))
            {
                return(EnhanceResult.NotInBackpack);
            }

            if (!(item is BaseArmor) && !(item is BaseWeapon))
            {
                return(EnhanceResult.BadItem);
            }

            if (item is IArcaneEquip)
            {
                IArcaneEquip eq = (IArcaneEquip)item;
                if (eq.IsArcane)
                {
                    return(EnhanceResult.BadItem);
                }
            }

            if (CraftResources.IsStandard(resource))
            {
                return(EnhanceResult.BadResource);
            }

            int num = craftSystem.CanCraft(from, tool, item.GetType());

            if (num > 0)
            {
                resMessage = num;
                return(EnhanceResult.None);
            }

            CraftItem craftItem = craftSystem.CraftItems.SearchFor(item.GetType());

            if (IsSpecial(item, craftSystem))
            {
                craftItem = craftSystem.CraftItems.SearchForSubclass(item.GetType());
            }

            if (craftItem == null || craftItem.Resources.Count == 0)
            {
                return(EnhanceResult.BadItem);
            }

            #region Mondain's Legacy
            if (craftItem.ForceNonExceptional)
            {
                return(EnhanceResult.BadItem);
            }
            #endregion

            bool allRequiredSkills = false;
            if (craftItem.GetSuccessChance(from, resType, craftSystem, false, ref allRequiredSkills) <= 0.0)
            {
                return(EnhanceResult.NoSkill);
            }

            CraftResourceInfo info = CraftResources.GetInfo(resource);

            if (info == null || info.ResourceTypes.Length == 0)
            {
                return(EnhanceResult.BadResource);
            }

            CraftAttributeInfo attributes = info.AttributeInfo;

            if (attributes == null)
            {
                return(EnhanceResult.BadResource);
            }

            int resHue = 0, maxAmount = 0;

            if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref resMessage))
            {
                return(EnhanceResult.NoResources);
            }

            if (craftSystem is DefBlacksmithy)
            {
                AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer;
                if (hammer != null)
                {
                    hammer.UsesRemaining--;
                    if (hammer.UsesRemaining < 1)
                    {
                        hammer.Delete();
                    }
                }
            }

            int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0;
            int dura = 0, luck = 0, lreq = 0, dinc = 0;
            int baseChance = 0;

            bool physBonus = false;
            bool fireBonus = false;
            bool coldBonus = false;
            bool nrgyBonus = false;
            bool poisBonus = false;
            bool duraBonus = false;
            bool luckBonus = false;
            bool lreqBonus = false;
            bool dincBonus = false;

            if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                if (!CraftResources.IsStandard(weapon.Resource))
                {
                    return(EnhanceResult.AlreadyEnhanced);
                }

                if (weapon.ExtendedWeaponAttributes.AssassinHoned > 0)
                {
                    return(EnhanceResult.BadItem);
                }

                baseChance = 20;

                dura = weapon.MaxHitPoints;
                luck = weapon.Attributes.Luck;
                lreq = weapon.WeaponAttributes.LowerStatReq;
                dinc = weapon.Attributes.WeaponDamage;

                fireBonus = (attributes.WeaponFireDamage > 0);
                coldBonus = (attributes.WeaponColdDamage > 0);
                nrgyBonus = (attributes.WeaponEnergyDamage > 0);
                poisBonus = (attributes.WeaponPoisonDamage > 0);

                duraBonus = (attributes.WeaponDurability > 0);
                luckBonus = (attributes.WeaponLuck > 0);
                lreqBonus = (attributes.WeaponLowerRequirements > 0);
                dincBonus = (dinc > 0);
            }
            else
            {
                BaseArmor armor = (BaseArmor)item;

                if (!CraftResources.IsStandard(armor.Resource))
                {
                    return(EnhanceResult.AlreadyEnhanced);
                }

                baseChance = 20;

                phys = armor.PhysicalResistance;
                fire = armor.FireResistance;
                cold = armor.ColdResistance;
                pois = armor.PoisonResistance;
                nrgy = armor.EnergyResistance;

                dura = armor.MaxHitPoints;
                luck = armor.Attributes.Luck;
                lreq = armor.ArmorAttributes.LowerStatReq;

                physBonus = (attributes.ArmorPhysicalResist > 0);
                fireBonus = (attributes.ArmorFireResist > 0);
                coldBonus = (attributes.ArmorColdResist > 0);
                nrgyBonus = (attributes.ArmorEnergyResist > 0);
                poisBonus = (attributes.ArmorPoisonResist > 0);

                duraBonus = (attributes.ArmorDurability > 0);
                luckBonus = (attributes.ArmorLuck > 0);
                lreqBonus = (attributes.ArmorLowerRequirements > 0);
                dincBonus = false;
            }

            int skill = from.Skills[craftSystem.MainSkill].Fixed / 10;

            if (skill >= 100)
            {
                baseChance -= (skill - 90) / 10;
            }

            EnhanceResult res = EnhanceResult.Success;

            PlayerMobile user = from as PlayerMobile;

            if (physBonus)
            {
                CheckResult(ref res, baseChance + phys);
            }

            if (fireBonus)
            {
                CheckResult(ref res, baseChance + fire);
            }

            if (coldBonus)
            {
                CheckResult(ref res, baseChance + cold);
            }

            if (nrgyBonus)
            {
                CheckResult(ref res, baseChance + nrgy);
            }

            if (poisBonus)
            {
                CheckResult(ref res, baseChance + pois);
            }

            if (duraBonus)
            {
                CheckResult(ref res, baseChance + (dura / 40));
            }

            if (luckBonus)
            {
                CheckResult(ref res, baseChance + 10 + (luck / 2));
            }

            if (lreqBonus)
            {
                CheckResult(ref res, baseChance + (lreq / 4));
            }

            if (dincBonus)
            {
                CheckResult(ref res, baseChance + (dinc / 4));
            }

            if (user.NextEnhanceSuccess)
            {
                user.NextEnhanceSuccess = false;
                user.SendLocalizedMessage(1149969); // The magical aura that surrounded you disipates and you feel that your item enhancement chances have returned to normal.
                res = EnhanceResult.Success;
            }

            switch (res)
            {
            case EnhanceResult.Broken:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                item.Delete();
                break;
            }

            case EnhanceResult.Success:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                if (item is BaseWeapon)
                {
                    BaseWeapon w = (BaseWeapon)item;

                    w.Resource = resource;

                    #region Mondain's Legacy
                    if (resource != CraftResource.Heartwood)
                    {
                        w.Attributes.WeaponDamage       += attributes.WeaponDamage;
                        w.Attributes.WeaponSpeed        += attributes.WeaponSwingSpeed;
                        w.Attributes.AttackChance       += attributes.WeaponHitChance;
                        w.Attributes.RegenHits          += attributes.WeaponRegenHits;
                        w.WeaponAttributes.HitLeechHits += attributes.WeaponHitLifeLeech;
                    }
                    else
                    {
                        switch (Utility.Random(6))
                        {
                        case 0:
                            w.Attributes.WeaponDamage += attributes.WeaponDamage;
                            break;

                        case 1:
                            w.Attributes.WeaponSpeed += attributes.WeaponSwingSpeed;
                            break;

                        case 2:
                            w.Attributes.AttackChance += attributes.WeaponHitChance;
                            break;

                        case 3:
                            w.Attributes.Luck += attributes.WeaponLuck;
                            break;

                        case 4:
                            w.WeaponAttributes.LowerStatReq += attributes.WeaponLowerRequirements;
                            break;

                        case 5:
                            w.WeaponAttributes.HitLeechHits += attributes.WeaponHitLifeLeech;
                            break;
                        }
                    }
                    #endregion

                    int hue = w.GetElementalDamageHue();
                    if (hue > 0)
                    {
                        w.Hue = hue;
                    }
                }
                #region Mondain's Legacy
                else if (item is BaseShield)
                {
                    BaseShield shield = (BaseShield)item;

                    shield.Resource = resource;

                    switch (resource)
                    {
                    case CraftResource.AshWood:
                        shield.ArmorAttributes.LowerStatReq += 20;
                        break;

                    case CraftResource.YewWood:
                        shield.Attributes.RegenHits += 1;
                        break;

                    case CraftResource.Heartwood:
                        switch (Utility.Random(7))
                        {
                        case 0:
                            shield.Attributes.BonusDex += 2;
                            break;

                        case 1:
                            shield.Attributes.BonusStr += 2;
                            break;

                        case 2:
                            shield.Attributes.ReflectPhysical += 5;
                            break;

                        case 3:
                            shield.Attributes.SpellChanneling = 1;
                            shield.Attributes.CastSpeed       = -1;
                            break;

                        case 4:
                            shield.ArmorAttributes.SelfRepair += 2;
                            break;

                        case 5:
                            shield.PhysicalBonus += 5;
                            break;

                        case 6:
                            shield.ColdBonus += 3;
                            break;
                        }
                        break;

                    case CraftResource.Bloodwood:
                        shield.Attributes.RegenHits += 2;
                        shield.Attributes.Luck      += 40;
                        break;

                    case CraftResource.Frostwood:
                        shield.Attributes.SpellChanneling = 1;
                        shield.Attributes.CastSpeed       = -1;
                        break;
                    }
                }
                #endregion
                else if (item is BaseArmor)             //Sanity
                {
                    ((BaseArmor)item).Resource = resource;

                    #region Mondain's Legacy
                    BaseArmor armor = (BaseArmor)item;

                    if (resource != CraftResource.Heartwood)
                    {
                        armor.Attributes.WeaponDamage += attributes.ArmorDamage;
                        armor.Attributes.AttackChance += attributes.ArmorHitChance;
                        armor.Attributes.RegenHits    += attributes.ArmorRegenHits;
                        //armor.ArmorAttributes.MageArmor += attributes.ArmorMage;
                    }
                    else
                    {
                        switch (Utility.Random(5))
                        {
                        case 0:
                            armor.Attributes.WeaponDamage += attributes.ArmorDamage;
                            break;

                        case 1:
                            armor.Attributes.AttackChance += attributes.ArmorHitChance;
                            break;

                        case 2:
                            armor.ArmorAttributes.MageArmor += attributes.ArmorMage;
                            break;

                        case 3:
                            armor.Attributes.Luck += attributes.ArmorLuck;
                            break;

                        case 4:
                            armor.ArmorAttributes.LowerStatReq += attributes.ArmorLowerRequirements;
                            break;
                        }
                    }
                    #endregion
                }

                break;
            }

            case EnhanceResult.Failure:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                break;
            }
            }

            return(res);
        }
 // Start is called before the first frame update
 void Start()
 {
     rb2d   = GetComponent <Rigidbody2D>();
     shield = GetComponent <BaseShield>();
 }