fix: Fixes ethics causing crashes when not used (#1972)

This commit is contained in:
Kamron Batman 2024-10-15 17:02:11 -07:00 • committed by GitHub
parent b7316a5bd6
commit f16bce60e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 75 additions and 82 deletions

View file

@ -1327,32 +1327,13 @@ namespace Server.Mobiles
}
var item = items[i];
var itemEthic = Ethic.Find(item);
if ((item.SavedFlags & 0x100) != 0)
if (itemEthic != null && itemEthic != ethic)
{
if (item.Hue != Ethic.Hero.Definition.PrimaryHue)
{
item.SavedFlags &= ~0x100;
}
else if (ethic != Ethic.Hero)
{
from.AddToBackpack(item);
moved = true;
continue;
}
}
else if ((item.SavedFlags & 0x200) != 0)
{
if (item.Hue != Ethic.Evil.Definition.PrimaryHue)
{
item.SavedFlags &= ~0x200;
}
else if (ethic != Ethic.Evil)
{
from.AddToBackpack(item);
moved = true;
continue;
}
from.AddToBackpack(item);
moved = true;
continue;
}
if (item is BaseWeapon weapon)