diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3203df5a3..30963ad84 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -18513,6 +18513,15 @@ void Player::SetHomebind(WorldLocation const& loc, uint32 areaId) CharacterDatabase.Execute(stmt); } +void Player::SendBindPointUpdate() +{ + WorldPackets::Misc::BindPointUpdate packet; + packet.BindPosition = Position(m_homebindX, m_homebindY, m_homebindZ); + packet.BindMapID = m_homebindMapId; + packet.BindAreaID = m_homebindAreaId; + SendDirectMessage(packet.Write()); +} + uint32 Player::GetUInt32ValueFromArray(Tokenizer const& data, uint16 index) { if (index >= data.size()) @@ -25228,13 +25237,7 @@ void Player::SendInitialPacketsBeforeAddToMap() // guild bank list wtf? // Homebind - WorldPacket data(SMSG_BINDPOINTUPDATE, 4 + 4 + 4 + 4 + 4); - data << m_homebindX; - data << m_homebindZ; - data << m_homebindY; - data << (uint32) m_homebindAreaId; - data << (uint32) m_homebindMapId; - GetSession()->SendPacket(&data); + SendBindPointUpdate(); SendTalentsInfoData(); // SMSG_TALENTS_INFO SendInitialSpells(); // SMSG_INITIAL_SPELLS @@ -25247,7 +25250,7 @@ void Player::SendInitialPacketsBeforeAddToMap() SendEquipmentSetList(); - data.Initialize(SMSG_LOGIN_SETTIMESPEED, 20); + WorldPacket data(SMSG_LOGIN_SETTIMESPEED, 20); data << uint32(0); data.AppendPackedTime(sWorld->GetGameTime()); data << uint32(0); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 63cb8a4a1..e2aa806ae 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2824,6 +2824,7 @@ class TC_GAME_API Player : public Unit, public GridObject void SaveRecallPosition(); void SetHomebind(WorldLocation const& loc, uint32 areaId); + void SendBindPointUpdate(); // Homebind coordinates uint32 m_homebindMapId; diff --git a/src/server/game/Server/Packets/MiscPackets.cpp b/src/server/game/Server/Packets/MiscPackets.cpp index 8ef9de613..94f501647 100644 --- a/src/server/game/Server/Packets/MiscPackets.cpp +++ b/src/server/game/Server/Packets/MiscPackets.cpp @@ -174,6 +174,17 @@ WorldPacket const* WorldPackets::Misc::StopMirrorTimer::Write() return &_worldPacket; } +WorldPacket const* WorldPackets::Misc::BindPointUpdate::Write() +{ + _worldPacket << BindPosition.GetPositionX(); + _worldPacket << BindPosition.GetPositionY(); + _worldPacket << BindPosition.GetPositionZ(); + _worldPacket << uint32(BindAreaID); + _worldPacket << uint32(BindMapID); + + return &_worldPacket; +} + WorldPacket const* WorldPackets::Misc::Dismount::Write() { _worldPacket.WriteBit(Guid[6]); diff --git a/src/server/game/Server/Packets/MiscPackets.h b/src/server/game/Server/Packets/MiscPackets.h index 0dafff4ea..c30c860c4 100644 --- a/src/server/game/Server/Packets/MiscPackets.h +++ b/src/server/game/Server/Packets/MiscPackets.h @@ -188,6 +188,18 @@ namespace WorldPackets uint32 Timer = 0; }; + class BindPointUpdate final : public ServerPacket + { + public: + BindPointUpdate() : ServerPacket(SMSG_BIND_POINT_UPDATE, 20) { } + + WorldPacket const* Write() override; + + uint32 BindMapID = 0; + Position BindPosition; + uint32 BindAreaID = 0; + }; + class Dismount final : public ServerPacket { public: diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index e0ca263e2..ff14d758b 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -707,7 +707,7 @@ void OpcodeTable::Initialize() DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PET_SLOT_UPDATE, STATUS_NEVER); // 5.4.8 18414 DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PET_UPDATE, STATUS_NEVER); // 5.4.8 18414 DEFINE_SERVER_OPCODE_HANDLER(SMSG_BINDER_CONFIRM, STATUS_NEVER); // 5.4.8 18414 - DEFINE_SERVER_OPCODE_HANDLER(SMSG_BINDPOINTUPDATE, STATUS_NEVER); // 5.4.8 18414 + DEFINE_SERVER_OPCODE_HANDLER(SMSG_BIND_POINT_UPDATE, STATUS_NEVER); // 5.4.8 18414 DEFINE_SERVER_OPCODE_HANDLER(SMSG_BLACK_MARKET_BID_ON_ITEM_RESULT, STATUS_NEVER); // 5.4.8 18414 DEFINE_SERVER_OPCODE_HANDLER(SMSG_BLACK_MARKET_OPEN_RESULT, STATUS_NEVER); // 5.4.8 18414 DEFINE_SERVER_OPCODE_HANDLER(SMSG_BLACK_MARKET_OUTBID, STATUS_NEVER); // 5.4.8 18414 diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 7b5442d49..43761573c 100644 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -605,7 +605,7 @@ enum OpcodeServer : uint16 SMSG_BATTLE_PET_SLOT_UPDATE = 0x16AF, SMSG_BATTLE_PET_UPDATE = 0x041A, SMSG_BINDER_CONFIRM = 0x1287, - SMSG_BINDPOINTUPDATE = 0x0E3B, + SMSG_BIND_POINT_UPDATE = 0x0E3B, SMSG_BLACK_MARKET_BID_ON_ITEM_RESULT = 0x148A, SMSG_BLACK_MARKET_OPEN_RESULT = 0x00AE, SMSG_BLACK_MARKET_OUTBID = 0x1040, diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index f8ba1ee29..63c552326 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -6882,16 +6882,7 @@ void Spell::EffectBind(SpellEffIndex effIndex) } player->SetHomebind(homeLoc, areaId); - - // binding - WorldPacket data(SMSG_BINDPOINTUPDATE, 4 + 4 + 4 + 4 + 4); - data << float(homeLoc.GetPositionX()); - data << float(homeLoc.GetPositionY()); - data << float(homeLoc.GetPositionZ()); - data << uint32(areaId); - data << uint32(homeLoc.GetMapId()); - - player->SendDirectMessage(&data); + player->SendBindPointUpdate(); TC_LOG_DEBUG("spells", "EffectBind: New homebind X: %f, Y: %f, Z: %f, MapId: %u, AreaId: %u", homeLoc.GetPositionX(), homeLoc.GetPositionY(), homeLoc.GetPositionZ(), homeLoc.GetMapId(), areaId); @@ -6899,7 +6890,7 @@ void Spell::EffectBind(SpellEffIndex effIndex) ObjectGuid guid = m_caster->GetGUID(); // zone update - data.Initialize(SMSG_PLAYERBOUND, 1 + 8 + 4); + WorldPacket data(SMSG_PLAYERBOUND, 1 + 8 + 4); data.WriteBit(guid[2]); data.WriteBit(guid[4]); data.WriteBit(guid[0]);