fix(battle-node): MsgEnvelope rejects reserved Body keys + complete ReceiveNodeResultCode
ToJson now throws ArgumentException when a Body key collides with a reserved envelope field (uri/viewerId/uuid/bid/try/cat/pubSeq/playSeq); FromJson reuses the same shared ReservedEnvelopeKeys HashSet. ReceiveNodeResultCode expanded from 9 to 31 codes to mirror the full enums.md catalog. Two regression tests added for the collision guard and PascalCase uri serialization. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
namespace SVSim.BattleNode.Protocol;
|
||||
|
||||
/// <summary>The "resultCode" field on synchronize pushes. 1=Success, else error.</summary>
|
||||
/// <summary>
|
||||
/// The "resultCode" field on synchronize pushes. 1 = Success, else error.
|
||||
/// Mirrors the full catalog from docs/api-spec/in-battle/enums.md, including
|
||||
/// source typos in the original spec (RoomBattleReadeError, RoomTornament*).
|
||||
/// </summary>
|
||||
public enum ReceiveNodeResultCode
|
||||
{
|
||||
None = 0,
|
||||
@@ -8,9 +12,30 @@ public enum ReceiveNodeResultCode
|
||||
Different_UUID = 30001,
|
||||
RedisReplyError = 30002,
|
||||
UnexistUserinfoError = 30003,
|
||||
RoomStatusInfoError = 30101,
|
||||
RoomCreateError = 30102,
|
||||
RoomEntryError = 30103,
|
||||
RoomKickError = 30104,
|
||||
RoomLeaveError = 30105,
|
||||
RoomReleaseError = 30106,
|
||||
RoomForceReleaseError = 30107,
|
||||
RoomReenterError = 30108,
|
||||
RoomBattleReadeError = 30109, // source typo per spec, preserved
|
||||
RoomTournamentDeckError = 30110,
|
||||
RoomTournamentError = 30111,
|
||||
RoomSetupLock = 30112,
|
||||
MatchingTimeOut = 30201,
|
||||
UnmatchedError = 30211,
|
||||
CurrentBattleError = 30212,
|
||||
UnexpectedPhaseError = 30213,
|
||||
// Other codes from spec/enums.md added as needed; v1 only triggers the four above.
|
||||
WatchError = 30302,
|
||||
SwapTimeoutError = 31001,
|
||||
FoundRemovedUserErrorSelf = 32101,
|
||||
FoundRemovedUserErrorOppo = 32102,
|
||||
FoundRemovedUserErrorWatcher = 32103,
|
||||
RoomTimeEndError = 32104,
|
||||
WatcherInRemovedOwnerRoomError = 32105,
|
||||
RoomTornamentOwnTimeEndError = 32106, // source typo per spec, preserved
|
||||
RoomTornamentOppoTimeEndError = 32107, // source typo per spec, preserved
|
||||
BattleFinishTimeEnd = 32108,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user