protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Powder.Deleted || m_Powder.UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049086);                       // You have used up your powder of temperament.
                    return;
                }

                if (targeted is IDurability && targeted is Item)
                {
                    IDurability wearable = (IDurability)targeted;
                    Item        item     = (Item)targeted;

                    if (!wearable.CanFortify)
                    {
                        from.SendLocalizedMessage(1049083);                           // You cannot use the powder on that item.
                        return;
                    }

                    if ((item.IsChildOf(from.Backpack) || (Core.ML && item.Parent == from)) && m_Powder.IsChildOf(from.Backpack))
                    {
                        int origMaxHP = wearable.MaxHitPoints;
                        int origCurHP = wearable.HitPoints;

                        if (origMaxHP > 0)
                        {
                            int initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;

                            wearable.UnscaleDurability();

                            if (wearable.MaxHitPoints < initMaxHP)
                            {
                                int bonus = initMaxHP - wearable.MaxHitPoints;

                                if (bonus > 10)
                                {
                                    bonus = 10;
                                }

                                wearable.MaxHitPoints += bonus;
                                wearable.HitPoints    += bonus;

                                wearable.ScaleDurability();

                                if (wearable.MaxHitPoints > 255)
                                {
                                    wearable.MaxHitPoints = 255;
                                }
                                if (wearable.HitPoints > 255)
                                {
                                    wearable.HitPoints = 255;
                                }

                                if (wearable.MaxHitPoints > origMaxHP)
                                {
                                    from.SendLocalizedMessage(1049084);                                       // You successfully use the powder on the item.
                                    from.PlaySound(0x247);

                                    --m_Powder.UsesRemaining;

                                    if (m_Powder.UsesRemaining <= 0)
                                    {
                                        from.SendLocalizedMessage(1049086);                                           // You have used up your powder of fortifying.
                                        m_Powder.Delete();
                                    }
                                }
                                else
                                {
                                    wearable.MaxHitPoints = origMaxHP;
                                    wearable.HitPoints    = origCurHP;
                                    from.SendLocalizedMessage(1049085);                                       // The item cannot be improved any further.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049085);                                   // The item cannot be improved any further.
                                wearable.ScaleDurability();
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049083);                               // You cannot use the powder on that item.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042001);                           // That must be in your pack for you to use it.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049083);                       // You cannot use the powder on that item.
                }
            }
Example #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Powder.Deleted || m_Powder.UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049086); // You have used up your powder of temperament.
                    return;
                }

                if (targeted is Item)
                {
                    Item item    = (Item)targeted;
                    bool noGo    = false;
                    int  antique = 0;

                    if (!Server.Engines.Craft.Repair.AllowsRepair(item, null) || (item is BaseJewel && !CanPOFJewelry))
                    {
                        from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                        return;
                    }

                    #region SA
                    if (item is BaseWeapon)
                    {
                        if (((BaseWeapon)item).Attributes.Brittle > 0 || ((BaseWeapon)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseWeapon)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseArmor)
                    {
                        if (((BaseArmor)item).Attributes.Brittle > 0 || ((BaseArmor)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseArmor)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseClothing)
                    {
                        if (((BaseClothing)item).Attributes.Brittle > 0 || ((BaseClothing)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseClothing)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseJewel)
                    {
                        if (((BaseJewel)item).Attributes.Brittle > 0 || ((BaseJewel)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseJewel)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseTalisman && ((BaseTalisman)item).Attributes.Brittle > 0)
                    {
                        noGo = true;
                    }
                    if (noGo)
                    {
                        from.SendLocalizedMessage(1149799); //That cannot be used on brittle items.
                        return;
                    }
                    #endregion

                    if (targeted is IDurability)
                    {
                        IDurability wearable = (IDurability)targeted;

                        if (!wearable.CanFortify)
                        {
                            from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                            return;
                        }

                        if ((item.IsChildOf(from.Backpack) || (Core.ML && item.Parent == from)) && m_Powder.IsChildOf(from.Backpack))
                        {
                            int origMaxHP = wearable.MaxHitPoints;
                            int origCurHP = wearable.HitPoints;

                            if (origMaxHP > 0)
                            {
                                //int initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;
                                int initMaxHP = antique <= 0 ? 255 : antique == 1 ? 200 : 150;

                                wearable.UnscaleDurability();

                                if (wearable.MaxHitPoints < initMaxHP)
                                {
                                    if (antique > 0)
                                    {
                                        if (item is BaseWeapon)
                                        {
                                            ((BaseWeapon)item).NegativeAttributes.Antique++;
                                        }
                                        if (item is BaseArmor)
                                        {
                                            ((BaseArmor)item).NegativeAttributes.Antique++;
                                        }
                                        if (item is BaseJewel)
                                        {
                                            ((BaseJewel)item).NegativeAttributes.Antique++;
                                        }
                                        if (item is BaseClothing)
                                        {
                                            ((BaseClothing)item).NegativeAttributes.Antique++;
                                        }
                                    }

                                    int bonus = initMaxHP - wearable.MaxHitPoints;

                                    if (bonus > 10)
                                    {
                                        bonus = 10;
                                    }

                                    wearable.MaxHitPoints += bonus;
                                    wearable.HitPoints    += bonus;

                                    wearable.ScaleDurability();

                                    if (wearable.MaxHitPoints > 255)
                                    {
                                        wearable.MaxHitPoints = 255;
                                    }
                                    if (wearable.HitPoints > 255)
                                    {
                                        wearable.HitPoints = 255;
                                    }

                                    if (wearable.MaxHitPoints > origMaxHP)
                                    {
                                        from.SendLocalizedMessage(1049084); // You successfully use the powder on the item.
                                        from.PlaySound(0x247);

                                        --m_Powder.UsesRemaining;

                                        if (m_Powder.UsesRemaining <= 0)
                                        {
                                            from.SendLocalizedMessage(1049086); // You have used up your powder of fortifying.
                                            m_Powder.Delete();
                                        }
                                    }
                                    else
                                    {
                                        wearable.MaxHitPoints = origMaxHP;
                                        wearable.HitPoints    = origCurHP;
                                        from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
                                    wearable.ScaleDurability();
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                }
            }
Example #3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (this.m_Powder.Deleted || this.m_Powder.UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049086); // You have used up your powder of temperament.
                    return;
                }

                if (targeted is IDurability && targeted is Item)
                {
                    IDurability wearable = (IDurability)targeted;
                    Item        item     = (Item)targeted;

                    if (!wearable.CanFortify)
                    {
                        from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                        return;
                    }

                    #region SF Imbuing
                    if (item is BaseArmor)
                    {
                        BaseArmor Ti = (BaseArmor)item as BaseArmor;
                        if (Ti.Attributes.Brittle > 0)
                        {
                            from.SendLocalizedMessage(1149799);   // That cannot be used on brittle items.
                            return;
                        }
                    }
                    else if (item is BaseJewel)
                    {
                        BaseJewel Ti = (BaseJewel)item as BaseJewel;
                        if (Ti.Attributes.Brittle > 0)
                        {
                            from.SendLocalizedMessage(1149799);   // That cannot be used on brittle items.
                            return;
                        }
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat Ti = (BaseHat)item as BaseHat;
                        if (Ti.Attributes.Brittle > 0)
                        {
                            from.SendLocalizedMessage(1149799);   // That cannot be used on brittle items.
                            return;
                        }
                    }
                    else if (item is BaseWeapon)
                    {
                        BaseWeapon Ti = (BaseWeapon)item as BaseWeapon;
                        if (Ti.Attributes.Brittle > 0)
                        {
                            from.SendLocalizedMessage(1149799);   // That cannot be used on brittle items.
                            return;
                        }
                    }
                    #endregion


                    if ((item.IsChildOf(from.Backpack) || (Core.ML && item.Parent == from)) && this.m_Powder.IsChildOf(from.Backpack))
                    {
                        int origMaxHP = wearable.MaxHitPoints;
                        int origCurHP = wearable.HitPoints;

                        if (origMaxHP > 0)
                        {
                            int initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;

                            wearable.UnscaleDurability();

                            if (wearable.MaxHitPoints < initMaxHP)
                            {
                                int bonus = initMaxHP - wearable.MaxHitPoints;

                                if (bonus > 10)
                                {
                                    bonus = 10;
                                }

                                wearable.MaxHitPoints += bonus;
                                wearable.HitPoints    += bonus;

                                wearable.ScaleDurability();

                                if (wearable.MaxHitPoints > 255)
                                {
                                    wearable.MaxHitPoints = 255;
                                }
                                if (wearable.HitPoints > 255)
                                {
                                    wearable.HitPoints = 255;
                                }

                                if (wearable.MaxHitPoints > origMaxHP)
                                {
                                    from.SendLocalizedMessage(1049084); // You successfully use the powder on the item.
                                    from.PlaySound(0x247);

                                    --this.m_Powder.UsesRemaining;

                                    if (this.m_Powder.UsesRemaining <= 0)
                                    {
                                        from.SendLocalizedMessage(1049086); // You have used up your powder of fortifying.
                                        this.m_Powder.Delete();
                                    }
                                }
                                else
                                {
                                    wearable.MaxHitPoints = origMaxHP;
                                    wearable.HitPoints    = origCurHP;
                                    from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
                                wearable.ScaleDurability();
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                }
            }