gameServer/Consts.hs
author Wuzzy <Wuzzy2@mail.ru>
Sat, 25 Aug 2018 21:36:15 +0200
changeset 13701 bb68f721e666
parent 13696 d732ca5dcab9
child 13702 dc06ef77a73a
permissions -rw-r--r--
Don't translate response to /rnd command
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10460
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
     1
{-
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
     2
 * Hedgewars, a free turn based strategy game
11046
47a8c19ecb60 more copyright fixes
sheepluva
parents: 10460
diff changeset
     3
 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
10460
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
     4
 *
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
     8
 *
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
    12
 * GNU General Public License for more details.
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
    13
 *
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
    14
 * You should have received a copy of the GNU General Public License
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
    15
 * along with this program; if not, write to the Free Software
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
    16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
    17
 \-}
8dcea9087d75 Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents: 10076
diff changeset
    18
4973
53411a26df7e Add server version (which is separate from protocol version) and a check in frontend for a new enough server (currently only qWarning)
unc0rr
parents:
diff changeset
    19
{-# LANGUAGE OverloadedStrings #-}
53411a26df7e Add server version (which is separate from protocol version) and a check in frontend for a new enough server (currently only qWarning)
unc0rr
parents:
diff changeset
    20
module Consts where
53411a26df7e Add server version (which is separate from protocol version) and a check in frontend for a new enough server (currently only qWarning)
unc0rr
parents:
diff changeset
    21
53411a26df7e Add server version (which is separate from protocol version) and a check in frontend for a new enough server (currently only qWarning)
unc0rr
parents:
diff changeset
    22
import qualified Data.ByteString.Char8 as B
53411a26df7e Add server version (which is separate from protocol version) and a check in frontend for a new enough server (currently only qWarning)
unc0rr
parents:
diff changeset
    23
53411a26df7e Add server version (which is separate from protocol version) and a check in frontend for a new enough server (currently only qWarning)
unc0rr
parents:
diff changeset
    24
serverVersion :: B.ByteString
10076
b235e520ea21 Mutual authentication: server side
unc0rr
parents: 9702
diff changeset
    25
serverVersion = "3"
13504
f747c385b5ba Server: Replace hardcoded hog-related numbers with consts
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    26
13696
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    27
-- Maximum hedgehogs per team
13504
f747c385b5ba Server: Replace hardcoded hog-related numbers with consts
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    28
cHogsPerTeam :: Int
f747c385b5ba Server: Replace hardcoded hog-related numbers with consts
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    29
cHogsPerTeam = 8
f747c385b5ba Server: Replace hardcoded hog-related numbers with consts
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    30
13696
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    31
-- Maximum teams count
13504
f747c385b5ba Server: Replace hardcoded hog-related numbers with consts
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    32
cMaxTeams :: Int
f747c385b5ba Server: Replace hardcoded hog-related numbers with consts
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    33
cMaxTeams = 8
f747c385b5ba Server: Replace hardcoded hog-related numbers with consts
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    34
13696
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    35
-- Maximum total number of hedgehogs
13504
f747c385b5ba Server: Replace hardcoded hog-related numbers with consts
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    36
cMaxHHs :: Int
13505
69f0f437c75a Increase hedgehog limit to 64
Wuzzy <Wuzzy2@mail.ru>
parents: 13504
diff changeset
    37
cMaxHHs = cHogsPerTeam * cMaxTeams
13696
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    38
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    39
{- "Fake" nick names used for special server messages in chat.
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    40
They are enclosed in brackets; these characters not allowed in real nick names.
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    41
The brackets are required as they are parsed by the frontend.
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    42
Names enclosed in square brackets send messages that are supposed to be translated by the frontend.
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    43
Names enclosed in parenthesis send messages that are not supposed to be translated. -}
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    44
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    45
-- For most server messages, usually response to a command
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    46
nickServer :: B.ByteString
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    47
nickServer = "[server]"
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    48
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    49
-- For /rnd command
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    50
nickRandom :: B.ByteString
13701
bb68f721e666 Don't translate response to /rnd command
Wuzzy <Wuzzy2@mail.ru>
parents: 13696
diff changeset
    51
nickRandom = "(random)"
13696
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    52
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    53
-- For /global command
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    54
nickGlobal :: B.ByteString
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13505
diff changeset
    55
nickGlobal = "(global notice)"