fix(Core/Gossips): Properly send packet with questgiver query handler. (#12290)

Fixes #12215
This commit is contained in:
UltraNix
2022-07-06 14:05:45 +02:00
committed by GitHub
parent 7814ac68cc
commit c3d8340e6b
4 changed files with 33 additions and 6 deletions

View File

@@ -98,6 +98,12 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data)
if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId))
recv_data >> code;
// Prevent cheating on C++ scripted menus
if (_player->PlayerTalkClass->GetGossipMenu().GetSenderGUID() != guid)
{
return;
}
Creature* unit = nullptr;
GameObject* go = nullptr;
Item* item = nullptr;
@@ -528,6 +534,16 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket& recv_data)
ObjectGuid guid;
recv_data >> guid;
if (!guid)
{
// Clear any active gossip related to current selection if not present at player's client
GossipMenu& gossipMenu = _player->PlayerTalkClass->GetGossipMenu();
if (gossipMenu.GetSenderGUID() == _player->GetTarget())
{
_player->PlayerTalkClass->SendCloseGossip();
}
}
_player->SetSelection(guid);
// Change target of current autoshoot spell