Refactor Unit related ServerPackets#3406
Conversation
There was a problem hiding this comment.
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
AppendBodyToserializers. - Migrate call sites that previously built raw
WorldPackets to construct and send the new typed packets viaSendPacket(std::unique_ptr<...>),SendObjectMessageToSet,SendMessageToSet,SendToPlayers, etc. - Add
unique_ptr<ServerPacket const>-aware overloads onWorldObject,Player,Map, andMovementAnticheat.
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.
701abc3 to
7c68097
Compare
|
There is a merge conflict. |
|
There is a merge conflict once again. |
🍰 Pullrequest