Skip to content

Refactor Unit related ServerPackets#3406

Merged
ratkosrb merged 3 commits into
vmangos:developmentfrom
0blu:nice-packet-10a
May 18, 2026
Merged

Refactor Unit related ServerPackets#3406
ratkosrb merged 3 commits into
vmangos:developmentfrom
0blu:nice-packet-10a

Conversation

@0blu
Copy link
Copy Markdown
Collaborator

@0blu 0blu commented May 11, 2026

🍰 Pullrequest

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a large mechanical refactor that converts many Unit/Player-related server packets from the old "build a WorldPacket inline" style to the new typed WorldPackets::* ServerPacket classes (with AppendBodyTo). It adds new packet definitions across Combat, Duel, Item, Loot, Misc, Npc, Pet, Skill, and Taxi, and updates call sites in Object, Unit, Player, Pet, Creature, Map, and the movement anticheat to use the new SendPacket(std::unique_ptr<ServerPacket const>) overloads. It also moves secsToTimeBitFields out of Util.h into Misc.cpp (its only remaining caller).

Changes:

  • Define many new typed server packet classes and their AppendBodyTo serializers.
  • Migrate call sites that previously built raw WorldPackets to construct and send the new typed packets via SendPacket(std::unique_ptr<...>), SendObjectMessageToSet, SendMessageToSet, SendToPlayers, etc.
  • Add unique_ptr<ServerPacket const>-aware overloads on WorldObject, Player, Map, and MovementAnticheat.

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/shared/Util.h Removes inline secsToTimeBitFields (relocated to Misc.cpp).
src/game/Anticheat/MovementAnticheat/MovementAnticheat.{h,cpp} Adds LogMovementPacket(ServerPacket const&) and uses new Notification packet.
src/game/Maps/Map.{h,cpp} Adds SendToPlayers(unique_ptr<ServerPacket const>, Team) overload.
src/game/Objects/Object.{h,cpp} Adds SendObjectMessageToSet unique_ptr overload; converts DestroyForPlayer, spawn/despawn anims, PlayDistanceSound.
src/game/Objects/Creature.cpp Converts AI reaction, zone-under-attack, spirit healer query to new packets.
src/game/Objects/Pet.cpp Converts PetBroken and PetMode sends to new packets.
src/game/Objects/Player.{h,cpp} Bulk conversion of dozens of player-side WorldPacket sites; adds SendMessageToSet(unique_ptr<...>, bool) overload.
src/game/Objects/Unit.cpp Converts kill log, durability damage, emote, attack start/stop, environmental damage log, pet feedback/talk/AI reaction, stand state.
src/game/Objects/ItemDefines.h Adds forward decl of Unit.
src/game/Spells/SpellEffects.cpp Uses helper SendObjectSpawnAnim and new BindpointUpdate/PlayerBound packets.
src/game/Server/Packets/Combat.{h,cpp} New AttackStart, PartyKillLog, EnvironmentalDamageLog packets.
src/game/Server/Packets/Duel.{h,cpp} New DuelComplete, DuelWinner, DuelCountdown packets.
src/game/Server/Packets/Item.{h,cpp} New OpenContainer, BuyFailed, SellItemResponse, BuyItemResponse, InventoryChangeFailure, ItemPushResult packets.
src/game/Server/Packets/Loot.{h,cpp} New LootReleaseResponse, LootRemoved packets.
src/game/Server/Packets/Misc.{h,cpp} Adds many new misc packets and moves secsToTimeBitFields here.
src/game/Server/Packets/Npc.{h,cpp} New AreaSpiritHealerTime, BinderConfirm packets.
src/game/Server/Packets/Pet.{h,cpp} New PetBroken, PetActionFeedback, PetActionSound, PetMode, PetUnlearnConfirm, PetTameFailure packets.
src/game/Server/Packets/Skill.{h,cpp} New SetProficiency packet.
src/game/Server/Packets/Taxi.{h,cpp} New ActivateTaxiReply packet.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/game/Objects/Player.cpp Outdated
Comment thread src/game/Objects/Player.cpp
Comment thread src/game/Objects/Unit.cpp Outdated
@0blu 0blu force-pushed the nice-packet-10a branch from 01333d3 to 819806d Compare May 13, 2026 18:18
Comment thread src/game/WorldStates.h
@0blu 0blu force-pushed the nice-packet-10a branch 2 times, most recently from 701abc3 to 7c68097 Compare May 14, 2026 11:56
@ratkosrb
Copy link
Copy Markdown
Contributor

There is a merge conflict.

@0blu 0blu force-pushed the nice-packet-10a branch from 7c68097 to 9627d73 Compare May 17, 2026 09:12
@ratkosrb
Copy link
Copy Markdown
Contributor

There is a merge conflict once again.

@0blu 0blu force-pushed the nice-packet-10a branch from 9627d73 to 911179d Compare May 18, 2026 07:22
Comment thread src/game/Objects/Player.cpp Outdated
Comment thread src/game/Server/Packets/Pet.h
Comment thread src/game/Server/Packets/Pet.h
@ratkosrb ratkosrb merged commit c20931e into vmangos:development May 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants