def _stats_get_items_load(self, image):
        ITEM_GROUP.item_class = BonusItem
        ITEM_GROUP.similarity = 0.85
        ITEM_GROUP.amount_area = (35, 51, 63, 63)
        origin = area_offset(CAMPAIGN_BONUS.button, offset=(-7, 34))[:2]
        grids = ButtonGrid(origin=origin, button_shape=(64, 64), grid_shape=(7, 2), delta=(72 + 2 / 3, 75))

        reward_bottom = AUTO_SEARCH_MENU_EXIT.button[1]
        grids.buttons = [button for button in grids.buttons if button.area[3] < reward_bottom]
        ITEM_GROUP.grids = grids
예제 #2
0
    def _guild_operations_get_dispatch(self):
        """
        Get the button to switch available dispatch
        In previous version, this function detects the red dot on the switch.
        But the red dot may not shows for unknown reason sometimes, so we detect the switch itself.

        Returns:
            Button: Button to switch available dispatch. None if already reach the most right fleet.

        Pages:
            in: page_guild, guild operation, operation dispatch preparation (GUILD_DISPATCH_RECOMMEND)
        """
        # Fleet switch, for 4 situation
        #          | 1 |
        #       | 1 | | 2 |
        #    | 1 | | 2 | | 3 |
        # | 1 | | 2 | | 3 | | 4 |
        #   0  1  2  3  4  5  6   buttons in switch_grid
        switch_grid = ButtonGrid(origin=(573.5, 381),
                                 delta=(20.5, 0),
                                 button_shape=(11, 24),
                                 grid_shape=(7, 1))
        # Color of inactive fleet switch
        color_active = (74, 117, 222)
        # Color of current fleet
        color_inactive = (33, 48, 66)

        text = []
        index = 0
        button = None
        for switch in switch_grid.buttons():
            if self.image_color_count(switch,
                                      color=color_inactive,
                                      threshold=235,
                                      count=30):
                index += 1
                text.append(f'| {index} |')
                button = switch
            elif self.image_color_count(switch,
                                        color=color_active,
                                        threshold=235,
                                        count=30):
                index += 1
                text.append(f'[ {index} ]')
                button = switch

        # log example: | 1 | | 2 | [ 3 ]
        text = ' '.join(text)
        logger.attr('Dispatch_fleet', text)
        if text.endswith(']'):
            logger.info('Already at the most right fleet')
            return None
        else:
            return button
예제 #3
0
MASK_DORM = Mask(file='./assets/mask/MASK_DORM.png')
DORM_CAMERA_SWIPE = (300, 250)
DORM_CAMERA_RANDOM = (-20, -20, 20, 20)
RECORD = ('RewardRecord', 'dorm')
FOOD = ButtonGrid(origin=(298, 375),
                  delta=(156, 0),
                  button_shape=(112, 66),
                  grid_shape=(6, 1),
                  name='FOOD')
FOOD_AMOUNT = ButtonGrid(origin=(343, 411),
                         delta=(156, 0),
                         button_shape=(70, 33),
                         grid_shape=(6, 1),
                         name='FOOD_AMOUNT')
OCR_FOOD = Digit(FOOD_AMOUNT.buttons(),
                 letter=(255, 255, 255),
                 threshold=128,
                 name='OCR_DORM_FOOD')
OCR_FILL = DigitCounter(OCR_DORM_FILL,
                        letter=(255, 247, 247),
                        threshold=128,
                        name='OCR_DORM_FILL')


class Food:
    def __init__(self, feed, amount):
        self.feed = feed
        self.amount = amount