gameServer/HWProtoCore.hs
changeset 13832 28a86816dc01
parent 13830 5d58fce48b1d
child 13836 b07610de9957
equal deleted inserted replaced
13831:07b3dacd00f8 13832:28a86816dc01
    63             else
    63             else
    64             handleCmd_loggedin cmd
    64             handleCmd_loggedin cmd
    65         else
    65         else
    66         handleCmd_NotEntered cmd
    66         handleCmd_NotEntered cmd
    67 
    67 
       
    68 unknownCmdWarningText :: B.ByteString
       
    69 unknownCmdWarningText = loc "Unknown command or invalid parameters. Say '/help' in chat for a list of commands."
       
    70 
       
    71 handleCmd_loggedin ["CMD"] = return [Warning unknownCmdWarningText]
    68 
    72 
    69 handleCmd_loggedin ["CMD", parameters] = uncurry h $ extractParameters parameters
    73 handleCmd_loggedin ["CMD", parameters] = uncurry h $ extractParameters parameters
    70     where
    74     where
    71         h "DELEGATE" n | not $ B.null n = handleCmd ["DELEGATE", n]
    75         h "DELEGATE" n | not $ B.null n = handleCmd ["DELEGATE", n]
    72         h "SAVEROOM" n | not $ B.null n = handleCmd ["SAVEROOM", n]
    76         h "SAVEROOM" n | not $ B.null n = handleCmd ["SAVEROOM", n]
   109             cl <- thisClient
   113             cl <- thisClient
   110             return
   114             return
   111                 [ModifyClient (\c -> c{hasSuperPower = True})
   115                 [ModifyClient (\c -> c{hasSuperPower = True})
   112                 , AnswerClients [sendChan cl] ["CHAT", nickServer, loc "Super power activated."]
   116                 , AnswerClients [sendChan cl] ["CHAT", nickServer, loc "Super power activated."]
   113                 ]
   117                 ]
   114         h _ _ = return [Warning $ loc "Unknown command or invalid parameters. Say '/help' in chat for a list of commands." ]
   118         h _ _ = return [Warning unknownCmdWarningText]
   115 
   119 
   116 
   120 
   117         extractParameters p = let (a, b) = B.break (== ' ') p in (upperCase a, B.dropWhile (== ' ') b)
   121         extractParameters p = let (a, b) = B.break (== ' ') p in (upperCase a, B.dropWhile (== ' ') b)
   118 
   122 
   119 handleCmd_loggedin ["INFO", asknick] = do
   123 handleCmd_loggedin ["INFO", asknick] = do