mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 19:31:59 +01:00
*Fix a crash when toggle autocast for non-pet guardians.
*Allow control multiple guardians using one action bar (not fully implemented) --HG-- branch : trunk
This commit is contained in:
@@ -59,12 +59,17 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
|
||||
return;
|
||||
}
|
||||
|
||||
if(!pet->isAlive())
|
||||
return;
|
||||
|
||||
//TODO: allow control charmed player?
|
||||
if(pet->GetTypeId() == TYPEID_PLAYER && !(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
|
||||
return;
|
||||
|
||||
for(ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
|
||||
if((*itr)->GetEntry() == pet->GetEntry() && (*itr)->isAlive())
|
||||
HandlePetActionHelper(*itr, guid1, spellid, flag, guid2);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2)
|
||||
{
|
||||
CharmInfo *charmInfo = pet->GetCharmInfo();
|
||||
if(!charmInfo)
|
||||
{
|
||||
@@ -369,7 +374,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
|
||||
{
|
||||
if(pet->isCharmed())
|
||||
charmInfo->ToggleCreatureAutocast(spell_id, true);
|
||||
else
|
||||
else if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet())
|
||||
((Pet*)pet)->ToggleAutocast(spell_id, true);
|
||||
}
|
||||
//sign for no/turn off autocast
|
||||
@@ -377,7 +382,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
|
||||
{
|
||||
if(pet->isCharmed())
|
||||
charmInfo->ToggleCreatureAutocast(spell_id, false);
|
||||
else
|
||||
else if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet())
|
||||
((Pet*)pet)->ToggleAutocast(spell_id, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -558,6 +558,7 @@ class TRINITY_DLL_SPEC WorldSession
|
||||
|
||||
//Pet
|
||||
void HandlePetAction( WorldPacket & recv_data );
|
||||
void HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2);
|
||||
void HandlePetNameQuery( WorldPacket & recv_data );
|
||||
void HandlePetSetAction( WorldPacket & recv_data );
|
||||
void HandlePetAbandon( WorldPacket & recv_data );
|
||||
|
||||
Reference in New Issue
Block a user