mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[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:
parent
06dcbce4ee
commit
aab121fcb2
4 changed files with 12 additions and 9 deletions
|
|
@ -798,17 +798,20 @@ 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)
|
||||
{
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ class Pet : public Creature
|
|||
void GivePetXP(uint32 xp);
|
||||
void GivePetLevel(uint32 level);
|
||||
void SynchronizeLevelWithOwner();
|
||||
bool InitStatsForLevel(uint32 level);
|
||||
bool InitStatsForLevel(uint32 level, Unit* owner = NULL);
|
||||
bool HaveInDiet(ItemPrototype const* item) const;
|
||||
uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel);
|
||||
void SetDuration(int32 dur) { m_duration = dur; }
|
||||
|
|
|
|||
|
|
@ -3275,7 +3275,7 @@ void Spell::EffectSummon(uint32 i)
|
|||
spawnCreature->SetCreatorGUID(m_caster->GetGUID());
|
||||
spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||
|
||||
spawnCreature->InitStatsForLevel(level);
|
||||
spawnCreature->InitStatsForLevel(level, m_caster);
|
||||
|
||||
spawnCreature->GetCharmInfo()->SetPetNumber(pet_number, false);
|
||||
|
||||
|
|
@ -3705,7 +3705,7 @@ void Spell::EffectSummonGuardian(uint32 i)
|
|||
spawnCreature->SetCreatorGUID(m_caster->GetGUID());
|
||||
spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||
|
||||
spawnCreature->InitStatsForLevel(level);
|
||||
spawnCreature->InitStatsForLevel(level, m_caster);
|
||||
spawnCreature->GetCharmInfo()->SetPetNumber(pet_number, false);
|
||||
|
||||
spawnCreature->AIM_Initialize();
|
||||
|
|
@ -4195,7 +4195,7 @@ void Spell::EffectSummonPet(uint32 i)
|
|||
if(m_caster->IsPvP())
|
||||
NewSummon->SetPvP(true);
|
||||
|
||||
NewSummon->InitStatsForLevel(petlevel);
|
||||
NewSummon->InitStatsForLevel(petlevel, m_caster);
|
||||
NewSummon->InitPetCreateSpells();
|
||||
NewSummon->InitLevelupSpellsForLevel();
|
||||
NewSummon->InitTalentForLevel();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8110"
|
||||
#define REVISION_NR "8111"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue