mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/PacketIO: Corrected ActivateTaxiReply structure - fixes "There's no vendor nearby" message when starting flight
This commit is contained in:
@@ -460,11 +460,11 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
|
||||
if (sInfo->Effect == SPELL_EFFECT_SEND_TAXI)
|
||||
spellPaths.insert(sInfo->EffectMiscValue);
|
||||
|
||||
memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask));
|
||||
memset(sOldContinentsNodesMask, 0, sizeof(sOldContinentsNodesMask));
|
||||
memset(sHordeTaxiNodesMask, 0, sizeof(sHordeTaxiNodesMask));
|
||||
memset(sAllianceTaxiNodesMask, 0, sizeof(sAllianceTaxiNodesMask));
|
||||
memset(sDeathKnightTaxiNodesMask, 0, sizeof(sDeathKnightTaxiNodesMask));
|
||||
sTaxiNodesMask.fill(0);
|
||||
sOldContinentsNodesMask.fill(0);
|
||||
sHordeTaxiNodesMask.fill(0);
|
||||
sAllianceTaxiNodesMask.fill(0);
|
||||
sDeathKnightTaxiNodesMask.fill(0);
|
||||
for (TaxiNodesEntry const* node : sTaxiNodesStore)
|
||||
{
|
||||
TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(node->ID);
|
||||
|
||||
@@ -1361,6 +1361,6 @@ typedef std::vector<TaxiPathNodeEntry const*> TaxiPathNodeList;
|
||||
typedef std::vector<TaxiPathNodeList> TaxiPathNodesByPath;
|
||||
|
||||
#define TaxiMaskSize 217
|
||||
typedef uint8 TaxiMask[TaxiMaskSize];
|
||||
typedef std::array<uint8, TaxiMaskSize> TaxiMask;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
#include <limits>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
PlayerTaxi::PlayerTaxi()
|
||||
{
|
||||
memset(m_taximask, 0, sizeof(m_taximask));
|
||||
}
|
||||
|
||||
void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level)
|
||||
{
|
||||
// class specific initial known nodes
|
||||
@@ -47,7 +41,6 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
|
||||
SetTaximaskNode(620); // Gol'Bolar Quarry, Dun Morogh
|
||||
SetTaximaskNode(624); // Azure Watch, Azuremyst Isle
|
||||
break;
|
||||
|
||||
case RACE_ORC:
|
||||
case RACE_UNDEAD_PLAYER:
|
||||
case RACE_TAUREN:
|
||||
@@ -76,6 +69,7 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
|
||||
case ALLIANCE: SetTaximaskNode(100); break;
|
||||
case HORDE: SetTaximaskNode(99); break;
|
||||
}
|
||||
|
||||
// level dependent taxi hubs
|
||||
if (level >= 68)
|
||||
SetTaximaskNode(213); //Shattered Sun Staging Area
|
||||
@@ -96,24 +90,18 @@ void PlayerTaxi::LoadTaxiMask(std::string const &data)
|
||||
void PlayerTaxi::AppendTaximaskTo(WorldPackets::Taxi::ShowTaxiNodes& data, bool all)
|
||||
{
|
||||
if (all)
|
||||
{
|
||||
for (uint8 i = 0; i < TaxiMaskSize; ++i)
|
||||
data.Nodes.push_back(sTaxiNodesMask[i]); // all existed nodes
|
||||
}
|
||||
data.Nodes = &sTaxiNodesMask; // all existed nodes
|
||||
else
|
||||
{
|
||||
for (uint8 i = 0; i < TaxiMaskSize; ++i)
|
||||
data.Nodes.push_back(m_taximask[i]); // known nodes
|
||||
}
|
||||
data.Nodes = &m_taximask; // known nodes
|
||||
}
|
||||
|
||||
bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, uint32 team)
|
||||
{
|
||||
ClearTaxiDestinations();
|
||||
|
||||
Tokenizer Tokenizer(values, ' ');
|
||||
Tokenizer tokens(values, ' ');
|
||||
|
||||
for (Tokenizer::const_iterator iter = Tokenizer.begin(); iter != Tokenizer.end(); ++iter)
|
||||
for (Tokenizer::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
|
||||
{
|
||||
uint32 node = atoul(*iter);
|
||||
AddTaxiDestination(node);
|
||||
@@ -130,7 +118,7 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, uint3
|
||||
{
|
||||
uint32 cost;
|
||||
uint32 path;
|
||||
sObjectMgr->GetTaxiPath(m_TaxiDestinations[i-1], m_TaxiDestinations[i], path, cost);
|
||||
sObjectMgr->GetTaxiPath(m_TaxiDestinations[i - 1], m_TaxiDestinations[i], path, cost);
|
||||
if (!path)
|
||||
return false;
|
||||
}
|
||||
@@ -149,7 +137,7 @@ std::string PlayerTaxi::SaveTaxiDestinationsToString()
|
||||
|
||||
std::ostringstream ss;
|
||||
|
||||
for (size_t i=0; i < m_TaxiDestinations.size(); ++i)
|
||||
for (size_t i = 0; i < m_TaxiDestinations.size(); ++i)
|
||||
ss << m_TaxiDestinations[i] << ' ';
|
||||
|
||||
return ss.str();
|
||||
@@ -179,7 +167,7 @@ void PlayerTaxi::RequestEarlyLanding()
|
||||
{
|
||||
if (m_TaxiDestinations.empty())
|
||||
return;
|
||||
|
||||
|
||||
for (std::deque<uint32>::iterator it = m_TaxiDestinations.begin(); it != m_TaxiDestinations.end(); it++)
|
||||
if (IsTaximaskNodeKnown(*it))
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class PlayerTaxi
|
||||
{
|
||||
public:
|
||||
PlayerTaxi();
|
||||
PlayerTaxi() { }
|
||||
~PlayerTaxi() { }
|
||||
// Nodes
|
||||
void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level);
|
||||
@@ -57,7 +57,7 @@ class PlayerTaxi
|
||||
|
||||
friend std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi);
|
||||
private:
|
||||
TaxiMask m_taximask;
|
||||
TaxiMask m_taximask = { };
|
||||
std::deque<uint32> m_TaxiDestinations;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ WorldPacket const* WorldPackets::Taxi::ShowTaxiNodes::Write()
|
||||
_worldPacket.WriteBit(WindowInfo.is_initialized());
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
_worldPacket << uint32(Nodes.size());
|
||||
_worldPacket << uint32(Nodes->size());
|
||||
|
||||
if (WindowInfo.is_initialized())
|
||||
{
|
||||
@@ -44,8 +44,7 @@ WorldPacket const* WorldPackets::Taxi::ShowTaxiNodes::Write()
|
||||
_worldPacket << uint32(WindowInfo->CurrentNode);
|
||||
}
|
||||
|
||||
for (uint8 node : Nodes)
|
||||
_worldPacket << node;
|
||||
_worldPacket.append(Nodes->data(), Nodes->size());
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
@@ -68,11 +67,8 @@ void WorldPackets::Taxi::ActivateTaxi::Read()
|
||||
|
||||
WorldPacket const* WorldPackets::Taxi::ActivateTaxiReply::Write()
|
||||
{
|
||||
_worldPacket << Reply;
|
||||
_worldPacket.WriteBits(Reply, 4);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Taxi::TaxiRequestEarlyLanding::Read()
|
||||
{
|
||||
//Noop as it's empty packet
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "DB2Structure.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
@@ -60,64 +61,64 @@ namespace WorldPackets
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
Optional<ShowTaxiNodesWindowInfo> WindowInfo;
|
||||
std::vector<uint8> Nodes;
|
||||
TaxiMask const* Nodes = nullptr;
|
||||
};
|
||||
|
||||
|
||||
class EnableTaxiNode final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
EnableTaxiNode(WorldPacket&& packet) : ClientPacket(CMSG_ENABLE_TAXI_NODE, std::move(packet)) { }
|
||||
|
||||
|
||||
void Read() override;
|
||||
|
||||
|
||||
ObjectGuid Unit;
|
||||
};
|
||||
|
||||
|
||||
class TaxiQueryAvailableNodes final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
TaxiQueryAvailableNodes(WorldPacket&& packet) : ClientPacket(CMSG_TAXI_QUERY_AVAILABLE_NODES, std::move(packet)) { }
|
||||
|
||||
|
||||
void Read() override;
|
||||
|
||||
|
||||
ObjectGuid Unit;
|
||||
};
|
||||
|
||||
|
||||
class ActivateTaxi final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
ActivateTaxi(WorldPacket&& packet) : ClientPacket(CMSG_ACTIVATE_TAXI, std::move(packet)) { }
|
||||
|
||||
|
||||
void Read() override;
|
||||
|
||||
|
||||
ObjectGuid Vendor;
|
||||
uint32 Node;
|
||||
};
|
||||
|
||||
|
||||
class NewTaxiPath final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
NewTaxiPath() : ServerPacket(SMSG_NEW_TAXI_PATH, 0) { }
|
||||
|
||||
|
||||
WorldPacket const* Write() override { return &_worldPacket; }
|
||||
};
|
||||
|
||||
|
||||
class ActivateTaxiReply final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
ActivateTaxiReply() : ServerPacket(SMSG_ACTIVATE_TAXI_REPLY, 4) { }
|
||||
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 Reply;
|
||||
|
||||
uint8 Reply;
|
||||
};
|
||||
|
||||
|
||||
class TaxiRequestEarlyLanding final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
TaxiRequestEarlyLanding(WorldPacket&& packet) : ClientPacket(CMSG_TAXI_REQUEST_EARLY_LANDING, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user