diff -r 0135e64c6c66 -r c4fd2813b127 gameServer/Votes.hs --- a/gameServer/Votes.hs Wed May 16 18:22:28 2018 +0200 +++ b/gameServer/Votes.hs Wed Jul 31 23:14:27 2019 +0200 @@ -28,6 +28,7 @@ import Data.Maybe import Control.Applicative ------------------- +import Consts import Utils import CoreTypes import HandlerUtils @@ -42,16 +43,16 @@ case voting rm of Nothing -> - return [AnswerClients [sendChan cl] ["CHAT", "[server]", loc "There's no voting going on."]] + return [Warning $ loc "There's no voting going on."] Just voting -> if (not forced) && (uid `L.notElem` entitledToVote voting) then return [] else if (not forced) && (uid `L.elem` map fst (votes voting)) then - return [AnswerClients [sendChan cl] ["CHAT", "[server]", loc "You already have voted."]] + return [Warning $ loc "You already have voted."] else if forced && (not $ isAdministrator cl) then return [] else - ((:) (AnswerClients [sendChan cl] ["CHAT", "[server]", loc "Your vote has been counted."])) + ((:) (AnswerClients [sendChan cl] ["CHAT", nickServer, loc "Your vote has been counted."])) <$> (actOnVoting $ voting{votes = (uid, vote):votes voting}) where @@ -73,7 +74,7 @@ closeVoting = do chans <- roomClientsChans return [ - AnswerClients chans ["CHAT", "[server]", loc "Voting closed."] + AnswerClients chans ["CHAT", nickServer, loc "Voting closed."] , ModifyRoom (\r -> r{voting = Nothing}) ] @@ -100,7 +101,7 @@ chans <- roomClientsChans return $ [ModifyRoom $ \r -> r{params = p, mapParams = mp} - , AnswerClients chans ["CHAT", "[server]", location] + , AnswerClients chans ["CHAT", nickServer, location] , SendUpdateOnThisRoom , LoadGhost location] act (VotePause) = do @@ -108,7 +109,7 @@ chans <- roomClientsChans let modifyGameInfo f room = room{gameInfo = fmap f $ gameInfo room} return [ModifyRoom (modifyGameInfo $ \g -> g{isPaused = not $ isPaused g}), - AnswerClients chans ["CHAT", "[server]", loc "Pause toggled."], + AnswerClients chans ["CHAT", nickServer, loc "Pause toggled."], AnswerClients chans ["EM", toEngineMsg "I"]] act (VoteNewSeed) = return [SetRandomSeed] @@ -118,7 +119,7 @@ let answers = concatMap (\t -> [ModifyRoom $ modifyTeam t{hhnum = h} , AnswerClients chans ["HH_NUM", teamname t, showB h]] - ) $ if length curteams * h > 48 then [] else curteams + ) $ if length curteams * h > cMaxHHs then [] else curteams ; curteams = if isJust $ gameInfo rm then @@ -143,7 +144,7 @@ else return [ ModifyRoom (\r -> r{voting = Just (newVoting vt){entitledToVote = uids}}) - , AnswerClients chans ["CHAT", "[server]", B.concat [loc "New voting started", ": ", voteInfo vt]] + , AnswerClients chans ["CHAT", nickServer, B.concat [loc "New voting started", ": ", voteInfo vt]] , ReactCmd ["VOTE", "YES"] ] @@ -162,7 +163,7 @@ modifyRoom rnc (\r -> r{voting = if voteTTL rv == 0 then Nothing else Just rv{voteTTL = voteTTL rv - 1}}) ri if voteTTL rv == 0 then do chans <- liftM (map sendChan) $ roomClientsM rnc ri - return [AnswerClients chans ["CHAT", "[server]", loc "Voting expired."]] + return [AnswerClients chans ["CHAT", nickServer, loc "Voting expired."]] else return [] Nothing -> return []