コード例 #1
0
    def handle_mystery(self, button=None):
        """
        Args:
            button (optional): Button to click when get_items.
                Can be destination grid which makes the bot more like human.
        """
        if button is None or area_in_area(
                button.button, MYSTERY_ITEM.area, threshold=20):
            button = GET_ITEMS_1

        if self.appear(GET_ITEMS_1):
            logger.attr('Mystery', 'Get item')
            self._save_mystery_image()
            self.device.click(button)
            self.device.sleep(0.5)
            self.device.screenshot()
            self.handle_opened_strategy_bar()
            return 'get_item'

        if self.info_bar_count():
            if self._get_ammo_log_timer.reached() and self.appear(GET_AMMO):
                logger.attr('Mystery', 'Get ammo')
                self._get_ammo_log_timer.reset()
                self._save_mystery_image()
                return 'get_ammo'

        if self.config.MAP_MYSTERY_HAS_CARRIER:
            if self.is_in_map() and self.enemy_searching_appear():
                logger.attr('Mystery', 'Get carrier')
                self.carrier_count += 1
                self._save_mystery_image()
                self.handle_in_map_with_enemy_searching()
                return 'get_carrier'

        return False
コード例 #2
0
    def handle_mystery_items(self, button=None, drop=None):
        """
        Args:
            button: Button to click when get_items.
                Can be destination grid which makes the bot more like human.
            drop (DropImage):

        Returns:
            bool: If handled.
        """
        if button is None or area_in_area(
                button.button, MYSTERY_ITEM.area, threshold=20):
            button = MYSTERY_ITEM

        if self.appear(GET_ITEMS_1):
            logger.attr('Mystery', 'Get item')
            if drop:
                drop.add(self.device.image)
            self.device.click(button)
            self.device.sleep(0.5)
            self.device.screenshot()
            self.strategy_close()
            return True

        return False
コード例 #3
0
    def _gen(self):
        for x, vert in enumerate(zip(self.vertical[:-1], self.vertical[1:])):
            for y, hori in enumerate(zip(self.horizontal[:-1], self.horizontal[1:])):
                vert = Lines(np.vstack(vert), is_horizontal=False, config=self.config)
                hori = Lines(np.vstack(hori), is_horizontal=True, config=self.config)
                cross = hori.cross(vert)
                area = np.append(cross[0], cross[3])

                if area_in_area(area, self.config.DETECTING_AREA):
                    grid = Grid(location=(x, y), image=self.image, corner=cross.points, config=self.config)
                    yield grid