*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:
+10
-5
@@ -59,12 +59,17 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pet->isAlive())
|
//TODO: allow control charmed player?
|
||||||
return;
|
|
||||||
|
|
||||||
if(pet->GetTypeId() == TYPEID_PLAYER && !(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
|
if(pet->GetTypeId() == TYPEID_PLAYER && !(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
|
||||||
return;
|
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();
|
CharmInfo *charmInfo = pet->GetCharmInfo();
|
||||||
if(!charmInfo)
|
if(!charmInfo)
|
||||||
{
|
{
|
||||||
@@ -369,7 +374,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
|
|||||||
{
|
{
|
||||||
if(pet->isCharmed())
|
if(pet->isCharmed())
|
||||||
charmInfo->ToggleCreatureAutocast(spell_id, true);
|
charmInfo->ToggleCreatureAutocast(spell_id, true);
|
||||||
else
|
else if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet())
|
||||||
((Pet*)pet)->ToggleAutocast(spell_id, true);
|
((Pet*)pet)->ToggleAutocast(spell_id, true);
|
||||||
}
|
}
|
||||||
//sign for no/turn off autocast
|
//sign for no/turn off autocast
|
||||||
@@ -377,7 +382,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
|
|||||||
{
|
{
|
||||||
if(pet->isCharmed())
|
if(pet->isCharmed())
|
||||||
charmInfo->ToggleCreatureAutocast(spell_id, false);
|
charmInfo->ToggleCreatureAutocast(spell_id, false);
|
||||||
else
|
else if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet())
|
||||||
((Pet*)pet)->ToggleAutocast(spell_id, false);
|
((Pet*)pet)->ToggleAutocast(spell_id, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -558,6 +558,7 @@ class TRINITY_DLL_SPEC WorldSession
|
|||||||
|
|
||||||
//Pet
|
//Pet
|
||||||
void HandlePetAction( WorldPacket & recv_data );
|
void HandlePetAction( WorldPacket & recv_data );
|
||||||
|
void HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2);
|
||||||
void HandlePetNameQuery( WorldPacket & recv_data );
|
void HandlePetNameQuery( WorldPacket & recv_data );
|
||||||
void HandlePetSetAction( WorldPacket & recv_data );
|
void HandlePetSetAction( WorldPacket & recv_data );
|
||||||
void HandlePetAbandon( WorldPacket & recv_data );
|
void HandlePetAbandon( WorldPacket & recv_data );
|
||||||
|
|||||||
Reference in New Issue
Block a user