diff options
author | Rochet2 <rochet2@post.com> | 2017-08-14 00:42:02 +0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2017-08-13 23:42:02 +0200 |
commit | e5b9c207f8889010c88f66ea39160659137402d3 (patch) | |
tree | 9554e728e3f7a39f79b55a17d2f1c7e894fafcca /src/server/game/Handlers/NPCHandler.cpp | |
parent | f17cb00ee36f834a103268742246c13b09458d2f (diff) |
Core/Creatures: Implement a general way to store selection data for gossip and fix trainer exploit (#20085)
* Implement mail check
* Implement CloseInteraction packet
Diffstat (limited to 'src/server/game/Handlers/NPCHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/NPCHandler.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index d4e9f23482e..6d16a63d81a 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -113,7 +113,9 @@ void WorldSession::SendTrainerList(ObjectGuid guid, uint32 trainerId) return; } - _player->SetCurrentTrainerId(trainerId); + _player->PlayerTalkClass->GetInteractionData().Reset(); + _player->PlayerTalkClass->GetInteractionData().SourceGuid = guid; + _player->PlayerTalkClass->GetInteractionData().TrainerId = trainerId; trainer->SendSpells(unit, _player, GetSessionDbLocaleIndex()); } @@ -132,7 +134,10 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPackets::NPC::TrainerBuySpel if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - if (_player->GetCurrentTrainerId() != uint32(packet.TrainerID)) + if (_player->PlayerTalkClass->GetInteractionData().SourceGuid != packet.TrainerGUID) + return; + + if (_player->PlayerTalkClass->GetInteractionData().TrainerId != uint32(packet.TrainerID)) return; Trainer::Trainer const* trainer = sObjectMgr->GetTrainer(packet.TrainerID); @@ -190,7 +195,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPackets::NPC::GossipSelec return; // Prevent cheating on C++ scripted menus - if (_player->PlayerTalkClass->GetGossipMenu().GetSenderGUID() != packet.GossipUnit) + if (_player->PlayerTalkClass->GetInteractionData().SourceGuid != packet.GossipUnit) return; Creature* unit = nullptr; |