diff --git a/Projects/UOContent/Items/Armor/BaseArmor.cs b/Projects/UOContent/Items/Armor/BaseArmor.cs index a6955bf0f..b546a3774 100644 --- a/Projects/UOContent/Items/Armor/BaseArmor.cs +++ b/Projects/UOContent/Items/Armor/BaseArmor.cs @@ -1082,67 +1082,69 @@ namespace Server.Items public override bool CanEquip(Mobile from) { + if (!from.Player || from.AccessLevel >= AccessLevel.GameMaster) + { + return base.CanEquip(from); + } + if (!Ethic.CheckEquip(from, this)) { return false; } - if (from.AccessLevel < AccessLevel.GameMaster) + if (!CheckRace(from)) { - if (!CheckRace(from)) + return false; + } + + if (!AllowMaleWearer && !from.Female) + { + if (AllowFemaleWearer) { - return false; + from.SendLocalizedMessage(1010388); // Only females can wear this. + } + else + { + from.SendMessage("You may not wear this."); } - if (!AllowMaleWearer && !from.Female) - { - if (AllowFemaleWearer) - { - from.SendLocalizedMessage(1010388); // Only females can wear this. - } - else - { - from.SendMessage("You may not wear this."); - } + return false; + } - return false; + if (!AllowFemaleWearer && from.Female) + { + if (AllowMaleWearer) + { + from.SendLocalizedMessage(1063343); // Only males can wear this. + } + else + { + from.SendMessage("You may not wear this."); } - if (!AllowFemaleWearer && from.Female) - { - if (AllowMaleWearer) - { - from.SendLocalizedMessage(1063343); // Only males can wear this. - } - else - { - from.SendMessage("You may not wear this."); - } + return false; + } - return false; - } + int strBonus = ComputeStatBonus(StatType.Str), strReq = ComputeStatReq(StatType.Str); + int dexBonus = ComputeStatBonus(StatType.Dex), dexReq = ComputeStatReq(StatType.Dex); + int intBonus = ComputeStatBonus(StatType.Int), intReq = ComputeStatReq(StatType.Int); - int strBonus = ComputeStatBonus(StatType.Str), strReq = ComputeStatReq(StatType.Str); - int dexBonus = ComputeStatBonus(StatType.Dex), dexReq = ComputeStatReq(StatType.Dex); - int intBonus = ComputeStatBonus(StatType.Int), intReq = ComputeStatReq(StatType.Int); + if (from.Dex < dexReq || from.Dex + dexBonus < 1) + { + from.SendLocalizedMessage(502077); // You do not have enough dexterity to equip this item. + return false; + } - if (from.Dex < dexReq || from.Dex + dexBonus < 1) - { - from.SendLocalizedMessage(502077); // You do not have enough dexterity to equip this item. - return false; - } + if (from.Str < strReq || from.Str + strBonus < 1) + { + from.SendLocalizedMessage(500213); // You are not strong enough to equip that. + return false; + } - if (from.Str < strReq || from.Str + strBonus < 1) - { - from.SendLocalizedMessage(500213); // You are not strong enough to equip that. - return false; - } - - if (from.Int < intReq || from.Int + intBonus < 1) - { - from.SendMessage("You are not smart enough to equip that."); - return false; - } + if (from.Int < intReq || from.Int + intBonus < 1) + { + from.SendMessage("You are not smart enough to equip that."); + return false; } return base.CanEquip(from); diff --git a/Projects/UOContent/Items/Clothing/BaseClothing.cs b/Projects/UOContent/Items/Clothing/BaseClothing.cs index 5b249e490..ce77d2ec6 100644 --- a/Projects/UOContent/Items/Clothing/BaseClothing.cs +++ b/Projects/UOContent/Items/Clothing/BaseClothing.cs @@ -429,63 +429,65 @@ namespace Server.Items public override bool CanEquip(Mobile from) { + if (!from.Player || from.AccessLevel >= AccessLevel.GameMaster) + { + return base.CanEquip(from); + } + if (!Ethic.CheckEquip(from, this)) { return false; } - if (from.AccessLevel < AccessLevel.GameMaster) + if (RequiredRace != null && from.Race != RequiredRace) { - if (RequiredRace != null && from.Race != RequiredRace) + if (RequiredRace == Race.Elf) { - if (RequiredRace == Race.Elf) - { - from.SendLocalizedMessage(1072203); // Only Elves may use this. - } - else - { - from.SendMessage($"Only {RequiredRace.PluralName} may use this."); - } - - return false; + from.SendLocalizedMessage(1072203); // Only Elves may use this. + } + else + { + from.SendMessage($"Only {RequiredRace.PluralName} may use this."); } - if (!AllowMaleWearer && !from.Female) - { - if (AllowFemaleWearer) - { - from.SendLocalizedMessage(1010388); // Only females can wear this. - } - else - { - from.SendMessage("You may not wear this."); - } + return false; + } - return false; + if (!AllowMaleWearer && !from.Female) + { + if (AllowFemaleWearer) + { + from.SendLocalizedMessage(1010388); // Only females can wear this. + } + else + { + from.SendMessage("You may not wear this."); } - if (!AllowFemaleWearer && from.Female) - { - if (AllowMaleWearer) - { - from.SendLocalizedMessage(1063343); // Only males can wear this. - } - else - { - from.SendMessage("You may not wear this."); - } + return false; + } - return false; + if (!AllowFemaleWearer && from.Female) + { + if (AllowMaleWearer) + { + from.SendLocalizedMessage(1063343); // Only males can wear this. + } + else + { + from.SendMessage("You may not wear this."); } - var strBonus = ComputeStatBonus(StatType.Str); - var strReq = ComputeStatReq(StatType.Str); + return false; + } - if (from.Str < strReq || from.Str + strBonus < 1) - { - from.SendLocalizedMessage(500213); // You are not strong enough to equip that. - return false; - } + var strBonus = ComputeStatBonus(StatType.Str); + var strReq = ComputeStatReq(StatType.Str); + + if (from.Str < strReq || from.Str + strBonus < 1) + { + from.SendLocalizedMessage(500213); // You are not strong enough to equip that. + return false; } return base.CanEquip(from); diff --git a/Projects/UOContent/Items/Weapons/BaseWeapon.cs b/Projects/UOContent/Items/Weapons/BaseWeapon.cs index 3bc381b5a..23af56d5f 100644 --- a/Projects/UOContent/Items/Weapons/BaseWeapon.cs +++ b/Projects/UOContent/Items/Weapons/BaseWeapon.cs @@ -1026,6 +1026,11 @@ public abstract partial class BaseWeapon public override bool CanEquip(Mobile from) { + if (!from.Player || from.AccessLevel >= AccessLevel.GameMaster) + { + return from.CanBeginAction() && base.CanEquip(from); + } + if (!Ethic.CheckEquip(from, this)) { return false;