fix: Fixes NPCs not able to equip armor/clothing/weapons (#2161)
This commit is contained in:
parent
e54782441e
commit
47b03f5d62
3 changed files with 95 additions and 86 deletions
|
|
@ -1082,67 +1082,69 @@ namespace Server.Items
|
||||||
|
|
||||||
public override bool CanEquip(Mobile from)
|
public override bool CanEquip(Mobile from)
|
||||||
{
|
{
|
||||||
|
if (!from.Player || from.AccessLevel >= AccessLevel.GameMaster)
|
||||||
|
{
|
||||||
|
return base.CanEquip(from);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Ethic.CheckEquip(from, this))
|
if (!Ethic.CheckEquip(from, this))
|
||||||
{
|
{
|
||||||
return false;
|
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)
|
return false;
|
||||||
{
|
}
|
||||||
if (AllowFemaleWearer)
|
|
||||||
{
|
|
||||||
from.SendLocalizedMessage(1010388); // Only females can wear this.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
from.SendMessage("You may not wear this.");
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
return false;
|
||||||
{
|
}
|
||||||
if (AllowMaleWearer)
|
|
||||||
{
|
|
||||||
from.SendLocalizedMessage(1063343); // Only males can wear this.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
from.SendMessage("You may not wear this.");
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
if (from.Dex < dexReq || from.Dex + dexBonus < 1)
|
||||||
int dexBonus = ComputeStatBonus(StatType.Dex), dexReq = ComputeStatReq(StatType.Dex);
|
{
|
||||||
int intBonus = ComputeStatBonus(StatType.Int), intReq = ComputeStatReq(StatType.Int);
|
from.SendLocalizedMessage(502077); // You do not have enough dexterity to equip this item.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (from.Dex < dexReq || from.Dex + dexBonus < 1)
|
if (from.Str < strReq || from.Str + strBonus < 1)
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(502077); // You do not have enough dexterity to equip this item.
|
from.SendLocalizedMessage(500213); // You are not strong enough to equip that.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from.Str < strReq || from.Str + strBonus < 1)
|
if (from.Int < intReq || from.Int + intBonus < 1)
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(500213); // You are not strong enough to equip that.
|
from.SendMessage("You are not smart enough to equip that.");
|
||||||
return false;
|
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);
|
return base.CanEquip(from);
|
||||||
|
|
|
||||||
|
|
@ -429,63 +429,65 @@ namespace Server.Items
|
||||||
|
|
||||||
public override bool CanEquip(Mobile from)
|
public override bool CanEquip(Mobile from)
|
||||||
{
|
{
|
||||||
|
if (!from.Player || from.AccessLevel >= AccessLevel.GameMaster)
|
||||||
|
{
|
||||||
|
return base.CanEquip(from);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Ethic.CheckEquip(from, this))
|
if (!Ethic.CheckEquip(from, this))
|
||||||
{
|
{
|
||||||
return false;
|
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.
|
||||||
{
|
}
|
||||||
from.SendLocalizedMessage(1072203); // Only Elves may use this.
|
else
|
||||||
}
|
{
|
||||||
else
|
from.SendMessage($"Only {RequiredRace.PluralName} may use this.");
|
||||||
{
|
|
||||||
from.SendMessage($"Only {RequiredRace.PluralName} may use this.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AllowMaleWearer && !from.Female)
|
return false;
|
||||||
{
|
}
|
||||||
if (AllowFemaleWearer)
|
|
||||||
{
|
|
||||||
from.SendLocalizedMessage(1010388); // Only females can wear this.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
from.SendMessage("You may not wear this.");
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
return false;
|
||||||
{
|
}
|
||||||
if (AllowMaleWearer)
|
|
||||||
{
|
|
||||||
from.SendLocalizedMessage(1063343); // Only males can wear this.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
from.SendMessage("You may not wear this.");
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
return false;
|
||||||
var strReq = ComputeStatReq(StatType.Str);
|
}
|
||||||
|
|
||||||
if (from.Str < strReq || from.Str + strBonus < 1)
|
var strBonus = ComputeStatBonus(StatType.Str);
|
||||||
{
|
var strReq = ComputeStatReq(StatType.Str);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CanEquip(from);
|
return base.CanEquip(from);
|
||||||
|
|
|
||||||
|
|
@ -1026,6 +1026,11 @@ public abstract partial class BaseWeapon
|
||||||
|
|
||||||
public override bool CanEquip(Mobile from)
|
public override bool CanEquip(Mobile from)
|
||||||
{
|
{
|
||||||
|
if (!from.Player || from.AccessLevel >= AccessLevel.GameMaster)
|
||||||
|
{
|
||||||
|
return from.CanBeginAction<BaseWeapon>() && base.CanEquip(from);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Ethic.CheckEquip(from, this))
|
if (!Ethic.CheckEquip(from, this))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue