Пример #1
0
        /// <summary>
        /// Auto-equips the armor if the mobile can equip it.
        /// Else, the item is added to the mobile backpack.
        /// </summary>
        /// <param name="item">Item to equip</param>
        /// <param name="mustEquip">Forces the item to be equipped</param>
        /// <param name="m">Mobile to be equipped</param>
        /// <param name="t">Type of the item</param>
        private static void EquipArmor(BaseArmor item, bool mustEquip, Mobile m, Type t, int ehue)
        {
            Container pack   = m.Backpack;
            Layer     layer  = item.Layer;
            Item      equips = m.FindItemOnLayer(layer);

            item.Quality = ArmorQuality.Exceptional;

            if (mustEquip)
            {
                if (equips != null)
                {
                    pack.DropItem(equips);
                }
            }

            if (pack.FindItemByType(t) != null)
            {
                m.EquipItem(equips);
                return;
            }
            else
            {
                item.Hue = ehue;

                if (!Core.AOS)
                {
                    item.LootType = LootType.Regular;
                }

                if (mustEquip)
                {
                    if (equips != null)
                    {
                        pack.DropItem(equips);
                    }
                }

                if (m != null && m.EquipItem(item))
                {
                    return;
                }

                if (!mustEquip && pack != null)
                {
                    pack.DropItem(item);
                }
                else
                {
                    item.Delete();
                }
            }
        }
Пример #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int    scalar;
                double mageSkill = from.Skills[SkillName.Magery].Value;

                if (mageSkill >= 100.0)
                {
                    scalar = 3;
                }
                else if (mageSkill >= 90.0)
                {
                    scalar = 2;
                }
                else
                {
                    scalar = 1;
                }

                if (targeted is BaseWeapon)
                {
                    BaseWeapon Weapon = targeted as BaseWeapon;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(10);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment    = ((Utility.Random(3)) * scalar) + 1;
                            int augmentper = ((Utility.Random(5)) * scalar) + 5;

                            switch (Utility.Random(9))
                            {
                            case 0: Weapon.Attributes.AttackChance += augmentper; from.SendMessage("A true weapon strikes true wounds."); break;

                            case 1: Weapon.Attributes.BonusMana += augment; from.SendMessage("The spirit rises within."); break;

                            case 2: Weapon.Attributes.WeaponDamage += augmentper; from.SendMessage("A warrior is only as good as his best weapon."); break;

                            case 3: Weapon.Attributes.SpellChanneling = 1; from.SendMessage("The mage's best ally."); break;

                            case 4: Weapon.WeaponAttributes.HitDispel += augmentper; from.SendMessage("The bane of demons, the unsummoner."); break;

                            case 5: Weapon.WeaponAttributes.HitFireball += augmentper; from.SendMessage("What the blade leaves alive, the fire purifies."); break;

                            case 6: Weapon.WeaponAttributes.HitHarm += augmentper; from.SendMessage("Sometimes the sting can be worse."); break;

                            case 7: Weapon.WeaponAttributes.HitLightning += augmentper; from.SendMessage("The power of the storm is called to strike."); break;

                            case 8: Weapon.Attributes.WeaponSpeed += augmentper; from.SendMessage("What can beat speed but more speed?"); break;
                            }

                            from.PlaySound(0x1F5);
                            m_RuneStone.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the weapon!");
                            from.SendMessage("The weapon is damaged beyond repair!");
                            from.PlaySound(0x1F8);
                            Weapon.Delete();
                            m_RuneStone.Delete();
                        }
                    }
                }

                else if (targeted is BaseArmor)
                {
                    BaseArmor Armor = targeted as BaseArmor;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(10);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment    = ((Utility.Random(3)) * scalar) + 1;
                            int augmentper = ((Utility.Random(5)) * scalar) + 5;

                            switch (Utility.Random(12))
                            {
                            case 0: Armor.Attributes.BonusHits += augment; from.SendMessage("Even pierced, the armor protects."); break;

                            case 1: Armor.Attributes.NightSight = 1; from.SendMessage("In the darkest night, your path can be seen."); break;

                            case 2: Armor.Attributes.Luck += augment; from.SendMessage("The unluckiest always get the biggest breaks."); break;

                            case 3: Armor.Attributes.LowerManaCost += augment; from.SendMessage("The power of the spirit can be harnessed by metal."); break;

                            case 4: Armor.ArmorAttributes.DurabilityBonus += augmentper; from.SendMessage("Metal lasts longer than flesh."); break;

                            case 5: Armor.ArmorAttributes.MageArmor = 1; from.SendMessage("Channels of magic aren't held back."); break;

                            case 6: Armor.ArmorAttributes.SelfRepair += augment; from.SendMessage("The weapon that strikes mends the metal."); break;

                            case 7: Armor.PhysicalBonus += augment; from.SendMessage("Armor focus renews."); break;

                            case 8: Armor.FireBonus += augment; from.SendMessage("Armor focus renews."); break;

                            case 9: Armor.ColdBonus += augment; from.SendMessage("Armor focus renews."); break;

                            case 10: Armor.PoisonBonus += augment; from.SendMessage("Armor focus renews."); break;

                            case 11: Armor.EnergyBonus += augment; from.SendMessage("Armor focus renews."); break;
                            }

                            from.PlaySound(0x1F5);
                            m_RuneStone.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the armor!");
                            from.SendMessage("The armor is damaged beyond repair!");
                            from.PlaySound(0x1F8);
                            Armor.Delete();
                            m_RuneStone.Delete();
                        }
                    }
                }

                else if (targeted is BaseShield)
                {
                    BaseShield Shield = targeted as BaseShield;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(10);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment    = ((Utility.Random(3)) * scalar) + 1;
                            int augmentper = ((Utility.Random(5)) * scalar) + 5;

                            switch (Utility.Random(12))
                            {
                            case 0: Shield.Attributes.BonusStam += augment; from.SendMessage("Sometimes the warrior's best friend is his shield."); break;

                            case 1: Shield.Attributes.DefendChance += augment; from.SendMessage("The shield's purpose is to defend."); break;

                            case 2: Shield.Attributes.ReflectPhysical += augment; from.SendMessage("Turn the attack against the attacker."); break;

                            case 3: Shield.Attributes.SpellChanneling = 1; from.SendMessage("Sometimes even mages carry shields."); break;

                            case 4: Shield.Attributes.CastRecovery += augment; from.SendMessage("The shield supports when the warrior leans upon it."); break;

                            case 5: Shield.ArmorAttributes.SelfRepair += augment; from.SendMessage("The sword mends, the mace fixes."); break;

                            case 6: Shield.ArmorAttributes.DurabilityBonus += augmentper; from.SendMessage("Time cannot rust a trusted companion."); break;

                            case 7: Shield.PhysicalBonus += augment; from.SendMessage("Armor focus renews."); break;

                            case 8: Shield.FireBonus += augment; from.SendMessage("Armor focus renews."); break;

                            case 9: Shield.ColdBonus += augment; from.SendMessage("Armor focus renews."); break;

                            case 10: Shield.PoisonBonus += augment; from.SendMessage("Armor focus renews."); break;

                            case 11: Shield.EnergyBonus += augment; from.SendMessage("Armor focus renews."); break;
                            }

                            from.PlaySound(0x1F5);
                            m_RuneStone.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the shield!");
                            from.SendMessage("The shield is damaged beyond repair!");
                            from.PlaySound(0x1F8);
                            Shield.Delete();
                            m_RuneStone.Delete();
                        }
                    }
                }

                else if (targeted is BaseClothing)
                {
                    BaseClothing Clothing = targeted as BaseClothing;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(10);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment = ((Utility.Random(3)) * scalar) + 1;

                            switch (Utility.Random(9))
                            {
                            case 0: Clothing.Attributes.RegenHits += augment; from.SendMessage("Sturdy clothes help everyone."); break;

                            case 1: Clothing.Attributes.RegenStam += augment; from.SendMessage("Light clothes mean less of a burden."); break;

                            case 2: Clothing.Attributes.RegenMana += augment; from.SendMessage("Meditation is easier when one is comfortable."); break;

                            case 3: Clothing.Attributes.Luck += augment; from.SendMessage("Everyone should have at least one lucky piece of clothing."); break;

                            case 4: Clothing.Resistances.Physical += augment; from.SendMessage("Cotton or flax, it is now stronger."); break;

                            case 5: Clothing.Resistances.Fire += augment; from.SendMessage("Cotton or flax, it is now stronger."); break;

                            case 6: Clothing.Resistances.Cold += augment; from.SendMessage("Cotton or flax, it is now stronger."); break;

                            case 7: Clothing.Resistances.Poison += augment; from.SendMessage("Cotton or flax, it is now stronger."); break;

                            case 8: Clothing.Resistances.Energy += augment; from.SendMessage("Cotton or flax, it is now stronger."); break;
                            }

                            from.PlaySound(0x1F5);
                            m_RuneStone.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the clothing!");
                            from.SendMessage("The clothing is damaged beyond repair!");
                            from.PlaySound(0x1F8);
                            Clothing.Delete();
                            m_RuneStone.Delete();
                        }
                    }
                }

                else if (targeted is BaseJewel)
                {
                    BaseJewel Jewel = targeted as BaseJewel;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(10);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment = ((Utility.Random(3)) * scalar) + 1;

                            switch (Utility.Random(16))
                            {
                            case 0: Jewel.Attributes.BonusDex += augment; from.SendMessage("The light of the gem speeds the wearer's feet."); break;

                            case 1: Jewel.Attributes.BonusInt += augment; from.SendMessage("The spirit of the gem helps concentration."); break;

                            case 2: Jewel.Attributes.BonusStr += augment; from.SendMessage("The strength of the gem resonates in the muscles."); break;

                            case 3: Jewel.Attributes.Luck += augment; from.SendMessage("Gifts will rain while the gem is worn."); break;

                            case 4: Jewel.Attributes.SpellDamage += augment; from.SendMessage("Mana focuses into a stronger form."); break;

                            case 5: Jewel.Attributes.NightSight = 1; from.SendMessage("The gem lights the way."); break;

                            case 6: Jewel.Resistances.Physical += augment; from.SendMessage("The fortitude of the gem grows even stronger."); break;

                            case 7: Jewel.Resistances.Fire += augment; from.SendMessage("The fortitude of the gem grows even stronger."); break;

                            case 8: Jewel.Resistances.Cold += augment; from.SendMessage("The fortitude of the gem grows even stronger."); break;

                            case 9: Jewel.Resistances.Poison += augment; from.SendMessage("The fortitude of the gem grows even stronger."); break;

                            case 10: Jewel.Resistances.Energy += augment; from.SendMessage("The fortitude of the gem grows even stronger."); break;

                            case 11: Jewel.Attributes.AttackChance += augment; from.SendMessage("The gem glows a deep red."); break;

                            case 12: Jewel.Attributes.DefendChance += augment; from.SendMessage("The gem glows a faint yellow."); break;

                            case 13: Jewel.Attributes.LowerManaCost += augment; from.SendMessage("The gem glows an undulating blue."); break;

                            case 14: Jewel.Attributes.ReflectPhysical += augment; from.SendMessage("The gem glows a bright orange."); break;

                            case 15: Jewel.Attributes.WeaponSpeed += augment; from.SendMessage("The gem glows an eery green."); break;
                            }

                            from.PlaySound(0x1F5);
                            m_RuneStone.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the jewelery!");
                            from.SendMessage("The jewelery is damaged beyond repair!");
                            from.PlaySound(0x1F8);
                            Jewel.Delete();
                            m_RuneStone.Delete();
                        }
                    }
                }

                else
                {
                    from.SendMessage("You can not enhance that.");
                }
            }
Пример #3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseWeapon)
                {
                    BaseWeapon Weapon = targeted as BaseWeapon;

                    if (!from.InRange(m_Augmentation.GetWorldLocation(), 1) || !from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }
                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage(38, "You cannot enhance that in it's current location.");
                    }
                    else if (Weapon.Type == WeaponType.Ranged)
                    {
                        if (from.Skills[SkillName.Fletching].Base < 120.0)
                        {
                            from.SendMessage(38, "Only a Legendary Fletcher can enhance ranged weapons.");
                        }
                        else if (Weapon.UsedSockets >= Weapon.MaxSockets)
                        {
                            from.SendMessage(38, "That weapon is already enhanced to its limits!");
                        }
                        else
                        {
                            int EnhanceChance = Utility.Random(20);
                            if (EnhanceChance == 19)
                            {
                                EnhanceChance = 1;
                            }
                            else
                            {
                                EnhanceChance = 0;
                            }
                            int DestroyChance = Utility.Random(100);
                            if (DestroyChance == 99)
                            {
                                DestroyChance = 1;
                            }
                            else
                            {
                                DestroyChance = 0;
                            }

                            if (EnhanceChance == 0)                               // Success
                            {
                                Weapon.UsedSockets += 1;
                                Weapon.WeaponAttributes.HitColdArea += 20;
                                Weapon.Hue         = 5;
                                Weapon.AugmentList = Weapon.AugmentList + "\n" + m_Augmentation.Name;
                                from.PlaySound(0x2A);                                   // Anvil
                                from.SendMessage(55, "You have successfully enhanced the weapon!");
                                m_Augmentation.Delete();
                            }
                            else                             // Fail
                            {
                                if (DestroyChance == 0)      // Weapon not destroyed
                                {
                                    from.SendMessage(38, "You have failed to enhance the weapon!");
                                    from.SendMessage(38, "The augmentation crumbles in your hand,");
                                    from.SendMessage(38, "you have damaged the weapon in the process!");
                                    Weapon.MaxHitPoints -= 3;
                                    Weapon.HitPoints    -= 3;
                                }
                                else                                 // Weapon is destroyed
                                {
                                    from.SendMessage(38, "You have failed to enhance the weapon!");
                                    from.SendMessage(38, "You have damaged the weapon in the process,");
                                    from.SendMessage(38, "the weapon is damaged beyond repair and crumbles in your hand!");
                                    Weapon.Delete();
                                }

                                m_Augmentation.Delete();
                            }
                        }
                    }
                    else if (Weapon.Type == WeaponType.Polearm || Weapon.Type == WeaponType.Piercing || Weapon.Type == WeaponType.Staff || Weapon.Type == WeaponType.Slashing || Weapon.Type == WeaponType.Bashing || Weapon.Type == WeaponType.Axe)
                    {
                        if (from.Skills[SkillName.Blacksmith].Base < 120.0)
                        {
                            from.SendMessage(38, "Only a Legendary Blacksmith can enhance items.");
                        }
                        else if (Weapon.UsedSockets >= Weapon.MaxSockets)
                        {
                            from.SendMessage(38, "That weapon is already enhanced to its limits!");
                        }
                        else
                        {
                            int EnhanceChance = Utility.Random(20);
                            if (EnhanceChance == 19)
                            {
                                EnhanceChance = 1;
                            }
                            else
                            {
                                EnhanceChance = 0;
                            }
                            int DestroyChance = Utility.Random(100);
                            if (DestroyChance == 99)
                            {
                                DestroyChance = 1;
                            }
                            else
                            {
                                DestroyChance = 0;
                            }

                            if (EnhanceChance == 0)                               // Success
                            {
                                Weapon.UsedSockets += 1;
                                Weapon.WeaponAttributes.HitColdArea += 20;
                                Weapon.Hue         = 5;
                                Weapon.AugmentList = Weapon.AugmentList + "\n" + m_Augmentation.Name;
                                from.PlaySound(0x2A);                                   // Anvil
                                from.SendMessage(55, "You have successfully enhanced the weapon!");
                                m_Augmentation.Delete();
                            }
                            else                             // Fail
                            {
                                if (DestroyChance == 0)      // Weapon not destroyed
                                {
                                    from.SendMessage(38, "You have failed to enhance the weapon!");
                                    from.SendMessage(38, "The augmentation crumbles in your hand,");
                                    from.SendMessage(38, "you have damaged the weapon in the process!");
                                    Weapon.MaxHitPoints -= 3;
                                    Weapon.HitPoints    -= 3;
                                }
                                else                                 // Weapon is destroyed
                                {
                                    from.SendMessage(38, "You have failed to enhance the weapon!");
                                    from.SendMessage(38, "You have damaged the weapon in the process,");
                                    from.SendMessage(38, "the weapon is damaged beyond repair and crumbles in your hand!");
                                    Weapon.Delete();
                                }

                                m_Augmentation.Delete();
                            }
                        }
                    }
                }

                if (targeted is BaseArmor)
                {
                    BaseArmor Armor = targeted as BaseArmor;
                    if (!from.InRange(m_Augmentation.GetWorldLocation(), 1) || !from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }
                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage(38, "You cannot enhance that in it's current location.");
                    }
                    else if (Armor.BodyPosition == ArmorBodyType.Gorget || Armor.BodyPosition == ArmorBodyType.Gloves ||
                             Armor.BodyPosition == ArmorBodyType.Helmet || Armor.BodyPosition == ArmorBodyType.Arms || Armor.BodyPosition == ArmorBodyType.Legs ||
                             Armor.BodyPosition == ArmorBodyType.Chest)
                    {
                        if (Armor.MaterialType == ArmorMaterialType.Plate || Armor.MaterialType == ArmorMaterialType.Chainmail || Armor.MaterialType == ArmorMaterialType.Ringmail)
                        {
                            if (from.Skills[SkillName.Blacksmith].Base < 120.0)
                            {
                                from.SendMessage(38, "Only a Legendary Blacksmith can enhance this type of armor.");
                            }
                            else if (Armor.UsedSockets >= Armor.MaxSockets)
                            {
                                from.SendMessage(38, "That armor is already enhanced to its limits!");
                            }
                            else
                            {
                                int EnhanceChance = Utility.Random(20);
                                if (EnhanceChance == 19)
                                {
                                    EnhanceChance = 1;
                                }
                                else
                                {
                                    EnhanceChance = 0;
                                }
                                int DestroyChance = Utility.Random(100);
                                if (DestroyChance == 99)
                                {
                                    DestroyChance = 1;
                                }
                                else
                                {
                                    DestroyChance = 0;
                                }

                                if (EnhanceChance == 0)                                   // Success
                                {
                                    Armor.UsedSockets          += 1;
                                    Armor.Attributes.BonusMana += 3;
                                    Armor.Hue         = 5;
                                    Armor.AugmentList = Armor.AugmentList + "\n" + m_Augmentation.Name;
                                    from.PlaySound(0x2A);                                       // Anvil
                                    from.SendMessage(55, "You have successfully enhanced the armor!");
                                    m_Augmentation.Delete();
                                }
                                else                                 // Fail
                                {
                                    if (DestroyChance == 0)          // Armor not destroyed
                                    {
                                        from.SendMessage(38, "You have failed to enhance the armor!");
                                        from.SendMessage(38, "The augmentation crumbles in your hand,");
                                        from.SendMessage(38, "you have damaged the armor in the process!");
                                        Armor.MaxHitPoints -= 3;
                                        Armor.HitPoints    -= 3;
                                    }
                                    else                                     // Armor is destroyed
                                    {
                                        from.SendMessage(38, "You have failed to enhance the armor!");
                                        from.SendMessage(38, "You have damaged the armor in the process,");
                                        from.SendMessage(38, "the armor is damaged beyond repair and crumbles in your hand!");
                                        Armor.Delete();
                                    }

                                    m_Augmentation.Delete();
                                }
                            }
                        }
                        else
                        {
                            if (from.Skills[SkillName.Tailoring].Base < 120.0)
                            {
                                from.SendMessage(38, "Only a Legendary Tailor can enhance this type of Armor.");
                            }
                            else if (Armor.UsedSockets >= Armor.MaxSockets)
                            {
                                from.SendMessage(38, "That armor is already enhanced to its limits!");
                            }
                            else
                            {
                                int EnhanceChance = Utility.Random(20);
                                if (EnhanceChance == 19)
                                {
                                    EnhanceChance = 1;
                                }
                                else
                                {
                                    EnhanceChance = 0;
                                }
                                int DestroyChance = Utility.Random(100);
                                if (DestroyChance == 99)
                                {
                                    DestroyChance = 1;
                                }
                                else
                                {
                                    DestroyChance = 0;
                                }

                                if (EnhanceChance == 0)                                   // Success
                                {
                                    Armor.UsedSockets          += 1;
                                    Armor.Attributes.BonusMana += 3;
                                    Armor.Hue         = 5;
                                    Armor.AugmentList = Armor.AugmentList + "\n" + m_Augmentation.Name;
                                    from.PlaySound(0x2A);                                       // Anvil
                                    from.SendMessage(55, "You have successfully enhanced the armor!");
                                    m_Augmentation.Delete();
                                }
                                else                                 // Fail
                                {
                                    if (DestroyChance == 0)          // Armor not destroyed
                                    {
                                        from.SendMessage(38, "You have failed to enhance the armor!");
                                        from.SendMessage(38, "The augmentation crumbles in your hand,");
                                        from.SendMessage(38, "you have damaged the armor in the process!");
                                        Armor.MaxHitPoints -= 3;
                                        Armor.HitPoints    -= 3;
                                    }
                                    else                                     // Armor is destroyed
                                    {
                                        from.SendMessage(38, "You have failed to enhance the armor!");
                                        from.SendMessage(38, "You have damaged the armor in the process,");
                                        from.SendMessage(38, "the armor is damaged beyond repair and crumbles in your hand!");
                                        Armor.Delete();
                                    }

                                    m_Augmentation.Delete();
                                }
                            }
                        }
                    }
                }

                if (targeted is BaseShield)
                {
                    BaseShield Shield = targeted as BaseShield;
                    if (!from.InRange(m_Augmentation.GetWorldLocation(), 1) || !from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }
                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage(38, "You cannot enhance that in it's current location.");
                    }
                    else if (Shield.MaterialType == ArmorMaterialType.Plate)
                    {
                        if (from.Skills[SkillName.Blacksmith].Base < 120.0)
                        {
                            from.SendMessage(38, "Only a Legendary Blacksmith can enhance items.");
                        }
                        else if (Shield.UsedSockets >= Shield.MaxSockets)
                        {
                            from.SendMessage(38, "That shield is already enhanced to its limits!");
                        }
                        else
                        {
                            int EnhanceChance = Utility.Random(20);
                            if (EnhanceChance == 19)
                            {
                                EnhanceChance = 1;
                            }
                            else
                            {
                                EnhanceChance = 0;
                            }
                            int DestroyChance = Utility.Random(100);
                            if (DestroyChance == 99)
                            {
                                DestroyChance = 1;
                            }
                            else
                            {
                                DestroyChance = 0;
                            }

                            if (EnhanceChance == 0)                               // Success
                            {
                                Shield.UsedSockets += 1;
                                Shield.ColdBonus   += 6;
                                Shield.Hue          = 5;
                                Shield.AugmentList  = Shield.AugmentList + "\n" + m_Augmentation.Name;
                                from.PlaySound(0x2A);             // Anvil
                                from.SendMessage(55, "You have successfully enhanced the shield!");
                                m_Augmentation.Delete();
                            }
                            else                             // Fail
                            {
                                if (DestroyChance == 0)      // Shield not destroyed
                                {
                                    from.SendMessage(38, "You have failed to enhance the shield!");
                                    from.SendMessage(38, "The augmentation crumbles in your hand,");
                                    from.SendMessage(38, "you have damaged the shield!");
                                    Shield.MaxHitPoints -= 3;
                                    Shield.HitPoints    -= 3;
                                }
                                else                                 // Shield is destroyed
                                {
                                    from.SendMessage(38, "You have failed to enhance the shield!");
                                    from.SendMessage(38, "You have cracked the shield in the process,");
                                    from.SendMessage(38, "the shield is damaged beyond repair and crumbles in your hand!");
                                    Shield.Delete();
                                }

                                m_Augmentation.Delete();
                            }
                        }
                    }
                }
            }
Пример #4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseArmor)
                {
                    BaseArmor     armor     = targeted as BaseArmor;
                    int           toWeaken  = 0;
                    int           number    = 0;
                    CraftResource armortype = armor.Resource;

                    if (m_repair.SkillLevel >= 90.0)
                    {
                        toWeaken = 1;
                    }
                    else if (m_repair.SkillLevel >= 70.0)
                    {
                        toWeaken = 2;
                    }
                    else
                    {
                        toWeaken = 3;
                    }

                    if (armortype >= CraftResource.Iron && armortype <= CraftResource.Valorite)
                    {
                        number = 1044277;                 // That item cannot be repaired.
                    }
                    else if (armortype >= CraftResource.RedScales && armortype <= CraftResource.BlueScales)
                    {
                        number = 1044277;                 // That item cannot be repaired.
                    }
                    else if (!armor.IsChildOf(from.Backpack))
                    {
                        number = 1044275;                 // The item must be in your backpack to repair it.
                    }
                    else if (armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints)
                    {
                        number = 1044281;                 // That item is in full repair
                    }
                    else if (armor.MaxHitPoints <= toWeaken)
                    {
                        number = 500424;                 // You destroyed the item.
                        armor.Delete();
                    }
                    else
                    {
                        number              = 1044279;    // You repair the item.
                        armor.MaxHitPoints -= toWeaken;
                        armor.HitPoints     = armor.MaxHitPoints;
                        if (m_repair.Uses > 1)
                        {
                            m_repair.Uses -= 1;
                        }
                        else
                        {
                            m_repair.Delete();
                        }
                    }

                    from.SendLocalizedMessage(number);

                    if (armor.MaxHitPoints <= toWeaken)
                    {
                        from.SendLocalizedMessage(1044278);           // That item has been repaired many times, and will break if repairs are attempted again.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1044277);     // That item cannot be repaired.
                }
            }
Пример #5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int DestroyChance = Utility.Random(5);
                int augment       = Utility.Random(2) + 1;

                if (targeted is Item)                 // protects from crash if targeting a Mobile.
                {
                    Item item = (Item)targeted;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 3))
                    {
                        from.SendLocalizedMessage(500446);                   // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else if (targeted is BaseWeapon)
                    {
                        BaseWeapon Weapon = targeted as BaseWeapon;
                        {
                            if (DestroyChance > 0)                       // Success
                            {
                                Weapon.Attributes.RegenHits += augment;
                                from.SendMessage("The Rune enhances your weapon.");
                                from.PlaySound(0x1F5);
                                m_RegenHitsRune.Delete();
                            }

                            else                     // Fail
                            {
                                from.SendMessage("You have failed to enhance the weapon!");
                                from.SendMessage("The weapon is damaged beyond repair!");
                                from.PlaySound(42);
                                Weapon.Delete();
                                m_RegenHitsRune.Delete();
                            }
                        }
                    }

                    else if (targeted is BaseArmor)
                    {
                        BaseArmor Armor = targeted as BaseArmor;
                        {
                            if (DestroyChance > 0)                       // Success
                            {
                                Armor.Attributes.RegenHits += augment;
                                from.SendMessage("The Rune enhances your armor.");
                                from.PlaySound(0x1F5);
                                m_RegenHitsRune.Delete();
                            }

                            else                     // Fail
                            {
                                from.SendMessage("You have failed to enhance the armor!");
                                from.SendMessage("The armor is damaged beyond repair!");
                                from.PlaySound(42);
                                Armor.Delete();
                                m_RegenHitsRune.Delete();
                            }
                        }
                    }

                    else if (targeted is BaseShield)
                    {
                        BaseShield Shield = targeted as BaseShield;
                        {
                            if (DestroyChance > 0)                       // Success
                            {
                                Shield.Attributes.RegenHits += augment;
                                from.SendMessage("The Rune enhances your shield.");
                                from.PlaySound(0x1F5);
                                m_RegenHitsRune.Delete();
                            }

                            else                     // Fail
                            {
                                from.SendMessage("You have failed to enhance the shield!");
                                from.SendMessage("The shield is damaged beyond repair!");
                                from.PlaySound(42);
                                Shield.Delete();
                                m_RegenHitsRune.Delete();
                            }
                        }
                    }

                    else if (targeted is BaseClothing)
                    {
                        BaseClothing Clothing = targeted as BaseClothing;
                        {
                            if (DestroyChance > 0)                       // Success
                            {
                                Clothing.Attributes.RegenHits += augment;
                                from.SendMessage("The Rune enhances your clothing.");
                                from.PlaySound(0x1F5);
                                m_RegenHitsRune.Delete();
                            }

                            else                     // Fail
                            {
                                from.SendMessage("You have failed to enhance the clothing!");
                                from.SendMessage("The clothing is damaged beyond repair!");
                                from.PlaySound(88);
                                Clothing.Delete();
                                m_RegenHitsRune.Delete();
                            }
                        }
                    }

                    else if (targeted is BaseJewel)
                    {
                        BaseJewel Jewel = targeted as BaseJewel;
                        {
                            if (DestroyChance > 0)                       // Success
                            {
                                Jewel.Attributes.RegenHits += augment;
                                from.SendMessage("The Rune enhances your jewelry.");
                                from.PlaySound(0x1F5);
                                m_RegenHitsRune.Delete();
                            }

                            else                     // Fail
                            {
                                from.SendMessage("You have failed to enhance the jewelery!");
                                from.SendMessage("The jewelery is damaged beyond repair!");
                                from.PlaySound(62);
                                Jewel.Delete();
                                m_RegenHitsRune.Delete();
                            }
                        }
                    }
                }
                else
                {
                    from.SendMessage("You cannot enhance that.");
                }
            }
Пример #6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int    scalar;
                double mageSkill = from.Skills[SkillName.Inscribe].Value;

                if (mageSkill >= 100.0)
                {
                    scalar = 3;
                }
                else if (mageSkill >= 90.0)
                {
                    scalar = 2;
                }
                else
                {
                    scalar = 1;
                }

                if (targeted is BaseWeapon)
                {
                    BaseWeapon Weapon = targeted as BaseWeapon;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(5);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment = ((Utility.Random(3)) * scalar) + 1;

                            Weapon.Attributes.NightSight += 1; from.SendMessage("The Lor Rune enhances your weapon.");

                            from.PlaySound(0x1F5);
                            m_LorRune.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the weapon!");
                            from.SendMessage("The weapon is damaged beyond repair!");
                            from.PlaySound(42);
                            Weapon.Delete();
                            m_LorRune.Delete();
                        }
                    }
                }

                else if (targeted is BaseArmor)
                {
                    BaseArmor Armor = targeted as BaseArmor;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(5);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment    = ((Utility.Random(3)) * scalar) + 1;
                            int augmentper = ((Utility.Random(5)) * scalar) + 5;

                            Armor.Attributes.NightSight += 1; from.SendMessage("The Lor Rune enhances your armor.");

                            from.PlaySound(0x1F5);
                            m_LorRune.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the armor!");
                            from.SendMessage("The armor is damaged beyond repair!");
                            from.PlaySound(42);
                            Armor.Delete();
                            m_LorRune.Delete();
                        }
                    }
                }

                else if (targeted is BaseShield)
                {
                    BaseShield Shield = targeted as BaseShield;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(5);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment    = ((Utility.Random(3)) * scalar) + 1;
                            int augmentper = ((Utility.Random(5)) * scalar) + 5;

                            Shield.Attributes.NightSight += 1; from.SendMessage("The Lor Rune enhances your shield.");

                            from.PlaySound(0x1F5);
                            m_LorRune.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the shield!");
                            from.SendMessage("The shield is damaged beyond repair!");
                            from.PlaySound(42);
                            Shield.Delete();
                            m_LorRune.Delete();
                        }
                    }
                }

                else if (targeted is BaseClothing)
                {
                    BaseClothing Clothing = targeted as BaseClothing;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(5);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment = ((Utility.Random(3)) * scalar) + 1;

                            Clothing.Attributes.NightSight += 1; from.SendMessage("The Lor Rune enhances your clothing.");

                            from.PlaySound(0x1F5);
                            m_LorRune.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the clothing!");
                            from.SendMessage("The clothing is damaged beyond repair!");
                            from.PlaySound(88);
                            Clothing.Delete();
                            m_LorRune.Delete();
                        }
                    }
                }

                else if (targeted is BaseJewel)
                {
                    BaseJewel Jewel = targeted as BaseJewel;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(5);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment = ((Utility.Random(3)) * scalar) + 1;
                            Jewel.Attributes.NightSight += 1; from.SendMessage("The Lor Rune enhances your jewelry.");

                            from.PlaySound(0x1F5);
                            m_LorRune.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the jewelery!");
                            from.SendMessage("The jewelery is damaged beyond repair!");
                            from.PlaySound(62);
                            Jewel.Delete();
                            m_LorRune.Delete();
                        }
                    }
                }

                else
                {
                    from.SendMessage("You cannot enhance that.");
                }
            }
Пример #7
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (o is Item)
                {
                    if (from.CheckTargetSkill(SkillName.ItemID, o, 0, 100))
                    {
                        #region BaseWeapon
                        if (o is BaseWeapon && !((BaseWeapon)o).Identified)
                        {
                            BaseWeapon idarme = (BaseWeapon)o;

                            int difficulty = idarme.WeaponDifficulty;

                            if ((from.Skills[SkillName.ItemID].Value - (difficulty * 10)) <= 5)
                            {
                                from.SendMessage("Cette arme dégage un pouvoir trop grand pour vos maigres moyens");
                                return;
                            }
                            else if ((from.Skills[SkillName.ItemID].Value - (difficulty * 10)) >= Utility.Random(difficulty * 10))
                            {
                                from.SendMessage("Vous parvenez à décerner les capacités de l'arme");
                                idarme.Identified = true;
                            }
                            else
                            {
                                int consequence = Utility.Random(from.RawInt);

                                if (consequence < difficulty)
                                {
                                    from.SendMessage("Dans votre tentative d'identifier l'arme, vous l'avez brisée");
                                    idarme.Delete();
                                }
                                else if (consequence < difficulty * 10)
                                {
                                    from.SendMessage("Vous n'avez rien décelé, mais avez abimé l'arme");
                                    idarme.MaxHitPoints -= 1;
                                }
                                else
                                {
                                    from.SendMessage("Vous n'avez rien décelé");
                                }
                            }
                        }
                        #endregion
                        #region BaseArmor
                        else if (o is BaseArmor && !((BaseArmor)o).Identified)
                        {
                            BaseArmor idarmure = (BaseArmor)o;

                            int difficulty = idarmure.ArmorDifficulty;

                            if ((from.Skills[SkillName.ItemID].Value - (difficulty * 10)) <= 5)
                            {
                                from.SendMessage("Cette armure dégage un pouvoir trop grand pour vos maigres moyens");
                                return;
                            }
                            else if ((from.Skills[SkillName.ItemID].Value - (difficulty * 10)) >= Utility.Random(difficulty * 10))
                            {
                                from.SendMessage("Vous parvenez à décerner les capacités de l'armure");
                                idarmure.Identified = true;
                            }
                            else
                            {
                                int consequence = Utility.Random(from.RawInt);

                                if (consequence < difficulty)
                                {
                                    from.SendMessage("Dans votre tentative d'identifier l'armure, vous l'avez brisée");
                                    idarmure.Delete();
                                }
                                else if (consequence < difficulty * 10)
                                {
                                    from.SendMessage("Vous n'avez rien décelé, mais avez abimé l'armure");
                                    idarmure.MaxHitPoints -= 1;
                                }
                                else
                                {
                                    from.SendMessage("Vous n'avez rien décelé");
                                }
                            }
                        }
                        #endregion
                        #region BaseClothing
                        else if (o is BaseClothing && !((BaseClothing)o).Identified)
                        {
                            BaseClothing idclothing = (BaseClothing)o;

                            int difficulty = idclothing.ClothingDifficulty;

                            if ((from.Skills[SkillName.ItemID].Value - (difficulty * 10)) <= 5)
                            {
                                from.SendMessage("Ce vêtement dégage un pouvoir trop grand pour vos maigres moyens");
                                return;
                            }
                            else if ((from.Skills[SkillName.ItemID].Value - (difficulty * 10)) >= Utility.Random(difficulty * 10))
                            {
                                from.SendMessage("Vous parvenez à décerner les capacités du vêtement");
                                idclothing.Identified = true;
                            }
                            else
                            {
                                int consequence = Utility.Random(from.RawInt);

                                if (consequence < difficulty)
                                {
                                    from.SendMessage("Dans votre tentative d'identifier le vêtement, vous l'avez brisé");
                                    idclothing.Delete();
                                }
                                else if (consequence < difficulty * 10)
                                {
                                    from.SendMessage("Vous n'avez rien décelé, mais avez abimé le vêtement");
                                    idclothing.MaxHitPoints -= 1;
                                }
                                else
                                {
                                    from.SendMessage("Vous n'avez rien décelé");
                                }
                            }
                        }
                        #endregion
                        #region BaseJewel
                        else if (o is BaseJewel && !((BaseJewel)o).Identified)
                        {
                            BaseJewel idjewel = (BaseJewel)o;

                            int difficulty = idjewel.JewelDifficulty;

                            if ((from.Skills[SkillName.ItemID].Value - (difficulty * 10)) <= 5)
                            {
                                from.SendMessage("Ce bijou dégage un pouvoir trop grand pour vos maigres moyens");
                                return;
                            }
                            else if ((from.Skills[SkillName.ItemID].Value - (difficulty * 10)) >= Utility.Random(difficulty * 10))
                            {
                                from.SendMessage("Vous parvenez à décerner les capacités du bijou");
                                idjewel.Identified = true;
                            }
                            else
                            {
                                int consequence = Utility.Random(from.RawInt);

                                if (consequence < difficulty * 2)
                                {
                                    from.SendMessage("Dans votre tentative d'identifier le bijou, vous l'avez brisé");
                                    idjewel.Delete();
                                }
                                else
                                {
                                    from.SendMessage("Vous n'avez rien décelé");
                                }
                            }
                        }
                        else
                        {
                            from.SendMessage("Cet objet est déjà identifié");
                        }
                        #endregion

                        if (!Core.AOS)
                        {
                            ((Item)o).OnSingleClick(from);
                        }
                    }
                    else
                    {
                        from.SendMessage("Vous ne parvenez pas à vous concentrer.");
                    }
                }
                else if (o is Mobile)
                {
                    ((Mobile)o).OnSingleClick(from);
                }
                else
                {
                    from.SendMessage("Vous ne pouvez rien apprendre de cela");
                }
            }
Пример #8
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int DestroyChance = Utility.Random(4); // we dont use += on mage armor (can raise magery over caps)

                if (targeted is Item)                  // protects from crash if targeting a Mobile.
                {
                    Item item = (Item)targeted;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 3))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }
                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    if (targeted is BaseWeapon)
                    {
                        BaseWeapon Weapon = targeted as BaseWeapon;
                        {
                            if (DestroyChance > 0)                       // Success
                            {
                                Weapon.WeaponAttributes.MageWeapon = 1;
                                from.SendMessage("The Rune enhances your weapon.");
                                from.PlaySound(0x1F5);
                                m_MageArmorRune.Delete();
                            }

                            else                     // Fail
                            {
                                from.SendMessage("You have failed to enhance the weapon!");
                                from.SendMessage("The weapon is damaged beyond repair!");
                                from.PlaySound(42);
                                Weapon.Delete();
                                m_MageArmorRune.Delete();
                            }
                        }
                    }

                    else if (targeted is BaseArmor)
                    {
                        BaseArmor Armor = targeted as BaseArmor;
                        {
                            if (DestroyChance > 0)                       // Success
                            {
                                Armor.ArmorAttributes.MageArmor = 1;
                                from.SendMessage("The Rune enhances your armor.");
                                from.PlaySound(0x1F5);
                                m_MageArmorRune.Delete();
                            }

                            else                     // Fail
                            {
                                from.SendMessage("You have failed to enhance the armor!");
                                from.SendMessage("The armor is damaged beyond repair!");
                                from.PlaySound(42);
                                Armor.Delete();
                                m_MageArmorRune.Delete();
                            }
                        }
                    }

                    else if (targeted is BaseShield)
                    {
                        BaseShield Shield = targeted as BaseShield;

                        {
                            if (DestroyChance > 0)                       // Success
                            {
                                Shield.ArmorAttributes.MageArmor = 1;
                                from.SendMessage("The Rune enhances your shield.");
                                from.PlaySound(0x1F5);
                                m_MageArmorRune.Delete();
                            }

                            else                     // Fail
                            {
                                from.SendMessage("You have failed to enhance the shield!");
                                from.SendMessage("The shield is damaged beyond repair!");
                                from.PlaySound(42);
                                Shield.Delete();
                                m_MageArmorRune.Delete();
                            }
                        }
                    }

                    else if (targeted is BaseClothing)
                    {
                        BaseClothing Clothing = targeted as BaseClothing;
                        {
                            if (DestroyChance > 0)                       // Success
                            {
                                Clothing.ClothingAttributes.MageArmor = 1;
                                from.SendMessage("The Rune enhances your clothing.");
                                from.PlaySound(0x1F5);
                                m_MageArmorRune.Delete();
                            }

                            else                     // Fail
                            {
                                from.SendMessage("You have failed to enhance the clothing!");
                                from.SendMessage("The clothing is damaged beyond repair!");
                                from.PlaySound(88);
                                Clothing.Delete();
                                m_MageArmorRune.Delete();
                            }
                        }
                    }
                }
                else
                {
                    from.SendMessage("You cannot enhance that.");
                }
            }
Пример #9
0
        /// <summary>
        /// Auto-equips the armor if the mobile can equip it.
        /// Else, the item is added to the mobile backpack.
        /// </summary>
        /// <param name="item">Item to equip</param>
        /// <param name="mustEquip">Forces the item to be equipped</param>
        /// <param name="m">Mobile to be equipped</param>
        /// <param name="t">Type of the item</param>
        private static void EquipArmor(BaseArmor item, bool mustEquip, Mobile m, Type t, int ehue)
        {
            Container pack = m.Backpack;
            Layer layer = item.Layer;
            Item equips = m.FindItemOnLayer(layer);

            item.Quality = ArmorQuality.Exceptional;

            if (mustEquip)
            {
                if (equips != null)
                    pack.DropItem(equips);
            }

            if (pack.FindItemByType(t) != null)
            {
                m.EquipItem(equips);
                return;
            }
            else
            {

                item.Hue = ehue;

                if (!Core.AOS)
                {
                    item.LootType = LootType.Regular;
                }

                if (mustEquip)
                {
                    if (equips != null)
                        pack.DropItem(equips);
                }

                if (m != null && m.EquipItem(item))
                    return;

                if (!mustEquip && pack != null)
                    pack.DropItem(item);
                else
                    item.Delete();
            }
        }
Пример #10
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int    scalar;
                double mageSkill = from.Skills[SkillName.Inscribe].Value;

                if (mageSkill >= 100.0)
                {
                    scalar = 3;
                }
                else if (mageSkill >= 90.0)
                {
                    scalar = 2;
                }
                else
                {
                    scalar = 1;
                }

                if (targeted is BaseWeapon)
                {
                    BaseWeapon Weapon = targeted as BaseWeapon;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(5);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment    = ((Utility.Random(3)) * scalar) + 1;
                            int augmentper = ((Utility.Random(5)) * scalar) + 5;

                            Weapon.WeaponAttributes.DurabilityBonus += augmentper; from.SendMessage("The Aglo Rune enhances your weapon.");

                            from.PlaySound(0x1F5);
                            m_AgloRune.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the weapon!");
                            from.SendMessage("The weapon is damaged beyond repair!");
                            from.PlaySound(42);
                            Weapon.Delete();
                            m_AgloRune.Delete();
                        }
                    }
                }

                else if (targeted is BaseArmor)
                {
                    BaseArmor Armor = targeted as BaseArmor;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(5);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment    = ((Utility.Random(3)) * scalar) + 1;
                            int augmentper = ((Utility.Random(5)) * scalar) + 5;

                            Armor.ArmorAttributes.DurabilityBonus += augmentper; from.SendMessage("The Aglo Rune enhances your armor.");

                            from.PlaySound(0x1F5);
                            m_AgloRune.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the armor!");
                            from.SendMessage("The armor is damaged beyond repair!");
                            from.PlaySound(42);
                            Armor.Delete();
                            m_AgloRune.Delete();
                        }
                    }
                }

                else if (targeted is BaseShield)
                {
                    BaseShield Shield = targeted as BaseShield;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(5);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment    = ((Utility.Random(3)) * scalar) + 1;
                            int augmentper = ((Utility.Random(5)) * scalar) + 5;

                            Shield.ArmorAttributes.DurabilityBonus += augmentper; from.SendMessage("The shield supports when the warrior leans upon it.");

                            from.PlaySound(0x1F5);
                            m_AgloRune.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the shield!");
                            from.SendMessage("The shield is damaged beyond repair!");
                            from.PlaySound(42);
                            Shield.Delete();
                            m_AgloRune.Delete();
                        }
                    }
                }

                else if (targeted is BaseClothing)
                {
                    BaseClothing Clothing = targeted as BaseClothing;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 1))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        int DestroyChance = Utility.Random(5);

                        if (DestroyChance > 0)                           // Success
                        {
                            int augment    = ((Utility.Random(3)) * scalar) + 1;
                            int augmentper = ((Utility.Random(5)) * scalar) + 5;

                            Clothing.ClothingAttributes.DurabilityBonus += augmentper; from.SendMessage("Meditation is easier when one is comfortable.");

                            from.PlaySound(0x1F5);
                            m_AgloRune.Delete();
                        }

                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the clothing!");
                            from.SendMessage("The clothing is damaged beyond repair!");
                            from.PlaySound(88);
                            Clothing.Delete();
                            m_AgloRune.Delete();
                        }
                    }
                }

                else if (targeted is BaseJewel)
                {
                    //BaseJewel Jewel = targeted as BaseJewel;

                    //if ( !from.InRange( ((Item)targeted).GetWorldLocation(), 1 ) )
                    //{
                    //from.SendLocalizedMessage( 500446 ); // That is too far away.
                    //}

                    //else if (( ((Item)targeted).Parent != null ) && ( ((Item)targeted).Parent is Mobile ) )
                    //{
                    //from.SendMessage( "You cannot enhance that in it's current location." );
                    //}

                    //else
                    //{
                    //int DestroyChance = Utility.Random( 5 );

                    //if ( DestroyChance > 0 ) // Success
                    //{
                    //int augment = ( ( Utility.Random( 3 ) ) * scalar ) + 1;
                    //Jewel.Attributes.BonusInt += augment; from.SendMessage( "The Aglo Rune enhances your jewelry." );

                    //from.PlaySound( 0x1F5 );
                    //m_AgloRune.Delete();
                    //}

                    //else // Fail
                    //{
                    //from.SendMessage( "You have failed to enhance the jewelery!" );
                    //from.SendMessage( "The jewelery is damaged beyond repair!" );
                    //from.PlaySound( 62 );
                    //Jewel.Delete();
                    //m_AgloRune.Delete();
                    //}
                    //}
                    //}

                    //else
                    //{
                    from.SendMessage("You cannot enhance that.");
                }
            }