diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Unit.cpp | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 86811c52a66..d2a10593a1d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9466,16 +9466,22 @@ void Unit::Mount(uint32 mount) Pet* pet = GetPet(); 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()); - ((Player*)this)->SetOldPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL)); + if(pet->isControlled()) + { + ((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 // 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) - if(GetTypeId() == TYPEID_PLAYER && IsInWorld() && ((Player*)this)->GetTemporaryUnsummonedPetNumber() && isAlive()) + if(GetTypeId() == TYPEID_PLAYER && IsInWorld() && isAlive()) { - Pet* NewPet = new Pet; - if(!NewPet->LoadPetFromDB(this, 0, ((Player*)this)->GetTemporaryUnsummonedPetNumber(), true)) - delete NewPet; - - ((Player*)this)->SetTemporaryUnsummonedPetNumber(0); + if( ((Player*)this)->GetTemporaryUnsummonedPetNumber() ) + { + Pet* NewPet = new Pet; + if(!NewPet->LoadPetFromDB(this, 0, ((Player*)this)->GetTemporaryUnsummonedPetNumber(), true)) + 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()) 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 { |