diff options
| author | treeston <treeston.mmoc@gmail.com> | 2017-07-18 15:55:31 +0200 |
|---|---|---|
| committer | treeston <treeston.mmoc@gmail.com> | 2017-07-18 15:55:31 +0200 |
| commit | 24ec3ad3409e66f523f533ec1d9d573000a5807f (patch) | |
| tree | 46c4229933bc0454e8eb12c134d2f0d85e1e9f32 /src/server/game/Handlers/TaxiHandler.cpp | |
| parent | d99f4e8900a5445ccf4ef2396acc35afa9995e23 (diff) | |
Core/Taxi: Properly send taxi node status on login, as well as if the taxi master is out of range. Closes #20035.
Diffstat (limited to 'src/server/game/Handlers/TaxiHandler.cpp')
| -rw-r--r-- | src/server/game/Handlers/TaxiHandler.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index 3912707ea25..b35b2d711d2 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -21,6 +21,7 @@ #include "DatabaseEnv.h" #include "DBCStores.h" #include "Log.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Opcodes.h" #include "Player.h" @@ -39,25 +40,22 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData) void WorldSession::SendTaxiStatus(ObjectGuid guid) { - // cheating checks - Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); - if (!unit) + Player* const player = GetPlayer(); + Creature* unit = ObjectAccessor::GetCreature(*player, guid); + if (!unit || unit->IsHostileTo(player) || !unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER)) { TC_LOG_DEBUG("network", "WorldSession::SendTaxiStatus - %s not found or you can't interact with him.", guid.ToString().c_str()); return; } - uint32 curloc = sObjectMgr->GetNearestTaxiNode(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetMapId(), GetPlayer()->GetTeam()); - - // not found nearest - if (curloc == 0) + // find taxi node + uint32 nearest = sObjectMgr->GetNearestTaxiNode(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetMapId(), player->GetTeam()); + if (!nearest) return; - TC_LOG_DEBUG("network", "WORLD: current location %u ", curloc); - WorldPacket data(SMSG_TAXINODE_STATUS, 9); data << guid; - data << uint8(GetPlayer()->m_taxi.IsTaximaskNodeKnown(curloc) ? 1 : 0); + data << uint8(player->m_taxi.IsTaximaskNodeKnown(nearest) ? 1 : 0); SendPacket(&data); } |
