aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/MiscHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers/MiscHandler.cpp')
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index b0514467667..c46656f7a53 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -98,9 +98,19 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
recvData >> guid >> menuId >> gossipListId;
+ if (!_player->PlayerTalkClass->GetGossipMenu().GetItem(gossipListId))
+ {
+ recvData.rfinish();
+ return;
+ }
+
if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId))
recvData >> code;
+ // Prevent cheating on C++ scripted menus
+ if (_player->PlayerTalkClass->GetGossipMenu().GetSenderGUID() != guid)
+ return;
+
Creature* unit = NULL;
GameObject* go = NULL;
if (IS_CRE_OR_VEH_GUID(guid))
@@ -152,7 +162,8 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
else
{
go->AI()->GossipSelectCode(_player, menuId, gossipListId, code.c_str());
- sScriptMgr->OnGossipSelectCode(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str());
+ if (!sScriptMgr->OnGossipSelectCode(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str()))
+ _player->OnGossipSelect(go, gossipListId, menuId);
}
}
else