-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnetmsg.nim
195 lines (147 loc) · 2.94 KB
/
netmsg.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import netmsgtypes, netmsgdefs, msgpacker, strutils
# sys messages
type NetSysMsg* {.pure.} = enum
Null,
# sent by client
Info,
# sent by server
MapChange,
MapData,
ConReady,
Snap,
SnapEmpty,
SnapSingle,
SnapSmall,
InputTiming,
RconAuthStatus,
RconLine,
AuthChallenge,
AuthResult,
# sent by client
Ready,
EnterGame,
Input,
RconCmd,
RconAuth,
RequestMapData,
AuthStart,
AuthResponse,
# sent by both
Ping,
PingReply,
Error,
# sent by server
RconCmdAdd,
RconCmdRem
# game messages
# server messages
netmsg:
Invalid: discard
SvMotd:
msg: string
SvBroadcast:
msg: string
SvChat:
team: Team
clientId: ClientId
msg: StringHalfStrict
SvKillMsg:
killer: ClientId
victim: ClientId
weapon: Weapon
modeSpecial: int
SvSoundGlobal:
soundId: Sound
SvTuneParams: discard
SvExtraProjectile: discard
SvReadyToEnter: discard
SvWeaponPickup:
weapon: Weapon
SvEmoticon:
clientId: ClientId
emoticon: Emoticon
SvVoteClearOptions: discard
SvVoteOptionListAdd:
numOptions: range[1 .. 15]
description0: StringStrict
description1: StringStrict
description2: StringStrict
description3: StringStrict
description4: StringStrict
description5: StringStrict
description6: StringStrict
description7: StringStrict
description8: StringStrict
description9: StringStrict
description10: StringStrict
description11: StringStrict
description12: StringStrict
description13: StringStrict
description14: StringStrict
SvVoteOptionAdd:
description: StringStrict
SvVoteOptionRemove:
description: StringStrict
SvVoteSet:
timeout: range[0 .. 60]
description: StringStrict
reason: StringStrict
SvVoteStatus:
yes: ClientIdValid
no: ClientIdValid
pass: ClientIdValid
total: ClientIdValid
# client messages
ClSay:
team: bool
msg: StringHalfStrict
ClSetTeam:
team: Team
ClSetSpectatorMode:
spectatorId: SpectatorId
ClStartInfo:
name: StringStrict
clan: StringStrict
country: int
skin: StringStrict
useCustomColor: bool
colorBody: int
colorFeet: int
ClChangeInfo:
name: StringStrict
clan: StringStrict
country: int
skin: StringStrict
useCustomColor: bool
colorBody: int
colorFeet: int
ClKill: discard
ClEmoticon:
emoticon: Emoticon
ClVote:
vote: range[-1 .. 1]
ClCallVote:
typeStr: StringStrict
value: StringStrict
reason: StringStrict
ClIsDDNet: discard
SvDDRaceTime:
time: int
check: int
finish: range[0 .. 1]
SvRecord:
serverTimeBest: int
playerTimeBest: int
SvPlayerTime:
time: int
clientId: ClientId
SvTeamsState: discard
ClShowOthers:
show: bool
when isMainModule:
var t = SvPlayerTime()
t.time = 5
t.clientId = 15
var msg : NetMsg = t
var t2 = SvPlayerTime(msg)
echo("msg: ", t2[])