Example #1
0
    def create(cls, uuid, level, utg_name, description, abilities, terrains, type, archetype=game_relations.ARCHETYPE.NEUTRAL, editor=None, state=MOB_RECORD_STATE.DISABLED, global_action_probability=0):

        from the_tale.game.mobs.storage import mobs_storage

        model = MobRecord.objects.create(uuid=uuid,
                                         level=level,
                                         name=utg_name.normal_form(),
                                         type=type,
                                         archetype=archetype,
                                         data=s11n.to_json({'name': utg_name.serialize(),
                                                            'global_action_probability': global_action_probability}),
                                         description=description,
                                         abilities=s11n.to_json(list(abilities)),
                                         terrains=s11n.to_json([terrain.value for terrain in terrains]),
                                         state=state,
                                         editor=editor._model if editor else None)

        prototype = cls(model)

        linguistics_logic.sync_restriction(group=linguistics_relations.TEMPLATE_RESTRICTION_GROUP.MOB,
                                           external_id=prototype.id,
                                           name=prototype.name)

        mobs_storage.add_item(prototype.id, prototype)
        mobs_storage.update_version()

        return prototype
Example #2
0
    def create(
            cls,
            uuid,
            level,
            utg_name,
            description,
            abilities,
            terrains,
            type,
            archetype=game_relations.ARCHETYPE.NEUTRAL,
            editor=None,
            state=relations.MOB_RECORD_STATE.DISABLED,
            global_action_probability=0,
            communication_verbal=game_relations.COMMUNICATION_VERBAL.CAN_NOT,
            communication_gestures=game_relations.COMMUNICATION_GESTURES.
        CAN_NOT,
            communication_telepathic=game_relations.COMMUNICATION_TELEPATHIC.
        CAN_NOT,
            intellect_level=game_relations.INTELLECT_LEVEL.NONE,
            is_mercenary=True,
            is_eatable=True):

        from the_tale.game.mobs.storage import mobs_storage

        model = models.MobRecord.objects.create(
            uuid=uuid,
            level=level,
            name=utg_name.normal_form(),
            type=type,
            archetype=archetype,
            data=s11n.to_json({
                'name':
                utg_name.serialize(),
                'global_action_probability':
                global_action_probability
            }),
            description=description,
            abilities=s11n.to_json(list(abilities)),
            terrains=s11n.to_json([terrain.value for terrain in terrains]),
            state=state,
            editor=editor._model if editor else None,
            communication_verbal=communication_verbal,
            communication_gestures=communication_gestures,
            communication_telepathic=communication_telepathic,
            intellect_level=intellect_level,
            is_mercenary=is_mercenary,
            is_eatable=is_eatable)

        prototype = cls(model)

        linguistics_logic.sync_restriction(
            group=linguistics_relations.TEMPLATE_RESTRICTION_GROUP.MOB,
            external_id=prototype.id,
            name=prototype.name)

        mobs_storage.add_item(prototype.id, prototype)
        mobs_storage.update_version()

        return prototype
Example #3
0
    def create(cls,
               uuid,
               level,
               utg_name,
               description,
               abilities,
               terrains,
               type,
               archetype=game_relations.ARCHETYPE.NEUTRAL,
               editor=None,
               state=MOB_RECORD_STATE.DISABLED,
               global_action_probability=0):

        from the_tale.game.mobs.storage import mobs_storage

        model = MobRecord.objects.create(
            uuid=uuid,
            level=level,
            name=utg_name.normal_form(),
            type=type,
            archetype=archetype,
            data=s11n.to_json({
                'name':
                utg_name.serialize(),
                'global_action_probability':
                global_action_probability
            }),
            description=description,
            abilities=s11n.to_json(list(abilities)),
            terrains=s11n.to_json([terrain.value for terrain in terrains]),
            state=state,
            editor=editor._model if editor else None)

        prototype = cls(model)

        linguistics_logic.sync_restriction(
            group=linguistics_relations.TEMPLATE_RESTRICTION_GROUP.MOB,
            external_id=prototype.id,
            name=prototype.name)

        mobs_storage.add_item(prototype.id, prototype)
        mobs_storage.update_version()

        return prototype
Example #4
0
    def create(cls, uuid, level, utg_name, description, abilities, terrains, type,
               archetype=game_relations.ARCHETYPE.NEUTRAL,
               editor=None,
               state=relations.MOB_RECORD_STATE.DISABLED,
               global_action_probability=0,
               communication_verbal=game_relations.COMMUNICATION_VERBAL.CAN_NOT,
               communication_gestures=game_relations.COMMUNICATION_GESTURES.CAN_NOT,
               communication_telepathic=game_relations.COMMUNICATION_TELEPATHIC.CAN_NOT,
               intellect_level=game_relations.INTELLECT_LEVEL.NONE,
               is_mercenary=True,
               is_eatable=True):

        from the_tale.game.mobs.storage import mobs_storage

        model = models.MobRecord.objects.create(uuid=uuid,
                                                level=level,
                                                name=utg_name.normal_form(),
                                                type=type,
                                                archetype=archetype,
                                                data=s11n.to_json({'name': utg_name.serialize(),
                                                                   'global_action_probability': global_action_probability}),
                                                description=description,
                                                abilities=s11n.to_json(list(abilities)),
                                                terrains=s11n.to_json([terrain.value for terrain in terrains]),
                                                state=state,
                                                editor=editor._model if editor else None,
                                                communication_verbal=communication_verbal,
                                                communication_gestures=communication_gestures,
                                                communication_telepathic=communication_telepathic,
                                                intellect_level=intellect_level,
                                                is_mercenary=is_mercenary,
                                                is_eatable=is_eatable)

        prototype = cls(model)

        linguistics_logic.sync_restriction(group=linguistics_relations.TEMPLATE_RESTRICTION_GROUP.MOB,
                                           external_id=prototype.id,
                                           name=prototype.name)

        mobs_storage.add_item(prototype.id, prototype)
        mobs_storage.update_version()

        return prototype