*Fix a crash when player toggle autocast for guardians.
--HG-- branch : trunk
This commit is contained in:
+10
-10
@@ -381,18 +381,19 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
|
|||||||
//sign for autocast
|
//sign for autocast
|
||||||
if(act_state == ACT_ENABLED && spell_id)
|
if(act_state == ACT_ENABLED && spell_id)
|
||||||
{
|
{
|
||||||
if(pet->isCharmed())
|
if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet())
|
||||||
charmInfo->ToggleCreatureAutocast(spell_id, true);
|
|
||||||
else if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet())
|
|
||||||
((Pet*)pet)->ToggleAutocast(spell_id, true);
|
((Pet*)pet)->ToggleAutocast(spell_id, true);
|
||||||
|
else
|
||||||
|
charmInfo->ToggleCreatureAutocast(spell_id, true);
|
||||||
}
|
}
|
||||||
//sign for no/turn off autocast
|
//sign for no/turn off autocast
|
||||||
else if(act_state == ACT_DISABLED && spell_id)
|
else if(act_state == ACT_DISABLED && spell_id)
|
||||||
{
|
{
|
||||||
if(pet->isCharmed())
|
if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet())
|
||||||
charmInfo->ToggleCreatureAutocast(spell_id, false);
|
|
||||||
else if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet())
|
|
||||||
((Pet*)pet)->ToggleAutocast(spell_id, false);
|
((Pet*)pet)->ToggleAutocast(spell_id, false);
|
||||||
|
else
|
||||||
|
charmInfo->ToggleCreatureAutocast(spell_id, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
charmInfo->GetActionBarEntry(position)->Type = act_state;
|
charmInfo->GetActionBarEntry(position)->Type = act_state;
|
||||||
@@ -570,11 +571,10 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pet->isCharmed())
|
if(pet->isPet())
|
||||||
//state can be used as boolean
|
|
||||||
pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state);
|
|
||||||
else
|
|
||||||
((Pet*)pet)->ToggleAutocast(spellid, state);
|
((Pet*)pet)->ToggleAutocast(spellid, state);
|
||||||
|
else
|
||||||
|
pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state);
|
||||||
|
|
||||||
for(uint8 i = 0; i < 10; ++i)
|
for(uint8 i = 0; i < 10; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user