[8111] Implemented support for implicit specify owner when initializing stats for summoned pets.

* Speedup of summoning pets (no need to seach owner by guid)
* Fixed problem that summond pets from NPC had not initialized stats
  (pet was not in world in time of stat init thus owner was not found)

Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
ApoC 2009-07-03 19:24:45 +02:00
parent 06dcbce4ee
commit aab121fcb2
4 changed files with 12 additions and 9 deletions

View file

@ -798,16 +798,19 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
return true;
}
bool Pet::InitStatsForLevel(uint32 petlevel)
bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
{
CreatureInfo const *cinfo = GetCreatureInfo();
assert(cinfo);
Unit* owner = GetOwner();
if(!owner)
{
sLog.outError("attempt to summon pet (Entry %u) without owner! Attempt terminated.", cinfo->Entry);
return false;
owner = GetOwner();
if(!owner)
{
sLog.outError("attempt to summon pet (Entry %u) without owner! Attempt terminated.", cinfo->Entry);
return false;
}
}
uint32 creature_ID = (getPetType() == HUNTER_PET) ? 1 : cinfo->Entry;