aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-03 10:45:57 -0500
committermegamage <none@none>2009-05-03 10:45:57 -0500
commitf4f61852c2fc31b2e4cb10f14ea4487e2e850549 (patch)
tree7b0910169e48f8f3bff3942054b1b72cf007d4a4 /src
parentf6e8ccb239eaaa98bceab708a831e163d4107a3c (diff)
*Add ai function spellclick
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/CreatureAI.h2
-rw-r--r--src/game/MiscHandler.cpp19
2 files changed, 14 insertions, 7 deletions
diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h
index cae7026f6c7..f99d9fe33cb 100644
--- a/src/game/CreatureAI.h
+++ b/src/game/CreatureAI.h
@@ -242,6 +242,8 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
void OnCharmed(bool apply);
+ virtual void SpellClick(Player *player) {}
+
// Called at reaching home after evade
virtual void JustReachedHome() {}
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index 21342753909..f7f533893fe 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -1692,15 +1692,20 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
uint64 guid;
recv_data >> guid;
- Vehicle *vehicle = ObjectAccessor::GetVehicle(guid);
-
- if(!vehicle)
+ Creature *creature = NULL;
+ if(IS_VEHICLE_GUID(guid))
{
- sLog.outError("Player %s cannot find vehicle %u", _player->GetName(), guid);
- return;
+ Vehicle *vehicle = ObjectAccessor::GetVehicle(guid);
+ if(vehicle)
+ {
+ _player->EnterVehicle(vehicle);
+ creature = vehicle;
+ }
}
-
- _player->EnterVehicle(vehicle);
+ if(!creature)
+ creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
+ if(creature && creature->IsAIEnabled)
+ creature->AI()->SpellClick(_player);
}
void WorldSession::HandleInspectAchievements( WorldPacket & recv_data )