diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-05-01 18:19:36 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2017-05-01 18:19:36 -0300 |
commit | f913f3bb8977c127d200d5d4a608ab434b21bbcd (patch) | |
tree | bb2d18ad5c0c23667271ca98bd6754cc745256a8 /src/server/game/Handlers/MiscHandler.cpp | |
parent | e4481c016a86fe7db0b83a434ea08eb7ba50174f (diff) |
Core/Scripts: unified scripted gossip/quest api
- Changed self-accessor on GameObjectAI to "me", like UnitAI
- Moved all related functions to AI, now Unit and GameObject have the same function names with identical behaviour
- Remove "OnUpdate" from CreatureScript/GameObjectScript, was never used and we already have AI Update method
- Quest methods no longer return a bool, the return value was used to call the AI version if the ScriptMgr one returned false
- Implemented GameObjectAI::Destroyed hook (was never called), implemented Damaged method
- Rename OnStateChanged to OnLootStateChanged to reflect when it's really called, and created a new hook OnStateChanged that only gets called on GOState change
- Since the functions are now only getting called from AI, made GetAI methods full virtual. (CanSpawn method is anyways going to be used on creatures with AI)
Diffstat (limited to 'src/server/game/Handlers/MiscHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/MiscHandler.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index e360493cd89..2e18f843a8d 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -146,14 +146,12 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) { if (unit) { - unit->AI()->sGossipSelectCode(_player, menuId, gossipListId, code.c_str()); - if (!sScriptMgr->OnGossipSelectCode(_player, unit, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str())) + if (!unit->AI()->GossipSelectCode(_player, menuId, gossipListId, code.c_str())) _player->OnGossipSelect(unit, gossipListId, menuId); } else { - go->AI()->GossipSelectCode(_player, menuId, gossipListId, code.c_str()); - if (!sScriptMgr->OnGossipSelectCode(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str())) + if (!go->AI()->GossipSelectCode(_player, menuId, gossipListId, code.c_str())) _player->OnGossipSelect(go, gossipListId, menuId); } } @@ -161,14 +159,12 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) { if (unit) { - unit->AI()->sGossipSelect(_player, menuId, gossipListId); - if (!sScriptMgr->OnGossipSelect(_player, unit, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId))) + if (!unit->AI()->GossipSelect(_player, menuId, gossipListId)) _player->OnGossipSelect(unit, gossipListId, menuId); } else { - go->AI()->GossipSelect(_player, menuId, gossipListId); - if (!sScriptMgr->OnGossipSelect(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId))) + if (!go->AI()->GossipSelect(_player, menuId, gossipListId)) _player->OnGossipSelect(go, gossipListId, menuId); } } |