Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/development' into repacker
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jun 6, 2024
2 parents 217adf8 + e1ea256 commit 8f81901
Show file tree
Hide file tree
Showing 33 changed files with 5,630 additions and 1,660 deletions.
2 changes: 1 addition & 1 deletion src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ bool MovementAnticheat::IsLoggedOpcode(uint16 opcode)
case CMSG_FORCE_WALK_SPEED_CHANGE_ACK:
case CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK:
case CMSG_FORCE_TURN_RATE_CHANGE_ACK:
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4
case MSG_MOVE_TIME_SKIPPED:
#endif
return true;
Expand Down
4 changes: 4 additions & 0 deletions src/game/Battlegrounds/BattleGround.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,9 +960,11 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool transport, bool sen
sBattleGroundMgr.ScheduleQueueUpdate(bgQueueTypeId, bgTypeId, GetBracketId());

// Let others know
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_6_1
WorldPacket data;
sBattleGroundMgr.BuildPlayerLeftBattleGroundPacket(&data, guid);
SendPacketToTeam(team, &data, pPlayer, false);
#endif
}
}

Expand Down Expand Up @@ -1037,9 +1039,11 @@ void BattleGround::AddPlayer(Player* pPlayer)

UpdatePlayersCountByTeam(team, false); // +1 player

#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_6_1
WorldPacket data;
sBattleGroundMgr.BuildPlayerJoinedBattleGroundPacket(&data, pPlayer);
SendPacketToTeam(team, &data, pPlayer, false);
#endif

// setup BG group membership
PlayerAddedToBGCheckIfBGIsRunning(pPlayer);
Expand Down
2 changes: 2 additions & 0 deletions src/game/Battlegrounds/BattleGroundMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,7 @@ void BattleGroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid)
*data << uint32(soundid);
}

#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_6_1
void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket* data, ObjectGuid guid)
{
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
Expand All @@ -1128,6 +1129,7 @@ void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket* data, Pla
data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8);
*data << player->GetObjectGuid();
}
#endif

BattleGround* BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId)
{
Expand Down
2 changes: 2 additions & 0 deletions src/game/Battlegrounds/BattleGroundMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ class BattleGroundMgr
void Update(uint32 diff);

/* Packet Building */
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_6_1
void BuildPlayerJoinedBattleGroundPacket(WorldPacket* data, Player* player);
void BuildPlayerLeftBattleGroundPacket(WorldPacket* data, ObjectGuid guid);
#endif
void BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattleGroundTypeId bgTypeId);
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, int32 status);
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
Expand Down
8 changes: 4 additions & 4 deletions src/game/Group/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ void Group::SetTargetIcon(uint8 id, ObjectGuid targetGuid)

m_targetIcons[id] = targetGuid;

#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1 + 1 + 8));
data << uint8(0); // 1 - full icon list, 0 - delta update
data << uint8(id);
Expand Down Expand Up @@ -1312,7 +1312,7 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count, uint32& sum_le

void Group::SendTargetIconList(WorldSession* session)
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
if (!session)
return;

Expand All @@ -1335,7 +1335,7 @@ void Group::SendTargetIconList(WorldSession* session)
void Group::SendUpdate()
{
// sending full group list update clears marked targets when not in a raid, so we need to resend them
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
std::unique_ptr<WorldPacket> markedTargets;
if (!isRaidGroup())
{
Expand Down Expand Up @@ -1399,7 +1399,7 @@ void Group::SendUpdate()
}
player->GetSession()->SendPacket(&data);

#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
if (markedTargets)
player->GetSession()->SendPacket(markedTargets.get());
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/game/Handlers/AddonHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)

if (!uncompress(const_cast<uint8*>(AddOnPacked.contents()), &AddonRealSize, const_cast<uint8*>((*Source).contents() + CurrentPosition), (*Source).size() - CurrentPosition) != Z_OK)
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_6_1
Target->Initialize(SMSG_ADDON_INFO);

#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
Expand Down Expand Up @@ -155,6 +156,7 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
#endif
}
}
#endif
#endif
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/game/Handlers/BattleGroundHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void WorldSession::HandleBattlefieldJoinOpcode(WorldPacket& recv_data)
uint32 mapId;
recv_data >> mapId;

WorldPacket data(CMSG_BATTLEMASTER_JOIN);
WorldPacket data(recv_data.GetOpcode());
data << uint64(0);
data << uint32(mapId);
data << uint32(0);
Expand Down
2 changes: 1 addition & 1 deletion src/game/Handlers/GroupHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recv_data)

void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recv_data)
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
if (recv_data.empty()) // request
{
Group* group = GetPlayer()->GetGroup();
Expand Down
51 changes: 20 additions & 31 deletions src/game/Handlers/MovementHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void Player::ExecuteTeleportNear()

void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
{
uint32 const opcode = recvData.GetOpcode();
uint32 opcode = recvData.GetOpcode();

// Do not accept packets sent before this time.
if (recvData.GetPacketTime() <= m_moveRejectTime)
Expand Down Expand Up @@ -377,46 +377,35 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
if (opcode == CMSG_MOVE_FALL_RESET)
return;

WorldPacket data(opcode, recvData.size());

#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
data << m_clientMoverGuid.WriteAsPacked();
#else
data << m_clientMoverGuid.GetRawValue();
#endif
movementInfo.Write(data);

pMover->SendMovementMessageToSet(std::move(data), true, _player);

// Fix movement issue on older clients where if the player jumps while running,
// and then lets go of the key while in the air, he appears to continue moving
// forward on other people's screen. Once he moves for real, they will see him
// teleport back to where he was standing after he jumped.
// This opcode has no handler in this client build.
#if SUPPORTED_CLIENT_BUILD == CLIENT_BUILD_1_9_4
if (opcode == MSG_MOVE_FALL_LAND)
{
uint16 opcode2 = 0;
if (!movementInfo.HasMovementFlag(MOVEFLAG_MASK_MOVING))
opcode2 = MSG_MOVE_STOP;
opcode = MSG_MOVE_STOP;
else if (movementInfo.HasMovementFlag(MOVEFLAG_BACKWARD))
opcode2 = MSG_MOVE_START_BACKWARD;
opcode = MSG_MOVE_START_BACKWARD;
else if (movementInfo.HasMovementFlag(MOVEFLAG_FORWARD))
opcode2 = MSG_MOVE_START_FORWARD;
opcode = MSG_MOVE_START_FORWARD;
else if (movementInfo.HasMovementFlag(MOVEFLAG_STRAFE_LEFT))
opcode2 = MSG_MOVE_START_STRAFE_LEFT;
opcode = MSG_MOVE_START_STRAFE_LEFT;
else if (movementInfo.HasMovementFlag(MOVEFLAG_STRAFE_RIGHT))
opcode2 = MSG_MOVE_START_STRAFE_RIGHT;
opcode = MSG_MOVE_START_STRAFE_RIGHT;
else
opcode = MSG_MOVE_HEARTBEAT;
}
#endif

if (opcode2)
{
WorldPacket data(opcode2, recvData.size());
data << m_clientMoverGuid.WriteAsPacked(); // write guid
movementInfo.Write(data); // write data
WorldPacket data(opcode, recvData.size());

pMover->SendMovementMessageToSet(std::move(data), true, _player);
}
}
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
data << m_clientMoverGuid.WriteAsPacked();
#else
data << m_clientMoverGuid.GetRawValue();
#endif
movementInfo.Write(data);

pMover->SendMovementMessageToSet(std::move(data), true, _player);
}

/*
Expand Down Expand Up @@ -1055,7 +1044,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData)
pTransport->SendCreateUpdateToPlayer(_player);
}
}
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4
else
{
WorldPacket data(MSG_MOVE_TIME_SKIPPED, 12);
Expand Down
2 changes: 1 addition & 1 deletion src/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,7 @@ bool Map::SendToPlayersInZone(WorldPacket const* data, uint32 zoneId) const

void Map::SendDefenseMessage(int32 textId, uint32 zoneId) const
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2
for (const auto& itr : m_mapRefManager)
{
Player* pPlayer = itr.getSource();
Expand Down
18 changes: 18 additions & 0 deletions src/game/Movement/MovementPacketSender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,29 @@ void MovementPacketSender::SendMovementFlagChangeToObservers(Unit* unit, Movemen

void MovementPacketSender::SendMovementFlagChangeToAll(Unit* unit, MovementFlags mFlag, bool apply)
{

uint16 opcode;
switch (mFlag)
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4

#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4
case MOVEFLAG_ROOT: opcode = apply ? SMSG_SPLINE_MOVE_ROOT : SMSG_SPLINE_MOVE_UNROOT; break;
#else
case MOVEFLAG_ROOT:
{
if (apply)
{
WorldPacket data(MSG_MOVE_ROOT, 64);
data << unit->GetPackGUID();
data << unit->m_movementInfo;
unit->SendMovementMessageToSet(std::move(data), true);
}
else
opcode = SMSG_SPLINE_MOVE_UNROOT;
break;
}
#endif
case MOVEFLAG_WATERWALKING: opcode = apply ? SMSG_SPLINE_MOVE_WATER_WALK : SMSG_SPLINE_MOVE_LAND_WALK; break;
case MOVEFLAG_SAFE_FALL: opcode = apply ? SMSG_SPLINE_MOVE_FEATHER_FALL : SMSG_SPLINE_MOVE_NORMAL_FALL; break;
case MOVEFLAG_HOVER: opcode = apply ? SMSG_SPLINE_MOVE_SET_HOVER : SMSG_SPLINE_MOVE_UNSET_HOVER; break;
Expand Down
17 changes: 11 additions & 6 deletions src/game/Objects/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8777,9 +8777,11 @@ float Player::ComputeRest(time_t timePassed, bool offline /*= false*/, bool inRe

void Player::SetBindPoint(ObjectGuid guid) const
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_6_1
WorldPacket data(SMSG_BINDER_CONFIRM, 8);
data << ObjectGuid(guid);
GetSession()->SendPacket(&data);
#endif
}

void Player::SendTalentWipeConfirm(ObjectGuid guid) const
Expand All @@ -8792,13 +8794,16 @@ void Player::SendTalentWipeConfirm(ObjectGuid guid) const

void Player::SendPetSkillWipeConfirm() const
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_6_1
Pet* pet = GetPet();
if (!pet)
return;

WorldPacket data(SMSG_PET_UNLEARN_CONFIRM, (8 + 4));
data << ObjectGuid(pet->GetObjectGuid());
data << uint32(pet->GetResetTalentsCost());
GetSession()->SendPacket(&data);
#endif
}

/*********************************************************/
Expand Down Expand Up @@ -16439,7 +16444,7 @@ void Player::SendRaidInfo() const
*/
void Player::SendSavedInstances() const
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
bool hasBeenSaved = false;
WorldPacket data;

Expand Down Expand Up @@ -17528,7 +17533,7 @@ void Player::SendExplorationExperience(uint32 Area, uint32 Experience) const

void Player::SendFactionAtWar(uint32 reputationId, bool apply) const
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4
WorldPacket data(SMSG_SET_FACTION_ATWAR, 4 + 1);
data << uint32(reputationId);
data << uint8(apply ? FACTION_FLAG_AT_WAR : 0);
Expand Down Expand Up @@ -17625,7 +17630,7 @@ void Player::ResetPersonalInstanceOnLeaveDungeon(uint32 mapId)

void Player::SendResetInstanceSuccess(uint32 MapId) const
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
WorldPacket data(SMSG_INSTANCE_RESET, 4);
data << uint32(MapId);
GetSession()->SendPacket(&data);
Expand All @@ -17634,7 +17639,7 @@ void Player::SendResetInstanceSuccess(uint32 MapId) const

void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) const
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
// reason: see enum InstanceResetFailReason
WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 8);
data << uint32(reason);
Expand Down Expand Up @@ -19561,7 +19566,7 @@ void Player::SendTransferAborted(uint8 reason) const

void Player::SendInstanceResetWarning(uint32 mapid, uint32 _time) const
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1
// type of warning, based on the time remaining until reset
uint32 type;
if (_time > 3600)
Expand Down Expand Up @@ -20455,7 +20460,7 @@ void Player::ResurectUsingRequestData()

void Player::SetClientControl(Unit const* target, uint8 allowMove)
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4
WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, target->GetPackGUID().size() + 1);
data << target->GetPackGUID();
data << uint8(allowMove);
Expand Down
2 changes: 1 addition & 1 deletion src/game/Objects/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9058,7 +9058,7 @@ void Unit::SendPetActionFeedback(uint8 msg)

void Unit::SendPetTalk(uint32 pettalk)
{
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
if (Player* pOwner = ::ToPlayer(GetOwner()))
{
WorldPacket data(SMSG_PET_ACTION_SOUND, 8 + 4);
Expand Down
2 changes: 1 addition & 1 deletion src/game/Objects/UpdateData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void UpdateData::Clear()
m_outOfRangeGUIDs.clear();
}

#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1
bool MovementData::CanAddPacket(WorldPacket const& data)
{
// Since packet size is stored with an uint8, packet size is limited for compressed packets
Expand Down
2 changes: 1 addition & 1 deletion src/game/Objects/UpdateData.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class UpdateData
std::list<UpdatePacket> m_datas;
};

#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1
class MovementData
{
public:
Expand Down
2 changes: 1 addition & 1 deletion src/game/PlayerBots/CombatBotBaseAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3087,7 +3087,7 @@ void CombatBotBaseAI::SendBattlefieldPortPacket()

void CombatBotBaseAI::SendBattlemasterJoinPacket(uint8 battlegroundId)
{
WorldPacket data(CMSG_BATTLEMASTER_JOIN);
WorldPacket data(CMSG_BATTLEFIELD_JOIN);
data << me->GetObjectGuid(); // battlemaster guid, or player guid if joining queue from BG portal

switch (battlegroundId)
Expand Down
Loading

0 comments on commit 8f81901

Please sign in to comment.