aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
authorModoX <moardox@gmail.com>2024-08-31 19:43:18 +0200
committerModoX <moardox@gmail.com>2024-08-31 19:43:18 +0200
commitd66f2dcdac2f1602f36cd9f1720fdbf274a37c61 (patch)
treed0e122a0d3e828a5a33e9131e8f1443ade3692da /src/server/game/Globals/ObjectMgr.cpp
parent1b4c324fe1946ad1b595e947ba43e71341adad15 (diff)
Core/Creature: Added additional checks when setting feign death in db
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index fca4e4ff71b..d7a5428cbcc 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2354,6 +2354,15 @@ void ObjectMgr::LoadCreatures()
TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: {} Entry: {}) with disallowed `unit_flags2` {}, removing incorrect flag.", guid, data.id, disallowedUnitFlags2);
*data.unit_flags2 &= UNIT_FLAG2_ALLOWED;
}
+
+ if (data.unit_flags.has_value())
+ {
+ if (*data.unit_flags2 & UNIT_FLAG2_FEIGN_DEATH && !(*data.unit_flags & (UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC)))
+ {
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: {} Entry: {}) has UNIT_FLAG2_FEIGN_DEATH set without IMMUNE_TO_PC | IMMUNE_TO_NPC, removing incorrect flag.", guid, data.id);
+ *data.unit_flags2 &= ~UNIT_FLAG2_FEIGN_DEATH;
+ }
+ }
}
if (data.unit_flags3.has_value())
@@ -2363,6 +2372,15 @@ void ObjectMgr::LoadCreatures()
TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: {} Entry: {}) with disallowed `unit_flags3` {}, removing incorrect flag.", guid, data.id, disallowedUnitFlags3);
*data.unit_flags3 &= UNIT_FLAG3_ALLOWED;
}
+
+ if (data.unit_flags.has_value())
+ {
+ if (*data.unit_flags3 & UNIT_FLAG3_FAKE_DEAD && !(*data.unit_flags & (UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC)))
+ {
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: {} Entry: {}) has UNIT_FLAG3_FAKE_DEAD set without IMMUNE_TO_PC | IMMUNE_TO_NPC, removing incorrect flag.", guid, data.id);
+ *data.unit_flags3 &= ~UNIT_FLAG3_FAKE_DEAD;
+ }
+ }
}
uint32 healthPct = std::clamp<uint32>(data.curHealthPct, 1, 100);