Exemplo n.º 1
0
import numpy as np
from datetime import datetime, timedelta

from module.base.timer import Timer
from module.base.utils import rgb2gray
from module.logger import logger
from module.ocr.ocr import Duration
from module.research.assets import *
from module.research.project import (RESEARCH_ENTRANCE, ResearchSelector,
                                     get_research_finished)
from module.research.rqueue import ResearchQueue
from module.ui.page import *

OCR_DURATION = Duration(RESEARCH_LAB_DURATION_REMAIN,
                        letter=(255, 255, 255),
                        threshold=64,
                        name='RESEARCH_LAB_DURATION_REMAIN')


class RewardResearch(ResearchSelector, ResearchQueue):
    _research_project_offset = 0
    _research_finished_index = 2
    research_project_started = None  # ResearchProject
    enforce = False
    end_time = None

    def research_has_finished(self):
        """
        Finished research should be auto-focused to the center, but sometimes didn't, due to an unknown game bug.
        This method will handle that.
        Returns:
Exemplo n.º 2
0
from datetime import datetime

from module.base.button import ButtonGrid
from module.base.decorator import cached_property, Config
from module.logger import logger
from module.ocr.ocr import Duration
from module.research.assets import *
from module.research.ui import ResearchUI

OCR_QUEUE_REMAIN = Duration(QUEUE_REMAIN,
                            letter=(255, 255, 255),
                            threshold=128,
                            name='OCR_QUEUE_REMAIN')


class ResearchQueue(ResearchUI):
    def research_queue_add(self, skip_first_screenshot=True):
        """
        Pages:
            in: RESEARCH_QUEUE_ADD (is_in_research, DETAIL_NEXT)
            out: is_in_research and stabled
        """
        logger.hr('Research queue add')
        # POPUP_CONFIRM has just been clicked in research_project_start()
        self.popup_interval_clear()
        self.interval_clear([RESEARCH_QUEUE_ADD])
        while 1:
            if skip_first_screenshot:
                skip_first_screenshot = False
            else:
                self.device.screenshot()