*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
+2
View File
@@ -242,6 +242,8 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
void OnCharmed(bool apply); void OnCharmed(bool apply);
virtual void SpellClick(Player *player) {}
// Called at reaching home after evade // Called at reaching home after evade
virtual void JustReachedHome() {} virtual void JustReachedHome() {}
+12 -7
View File
@@ -1692,15 +1692,20 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
uint64 guid; uint64 guid;
recv_data >> guid; recv_data >> guid;
Vehicle *vehicle = ObjectAccessor::GetVehicle(guid); Creature *creature = NULL;
if(IS_VEHICLE_GUID(guid))
if(!vehicle) {
Vehicle *vehicle = ObjectAccessor::GetVehicle(guid);
if(vehicle)
{ {
sLog.outError("Player %s cannot find vehicle %u", _player->GetName(), guid);
return;
}
_player->EnterVehicle(vehicle); _player->EnterVehicle(vehicle);
creature = vehicle;
}
}
if(!creature)
creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
if(creature && creature->IsAIEnabled)
creature->AI()->SpellClick(_player);
} }
void WorldSession::HandleInspectAchievements( WorldPacket & recv_data ) void WorldSession::HandleInspectAchievements( WorldPacket & recv_data )