mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +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
|
|
@ -5849,6 +5849,22 @@ Pet* Unit::_GetPet(ObjectGuid guid) const
|
|||
return GetMap()->GetPet(guid);
|
||||
}
|
||||
|
||||
void Unit::RemoveMiniPet()
|
||||
{
|
||||
if (Pet* pet = GetMiniPet())
|
||||
pet->Unsummon(PET_SAVE_AS_DELETED, this);
|
||||
else
|
||||
SetCritterGuid(ObjectGuid());
|
||||
}
|
||||
|
||||
Pet* Unit::GetMiniPet() const
|
||||
{
|
||||
if (GetCritterGuid().IsEmpty())
|
||||
return NULL;
|
||||
|
||||
return GetMap()->GetPet(GetCritterGuid());
|
||||
}
|
||||
|
||||
Unit* Unit::GetCharm() const
|
||||
{
|
||||
ObjectGuid charm_guid = GetCharmGuid();
|
||||
|
|
@ -8365,6 +8381,7 @@ void Unit::SetDeathState(DeathState s)
|
|||
{
|
||||
RemoveAllAurasOnDeath();
|
||||
RemoveGuardians();
|
||||
RemoveMiniPet();
|
||||
UnsummonAllTotems();
|
||||
|
||||
// after removing a Fearaura (in RemoveAllAurasOnDeath)
|
||||
|
|
@ -9287,6 +9304,8 @@ void Unit::RemoveFromWorld()
|
|||
Uncharm();
|
||||
RemoveNotOwnSingleTargetAuras();
|
||||
RemoveGuardians();
|
||||
RemoveMiniPet();
|
||||
UnsummonAllTotems();
|
||||
RemoveAllGameObjects();
|
||||
RemoveAllDynObjects();
|
||||
CleanupDeletedAuras();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue