Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core/Packet] Split SMSG_BIND_POINT_UPDATE to MiscPacket #372

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Entities/Player/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -2824,6 +2824,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void SaveRecallPosition();

void SetHomebind(WorldLocation const& loc, uint32 areaId);
void SendBindPointUpdate();

// Homebind coordinates
uint32 m_homebindMapId;
Expand Down
11 changes: 11 additions & 0 deletions src/server/game/Server/Packets/MiscPackets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
12 changes: 12 additions & 0 deletions src/server/game/Server/Packets/MiscPackets.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Server/Protocol/Opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Server/Protocol/Opcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 2 additions & 11 deletions src/server/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6882,24 +6882,15 @@ 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);

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]);
Expand Down
Loading