Core/Creature: Added additional checks when setting feign death in db

Port From (https://github.com/TrinityCore/TrinityCore/commit/d66f2dcdac2f1602f36cd9f1720fdbf274a37c61)
This commit is contained in:
Hondacrx
2024-11-09 23:35:39 -05:00
parent 4fd0430eb0
commit 34caf6a4da
+18
View File
@@ -3677,6 +3677,15 @@ namespace Game
}
}
if (data.unit_flags.HasValue)
{
if ((data.unit_flags2.Value & (uint)UnitFlags2.FeignDeath) != 0 && (data.unit_flags.Value & (uint)(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc)) == 0)
{
Log.outError(LogFilter.Sql, $"Table `creature` has creature (GUID: {guid} Entry: {data.Id}) has UNIT_FLAG2_FEIGN_DEATH set without IMMUNE_TO_PC | IMMUNE_TO_NPC, removing incorrect flag.");
data.unit_flags2 = data.unit_flags2 & ~(uint)UnitFlags2.FeignDeath;
}
}
if (data.unit_flags3.HasValue)
{
uint disallowedUnitFlags3 = (data.unit_flags3.Value & ~(uint)UnitFlags3.Allowed);
@@ -3687,6 +3696,15 @@ namespace Game
}
}
if (data.unit_flags.HasValue)
{
if ((data.unit_flags3.Value & (uint)UnitFlags3.FakeDead) != 0 && (data.unit_flags.Value & (uint)(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc)) == 0)
{
Log.outError(LogFilter.Sql, $"Table `creature` has creature (GUID: {guid} Entry: {data.Id}) has UNIT_FLAG3_FAKE_DEAD set without IMMUNE_TO_PC | IMMUNE_TO_NPC, removing incorrect flag.");
data.unit_flags3 = data.unit_flags3 & ~(uint)UnitFlags3.FakeDead;
}
}
uint healthPct = Math.Clamp(data.curHealthPct, 1, 100);
if (data.curHealthPct != healthPct)
{