gameServer/Consts.hs
author Wuzzy <Wuzzy2@mail.ru>
Fri, 12 Jun 2020 00:20:47 +0200
changeset 15640 e21285b7c5e6
parent 13732 5f62417a7d84
permissions -rw-r--r--
Teach AI to use seduction
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"
13509
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: 13510
diff changeset
    27
-- Maximum hedgehogs per team
13509
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: 13510
diff changeset
    31
-- Maximum teams count
13509
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: 13510
diff changeset
    35
-- Maximum total number of hedgehogs
13509
f747c385b5ba Server: Replace hardcoded hog-related numbers with consts
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    36
cMaxHHs :: Int
13510
69f0f437c75a Increase hedgehog limit to 64
Wuzzy <Wuzzy2@mail.ru>
parents: 13509
diff changeset
    37
cMaxHHs = cHogsPerTeam * cMaxTeams
13696
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13510
diff changeset
    38
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13510
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: 13510
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: 13510
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: 13510
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: 13510
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: 13510
diff changeset
    44
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13510
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: 13510
diff changeset
    46
nickServer :: B.ByteString
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13510
diff changeset
    47
nickServer = "[server]"
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13510
diff changeset
    48
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13510
diff changeset
    49
-- For /rnd command
13732
5f62417a7d84 Translate "heads" and "tails" of gameServer
Wuzzy <Wuzzy2@mail.ru>
parents: 13702
diff changeset
    50
nickRandomCoin :: B.ByteString
5f62417a7d84 Translate "heads" and "tails" of gameServer
Wuzzy <Wuzzy2@mail.ru>
parents: 13702
diff changeset
    51
nickRandomCoin = "[random]"
5f62417a7d84 Translate "heads" and "tails" of gameServer
Wuzzy <Wuzzy2@mail.ru>
parents: 13702
diff changeset
    52
5f62417a7d84 Translate "heads" and "tails" of gameServer
Wuzzy <Wuzzy2@mail.ru>
parents: 13702
diff changeset
    53
nickRandomCustom :: B.ByteString
5f62417a7d84 Translate "heads" and "tails" of gameServer
Wuzzy <Wuzzy2@mail.ru>
parents: 13702
diff changeset
    54
nickRandomCustom = "(random)"
13696
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13510
diff changeset
    55
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13510
diff changeset
    56
-- For /global command
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13510
diff changeset
    57
nickGlobal :: B.ByteString
d732ca5dcab9 GameServer: Refactor fake nick names into Consts
Wuzzy <Wuzzy2@mail.ru>
parents: 13510
diff changeset
    58
nickGlobal = "(global notice)"
13702
dc06ef77a73a Don't translate greeting message
Wuzzy <Wuzzy2@mail.ru>
parents: 13701
diff changeset
    59
dc06ef77a73a Don't translate greeting message
Wuzzy <Wuzzy2@mail.ru>
parents: 13701
diff changeset
    60
-- For greeting message added with /greeting command
dc06ef77a73a Don't translate greeting message
Wuzzy <Wuzzy2@mail.ru>
parents: 13701
diff changeset
    61
nickGreeting :: B.ByteString
dc06ef77a73a Don't translate greeting message
Wuzzy <Wuzzy2@mail.ru>
parents: 13701
diff changeset
    62
nickGreeting = "(greeting)"