mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[7776] Completed implementation of CMSG_SPELLCLICK
For vehicles, you have to add the correct SPELL_AURA_CONTROL_VEHICLE spells to npc_spellclick_spells, otherwise you won't be able to use them
This commit is contained in:
parent
6e87802fa5
commit
fefe56e3c5
19 changed files with 225 additions and 39 deletions
|
|
@ -489,3 +489,29 @@ void WorldSession::HandleSelfResOpcode( WorldPacket & /*recv_data*/ )
|
|||
_player->SetUInt32Value(PLAYER_SELF_RES_SPELL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleSpellClick( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
|
||||
if(!unit)
|
||||
return;
|
||||
|
||||
SpellClickInfoMap const& map = objmgr.mSpellClickInfoMap;
|
||||
for(SpellClickInfoMap::const_iterator itr = map.lower_bound(unit->GetEntry()); itr != map.upper_bound(unit->GetEntry()); ++itr)
|
||||
{
|
||||
if(itr->second.questId == 0 || _player->GetQuestStatus(itr->second.questId) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
Unit *caster = (itr->second.castFlags & 0x1) ? (Unit*)_player : (Unit*)unit;
|
||||
Unit *target = (itr->second.castFlags & 0x2) ? (Unit*)_player : (Unit*)unit;
|
||||
|
||||
caster->CastSpell(target, itr->second.spellId, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue