def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ os.chdir(game_dir) # add models file_path = os.path.join(game_dir, "worlddata", "models.py") utils.file_append(file_path, [ "\n", "class action_room_interval(BaseModels.action_room_interval):\n", " pass\n", "\n", "\n", "class action_message(BaseModels.action_message):\n", " pass\n", "\n", "\n", "class action_get_objects(BaseModels.action_get_objects):\n", " pass\n", "\n" ]) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations", "worlddata"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate", "worlddata"] django_kwargs = {"database": "worlddata"} django.core.management.call_command(*django_args, **django_kwargs)
def init_game(game_name, template=None, port=None): """ Create a new game project. :param game_name: game project's name :param template: game template's name :param port: game server's port. :return: """ gamedir = os.path.abspath(os.path.join(configs.CURRENT_DIR, game_name)) utils.create_game_directory(gamedir, template, port) os.chdir(gamedir) evennia_launcher.GAMEDIR = gamedir evennia_launcher.init_game_directory(gamedir, check_db=False) try: utils.create_database() except Exception as e: traceback.print_exc() raise print( configs.CREATED_NEW_GAMEDIR.format(gamedir=game_name, settings_path=os.path.join( game_name, configs.SETTINGS_PATH), port=port if port else 8000))
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ print("Upgrading game from version 0.2.8 %s." % game_dir) if game_template == "example_cn": game_template_dir = os.path.join(configs.MUDDERY_TEMPLATE, game_template) # copy webclient utils.copy_path( game_template_dir, game_dir, os.path.join("web", "webclient_overrides", "webclient")) os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs)
def start(game_dir): """ Start the game. :return: """ evennia_launcher.init_game_directory(game_dir, check_db=True) evennia_launcher.error_check_python_modules() evennia_launcher.start_evennia()
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ os.chdir(game_dir) # add honour_settings table to the worlddata model file_path = os.path.join(game_dir, "worlddata", "models.py") file_append(file_path, [ "\n", "class honour_settings(BaseModels.honour_settings):\n", " pass\n", "\n" ]) # add honours table to the gamedata model file_path = os.path.join(game_dir, "gamedata", "models.py") file_append(file_path, [ "from muddery.server.database import gamedata_models as BaseModels", "\n", "class honours(BaseModels.honours):\n", " pass\n", "\n" ]) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations", "worlddata"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate", "worlddata"] django_kwargs = {"database": "worlddata"} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["makemigrations", "gamedata"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate", "gamedata"] django_kwargs = {"database": "gamedata"} django.core.management.call_command(*django_args, **django_kwargs) # load system data try: import_system_data() print("Import system data success.") except Exception as e: traceback.print_exc() raise
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ print("Upgrading game from version 0.2.7 %s." % game_dir) if game_template: game_template_dir = os.path.join(configs.MUDDERY_TEMPLATE, game_template) if os.path.exists( os.path.join(game_template_dir, "statements", "skill.py")): # copy skill utils.copy_path(game_template_dir, game_dir, os.path.join("statements", "skill.py")) # copy homepage utils.copy_path(game_template_dir, game_dir, os.path.join("web", "template_overrides")) # copy webclient utils.copy_path( game_template_dir, game_dir, os.path.join("web", "webclient_overrides", "webclient")) os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) # load data system_data_path = os.path.join(muddery_lib, "worlddata", "data") from muddery.worlddata.data_sets import DATA_SETS # load system data for data_handlers in DATA_SETS.system_data: try: data_handlers.import_from_path(system_data_path, system_data=True) except Exception, e: err_message = "Cannot import system game data. %s" % e print(err_message)
def create_game(game_dir, game_template, setting_dict): """ Create a new game dir. Args: game_dir: (string)game's dir Returns: None """ launcher_utils.create_game_directory(game_dir, game_template, setting_dict) os.chdir(game_dir) evennia_launcher.init_game_directory(game_dir, check_db=False)
def migrate_database(): """ Migrate databases to the latest Muddery version. :return: """ print("Migrating databases.") gamedir = os.path.abspath(configs.CURRENT_DIR) os.chdir(gamedir) evennia_launcher.init_game_directory(gamedir, check_db=False) # make migrations django_args = ["makemigrations", "gamedata"] django_kwargs = {} try: django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print(configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) django_args = ["makemigrations", "worlddata"] django_kwargs = {} try: django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print(configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) # migrate the database django_args = ["migrate"] django_kwargs = {} try: django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print(configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) django_args = ["migrate", "gamedata"] django_kwargs = {"database": "gamedata"} try: django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print(configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) django_args = ["migrate", "worlddata"] django_kwargs = {"database": "worlddata"} try: django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print(configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs))
def load_system_data(): """ Reload Muddery's system data. :return: """ print("Importing system data.") gamedir = os.path.abspath(configs.CURRENT_DIR) os.chdir(gamedir) evennia_launcher.init_game_directory(gamedir, check_db=False) # load local data try: utils.import_system_data() print("Import system data success.") except Exception as e: traceback.print_exc() raise
def upgrade_game(self, game_dir, game_template): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. """ print("Upgrading game %s." % game_dir) os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs)
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations", "worlddata"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate", "worlddata"] django_kwargs = {"database": "worlddata"} django.core.management.call_command(*django_args, **django_kwargs)
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ print("Upgrading game from version 0.2.8 %s." % game_dir) print(""" We are very sorry that your game is too old to upgrade. If you want to upgrade your game nevertheless, please contact the author.""") raise MudderyError("Can not upgrade.") if game_template == "example_cn": game_template_dir = os.path.join(configs.MUDDERY_TEMPLATE, game_template) # copy webclient utils.copy_path( game_template_dir, game_dir, os.path.join("web", "webclient_overrides", "webclient")) os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs)
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ print("Upgrading game 0.2.2-0.2.4 %s." % game_dir) os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs)
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations", "worlddata"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate", "worlddata"] django_kwargs = {"database": "worlddata"} django.core.management.call_command(*django_args, **django_kwargs) # load system localized strings from django.conf import settings from muddery.worldeditor.services import importer # system data file's path system_data_path = os.path.join(settings.MUDDERY_DIR, settings.WORLD_DATA_FOLDER) # localized string file's path system_localized_string_path = os.path.join( system_data_path, settings.LOCALIZED_STRINGS_FOLDER, settings.LANGUAGE_CODE) # load data importer.import_table_path(system_localized_string_path, settings.LOCALIZED_STRINGS_MODEL)
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ os.chdir(game_dir) # add models file_path = os.path.join(game_dir, "worlddata", "models.py") utils.file_append(file_path, ["\n", "class action_room_interval(BaseModels.action_room_interval):\n", " pass\n", "\n", "\n", "class action_message(BaseModels.action_message):\n", " pass\n", "\n", "\n", "class action_get_objects(BaseModels.action_get_objects):\n", " pass\n", "\n" ]) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations", "worlddata"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate", "worlddata"] django_kwargs = {"database": "worlddata"} django.core.management.call_command(*django_args, **django_kwargs)
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ print("Upgrading game from version 0.2.8 %s." % game_dir) print(""" We are very sorry that your game is too old to upgrade. If you want to upgrade your game nevertheless, please contact the author.""") raise MudderyError("Can not upgrade.") if game_template == "example_cn": game_template_dir = os.path.join(configs.MUDDERY_TEMPLATE, game_template) # copy webclient utils.copy_path(game_template_dir, game_dir, os.path.join("web", "webclient_overrides", "webclient")) os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs)
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ print("Upgrading game 0.2.0-0.2.2 %s." % game_dir) print(""" We are very sorry that your game is too old to upgrade. If you want to upgrade your game nevertheless, please contact the author.""") raise MudderyError("Can not upgrade.") # comment out client_settings in models file_path = os.path.join(game_dir, "worlddata", "models.py") utils.comment_out_class(file_path, "client_settings") # add world_area to models utils.file_append(file_path, ["\n", "class world_areas(model_base.world_areas):\n", " pass\n", "\n"]) # add character_attributes_info to models utils.file_append(file_path, ["\n", "class character_attributes_info(model_base.character_attributes_info):\n", " pass\n", "\n"]) # add equipment_attributes_info to models utils.file_append(file_path, ["\n", "class equipment_attributes_info(model_base.equipment_attributes_info):\n", " pass\n", "\n"]) # add food_attributes_info to models utils.file_append(file_path, ["\n", "class food_attributes_info(model_base.food_attributes_info):\n", " pass\n", "\n"]) # add condition_desc to models utils.file_append(file_path, ["\n", "class condition_desc(model_base.condition_desc):\n", " pass\n", "\n"]) # add skill_types to models utils.file_append(file_path, ["\n", "class skill_types(model_base.skill_types):\n", " pass\n", "\n"]) # add honours to models utils.file_append(file_path, ["\n", "class honours(model_base.honours):\n", " pass\n", "\n"]) # comment out ClientSettingsForm in forms file_path = os.path.join(game_dir, "worlddata", "forms.py") utils.comment_out_class(file_path, "ClientSettingsForm") utils.comment_out_lines(file_path, ["Manager.init_data()"]) # add world_area to forms utils.file_append(file_path, ["\n", "class WorldAreasForm(forms_base.WorldAreasForm):\n", " pass\n", "\n"]) # add character_attributes_info to forms utils.file_append(file_path, ["\n", "class CharacterAttributesForm(forms_base.CharacterAttributesForm):\n", " pass\n", "\n"]) # add equipment_attributes_info to forms utils.file_append(file_path, ["\n", "class EquipmentAttributesForm(forms_base.EquipmentAttributesForm):\n", " pass\n", "\n"]) # add food_attributes_info to forms utils.file_append(file_path, ["\n", "class FoodAttributesForm(forms_base.FoodAttributesForm):\n", " pass\n", "\n"]) # add condition_desc to forms utils.file_append(file_path, ["\n", "class ConditionDescForm(forms_base.ConditionDescForm):\n", " pass\n", "\n"]) # add skill_types to forms utils.file_append(file_path, ["\n", "class SkillTypesForm(forms_base.SkillTypesForm):\n", " pass\n", "\n"]) # add init method utils.file_append(file_path, ["\n", "Manager.init_data()\n", "\n"]) # comment out ClientSettingsAdmin in admin file_path = os.path.join(game_dir, "worlddata", "admin.py") utils.comment_out_class(file_path, "ClientSettingsAdmin") utils.comment_out_lines(file_path, "admin.site.register(client_settings, ClientSettingsAdmin)") # update web folder shutil.rmtree(os.path.join(game_dir, "web")) default_template_dir = os.path.join(muddery_lib, "game_template") # update web folder utils.copy_path(default_template_dir, game_dir, "web") # update game editor utils.copy_path(default_template_dir, game_dir, os.path.join("worlddata", "editor")) if game_template: game_template_dir = os.path.join(configs.MUDDERY_TEMPLATE, game_template) # update AI if game_template == "example_cn": utils.copy_path(game_template_dir, game_dir, "ai") # update settings file file_path = os.path.join(game_dir, "server", "conf", "settings.py") utils.file_append(file_path, ["\n", "AI_CHOOSE_SKILL = 'ai.choose_skill.ChooseSkill'\n", "\n"]) # update web folder utils.copy_path(game_template_dir, game_dir, "web") # update statements utils.copy_path(game_template_dir, game_dir, "statements") # update game editor utils.copy_path(game_template_dir, game_dir, os.path.join("worlddata", "editor")) # template data utils.copy_path(game_template_dir, game_dir, os.path.join("worlddata", "data")) os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) # load data system_data_path = os.path.join(muddery_lib, "worlddata", "data") from muddery.worlddata.data_sets import DATA_SETS # load system data for data_handlers in DATA_SETS.system_data: try: data_handlers.import_from_path(system_data_path, system_data=True) except Exception, e: err_message = "Cannot import system game data. %s" % e print(err_message)
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # add system data to models file_path = os.path.join(game_dir, "worlddata", "models.py") utils.file_append(file_path, ["\n", "class system_data(BaseModels.system_data):\n", " pass\n", "\n"]) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {"database": "worlddata"} django.core.management.call_command(*django_args, **django_kwargs) from django.conf import settings game_settings = apps.get_model(settings.WORLD_DATA_APP, "game_settings") record = game_settings.objects.first() map_scale = record.map_scale room_size = record.map_room_size world_areas = apps.get_model(settings.WORLD_DATA_APP, "world_areas") world_rooms = apps.get_model(settings.WORLD_DATA_APP, "world_rooms") areas = world_areas.objects.all() for area in areas: background_point = ast.literal_eval(area.background_point) if area.background_point else [0, 0] corresp_map_pos = ast.literal_eval(area.corresp_map_pos) if area.corresp_map_pos else [0, 0] shift_x = background_point[0] - corresp_map_pos[0] * map_scale shift_y = background_point[1] + corresp_map_pos[1] * map_scale rooms = world_rooms.objects.filter(location=area) # If the background is empty, calculate the map size. if not area.background: min_x = 0 max_x = 0 min_y = 0 max_y = 0 if rooms: position = ast.literal_eval(rooms[0].position) min_x = position[0] max_x = position[0] min_y = position[1] max_y = position[1] for room in rooms: position = room.position if position: position = ast.literal_eval(position) x = position[0] y = position[1] if x > max_x: max_x = x if y > max_y: max_y = y if x < min_x: min_x = x if y < min_y: min_y = y # set the area's size area.width = (max_x - min_x) * map_scale + room_size * 2 area.height = (max_y - min_y) * map_scale + room_size * 2 area.save() # calculate room's position shift_x = shift_x - min_x * map_scale + room_size shift_y = shift_y + max_y * map_scale + room_size for room in rooms: position = room.position if position: position = ast.literal_eval(position) x = position[0] y = position[1] x = int(x * map_scale + shift_x) y = int(-y * map_scale + shift_y) room.position = "(%s,%s)" % (x, y) room.save()
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ print("Upgrading game 0.2.5 %s." % game_dir) print(""" We are very sorry that your game is too old to upgrade. If you want to upgrade your game nevertheless, please contact the author.""") raise MudderyError("Can not upgrade.") # add new models file_path = os.path.join(game_dir, "worlddata", "models.py") # add condition_desc to models utils.file_append(file_path, ["\n", "class condition_desc(model_base.condition_desc):\n", " pass\n", "\n"]) # add skill_types to models utils.file_append(file_path, ["\n", "class skill_types(model_base.skill_types):\n", " pass\n", "\n"]) # add honours to models utils.file_append(file_path, ["\n", "class honours(model_base.honours):\n", " pass\n", "\n"]) # add new forms file_path = os.path.join(game_dir, "worlddata", "forms.py") # move init to the end of the file utils.comment_out_lines(file_path, ["Manager.init_data()"]) # add condition_desc to forms utils.file_append(file_path, ["\n", "class ConditionDescForm(forms_base.ConditionDescForm):\n", " pass\n", "\n"]) # add skill_types to forms utils.file_append(file_path, ["\n", "class SkillTypesForm(forms_base.SkillTypesForm):\n", " pass\n", "\n"]) # add init method utils.file_append(file_path, ["\n", "Manager.init_data()\n", "\n"]) default_template_dir = os.path.join(muddery_lib, "game_template") # update game editor utils.copy_path(default_template_dir, game_dir, os.path.join("worlddata", "editor")) if game_template: game_template_dir = os.path.join(configs.MUDDERY_TEMPLATE, game_template) if game_template == "example_cn": # update AI utils.copy_path(game_template_dir, game_dir, "ai") # update settings file file_path = os.path.join(game_dir, "server", "conf", "settings.py") utils.file_append(file_path, ["\n", "AI_CHOOSE_SKILL = 'ai.choose_skill.ChooseSkill'\n", "\n"]) if game_template == "legend": # update main.js utils.copy_path(game_template_dir, game_dir, os.path.join("web", "webclient_overrides", "webclient", "controllers", "main.js")) # update game editor utils.copy_path(game_template_dir, game_dir, os.path.join("worlddata", "editor")) # template data utils.copy_path(game_template_dir, game_dir, os.path.join("worlddata", "data")) os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) if game_template == "example_cn": # load data from muddery.worlddata.data_sets import DATA_SETS data_path = os.path.join(game_dir, "worlddata", "data") DATA_SETS.get_handler("skill_types").import_from_path(data_path)
def main(): """ Run the muddery main program. """ # set up argument parser parser = ArgumentParser(description=CMDLINE_HELP) parser.add_argument('-v', '--version', action='store_true', dest='show_version', default=False, help="Show version info.") parser.add_argument('-i', '--interactive', action='store_true', dest='interactive', default=False, help="Start given processes in interactive mode.") parser.add_argument('--init', action='store', dest="init", metavar="game_name [template]", help="Creates a new game directory 'game_name' at the current location (from optional template).") parser.add_argument('-l', nargs='+', action='store', dest='listsetting', metavar="key", help="List values for server settings. Use 'all' to list all available keys.") parser.add_argument('--profiler', action='store_true', dest='profiler', default=False, help="Start given server component under the Python profiler.") parser.add_argument('--dummyrunner', nargs=1, action='store', dest='dummyrunner', metavar="N", help="Tests a running server by connecting N dummy players to it.") parser.add_argument('--settings', nargs=1, action='store', dest='altsettings', default=None, metavar="filename.py", help="Start evennia with alternative settings file in gamedir/server/conf/.") parser.add_argument("option", nargs='?', default="noop", help="Operational mode: 'start', 'stop' or 'restart'.") parser.add_argument("service", metavar="component", nargs='?', default="all", help="Server component to operate on: 'server', 'portal' or 'all' (default).") parser.epilog = "Example django-admin commands: 'migrate', 'flush', 'shell' and 'dbshell'. " \ "See the django documentation for more django-admin commands." args, unknown_args = parser.parse_known_args() # handle arguments option, service = args.option, args.service # make sure we have everything evennia_launcher.check_main_evennia_dependencies() if not args: # show help pane print(CMDLINE_HELP) sys.exit() elif args.init: # initialization of game directory if option == "noop": option = "" create_game_directory(args.init, option) evennia_launcher.init_game_directory(GAMEDIR, check_db=False) try: django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError, exc: print(ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) try: django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError, exc: print(ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs))
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ print("Upgrading game 0.2.2-0.2.4 %s." % game_dir) # add new models file_path = os.path.join(game_dir, "worlddata", "models.py") # add character_attributes_info to models utils.file_append(file_path, [ "\n", "class character_attributes_info(model_base.character_attributes_info):\n", " pass\n", "\n" ]) # add equipment_attributes_info to models utils.file_append(file_path, [ "\n", "class equipment_attributes_info(model_base.equipment_attributes_info):\n", " pass\n", "\n" ]) # add food_attributes_info to models utils.file_append(file_path, [ "\n", "class food_attributes_info(model_base.food_attributes_info):\n", " pass\n", "\n" ]) # add new forms file_path = os.path.join(game_dir, "worlddata", "forms.py") # move init to the end of the file utils.comment_out_lines(file_path, ["Manager.init_data()"]) # add character_attributes_info to forms utils.file_append(file_path, [ "\n", "class CharacterAttributesForm(forms_base.CharacterAttributesForm):\n", " pass\n", "\n" ]) # add equipment_attributes_info to forms utils.file_append(file_path, [ "\n", "class EquipmentAttributesForm(forms_base.EquipmentAttributesForm):\n", " pass\n", "\n" ]) # add food_attributes_info to forms utils.file_append(file_path, [ "\n", "class FoodAttributesForm(forms_base.FoodAttributesForm):\n", " pass\n", "\n" ]) # add init method utils.file_append(file_path, ["\n", "Manager.init_data()\n", "\n"]) default_template_dir = os.path.join(muddery_lib, "game_template") # update game editor utils.copy_path(default_template_dir, game_dir, os.path.join("worlddata", "editor")) if game_template: game_template_dir = os.path.join(configs.MUDDERY_TEMPLATE, game_template) # update statements utils.copy_path(game_template_dir, game_dir, "statements") # update game editor utils.copy_path(game_template_dir, game_dir, os.path.join("worlddata", "editor")) # template data utils.copy_path(game_template_dir, game_dir, os.path.join("worlddata", "data")) os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) # load data system_data_path = os.path.join(muddery_lib, "worlddata", "data") from muddery.worlddata.data_sets import DATA_SETS # load system data for data_handlers in DATA_SETS.system_data: try: data_handlers.import_from_path(system_data_path, system_data=True) except Exception, e: err_message = "Cannot import system game data. %s" % e logger.log_errmsg(err_message)
def main(): """ Run the muddery main program. """ # set up argument parser parser = ArgumentParser(description=configs.CMDLINE_HELP) parser.add_argument('-v', '--version', action='store_true', dest='show_version', default=False, help="Show version info.") # parser.add_argument('-i', '--interactive', action='store_true', # dest='interactive', default=False, # help="Start given processes in interactive mode.") parser.add_argument( '--init', nargs='+', action='store', dest="init", metavar="game_name [template]", help= "Creates a new game directory 'game_name' at the current location (from optional template)." ) parser.add_argument( '-l', nargs='+', action='store', dest='listsetting', metavar="key", help= "List values for server settings. Use 'all' to list all available keys." ) parser.add_argument( '--profiler', action='store_true', dest='profiler', default=False, help="Start given server component under the Python profiler.") parser.add_argument( '--dummyrunner', nargs=1, action='store', dest='dummyrunner', metavar="N", help="Tests a running server by connecting N dummy players to it.") parser.add_argument( '--settings', nargs=1, action='store', dest='altsettings', default=None, metavar="filename.py", help= "Start evennia with alternative settings file in gamedir/server/conf/." ) parser.add_argument( '--upgrade', nargs='?', const='', dest='upgrade', metavar="[template]", help="Upgrade a game directory 'game_name' to the latest version.") parser.add_argument('--loaddata', action='store_true', dest='loaddata', default=False, help="Load local data from the worlddata folder.") parser.add_argument("option", nargs='?', default="noop", help="Operational mode: 'start', 'stop' or 'restart'.") parser.add_argument( "service", metavar="component", nargs='?', default="all", help= "Server component to operate on: 'server', 'portal' or 'all' (default)." ) parser.epilog = "Example django-admin commands: 'migrate', 'flush', 'shell' and 'dbshell'. " \ "See the django documentation for more django-admin commands." args, unknown_args = parser.parse_known_args() # handle arguments option, service = args.option, args.service # make sure we have everything evennia_launcher.check_main_evennia_dependencies() if not args: # show help pane print(configs.CMDLINE_HELP) sys.exit() elif args.init: # initialization of game directory game_name = args.init[0] template = None if len(args.init) > 1: template = args.init[1] gamedir = os.path.abspath(os.path.join(configs.CURRENT_DIR, game_name)) utils.create_game_directory(gamedir, template) os.chdir(gamedir) evennia_launcher.init_game_directory(gamedir, check_db=False) # make migrations try: django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError, exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) # migrate the database try: django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {"database": "worlddata"} django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError, exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs))
if args.upgrade: template = args.upgrade gamedir = os.path.abspath(configs.CURRENT_DIR) UPGRADE_HANDLER.upgrade_game(gamedir, template, configs.MUDDERY_LIB) except Exception, e: print("Upgrade failed: %s" % e) sys.exit() elif args.loaddata: print("Importing local data.") gamedir = os.path.abspath(configs.CURRENT_DIR) os.chdir(gamedir) evennia_launcher.init_game_directory(gamedir, check_db=False) # make migrations try: django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError, exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) # migrate the database try: django_args = ["migrate"]
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # add system data to models file_path = os.path.join(game_dir, "worlddata", "models.py") utils.file_append(file_path, [ "\n", "class system_data(BaseModels.system_data):\n", " pass\n", "\n" ]) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {"database": "worlddata"} django.core.management.call_command(*django_args, **django_kwargs) from django.conf import settings game_settings = apps.get_model(settings.WORLD_DATA_APP, "game_settings") record = game_settings.objects.first() map_scale = record.map_scale room_size = record.map_room_size world_areas = apps.get_model(settings.WORLD_DATA_APP, "world_areas") world_rooms = apps.get_model(settings.WORLD_DATA_APP, "world_rooms") areas = world_areas.objects.all() for area in areas: background_point = ast.literal_eval( area.background_point) if area.background_point else [0, 0] corresp_map_pos = ast.literal_eval( area.corresp_map_pos) if area.corresp_map_pos else [0, 0] shift_x = background_point[0] - corresp_map_pos[0] * map_scale shift_y = background_point[1] + corresp_map_pos[1] * map_scale rooms = world_rooms.objects.filter(location=area) # If the background is empty, calculate the map size. if not area.background: min_x = 0 max_x = 0 min_y = 0 max_y = 0 if rooms: position = ast.literal_eval(rooms[0].position) min_x = position[0] max_x = position[0] min_y = position[1] max_y = position[1] for room in rooms: position = room.position if position: position = ast.literal_eval(position) x = position[0] y = position[1] if x > max_x: max_x = x if y > max_y: max_y = y if x < min_x: min_x = x if y < min_y: min_y = y # set the area's size area.width = (max_x - min_x) * map_scale + room_size * 2 area.height = (max_y - min_y) * map_scale + room_size * 2 area.save() # calculate room's position shift_x = shift_x - min_x * map_scale + room_size shift_y = shift_y + max_y * map_scale + room_size for room in rooms: position = room.position if position: position = ast.literal_eval(position) x = position[0] y = position[1] x = int(x * map_scale + shift_x) y = int(-y * map_scale + shift_y) room.position = "(%s,%s)" % (x, y) room.save()
def upgrade_game(self, game_dir, game_template, muddery_lib): """ Upgrade a game. Args: game_dir: (string) the game dir to be upgraded. game_template: (string) the game template used to upgrade the game dir. muddery_lib: (string) muddery's dir """ print("Upgrading game 0.2.0-0.2.2 %s." % game_dir) print(""" We are very sorry that your game is too old to upgrade. If you want to upgrade your game nevertheless, please contact the author.""") raise MudderyError("Can not upgrade.") # comment out client_settings in models file_path = os.path.join(game_dir, "worlddata", "models.py") utils.comment_out_class(file_path, "client_settings") # add world_area to models utils.file_append(file_path, [ "\n", "class world_areas(model_base.world_areas):\n", " pass\n", "\n" ]) # add character_attributes_info to models utils.file_append(file_path, [ "\n", "class character_attributes_info(model_base.character_attributes_info):\n", " pass\n", "\n" ]) # add equipment_attributes_info to models utils.file_append(file_path, [ "\n", "class equipment_attributes_info(model_base.equipment_attributes_info):\n", " pass\n", "\n" ]) # add food_attributes_info to models utils.file_append(file_path, [ "\n", "class food_attributes_info(model_base.food_attributes_info):\n", " pass\n", "\n" ]) # add condition_desc to models utils.file_append(file_path, [ "\n", "class condition_desc(model_base.condition_desc):\n", " pass\n", "\n" ]) # add skill_types to models utils.file_append(file_path, [ "\n", "class skill_types(model_base.skill_types):\n", " pass\n", "\n" ]) # add honours to models utils.file_append( file_path, ["\n", "class honours(model_base.honours):\n", " pass\n", "\n"]) # comment out ClientSettingsForm in forms file_path = os.path.join(game_dir, "worlddata", "forms.py") utils.comment_out_class(file_path, "ClientSettingsForm") utils.comment_out_lines(file_path, ["Manager.init_data()"]) # add world_area to forms utils.file_append(file_path, [ "\n", "class WorldAreasForm(forms_base.WorldAreasForm):\n", " pass\n", "\n" ]) # add character_attributes_info to forms utils.file_append(file_path, [ "\n", "class CharacterAttributesForm(forms_base.CharacterAttributesForm):\n", " pass\n", "\n" ]) # add equipment_attributes_info to forms utils.file_append(file_path, [ "\n", "class EquipmentAttributesForm(forms_base.EquipmentAttributesForm):\n", " pass\n", "\n" ]) # add food_attributes_info to forms utils.file_append(file_path, [ "\n", "class FoodAttributesForm(forms_base.FoodAttributesForm):\n", " pass\n", "\n" ]) # add condition_desc to forms utils.file_append(file_path, [ "\n", "class ConditionDescForm(forms_base.ConditionDescForm):\n", " pass\n", "\n" ]) # add skill_types to forms utils.file_append(file_path, [ "\n", "class SkillTypesForm(forms_base.SkillTypesForm):\n", " pass\n", "\n" ]) # add init method utils.file_append(file_path, ["\n", "Manager.init_data()\n", "\n"]) # comment out ClientSettingsAdmin in admin file_path = os.path.join(game_dir, "worlddata", "admin.py") utils.comment_out_class(file_path, "ClientSettingsAdmin") utils.comment_out_lines( file_path, "admin.site.register(client_settings, ClientSettingsAdmin)") # update web folder shutil.rmtree(os.path.join(game_dir, "web")) default_template_dir = os.path.join(muddery_lib, "game_template") # update web folder utils.copy_path(default_template_dir, game_dir, "web") # update game editor utils.copy_path(default_template_dir, game_dir, os.path.join("worlddata", "editor")) if game_template: game_template_dir = os.path.join(configs.MUDDERY_TEMPLATE, game_template) # update AI if game_template == "example_cn": utils.copy_path(game_template_dir, game_dir, "ai") # update settings file file_path = os.path.join(game_dir, "server", "conf", "settings.py") utils.file_append(file_path, [ "\n", "AI_CHOOSE_SKILL = 'ai.choose_skill.ChooseSkill'\n", "\n" ]) # update web folder utils.copy_path(game_template_dir, game_dir, "web") # update statements utils.copy_path(game_template_dir, game_dir, "statements") # update game editor utils.copy_path(game_template_dir, game_dir, os.path.join("worlddata", "editor")) # template data utils.copy_path(game_template_dir, game_dir, os.path.join("worlddata", "data")) os.chdir(game_dir) init_game_directory(game_dir, check_db=False) # make new migrations django_args = ["makemigrations"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) # load data system_data_path = os.path.join(muddery_lib, "worlddata", "data") from muddery.worlddata.data_sets import DATA_SETS # load system data for data_handlers in DATA_SETS.system_data: try: data_handlers.import_from_path(system_data_path, system_data=True) except Exception, e: err_message = "Cannot import system game data. %s" % e print(err_message)
def main(): """ Run the muddery main program. """ # set up argument parser parser = ArgumentParser(description=configs.CMDLINE_HELP, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('--gamedir', nargs=1, action='store', dest='altgamedir', metavar="<path>", help="location of gamedir (default: current location)") parser.add_argument( '--init', nargs='+', action='store', dest="init", metavar="<gamename> [template name]", help= "creates a new gamedir 'name' at current location (from optional template)." ) parser.add_argument( '--log', '-l', action='store_true', dest='tail_log', default=False, help="tail the portal and server logfiles and print to stdout") parser.add_argument( '--list', nargs='+', action='store', dest='listsetting', metavar="all|<key>", help=("list settings, use 'all' to list all available keys")) parser.add_argument( '--settings', nargs=1, action='store', dest='altsettings', default=None, metavar="<path>", help=("start evennia with alternative settings file from\n" " gamedir/server/conf/. (default is settings.py)")) parser.add_argument( '--initsettings', action='store_true', dest="initsettings", default=False, help= "create a new, empty settings file as\n gamedir/server/conf/settings.py" ) parser.add_argument( '--profiler', action='store_true', dest='profiler', default=False, help="start given server component under the Python profiler") parser.add_argument( '--dummyrunner', nargs=1, action='store', dest='dummyrunner', metavar="<N>", help="test a server by connecting <N> dummy accounts to it") parser.add_argument('-v', '--version', action='store_true', dest='show_version', default=False, help="show version info") parser.add_argument( '--upgrade', nargs='?', const='', dest='upgrade', metavar="[template]", help="Upgrade a game directory 'game_name' to the latest version.") parser.add_argument('--loaddata', action='store_true', dest='loaddata', default=False, help="Load local data from the worlddata folder.") parser.add_argument("operation", nargs='?', default="noop", help=configs.ARG_OPTIONS) parser.epilog = ( "Common Django-admin commands are shell, dbshell, test and migrate.\n" "See the Django documentation for more management commands.") args, unknown_args = parser.parse_known_args() # handle arguments option = args.operation # make sure we have everything evennia_launcher.check_main_evennia_dependencies() if not args: # show help pane print(configs.CMDLINE_HELP) sys.exit() elif args.init: # initialization of game directory game_name = args.init[0] template = None if len(args.init) > 1: template = args.init[1] gamedir = os.path.abspath(os.path.join(configs.CURRENT_DIR, game_name)) utils.create_game_directory(gamedir, template) os.chdir(gamedir) evennia_launcher.GAMEDIR = gamedir evennia_launcher.init_game_directory(gamedir, check_db=False) # make migrations try: django_args = ["makemigrations", "worlddata"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError, exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) # migrate the database try: django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate", "worlddata"] django_kwargs = {"database": "worlddata"} django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError, exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs))
def main(): """ Run the muddery main program. """ # set up argument parser parser = ArgumentParser(description=configs.CMDLINE_HELP, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('--gamedir', nargs=1, action='store', dest='altgamedir', metavar="<path>", help="location of gamedir (default: current location)") parser.add_argument( '--init', nargs='+', action='store', dest="init", metavar="<gamename> [template name]", help= "creates a new gamedir 'name' at current location (from optional template)." ) parser.add_argument( '--log', '-l', action='store_true', dest='tail_log', default=False, help="tail the portal and server logfiles and print to stdout") parser.add_argument( '--list', nargs='+', action='store', dest='listsetting', metavar="all|<key>", help=("list settings, use 'all' to list all available keys")) parser.add_argument( '--settings', nargs=1, action='store', dest='altsettings', default=None, metavar="<path>", help=("start evennia with alternative settings file from\n" " gamedir/server/conf/. (default is settings.py)")) parser.add_argument( '--initsettings', action='store_true', dest="initsettings", default=False, help= "create a new, empty settings file as\n gamedir/server/conf/settings.py" ) parser.add_argument( '--profiler', action='store_true', dest='profiler', default=False, help="start given server component under the Python profiler") parser.add_argument( '--dummyrunner', nargs=1, action='store', dest='dummyrunner', metavar="<N>", help="test a server by connecting <N> dummy accounts to it") parser.add_argument('-v', '--version', action='store_true', dest='show_version', default=False, help="show version info") parser.add_argument( '--upgrade', nargs='?', const='', dest='upgrade', metavar="[template]", help="Upgrade a game directory 'game_name' to the latest version.") parser.add_argument('--loaddata', action='store_true', dest='loaddata', default=False, help="Load local data from the worlddata folder.") parser.add_argument("operation", nargs='?', default="noop", help=configs.ARG_OPTIONS) parser.epilog = ( "Common Django-admin commands are shell, dbshell, test and migrate.\n" "See the Django documentation for more management commands.") args, unknown_args = parser.parse_known_args() # handle arguments option = args.operation # make sure we have everything evennia_launcher.check_main_evennia_dependencies() if not args: # show help pane print(configs.CMDLINE_HELP) sys.exit() elif args.init: # initialization of game directory game_name = args.init[0] template = None if len(args.init) > 1: template = args.init[1] gamedir = os.path.abspath(os.path.join(configs.CURRENT_DIR, game_name)) utils.create_game_directory(gamedir, template) os.chdir(gamedir) evennia_launcher.GAMEDIR = gamedir evennia_launcher.init_game_directory(gamedir, check_db=False) # make migrations try: django_args = ["makemigrations", "gamedata"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) try: django_args = ["makemigrations", "worlddata"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) # migrate the database try: django_args = ["migrate"] django_kwargs = {} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate", "gamedata"] django_kwargs = {"database": "gamedata"} django.core.management.call_command(*django_args, **django_kwargs) django_args = ["migrate", "worlddata"] django_kwargs = {"database": "worlddata"} django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) # import worlddata try: print("Importing local data.") import_local_data() except Exception as e: print("Import local data error: %s" % e) print( configs.CREATED_NEW_GAMEDIR.format(gamedir=args.init[0], settings_path=os.path.join( args.init[0], configs.SETTINGS_PATH))) sys.exit() elif args.upgrade is not None: utils.check_gamedir(configs.CURRENT_DIR) try: from muddery.server.upgrader.upgrade_handler import UPGRADE_HANDLER template = None if args.upgrade: template = args.upgrade gamedir = os.path.abspath(configs.CURRENT_DIR) UPGRADE_HANDLER.upgrade_game(gamedir, template, configs.MUDDERY_LIB) except Exception as e: print("Upgrade failed: %s" % e) sys.exit() elif args.loaddata: print("Importing local data.") gamedir = os.path.abspath(configs.CURRENT_DIR) os.chdir(gamedir) evennia_launcher.init_game_directory(gamedir, check_db=False) # make migrations django_args = ["makemigrations", "worlddata"] django_kwargs = {} try: django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) # migrate the database django_args = ["migrate"] django_kwargs = {} try: django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) django_args = ["migrate", "worlddata"] django_kwargs = {"database": "worlddata"} try: django.core.management.call_command(*django_args, **django_kwargs) except django.core.management.base.CommandError as exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) # load local data try: import_local_data() print("Import local data success.") except Exception as e: print("Import local data error: %s" % e) sys.exit() if args.show_version: # show the version info print(utils.show_version_info(option == "help")) sys.exit() if args.altsettings: evennia_launcher.main() if option != "noop": # check current game's version try: utils.check_gamedir(configs.CURRENT_DIR) evennia_launcher.set_gamedir(configs.CURRENT_DIR) from muddery.server.upgrader.upgrade_handler import UPGRADE_HANDLER game_ver, game_template = utils.get_game_config( configs.CURRENT_DIR) if UPGRADE_HANDLER.can_upgrade(game_ver): ver_str = ".".join([str(v) for v in game_ver]) print(configs.NEED_UPGRADE.format(version=ver_str)) return except Exception as e: traceback.print_exc() print("Check upgrade error: %s" % e) return # pass-through to evennia evennia_launcher.main() if option == "start": # Collect static files. django_args = ["collectstatic"] django_kwargs = {"verbosity": 0, "interactive": False} try: django.core.management.call_command(*django_args, **django_kwargs) print("Static file collected.") except django.core.management.base.CommandError as exc: print( configs.ERROR_INPUT.format(traceback=exc, args=django_args, kwargs=django_kwargs)) print_info() else: # no input; print muddery info print(configs.ABOUT_INFO)