aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index b2be5c49b91..d8e5852b85a 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1236,7 +1236,11 @@ uint32 ObjectMgr::ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData co
if (data && data->displayid)
return data->displayid;
- return cinfo->GetRandomValidModelId();
+ if (!(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER))
+ return cinfo->GetRandomValidModelId();
+
+ // Triggers by default receive the invisible model
+ return cinfo->GetFirstInvisibleModel();
}
void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data /*= NULL*/)
@@ -1301,6 +1305,12 @@ void ObjectMgr::LoadCreatureModelInfo()
Field* fields = result->Fetch();
uint32 modelId = fields[0].GetUInt32();
+ CreatureDisplayInfoEntry const* creatureDisplay = sCreatureDisplayInfoStore.LookupEntry(modelId);
+ if (!creatureDisplay)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has model for nonexistent display id (%u).", modelId);
+ continue;
+ }
CreatureModelInfo& modelInfo = _creatureModelStore[modelId];
@@ -1308,12 +1318,10 @@ void ObjectMgr::LoadCreatureModelInfo()
modelInfo.combat_reach = fields[2].GetFloat();
modelInfo.gender = fields[3].GetUInt8();
modelInfo.modelid_other_gender = fields[4].GetUInt32();
+ modelInfo.is_trigger = false;
// Checks
- if (!sCreatureDisplayInfoStore.LookupEntry(modelId))
- TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has model for nonexistent display id (%u).", modelId);
-
if (modelInfo.gender > GENDER_NONE)
{
TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId);
@@ -1329,6 +1337,18 @@ void ObjectMgr::LoadCreatureModelInfo()
if (modelInfo.combat_reach < 0.1f)
modelInfo.combat_reach = DEFAULT_COMBAT_REACH;
+ if (CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(creatureDisplay->ModelId))
+ {
+ for (uint32 i = 0; i < 5; ++i)
+ {
+ if (strstr(modelData->ModelPath, "InvisibleStalker"))
+ {
+ modelInfo.is_trigger = true;
+ break;
+ }
+ }
+ }
+
++count;
}
while (result->NextRow());