From cc9889a3d495961657b1b5918fe1bdac6e7f8817 Mon Sep 17 00:00:00 2001 From: treeston Date: Tue, 18 Jul 2017 15:55:31 +0200 Subject: [PATCH] Core/Taxi: Properly send taxi node status on login, as well as if the taxi master is out of range. Closes #20035. (cherry picked from commit 24ec3ad3409e66f523f533ec1d9d573000a5807f) --- src/server/game/Handlers/TaxiHandler.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index 9e056f04c68..066fc7910a4 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -42,23 +42,24 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPackets::Taxi::TaxiNodeS void WorldSession::SendTaxiStatus(ObjectGuid guid) { - // cheating checks - Creature* unit = ObjectAccessor::GetCreature(*GetPlayer(), guid); - if (!unit) + Player* const player = GetPlayer(); + Creature* unit = ObjectAccessor::GetCreature(*player, guid); + if (!unit || unit->IsHostileTo(player) || !unit->HasNpcFlag(UNIT_NPC_FLAG_FLIGHTMASTER)) { TC_LOG_DEBUG("network", "WorldSession::SendTaxiStatus - %s not found.", guid.ToString().c_str()); return; } - uint32 curloc = sObjectMgr->GetNearestTaxiNode(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetMapId(), GetPlayer()->GetTeam()); + // find taxi node + uint32 nearest = sObjectMgr->GetNearestTaxiNode(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetMapId(), player->GetTeam()); WorldPackets::Taxi::TaxiNodeStatus data; data.Unit = guid; - if (!curloc) + if (!nearest) data.Status = TAXISTATUS_NONE; else if (unit->GetReactionTo(GetPlayer()) >= REP_NEUTRAL) - data.Status = GetPlayer()->m_taxi.IsTaximaskNodeKnown(curloc) ? TAXISTATUS_LEARNED : TAXISTATUS_UNLEARNED; + data.Status = GetPlayer()->m_taxi.IsTaximaskNodeKnown(nearest) ? TAXISTATUS_LEARNED : TAXISTATUS_UNLEARNED; else data.Status = TAXISTATUS_NOT_ELIGIBLE;