gameServer/HWProtoLobbyState.hs
changeset 13079 81c154fd4380
parent 12114 cdadc1d487f1
child 13508 da59012fbd7a
equal deleted inserted replaced
13078:dd904dd9c587 13079:81c154fd4380
    47     n <- clientNick
    47     n <- clientNick
    48     s <- roomOthersChans
    48     s <- roomOthersChans
    49     return [AnswerClients s ["CHAT", n, msg], RegisterEvent LobbyChatMessage]
    49     return [AnswerClients s ["CHAT", n, msg], RegisterEvent LobbyChatMessage]
    50 
    50 
    51 handleCmd_lobby ["CREATE_ROOM", rName, roomPassword]
    51 handleCmd_lobby ["CREATE_ROOM", rName, roomPassword]
    52     | illegalName rName = return [Warning $ loc "Illegal room name"]
    52     | illegalName rName = return [Warning $ loc "Illegal room name! A room name must be between 1-40 characters long, must not have a trailing or leading space and must not have any of these characters: $()*+?[]^{|}"]
    53     | otherwise = do
    53     | otherwise = do
    54         rs <- allRoomInfos
    54         rs <- allRoomInfos
    55         cl <- thisClient
    55         cl <- thisClient
    56         return $ if isJust $ find (\r -> rName == name r) rs then
    56         return $ if isJust $ find (\r -> rName == name r) rs then
    57             [Warning "Room exists"]
    57             [Warning $ loc "A room with the same name already exists."]
    58             else
    58             else
    59             [
    59             [
    60                 AddRoom rName roomPassword
    60                 AddRoom rName roomPassword
    61                 , AnswerClients [sendChan cl] ["CLIENT_FLAGS", "+hr", nick cl]
    61                 , AnswerClients [sendChan cl] ["CLIENT_FLAGS", "+hr", nick cl]
    62                 , ModifyClient (\c -> c{isMaster = True, isReady = True, isJoinedMidGame = False})
    62                 , ModifyClient (\c -> c{isMaster = True, isReady = True, isJoinedMidGame = False})
    88                 else
    88                 else
    89                 []
    89                 []
    90     let clTeamsNames = map teamname clTeams
    90     let clTeamsNames = map teamname clTeams
    91     return $
    91     return $
    92         if isNothing maybeRI then
    92         if isNothing maybeRI then
    93             [Warning $ loc "No such room"]
    93             [Warning $ loc "No such room."]
    94             else if (not sameProto) && (not $ isAdministrator cl) then
    94             else if (not sameProto) && (not $ isAdministrator cl) then
    95             [Warning $ loc "Room version incompatible to your hedgewars version"]
    95             [Warning $ loc "Room version incompatible to your Hedgewars version!"]
    96             else if isRestrictedJoins jRoom && not (hasSuperPower cl) then
    96             else if isRestrictedJoins jRoom && not (hasSuperPower cl) then
    97             [Warning $ loc "Joining restricted"]
    97             [Warning $ loc "Access denied. This room currently doesn't allow joining."]
    98             else if isRegisteredOnly jRoom && (not $ isRegistered cl) && not (isAdministrator cl) then
    98             else if isRegisteredOnly jRoom && (not $ isRegistered cl) && not (isAdministrator cl) then
    99             [Warning $ loc "Registered users only"]
    99             [Warning $ loc "Access denied. This room is for registered users only."]
   100             else if isBanned then
   100             else if isBanned then
   101             [Warning $ loc "You are banned in this room"]
   101             [Warning $ loc "You are banned from this room."]
   102             else if roomPassword /= password jRoom  && not (hasSuperPower cl) then
   102             else if roomPassword /= password jRoom  && not (hasSuperPower cl) then
   103             [NoticeMessage WrongPassword]
   103             [NoticeMessage WrongPassword]
   104             else
   104             else
   105             (
   105             (
   106                 MoveToRoom jRI
   106                 MoveToRoom jRI