*Add ai function spellclick

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-03 10:45:57 -05:00
parent f6e8ccb239
commit f4f61852c2
2 changed files with 14 additions and 7 deletions

View File

@@ -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() {}

View File

@@ -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 )