-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPacket.cs
223 lines (179 loc) · 7.1 KB
/
Packet.cs
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
namespace liveorlive_server {
public interface IPacket {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Lowercase for consistency with JSON")]
public string packetType { get; }
}
// Just to help classify stuff (Server comes from the server, client comes from client)
public interface IServerPacket : IPacket { }
public interface IClientPacket : IPacket { }
// Server packets
public record GameDataSyncPacket : IServerPacket {
public string packetType => "gameDataSync";
public required GameData gameData;
}
public record PlayerJoinedPacket : IServerPacket {
public string packetType => "playerJoined";
public required Player player;
}
public record PlayerJoinRejectedPacket : IServerPacket {
public string packetType => "playerJoinRejected";
public required string reason;
}
public record PlayerLeftPacket : IServerPacket {
public string packetType => "playerLeft";
public required string username;
}
public record HostSetPacket : IServerPacket {
public string packetType => "hostSet";
public required string username;
}
public record GameStartedPacket : IServerPacket {
public string packetType => "gameStarted";
}
public record NewRoundStartedPacket : IServerPacket {
public string packetType => "newRoundStarted";
public required List<Player> players;
public required int liveCount;
public required int blankCount;
}
public record TurnStartedPacket : IServerPacket {
public string packetType => "turnStarted";
public required string username;
}
public record TurnEndedPacket : IServerPacket {
public string packetType => "turnEnded";
public required string username;
}
public record ActionFailedPacket : IServerPacket {
public string packetType => "actionFailed";
public required string reason;
}
public record PlayerShotAtPacket : IServerPacket {
public string packetType => "playerShotAt";
public required string target;
public required AmmoType ammoType;
public required int damage; // Maybe derive ammoType from the damage (0 = blank?)
}
public record SkipItemUsedPacket : IServerPacket {
public string packetType => "skipItemUsed";
public required string target;
}
public record DoubleDamageItemUsedPacket : IServerPacket {
public string packetType => "doubleDamageItemUsed";
}
public record CheckBulletItemUsedPacket : IServerPacket {
public string packetType => "checkBulletItemUsed";
}
public record CheckBulletItemResultPacket : IServerPacket {
public string packetType => "checkBulletItemResult";
public required AmmoType result;
}
public record RebalancerItemUsedPacket : IServerPacket {
public string packetType => "rebalancerItemUsed";
public required AmmoType ammoType;
public required int count;
}
public record AdrenalineItemUsedPacket : IServerPacket {
public string packetType => "adrenalineItemUsed";
public required int result;
}
public record AddLifeItemUsedPacket : IServerPacket {
public string packetType => "addLifeItemUsed";
}
public record QuickshotItemUsedPacket : IServerPacket {
public string packetType => "quickshotItemUsed";
}
public record StealItemUsedPacket : IServerPacket {
public string packetType => "stealItemUsed";
public required string target;
public required Item item;
}
public record NewChatMessageSentPacket : IServerPacket {
public string packetType => "newChatMessageSent";
public required ChatMessage message;
}
public record ChatMessagesSyncPacket : IServerPacket {
public string packetType => "chatMessagesSync";
public required List<ChatMessage> messages;
}
public record GameLogMessagesSyncPacket : IServerPacket {
public string packetType => "gameLogMessagesSync";
public required List<GameLogMessage> messages;
}
public record ShowAlertPacket : IServerPacket {
public string packetType => "showAlert";
public required string content;
}
public record NewGameLogMessageSentPacket : IServerPacket {
public string packetType => "newGameLogMessageSent";
public required GameLogMessage message;
}
public record PlayerKickedPacket : IServerPacket {
public string packetType => "playerKicked";
public required string username;
public required string currentTurn;
}
// Client packets
public record JoinGamePacket : IClientPacket {
public string packetType => "joinGame";
public required string username;
}
public record SetHostPacket : IClientPacket {
public string packetType => "setHost";
public required string username;
}
public record GameDataRequestPacket : IClientPacket {
public string packetType => "gameDataRequest";
}
public record StartGamePacket : IClientPacket {
public string packetType => "startGame";
}
public record ShootPlayerPacket : IClientPacket {
public string packetType => "shootPlayer";
public required string target;
}
public record UseSkipItemPacket : IClientPacket {
public string packetType => "useSkipItem";
public required string target;
}
public record UseDoubleDamageItemPacket : IClientPacket {
public string packetType => "useDoubleDamageItem";
}
public record UseCheckBulletItemPacket : IClientPacket {
public string packetType => "useCheckBulletItem";
}
public record UseRebalancerItemPacket : IClientPacket {
public string packetType => "useRebalancerItem";
public required AmmoType ammoType;
}
public record UseAdrenalineItemPacket : IClientPacket {
public string packetType => "useAdrenalineItem";
}
public record UseAddLifeItemPacket : IClientPacket {
public string packetType => "useAddLifeItem";
}
public record UseQuickshotItemPacket : IClientPacket {
public string packetType => "useQuickshotItem";
}
public record UseStealItemPacket : IClientPacket {
public string packetType => "useStealItem";
public required string target;
public required Item item;
public required AmmoType? ammoType;
public required string? skipTarget;
}
public record SendNewChatMessagePacket : IClientPacket {
public string packetType => "sendNewChatMessage";
public required string content;
}
public record ChatMessagesRequestPacket : IClientPacket {
public string packetType => "chatMessagesRequest";
}
public record GameLogMessagesRequestPacket : IClientPacket {
public string packetType => "gameLogMessagesRequest";
}
public record KickPlayerPacket : IClientPacket {
public string packetType => "kickPlayer";
public required string username;
}
}