コード例 #1
0
    def start(self):
        key = self.raw_parameters[0]
        replace = []
        avatar = None
        for param in self.raw_parameters[1:]:
            if "=" in param:
                replace.append(param)
            else:
                avatar = get_avatar(self.session, param)

        # If text is "${{end}}, then close the current dialog
        if key == "${{end}}":
            return

        self.stop()

        pages = process_translate_text(
            self.session,
            key,
            replace,
        )

        dialog = self.session.client.get_state_by_name("DialogState")
        if dialog:
            dialog.text_queue += pages
        else:
            self.open_dialog(pages, avatar)
コード例 #2
0
    def start(self):
        npc_slug, breeding_mother, breeding_father = self.parameters
        world = self.session.client.get_state_by_name("WorldState")
        if not world:
            return False

        npc_slug = npc_slug.replace("player", "npc_red")
        trainer = world.get_entity(npc_slug)
        if trainer is None:
            logger.error(
                "Could not find NPC corresponding to slug {}".format(npc_slug))
            return False

        mother_id = uuid.UUID(trainer.game_variables[breeding_mother])
        father_id = uuid.UUID(trainer.game_variables[breeding_father])

        mother = trainer.find_monster_by_id(mother_id)
        if mother is None:
            logger.debug("Mother not found in party, searching storage boxes.")
            mother = trainer.find_monster_in_storage(mother_id)

        father = trainer.find_monster_by_id(father_id)
        if father is None:
            logger.debug("Father not found in party, searching storage boxes.")
            father = trainer.find_monster_in_storage(father_id)

        if mother is None:
            logger.error(
                "Could not find (mother) monster with instance id {}".format(
                    mother_id))
            return False
        if father is None:
            logger.error(
                "Could not find (father) monster with instance id {}".format(
                    father_id))
            return False

        new_mon = mother.spawn(father)
        trainer.add_monster(new_mon)

        replace = ["monster_name={}".format(new_mon.name)]
        avatar = get_avatar(self.session, new_mon.slug)

        self.open_dialog(
            process_translate_text(
                self.session,
                "got_new_tuxemon",
                replace,
            ), avatar)
コード例 #3
0
    def start(self):
        key = self.raw_parameters[0]
        replace = []
        avatar = None
        for param in self.raw_parameters[1:]:
            if "=" in param:
                replace.append(param)
            else:
                avatar = get_avatar(self.session, param)

        self.open_dialog(process_translate_text(
            self.session,
            key,
            replace,
        ), avatar)
コード例 #4
0
    def start(self):
        # hack to allow unescaped commas in the dialog string
        text = ', '.join(self.raw_parameters)
        text = replace_text(self.session, text)

        # If text is "${{end}}, then close the current dialog
        if not text == "${{end}}":
            self.stop()

            # is a dialog already open?
            dialog = self.session.client.get_state_name("DialogState")

            if dialog:
                # yes, so just add text to it
                dialog.text_queue.append(text)
            else:
                # no, so create new dialog with this line
                avatar = get_avatar(self.session, self.parameters.avatar)
                self.open_dialog(text, avatar)
コード例 #5
0
 def start(self):
     text = replace_text(self.session, self.parameters.text)
     avatar = get_avatar(self.session, self.parameters.avatar)
     self.open_dialog(text, avatar)