feat(Core/Pets): Management refactoring (#9712)

* feat(Core/Pets): rework managment

* 1

* 2

* 3

* 4

* 5

* cs pet

* check before ressurect

* pet DECLINED_NAMES

* display

- https://github.com/azerothcore/azerothcore-wotlk/issues/9297

* ArenaSpectator

* 1
This commit is contained in:
Kargatum
2021-12-31 04:45:13 +07:00
committed by GitHub
parent 24ab99919a
commit e12494d993
24 changed files with 1173 additions and 1208 deletions

View File

@@ -16609,11 +16609,10 @@ bool Unit::IsPetAura(Aura const* aura)
return false;
// if the owner has that pet aura, return true
for (PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end(); ++itr)
{
if ((*itr)->GetAura(GetEntry()) == aura->GetId())
for (PetAura const* petAura : owner->m_petAuras)
if (petAura->GetAura(GetEntry()) == aura->GetId())
return true;
}
return false;
}
@@ -16632,7 +16631,11 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id)
uint8 level = creatureTarget->getLevel() + 5 < getLevel() ? (getLevel() - 5) : creatureTarget->getLevel();
InitTamedPet(pet, level, spell_id);
if (!InitTamedPet(pet, level, spell_id))
{
delete pet;
return nullptr;
}
return pet;
}
@@ -16659,6 +16662,11 @@ Pet* Unit::CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id)
bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id)
{
Player* player = ToPlayer();
PetStable& petStable = player->GetOrInitPetStable();
if (petStable.CurrentPet || petStable.GetUnslottedHunterPet())
return false;
pet->SetCreatorGUID(GetGUID());
pet->SetFaction(GetFaction());
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
@@ -16676,6 +16684,7 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id)
// this enables pet details window (Shift+P)
pet->InitPetCreateSpells();
pet->SetFullHealth();
pet->FillPetInfo(&petStable.CurrentPet.emplace());
return true;
}