mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 10:37:01 +00:00
[10754] Use UNIT_FIELD_CRITTER for store minipet guid.
Also move related code to Unit and allow summon minipets by creatures. Signed-off-by: VladimirMangos <vladimir@getmangos.com> Also fix creature's totems unsummon at owner remove from world.
This commit is contained in:
parent
f671f09950
commit
92ed528eb9
7 changed files with 35 additions and 45 deletions
|
|
@ -7521,26 +7521,22 @@ void Spell::EffectCharge2(SpellEffectIndex /*eff_idx*/)
|
|||
|
||||
void Spell::DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction)
|
||||
{
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
Player* player = (Player*)m_caster;
|
||||
|
||||
uint32 pet_entry = m_spellInfo->EffectMiscValue[eff_idx];
|
||||
if(!pet_entry)
|
||||
return;
|
||||
|
||||
Pet* old_critter = player->GetMiniPet();
|
||||
Pet* old_critter = m_caster->GetMiniPet();
|
||||
|
||||
// for same pet just despawn
|
||||
if(old_critter && old_critter->GetEntry() == pet_entry)
|
||||
// for same pet just despawn (player unsummon command)
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && old_critter && old_critter->GetEntry() == pet_entry)
|
||||
{
|
||||
player->RemoveMiniPet();
|
||||
m_caster->RemoveMiniPet();
|
||||
return;
|
||||
}
|
||||
|
||||
// despawn old pet before summon new
|
||||
if(old_critter)
|
||||
player->RemoveMiniPet();
|
||||
if (old_critter)
|
||||
m_caster->RemoveMiniPet();
|
||||
|
||||
// summon new pet
|
||||
Pet* critter = new Pet(MINI_PET);
|
||||
|
|
@ -7596,7 +7592,7 @@ void Spell::DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction)
|
|||
if(duration > 0)
|
||||
critter->SetDuration(duration);
|
||||
|
||||
player->_SetMiniPet(critter);
|
||||
m_caster->SetMiniPet(critter);
|
||||
|
||||
map->Add((Creature*)critter);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue