def __init__(self): self.logins = {} self.roles_symbols = { 'h': fo.roleType.host, 'm': fo.roleType.clientTypeModerator, 'p': fo.roleType.clientTypePlayer, 'o': fo.roleType.clientTypeObserver, 'g': fo.roleType.galaxySetup } try: with open(fo.get_user_config_dir() + "/auth.txt") as f: first_line = True for line in f: if first_line: first_line = False self.default_roles = self.__parse_roles(line.strip()) else: l = line.rsplit(':', 2) self.logins[l[0]] = (l[2].strip(), self.__parse_roles(l[1].strip())) except IOError: exctype, value = sys.exc_info()[:2] warn("Cann't read auth file %s: %s %s" % (fo.get_user_config_dir() + "/auth.txt", exctype, value)) self.default_roles = [ fo.roleType.clientTypeModerator, fo.roleType.clientTypePlayer, fo.roleType.clientTypeObserver, fo.roleType.galaxySetup ] info("Auth initialized")
def __init__(self): self.logins = {} self.roles_symbols = { "h": fo.roleType.host, "m": fo.roleType.clientTypeModerator, "p": fo.roleType.clientTypePlayer, "o": fo.roleType.clientTypeObserver, "g": fo.roleType.galaxySetup, } try: with open(fo.get_user_config_dir() + "/auth.txt") as f: first_line = True for line in f: if first_line: first_line = False self.default_roles = self.__parse_roles(line.strip()) else: login, roles, password = line.rsplit(":", 2) self.logins[login] = (password.strip(), self.__parse_roles( roles.strip())) except IOError: exctype, value = sys.exc_info()[:2] warning("Can't read auth file %s: %s %s" % (fo.get_user_config_dir() + "/auth.txt", exctype, value)) self.default_roles = [ fo.roleType.clientTypeModerator, fo.roleType.clientTypePlayer, fo.roleType.clientTypeObserver, fo.roleType.galaxySetup, ] info("Auth initialized")
def __init__(self): self.logins = {} try: with open(fo.get_user_config_dir() + "/auth.txt") as f: for line in f: l = line.rsplit(':', 1) self.logins[l[0]] = l[1] except: exctype, value = sys.exc_info()[:2] warn("Cann't read auth file %s: %s %s" % (fo.get_user_config_dir() + "/auth.txt", exctype, value)) info("Auth initialized")
from starsystems import name_planets, generate_systems from empires import compile_home_system_list, setup_empire from fields import generate_fields from natives import generate_natives from monsters import generate_monsters from specials import distribute_specials from util import int_hash, seed_rng, report_error, error_list from universe_tables import MAX_JUMPS_BETWEEN_SYSTEMS, MAX_STARLANE_LENGTH import universe_statistics from common import six from common.handlers import init_handlers from common.listeners import listener from common.option_tools import parse_config parse_config(fo.get_options_db_option_str("ai-config"), fo.get_user_config_dir()) init_handlers(fo.get_options_db_option_str("ai-config"), None) class PyGalaxySetupData: """ Class used to store and manage a copy of the galaxy setup data provided by the FreeOrion interface. This data can then be modified when needed during the universe generation process, without having to change the original data structure. """ def __init__(self, galaxy_setup_data): self.seed = galaxy_setup_data.seed self.size = galaxy_setup_data.size self.shape = galaxy_setup_data.shape self.age = galaxy_setup_data.age self.starlane_frequency = galaxy_setup_data.starlaneFrequency
from starnames import name_star_systems from galaxy import calc_star_system_positions from starsystems import name_planets, generate_systems from empires import compile_home_system_list, setup_empire from fields import generate_fields from natives import generate_natives from monsters import generate_monsters from specials import distribute_specials from util import int_hash, seed_rng, report_error, error_list from universe_tables import MAX_JUMPS_BETWEEN_SYSTEMS, MAX_STARLANE_LENGTH import universe_statistics from common.handlers import init_handlers from common.listeners import listener from common.option_tools import parse_config parse_config(fo.get_options_db_option_str("ai-config"), fo.get_user_config_dir()) init_handlers(fo.get_options_db_option_str("ai-config"), None) class PyGalaxySetupData: """ Class used to store and manage a copy of the galaxy setup data provided by the FreeOrion interface. This data can then be modified when needed during the universe generation process, without having to change the original data structure. """ def __init__(self, galaxy_setup_data): self.seed = galaxy_setup_data.seed self.size = galaxy_setup_data.size self.shape = galaxy_setup_data.shape self.age = galaxy_setup_data.age self.starlane_frequency = galaxy_setup_data.starlaneFrequency