Package horizons :: Module constants
[hide private]
[frames] | no frames]

Source Code for Module horizons.constants

  1  # -*- coding: utf-8 -*- 
  2  # ################################################### 
  3  # Copyright (C) 2008-2017 The Unknown Horizons Team 
  4  # team@unknown-horizons.org 
  5  # This file is part of Unknown Horizons. 
  6  # 
  7  # Unknown Horizons is free software; you can redistribute it and/or modify 
  8  # it under the terms of the GNU General Public License as published by 
  9  # the Free Software Foundation; either version 2 of the License, or 
 10  # (at your option) any later version. 
 11  # 
 12  # This program is distributed in the hope that it will be useful, 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 15  # GNU General Public License for more details. 
 16  # 
 17  # You should have received a copy of the GNU General Public License 
 18  # along with this program; if not, write to the 
 19  # Free Software Foundation, Inc., 
 20  # 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
 21  # ################################################### 
 22   
 23  import ctypes 
 24  import os 
 25  import os.path 
 26  import platform 
 27  import subprocess 
 28  from pathlib import Path 
 29  from typing import List, Optional 
 30   
 31  from horizons.ext.enum import Enum 
 32  from horizons.util.platform import get_old_user_game_directory, get_user_game_directories 
 33   
 34   
 35  """This file keeps track of the constants that are used in Unknown Horizons. 
 36  NOTE: Using magic constants in code is generally a bad style, so avoid where 
 37  possible and instead import the proper classes of this file. 
 38  """ 
39 40 41 -def get_git_version():
42 """Function gets latest revision of the working copy. 43 It only works in git repositories, and is actually a hack. 44 """ 45 try: 46 from run_uh import get_content_dir_parent_path 47 uh_path = get_content_dir_parent_path() 48 except ImportError: 49 return "<unknown>" 50 51 # Try git describe 52 try: 53 git = "git" 54 if platform.system() == "Windows": 55 git = "git.exe" 56 57 # Note that this uses glob patterns, not regular expressions. 58 # TAG_STRUCTURE = "20[0-9][0-9].[0-9]*" 59 # describe = [git, "describe", "--tags", TAG_STRUCTURE] 60 describe = [git, "describe", "--tags"] 61 git_string = subprocess.check_output(describe, cwd=uh_path, universal_newlines=True).rstrip('\n') 62 return git_string 63 except (subprocess.CalledProcessError, RuntimeError): 64 pass 65 66 # Read current HEAD out of .git manually 67 try: 68 git_head_path = Path(uh_path, '.git', 'HEAD') 69 if git_head_path.exists(): 70 with git_head_path.open() as f: 71 head = f.readline().strip().partition(' ') 72 if head[2]: 73 head_file = Path(uh_path, '.git', head[2]) 74 else: 75 head_file = git_head_path 76 77 if head_file.exists(): 78 with head_file.open() as f: 79 return str(f.readline().strip()[0:7]) 80 except ImportError: 81 pass 82 83 # Try gitversion.txt 84 try: 85 with open(os.path.join("content", "packages", "gitversion.txt")) as f: 86 return f.read() 87 except IOError: 88 pass 89 90 return "<unknown>"
91
92 93 ##Versioning 94 -class VERSION:
95 RELEASE_NAME = "Unknown Horizons %s" 96 RELEASE_VERSION = get_git_version() 97 # change for release: 98 IS_DEV_VERSION = True 99 #RELEASE_VERSION = u'2019.1' 100 101 REQUIRED_FIFE_MAJOR_VERSION = 0 102 REQUIRED_FIFE_MINOR_VERSION = 4 103 REQUIRED_FIFE_PATCH_VERSION = 2 104 105 REQUIRED_FIFE_VERSION = (REQUIRED_FIFE_MAJOR_VERSION, REQUIRED_FIFE_MINOR_VERSION, REQUIRED_FIFE_PATCH_VERSION) 106 107 ## +=1 this if you changed the savegame "api" 108 SAVEGAMEREVISION = 77 109 SAVEGAME_LEAST_UPGRADABLE_REVISION = 76 110 111 @staticmethod
112 - def string():
114
115 116 ## WORLD 117 -class UNITS:
118 # ./development/print_db_data.py unit 119 HUKER_SHIP = 1000001 120 BUILDING_COLLECTOR = 1000002 121 122 FISHER_BOAT = 1000004 123 PIRATE_SHIP = 1000005 124 TRADER_SHIP = 1000006 125 ANIMAL_COLLECTOR = 1000007 126 STORAGE_COLLECTOR = 1000008 127 FIELD_COLLECTOR = 1000009 128 LUMBERJACK_COLLECTOR = 1000010 129 SETTLER_COLLECTOR = 1000011 130 131 WILD_ANIMAL = 1000013 132 HUNTER_COLLECTOR = 1000014 133 FARM_ANIMAL_COLLECTOR = 1000015 134 USABLE_FISHER_BOAT = 1000016 135 136 FRIGATE = 1000020 137 138 DISASTER_RECOVERY_COLLECTOR = 1000022 139 140 SWORDSMAN = 1000023 141 142 # players will be spawned with an instance of this 143 PLAYER_SHIP = HUKER_SHIP 144 145 DIFFERENCE_BUILDING_UNIT_ID = 1000000
146
147 148 -class BUILDINGS:
149 # ./development/print_db_data.py building 150 WAREHOUSE = 1 151 STORAGE = 2 152 RESIDENTIAL = 3 153 MAIN_SQUARE = 4 154 PAVILION = 5 155 SIGNAL_FIRE = 6 156 WEAVER = 7 157 LUMBERJACK = 8 158 HUNTER = 9 159 SETTLER_RUIN = 10 160 FISHER = 11 161 BOAT_BUILDER = 12 162 LOOKOUT = 13 163 164 TRAIL = 15 165 166 TREE = 17 167 PASTURE = 18 168 POTATO_FIELD = 19 169 FARM = 20 170 VILLAGE_SCHOOL = 21 171 SUGARCANE_FIELD = 22 172 CLAY_DEPOSIT = 23 173 BRICKYARD = 24 174 CLAY_PIT = 25 175 DISTILLERY = 26 176 177 MINE = 28 178 SMELTERY = 29 179 TOOLMAKER = 30 180 CHARCOAL_BURNER = 31 181 TAVERN = 32 182 FISH_DEPOSIT = 33 183 MOUNTAIN = 34 184 SALT_PONDS = 35 185 TOBACCO_FIELD = 36 186 TOBACCONIST = 37 187 CATTLE_RUN = 38 188 PIGSTY = 39 189 HERBARY = 40 190 BUTCHERY = 41 191 DOCTOR = 42 192 GRAVEL_PATH = 43 193 WOODEN_TOWER = 44 194 FIRE_STATION = 45 195 CORN_FIELD = 46 196 WINDMILL = 47 197 BAKERY = 48 198 SPICE_FIELD = 49 199 BLENDER = 50 200 201 BARRACKS = 53 202 STONE_PIT = 54 203 STONEMASON = 55 204 205 COCOA_FIELD = 60 206 VINEYARD = 61 207 ALVEARIES = 62 208 PASTRY_SHOP = 63 209 210 WINERY = 65 211 212 WEAPONSMITH = 66 213 CANNON_FOUNDRY = 67 214 215 BREWERY = 68 216 HOP_FIELD = 69 217 218 STONE_DEPOSIT = 70 219 220 BARRIER = 71 221 222 AMBIENT = 72 223 224 SALINE = 86 225 PUBLIC_BATH = 87 226 227 EXPAND_RANGE = (WAREHOUSE, STORAGE, LOOKOUT) 228 229 TRANSPARENCY_VALUE = 180 230
231 - class ACTION:
232 # data for calculating gfx for paths. 233 # think: animation contains key, if there is a path at offset value 234 # you need to sort this before iterating via sorted, since order is important here. 235 action_offset_dict = { 236 # Direct connections 237 'a': (0, -1), 238 'b': (+1, 0), 239 'c': (0, +1), 240 'd': (-1, 0), 241 # Remote connections 242 'e': (+1, -1), 243 'f': (+1, +1), 244 'g': (-1, +1), 245 'h': (-1, -1), 246 }
247
248 - class BUILD:
249 MAX_BUILDING_SHIP_DISTANCE = 5 # max distance ship-building when building from ship
250
251 252 -class RES:
253 # ./development/print_db_data.py res 254 GOLD = 1 255 LAMB_WOOL = 2 256 TEXTILE = 3 257 BOARDS = 4 258 FOOD = 5 259 TOOLS = 6 260 BRICKS = 7 261 TREES = 8 262 GRASS = 9 263 WOOL = 10 264 FAITH = 11 265 WILDANIMALFOOD = 12 266 DEER_MEAT = 13 267 HAPPINESS = 14 268 POTATOES = 15 269 EDUCATION = 16 270 RAW_SUGAR = 17 271 SUGAR = 18 272 COMMUNITY = 19 273 RAW_CLAY = 20 274 CLAY = 21 275 LIQUOR = 22 276 CHARCOAL = 23 277 RAW_IRON = 24 278 IRON_ORE = 25 279 IRON_INGOTS = 26 280 GET_TOGETHER = 27 281 FISH = 28 282 SALT = 29 283 TOBACCO_PLANTS = 30 284 TOBACCO_LEAVES = 31 285 TOBACCO_PRODUCTS = 32 286 CATTLE = 33 287 PIGS = 34 288 CATTLE_SLAUGHTER = 35 289 PIGS_SLAUGHTER = 36 290 HERBS = 37 291 MEDICAL_HERBS = 38 292 ACORNS = 39 293 CANNON = 40 294 SWORD = 41 295 GRAIN = 42 296 CORN = 43 297 FLOUR = 44 298 SPICE_PLANTS = 45 299 SPICES = 46 300 CONDIMENTS = 47 301 MARBLE_DEPOSIT = GOLD # 48 302 MARBLE_TOPS = GOLD # 49 303 COAL_DEPOSIT = GOLD # 50 304 STONE_DEPOSIT = 51 305 STONE_TOPS = 52 306 COCOA_BEANS = 53 307 COCOA = 54 308 CONFECTIONERY = 55 309 CANDLES = 56 310 VINES = 57 311 GRAPES = 58 312 ALVEARIES = 59 313 HONEYCOMBS = 60 314 GOLD_DEPOSIT = GOLD # 61 315 GOLD_ORE = GOLD # 62 316 GOLD_INGOTS = GOLD # 63 317 GEM_DEPOSIT = GOLD # 64 318 ROUGH_GEMS = GOLD # 65 319 GEMS = GOLD # 66 320 SILVER_DEPOSIT = GOLD # 67 321 SILVER_ORE = GOLD # 68 322 SILVER_INGOTS = GOLD # 69 323 COFFEE_PLANTS = GOLD # 70 324 COFFEE_BEANS = GOLD # 71 325 COFFEE = GOLD # 72 326 TEA_PLANTS = GOLD # 73 327 TEA_LEAVES = GOLD # 74 328 TEA = GOLD # 75 329 FLOWER_MEADOWS = GOLD # 76 330 BLOSSOMS = GOLD # 77 331 BRINE = GOLD # 78 332 BRINE_DEPOSIT = GOLD # 79 333 WHALES = GOLD # 80 334 AMBERGRIS = GOLD # 81 335 LAMP_OIL = GOLD # 82 336 COTTON_PLANTS = GOLD # 83 337 COTTON = GOLD # 84 338 INDIGO_PLANTS = GOLD # 85 339 INDIGO = GOLD # 86 340 GARMENTS = GOLD # 87 341 PERFUME = GOLD # 88 342 HOP_PLANTS = 89 343 HOPS = 90 344 BEER = 91 345 # 92-99 reserved for services 346 REPRESENTATION = GOLD # 92 347 SOCIETY = GOLD # 93 348 FAITH_2 = GOLD # 94 349 EDUCATION_2 = GOLD # 95 350 HYGIENE = 96 351 RECREATION = GOLD # 97 352 BLACKDEATH = 98 353 FIRE = 99
354 # 92-99 reserved for services
355 356 357 -class WEAPONS:
358 CANNON = RES.CANNON 359 SWORD = RES.SWORD 360 361 DEFAULT_FIGHTING_SHIP_WEAPONS_NUM = 7
362
363 364 -class GROUND:
365 DEFAULT_LAND = (3, "straight", 45) 366 SAND = (6, "straight", 45) 367 SHALLOW_WATER = (1, "straight", 45) 368 WATER = (0, "straight", 45) 369 370 # sand to shallow water tiles 371 COAST_SOUTH = (5, "straight", 45) 372 COAST_EAST = (5, "straight", 135) 373 COAST_NORTH = (5, "straight", 225) 374 COAST_WEST = (5, "straight", 315) 375 COAST_SOUTHWEST3 = (5, "curve_in", 135) 376 COAST_NORTHWEST3 = (5, "curve_in", 225) 377 COAST_NORTHEAST3 = (5, "curve_in", 315) 378 COAST_SOUTHEAST3 = (5, "curve_in", 45) 379 COAST_NORTHEAST1 = (5, "curve_out", 225) 380 COAST_SOUTHEAST1 = (5, "curve_out", 135) 381 COAST_SOUTHWEST1 = (5, "curve_out", 45) 382 COAST_NORTHWEST1 = (5, "curve_out", 315) 383 384 # grass to sand tiles 385 SAND_SOUTH = (4, "straight", 45) 386 SAND_EAST = (4, "straight", 135) 387 SAND_NORTH = (4, "straight", 225) 388 SAND_WEST = (4, "straight", 315) 389 SAND_SOUTHWEST3 = (4, "curve_in", 135) 390 SAND_NORTHWEST3 = (4, "curve_in", 225) 391 SAND_NORTHEAST3 = (4, "curve_in", 315) 392 SAND_SOUTHEAST3 = (4, "curve_in", 45) 393 SAND_NORTHEAST1 = (4, "curve_out", 225) 394 SAND_SOUTHEAST1 = (4, "curve_out", 135) 395 SAND_SOUTHWEST1 = (4, "curve_out", 45) 396 SAND_NORTHWEST1 = (4, "curve_out", 315) 397 398 # shallow water to deep water tiles 399 DEEP_WATER_SOUTH = (2, "straight", 45) 400 DEEP_WATER_EAST = (2, "straight", 135) 401 DEEP_WATER_NORTH = (2, "straight", 225) 402 DEEP_WATER_WEST = (2, "straight", 315) 403 DEEP_WATER_SOUTHWEST3 = (2, "curve_in", 135) 404 DEEP_WATER_NORTHWEST3 = (2, "curve_in", 225) 405 DEEP_WATER_NORTHEAST3 = (2, "curve_in", 315) 406 DEEP_WATER_SOUTHEAST3 = (2, "curve_in", 45) 407 DEEP_WATER_NORTHEAST1 = (2, "curve_out", 225) 408 DEEP_WATER_SOUTHEAST1 = (2, "curve_out", 135) 409 DEEP_WATER_SOUTHWEST1 = (2, "curve_out", 45) 410 DEEP_WATER_NORTHWEST1 = (2, "curve_out", 315)
411
412 413 -class ACTION_SETS:
414 DEFAULT_ANIMATION_LENGTH = 500 415 DEFAULT_WEIGHT = 10
416
417 418 -class GAME_SPEED:
419 TICKS_PER_SECOND = 16 420 TICK_RATES = [] # type: List[int]
421 422 423 GAME_SPEED.TICK_RATES = [int(i * GAME_SPEED.TICKS_PER_SECOND) for i in (0.5, 1, 2, 3, 4, 6, 8, 11, 20)]
424 425 426 -class COLORS:
427 BLACK = 9
428
429 430 -class VIEW:
431 ZOOM_MAX = 1.5 432 ZOOM_MIN = 0.25 433 ZOOM_DEFAULT = 1 434 ZOOM_LEVELS_FACTOR = 0.875 435 CELL_IMAGE_DIMENSIONS = (64, 32) 436 ROTATION = 45.0 437 TILT = -60 438 AUTOSCROLL_WIDTH = 10
439
440 441 ## The Production States available in the game sorted by importance from least 442 ## to most important 443 -class PRODUCTION:
444 # ./development/print_db_data.py lines 445 STATES = Enum('none', 'waiting_for_res', 'inventory_full', 'producing', 'paused', 'done') 446 # NOTE: 'done' is only for SingleUseProductions 447 # NOTE: 'none' is not used by an actual production, just for a producer 448 STATISTICAL_WINDOW = 1000 # How many latest ticks are relevant for keeping track of how busy a production is
449
450 451 -class PRODUCTIONLINES:
452 HUKER = 15 453 # will get added later 454 FISHING_BOAT = None # type: ignore 455 FRIGATE = 58 456 TREES = 256812226 457 WOOL = 1654557398 458 SWORDSMAN = 1062345232
459
460 461 ## GAME-RELATED, BALANCING VALUES 462 -class GAME:
463 # seconds: duration of a "month" (running costs and taxes are paid in this interval) 464 INGAME_TICK_INTERVAL = 30 465 466 WORLD_WORLDID = 0 # worldid of World object 467 # exit after on tick MAX_TICKS (disabled by setting to None) 468 MAX_TICKS = None # type: Optional[int]
469
470 471 # Map related constants 472 -class MAP:
473 PADDING = 10 # extra usable water around the map edges 474 BORDER = 30 # extra unusable water around the padding (to keep the black void at bay)
475
476 477 -class GUI:
478 CITYINFO_UPDATE_DELAY = 2 # seconds 479 DEFAULT_EXCHANGE_AMOUNT = 50 # tons
480
481 482 # Editor 483 -class EDITOR:
484 MIN_BRUSH_SIZE = 1 485 MAX_BRUSH_SIZE = 3 486 DEFAULT_BRUSH_SIZE = 1
487
488 489 # Messagewidget and Logbook 490 -class MESSAGES:
491 CUSTOM_MSG_SHOW_DELAY = 6 # delay between messages when passing more than one 492 CUSTOM_MSG_VISIBLE_FOR = 90 # after this time the msg gets removed from screen 493 LOGBOOK_DEFAULT_DELAY = 1 # delay between condition fulfilled and logbook popping up
494
495 496 # AI values read from the command line; use the values below unless overridden by the CLI or the GUI 497 -class AI:
498 HIGHLIGHT_PLANS = False # whether to show the AI players' plans on the map 499 HIGHLIGHT_COMBAT = False # whether to show the AI players' combat ranges around each unit 500 HUMAN_AI = False # whether the human player is controlled by the AI
501
502 503 -class TRADER: # check resource values: ./development/print_db_data.py res
504 TILES_PER_TRADER = 100 # create one ship per 100 tiles 505 SETTLEMENTS_PER_SHIP = 2 # the settlement : ship ratio 506 PRICE_MODIFIER_BUY = 1.0 # buy for x times the resource value 507 PRICE_MODIFIER_SELL = 1.0 # sell for x times the resource value 508 TRADING_DURATION = 4 # seconds that trader stays at warehouse to simulate (un)loading 509 510 BUSINESS_SENSE = 50 # chance in percent to be sent to a warehouse instead of random spot 511 512 BUY_AMOUNT_MIN = 2 # amount range to buy/sell from settlement per resource 513 BUY_AMOUNT_MAX = 10 514 SELL_AMOUNT_MIN = 2 515 SELL_AMOUNT_MAX = 10 516
517 518 # Taxes and Restrictions 519 -class TIER:
520 NATURE = 0 521 SAILORS = 0 522 PIONEERS = 1 523 SETTLERS = 2 524 CITIZENS = 3 525 MERCHANTS = 4 526 ARISTOCRATS = 5 527 528 LOWEST = SAILORS 529 HIGHEST = ARISTOCRATS 530 CURRENT_MAX = MERCHANTS
531
532 533 -class SETTLER:
534 TAX_SETTINGS_MIN = 0.5 535 TAX_SETTINGS_MAX = 1.5 536 TAX_SETTINGS_STEP = 0.1
537
538 539 -class WILD_ANIMAL:
540 HEALTH_INIT_VALUE = 50 # animals start with this value 541 HEALTH_INCREASE_ON_FEEDING = 8 # health increases by this value on feeding 542 HEALTH_DECREASE_ON_NO_JOB = 20 # health decreases by this value when they have no food 543 HEALTH_LEVEL_TO_REPRODUCE = 75 # this level has to be reached for reproducing 544 POPULATION_LIMIT = 15 # minimum number of trees per animal to allow reproducing 545 FOOD_AVAILABLE_ON_START = 0.5 # probability that a tree has wild animal food in the beginning 546 POPULATION_INIT_RATIO = 15 # every N-th tree gets an animal in the beginning
547
548 549 -class COLLECTORS:
550 DEFAULT_WORK_DURATION = 16 # how many ticks collectors pretend to work at target 551 DEFAULT_WAIT_TICKS = 32 # how long collectors wait before again looking for a job 552 DEFAULT_STORAGE_SIZE = 8 553 STATISTICAL_WINDOW = 1000 # How many latest ticks are relevant for calculating how busy a collector is
554
555 556 -class STORAGE:
557 DEFAULT_STORAGE_SIZE = 30 # Our usual inventorys are 30 tons big 558 559 # Distributing overall delimiter, if one slot is "full" with respect to 560 # this value, you can't load further in any of the slots even if empty. 561 SHIP_TOTAL_STORAGE = 120 562 SHIP_TOTAL_SLOTS_NUMBER = 4 563 564 # The maximum number of items you can set in a trade route slot or warehouse trade slot 565 # This was actually only added to make sure the number wouldn't overflow the amount slider 566 # If more items can be traded than pixels in the slider it is impossible to accurately select an amount 567 # See https://github.com/unknown-horizons/unknown-horizons/issues/1095 568 ITEMS_PER_TRADE_SLOT = 50
569
570 571 ## ENGINE 572 -class LAYERS:
573 WATER = 0 574 GROUND = 1 575 FIELDS = 2 # ironically doesn't apply to fields anymore... 576 OBJECTS = 3 577 578 NUM = 4 # number of layers
579
580 581 -class GFX:
582 BUILDING_OUTLINE_THRESHOLD = 96 583 BUILDING_OUTLINE_WIDTH = 2 584 585 UNIT_OUTLINE_THRESHOLD = 96 586 UNIT_OUTLINE_WIDTH = 2 587 588 SHIP_OUTLINE_THRESHOLD = 96 589 SHIP_OUTLINE_WIDTH = 2 590 591 # this is modified by the game starting process. 592 USE_ATLASES = False
593 594 595 ## PATHS 596 597 _config_dir, _data_dir, _cache_dir = get_user_game_directories()
598 599 600 -class PATHS:
601 # paths in user directories 602 USER_CONFIG_FILE = os.path.join(_config_dir, "settings.xml") 603 USER_DATA_DIR = _data_dir 604 LOG_DIR = os.path.join(USER_DATA_DIR, "log") 605 USER_MAPS_DIR = os.path.join(USER_DATA_DIR, "maps") 606 SCREENSHOT_DIR = os.path.join(USER_DATA_DIR, "screenshots") 607 SAVEGAME_DIR = os.path.join(USER_DATA_DIR, "save") 608 CACHE_DIR = _cache_dir 609 ATLAS_METADATA_PATH = os.path.join(CACHE_DIR, "atlas-metadata.cache") 610 611 # paths relative to uh dir 612 DEFAULT_WINDOW_ICON_PATH = os.path.join("content", "gui", "images", "logos", "uh_32.png") 613 MAC_WINDOW_ICON_PATH = os.path.join("content", "gui", "icons", "Icon.icns") 614 615 ACTION_SETS_DIRECTORY = os.path.join("content", "gfx") 616 TILE_SETS_DIRECTORY = os.path.join("content", "gfx", "base") 617 SAVEGAME_TEMPLATE = os.path.join("content", "savegame_template.sql") 618 619 ATLAS_FILES_DIR = os.path.join("content", "gfx", "atlas") 620 ATLAS_DB_PATH = os.path.join("content", "atlas.sql") 621 ACTION_SETS_JSON_FILE = os.path.join("content", "actionsets.json") 622 TILE_SETS_JSON_FILE = os.path.join("content", "tilesets.json") 623 624 SETTINGS_TEMPLATE_FILE = os.path.join("content", "settings-template.xml") 625 CONFIG_TEMPLATE_FILE = os.path.join("content", "settings-template.xml") 626 627 DB_FILES = tuple(os.path.join("content", i) for i in 628 ("game.sql", "balance.sql", "names.sql")) 629 630 ATLAS_SOURCE_DIRECTORIES = tuple(os.path.join("content", "gfx", d) 631 for d in ( 632 "base", 633 "buildings", 634 "misc", 635 "terrain", 636 "units", 637 )) 638 639 #voice paths 640 VOICE_DIR = os.path.join("content", "audio", "voice") 641 UH_LOGO_FILE = os.path.join("content", "gfx", "uh.png")
642 643 644 _old_user_dir = get_old_user_game_directory()
645 646 647 -class OLDPATHS:
648 USER_DATA_DIR = _old_user_dir 649 USER_CONFIG_FILE = os.path.join(_old_user_dir, "settings.xml") 650 CACHE_DIR = _old_user_dir
651
652 653 -class SETTINGS:
654 UH_MODULE = "unknownhorizons" 655 FIFE_MODULE = "FIFE" 656 KEY_MODULE = "keys" 657 META_MODULE = "meta"
658
659 660 -class PLAYER:
661 STATS_UPDATE_FREQUENCY = GAME_SPEED.TICKS_PER_SECOND
662
663 664 ## SINGLEPLAYER 665 -class SINGLEPLAYER:
666 FREEZE_PROTECTION = True 667 SEED = None # type: int
668
669 670 ## MULTIPLAYER 671 -class MULTIPLAYER:
672 MAX_PLAYER_COUNT = 8
673
674 675 -class NETWORK:
676 SERVER_ADDRESS = "207.180.251.79" 677 # change port to 2022 for development server updated after UH commits 678 SERVER_PORT = 2002 679 CLIENT_ADDRESS = None # type: Optional[str] 680 UPDATE_FILE_URL = "http://unknown-horizons.org/current-version.json"
681
682 683 ## TRANSLATIONS 684 -class _LanguageNameDict(dict):
685 - def __getitem__(self, key):
686 return self.get(key, [key])[0]
687
688 - def get_english(self, key):
689 return self.get(key, [key])[1]
690
691 - def get_by_value(self, value, english=False):
692 for code, (own, eng) in self.items(): 693 if english and eng == value: 694 return code 695 elif not english and own == value: 696 return code 697 return "" # meaning default key
698 699 700 LANGUAGENAMES = _LanguageNameDict({ 701 "" : ('System default', ''), 702 "af" : ('Afrikaans', 'Afrikaans'), 703 "ar" : ('اَللُّغَةُ اَلْعَرَبِيَّة', 'Arabic'), 704 "bg" : ('Български', 'Bulgarian'), 705 "ca" : ('Català', 'Catalan'), 706 'ca@valencia' : ('Català de València', 'Catalan (Valencia)'), 707 "cs" : ('Čeština', 'Czech'), 708 "da" : ('Danske', 'Danish'), 709 "de" : ('Deutsch', 'German'), 710 "en" : ('English', 'English'), 711 "eo" : ('Esperanto', 'Esperanto'), 712 "es" : ('Español', 'Spanish'), 713 "et" : ('Eesti', 'Estonian'), 714 "el" : ('Ελληνικά', 'Greek'), 715 "fi" : ('Suomi', 'Finnish'), 716 "fr" : ('Français', 'French'), 717 "frp" : ('Francoprovençâl', 'Franco-Provencal'), 718 "ga" : ('Gaeilge', 'Irish'), 719 "gl" : ('Galego', 'Galician'), 720 "hi" : ('मानक हिन्दी', 'Hindi'), 721 "hr" : ('Hrvatski', 'Croatian'), 722 "hu" : ('Magyar', 'Hungarian'), 723 "id" : ('Bahasa Indonesia', 'Indonesian'), 724 "it" : ('Italiano', 'Italian'), 725 "ja" : ('日本語', 'Japanese'), 726 "ko" : ('한국말/조선말', 'Korean'), 727 "lt" : ('Lietuvių', 'Lithuanian'), 728 "lv" : ('Latviešu', 'Latvian'), 729 "ml" : ('മലയാളം', 'Malayalam'), 730 "nb" : ('Bokmål', 'Norwegian'), 731 "nl" : ('Nederlands', 'Dutch'), 732 "pl" : ('Polski', 'Polish'), 733 "pt_BR" : ('Português Br.', 'Brazilian Portuguese'), 734 "pt" : ('Português', 'Portuguese'), 735 "ro" : ('Română', 'Romanian'), 736 "ru" : ('Русский', 'Russian'), 737 "sk" : ('Slovenský', 'Slovak'), 738 "sl" : ('Slovenski', 'Slovenian'), 739 "sr" : ('Cрпски', 'Serbian'), 740 "sv" : ('Svenska', 'Swedish'), 741 "th" : ('ภาษาไทย', 'Thai'), 742 "tr" : ('Türkçe', 'Turkish'), 743 "uk" : ('Українська', 'Ukrainian'), 744 "vi" : ('Tiếng Việt', 'Vietnamese'), 745 "zh_CN" : ('简化字', 'Simplified Chinese'), 746 "zh_Hant" : ('繁體字', 'Traditional Chinese'), 747 "zh_TW" : ('繁體字', 'Traditional Chinese'), 748 "zu" : ('IsiZulu', 'Zulu'), 749 }) 750 751 FONTDEFS = { 752 # "af" 753 # "ar" 754 "bg" : 'libertine', 755 # "ca" 756 "ca@valencia" : 'libertine', 757 "cs" : 'libertine', 758 "da" : 'libertine', 759 "de" : 'libertine', 760 "en" : 'libertine', 761 "es" : 'libertine', 762 "et" : 'libertine', 763 "el" : 'libertine', 764 "fi" : 'libertine', 765 "fr" : 'libertine', 766 # "frp" 767 "ga" : 'libertine', 768 "gl" : 'libertine', 769 # "hi" 770 "hr" : 'libertine', 771 "hu" : 'libertine', 772 "id" : 'libertine', 773 "it" : 'libertine', 774 # "ja" 775 # "ko" 776 "lt" : 'libertine', 777 "lv" : 'libertine', 778 # "ml" 779 "nb" : 'libertine', 780 "nl" : 'libertine', 781 "pl" : 'libertine', 782 "pt_BR" : 'libertine', 783 "pt" : 'libertine', 784 "ro" : 'libertine', 785 "ru" : 'libertine', 786 "sk" : 'libertine', 787 "sl" : 'libertine', 788 "sr" : 'libertine', 789 "sv" : 'libertine', 790 # "th" 791 "tr" : 'libertine', 792 "uk" : 'libertine', 793 # "vi" 794 # "zh_CN" 795 # "zh_TW" 796 "zu" : 'libertine', 797 }
798 799 800 -class HOTKEYS:
801 DISPLAY_KEY = { 802 'MINUS': '-', 803 'PLUS': '+', 804 'COMMA': ',', 805 'PERIOD': '.', 806 'EXCLAIM': '!', 807 'AT': '@', 808 'HASH': '#', 809 'DOLLAR': '$', 810 # XXX Fife does not recognize percent key? 811 # 'PERCENT': '%', 812 'CARET': '^', 813 'AMPERSAND': '&', 814 'ASTERISK': '*', 815 'LEFTPAREN': '(', 816 'RIGHTPAREN': ')', 817 'UNDERSCORE': '_', 818 'LEFTBRACKET': '[', 819 'RIGHTBRACKET': ']', 820 'SLASH': '/', 821 'COLON': ':', 822 'SEMICOLON': ';', 823 'LESS': '<', 824 'EQUALS': '=', 825 'GREATER': '>', 826 'QUESTION': '?', 827 'BACKSLASH': '\\', 828 'BACKQUOTE': '`', 829 'QUOTE': "'", 830 'QUOTEDBL': '"', 831 'ESCAPE': 'Esc', 832 'DELETE': 'Del', 833 'INSERT': 'Ins', 834 'PAGE_UP': 'PgUp', 835 'PAGE_DOWN': 'PgDn', 836 'PRINT_SCREEN': 'PrtSc', 837 }
838