aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMeji <alvaro.megias@outlook.com>2024-06-08 12:48:45 +0200
committerOvahlord <dreadkiller@gmx.de>2024-06-20 01:19:07 +0200
commitcc86f7490f1297eb813575874902a16854501761 (patch)
tree2957249be934012b17b3171e74ca778551fa57ac /src
parenta38c5bd7d4eda6919de95a2b10876154ddfd5b62 (diff)
Core/Creatures: Validate creature.modelid on startup (#30023)
(cherry picked from commit ef70cf64814341543fdb8efa403319371d9f3104) # Conflicts: # sql/old/4.4.x/world/24021_2024_06_02/2024_06_08_00_world.sql
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp2
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 8c20cc793fd..280cc268017 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -523,7 +523,7 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/)
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
if (!minfo) // Cancel load if no model defined
{
- TC_LOG_ERROR("sql.sql", "Creature (Entry: {}) has invalid model {} defined in table `creature_template`, can't load.", entry, model.CreatureDisplayID);
+ TC_LOG_ERROR("sql.sql", "Creature (Entry: {}) has invalid model {} defined in table `creature_template_model`, can't load.", entry, model.CreatureDisplayID);
return false;
}
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 0a71eb8d80a..5385f24cbb8 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2249,6 +2249,15 @@ void ObjectMgr::LoadCreatures()
continue;
}
+ if (data.display.has_value())
+ {
+ if (!GetCreatureModelInfo(data.display->CreatureDisplayID))
+ {
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: {} Entry: {}) with invalid `modelid` {}, ignoring.", guid, data.id, data.display->CreatureDisplayID);
+ data.display.reset();
+ }
+ }
+
// -1 random, 0 no equipment
if (data.equipmentId != 0)
{