Esempio n. 1
0
from module.base.timer import Timer
from module.base.utils import rgb2gray
from module.combat.assets import GET_ITEMS_1, GET_ITEMS_2
from module.exception import ScriptError
from module.logger import logger
from module.os.globe_operation import GlobeOperation
from module.os.globe_zone import ZoneManager
from module.os_handler.assets import *
from module.ui.scroll import Scroll

SCROLL_STORAGE = Scroll(STORATE_SCROLL, color=(247, 211, 66))


class StorageHandler(GlobeOperation, ZoneManager):
    def storage_enter(self):
        """
        Pages:
            in: is_in_map, STORAGE_ENTER
            out: STORAGE_CHECK
        """
        self.ui_click(STORAGE_ENTER,
                      check_button=STORAGE_CHECK,
                      offset=(200, 5),
                      skip_first_screenshot=True)
        self.handle_info_bar()

    def storage_quit(self):
        """
        Pages:
            in: STORAGE_CHECK
            out: is_in_map
Esempio n. 2
0
    'extra_book': ['小型船団護衛', '中型船団護衛', '大型船団護衛'],
    'urgent_drill': ['敵偵察部隊迎撃', '敵主力艦隊撃破', '敵精鋭部隊撃破', '輸送部隊護衛'],
    'urgent_part':
    ['近海掃海任務', '近海航行展示', '離島火力支援', '離島兵員輸送', '外敵生態調査', '兵站航路確保'],
    'urgent_book':
    ['離島物資輸送', '近海パトロール', '離島漸減支援', '外敵動静哨戒', '前線部隊支援', '外敵中枢偵察'],
    'urgent_box': ['装備輸送', '物資交換', '装備試験'],
    'urgent_cube': ['船団救出', '敵襲'],
    'urgent_gem': ['要人護衛', '休暇護衛'],
    'urgent_ship': ['小型観艦式', '連合艦隊観艦式', '多国連合観艦式'],
}
COMMISSION_SWITCH = Switch('Commission_switch', is_selector=True)
COMMISSION_SWITCH.add_status('daily', COMMISSION_DAILY)
COMMISSION_SWITCH.add_status('urgent', COMMISSION_URGENT)
COMMISSION_SCROLL = Scroll(COMMISSION_SCROLL_AREA,
                           color=(247, 211, 66),
                           name='COMMISSION_SCROLL')


class Commission:
    button: Button
    name: str
    genre: str
    status: str
    duration: timedelta
    expire: timedelta

    def __init__(self, image, y, config):
        self.config = config
        self.y = y
        self.stack_y = y
from module.logger import logger
from module.ui.assets import WAR_ARCHIVES_CHECK
from module.ui.page import page_archives
from module.ui.scroll import Scroll
from module.ui.switch import Switch
from module.war_archives.assets import (WAR_ARCHIVES_CAMPAIGN_CHECK,
                                        WAR_ARCHIVES_EX_ON,
                                        WAR_ARCHIVES_SCROLL,
                                        WAR_ARCHIVES_SP_ON)
from module.war_archives.dictionary import dic_archives_template

WAR_ARCHIVES_SWITCH = Switch('War_Archives_switch', is_selector=True)
WAR_ARCHIVES_SWITCH.add_status('ex', WAR_ARCHIVES_EX_ON)
WAR_ARCHIVES_SWITCH.add_status('sp', WAR_ARCHIVES_SP_ON)
WAR_ARCHIVES_SCROLL = Scroll(WAR_ARCHIVES_SCROLL,
                             color=(247, 211, 66),
                             name='WAR_ARCHIVES_SCROLL')


class CampaignBase(CampaignBase_):
    # Helper variable to keep track of whether is the first runthrough
    first_run = True

    def _get_archives_entrance(self, name):
        """
        Create entrance button to target archive campaign
        using a template acquired by event folder name

        Args:
            name(str): event folder name
        """
Esempio n. 4
0
from datetime import datetime

import module.config.server as server
from module.base.timer import Timer
from module.combat.combat import Combat
from module.exception import GameTooManyClickError, ScriptError
from module.handler.assets import *
from module.logger import logger
from module.map.assets import *
from module.ui.assets import *
from module.ui.scroll import Scroll
from module.ui.ui import MAIN_CHECK

USER_AGREEMENT_SCROLL = Scroll(USER_AGREEMENT_SCROLL, color=(182, 189, 202), name='USER_AGREEMENT_SCROLL')


class LoginHandler(Combat):
    def _handle_app_login(self):
        """
        Pages:
            in: Any page
            out: page_main
        """
        logger.hr('App login')

        confirm_timer = Timer(1.5, count=4).start()
        login_success = False
        while 1:
            self.device.screenshot()

            if self.handle_get_items(save_get_items=False):
Esempio n. 5
0
from module.equipment.equipment import Equipment
from module.logger import logger
from module.ui.scroll import Scroll

EQUIP_INFO_BAR = ButtonGrid(origin=(723, 111),
                            delta=(94, 0),
                            button_shape=(76, 76),
                            grid_shape=(5, 1),
                            name="EQUIP_INFO_BAR")
EQUIPMENT_GRID = ButtonGrid(origin=(725, 155),
                            delta=(95, 0),
                            button_shape=(31, 31),
                            grid_shape=(5, 1),
                            name='EQUIPMENT_GRID')
EQUIPMENT_SCROLL = Scroll(EQUIP_SCROLL,
                          color=(247, 211, 66),
                          name='EQUIP_SCROLL')
SIM_VALUE = 0.90


class EquipmentChange(Equipment):
    equip_list = {}
    equipping_list = []

    def get_equiping_list(self, skip_first_screenshot=True):
        '''
        Pages:
            in: ship's details
        '''
        logger.info("Get equipping list")
        if skip_first_screenshot:
Esempio n. 6
0
 def _sos_scroll(self):
     return Scroll(SOS_SCROLL_AREA, color=(164, 173, 189), name='SOS_SCROLL')
Esempio n. 7
0
 def _sos_scroll(self):
     return Scroll(SOS_SCROLL_AREA, color=(247, 210, 66), name='SOS_SCROLL')
Esempio n. 8
0
                          'oath_skin', 'not_available', 'not_available'
                      ]]

CARD_GRIDS = ButtonGrid(origin=(93, 76),
                        delta=(164 + 2 / 3, 227),
                        button_shape=(138, 204),
                        grid_shape=(7, 2),
                        name='CARD')
CARD_RARITY_GRIDS = CARD_GRIDS.crop(area=(0, 0, 138, 5), name='RARITY')
CARD_LEVEL_GRIDS = CARD_GRIDS.crop(area=(77, 5, 138, 27), name='LEVEL')
CARD_EMOTION_GRIDS = CARD_GRIDS.crop(area=(23, 29, 48, 52), name='EMOTION')
CARD_BOTTOM_GRIDS = CARD_GRIDS.move(vector=(0, 94), name='CARD')
CARD_BOTTOM_LEVEL_GRIDS = CARD_LEVEL_GRIDS.move(vector=(0, 94), name='LEVEL')
CARD_BOTTOM_EMOTION_GRIDS = CARD_EMOTION_GRIDS.move(vector=(0, 94),
                                                    name='EMOTION')
DOCK_SCROLL = Scroll(DOCK_SCROLL, color=(247, 211, 66), name='DOCK_SCROLL')

OCR_DOCK_SELECTED = DigitCounter(DOCK_SELECTED,
                                 threshold=64,
                                 name='OCR_DOCK_SELECTED')


class Dock(Equipment):
    def handle_dock_cards_loading(self):
        # Poor implementation.
        self.device.sleep((1, 1.5))
        self.device.screenshot()

    def dock_favourite_set(self, enable=False):
        if DOCK_FAVOURITE.set('on' if enable else 'off', main=self):
            self.handle_dock_cards_loading()
Esempio n. 9
0
from module.base.button import ButtonGrid
from module.base.decorator import cached_property
from module.base.resource import del_cached_property
from module.base.timer import Timer
from module.logger import logger
from module.map_detection.utils import Points
from module.ocr.ocr import Digit, Ocr
from module.shop.assets import *
from module.shop.base import ShopItemGrid
from module.shop.clerk import ShopClerk
from module.ui.scroll import Scroll

OCR_SHOP_MEDAL = Digit(SHOP_MEDAL,
                       letter=(239, 239, 239),
                       name='OCR_SHOP_MEDAL')
MEDAL_SHOP_SCROLL = Scroll(MEDAL_SHOP_SCROLL_AREA, color=(247, 211, 66))


class DigitPatch(Digit):
    def after_process(self, result):
        result = Ocr.after_process(self, result)
        # '100' detected as '00' on retrofit blueprint
        if result == '00':
            result = '100'
        return Digit.after_process(self, result.split())


PRICE_OCR = DigitPatch([],
                       letter=(255, 223, 57),
                       threshold=32,
                       name='Price_ocr')