Update NPCHandler.cpp

This commit is contained in:
manstfu 2025-02-15 13:02:28 +01:00 committed by GitHub
parent 5de2bb0a11
commit 874a124588
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,8 +94,8 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle,
{
LOG_DEBUG("network", "WORLD: SendTrainerList");
Creature* unit = trainerEntry ? GetPlayer()->GetMap()->GetCreature(guid) : GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit && !trainerEntry)
{
LOG_DEBUG("network", "WORLD: SendTrainerList - Unit ({}) not found or you can not interact with him.", guid.ToString());
return;
@ -217,8 +217,8 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
recvData >> guid >> spellId;
Creature* unit = GetCurrentTrainer() ? GetPlayer()->GetMap()->GetCreature(guid) : GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit && !GetCurrentTrainer())
{
LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit ({}) not found or you can not interact with him.", guid.ToString());
return;