diff options
author | megamage <none@none> | 2009-05-05 16:56:15 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-05 16:56:15 -0500 |
commit | e69d2cbed95b6cddd009f68dd80fd4614342d1fc (patch) | |
tree | 8dd0777d15adf284f2b0146e791ac4cd868b36e3 /src/game/SpellHandler.cpp | |
parent | dcb2b5aa019c409b1b9b1061aa4dd24c8ecacb5d (diff) |
[7776] Completed implementation of CMSG_SPELLCLICK Author: arrai
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
--HG--
branch : trunk
Diffstat (limited to 'src/game/SpellHandler.cpp')
-rw-r--r-- | src/game/SpellHandler.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 5cd5da67118..c24a9e2bb92 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -483,3 +483,30 @@ void WorldSession::HandleSelfResOpcode( WorldPacket & /*recv_data*/ ) } } +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); + } + } + + if(unit->isVehicle()) + _player->EnterVehicle((Vehicle*)unit); +} |