179 [if isReady cl then "NOT_READY" else "READY", nick cl] |
179 [if isReady cl then "NOT_READY" else "READY", nick cl] |
180 else |
180 else |
181 ["CLIENT_FLAGS", if isReady cl then "-r" else "+r", nick cl] |
181 ["CLIENT_FLAGS", if isReady cl then "-r" else "+r", nick cl] |
182 ] |
182 ] |
183 |
183 |
|
184 |
184 handleCmd_inRoom ["START_GAME"] = do |
185 handleCmd_inRoom ["START_GAME"] = do |
185 (ci, rnc) <- ask |
186 (ci, rnc) <- ask |
186 cl <- thisClient |
187 cl <- thisClient |
187 rm <- thisRoom |
188 rm <- thisRoom |
188 chans <- roomClientsChans |
189 chans <- roomClientsChans |
295 |
296 |
296 handleCmd_inRoom ["KICK", kickNick] = do |
297 handleCmd_inRoom ["KICK", kickNick] = do |
297 (thisClientId, rnc) <- ask |
298 (thisClientId, rnc) <- ask |
298 maybeClientId <- clientByNick kickNick |
299 maybeClientId <- clientByNick kickNick |
299 master <- liftM isMaster thisClient |
300 master <- liftM isMaster thisClient |
|
301 rm <- thisRoom |
300 let kickId = fromJust maybeClientId |
302 let kickId = fromJust maybeClientId |
|
303 let kickCl = rnc `client` kickId |
301 let sameRoom = clientRoom rnc thisClientId == clientRoom rnc kickId |
304 let sameRoom = clientRoom rnc thisClientId == clientRoom rnc kickId |
|
305 let notOnly2Clans = (length . group . sort . map teamcolor . teams $ rm) > 2 |
302 return |
306 return |
303 [KickRoomClient kickId | master && isJust maybeClientId && (kickId /= thisClientId) && sameRoom] |
307 [KickRoomClient kickId | |
|
308 master |
|
309 && isJust maybeClientId |
|
310 && (kickId /= thisClientId) |
|
311 && sameRoom |
|
312 && ((isNothing $ gameInfo rm) || notOnly2Clans || teamsInGame kickCl = 0) |
|
313 ] |
304 |
314 |
305 |
315 |
306 handleCmd_inRoom ["DELEGATE", newAdmin] = do |
316 handleCmd_inRoom ["DELEGATE", newAdmin] = do |
307 (thisClientId, rnc) <- ask |
317 (thisClientId, rnc) <- ask |
308 maybeClientId <- clientByNick newAdmin |
318 maybeClientId <- clientByNick newAdmin |