author | alfadur |
Wed, 27 Mar 2024 02:19:44 +0300 | |
changeset 16030 | 8ba2b5007c29 |
parent 16029 | d9f1b239b6d7 |
child 16031 | e915ed28726e |
permissions | -rw-r--r-- |
15826 | 1 |
use super::{ |
2 |
actions::{Destination, DestinationGroup}, |
|
3 |
Response, |
|
4 |
}; |
|
5 |
use crate::handlers::actions::ToPendingMessage; |
|
13666 | 6 |
use crate::{ |
15096 | 7 |
core::{ |
8 |
client::HwClient, |
|
9 |
room::HwRoom, |
|
15547 | 10 |
server::{ |
11 |
EndGameResult, HwRoomControl, HwServer, JoinRoomError, LeaveRoomResult, StartGameError, |
|
16015 | 12 |
VoteEffect, VoteError, VoteResult, |
15547 | 13 |
}, |
15826 | 14 |
types::{ClientId, RoomId}, |
15096 | 15 |
}, |
15826 | 16 |
utils::to_engine_msg, |
17 |
}; |
|
18 |
use hedgewars_network_protocol::{ |
|
19 |
messages::{ |
|
15096 | 20 |
add_flags, remove_flags, server_chat, |
21 |
HwProtocolMessage::{self, Rnd}, |
|
22 |
HwServerMessage::{self, *}, |
|
14803 | 23 |
ProtocolFlags as Flags, |
14478 | 24 |
}, |
15826 | 25 |
types::{GameCfg, RoomConfig, TeamInfo, Vote, VoteType, MAX_HEDGEHOGS_PER_TEAM}, |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
26 |
}; |
14718 | 27 |
use rand::{self, seq::SliceRandom, thread_rng, Rng}; |
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
28 |
use std::{iter::once, mem::replace}; |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
29 |
|
15096 | 30 |
pub fn rnd_reply(options: &[String]) -> HwServerMessage { |
13492 | 31 |
let mut rng = thread_rng(); |
14718 | 32 |
|
13492 | 33 |
let reply = if options.is_empty() { |
14718 | 34 |
(*&["heads", "tails"].choose(&mut rng).unwrap()).to_string() |
13445
d3c86ade3d4d
Send the rnd reply to the room only.
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13444
diff
changeset
|
35 |
} else { |
14718 | 36 |
options.choose(&mut rng).unwrap().clone() |
13492 | 37 |
}; |
13445
d3c86ade3d4d
Send the rnd reply to the room only.
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13444
diff
changeset
|
38 |
|
13492 | 39 |
ChatMsg { |
14718 | 40 |
nick: "[random]".to_string(), |
41 |
msg: reply, |
|
13492 | 42 |
} |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
43 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
44 |
|
15465 | 45 |
pub fn get_lobby_join_data(server: &HwServer, response: &mut Response) { |
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
46 |
let client_id = response.client_id(); |
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
47 |
|
15465 | 48 |
let client = server.client(client_id); |
14812 | 49 |
let nick = vec![client.nick.clone()]; |
50 |
let mut flags = vec![]; |
|
51 |
if client.is_registered() { |
|
52 |
flags.push(Flags::Registered) |
|
53 |
} |
|
54 |
if client.is_admin() { |
|
55 |
flags.push(Flags::Admin) |
|
56 |
} |
|
57 |
if client.is_contributor() { |
|
58 |
flags.push(Flags::Contributor) |
|
59 |
} |
|
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
60 |
|
14812 | 61 |
let all_nicks: Vec<_> = server.collect_nicks(|_| true); |
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
62 |
|
14812 | 63 |
let mut flag_selectors = [ |
64 |
( |
|
65 |
Flags::Registered, |
|
66 |
server.collect_nicks(|(_, c)| c.is_registered()), |
|
67 |
), |
|
68 |
(Flags::Admin, server.collect_nicks(|(_, c)| c.is_admin())), |
|
69 |
( |
|
70 |
Flags::Contributor, |
|
71 |
server.collect_nicks(|(_, c)| c.is_contributor()), |
|
72 |
), |
|
73 |
( |
|
74 |
Flags::InRoom, |
|
75 |
server.collect_nicks(|(_, c)| c.room_id.is_some()), |
|
76 |
), |
|
77 |
]; |
|
78 |
||
15465 | 79 |
let server_msg = ServerMessage(server.get_greetings(client).to_string()); |
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
80 |
|
14802 | 81 |
let rooms_msg = Rooms( |
15545
f4f6060b536c
add a separate interface for modifying room state
alfadur <mail@none>
parents:
15544
diff
changeset
|
82 |
server |
f4f6060b536c
add a separate interface for modifying room state
alfadur <mail@none>
parents:
15544
diff
changeset
|
83 |
.iter_rooms() |
15544 | 84 |
.filter(|r| r.protocol_number == client.protocol_number) |
85 |
.flat_map(|r| r.info(r.master_id.map(|id| server.client(id)))) |
|
14802 | 86 |
.collect(), |
87 |
); |
|
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
88 |
|
14812 | 89 |
response.add(LobbyJoined(nick).send_all().but_self()); |
90 |
response.add( |
|
91 |
ClientFlags(add_flags(&flags), all_nicks.clone()) |
|
92 |
.send_all() |
|
93 |
.but_self(), |
|
94 |
); |
|
95 |
||
96 |
response.add(LobbyJoined(all_nicks).send_self()); |
|
97 |
for (flag, nicks) in &mut flag_selectors { |
|
14912 | 98 |
if !nicks.is_empty() { |
99 |
response.add(ClientFlags(add_flags(&[*flag]), replace(nicks, vec![])).send_self()); |
|
100 |
} |
|
14812 | 101 |
} |
102 |
||
14802 | 103 |
response.add(server_msg.send_self()); |
104 |
response.add(rooms_msg.send_self()); |
|
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
105 |
} |
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
106 |
|
15463 | 107 |
pub fn get_room_join_data<'a, I: Iterator<Item = &'a HwClient> + Clone>( |
108 |
client: &HwClient, |
|
16030 | 109 |
master: Option<&HwClient>, |
15463 | 110 |
room: &HwRoom, |
111 |
room_clients: I, |
|
14808 | 112 |
response: &mut Response, |
113 |
) { |
|
15463 | 114 |
#[inline] |
15556 | 115 |
fn partition_nicks<'a, I, F>(clients: I, f: F) -> (Vec<String>, Vec<String>) |
15463 | 116 |
where |
15556 | 117 |
I: Iterator<Item = &'a HwClient> + Clone, |
15463 | 118 |
F: Fn(&&'a HwClient) -> bool, |
119 |
{ |
|
15556 | 120 |
( |
121 |
clients |
|
122 |
.clone() |
|
123 |
.filter(|c| f(c)) |
|
124 |
.map(|c| &c.nick) |
|
125 |
.cloned() |
|
126 |
.collect(), |
|
127 |
clients |
|
128 |
.filter(|c| !f(c)) |
|
129 |
.map(|c| &c.nick) |
|
130 |
.cloned() |
|
131 |
.collect(), |
|
132 |
) |
|
15463 | 133 |
} |
14808 | 134 |
|
15463 | 135 |
let nick = client.nick.clone(); |
15556 | 136 |
response.add( |
137 |
RoomJoined(vec![nick.clone()]) |
|
138 |
.send_all() |
|
139 |
.in_room(room.id) |
|
140 |
.but_self(), |
|
141 |
); |
|
15557
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
142 |
response.add(ClientFlags(add_flags(&[Flags::InRoom]), vec![nick.clone()]).send_all()); |
15556 | 143 |
let nicks = room_clients.clone().map(|c| c.nick.clone()).collect(); |
14808 | 144 |
response.add(RoomJoined(nicks).send_self()); |
145 |
||
14820 | 146 |
let mut flag_selectors = [ |
147 |
( |
|
148 |
Flags::RoomMaster, |
|
15556 | 149 |
partition_nicks(room_clients.clone(), |c| c.is_master()), |
14820 | 150 |
), |
15463 | 151 |
( |
152 |
Flags::Ready, |
|
15556 | 153 |
partition_nicks(room_clients.clone(), |c| c.is_ready()), |
15463 | 154 |
), |
155 |
( |
|
156 |
Flags::InGame, |
|
15556 | 157 |
partition_nicks(room_clients.clone(), |c| c.is_in_game()), |
15463 | 158 |
), |
14820 | 159 |
]; |
160 |
||
15556 | 161 |
for (flag, (set_nicks, cleared_nicks)) in &mut flag_selectors { |
162 |
if !set_nicks.is_empty() { |
|
163 |
response.add(ClientFlags(add_flags(&[*flag]), replace(set_nicks, vec![])).send_self()); |
|
164 |
} |
|
165 |
||
166 |
if !cleared_nicks.is_empty() { |
|
167 |
response.add( |
|
168 |
ClientFlags(remove_flags(&[*flag]), replace(cleared_nicks, vec![])).send_self(), |
|
169 |
); |
|
170 |
} |
|
14820 | 171 |
} |
14808 | 172 |
|
15575 | 173 |
get_active_room_teams(room, Destination::ToSelf, response); |
174 |
get_active_room_config(room, Destination::ToSelf, response); |
|
15557
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
175 |
|
14808 | 176 |
if !room.greeting.is_empty() { |
177 |
response.add( |
|
178 |
ChatMsg { |
|
179 |
nick: "[greeting]".to_string(), |
|
180 |
msg: room.greeting.clone(), |
|
181 |
} |
|
182 |
.send_self(), |
|
183 |
); |
|
184 |
} |
|
15557
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
185 |
|
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
186 |
if let Some(info) = &room.game_info { |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
187 |
response.add( |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
188 |
ClientFlags(add_flags(&[Flags::Ready, Flags::InGame]), vec![nick]) |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
189 |
.send_all() |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
190 |
.in_room(room.id), |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
191 |
); |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
192 |
response.add(RunGame.send_self()); |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
193 |
|
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
194 |
response.add( |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
195 |
ForwardEngineMessage( |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
196 |
once(to_engine_msg("e$spectate 1".bytes())) |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
197 |
.chain(info.msg_log.iter().cloned()) |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
198 |
.collect(), |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
199 |
) |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
200 |
.send_self(), |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
201 |
); |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
202 |
|
15562 | 203 |
for team in info.client_teams(client.id) { |
15557
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
204 |
response.add( |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
205 |
ForwardEngineMessage(vec![to_engine_msg(once(b'G').chain(team.name.bytes()))]) |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
206 |
.send_all() |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
207 |
.in_room(room.id), |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
208 |
); |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
209 |
} |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
210 |
|
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
211 |
if info.is_paused { |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
212 |
response.add(ForwardEngineMessage(vec![to_engine_msg(once(b'I'))]).send_self()); |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
213 |
} |
15591 | 214 |
|
16029 | 215 |
for original_team in &info.original_teams { |
216 |
if let Some(team) = room.find_team(|team| team.name == original_team.info.name) { |
|
217 |
if *team != original_team.info { |
|
218 |
response.add(TeamRemove(original_team.info.name.clone()).send_self()); |
|
15719 | 219 |
response.add(TeamAdd(team.to_protocol()).send_self()); |
15591 | 220 |
} |
221 |
} else { |
|
16029 | 222 |
response.add(TeamRemove(original_team.info.name.clone()).send_self()); |
15591 | 223 |
} |
224 |
} |
|
225 |
||
16029 | 226 |
for team in &room.teams { |
227 |
if !info |
|
228 |
.original_teams |
|
229 |
.iter() |
|
230 |
.any(|original_team| original_team.info.name == team.info.name) |
|
231 |
{ |
|
232 |
response.add(TeamAdd(team.info.to_protocol()).send_self()); |
|
15719 | 233 |
} |
234 |
} |
|
235 |
||
15591 | 236 |
get_room_config_impl(room.config(), Destination::ToSelf, response); |
15557
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
237 |
} |
16030 | 238 |
|
239 |
get_room_update(None, room, master, response); |
|
14808 | 240 |
} |
241 |
||
15463 | 242 |
pub fn get_room_join_error(error: JoinRoomError, response: &mut Response) { |
243 |
use super::strings::*; |
|
244 |
match error { |
|
245 |
JoinRoomError::DoesntExist => response.warn(NO_ROOM), |
|
15556 | 246 |
JoinRoomError::WrongProtocol => response.warn(INCOMPATIBLE_ROOM_PROTOCOL), |
15555 | 247 |
JoinRoomError::WrongPassword => { |
248 |
response.add(Notice("WrongPassword".to_string()).send_self()) |
|
249 |
} |
|
15463 | 250 |
JoinRoomError::Full => response.warn(ROOM_FULL), |
251 |
JoinRoomError::Restricted => response.warn(ROOM_JOIN_RESTRICTED), |
|
15556 | 252 |
JoinRoomError::RegistrationRequired => response.warn(ROOM_REGISTRATION_REQUIRED), |
15463 | 253 |
} |
254 |
} |
|
255 |
||
15504 | 256 |
pub fn get_remove_teams_data( |
257 |
room_id: RoomId, |
|
258 |
was_in_game: bool, |
|
259 |
removed_teams: Vec<String>, |
|
260 |
response: &mut Response, |
|
261 |
) { |
|
262 |
if was_in_game { |
|
263 |
for team_name in &removed_teams { |
|
264 |
let remove_msg = to_engine_msg(once(b'F').chain(team_name.bytes())); |
|
14711
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
265 |
|
15504 | 266 |
response.add( |
267 |
ForwardEngineMessage(vec![remove_msg]) |
|
268 |
.send_all() |
|
269 |
.in_room(room_id) |
|
270 |
.but_self(), |
|
271 |
); |
|
272 |
} |
|
15563 | 273 |
} else { |
274 |
for team_name in removed_teams { |
|
275 |
response.add(TeamRemove(team_name).send_all().in_room(room_id)); |
|
276 |
} |
|
15504 | 277 |
} |
278 |
} |
|
14711
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
279 |
|
15514 | 280 |
pub fn get_room_leave_result( |
15504 | 281 |
server: &HwServer, |
282 |
room: &HwRoom, |
|
283 |
leave_message: &str, |
|
284 |
result: LeaveRoomResult, |
|
285 |
response: &mut Response, |
|
286 |
) { |
|
287 |
let client = server.client(response.client_id); |
|
288 |
response.add(ClientFlags(remove_flags(&[Flags::InRoom]), vec![client.nick.clone()]).send_all()); |
|
289 |
||
15538 | 290 |
match result { |
15504 | 291 |
LeaveRoomResult::RoomRemoved => { |
292 |
response.add( |
|
293 |
RoomRemove(room.name.clone()) |
|
294 |
.send_all() |
|
295 |
.with_protocol(room.protocol_number), |
|
296 |
); |
|
297 |
} |
|
14711
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
298 |
|
15504 | 299 |
LeaveRoomResult::RoomRemains { |
300 |
is_empty, |
|
301 |
was_master, |
|
302 |
new_master, |
|
303 |
was_in_game, |
|
304 |
removed_teams, |
|
305 |
} => { |
|
306 |
if !is_empty { |
|
307 |
response.add( |
|
308 |
RoomLeft(client.nick.clone(), leave_message.to_string()) |
|
309 |
.send_all() |
|
310 |
.in_room(room.id) |
|
311 |
.but_self(), |
|
312 |
); |
|
313 |
} |
|
14819 | 314 |
|
15504 | 315 |
if was_master { |
316 |
response.add( |
|
317 |
ClientFlags( |
|
318 |
remove_flags(&[Flags::RoomMaster]), |
|
319 |
vec![client.nick.clone()], |
|
320 |
) |
|
321 |
.send_all() |
|
322 |
.in_room(room.id), |
|
323 |
); |
|
14819 | 324 |
|
15504 | 325 |
if let Some(new_master_id) = new_master { |
326 |
let new_master_nick = server.client(new_master_id).nick.clone(); |
|
14819 | 327 |
response.add( |
328 |
ClientFlags(add_flags(&[Flags::RoomMaster]), vec![new_master_nick]) |
|
329 |
.send_all() |
|
330 |
.in_room(room.id), |
|
331 |
); |
|
14715 | 332 |
} |
14711
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
333 |
} |
15504 | 334 |
|
335 |
get_remove_teams_data(room.id, was_in_game, removed_teams, response); |
|
336 |
||
16030 | 337 |
let master = new_master.or(Some(client.id)).map(|id| server.client(id)); |
338 |
||
15504 | 339 |
response.add( |
16030 | 340 |
RoomUpdated(room.name.clone(), room.info(master)) |
15504 | 341 |
.send_all() |
342 |
.with_protocol(room.protocol_number), |
|
343 |
); |
|
14711
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
344 |
} |
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
345 |
} |
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
346 |
} |
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
347 |
|
15096 | 348 |
pub fn remove_client(server: &mut HwServer, response: &mut Response, msg: String) { |
14695
b87c71ccd17d
Server action refactoring part 5 of N
alfadur <mail@none>
parents:
14694
diff
changeset
|
349 |
let client_id = response.client_id(); |
15504 | 350 |
let client = server.client(client_id); |
14718 | 351 |
let nick = client.nick.clone(); |
14695
b87c71ccd17d
Server action refactoring part 5 of N
alfadur <mail@none>
parents:
14694
diff
changeset
|
352 |
|
15545
f4f6060b536c
add a separate interface for modifying room state
alfadur <mail@none>
parents:
15544
diff
changeset
|
353 |
if let Some(mut room_control) = server.get_room_control(client_id) { |
f4f6060b536c
add a separate interface for modifying room state
alfadur <mail@none>
parents:
15544
diff
changeset
|
354 |
let room_id = room_control.room().id; |
f4f6060b536c
add a separate interface for modifying room state
alfadur <mail@none>
parents:
15544
diff
changeset
|
355 |
let result = room_control.leave_room(); |
f4f6060b536c
add a separate interface for modifying room state
alfadur <mail@none>
parents:
15544
diff
changeset
|
356 |
get_room_leave_result(server, server.room(room_id), &msg, result, response); |
15504 | 357 |
} |
14695
b87c71ccd17d
Server action refactoring part 5 of N
alfadur <mail@none>
parents:
14694
diff
changeset
|
358 |
|
b87c71ccd17d
Server action refactoring part 5 of N
alfadur <mail@none>
parents:
14694
diff
changeset
|
359 |
server.remove_client(client_id); |
b87c71ccd17d
Server action refactoring part 5 of N
alfadur <mail@none>
parents:
14694
diff
changeset
|
360 |
|
15465 | 361 |
response.add(LobbyLeft(nick, msg.clone()).send_all()); |
362 |
response.add(Bye(msg).send_self()); |
|
14717 | 363 |
response.remove_client(client_id); |
14694
08a8605bafaf
Server action refactoring part 4 of N
alfadur <mail@none>
parents:
14478
diff
changeset
|
364 |
} |
08a8605bafaf
Server action refactoring part 4 of N
alfadur <mail@none>
parents:
14478
diff
changeset
|
365 |
|
14707
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
366 |
pub fn get_room_update( |
16030 | 367 |
old_name: Option<String>, |
15096 | 368 |
room: &HwRoom, |
369 |
master: Option<&HwClient>, |
|
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
370 |
response: &mut Response, |
14707
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
371 |
) { |
16030 | 372 |
let update_msg = RoomUpdated(old_name.unwrap_or(room.name.clone()), room.info(master)); |
14707
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
373 |
response.add(update_msg.send_all().with_protocol(room.protocol_number)); |
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
374 |
} |
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
375 |
|
15565 | 376 |
pub fn get_room_config_impl( |
377 |
config: &RoomConfig, |
|
378 |
destination: Destination, |
|
379 |
response: &mut Response, |
|
380 |
) { |
|
381 |
response.add( |
|
382 |
ConfigEntry("FULLMAPCONFIG".to_string(), config.to_map_config()) |
|
383 |
.send_to_destination(destination.clone()), |
|
384 |
); |
|
14806
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
385 |
for cfg in config.to_game_config() { |
15565 | 386 |
response.add(cfg.to_server_msg().send_to_destination(destination.clone())); |
14806
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
387 |
} |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
388 |
} |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
389 |
|
15575 | 390 |
pub fn get_active_room_config(room: &HwRoom, destination: Destination, response: &mut Response) { |
15565 | 391 |
get_room_config_impl(room.active_config(), destination, response); |
14806
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
392 |
} |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
393 |
|
15565 | 394 |
pub fn get_teams<'a, I>(teams: I, destination: Destination, response: &mut Response) |
14806
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
395 |
where |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
396 |
I: Iterator<Item = &'a TeamInfo>, |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
397 |
{ |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
398 |
for team in teams { |
15565 | 399 |
response.add(TeamAdd(team.to_protocol()).send_to_destination(destination.clone())); |
400 |
response |
|
401 |
.add(TeamColor(team.name.clone(), team.color).send_to_destination(destination.clone())); |
|
402 |
response.add( |
|
403 |
HedgehogsNumber(team.name.clone(), team.hedgehogs_number) |
|
404 |
.send_to_destination(destination.clone()), |
|
405 |
); |
|
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
406 |
} |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
407 |
} |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
408 |
|
15575 | 409 |
pub fn get_active_room_teams(room: &HwRoom, destination: Destination, response: &mut Response) { |
15562 | 410 |
let current_teams = match room.game_info { |
15563 | 411 |
Some(ref info) => &info.original_teams, |
15562 | 412 |
None => &room.teams, |
413 |
}; |
|
414 |
||
16029 | 415 |
get_teams( |
416 |
current_teams.iter().map(|team| &team.info), |
|
417 |
destination, |
|
418 |
response, |
|
419 |
); |
|
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
420 |
} |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
421 |
|
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
422 |
pub fn get_room_flags( |
15096 | 423 |
server: &HwServer, |
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
424 |
room_id: RoomId, |
15565 | 425 |
destination: Destination, |
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
426 |
response: &mut Response, |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
427 |
) { |
15544 | 428 |
let room = server.room(room_id); |
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
429 |
if let Some(id) = room.master_id { |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
430 |
response.add( |
14803 | 431 |
ClientFlags( |
432 |
add_flags(&[Flags::RoomMaster]), |
|
15514 | 433 |
vec![server.client(id).nick.clone()], |
14803 | 434 |
) |
15565 | 435 |
.send_to_destination(destination.clone()), |
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
436 |
); |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
437 |
} |
15514 | 438 |
let nicks = server.collect_nicks(|(_, c)| c.room_id == Some(room_id) && c.is_ready()); |
439 |
||
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
440 |
if !nicks.is_empty() { |
15565 | 441 |
response |
442 |
.add(ClientFlags(add_flags(&[Flags::Ready]), nicks).send_to_destination(destination)); |
|
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
443 |
} |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
444 |
} |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
445 |
|
15547 | 446 |
pub fn check_vote( |
447 |
server: &HwServer, |
|
448 |
room: &HwRoom, |
|
449 |
kind: &VoteType, |
|
450 |
response: &mut Response, |
|
451 |
) -> bool { |
|
452 |
let error = match &kind { |
|
453 |
VoteType::Kick(nick) => { |
|
454 |
if server |
|
455 |
.find_client(&nick) |
|
456 |
.filter(|c| c.room_id == Some(room.id)) |
|
457 |
.is_some() |
|
458 |
{ |
|
459 |
None |
|
460 |
} else { |
|
461 |
Some("/callvote kick: No such user!".to_string()) |
|
462 |
} |
|
463 |
} |
|
464 |
VoteType::Map(None) => { |
|
465 |
let names: Vec<_> = room.saves.keys().cloned().collect(); |
|
466 |
if names.is_empty() { |
|
467 |
Some("/callvote map: No maps saved in this room!".to_string()) |
|
468 |
} else { |
|
469 |
Some(format!("Available maps: {}", names.join(", "))) |
|
470 |
} |
|
471 |
} |
|
472 |
VoteType::Map(Some(name)) => { |
|
473 |
if room.saves.get(&name[..]).is_some() { |
|
474 |
None |
|
475 |
} else { |
|
476 |
Some("/callvote map: No such map!".to_string()) |
|
477 |
} |
|
478 |
} |
|
479 |
VoteType::Pause => { |
|
480 |
if room.game_info.is_some() { |
|
481 |
None |
|
482 |
} else { |
|
483 |
Some("/callvote pause: No game in progress!".to_string()) |
|
484 |
} |
|
485 |
} |
|
486 |
VoteType::NewSeed => None, |
|
487 |
VoteType::HedgehogsPerTeam(number) => match number { |
|
488 |
1..=MAX_HEDGEHOGS_PER_TEAM => None, |
|
489 |
_ => Some("/callvote hedgehogs: Specify number from 1 to 8.".to_string()), |
|
490 |
}, |
|
491 |
}; |
|
492 |
||
493 |
match error { |
|
494 |
None => true, |
|
495 |
Some(msg) => { |
|
496 |
response.add(server_chat(msg).send_self()); |
|
497 |
false |
|
498 |
} |
|
499 |
} |
|
500 |
} |
|
501 |
||
502 |
pub fn get_vote_data( |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
503 |
room_id: RoomId, |
15547 | 504 |
result: &Result<VoteResult, VoteError>, |
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
505 |
response: &mut Response, |
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
506 |
) { |
15547 | 507 |
match result { |
508 |
Ok(VoteResult::Submitted) => { |
|
509 |
response.add(server_chat("Your vote has been counted.".to_string()).send_self()) |
|
510 |
} |
|
15817 | 511 |
Ok(VoteResult::Succeeded(_) | VoteResult::Failed) => response.add( |
15547 | 512 |
server_chat("Voting closed.".to_string()) |
513 |
.send_all() |
|
514 |
.in_room(room_id), |
|
515 |
), |
|
516 |
Err(VoteError::NoVoting) => { |
|
517 |
response.add(server_chat("There's no voting going on.".to_string()).send_self()) |
|
518 |
} |
|
519 |
Err(VoteError::AlreadyVoted) => { |
|
520 |
response.add(server_chat("You already have voted.".to_string()).send_self()) |
|
521 |
} |
|
522 |
} |
|
523 |
} |
|
524 |
||
525 |
pub fn handle_vote( |
|
16015 | 526 |
room_control: HwRoomControl, |
15547 | 527 |
result: Result<VoteResult, VoteError>, |
528 |
response: &mut super::Response, |
|
529 |
) { |
|
530 |
let room_id = room_control.room().id; |
|
16015 | 531 |
get_vote_data(room_control.room().id, &result, response); |
15547 | 532 |
|
16015 | 533 |
if let Ok(VoteResult::Succeeded(effect)) = result { |
534 |
match effect { |
|
535 |
VoteEffect::Kicked(kicked_id, leave_result) => { |
|
536 |
response.add(Kicked.send(kicked_id)); |
|
537 |
get_room_leave_result( |
|
538 |
room_control.server(), |
|
539 |
room_control.room(), |
|
540 |
"kicked", |
|
541 |
leave_result, |
|
542 |
response, |
|
543 |
); |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
544 |
} |
16015 | 545 |
VoteEffect::Map(location) => { |
546 |
let msg = server_chat(location.to_string()); |
|
547 |
let room = room_control.room(); |
|
548 |
response.add(msg.send_all().in_room(room.id)); |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
549 |
|
16015 | 550 |
let room_master = room.master_id.map(|id| room_control.server().client(id)); |
15547 | 551 |
|
16015 | 552 |
get_room_update(None, room, room_master, response); |
15547 | 553 |
|
16015 | 554 |
let room_destination = Destination::ToAll { |
555 |
group: DestinationGroup::Room(room.id), |
|
556 |
skip_self: false, |
|
557 |
}; |
|
558 |
get_active_room_config(room, room_destination, response); |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
559 |
} |
16015 | 560 |
VoteEffect::Pause => { |
561 |
response.add( |
|
562 |
server_chat("Pause toggled.".to_string()) |
|
563 |
.send_all() |
|
564 |
.in_room(room_id), |
|
565 |
); |
|
566 |
response.add( |
|
567 |
ForwardEngineMessage(vec![to_engine_msg(once(b'I'))]) |
|
568 |
.send_all() |
|
569 |
.in_room(room_id), |
|
570 |
); |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
571 |
} |
16015 | 572 |
VoteEffect::NewSeed(cfg) => { |
15547 | 573 |
response.add(cfg.to_server_msg().send_all().in_room(room_id)); |
14707
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
574 |
} |
16015 | 575 |
VoteEffect::HedgehogsPerTeam(number, team_names) => { |
15547 | 576 |
response.extend( |
16015 | 577 |
team_names |
15547 | 578 |
.into_iter() |
579 |
.map(|n| HedgehogsNumber(n, number).send_all().in_room(room_id)), |
|
580 |
); |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
581 |
} |
14707
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
582 |
} |
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
583 |
} |
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
584 |
} |
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
585 |
|
15514 | 586 |
pub fn get_start_game_data( |
587 |
server: &HwServer, |
|
588 |
room_id: RoomId, |
|
589 |
result: Result<Vec<String>, StartGameError>, |
|
590 |
response: &mut Response, |
|
591 |
) { |
|
592 |
match result { |
|
593 |
Ok(room_nicks) => { |
|
594 |
let room = server.room(room_id); |
|
595 |
response.add(RunGame.send_all().in_room(room.id)); |
|
596 |
response.add( |
|
597 |
ClientFlags(add_flags(&[Flags::InGame]), room_nicks) |
|
598 |
.send_all() |
|
599 |
.in_room(room.id), |
|
600 |
); |
|
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
601 |
|
15514 | 602 |
let room_master = room.master_id.map(|id| server.client(id)); |
603 |
get_room_update(None, room, room_master, response); |
|
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
604 |
} |
15514 | 605 |
Err(StartGameError::NotEnoughClans) => { |
606 |
response.warn("The game can't be started with less than two clans!") |
|
607 |
} |
|
608 |
Err(StartGameError::NotReady) => response.warn("Not all players are ready"), |
|
15538 | 609 |
Err(StartGameError::AlreadyInGame) => response.warn("The game is already in progress"), |
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
610 |
} |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
611 |
} |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
612 |
|
15538 | 613 |
pub fn get_end_game_result( |
614 |
server: &HwServer, |
|
615 |
room_id: RoomId, |
|
616 |
result: EndGameResult, |
|
617 |
response: &mut Response, |
|
618 |
) { |
|
619 |
let room = server.room(room_id); |
|
15547 | 620 |
let room_master = room.master_id.map(|id| server.client(id)); |
15538 | 621 |
|
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
622 |
get_room_update(None, room, room_master, response); |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
623 |
response.add(RoundFinished.send_all().in_room(room_id)); |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
624 |
|
15563 | 625 |
response.extend( |
626 |
result |
|
627 |
.left_teams |
|
628 |
.iter() |
|
15591 | 629 |
.filter(|name| room.find_team(|t| t.name == **name).is_some()) |
15563 | 630 |
.map(|name| TeamRemove(name.clone()).send_all().in_room(room.id)), |
631 |
); |
|
632 |
||
15538 | 633 |
if !result.unreadied_nicks.is_empty() { |
15563 | 634 |
response.add( |
15538 | 635 |
ClientFlags(remove_flags(&[Flags::Ready]), result.unreadied_nicks) |
15563 | 636 |
.send_all() |
637 |
.in_room(room_id), |
|
638 |
); |
|
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
639 |
} |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
640 |
} |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
641 |
|
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
642 |
#[cfg(test)] |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
643 |
mod tests { |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
644 |
use super::*; |
15132 | 645 |
use crate::handlers::actions::PendingMessage; |
15826 | 646 |
use hedgewars_network_protocol::messages::HwServerMessage::ChatMsg; |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
647 |
|
15096 | 648 |
fn reply2string(r: HwServerMessage) -> String { |
13445
d3c86ade3d4d
Send the rnd reply to the room only.
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13444
diff
changeset
|
649 |
match r { |
d3c86ade3d4d
Send the rnd reply to the room only.
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13444
diff
changeset
|
650 |
ChatMsg { msg: p, .. } => String::from(p), |
d3c86ade3d4d
Send the rnd reply to the room only.
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13444
diff
changeset
|
651 |
_ => panic!("expected a ChatMsg"), |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
652 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
653 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
654 |
|
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
655 |
fn run_handle_test(opts: Vec<String>) { |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
656 |
let opts2 = opts.clone(); |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
657 |
for opt in opts { |
13492 | 658 |
while reply2string(rnd_reply(&opts2)) != opt {} |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
659 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
660 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
661 |
|
13446
dd2e51f7303d
Add an extra test for Rnd's distribution
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13445
diff
changeset
|
662 |
/// This test terminates almost surely. |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
663 |
#[test] |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
664 |
fn test_handle_rnd_empty() { |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
665 |
run_handle_test(vec![]) |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
666 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
667 |
|
13446
dd2e51f7303d
Add an extra test for Rnd's distribution
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13445
diff
changeset
|
668 |
/// This test terminates almost surely. |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
669 |
#[test] |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
670 |
fn test_handle_rnd_nonempty() { |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
671 |
run_handle_test(vec!["A".to_owned(), "B".to_owned(), "C".to_owned()]) |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
672 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
673 |
} |