aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Player/Player.cpp22
-rw-r--r--src/server/game/Entities/Player/Player.h1
-rw-r--r--src/server/game/Handlers/TaxiHandler.cpp18
3 files changed, 31 insertions, 10 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 1699550b8b5..4165ecb9b33 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -21326,6 +21326,27 @@ void Player::ContinueTaxiFlight() const
GetSession()->SendDoFlight(mountDisplayId, path, startNode);
}
+void Player::SendTaxiNodeStatusMultiple()
+{
+ for (auto itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
+ {
+ if (!itr->IsCreature())
+ continue;
+ Creature* creature = ObjectAccessor::GetCreature(*this, *itr);
+ if (!creature || creature->IsHostileTo(this))
+ continue;
+ if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER))
+ continue;
+ uint32 nearestNode = sObjectMgr->GetNearestTaxiNode(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetMapId(), GetTeam());
+ if (!nearestNode)
+ continue;
+ WorldPacket data(SMSG_TAXINODE_STATUS, 9);
+ data << *itr;
+ data << uint8(m_taxi.IsTaximaskNodeKnown(nearestNode) ? 1 : 0);
+ SendDirectMessage(&data);
+ }
+}
+
void Player::InitDataForForm(bool reapplyMods)
{
ShapeshiftForm form = GetShapeshiftForm();
@@ -22519,6 +22540,7 @@ void Player::SendInitialPacketsAfterAddToMap()
SendEnchantmentDurations(); // must be after add to map
SendItemDurations(); // must be after add to map
SendQuestGiverStatusMultiple();
+ SendTaxiNodeStatusMultiple();
// raid downscaling - send difficulty to player
if (GetMap()->IsRaid())
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 4a2a82000b4..6a0520121bd 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -946,6 +946,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0);
void CleanupAfterTaxiFlight();
void ContinueTaxiFlight() const;
+ void SendTaxiNodeStatusMultiple();
// mount_id can be used in scripting calls
bool isAcceptWhispers() const { return (m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS) != 0; }
void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
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);
}