Don't unsummon pet while mounting in arena.
Disable pet's interface instead. --HG-- branch : trunk
This commit is contained in:
+30
-14
@@ -9466,16 +9466,22 @@ void Unit::Mount(uint32 mount)
|
|||||||
Pet* pet = GetPet();
|
Pet* pet = GetPet();
|
||||||
if(pet)
|
if(pet)
|
||||||
{
|
{
|
||||||
if(pet->isControlled())
|
BattleGround *bg = ((Player *)this)->GetBattleGround();
|
||||||
|
// don't unsummon pet in arena but SetFlag UNIT_FLAG_DISABLE_ROTATE to disable pet's interface
|
||||||
|
if(bg && bg->isArena())
|
||||||
|
pet->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
((Player*)this)->SetTemporaryUnsummonedPetNumber(pet->GetCharmInfo()->GetPetNumber());
|
if(pet->isControlled())
|
||||||
((Player*)this)->SetOldPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL));
|
{
|
||||||
|
((Player*)this)->SetTemporaryUnsummonedPetNumber(pet->GetCharmInfo()->GetPetNumber());
|
||||||
|
((Player*)this)->SetOldPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL));
|
||||||
|
}
|
||||||
|
((Player*)this)->RemovePet(NULL,PET_SAVE_NOT_IN_SLOT);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
((Player*)this)->RemovePet(NULL,PET_SAVE_NOT_IN_SLOT);
|
|
||||||
}
|
}
|
||||||
else
|
((Player*)this)->SetTemporaryUnsummonedPetNumber(0);
|
||||||
((Player*)this)->SetTemporaryUnsummonedPetNumber(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9492,13 +9498,19 @@ void Unit::Unmount()
|
|||||||
// only resummon old pet if the player is already added to a map
|
// only resummon old pet if the player is already added to a map
|
||||||
// this prevents adding a pet to a not created map which would otherwise cause a crash
|
// this prevents adding a pet to a not created map which would otherwise cause a crash
|
||||||
// (it could probably happen when logging in after a previous crash)
|
// (it could probably happen when logging in after a previous crash)
|
||||||
if(GetTypeId() == TYPEID_PLAYER && IsInWorld() && ((Player*)this)->GetTemporaryUnsummonedPetNumber() && isAlive())
|
if(GetTypeId() == TYPEID_PLAYER && IsInWorld() && isAlive())
|
||||||
{
|
{
|
||||||
Pet* NewPet = new Pet;
|
if( ((Player*)this)->GetTemporaryUnsummonedPetNumber() )
|
||||||
if(!NewPet->LoadPetFromDB(this, 0, ((Player*)this)->GetTemporaryUnsummonedPetNumber(), true))
|
{
|
||||||
delete NewPet;
|
Pet* NewPet = new Pet;
|
||||||
|
if(!NewPet->LoadPetFromDB(this, 0, ((Player*)this)->GetTemporaryUnsummonedPetNumber(), true))
|
||||||
((Player*)this)->SetTemporaryUnsummonedPetNumber(0);
|
delete NewPet;
|
||||||
|
((Player*)this)->SetTemporaryUnsummonedPetNumber(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(Pet *pPet = GetPet())
|
||||||
|
if(pPet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE) && !pPet->hasUnitState(UNIT_STAT_STUNNED))
|
||||||
|
pPet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12708,7 +12720,11 @@ void Unit::SetStunned(bool apply)
|
|||||||
{
|
{
|
||||||
if(isAlive() && getVictim())
|
if(isAlive() && getVictim())
|
||||||
SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID());
|
SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID());
|
||||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE);
|
|
||||||
|
// don't remove UNIT_FLAG_DISABLE_ROTATE for pet when owner is mounted (disabled pet's interface)
|
||||||
|
Unit *pOwner = GetOwner();
|
||||||
|
if(!pOwner || (pOwner->GetTypeId() == TYPEID_PLAYER && !((Player *)pOwner)->IsMounted()))
|
||||||
|
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_ROTATE);
|
||||||
|
|
||||||
if(!hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect
|
if(!hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user