mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Taxi: Properly send taxi node status on login, as well as if the taxi master is out of range. Closes #20035.
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user