Example #1
0
    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)
Example #2
0
    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)
Example #3
0
    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)
Example #4
0
    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)
Example #5
0
    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()
Example #6
0
    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)
Example #7
0
    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)
Example #8
0
    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()
Example #9
0
    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)