[9077] Fixes for pet work in case mounted owner.

* No unsummon temporary pet at non-fly mounting.
* Implement client side disable pet's action bar for mountted owner time

Signed-off-by: VladimirMangos <vladimir@getmangos.com>

* implement server side action disabled case (action bar modify, aggro reaction and autocast)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Lightguard 2009-12-28 15:44:02 +03:00 committed by VladimirMangos
parent 7d0a830bd4
commit 9c98bd92e2
10 changed files with 112 additions and 19 deletions

View file

@ -44,23 +44,33 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
// used also for charmed creature
Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)) );
if(!pet)
if (!pet)
{
sLog.outError( "Pet %u not exist.", uint32(GUID_LOPART(guid1)) );
return;
}
if(pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
{
sLog.outError("HandlePetAction.Pet %u isn't pet of player %s.", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName() );
return;
}
if(!pet->isAlive())
if (!pet->isAlive())
return;
if(pet->GetTypeId() == TYPEID_PLAYER && !(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
return;
if (pet->GetTypeId() == TYPEID_PLAYER)
{
// controller player can only do melee attack
if (!(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
return;
}
else if (((Creature*)pet)->isPet())
{
// pet can have action bar disabled
if(((Pet*)pet)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)
return;
}
CharmInfo *charmInfo = pet->GetCharmInfo();
if(!charmInfo)
@ -316,6 +326,10 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
return;
}
// pet can have action bar disabled
if(pet->isPet() && ((Pet*)pet)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)
return;
CharmInfo *charmInfo = pet->GetCharmInfo();
if(!charmInfo)
{