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. } }
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. } }
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 BaseArmor /*&& (DefBlacksmithy.CraftSystem.CraftItems.SearchForSubclass( targeted.GetType() ) != null)*/) { BaseArmor ar = (BaseArmor)targeted; if (ar.IsChildOf(from.Backpack) && m_Powder.IsChildOf(from.Backpack)) { int origMaxHP = ar.MaxHitPoints; int origCurHP = ar.HitPoints; ar.UnscaleDurability(); if (ar.MaxHitPoints < ar.InitMaxHits) { int bonus = ar.InitMaxHits - ar.MaxHitPoints; if (bonus > 10) { bonus = 10; } ar.MaxHitPoints += bonus; ar.HitPoints += bonus; ar.ScaleDurability(); if (ar.MaxHitPoints > origMaxHP) { from.SendLocalizedMessage(1049084); // You successfully use the powder on the item. --m_Powder.UsesRemaining; if (m_Powder.UsesRemaining <= 0) { from.SendLocalizedMessage(1049086); // You have used up your powder of temperament. m_Powder.Delete(); } } else { ar.MaxHitPoints = origMaxHP; ar.HitPoints = origCurHP; from.SendLocalizedMessage(1049085); // The item cannot be improved any further. } } else { from.SendLocalizedMessage(1049085); // The item cannot be improved any further. ar.ScaleDurability(); } } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } } else if (targeted is BaseWeapon /*&& (DefBlacksmithy.CraftSystem.CraftItems.SearchForSubclass( targeted.GetType() ) != null)*/) { BaseWeapon wep = (BaseWeapon)targeted; if (wep.IsChildOf(from.Backpack) && m_Powder.IsChildOf(from.Backpack)) { int origMaxHP = wep.MaxHitPoints; int origCurHP = wep.HitPoints; wep.UnscaleDurability(); if (wep.MaxHitPoints < wep.InitMaxHits) { int bonus = wep.InitMaxHits - wep.MaxHitPoints; if (bonus > 10) { bonus = 10; } wep.MaxHitPoints += bonus; wep.HitPoints += bonus; wep.ScaleDurability(); if (wep.MaxHitPoints > origMaxHP) { from.SendLocalizedMessage(1049084); // You successfully use the powder on the item. --m_Powder.UsesRemaining; if (m_Powder.UsesRemaining <= 0) { from.SendLocalizedMessage(1049086); // You have used up your powder of temperament. m_Powder.Delete(); } } else { wep.MaxHitPoints = origMaxHP; wep.HitPoints = origCurHP; from.SendLocalizedMessage(1049085); // The item cannot be improved any further. } } else { from.SendLocalizedMessage(1049085); // The item cannot be improved any further. wep.ScaleDurability(); } } 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. } }
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 is BaseArmor) { BaseArmor Ti = (BaseArmor)item as BaseArmor; if (Ti.TimesImbued > 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.TimesImbued > 0) { from.SendLocalizedMessage(1149799); // That cannot be used on brittle items. return; } } else if (item is BaseClothing) { BaseClothing Ti = (BaseClothing)item as BaseClothing; if (Ti.TimesImbued > 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.TimesImbued > 0) { from.SendLocalizedMessage(1149799); // That cannot be used on brittle items. return; } } if (item.IsChildOf(from.Backpack) && 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. --m_Powder.UsesRemaining; if (m_Powder.UsesRemaining <= 0) { from.SendLocalizedMessage(1049086); // You have used up your powder of temperament. 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. } }