Core/Creature: Remove UNIT_FLAG3_FAKE_DEAD and UNIT_FLAG2_FEIGN_DEATH if no unit_flags are set

Port From (https://github.com/TrinityCore/TrinityCore/commit/72d952db74d0c4a6e90d7a387774d090eb4a842b)
This commit is contained in:
Hondacrx
2024-11-10 22:24:15 -05:00
parent 9087e3dc30
commit c87b3851eb
+1 -7
View File
@@ -3677,14 +3677,11 @@ namespace Game
} }
} }
if (data.unit_flags.HasValue) if ((data.unit_flags2.Value & (uint)UnitFlags2.FeignDeath) != 0 && (!data.unit_flags.HasValue || (data.unit_flags.Value & (uint)(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc)) == 0))
{
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."); 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; data.unit_flags2 = data.unit_flags2 & ~(uint)UnitFlags2.FeignDeath;
} }
}
if (data.unit_flags3.HasValue) if (data.unit_flags3.HasValue)
{ {
@@ -3696,14 +3693,11 @@ 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) 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."); 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; data.unit_flags3 = data.unit_flags3 & ~(uint)UnitFlags3.FakeDead;
} }
}
uint healthPct = Math.Clamp(data.curHealthPct, 1, 100); uint healthPct = Math.Clamp(data.curHealthPct, 1, 100);
if (data.curHealthPct != healthPct) if (data.curHealthPct != healthPct)