refactor(Packet): Add ServerPacket structure#3361
refactor(Packet): Add ServerPacket structure#33610blu wants to merge 3 commits intovmangos:developmentfrom
Conversation
0e94066 to
896c5b3
Compare
| // Simplified SMSG_CAST_RESULT for a basic spell failure (status=2) with no extra data. | ||
| // For complex failures with additional payload (e.g. cooldown time, required area), | ||
| // use the full Spell::SendCastResult() path in Spell.cpp instead. | ||
| class CastResultSimpleFailure final : public ServerPacket |
There was a problem hiding this comment.
Why don't we pass the Spell* to the packet so it can build the whole structure?
There was a problem hiding this comment.
It will not invalidate the pointers. We read the new data into the existing spell entry.
https://github.com/vmangos/core/blob/development/src/game/Spells/SpellMgr.cpp#L3776
src/game/Server/Packets/Group.h
Outdated
| // --- Server Packets --- | ||
|
|
||
| static constexpr uint8 PARTY_MAX_POSITIVE_AURAS = 32; // MAX_POSITIVE_AURAS | ||
| static constexpr uint8 PARTY_MAX_NEGATIVE_AURAS = 16; // MAX_AURAS - MAX_POSITIVE_AURAS |
There was a problem hiding this comment.
why do we hardcode this here instead of using the actual defines
There was a problem hiding this comment.
Woops these changes were not intended for this PR.
I have a larger PR where I cherry picked some changes.
I would need to import SpellAuraDefines.h which then gets indirectly imported in a lot of places.
(because WorldSession.h has all the packet definitions imported)
src/game/Server/Packets/Petition.cpp
Outdated
| buffer << charterEntry; | ||
| buffer << charterDisplayId; | ||
| buffer << charterCost; | ||
| buffer << unknown; |
There was a problem hiding this comment.
have you tried taking a peak at how this is used to determine it's possible meaning?
|
For cases where the client assigns the same handler to multiple packets, reading the same structure, we should use the same packet class for them as well and just pass opcode in constructor, rather than creating duplicate structures. |
896c5b3 to
5f698c5
Compare
I would like to prevent mistakes in the code. I've used |
5f698c5 to
a1d82da
Compare
a1d82da to
a1385d1
Compare
That doesn't prevent us from having invalid structs. I don't like this duplication of code. There are a million movement packets with the same structure. |

Converts some of the manually built
WorldPacket(which were sent by the server) to nicely structuredServerPackets.Due to the large amount of changes required this will be split into multiple PRs.