This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.proto
208 lines (171 loc) · 3.66 KB
/
main.proto
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
syntax = "proto3";
package murdermystery;
option go_package = "github.com/Scoder12/murdermystery/backend/protocol/pb";
// Server Messages
message Handshake {
enum Status {
UNKNOWN = 0;
OK = 1;
}
Status status = 1;
int32 id = 2;
}
message Host { bool isHost = 1; }
message Players {
message Player {
string name = 1;
int32 id = 2;
}
repeated Player players = 1;
int32 host_id = 2;
}
message Error {
enum E_type {
UNKNOWN = 0;
DISCONNECT = 1;
BADNAME = 2;
}
E_type msg = 1;
}
message Alert {
enum Msg {
UNKNOWN = 0;
NEEDMOREPLAYERS = 1;
}
Msg msg = 1;
}
enum Character {
NONE = 0;
CITIZEN = 1;
WEREWOLF = 2;
HEALER = 3;
PROPHET = 4;
HUNTER = 5;
}
message SetCharacter { Character character = 1; }
message FellowWolves { repeated int32 ids = 1; }
message VoteRequest {
enum Type {
UNKNOWN = 0;
KILL = 1;
PROPHET = 2;
HEALERHEAL = 3;
HEALERPOISON = 4;
JURY = 5;
}
repeated int32 choice_IDs = 1;
Type type = 2;
}
enum VoteResultType {
NOWINNER = 0;
WIN = 1;
TIE = 2;
}
message JuryVoteResult {
VoteResultType status = 1;
int32 winner = 2;
}
message VoteResult {
message CandidateResult {
int32 id = 1;
repeated int32 voters = 2;
}
repeated CandidateResult candidates = 1;
JuryVoteResult jury = 2;
}
message VoteOver { VoteResult result = 1; }
message ProphetReveal {
int32 id = 1;
bool good = 2;
}
message KillReveal { repeated int32 killed_IDs = 1; }
enum KillReason {
UNKNOWN = 0;
WOLVES = 1;
VOTED = 2;
HEALERPOISON = 3;
}
message Killed { KillReason reason = 1; }
message GameOver {
enum Reason {
NONE = 0;
WEREWOLF_WIN = 1;
CITIZEN_WIN = 2;
}
message Player {
int32 id = 1;
Character character = 2;
}
Reason reason = 1;
repeated Player players = 2;
}
message SpectatorAssignedCharacter {
int32 id = 1;
Character character = 2;
}
message SpectatorProphetReveal {
int32 prophet_id = 1;
int32 choice_id = 2;
bool good = 3;
}
message SpectatorHealerHeal {
int32 healer = 1;
repeated int32 healed = 2;
}
// Don't need SpectatorHealerPoison because that is a KillReason handled by
// SpecatatorKill.
message SpectatorKill {
KillReason reason = 1;
int32 killed = 2;
}
message SpectatorVoteRequest {
repeated int32 voters = 1;
VoteRequest vote_request = 2;
}
message SpectatorVoteOver { VoteOver vote_over = 3; }
// No SpectatorGameOver, GameOver is broadcast to everyone
message SpectatorUpdate {
oneof evt {
SpectatorAssignedCharacter set_char = 1;
SpectatorProphetReveal prophet_reveal = 2;
SpectatorHealerHeal healer_heal = 3;
SpectatorKill kill = 4;
SpectatorVoteRequest vote_request = 5;
SpectatorVoteOver vote_over = 6;
}
}
message BulkSpectatorUpdate { repeated SpectatorUpdate update = 1; }
message PlayerStatus { repeated int32 alive = 1; }
// The Server message
message ServerMessage {
oneof data {
Handshake handshake = 1;
Host host = 2;
Players players = 3;
Error error = 4;
Alert alert = 5;
SetCharacter set_character = 6;
FellowWolves fellow_wolves = 7;
VoteRequest vote_request = 8;
VoteOver vote_over = 9;
ProphetReveal prophet_reveal = 11;
SpectatorUpdate spectator_update = 12;
KillReveal kill_reveal = 13;
Killed killed = 14;
GameOver game_over = 15;
BulkSpectatorUpdate bulk_spectator_update = 16;
PlayerStatus player_status = 17;
}
}
// Client Messages
message SetName { string name = 1; }
message StartGame {}
message ClientVote { int32 choice = 1; }
// The client message
message ClientMessage {
oneof data {
SetName set_name = 1;
StartGame start_game = 2;
ClientVote vote = 3;
}
}