From 34caf6a4da9131cc4d4bd28f7e2aa3c0ac99026b Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Sat, 9 Nov 2024 23:35:39 -0500 Subject: [PATCH] Core/Creature: Added additional checks when setting feign death in db Port From (https://github.com/TrinityCore/TrinityCore/commit/d66f2dcdac2f1602f36cd9f1720fdbf274a37c61) --- Source/Game/Globals/ObjectManager.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index b79c4fbd9..03288a31a 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -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) {