diff options
author | megamage <none@none> | 2009-04-14 18:31:31 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-14 18:31:31 -0500 |
commit | 4f4c6aeaf533419a7933e8ff0ee6f09d976a04b7 (patch) | |
tree | f34fd730fd094fef70139ab88dadf86c1532b1d8 /src | |
parent | 9ec70b5e72413290e73d5a0b3d462150aa8cb93c (diff) |
[7666] For heroic mode creature use AIName from normal mode version in same way as done for ScriptName. Author: VladimirMangos
Also at creature templates loading check that AIName/ScriptName not set for heroic mode creature versions.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Creature.cpp | 9 | ||||
-rw-r--r-- | src/game/Creature.h | 5 | ||||
-rw-r--r-- | src/game/CreatureAISelector.cpp | 7 | ||||
-rw-r--r-- | src/game/CreatureEventAI.cpp | 2 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 12 |
5 files changed, 25 insertions, 10 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index cee08c1dd27..71631e4bdbc 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -2237,12 +2237,17 @@ uint32 Creature::getLevelForTarget( Unit const* target ) const return level; } -std::string Creature::GetScriptName() +std::string Creature::GetAIName() const +{ + return ObjectMgr::GetCreatureTemplate(GetEntry())->AIName; +} + +std::string Creature::GetScriptName() const { return objmgr.GetScriptName(GetScriptId()); } -uint32 Creature::GetScriptId() +uint32 Creature::GetScriptId() const { return ObjectMgr::GetCreatureTemplate(GetEntry())->ScriptID; } diff --git a/src/game/Creature.h b/src/game/Creature.h index 10aa31e2283..0f12401bba8 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -560,8 +560,9 @@ class TRINITY_DLL_SPEC Creature : public Unit CreatureInfo const *GetCreatureInfo() const { return m_creatureInfo; } CreatureDataAddon const* GetCreatureAddon() const; - std::string GetScriptName(); - uint32 GetScriptId(); + std::string GetAIName() const; + std::string GetScriptName() const; + uint32 GetScriptId() const; void prepareGossipMenu( Player *pPlayer, uint32 gossipid = 0 ); void sendPreparedGossip( Player* player ); diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp index 88384fd6f21..9250a254155 100644 --- a/src/game/CreatureAISelector.cpp +++ b/src/game/CreatureAISelector.cpp @@ -47,11 +47,8 @@ namespace FactorySelector if(CreatureAI* scriptedAI = Script->GetAI(creature)) return scriptedAI; - CreatureInfo const *cinfo = creature->GetCreatureInfo(); - assert(cinfo); - - // this seems to be useless - std::string ainame=cinfo->AIName; + // AIname in db + std::string ainame=creature->GetAIName(); if(!ai_factory && !ainame.empty()) ai_factory = ai_registry.GetRegistryItem( ainame.c_str() ); diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index daf5c74ca72..96213130126 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -34,7 +34,7 @@ int CreatureEventAI::Permissible(const Creature *creature) { - if( creature->GetCreatureInfo()->AIName == "EventAI" ) + if( creature->GetAIName() == "EventAI" ) return PERMIT_BASE_SPECIAL; return PERMIT_BASE_NO; } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 9e4c7244c58..7096fa03dfa 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -591,6 +591,18 @@ void ObjectMgr::LoadCreatureTemplates() continue; } + if(heroicInfo->AIName && *heroicInfo->AIName) + { + sLog.outErrorDb("Heroic mode creature (Entry: %u) has `AIName`, but in any case will used normal mode creature (Entry: %u) AIName.",cInfo->HeroicEntry,i); + continue; + } + + if(heroicInfo->ScriptID) + { + sLog.outErrorDb("Heroic mode creature (Entry: %u) has `ScriptName`, but in any case will used normal mode creature (Entry: %u) ScriptName.",cInfo->HeroicEntry,i); + continue; + } + hasHeroicEntries.insert(i); heroicEntries.insert(cInfo->HeroicEntry); } |