[7666] For heroic mode creature use AIName from normal mode version in same way as done for ScriptName.

Also at creature templates loading check that AIName/ScriptName not set for heroic mode creature versions.
This commit is contained in:
VladimirMangos 2009-04-14 02:10:32 +04:00
parent 1ebf1a5ba4
commit 721e005b84
6 changed files with 25 additions and 9 deletions

View file

@ -1993,12 +1993,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;
}

View file

@ -532,8 +532,9 @@ class MANGOS_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 );

View file

@ -38,12 +38,10 @@ namespace FactorySelector
return scriptedAI;
CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance());
assert( creature->GetCreatureInfo() != NULL );
CreatureInfo const *cinfo=creature->GetCreatureInfo();
const CreatureAICreator *ai_factory = NULL;
std::string ainame=cinfo->AIName;
std::string ainame=creature->GetAIName();
// select by NPC flags _first_ - otherwise EventAI might be choosen for pets/totems
// excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI

View file

@ -32,7 +32,7 @@
int CreatureEventAI::Permissible(const Creature *creature)
{
if( creature->GetCreatureInfo()->AIName == "EventAI" )
if( creature->GetAIName() == "EventAI" )
return PERMIT_BASE_SPECIAL;
return PERMIT_BASE_NO;
}

View file

@ -528,6 +528,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);
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7665"
#define REVISION_NR "7666"
#endif // __REVISION_NR_H__