diff --git a/assets/cn/raid/RAID_REWARDS.png b/assets/cn/raid/RAID_REWARDS.png new file mode 100644 index 000000000..c4ec9c2cd Binary files /dev/null and b/assets/cn/raid/RAID_REWARDS.png differ diff --git a/assets/cn/shop/MEDAL_SHOP_SCROLL_AREA.png b/assets/cn/shop/MEDAL_SHOP_SCROLL_AREA.png index c1b24968c..1e5552c11 100644 Binary files a/assets/cn/shop/MEDAL_SHOP_SCROLL_AREA.png and b/assets/cn/shop/MEDAL_SHOP_SCROLL_AREA.png differ diff --git a/assets/cn/shop/SHOP_CORE.png b/assets/cn/shop/SHOP_CORE.png index 0bbf1e045..dddba37e3 100644 Binary files a/assets/cn/shop/SHOP_CORE.png and b/assets/cn/shop/SHOP_CORE.png differ diff --git a/assets/cn/shop/SHOP_GUILD_COINS.png b/assets/cn/shop/SHOP_GUILD_COINS.png index b017924b7..0ee194a1b 100644 Binary files a/assets/cn/shop/SHOP_GUILD_COINS.png and b/assets/cn/shop/SHOP_GUILD_COINS.png differ diff --git a/assets/cn/shop/SHOP_MEDAL.png b/assets/cn/shop/SHOP_MEDAL.png index e3cac2400..dddba37e3 100644 Binary files a/assets/cn/shop/SHOP_MEDAL.png and b/assets/cn/shop/SHOP_MEDAL.png differ diff --git a/assets/cn/shop/SHOP_MERIT.png b/assets/cn/shop/SHOP_MERIT.png index 75ce11eea..64a226efb 100644 Binary files a/assets/cn/shop/SHOP_MERIT.png and b/assets/cn/shop/SHOP_MERIT.png differ diff --git a/assets/cn/shop/SHOP_REFRESH.png b/assets/cn/shop/SHOP_REFRESH.png index b721cdf8a..237099873 100644 Binary files a/assets/cn/shop/SHOP_REFRESH.png and b/assets/cn/shop/SHOP_REFRESH.png differ diff --git a/assets/cn/ui/MUNITIONS_CHECK.png b/assets/cn/ui/MUNITIONS_CHECK.png index ba9cd87ce..fb88c728a 100644 Binary files a/assets/cn/ui/MUNITIONS_CHECK.png and b/assets/cn/ui/MUNITIONS_CHECK.png differ diff --git a/assets/cn/ui/SHOP_CHECK.png b/assets/cn/ui/SHOP_CHECK.png index 2a95a96c4..c7865ff10 100644 Binary files a/assets/cn/ui/SHOP_CHECK.png and b/assets/cn/ui/SHOP_CHECK.png differ diff --git a/assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png b/assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png index cf880c751..e59608a84 100644 Binary files a/assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png and b/assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png differ diff --git a/assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.png b/assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.png index 55319c2c3..7374cdd01 100644 Binary files a/assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.png and b/assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.png differ diff --git a/assets/en/raid/RAID_REWARDS.png b/assets/en/raid/RAID_REWARDS.png new file mode 100644 index 000000000..c4ec9c2cd Binary files /dev/null and b/assets/en/raid/RAID_REWARDS.png differ diff --git a/assets/en/shop/MEDAL_SHOP_SCROLL_AREA.png b/assets/en/shop/MEDAL_SHOP_SCROLL_AREA.png index c1b24968c..1e5552c11 100644 Binary files a/assets/en/shop/MEDAL_SHOP_SCROLL_AREA.png and b/assets/en/shop/MEDAL_SHOP_SCROLL_AREA.png differ diff --git a/assets/en/shop/SHOP_CORE.png b/assets/en/shop/SHOP_CORE.png index 0bbf1e045..dddba37e3 100644 Binary files a/assets/en/shop/SHOP_CORE.png and b/assets/en/shop/SHOP_CORE.png differ diff --git a/assets/en/shop/SHOP_GUILD_COINS.png b/assets/en/shop/SHOP_GUILD_COINS.png index b017924b7..0ee194a1b 100644 Binary files a/assets/en/shop/SHOP_GUILD_COINS.png and b/assets/en/shop/SHOP_GUILD_COINS.png differ diff --git a/assets/en/shop/SHOP_MEDAL.png b/assets/en/shop/SHOP_MEDAL.png index e3cac2400..dddba37e3 100644 Binary files a/assets/en/shop/SHOP_MEDAL.png and b/assets/en/shop/SHOP_MEDAL.png differ diff --git a/assets/en/shop/SHOP_MERIT.png b/assets/en/shop/SHOP_MERIT.png index 75ce11eea..64a226efb 100644 Binary files a/assets/en/shop/SHOP_MERIT.png and b/assets/en/shop/SHOP_MERIT.png differ diff --git a/assets/en/shop/SHOP_REFRESH.png b/assets/en/shop/SHOP_REFRESH.png index c7a407dc2..9c25e708a 100644 Binary files a/assets/en/shop/SHOP_REFRESH.png and b/assets/en/shop/SHOP_REFRESH.png differ diff --git a/assets/en/ui/MUNITIONS_CHECK.png b/assets/en/ui/MUNITIONS_CHECK.png index 5d1d16b08..43c04923c 100644 Binary files a/assets/en/ui/MUNITIONS_CHECK.png and b/assets/en/ui/MUNITIONS_CHECK.png differ diff --git a/assets/en/ui/SHOP_CHECK.png b/assets/en/ui/SHOP_CHECK.png index 6bf7ffa6a..0f69fc256 100644 Binary files a/assets/en/ui/SHOP_CHECK.png and b/assets/en/ui/SHOP_CHECK.png differ diff --git a/assets/en/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png b/assets/en/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png index 7e3092cea..e59608a84 100644 Binary files a/assets/en/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png and b/assets/en/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png differ diff --git a/assets/en/ui/SHOP_GOTO_SUPPLY_PACK.png b/assets/en/ui/SHOP_GOTO_SUPPLY_PACK.png index bdd19a19d..7374cdd01 100644 Binary files a/assets/en/ui/SHOP_GOTO_SUPPLY_PACK.png and b/assets/en/ui/SHOP_GOTO_SUPPLY_PACK.png differ diff --git a/assets/jp/raid/RAID_REWARDS.png b/assets/jp/raid/RAID_REWARDS.png new file mode 100644 index 000000000..c4ec9c2cd Binary files /dev/null and b/assets/jp/raid/RAID_REWARDS.png differ diff --git a/assets/jp/shop/MEDAL_SHOP_SCROLL_AREA.png b/assets/jp/shop/MEDAL_SHOP_SCROLL_AREA.png index c1b24968c..1e5552c11 100644 Binary files a/assets/jp/shop/MEDAL_SHOP_SCROLL_AREA.png and b/assets/jp/shop/MEDAL_SHOP_SCROLL_AREA.png differ diff --git a/assets/jp/shop/SHOP_CORE.png b/assets/jp/shop/SHOP_CORE.png index 0bbf1e045..dddba37e3 100644 Binary files a/assets/jp/shop/SHOP_CORE.png and b/assets/jp/shop/SHOP_CORE.png differ diff --git a/assets/jp/shop/SHOP_GUILD_COINS.png b/assets/jp/shop/SHOP_GUILD_COINS.png index 3c5bd82ac..0ee194a1b 100644 Binary files a/assets/jp/shop/SHOP_GUILD_COINS.png and b/assets/jp/shop/SHOP_GUILD_COINS.png differ diff --git a/assets/jp/shop/SHOP_MEDAL.png b/assets/jp/shop/SHOP_MEDAL.png index e3cac2400..dddba37e3 100644 Binary files a/assets/jp/shop/SHOP_MEDAL.png and b/assets/jp/shop/SHOP_MEDAL.png differ diff --git a/assets/jp/shop/SHOP_MERIT.png b/assets/jp/shop/SHOP_MERIT.png index 3b662cace..64a226efb 100644 Binary files a/assets/jp/shop/SHOP_MERIT.png and b/assets/jp/shop/SHOP_MERIT.png differ diff --git a/assets/jp/shop/SHOP_REFRESH.png b/assets/jp/shop/SHOP_REFRESH.png index fb6f90ee2..8f7521f48 100644 Binary files a/assets/jp/shop/SHOP_REFRESH.png and b/assets/jp/shop/SHOP_REFRESH.png differ diff --git a/assets/jp/ui/MUNITIONS_CHECK.png b/assets/jp/ui/MUNITIONS_CHECK.png index 0537f9cce..2cc46262e 100644 Binary files a/assets/jp/ui/MUNITIONS_CHECK.png and b/assets/jp/ui/MUNITIONS_CHECK.png differ diff --git a/assets/jp/ui/SHOP_CHECK.png b/assets/jp/ui/SHOP_CHECK.png index 775a40588..ab0d13bb8 100644 Binary files a/assets/jp/ui/SHOP_CHECK.png and b/assets/jp/ui/SHOP_CHECK.png differ diff --git a/assets/jp/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png b/assets/jp/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png index a49be2755..e59608a84 100644 Binary files a/assets/jp/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png and b/assets/jp/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png differ diff --git a/assets/jp/ui/SHOP_GOTO_SUPPLY_PACK.png b/assets/jp/ui/SHOP_GOTO_SUPPLY_PACK.png index 05b04b975..7374cdd01 100644 Binary files a/assets/jp/ui/SHOP_GOTO_SUPPLY_PACK.png and b/assets/jp/ui/SHOP_GOTO_SUPPLY_PACK.png differ diff --git a/assets/research_blueprint/flandre.png b/assets/research_blueprint/flandre.png new file mode 100644 index 000000000..15b43b888 Binary files /dev/null and b/assets/research_blueprint/flandre.png differ diff --git a/assets/research_blueprint/hindenburg.png b/assets/research_blueprint/hindenburg.png new file mode 100644 index 000000000..c40286b30 Binary files /dev/null and b/assets/research_blueprint/hindenburg.png differ diff --git a/assets/research_blueprint/kearsarge.png b/assets/research_blueprint/kearsarge.png new file mode 100644 index 000000000..696e9a15a Binary files /dev/null and b/assets/research_blueprint/kearsarge.png differ diff --git a/assets/research_blueprint/schultz.png b/assets/research_blueprint/schultz.png new file mode 100644 index 000000000..04c84abec Binary files /dev/null and b/assets/research_blueprint/schultz.png differ diff --git a/assets/research_blueprint/shimanto.png b/assets/research_blueprint/shimanto.png new file mode 100644 index 000000000..4310d6730 Binary files /dev/null and b/assets/research_blueprint/shimanto.png differ diff --git a/assets/shop/cost/Coins_2.png b/assets/shop/cost/Coins_2.png new file mode 100644 index 000000000..82bc3fa15 Binary files /dev/null and b/assets/shop/cost/Coins_2.png differ diff --git a/assets/shop/cost/Core_2.png b/assets/shop/cost/Core_2.png new file mode 100644 index 000000000..c80b41998 Binary files /dev/null and b/assets/shop/cost/Core_2.png differ diff --git a/assets/shop/cost/Gems_2.png b/assets/shop/cost/Gems_2.png new file mode 100644 index 000000000..cb3857bae Binary files /dev/null and b/assets/shop/cost/Gems_2.png differ diff --git a/assets/shop/cost/GuildCoins_2.png b/assets/shop/cost/GuildCoins_2.png new file mode 100644 index 000000000..3021236cb Binary files /dev/null and b/assets/shop/cost/GuildCoins_2.png differ diff --git a/assets/shop/cost/Medal_2.png b/assets/shop/cost/Medal_2.png new file mode 100644 index 000000000..c0d6d4667 Binary files /dev/null and b/assets/shop/cost/Medal_2.png differ diff --git a/assets/shop/cost/Merit_2.png b/assets/shop/cost/Merit_2.png new file mode 100644 index 000000000..cb1494780 Binary files /dev/null and b/assets/shop/cost/Merit_2.png differ diff --git a/assets/shop/merit/Akatsuki.png b/assets/shop/merit/Akatsuki.png new file mode 100644 index 000000000..3f1023510 Binary files /dev/null and b/assets/shop/merit/Akatsuki.png differ diff --git a/assets/shop/merit/EmileBertin.png b/assets/shop/merit/EmileBertin.png new file mode 100644 index 000000000..68e103c87 Binary files /dev/null and b/assets/shop/merit/EmileBertin.png differ diff --git a/assets/shop/merit/Glorious.png b/assets/shop/merit/Glorious.png new file mode 100644 index 000000000..239cae82e Binary files /dev/null and b/assets/shop/merit/Glorious.png differ diff --git a/assets/shop/merit/Haruna.png b/assets/shop/merit/Haruna.png new file mode 100644 index 000000000..8ac36e6f2 Binary files /dev/null and b/assets/shop/merit/Haruna.png differ diff --git a/assets/shop/merit/Icarus.png b/assets/shop/merit/Icarus.png new file mode 100644 index 000000000..43a918893 Binary files /dev/null and b/assets/shop/merit/Icarus.png differ diff --git a/assets/shop/merit/IllustriousMuse.png b/assets/shop/merit/IllustriousMuse.png new file mode 100644 index 000000000..ca960cffa Binary files /dev/null and b/assets/shop/merit/IllustriousMuse.png differ diff --git a/assets/shop/merit/Independence.png b/assets/shop/merit/Independence.png new file mode 100644 index 000000000..8f4a5121a Binary files /dev/null and b/assets/shop/merit/Independence.png differ diff --git a/assets/shop/merit/Kawakaze.png b/assets/shop/merit/Kawakaze.png new file mode 100644 index 000000000..1de8da53f Binary files /dev/null and b/assets/shop/merit/Kawakaze.png differ diff --git a/assets/shop/merit/Kongo.png b/assets/shop/merit/Kongo.png new file mode 100644 index 000000000..c821635eb Binary files /dev/null and b/assets/shop/merit/Kongo.png differ diff --git a/assets/shop/merit/LilSandy.png b/assets/shop/merit/LilSandy.png new file mode 100644 index 000000000..c6c7de1eb Binary files /dev/null and b/assets/shop/merit/LilSandy.png differ diff --git a/assets/shop/merit/Makinami.png b/assets/shop/merit/Makinami.png new file mode 100644 index 000000000..1f45bcc47 Binary files /dev/null and b/assets/shop/merit/Makinami.png differ diff --git a/assets/shop/merit/Mikuma.png b/assets/shop/merit/Mikuma.png new file mode 100644 index 000000000..bd3264510 Binary files /dev/null and b/assets/shop/merit/Mikuma.png differ diff --git a/assets/shop/merit/Musketeer.png b/assets/shop/merit/Musketeer.png new file mode 100644 index 000000000..50a2a467f Binary files /dev/null and b/assets/shop/merit/Musketeer.png differ diff --git a/assets/shop/merit/Mutsu.png b/assets/shop/merit/Mutsu.png new file mode 100644 index 000000000..09c238dc0 Binary files /dev/null and b/assets/shop/merit/Mutsu.png differ diff --git a/assets/shop/merit/RoonMuse.png b/assets/shop/merit/RoonMuse.png new file mode 100644 index 000000000..99425e9c8 Binary files /dev/null and b/assets/shop/merit/RoonMuse.png differ diff --git a/assets/shop/merit/WestVirginia.png b/assets/shop/merit/WestVirginia.png new file mode 100644 index 000000000..ce9e73234 Binary files /dev/null and b/assets/shop/merit/WestVirginia.png differ diff --git a/assets/tw/raid/RAID_REWARDS.png b/assets/tw/raid/RAID_REWARDS.png new file mode 100644 index 000000000..c4ec9c2cd Binary files /dev/null and b/assets/tw/raid/RAID_REWARDS.png differ diff --git a/assets/tw/shop/MEDAL_SHOP_SCROLL_AREA.png b/assets/tw/shop/MEDAL_SHOP_SCROLL_AREA.png index c1b24968c..1e5552c11 100644 Binary files a/assets/tw/shop/MEDAL_SHOP_SCROLL_AREA.png and b/assets/tw/shop/MEDAL_SHOP_SCROLL_AREA.png differ diff --git a/assets/tw/shop/SHOP_CORE.png b/assets/tw/shop/SHOP_CORE.png index 0bbf1e045..dddba37e3 100644 Binary files a/assets/tw/shop/SHOP_CORE.png and b/assets/tw/shop/SHOP_CORE.png differ diff --git a/assets/tw/shop/SHOP_GUILD_COINS.png b/assets/tw/shop/SHOP_GUILD_COINS.png index b017924b7..0ee194a1b 100644 Binary files a/assets/tw/shop/SHOP_GUILD_COINS.png and b/assets/tw/shop/SHOP_GUILD_COINS.png differ diff --git a/assets/tw/shop/SHOP_MEDAL.png b/assets/tw/shop/SHOP_MEDAL.png index e3cac2400..dddba37e3 100644 Binary files a/assets/tw/shop/SHOP_MEDAL.png and b/assets/tw/shop/SHOP_MEDAL.png differ diff --git a/assets/tw/shop/SHOP_MERIT.png b/assets/tw/shop/SHOP_MERIT.png index 75ce11eea..64a226efb 100644 Binary files a/assets/tw/shop/SHOP_MERIT.png and b/assets/tw/shop/SHOP_MERIT.png differ diff --git a/assets/tw/shop/SHOP_REFRESH.png b/assets/tw/shop/SHOP_REFRESH.png index 01665897e..eed1cdda7 100644 Binary files a/assets/tw/shop/SHOP_REFRESH.png and b/assets/tw/shop/SHOP_REFRESH.png differ diff --git a/assets/tw/ui/MUNITIONS_CHECK.png b/assets/tw/ui/MUNITIONS_CHECK.png index 834fb727d..e533eb863 100644 Binary files a/assets/tw/ui/MUNITIONS_CHECK.png and b/assets/tw/ui/MUNITIONS_CHECK.png differ diff --git a/assets/tw/ui/SHOP_CHECK.png b/assets/tw/ui/SHOP_CHECK.png index 256f2d6d1..c58c62b65 100644 Binary files a/assets/tw/ui/SHOP_CHECK.png and b/assets/tw/ui/SHOP_CHECK.png differ diff --git a/assets/tw/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png b/assets/tw/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png index 2e464ec9f..e59608a84 100644 Binary files a/assets/tw/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png and b/assets/tw/ui/SHOP_GOTO_SUPPLY_PACK.BUTTON.png differ diff --git a/assets/tw/ui/SHOP_GOTO_SUPPLY_PACK.png b/assets/tw/ui/SHOP_GOTO_SUPPLY_PACK.png new file mode 100644 index 000000000..7374cdd01 Binary files /dev/null and b/assets/tw/ui/SHOP_GOTO_SUPPLY_PACK.png differ diff --git a/campaign/Readme.md b/campaign/Readme.md index f8467664f..1e67106e9 100644 --- a/campaign/Readme.md +++ b/campaign/Readme.md @@ -148,4 +148,5 @@ To add a new event, add a new row in here, and run `python -m module.config.conf | 20230615 | event 20200603 cn | Counterattack Within the Fjord | - | - | - | 復刻峽灣間的反擊 | | 20230621 | event 20210527 cn | Mirror Involution Rerun | 复刻镜位螺旋 | Mirror Involution Rerun | 照らす螺旋の鏡海(復刻) | - | | 20230629 | event 20220428 cn | Rondo at Rainbow's End | - | - | - | 虹彩的終幕曲 | -| 20230629 | raid 20230629 | Reflections of the Oasis | 绿洲往事 | Reflections of the Oasis | 緑地伽話 | - | +| 20230629 | raid 20230629 | Reflections of the Oasis | 绿洲往事 | Reflections of the Oasis | 緑地伽話 | - | +| 20220818 | event 20220818 cn | Operation Convergence | - | - | 結像点作戦 | 遠匯點作戰 | diff --git a/campaign/campaign_main/campaign_9_1.py b/campaign/campaign_main/campaign_9_1.py index 0611c447f..f4b5ac198 100644 --- a/campaign/campaign_main/campaign_9_1.py +++ b/campaign/campaign_main/campaign_9_1.py @@ -44,9 +44,7 @@ step_on = SelectedGrids([F3, E4]) class Config: SUBMARINE = 0 - INTERNAL_LINES_HOUGHLINES_THRESHOLD = 40 - EDGE_LINES_HOUGHLINES_THRESHOLD = 40 - COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.5 + HOMO_STORAGE = ((9, 5), [(214.274, 100.482), (1300.358, 100.482), (79.666, 584.209), (1505.19, 584.209)]) MAP_ENSURE_EDGE_INSIGHT_CORNER = 'bottom' diff --git a/config/template.json b/config/template.json index 5a8cc27c6..d2a8b91c6 100644 --- a/config/template.json +++ b/config/template.json @@ -1312,7 +1312,7 @@ "UseCoin": "always_use", "UsePart": "always_use", "AllowDelay": true, - "PresetFilter": "series_5_blueprint_152", + "PresetFilter": "series_6_blueprint_203", "CustomFilter": "S5-DR0.5 > S5-PRY0.5 > S5-H0.5 > S5-Q0.5 > S5-DR2.5 > 0.5 > S5-G1.5\n> S5-Q1 > S5-DR5 > S5-DR8 > S5-G4 > S5-PRY2.5 > 1 > S5-Q2 > reset\n> S5-G2.5 > S5-PRY5 > S5-PRY8 > 1.5 > 2 > S5-Q4 > 2.5 > 3\n> Q4 > G4 > 4 > 5 > S5-C6 > C6 > 6 > S5-C8 > 8\n> S5-C12 > 12" }, "Storage": { diff --git a/dev_tools/campaign_swipe.py b/dev_tools/campaign_swipe.py index d506d3814..9d26f80f7 100644 --- a/dev_tools/campaign_swipe.py +++ b/dev_tools/campaign_swipe.py @@ -57,7 +57,7 @@ hm.load_homography(image=np.array(az.device.image)) class SwipeSimulate: def __init__(self, swipe, simulate_count=4): self.simulate_count = simulate_count - self.swipe = np.array(swipe, dtype=np.float) + self.swipe = np.array(swipe, dtype=float) self.swipe_base = self.cal_swipe_base() logger.info(self.swipe_base) diff --git a/module/base/base.py b/module/base/base.py index d7b9f8615..2823fc1a5 100644 --- a/module/base/base.py +++ b/module/base/base.py @@ -224,27 +224,29 @@ class ModuleBase: color = get_color(self.device.image, button_area) return Button(area=button_area, color=color, button=button_area, name=name) - def interval_reset(self, button): + def interval_reset(self, button, interval=3): if isinstance(button, (list, tuple)): for b in button: self.interval_reset(b) return - if button.name in self.interval_timer: - self.interval_timer[button.name].reset() - else: - self.interval_timer[button.name] = Timer(3).reset() + if button is not None: + if button.name in self.interval_timer: + self.interval_timer[button.name].reset() + else: + self.interval_timer[button.name] = Timer(interval).reset() - def interval_clear(self, button): + def interval_clear(self, button, interval=3): if isinstance(button, (list, tuple)): for b in button: self.interval_clear(b) return - if button.name in self.interval_timer: - self.interval_timer[button.name].clear() - else: - self.interval_timer[button.name] = Timer(3).clear() + if button is not None: + if button.name in self.interval_timer: + self.interval_timer[button.name].clear() + else: + self.interval_timer[button.name] = Timer(interval).clear() _image_file = '' diff --git a/module/base/utils.py b/module/base/utils.py index 92b5ad928..9fcc5fefb 100644 --- a/module/base/utils.py +++ b/module/base/utils.py @@ -620,7 +620,7 @@ def rgb2hsv(image): Returns: np.ndarray: Hue (0~360), Saturation (0~100), Value (0~100). """ - image = cv2.cvtColor(image, cv2.COLOR_RGB2HSV).astype(np.float) + image = cv2.cvtColor(image, cv2.COLOR_RGB2HSV).astype(float) image *= (360 / 180, 100 / 255, 100 / 255) return image diff --git a/module/campaign/gems_farming.py b/module/campaign/gems_farming.py index 051fc03bd..ab0ec296c 100644 --- a/module/campaign/gems_farming.py +++ b/module/campaign/gems_farming.py @@ -13,7 +13,7 @@ from module.retire.assets import DOCK_CHECK, TEMPLATE_BOGUE, TEMPLATE_HERMES, TE from module.retire.dock import Dock from module.retire.scanner import ShipScanner from module.ui.page import page_fleet, page_event -from module.ui.ui import BACK_ARROW +from module.ui.assets import BACK_ARROW import inflection SIM_VALUE = 0.95 diff --git a/module/combat/combat.py b/module/combat/combat.py index 7e9b702e5..f723cea2b 100644 --- a/module/combat/combat.py +++ b/module/combat/combat.py @@ -425,17 +425,26 @@ class Combat(Level, HPBalancer, Retirement, SubmarineCall, CombatAuto, CombatMan continue if self.handle_get_items(drop=drop): continue - if not exp_info and self.handle_battle_status(drop=drop): - battle_status = True - continue if self.handle_popup_confirm('COMBAT_STATUS'): if battle_status and not exp_info: logger.info('Locking a new ship') self.config.GET_SHIP_TRIGGERED = True continue - if self.handle_exp_info(): - exp_info = True - continue + if not battle_status: + if not exp_info and self.handle_battle_status(drop=drop): + battle_status = True + continue + if self.handle_exp_info(): + exp_info = True + continue + else: + # Check exp_info first if battle_status has been clicked. + if self.handle_exp_info(): + exp_info = True + continue + if not exp_info and self.handle_battle_status(drop=drop): + battle_status = True + continue if self.handle_urgent_commission(drop=drop): continue if self.handle_guild_popup_cancel(): diff --git a/module/config/argument/args.json b/module/config/argument/args.json index dc214b71e..4857ad6c7 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -1611,6 +1611,7 @@ "type": "select", "value": "campaign_main", "option": [ + "event_20220818_cn", "event_20220428_cn", "event_20210527_cn", "event_20200603_cn", @@ -1635,7 +1636,6 @@ "event_20220915_cn", "event_20210916_cn", "event_20200903_en", - "event_20220818_cn", "event_20220324_cn", "event_20211028_cn", "event_20220728_cn", @@ -1669,10 +1669,10 @@ "event_20200227_cn" ], "display": "hide", - "tw": "event_20220428_cn", + "jp": "event_20220818_cn", + "tw": "event_20220818_cn", "cn": "event_20210527_cn", - "en": "event_20210527_cn", - "jp": "event_20210527_cn" + "en": "event_20210527_cn" }, "Mode": { "type": "select", @@ -1930,6 +1930,7 @@ "type": "select", "value": "campaign_main", "option": [ + "event_20220818_cn", "event_20220428_cn", "event_20210527_cn", "event_20200603_cn", @@ -1954,7 +1955,6 @@ "event_20220915_cn", "event_20210916_cn", "event_20200903_en", - "event_20220818_cn", "event_20220324_cn", "event_20211028_cn", "event_20220728_cn", @@ -1988,10 +1988,10 @@ "event_20200227_cn" ], "display": "disabled", - "tw": "event_20220428_cn", + "jp": "event_20220818_cn", + "tw": "event_20220818_cn", "cn": "event_20210527_cn", - "en": "event_20210527_cn", - "jp": "event_20210527_cn" + "en": "event_20210527_cn" }, "Mode": { "type": "select", @@ -2364,6 +2364,7 @@ "type": "select", "value": "campaign_main", "option": [ + "event_20220818_cn", "event_20220428_cn", "event_20210527_cn", "event_20200603_cn", @@ -2388,7 +2389,6 @@ "event_20220915_cn", "event_20210916_cn", "event_20200903_en", - "event_20220818_cn", "event_20220324_cn", "event_20211028_cn", "event_20220728_cn", @@ -2422,10 +2422,10 @@ "event_20200227_cn" ], "display": "disabled", - "tw": "event_20220428_cn", + "jp": "event_20220818_cn", + "tw": "event_20220818_cn", "cn": "event_20210527_cn", - "en": "event_20210527_cn", - "jp": "event_20210527_cn" + "en": "event_20210527_cn" }, "Mode": { "type": "select", @@ -4142,6 +4142,7 @@ "type": "select", "value": "campaign_main", "option": [ + "event_20220818_cn", "event_20220428_cn", "event_20210527_cn", "event_20200603_cn", @@ -4166,7 +4167,6 @@ "event_20220915_cn", "event_20210916_cn", "event_20200903_en", - "event_20220818_cn", "event_20220324_cn", "event_20211028_cn", "event_20220728_cn", @@ -4200,10 +4200,10 @@ "event_20200227_cn" ], "display": "disabled", - "tw": "event_20220428_cn", + "jp": "event_20220818_cn", + "tw": "event_20220818_cn", "cn": "event_20210527_cn", - "en": "event_20210527_cn", - "jp": "event_20210527_cn" + "en": "event_20210527_cn" }, "Mode": { "type": "select", @@ -4593,6 +4593,7 @@ "type": "select", "value": "campaign_main", "option": [ + "event_20220818_cn", "event_20220428_cn", "event_20210527_cn", "event_20200603_cn", @@ -4617,7 +4618,6 @@ "event_20220915_cn", "event_20210916_cn", "event_20200903_en", - "event_20220818_cn", "event_20220324_cn", "event_20211028_cn", "event_20220728_cn", @@ -4651,10 +4651,10 @@ "event_20200227_cn" ], "display": "disabled", - "tw": "event_20220428_cn", + "jp": "event_20220818_cn", + "tw": "event_20220818_cn", "cn": "event_20210527_cn", - "en": "event_20210527_cn", - "jp": "event_20210527_cn" + "en": "event_20210527_cn" }, "Mode": { "type": "select", @@ -5044,6 +5044,7 @@ "type": "select", "value": "campaign_main", "option": [ + "event_20220818_cn", "event_20220428_cn", "event_20210527_cn", "event_20200603_cn", @@ -5068,7 +5069,6 @@ "event_20220915_cn", "event_20210916_cn", "event_20200903_en", - "event_20220818_cn", "event_20220324_cn", "event_20211028_cn", "event_20220728_cn", @@ -5102,10 +5102,10 @@ "event_20200227_cn" ], "display": "disabled", - "tw": "event_20220428_cn", + "jp": "event_20220818_cn", + "tw": "event_20220818_cn", "cn": "event_20210527_cn", - "en": "event_20210527_cn", - "jp": "event_20210527_cn" + "en": "event_20210527_cn" }, "Mode": { "type": "select", @@ -5495,6 +5495,7 @@ "type": "select", "value": "campaign_main", "option": [ + "event_20220818_cn", "event_20220428_cn", "event_20210527_cn", "event_20200603_cn", @@ -5519,7 +5520,6 @@ "event_20220915_cn", "event_20210916_cn", "event_20200903_en", - "event_20220818_cn", "event_20220324_cn", "event_20211028_cn", "event_20220728_cn", @@ -5553,10 +5553,10 @@ "event_20200227_cn" ], "display": "disabled", - "tw": "event_20220428_cn", + "jp": "event_20220818_cn", + "tw": "event_20220818_cn", "cn": "event_20210527_cn", - "en": "event_20210527_cn", - "jp": "event_20210527_cn" + "en": "event_20210527_cn" }, "Mode": { "type": "select", @@ -5936,6 +5936,7 @@ "type": "select", "value": "campaign_main", "option": [ + "event_20220818_cn", "event_20220428_cn", "event_20210527_cn", "event_20200603_cn", @@ -5960,7 +5961,6 @@ "event_20220915_cn", "event_20210916_cn", "event_20200903_en", - "event_20220818_cn", "event_20220324_cn", "event_20211028_cn", "event_20220728_cn", @@ -5994,10 +5994,10 @@ "event_20200227_cn" ], "display": "disabled", - "tw": "event_20220428_cn", + "jp": "event_20220818_cn", + "tw": "event_20220818_cn", "cn": "event_20210527_cn", - "en": "event_20210527_cn", - "jp": "event_20210527_cn" + "en": "event_20210527_cn" }, "Mode": { "type": "select", @@ -7006,9 +7006,12 @@ }, "PresetFilter": { "type": "select", - "value": "series_5_blueprint_152", + "value": "series_6_blueprint_203", "option": [ "custom", + "series_6_blueprint_203", + "series_6_blueprint_only", + "series_6_203_only", "series_5_blueprint_152", "series_5_blueprint_only", "series_5_152_only", diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 6726c85ab..dd8f33df0 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -340,9 +340,12 @@ Research: option: [ always_use, only_05_hour, only_no_project, do_not_use ] AllowDelay: true PresetFilter: - value: series_5_blueprint_152 + value: series_6_blueprint_203 option: - custom + - series_6_blueprint_203 + - series_6_blueprint_only + - series_6_203_only - series_5_blueprint_152 - series_5_blueprint_only - series_5_152_only diff --git a/module/config/config.py b/module/config/config.py index b8043b569..a3ae848b7 100644 --- a/module/config/config.py +++ b/module/config/config.py @@ -509,6 +509,9 @@ class AzurLaneConfig(ConfigUpdater, ManualConfig, GeneratedConfig, ConfigWatcher "OpsiObscure", "OpsiAbyssal", "OpsiStronghold", + # Delay OpsiArchive, since OpsiArchive and OpsiDaily share the same mission list, + # although it does not requires any AP to enter. + "OpsiArchive", "OpsiMeowfficerFarming", ] ) diff --git a/module/config/config_generated.py b/module/config/config_generated.py index b9d9ee155..b4c57cea2 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -208,7 +208,7 @@ class GeneratedConfig: Research_UseCoin = 'always_use' # always_use, only_05_hour, only_no_project, do_not_use Research_UsePart = 'always_use' # always_use, only_05_hour, only_no_project, do_not_use Research_AllowDelay = True - Research_PresetFilter = 'series_5_blueprint_152' # custom, series_5_blueprint_152, series_5_blueprint_only, series_5_152_only, series_4_blueprint_tenrai, series_4_blueprint_only, series_4_tenrai_only, series_3_blueprint_234, series_3_blueprint_only, series_3_234_only, series_2_than_3_457_234, series_2_blueprint_457, series_2_blueprint_only, series_2_457_only + Research_PresetFilter = 'series_6_blueprint_203' # custom, series_6_blueprint_203, series_6_blueprint_only, series_6_203_only, series_5_blueprint_152, series_5_blueprint_only, series_5_152_only, series_4_blueprint_tenrai, series_4_blueprint_only, series_4_tenrai_only, series_3_blueprint_234, series_3_blueprint_only, series_3_234_only, series_2_than_3_457_234, series_2_blueprint_457, series_2_blueprint_only, series_2_457_only Research_CustomFilter = 'S5-DR0.5 > S5-PRY0.5 > S5-H0.5 > S5-Q0.5 > S5-DR2.5 > 0.5 > S5-G1.5\n> S5-Q1 > S5-DR5 > S5-DR8 > S5-G4 > S5-PRY2.5 > 1 > S5-Q2 > reset\n> S5-G2.5 > S5-PRY5 > S5-PRY8 > 1.5 > 2 > S5-Q4 > 2.5 > 3\n> Q4 > G4 > 4 > 5 > S5-C6 > C6 > 6 > S5-C8 > 8\n> S5-C12 > 12' # Group `Dorm` diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index d9c922431..6df788b66 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -646,6 +646,7 @@ "name": "Event Name", "help": "Automatically selects to the latest event", "campaign_main": "campaign_main", + "event_20220818_cn": "Operation Convergence", "raid_20230629": "Reflections of the Oasis", "event_20220428_cn": "Rondo at Rainbows End", "event_20210527_cn": "Mirror Involution Rerun", @@ -676,7 +677,6 @@ "event_20220915_cn": "Violet Tempest Blooming Lycoris", "event_20210916_cn": "Upon the Shimmering Blue", "event_20200903_en": "Stars of the Shimmering Fjord", - "event_20220818_cn": "Operation Convergence", "event_20220324_cn": "Virtual Tower", "event_20211028_cn": "Skybound Oratorio Rerun", "event_20220728_cn": "Aquilifers Ballade", @@ -1358,6 +1358,9 @@ "name": "Preset Filter Select", "help": "See research drops rates and spawn rates in https://azur-stats.lyoko.io/. People without a basic knowledge of these are recommended to use pre-optimized presets instead of writing custom filters", "custom": "custom", + "series_6_blueprint_203": "Series 6 Blueprints+203", + "series_6_blueprint_only": "Series 6 Blueprints Only", + "series_6_203_only": "Series 6 203 Only", "series_5_blueprint_152": "Series 5 Blueprints+152", "series_5_blueprint_only": "Series 5 Blueprints Only", "series_5_152_only": "Series 5 152 Only", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 8bceb3ee7..972383dfd 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -646,6 +646,7 @@ "name": "Campaign.Event.name", "help": "Campaign.Event.help", "campaign_main": "campaign_main", + "event_20220818_cn": "結像点作戦", "raid_20230629": "緑地伽話", "event_20220428_cn": "吟ずる瑠璃の楽章", "event_20210527_cn": "照らす螺旋の鏡海(復刻)", @@ -676,7 +677,6 @@ "event_20220915_cn": "赫の涙月 菫の暁風", "event_20210916_cn": "駆けよ 碧海の吹き風", "event_20200903_en": "輝ける峡湾の星(復刻)", - "event_20220818_cn": "結像点作戦", "event_20220324_cn": "幻像の塔", "event_20211028_cn": "神穹を衝く聖歌(復刻)", "event_20220728_cn": "鋼鷲の冒険譚", @@ -1358,6 +1358,9 @@ "name": "Research.PresetFilter.name", "help": "Research.PresetFilter.help", "custom": "custom", + "series_6_blueprint_203": "series_6_blueprint_203", + "series_6_blueprint_only": "series_6_blueprint_only", + "series_6_203_only": "series_6_203_only", "series_5_blueprint_152": "series_5_blueprint_152", "series_5_blueprint_only": "series_5_blueprint_only", "series_5_152_only": "series_5_152_only", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 2e7f2a2d0..82128cae1 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -646,6 +646,7 @@ "name": "活动名称", "help": "自动选择至最新的活动", "campaign_main": "主线图", + "event_20220818_cn": "远汇点作战", "raid_20230629": "绿洲往事", "event_20220428_cn": "虹彩的终幕曲", "event_20210527_cn": "复刻镜位螺旋", @@ -676,7 +677,6 @@ "event_20220915_cn": "紫绛槿岚", "event_20210916_cn": "碧海光粼", "event_20200903_en": "复刻峡湾间的星辰", - "event_20220818_cn": "远汇点作战", "event_20220324_cn": "虚像构筑之塔", "event_20211028_cn": "复刻穹顶下的圣咏曲", "event_20220728_cn": "雄鹰的叙事歌", @@ -1358,6 +1358,9 @@ "name": "科研过滤器", "help": "科研掉落和项目刷新见 https://azur-stats.lyoko.io/,对这些没有基本了解的人不建议编写自定义过滤器,建议使用预优化科研过滤器", "custom": "自定义", + "series_6_blueprint_203": "六期 蓝图+203", + "series_6_blueprint_only": "六期 仅蓝图", + "series_6_203_only": "六期 仅203", "series_5_blueprint_152": "五期 蓝图+152", "series_5_blueprint_only": "五期 仅蓝图", "series_5_152_only": "五期 仅152", diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index efa728e4d..e69e6b5f5 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -646,6 +646,7 @@ "name": "活動名稱", "help": "自動選擇至最新的活動圖", "campaign_main": "主線圖", + "event_20220818_cn": "遠匯點作戰", "raid_20230629": "Reflections of the Oasis", "event_20220428_cn": "虹彩的終幕曲", "event_20210527_cn": "鏡位螺旋", @@ -676,7 +677,6 @@ "event_20220915_cn": "Violet Tempest Blooming Lycoris", "event_20210916_cn": "碧海光粼", "event_20200903_en": "復刻峽灣間的星辰", - "event_20220818_cn": "Operation Convergence", "event_20220324_cn": "虛像構築之塔", "event_20211028_cn": "復刻穹頂下的聖詠曲", "event_20220728_cn": "Aquilifers Ballade", @@ -1358,6 +1358,9 @@ "name": "科研過濾器", "help": "科研掉落和項目刷新見 https://azur-stats.lyoko.io/,對這些沒有基本了解的人不建議編寫自定義過濾器,建議使用預優化科研過濾器", "custom": "自定義", + "series_6_blueprint_203": "六期 藍圖+203", + "series_6_blueprint_only": "六期 僅藍圖", + "series_6_203_only": "六期 僅203", "series_5_blueprint_152": "五期 藍圖+152", "series_5_blueprint_only": "五期 僅藍圖", "series_5_152_only": "五期 僅152", diff --git a/module/daily/daily.py b/module/daily/daily.py index 5f4d163df..92eceed85 100644 --- a/module/daily/daily.py +++ b/module/daily/daily.py @@ -7,9 +7,8 @@ from module.daily.assets import * from module.equipment.fleet_equipment import DailyEquipment from module.logger import logger from module.ocr.ocr import Digit -from module.ui.assets import DAILY_CHECK -from module.ui.ui import (BACK_ARROW, page_campaign_menu, - page_daily) +from module.ui.assets import BACK_ARROW, DAILY_CHECK +from module.ui.page import page_campaign_menu, page_daily DAILY_MISSION_LIST = [DAILY_MISSION_1, DAILY_MISSION_2, DAILY_MISSION_3] OCR_REMAIN = Digit(OCR_REMAIN, threshold=128, alphabet='01234') diff --git a/module/equipment/fleet_equipment.py b/module/equipment/fleet_equipment.py index c1c97743d..ce04d81af 100644 --- a/module/equipment/fleet_equipment.py +++ b/module/equipment/fleet_equipment.py @@ -3,7 +3,7 @@ from module.equipment.equipment import Equipment from module.logger import logger from module.ocr.ocr import Digit from module.ui.assets import FLEET_CHECK -from module.ui.ui import page_fleet +from module.ui.page import page_fleet OCR_FLEET_INDEX = Digit(OCR_FLEET_INDEX, letter=(90, 154, 255), threshold=128, alphabet='123456') diff --git a/module/exercise/exercise.py b/module/exercise/exercise.py index ca9133947..06e5767a0 100644 --- a/module/exercise/exercise.py +++ b/module/exercise/exercise.py @@ -4,10 +4,9 @@ from module.exercise.assets import * from module.exercise.combat import ExerciseCombat from module.logger import logger from module.ocr.ocr import Digit, Ocr, OcrYuv -from module.ui.ui import page_exercise +from module.ui.page import page_exercise from module.config.utils import get_server_next_update - class DatedDuration(Ocr): def __init__(self, buttons, lang='cnocr', letter=(255, 255, 255), threshold=128, alphabet='0123456789:IDS天日d', name=None): diff --git a/module/freebies/data_key.py b/module/freebies/data_key.py index b05a1be51..740f4027a 100644 --- a/module/freebies/data_key.py +++ b/module/freebies/data_key.py @@ -4,7 +4,9 @@ from module.logger import logger from module.ocr.ocr import DigitCounter from module.ui.assets import (CAMPAIGN_MENU_GOTO_WAR_ARCHIVES, WAR_ARCHIVES_CHECK) -from module.ui.ui import UI, page_archives +from module.ui.page import page_archives +from module.ui.ui import UI + DATA_KEY = DigitCounter(OCR_DATA_KEY, letter=(255, 247, 247), threshold=64) diff --git a/module/freebies/mail.py b/module/freebies/mail.py index d5d8e02bc..310efd9ad 100644 --- a/module/freebies/mail.py +++ b/module/freebies/mail.py @@ -8,7 +8,7 @@ from module.combat.assets import * from module.freebies.assets import * from module.logger import logger from module.statistics.item import ItemGrid -from module.ui.page import * +from module.ui.page import page_main from module.ui.ui import UI MAIL_BUTTON_GRID = ButtonGrid( diff --git a/module/gacha/gacha_reward.py b/module/gacha/gacha_reward.py index 8efd69734..5bc48ba5e 100644 --- a/module/gacha/gacha_reward.py +++ b/module/gacha/gacha_reward.py @@ -200,15 +200,18 @@ class RewardGacha(GachaUI, GeneralShop, Retirement): confirm_mode = True # Drill, Lock Ship # Clear button offset, or will click at the PLUS button of gems or HOME button STORY_SKIP.clear_offset() + queue_clean = True while 1: if skip_first_screenshot: skip_first_screenshot = False else: self.device.screenshot() - if self.appear(BUILD_QUEUE_EMPTY, offset=(20, 20)): + if self.appear(BUILD_QUEUE_EMPTY, offset=(20, 20)) and queue_clean: self.gacha_side_navbar_ensure(upper=1) break + else: + queue_clean = False if self.appear_then_click(BUILD_FINISH_ORDERS, interval=3): confirm_timer.reset() diff --git a/module/guild/guild_reward.py b/module/guild/guild_reward.py index aaaf35b10..5c204fc60 100644 --- a/module/guild/guild_reward.py +++ b/module/guild/guild_reward.py @@ -1,7 +1,7 @@ from module.guild.lobby import GuildLobby from module.guild.logistics import GuildLogistics from module.guild.operations import GuildOperations -from module.ui.ui import page_guild, page_main +from module.ui.page import page_guild, page_main class RewardGuild(GuildLobby, GuildLogistics, GuildOperations): diff --git a/module/handler/sensitive_info.py b/module/handler/sensitive_info.py index c25f19d3c..d508615e7 100644 --- a/module/handler/sensitive_info.py +++ b/module/handler/sensitive_info.py @@ -1,7 +1,8 @@ import re from module.base.mask import Mask -from module.ui.page import * +from module.ui.assets import PLAYER_CHECK +from module.ui.page import MAIN_CHECK MASK_MAIN = Mask('./assets/mask/MASK_MAIN.png') MASK_PLAYER = Mask('./assets/mask/MASK_PLAYER.png') diff --git a/module/map/camera.py b/module/map/camera.py index 9dea44a8b..763b63e1d 100644 --- a/module/map/camera.py +++ b/module/map/camera.py @@ -129,7 +129,8 @@ class Camera(MapOperation): return False elif self.appear(GET_ITEMS_1, offset=5): logger.warning('Perspective error caused by get_items') - self.handle_mystery() + # Don't use handle_mystery() here since OpSi overrides it. + self.device.click(GET_ITEMS_1) return False elif self.appear(GET_ITEMS_1_RYZA, offset=(20, 20)): logger.warning('Perspective error caused by GET_ITEMS_1_RYZA') diff --git a/module/meowfficer/meowfficer.py b/module/meowfficer/meowfficer.py index 30993249f..6571f862d 100644 --- a/module/meowfficer/meowfficer.py +++ b/module/meowfficer/meowfficer.py @@ -1,7 +1,7 @@ from module.meowfficer.buy import MeowfficerBuy from module.meowfficer.fort import MeowfficerFort from module.meowfficer.train import MeowfficerTrain -from module.ui.ui import page_meowfficer +from module.ui.page import page_meowfficer class RewardMeowfficer(MeowfficerBuy, MeowfficerFort, MeowfficerTrain): diff --git a/module/meta_reward/meta_reward.py b/module/meta_reward/meta_reward.py index 63d765c67..7321c34b3 100644 --- a/module/meta_reward/meta_reward.py +++ b/module/meta_reward/meta_reward.py @@ -4,8 +4,9 @@ from module.combat.combat import Combat from module.logger import logger from module.meta_reward.assets import * from module.template.assets import TEMPLATE_META_DOCK_RED_DOT +from module.ui.assets import BACK_ARROW from module.ui.page import page_meta -from module.ui.ui import UI, BACK_ARROW +from module.ui.ui import UI class MetaReward(Combat, UI): diff --git a/module/os_handler/storage.py b/module/os_handler/storage.py index 7043ff072..91e203dd3 100644 --- a/module/os_handler/storage.py +++ b/module/os_handler/storage.py @@ -61,6 +61,7 @@ class StorageHandler(GlobeOperation, ZoneManager): out: STORAGE_CHECK """ success = False + get_mission_counter = 0 self.interval_clear(STORAGE_CHECK) self.interval_clear(STORAGE_USE) self.interval_clear(GET_ITEMS_1) @@ -79,6 +80,10 @@ class StorageHandler(GlobeOperation, ZoneManager): logger.info(f'_storage_item_use item info -> {GET_MISSION}') self.device.click(GET_MISSION) self.interval_reset(STORAGE_CHECK) + get_mission_counter += 1 + if get_mission_counter >= 3: + logger.warning('Possibly stuck on energy storage device, redetecting logger items.') + break continue # Item rewards if self.appear_then_click(STORAGE_USE, offset=(180, 30), interval=5): diff --git a/module/raid/assets.py b/module/raid/assets.py index 74b74968f..17998c536 100644 --- a/module/raid/assets.py +++ b/module/raid/assets.py @@ -49,6 +49,7 @@ KUYBYSHEY_RAID_EX = Button(area={'cn': (1082, 189, 1146, 217), 'en': (1082, 189, KUYBYSHEY_RAID_HARD = Button(area={'cn': (1073, 345, 1125, 371), 'en': (1074, 344, 1125, 372), 'jp': (1064, 348, 1127, 369), 'tw': (1073, 345, 1125, 371)}, color={'cn': (91, 100, 114), 'en': (84, 93, 107), 'jp': (85, 94, 108), 'tw': (91, 100, 114)}, button={'cn': (1073, 345, 1125, 371), 'en': (1074, 344, 1125, 372), 'jp': (1064, 348, 1127, 369), 'tw': (1073, 345, 1125, 371)}, file={'cn': './assets/cn/raid/KUYBYSHEY_RAID_HARD.png', 'en': './assets/en/raid/KUYBYSHEY_RAID_HARD.png', 'jp': './assets/jp/raid/KUYBYSHEY_RAID_HARD.png', 'tw': './assets/cn/raid/KUYBYSHEY_RAID_HARD.png'}) KUYBYSHEY_RAID_NORMAL = Button(area={'cn': (1045, 423, 1097, 451), 'en': (1036, 424, 1099, 449), 'jp': (1048, 427, 1091, 448), 'tw': (1045, 423, 1097, 451)}, color={'cn': (86, 95, 109), 'en': (81, 92, 105), 'jp': (131, 143, 154), 'tw': (86, 95, 109)}, button={'cn': (1045, 423, 1097, 451), 'en': (1036, 424, 1099, 449), 'jp': (1048, 427, 1091, 448), 'tw': (1045, 423, 1097, 451)}, file={'cn': './assets/cn/raid/KUYBYSHEY_RAID_NORMAL.png', 'en': './assets/en/raid/KUYBYSHEY_RAID_NORMAL.png', 'jp': './assets/jp/raid/KUYBYSHEY_RAID_NORMAL.png', 'tw': './assets/cn/raid/KUYBYSHEY_RAID_NORMAL.png'}) RAID_FLEET_PREPARATION = Button(area={'cn': (983, 577, 1181, 638), 'en': (1041, 592, 1121, 631), 'jp': (983, 579, 1180, 635), 'tw': (983, 577, 1181, 638)}, color={'cn': (236, 188, 115), 'en': (236, 184, 117), 'jp': (235, 183, 103), 'tw': (236, 188, 115)}, button={'cn': (983, 577, 1181, 638), 'en': (1041, 592, 1121, 631), 'jp': (983, 579, 1180, 635), 'tw': (983, 577, 1181, 638)}, file={'cn': './assets/cn/raid/RAID_FLEET_PREPARATION.png', 'en': './assets/en/raid/RAID_FLEET_PREPARATION.png', 'jp': './assets/jp/raid/RAID_FLEET_PREPARATION.png', 'tw': './assets/tw/raid/RAID_FLEET_PREPARATION.png'}) +RAID_REWARDS = Button(area={'cn': (836, 127, 900, 169), 'en': (836, 127, 900, 169), 'jp': (836, 127, 900, 169), 'tw': (836, 127, 900, 169)}, color={'cn': (217, 103, 98), 'en': (217, 103, 98), 'jp': (217, 103, 98), 'tw': (217, 103, 98)}, button={'cn': (836, 127, 900, 169), 'en': (836, 127, 900, 169), 'jp': (836, 127, 900, 169), 'tw': (836, 127, 900, 169)}, file={'cn': './assets/cn/raid/RAID_REWARDS.png', 'en': './assets/en/raid/RAID_REWARDS.png', 'jp': './assets/jp/raid/RAID_REWARDS.png', 'tw': './assets/tw/raid/RAID_REWARDS.png'}) SURUGA_OCR_REMAIN_EASY = Button(area={'cn': (1093, 549, 1141, 563), 'en': (1093, 549, 1141, 563), 'jp': (1096, 549, 1141, 563), 'tw': (1096, 549, 1141, 563)}, color={'cn': (161, 161, 161), 'en': (161, 161, 161), 'jp': (155, 155, 155), 'tw': (155, 155, 155)}, button={'cn': (1093, 549, 1141, 563), 'en': (1093, 549, 1141, 563), 'jp': (1096, 549, 1141, 563), 'tw': (1096, 549, 1141, 563)}, file={'cn': './assets/cn/raid/SURUGA_OCR_REMAIN_EASY.png', 'en': './assets/en/raid/SURUGA_OCR_REMAIN_EASY.png', 'jp': './assets/jp/raid/SURUGA_OCR_REMAIN_EASY.png', 'tw': './assets/tw/raid/SURUGA_OCR_REMAIN_EASY.png'}) SURUGA_OCR_REMAIN_HARD = Button(area={'cn': (1071, 318, 1118, 332), 'en': (1071, 318, 1118, 332), 'jp': (1073, 318, 1118, 331), 'tw': (1079, 318, 1118, 332)}, color={'cn': (158, 158, 159), 'en': (158, 158, 159), 'jp': (173, 173, 173), 'tw': (168, 168, 168)}, button={'cn': (1071, 318, 1118, 332), 'en': (1071, 318, 1118, 332), 'jp': (1073, 318, 1118, 331), 'tw': (1079, 318, 1118, 332)}, file={'cn': './assets/cn/raid/SURUGA_OCR_REMAIN_HARD.png', 'en': './assets/en/raid/SURUGA_OCR_REMAIN_HARD.png', 'jp': './assets/jp/raid/SURUGA_OCR_REMAIN_HARD.png', 'tw': './assets/tw/raid/SURUGA_OCR_REMAIN_HARD.png'}) SURUGA_OCR_REMAIN_NORMAL = Button(area={'cn': (1137, 426, 1185, 439), 'en': (1137, 426, 1185, 439), 'jp': (1140, 426, 1185, 439), 'tw': (1140, 426, 1185, 439)}, color={'cn': (164, 164, 164), 'en': (164, 164, 164), 'jp': (158, 158, 158), 'tw': (158, 158, 158)}, button={'cn': (1137, 426, 1185, 439), 'en': (1137, 426, 1185, 439), 'jp': (1140, 426, 1185, 439), 'tw': (1140, 426, 1185, 439)}, file={'cn': './assets/cn/raid/SURUGA_OCR_REMAIN_NORMAL.png', 'en': './assets/en/raid/SURUGA_OCR_REMAIN_NORMAL.png', 'jp': './assets/jp/raid/SURUGA_OCR_REMAIN_NORMAL.png', 'tw': './assets/tw/raid/SURUGA_OCR_REMAIN_NORMAL.png'}) diff --git a/module/raid/raid.py b/module/raid/raid.py index edfd92393..01e4180cb 100644 --- a/module/raid/raid.py +++ b/module/raid/raid.py @@ -154,6 +154,7 @@ class Raid(MapOperation, RaidCombat, CampaignEvent): GGHandler(config=self.config, device=self.device).power_limit('Raid') skip_first_screenshot = True + # No need, already waited in `raid_execute_once()` # if emotion_reduce: # self.emotion.wait(fleet_index) @@ -248,6 +249,8 @@ class Raid(MapOperation, RaidCombat, CampaignEvent): break def raid_expected_end(self): + if self.appear_then_click(RAID_REWARDS, offset=(30, 30), interval=3): + return False return self.appear(RAID_CHECK, offset=(30, 30)) def raid_execute_once(self, mode, raid): diff --git a/module/raid/run.py b/module/raid/run.py index a9dd70b3d..5d239047e 100644 --- a/module/raid/run.py +++ b/module/raid/run.py @@ -2,6 +2,7 @@ from module.base.timer import Timer from module.campaign.campaign_event import CampaignEvent from module.exception import ScriptEnd, ScriptError from module.logger import logger +from module.raid.assets import RAID_REWARDS from module.raid.raid import OilExhausted, Raid, raid_ocr from module.ui.page import page_raid @@ -49,6 +50,10 @@ class RaidRun(Raid, CampaignEvent): remain, _, _ = result logger.attr(f'{mode.capitalize()} Remain', remain) + if self.appear_then_click(RAID_REWARDS, offset=(30, 30), interval=3): + confirm_timer.reset() + continue + # End if remain == prev: if confirm_timer.reached(): diff --git a/module/research/preset.py b/module/research/preset.py index dffb450dc..9f56c1a88 100644 --- a/module/research/preset.py +++ b/module/research/preset.py @@ -1,6 +1,72 @@ FILTER_STRING_SHORTEST = '0.5 > 1 > 1.5 > 2 > 2.5 > 3 > 4 > 5 > 6 > 8 > 10 > 12' FILTER_STRING_CHEAPEST = 'Q1 > Q2 > T3 > T4 > Q4 > C6 > T6 > C8 > C12 > G1.5 > D2.5 > G2.5 > D5 > Q0.5 > G4 > D8 > H1 > H2 > H0.5 > D0.5 > H4' DICT_FILTER_PRESET = { + # Goal: DR_blurprint=0, PRY_blueprint=0, tanrai_blueprint=150 + # Average time cost: 153.41706666666678 + # Average rewards: [238.69016631 238.37881965 529.71190834 528.92520834 528.39586667 150.07973333] + 'series_6_203_only_cube': """ + S6-Q0.5 > S6-DR0.5 > S6-PRY0.5 > Q0.5 > S6-Q4 > S6-Q2 > S6-Q1 > 0.5 + > S6-E-315 > S6-G1.5 > S6-G4 > Q1 > reset > S6-H1 > H1 > 1 > S6-E-031 + > S6-DR2.5 > S6-PRY2.5 > S6-G2.5 > G1.5 > 1.5 > Q2 > E2 > S6-H2 > H2 + > 2 > DR2.5 > PRY2.5 > G2.5 > 2.5 > S6-DR5 > S6-PRY5 > Q4 > G4 + > S6-H4 > H4 > 4 > S6-C6 > DR5 > PRY5 > 5 > S6-DR8 > S6-PRY8 > S6-C8 + > C6 > 6 > S6-C12 > DR8 > PRY8 > C8 > 8 > C12 > 12 + """, + # Goal: DR_blurprint=0, PRY_blueprint=0, tanrai_blueprint=150 + # Average time cost: 161.37177965277806 + # Average rewards: [241.92774575 241.13046242 421.82134358 421.04494941 420.46893024 150.07799978] + 'series_6_203_only': """ + S6-Q0.5 > S6-PRY0.5 > S6-DR0.5 > Q0.5 > S6-Q4 > S6-Q2 > S6-Q1 > 0.5 + > S6-E-315 > S6-G4 > S6-G1.5 > Q1 > 1 > S6-E-031 > S6-DR2.5 > reset + > S6-G2.5 > S6-PRY2.5 > G1.5 > 1.5 > Q2 > E2 > 2 > DR2.5 > PRY2.5 + > G2.5 > 2.5 > S6-DR5 > S6-PRY5 > Q4 > G4 > 4 > S6-C6 > DR5 > PRY5 + > 5 > S6-DR8 > S6-PRY8 > S6-C8 > C6 > 6 > DR8 > PRY8 > C8 > 8 + > S6-C12 > C12 > 12 + """, + # Goal: DR_blurprint=513, PRY_blueprint=343, tanrai_blueprint=100 + # Average time cost: 124.67622465277958 + # Average rewards: [531.93022864 529.81919864 510.27473326 510.18530159 510.11215826 100.8088164] + 'series_6_blueprint_203_cube': """ + S6-DR0.5 > S6-Q0.5 > S6-PRY0.5 > 0.5 > S6-DR2.5 > S6-Q1 > S6-Q2 + > S6-H1 > S6-E-315 > S6-G1.5 > reset > S6-Q4 > S6-G4 > S6-H2 > Q1 + > H1 > 1 > S6-G2.5 > S6-DR5 > S6-PRY2.5 > G1.5 > 1.5 > S6-E-031 + > S6-DR8 > Q2 > E2 > H2 > 2 > DR2.5 > PRY2.5 > G2.5 > 2.5 > S6-H4 + > S6-PRY5 > Q4 > G4 > H4 > 4 > S6-C6 > S6-PRY8 > DR5 > PRY5 > 5 > C6 + > 6 > S6-C8 > DR8 > PRY8 > C8 > 8 > S6-C12 > C12 > 12 + """, + # Goal: DR_blurprint=513, PRY_blueprint=343, tanrai_blueprint=100 + # Average time cost: 143.56399131945145 + # Average rewards: [520.06195858 519.19883191 392.86544828 392.64870495 392.49383995 102.2368499] + 'series_6_blueprint_203': """ + S6-DR0.5 > S6-PRY0.5 > S6-Q0.5 > S6-H0.5 > Q0.5 > S6-DR2.5 + > S6-G1.5 > S6-Q1 > S6-DR5 > 0.5 > S6-G4 > S6-Q2 > S6-PRY2.5 > reset + > S6-DR8 > Q1 > 1 > S6-E-315 > S6-G2.5 > G1.5 > 1.5 > S6-E-031 + > S6-Q4 > Q2 > E2 > 2 > DR2.5 > PRY2.5 > G2.5 > 2.5 > S6-PRY5 + > S6-PRY8 > Q4 > G4 > 4 > S6-C6 > DR5 > PRY5 > 5 > C6 > 6 > S6-C8 + > S6-C12 > DR8 > PRY8 > C8 > 8 > C12 > 12 + """, + # Goal: DR_blurprint=513, PRY_blueprint=343, tanrai_blueprint=0 + # Average time cost: 82.0121088194467 + # Average rewards: [519.0311752 514.64003687 653.77171198 653.72126532 653.66129615 26.97694791] + 'series_6_blueprint_only_cube': """ + S6-DR0.5 > S6-PRY0.5 > S6-H0.5 > S6-H1 > S6-H2 > S6-DR2.5 > S6-DR5 + > 0.5 > S6-DR8 > reset > S6-H4 > S6-Q1 > Q1 > H1 > 1 > S6-G1.5 > G1.5 + > 1.5 > S6-G2.5 > S6-Q2 > S6-E-315 > S6-E-031 > Q2 > E2 > H2 > 2 + > S6-PRY2.5 > S6-G4 > DR2.5 > PRY2.5 > G2.5 > 2.5 > S6-Q4 > Q4 > G4 + > H4 > 4 > S6-PRY5 > S6-PRY8 > S6-C6 > DR5 > PRY5 > 5 > C6 > 6 + > S6-C8 > S6-C12 > DR8 > PRY8 > C8 > 8 > C12 > 12 + """, + # Goal: DR_blurprint=513, PRY_blueprint=343, tanrai_blueprint=0 + # Average time cost: 124.71616166666873 + # Average rewards: [514.96354877 514.70099977 355.58865468 354.96831385 354.66888635 56.48432238] + 'series_6_blueprint_only': """ + S6-DR0.5 > S6-H0.5 > S6-PRY0.5 > S6-DR8 > S6-DR5 > S6-DR2.5 + > S6-G1.5 > S6-PRY2.5 > 0.5 > S6-G2.5 > S6-G4 > reset > S6-Q1 > Q1 + > 1 > S6-PRY5 > G1.5 > 1.5 > S6-Q2 > S6-E-031 > S6-E-315 > Q2 > E2 + > 2 > S6-PRY8 > DR2.5 > PRY2.5 > G2.5 > 2.5 > S6-Q4 > Q4 > G4 > 4 + > S6-C6 > DR5 > PRY5 > 5 > C6 > 6 > S6-C8 > DR8 > PRY8 > C8 > 8 + > S6-C12 > C12 > 12 + """, # Goal: DR_blurprint=0, PRY_blueprint=0, tanrai_blueprint=150 # Average time cost: 153.41706666666678 # Average rewards: [238.69016631 238.37881965 529.71190834 528.92520834 528.39586667 150.07973333] diff --git a/module/research/preset_generator.py b/module/research/preset_generator.py index dc939989a..07ab92395 100644 --- a/module/research/preset_generator.py +++ b/module/research/preset_generator.py @@ -80,6 +80,8 @@ def translate(string: str, target='series_4_tenrai_only_cube', for_simulate=Fals def convert_name(name, series): name = re.sub(r'series_\d', f'series_{series}', name) + if 'series_6' in name: + name = name.replace('tenrai', '203') if 'series_5' in name: name = name.replace('tenrai', '152') if 'series_4' in name: @@ -98,7 +100,7 @@ if __name__ == '__main__': Value( FILTER_STRING_CHEAPEST='Q1 > Q2 > T3 > T4 > Q4 > C6 > T6 > C8 > C12 > G1.5 > D2.5 > G2.5 > D5 > Q0.5 > G4 > D8 > H1 > H2 > H0.5 > D0.5 > H4') with Dict('DICT_FILTER_PRESET'): - for series in [5, 4, 3, 2]: + for series in [6, 5, 4, 3, 2]: def new_filter(**kwargs): for k, v in kwargs.items(): k = convert_name(k, series) @@ -185,7 +187,7 @@ if __name__ == '__main__': """) Comment('Old community filters') - DictItem(series_2_than_3_457_234=beautify_filter(""" + DictItem('series_2_than_3_457_234', beautify_filter(""" S2-Q0.5 > S2-PRY0.5 > S2-DR0.5 > S2-Q4 > S2-Q1 > S2-Q2 > S2-H0.5 > 0.5 > S3-Q1 > S3-Q2 > S2-G4 > S3-Q4 > S2-G1.5 > S2-DR2.5 > reset > Q1 > S2-PRY2.5 > S2-G2.5 > H1 > 1.5 > Q2 > 2.5 > S2-DR5 > S2-PRY5 > Q4 > G4 > 5 > H2 > S2-C6 > S2-DR8 > S2-PRY8 > S2-C8 diff --git a/module/research/project.py b/module/research/project.py index 2805d7151..a3d2f0187 100644 --- a/module/research/project.py +++ b/module/research/project.py @@ -1,4 +1,3 @@ -import re from datetime import timedelta from scipy import signal @@ -19,7 +18,7 @@ RESEARCH_DETAIL_GENRE = [DETAIL_GENRE_B, DETAIL_GENRE_C, DETAIL_GENRE_D, DETAIL_ DETAIL_GENRE_H_0, DETAIL_GENRE_H_1, DETAIL_GENRE_Q, DETAIL_GENRE_T] -def get_research_series(image, series_button=RESEARCH_SERIES): +def get_research_series_old(image, series_button=RESEARCH_SERIES): """ Get research series using a simple color detection. Counting white lines to detect Roman numerals. @@ -68,6 +67,58 @@ def get_research_series(image, series_button=RESEARCH_SERIES): return result +def _get_research_series(img): + img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) + pos = img.shape[0] * 2 // 5 + + img = img[pos - 4:pos + 5] + img = cv2.GaussianBlur(img, (5, 5), 1) + img = img[3:6] + + threshold = np.mean(img) + edge = np.where(np.diff((img[1] > threshold).astype(np.uint8)) == 1)[0] + + grad_x = cv2.Sobel(img, cv2.CV_16S, 1, 0)[1] + grad_y = cv2.Sobel(img, cv2.CV_16S, 0, 1)[1] + + edge = np.arctan([ + grad_y[i] / grad_x[i] + for i in edge + ]) + edge = tuple( + 0 if i > -.1 + else 1 + for i in edge + if i < .1 + ) + + return { + (0,): 1, + (0, 0): 2, + (0, 0, 0): 3, + (0, 1): 4, + (1,): 5, + (1, 0): 6 + }.get(edge, 0) + + +def get_research_series(image, series_button=RESEARCH_SERIES): + """ + Args: + image (np.ndarray): + series_button: + + Returns: + list[int]: Such as [1, 1, 1, 2, 3] + """ + result = [] + for button in series_button: + img = resize(crop(image, button.area), (46, 25)) + series = _get_research_series(img) + result.append(series) + return result + + def get_research_name(image, ocr=OCR_RESEARCH): """ Args: @@ -147,7 +198,7 @@ def match_template(image, template, area, offset=30, threshold=0.85): return similarity -def get_research_series_jp(image): +def get_research_series_jp_old(image): """ Almost the same as get_research_series except the button area. @@ -155,7 +206,7 @@ def get_research_series_jp(image): image (np.ndarray): Screenshot Returns: - series (string): + str: Series like "S4" """ # Set 'prominence = 50' to ignore possible noise. parameters = {'height': 160, 'prominence': 50, 'width': 1} @@ -184,6 +235,20 @@ def get_research_series_jp(image): return f'S{series}' +def get_research_series_jp(image): + """ + Args: + image: + + Returns: + str: Series like "S4" + """ + area = SERIES_DETAIL.area + img = crop(image, area) + series = _get_research_series(img) + return f'S{series}' + + def get_research_duration_jp(image): """ Args: @@ -332,9 +397,10 @@ class ResearchProject: '|seattle|georgia|kitakaze|azuma|friedrich' '|gascogne|champagne|cheshire|drake|mainz|odin' '|anchorage|hakuryu|agir|august|marcopolo' - '|plymouth|rupprecht|harbin|chkalov|brest)') + '|plymouth|rupprecht|harbin|chkalov|brest' + '|kearsarge|hindenburg|shimanto|schultz|flandre)') REGEX_INPUT = re.compile('(coin|cube|part)') - REGEX_DR_SHIP = re.compile('azuma|friedrich|drake|hakuryu|agir|plymouth|brest') + REGEX_DR_SHIP = re.compile('azuma|friedrich|drake|hakuryu|agir|plymouth|brest|kearsarge|hindenburg') # Generate with: """ out = [] @@ -349,10 +415,11 @@ class ResearchProject: '718', '731', '744', '759', '774', '792', '318', '331', '344', '359', '374', '392', '705', '712', '746', '757', '779', '794', '305', '312', '346', '357', '379', '394', '721', '722', '772', '777', '795', '321', '322', '372', '377', '395', '708', '763', '775', '782', '768', '308', '363', '375', '382', '368', '719', '778', '786', '788', - '793', '319', '378', '386', '388', '393', '418', '431', '444', '459', '474', '492', '018', '031', '044', '059', - '074', '092', '405', '412', '446', '457', '479', '494', '005', '012', '046', '057', '079', '094', '421', '422', - '472', '477', '495', '021', '022', '072', '077', '095', '408', '463', '475', '482', '468', '008', '063', '075', - '082', '068', '419', '478', '486', '488', '493', '019', '078', '086', '088', '093'] + '793', '319', '378', '386', '388', '393', '783', '713', '739', '771', '796', '383', '313', '339', '371', '396', + '418', '431', '444', '459', '474', '492', '018', '031', '044', '059', '074', '092', '405', '412', '446', '457', + '479', '494', '005', '012', '046', '057', '079', '094', '421', '422', '472', '477', '495', '021', '022', '072', + '077', '095', '408', '463', '475', '482', '468', '008', '063', '075', '082', '068', '419', '478', '486', '488', + '493', '019', '078', '086', '088', '093', '483', '413', '439', '471', '496', '083', '013', '039', '071', '096'] def __init__(self, name, series): """ @@ -525,8 +592,9 @@ class ResearchProjectJp: SHIP_S3 = ['champagne', 'cheshire', 'drake', 'mainz', 'odin'] SHIP_S4 = ['anchorage', 'hakuryu', 'agir', 'august', 'marcopolo'] SHIP_S5 = ['plymouth', 'rupprecht', 'harbin', 'chkalov', 'brest'] - SHIP_ALL = SHIP_S1 + SHIP_S2 + SHIP_S3 + SHIP_S4 + SHIP_S5 - DR_SHIP = ['azuma', 'friedrich', 'drake', 'hakuryu', 'agir', 'plymouth', 'brest'] + SHIP_S6 = ['kearsarge', 'hindenburg', 'shimanto', 'schultz', 'flandre'] + SHIP_ALL = SHIP_S1 + SHIP_S2 + SHIP_S3 + SHIP_S4 + SHIP_S5 + SHIP_S6 + DR_SHIP = ['azuma', 'friedrich', 'drake', 'hakuryu', 'agir', 'plymouth', 'brest', 'kearsarge', 'hindenburg'] def __init__(self): self.valid = True diff --git a/module/research/project_data.py b/module/research/project_data.py index f8732ede0..1ac7c77c1 100644 --- a/module/research/project_data.py +++ b/module/research/project_data.py @@ -222,6 +222,11 @@ LIST_RESEARCH_PROJECT = [ {'name': 'T-249-MI', 'series': 5, 'time': 21600, 'task': 'Complete 6 commissions.', 'input': [], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, {'name': 'E-031-MI', 'series': 5, 'time': 7200, 'task': 'Scrap 8 pieces of gear.', 'input': [], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, {'name': 'E-315-MI', 'series': 5, 'time': 7200, 'task': 'Scrap 15 pieces of gear.', 'input': [], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'E-193-MI', 'series': 5, 'time': 21600, 'task': '', 'input': [{'name': 'T3 Eagle Tech Pack', 'amount': 15}], 'output': [{'name': 'Prototype Quadruple 330mm Mle 1931 (CB Only) Main Gun Mount Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'E-178-MI', 'series': 5, 'time': 21600, 'task': '', 'input': [{'name': 'T3 Ironblood Tech Pack', 'amount': 15}], 'output': [{'name': 'Prototype Quadruple 30mm AA Gun Mount Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'E-186-MI', 'series': 5, 'time': 21600, 'task': '', 'input': [{'name': 'T3 Ironblood Tech Pack', 'amount': 15}], 'output': [{'name': 'Prototype Twin 130mm Model 1936 Main Gun Mount Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'E-188-MI', 'series': 5, 'time': 21600, 'task': '', 'input': [{'name': 'T3 Eagle Tech Pack', 'amount': 15}], 'output': [{'name': 'Prototype Su-2 Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'E-189-MI', 'series': 5, 'time': 21600, 'task': '', 'input': [{'name': 'T3 Eagle Tech Pack', 'amount': 15}], 'output': [{'name': 'Prototype VIT-2 (VK-107) Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, {'name': 'G-412-MI', 'series': 5, 'time': 5400, 'task': '', 'input': [{'name': 'Coins', 'amount': 1500}], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, {'name': 'G-236-MI', 'series': 5, 'time': 9000, 'task': '', 'input': [{'name': 'Coins', 'amount': 3000}], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, {'name': 'G-531-MI', 'series': 5, 'time': 14400, 'task': '', 'input': [{'name': 'Coins', 'amount': 6000}], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, @@ -252,6 +257,51 @@ LIST_RESEARCH_PROJECT = [ {'name': 'Q-089-MI', 'series': 5, 'time': 14400, 'task': '', 'input': [{'name': 'T3 Aircraft Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, {'name': 'H-387-MI', 'series': 5, 'time': 3600, 'task': '', 'input': [{'name': 'Wisdom Cube', 'amount': 3}], 'output': [{'name': 'Random Blueprint'}, {'name': 'T1 Mystery Retrofit Blueprint'}, {'name': 'Cognitive Chips'}]}, {'name': 'H-339-MI', 'series': 5, 'time': 7200, 'task': '', 'input': [{'name': 'Wisdom Cube', 'amount': 6}], 'output': [{'name': 'Random Blueprint'}, {'name': 'T2 Mystery Retrofit Blueprint'}, {'name': 'Cognitive Chips'}]}, + {'name': 'C-153-MI', 'series': 6, 'time': 21600, 'task': '', 'input': [], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'C-185-MI', 'series': 6, 'time': 28800, 'task': '', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'B-622-MI', 'series': 6, 'time': 14400, 'task': 'Clear Chapter 3 or onward stages for 6 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'B-636-MI', 'series': 6, 'time': 14400, 'task': 'Clear Chapter 4 or onward stages for 6 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'B-654-MI', 'series': 6, 'time': 14400, 'task': 'Clear Chapter 5 or onward stages for 6 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'B-682-MI', 'series': 6, 'time': 14400, 'task': 'Clear Chapter 6 or onward stages for 6 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'B-235-MI', 'series': 6, 'time': 14400, 'task': 'Clear Chapter 7 or onward stages for 5 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'B-268-MI', 'series': 6, 'time': 14400, 'task': 'Clear Chapter 8 or onward stages for 5 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'B-128-MI', 'series': 6, 'time': 14400, 'task': 'Clear Chapter 9 or onward stages for 4 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'B-164-MI', 'series': 6, 'time': 14400, 'task': 'Clear Chapter 10 or onward stages for 4 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'T-018-MI', 'series': 6, 'time': 10800, 'task': 'Complete 2 commissions.', 'input': [], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'T-384-MI', 'series': 6, 'time': 14400, 'task': 'Complete 4 commissions.', 'input': [], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'T-249-MI', 'series': 6, 'time': 21600, 'task': 'Complete 6 commissions.', 'input': [], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'E-031-MI', 'series': 6, 'time': 7200, 'task': 'Scrap 8 pieces of gear.', 'input': [], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'E-315-MI', 'series': 6, 'time': 7200, 'task': 'Scrap 15 pieces of gear.', 'input': [], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'G-412-MI', 'series': 6, 'time': 5400, 'task': '', 'input': [{'name': 'Coins', 'amount': 1500}], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'G-236-MI', 'series': 6, 'time': 9000, 'task': '', 'input': [{'name': 'Coins', 'amount': 3000}], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'G-531-MI', 'series': 6, 'time': 14400, 'task': '', 'input': [{'name': 'Coins', 'amount': 6000}], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-783-MI', 'series': 6, 'time': 9000, 'task': '', 'input': [{'name': 'Coins', 'amount': 3000}], 'output': [{'name': 'Blueprint - Hindenburg'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'D-713-MI', 'series': 6, 'time': 9000, 'task': '', 'input': [{'name': 'Coins', 'amount': 3000}], 'output': [{'name': 'Blueprint - Kearsarge'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'D-739-MI', 'series': 6, 'time': 9000, 'task': '', 'input': [{'name': 'Coins', 'amount': 3000}], 'output': [{'name': 'Blueprint - Shimanto'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'D-771-MI', 'series': 6, 'time': 9000, 'task': '', 'input': [{'name': 'Coins', 'amount': 3000}], 'output': [{'name': 'Blueprint - Felix Schultz'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'D-796-MI', 'series': 6, 'time': 9000, 'task': '', 'input': [{'name': 'Coins', 'amount': 3000}], 'output': [{'name': 'Blueprint - Flandre'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}]}, + {'name': 'D-383-MI', 'series': 6, 'time': 18000, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}], 'output': [{'name': 'Blueprint - Hindenburg'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-313-MI', 'series': 6, 'time': 18000, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}], 'output': [{'name': 'Blueprint - Kearsarge'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-339-MI', 'series': 6, 'time': 18000, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}], 'output': [{'name': 'Blueprint - Shimanto'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-371-MI', 'series': 6, 'time': 18000, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}], 'output': [{'name': 'Blueprint - Felix Schultz'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-396-MI', 'series': 6, 'time': 18000, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}], 'output': [{'name': 'Blueprint - Flandre'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'Q-302-MI', 'series': 6, 'time': 3600, 'task': '', 'input': [{'name': 'T1 General Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'Q-310-MI', 'series': 6, 'time': 3600, 'task': '', 'input': [{'name': 'T1 Main Gun Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'Q-351-MI', 'series': 6, 'time': 3600, 'task': '', 'input': [{'name': 'T1 Torpedo Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'Q-368-MI', 'series': 6, 'time': 3600, 'task': '', 'input': [{'name': 'T1 Anti-Air Gun Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'Q-389-MI', 'series': 6, 'time': 3600, 'task': '', 'input': [{'name': 'T1 Aircraft Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'Q-202-MI', 'series': 6, 'time': 7200, 'task': '', 'input': [{'name': 'T2 General Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'Q-210-MI', 'series': 6, 'time': 7200, 'task': '', 'input': [{'name': 'T2 Main Gun Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'Q-251-MI', 'series': 6, 'time': 7200, 'task': '', 'input': [{'name': 'T2 Torpedo Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'Q-268-MI', 'series': 6, 'time': 7200, 'task': '', 'input': [{'name': 'T2 Anti-Air Gun Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'Q-289-MI', 'series': 6, 'time': 7200, 'task': '', 'input': [{'name': 'T2 Aircraft Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T2'}, {'name': 'Coins'}]}, + {'name': 'Q-002-MI', 'series': 6, 'time': 14400, 'task': '', 'input': [{'name': 'T3 General Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'Q-010-MI', 'series': 6, 'time': 14400, 'task': '', 'input': [{'name': 'T3 Main Gun Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'Q-051-MI', 'series': 6, 'time': 14400, 'task': '', 'input': [{'name': 'T3 Torpedo Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'Q-068-MI', 'series': 6, 'time': 14400, 'task': '', 'input': [{'name': 'T3 Anti-Air Gun Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'Q-089-MI', 'series': 6, 'time': 14400, 'task': '', 'input': [{'name': 'T3 Aircraft Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'H-387-MI', 'series': 6, 'time': 3600, 'task': '', 'input': [{'name': 'Wisdom Cube', 'amount': 3}], 'output': [{'name': 'Random Blueprint'}, {'name': 'T1 Mystery Retrofit Blueprint'}, {'name': 'Cognitive Chips'}]}, + {'name': 'H-339-MI', 'series': 6, 'time': 7200, 'task': '', 'input': [{'name': 'Wisdom Cube', 'amount': 6}], 'output': [{'name': 'Random Blueprint'}, {'name': 'T2 Mystery Retrofit Blueprint'}, {'name': 'Cognitive Chips'}]}, {'name': 'C-038-RF', 'series': 1, 'time': 43200, 'task': '', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, {'name': 'B-351-RF', 'series': 1, 'time': 14400, 'task': 'Clear Chapter 11 or onward stages for 3 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, {'name': 'B-397-RF', 'series': 1, 'time': 14400, 'task': 'Clear Chapter 12 or onward stages for 3 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, @@ -377,4 +427,27 @@ LIST_RESEARCH_PROJECT = [ {'name': 'Q-068-UL', 'series': 5, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'T3 Anti-Air Gun Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, {'name': 'Q-089-UL', 'series': 5, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'T3 Aircraft Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, {'name': 'H-063-UL', 'series': 5, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 8000}, {'name': 'Wisdom Cube', 'amount': 3}], 'output': [{'name': 'Random Blueprint'}, {'name': 'T3 Mystery Retrofit Blueprint'}, {'name': 'Cognitive Chips'}]}, + {'name': 'E-893-MI', 'series': 5, 'time': 7200, 'task': '', 'input': [{'name': 'Quadruple 330mm Main Gun (Mle 1931) T3 Design', 'amount': 45}], 'output': [{'name': 'Prototype Quadruple 330mm Mle 1931 (CB Only) Main Gun Mount Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'E-878-MI', 'series': 5, 'time': 7200, 'task': '', 'input': [{'name': 'T3 Twin 37mm AA 70K Design', 'amount': 45}], 'output': [{'name': 'Prototype Quadruple 30mm AA Gun Mount Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'E-886-MI', 'series': 5, 'time': 7200, 'task': '', 'input': [{'name': 'T3 Single 130mm Main Gun Design', 'amount': 45}], 'output': [{'name': 'Prototype Twin 130mm Model 1936 Main Gun Mount Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'C-038-RF', 'series': 6, 'time': 43200, 'task': '', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}, {'name': 'Coins'}]}, + {'name': 'B-351-RF', 'series': 6, 'time': 14400, 'task': 'Clear Chapter 11 or onward stages for 3 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'B-397-RF', 'series': 6, 'time': 14400, 'task': 'Clear Chapter 12 or onward stages for 3 times on Normal Mode ', 'input': [], 'output': [{'name': 'Random Blueprint'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-483-RF', 'series': 6, 'time': 28800, 'task': '', 'input': [{'name': 'Coins', 'amount': 8000}], 'output': [{'name': 'Blueprint - Hindenburg'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-413-RF', 'series': 6, 'time': 28800, 'task': '', 'input': [{'name': 'Coins', 'amount': 8000}], 'output': [{'name': 'Blueprint - Kearsarge'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-439-RF', 'series': 6, 'time': 28800, 'task': '', 'input': [{'name': 'Coins', 'amount': 8000}], 'output': [{'name': 'Blueprint - Shimanto'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-471-RF', 'series': 6, 'time': 28800, 'task': '', 'input': [{'name': 'Coins', 'amount': 8000}], 'output': [{'name': 'Blueprint - Felix Schultz'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-496-RF', 'series': 6, 'time': 28800, 'task': '', 'input': [{'name': 'Coins', 'amount': 8000}], 'output': [{'name': 'Blueprint - Flandre'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'H-207-RF', 'series': 6, 'time': 14400, 'task': '', 'input': [{'name': 'Wisdom Cube', 'amount': 10}], 'output': [{'name': 'Random Blueprint'}, {'name': 'T3 Mystery Retrofit Blueprint'}, {'name': 'Cognitive Chips'}]}, + {'name': 'D-083-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'Wisdom Cube', 'amount': 5}], 'output': [{'name': 'Blueprint - Hindenburg'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-013-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'Wisdom Cube', 'amount': 5}], 'output': [{'name': 'Blueprint - Kearsarge'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-039-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'Wisdom Cube', 'amount': 5}], 'output': [{'name': 'Blueprint - Shimanto'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-071-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'Wisdom Cube', 'amount': 5}], 'output': [{'name': 'Blueprint - Felix Schultz'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'D-096-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'Wisdom Cube', 'amount': 5}], 'output': [{'name': 'Blueprint - Flandre'}, {'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'Q-002-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'T3 General Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'Q-010-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'T3 Main Gun Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'Q-051-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'T3 Torpedo Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'Q-068-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'T3 Anti-Air Gun Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'Q-089-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 5000}, {'name': 'T3 Aircraft Part', 'amount': 20}], 'output': [{'name': 'Random Gear Design'}, {'name': 'Random Gear Design T3'}]}, + {'name': 'H-063-UL', 'series': 6, 'time': 1800, 'task': '', 'input': [{'name': 'Coins', 'amount': 8000}, {'name': 'Wisdom Cube', 'amount': 3}], 'output': [{'name': 'Random Blueprint'}, {'name': 'T3 Mystery Retrofit Blueprint'}, {'name': 'Cognitive Chips'}]}, ] diff --git a/module/research/research.py b/module/research/research.py index 4f146b651..dfbd35559 100644 --- a/module/research/research.py +++ b/module/research/research.py @@ -12,7 +12,8 @@ from module.research.project import get_research_finished from module.research.rqueue import ResearchQueue from module.research.selector import RESEARCH_ENTRANCE, ResearchSelector from module.storage.storage import StorageHandler -from module.ui.page import * +from module.ui.assets import RESEARCH_CHECK +from module.ui.page import page_research OCR_DURATION = Duration(RESEARCH_LAB_DURATION_REMAIN, letter=(255, 255, 255), threshold=64, name='RESEARCH_LAB_DURATION_REMAIN') diff --git a/module/research/selector.py b/module/research/selector.py index 8bdd0012b..d3c6530a4 100644 --- a/module/research/selector.py +++ b/module/research/selector.py @@ -12,13 +12,14 @@ from module.research.project import research_detect, research_jp_detect from module.research.ui import ResearchUI RESEARCH_ENTRANCE = [ENTRANCE_1, ENTRANCE_2, ENTRANCE_3, ENTRANCE_4, ENTRANCE_5] -FILTER_REGEX = re.compile('(s[12345])?' +FILTER_REGEX = re.compile('(s[123456])?' '-?' '(neptune|monarch|ibuki|izumo|roon|saintlouis' '|seattle|georgia|kitakaze|azuma|friedrich' '|gascogne|champagne|cheshire|drake|mainz|odin' '|anchorage|hakuryu|agir|august|marcopolo' - '|plymouth|rupprecht|harbin|chkalov|brest)?' + '|plymouth|rupprecht|harbin|chkalov|brest' + '|kearsarge|hindenburg|shimanto|schultz|flandre)?' '(dr|pry)?' '([bcdeghqt])?' '-?' diff --git a/module/retire/retirement.py b/module/retire/retirement.py index 3296a817f..11689f0ea 100644 --- a/module/retire/retirement.py +++ b/module/retire/retirement.py @@ -307,6 +307,9 @@ class Retirement(Enhancement, QuickRetireSettingHandler): self.device.screenshot() ships = scanner.scan(self.device.image) + if not ships: + # exit if nothing can be retired + break if keep_one: if len(ships) < 2: break diff --git a/module/reward/reward.py b/module/reward/reward.py index 6c940634d..dd4bde00e 100644 --- a/module/reward/reward.py +++ b/module/reward/reward.py @@ -4,8 +4,9 @@ from module.base.timer import Timer from module.combat.assets import * from module.logger import logger from module.reward.assets import * +from module.ui.assets import MISSION_CHECK from module.ui.navbar import Navbar -from module.ui.page import * +from module.ui.page import page_main, page_mission, page_reward from module.ui.ui import UI diff --git a/module/shipyard/ui.py b/module/shipyard/ui.py index 223846e90..758891326 100644 --- a/module/shipyard/ui.py +++ b/module/shipyard/ui.py @@ -9,6 +9,16 @@ from module.ui.navbar import Navbar from module.ui.ui import UI +class ShipyardNavbar(Navbar): + def is_button_active(self, button, main): + if main.image_color_count(button, color=(33, 113, 222), threshold=221, count=400): + return True + # Color on Odin's shoulder + if main.image_color_count(button, color=(41, 85, 165), threshold=221, count=400): + return True + return False + + class ShipyardUI(UI): def _shipyard_cannot_strengthen(self): """ @@ -168,9 +178,9 @@ class ShipyardUI(UI): Location varies on own's research progress, so users must verify the index for themselves """ - return Navbar(grids=SHIPYARD_FACE_GRID, - active_color=(33, 113, 222), active_threshold=221, active_count=50, - inactive_color=(49, 60, 82), inactive_threshold=221, inactive_count=50) + return ShipyardNavbar( + grids=SHIPYARD_FACE_GRID, + inactive_color=(49, 60, 82), inactive_threshold=221, inactive_count=50) def shipyard_bottom_navbar_ensure(self, left=None, right=None, skip_first_screenshot=True): """ @@ -228,8 +238,8 @@ class ShipyardUI(UI): if series > 2 and index > 5: logger.warning(f'Research Series {series} is limited to indexes 1-5, cannot set focus to index {index}') return False - return self._shipyard_set_series(series, skip_first_screenshot) and \ - self.shipyard_bottom_navbar_ensure(left=index, skip_first_screenshot=skip_first_screenshot) + return self._shipyard_set_series(series, skip_first_screenshot) \ + and self.shipyard_bottom_navbar_ensure(left=index, skip_first_screenshot=skip_first_screenshot) def _shipyard_get_ship(self, skip_first_screenshot=True): """ @@ -334,8 +344,7 @@ class ShipyardUI(UI): continue # End - if success and \ - self._shipyard_in_ui(): + if success and self._shipyard_in_ui(): if confirm_timer.reached(): break else: @@ -348,8 +357,8 @@ class ShipyardUI(UI): Returns: bool whether entered """ - if self.appear(SHIPYARD_RESEARCH_INCOMPLETE, offset=(20, 20)) or \ - self.appear(SHIPYARD_RESEARCH_IN_PROGRESS, offset=(20, 20)): + if self.appear(SHIPYARD_RESEARCH_INCOMPLETE, offset=(20, 20)) \ + or self.appear(SHIPYARD_RESEARCH_IN_PROGRESS, offset=(20, 20)): logger.warning('Cannot enter buy interface, focused ' 'ship has not yet been fully researched') return False diff --git a/module/shop/assets.py b/module/shop/assets.py index 51d5f36bd..961ec2e66 100644 --- a/module/shop/assets.py +++ b/module/shop/assets.py @@ -7,7 +7,7 @@ from module.base.template import Template AMOUNT_MAX = Button(area={'cn': (772, 316, 822, 332), 'en': (772, 316, 822, 332), 'jp': (772, 316, 822, 332), 'tw': (772, 316, 822, 332)}, color={'cn': (148, 178, 225), 'en': (148, 178, 225), 'jp': (148, 178, 225), 'tw': (148, 178, 225)}, button={'cn': (772, 316, 822, 332), 'en': (772, 316, 822, 332), 'jp': (772, 316, 822, 332), 'tw': (772, 316, 822, 332)}, file={'cn': './assets/cn/shop/AMOUNT_MAX.png', 'en': './assets/en/shop/AMOUNT_MAX.png', 'jp': './assets/jp/shop/AMOUNT_MAX.png', 'tw': './assets/tw/shop/AMOUNT_MAX.png'}) AMOUNT_MINUS = Button(area={'cn': (546, 304, 586, 344), 'en': (546, 304, 586, 344), 'jp': (546, 304, 586, 344), 'tw': (546, 304, 586, 344)}, color={'cn': (76, 127, 195), 'en': (76, 127, 195), 'jp': (76, 127, 195), 'tw': (76, 127, 195)}, button={'cn': (546, 304, 586, 344), 'en': (546, 304, 586, 344), 'jp': (546, 304, 586, 344), 'tw': (546, 304, 586, 344)}, file={'cn': './assets/cn/shop/AMOUNT_MINUS.png', 'en': './assets/en/shop/AMOUNT_MINUS.png', 'jp': './assets/jp/shop/AMOUNT_MINUS.png', 'tw': './assets/tw/shop/AMOUNT_MINUS.png'}) AMOUNT_PLUS = Button(area={'cn': (693, 304, 735, 344), 'en': (693, 304, 735, 344), 'jp': (693, 304, 735, 344), 'tw': (693, 304, 735, 344)}, color={'cn': (81, 130, 196), 'en': (81, 130, 196), 'jp': (81, 130, 196), 'tw': (81, 130, 196)}, button={'cn': (693, 304, 735, 344), 'en': (693, 304, 735, 344), 'jp': (693, 304, 735, 344), 'tw': (693, 304, 735, 344)}, file={'cn': './assets/cn/shop/AMOUNT_PLUS.png', 'en': './assets/en/shop/AMOUNT_PLUS.png', 'jp': './assets/jp/shop/AMOUNT_PLUS.png', 'tw': './assets/tw/shop/AMOUNT_PLUS.png'}) -MEDAL_SHOP_SCROLL_AREA = Button(area={'cn': (1261, 138, 1267, 560), 'en': (1261, 138, 1267, 560), 'jp': (1261, 138, 1267, 560), 'tw': (1261, 138, 1267, 560)}, color={'cn': (190, 167, 70), 'en': (190, 167, 70), 'jp': (190, 167, 70), 'tw': (190, 167, 70)}, button={'cn': (1261, 138, 1267, 560), 'en': (1261, 138, 1267, 560), 'jp': (1261, 138, 1267, 560), 'tw': (1261, 138, 1267, 560)}, file={'cn': './assets/cn/shop/MEDAL_SHOP_SCROLL_AREA.png', 'en': './assets/en/shop/MEDAL_SHOP_SCROLL_AREA.png', 'jp': './assets/jp/shop/MEDAL_SHOP_SCROLL_AREA.png', 'tw': './assets/tw/shop/MEDAL_SHOP_SCROLL_AREA.png'}) +MEDAL_SHOP_SCROLL_AREA = Button(area={'cn': (1260, 221, 1266, 643), 'en': (1260, 221, 1266, 643), 'jp': (1260, 221, 1266, 643), 'tw': (1260, 221, 1266, 643)}, color={'cn': (242, 205, 66), 'en': (242, 205, 66), 'jp': (242, 205, 66), 'tw': (242, 205, 66)}, button={'cn': (1260, 221, 1266, 643), 'en': (1260, 221, 1266, 643), 'jp': (1260, 221, 1266, 643), 'tw': (1260, 221, 1266, 643)}, file={'cn': './assets/cn/shop/MEDAL_SHOP_SCROLL_AREA.png', 'en': './assets/en/shop/MEDAL_SHOP_SCROLL_AREA.png', 'jp': './assets/jp/shop/MEDAL_SHOP_SCROLL_AREA.png', 'tw': './assets/tw/shop/MEDAL_SHOP_SCROLL_AREA.png'}) SELECT_MINUS = Button(area={'cn': (562, 201, 588, 227), 'en': (562, 201, 588, 227), 'jp': (562, 201, 588, 227), 'tw': (562, 201, 588, 227)}, color={'cn': (86, 70, 70), 'en': (86, 70, 70), 'jp': (86, 70, 70), 'tw': (86, 70, 70)}, button={'cn': (562, 201, 588, 227), 'en': (562, 201, 588, 227), 'jp': (562, 201, 588, 227), 'tw': (562, 201, 588, 227)}, file={'cn': './assets/cn/shop/SELECT_MINUS.png', 'en': './assets/en/shop/SELECT_MINUS.png', 'jp': './assets/jp/shop/SELECT_MINUS.png', 'tw': './assets/tw/shop/SELECT_MINUS.png'}) SELECT_PLUS = Button(area={'cn': (674, 201, 700, 227), 'en': (674, 201, 700, 227), 'jp': (674, 201, 700, 227), 'tw': (674, 201, 700, 227)}, color={'cn': (97, 70, 70), 'en': (97, 70, 70), 'jp': (97, 70, 70), 'tw': (97, 70, 70)}, button={'cn': (674, 201, 700, 227), 'en': (674, 201, 700, 227), 'jp': (674, 201, 700, 227), 'tw': (674, 201, 700, 227)}, file={'cn': './assets/cn/shop/SELECT_PLUS.png', 'en': './assets/en/shop/SELECT_PLUS.png', 'jp': './assets/jp/shop/SELECT_PLUS.png', 'tw': './assets/tw/shop/SELECT_PLUS.png'}) SHOP_AMOUNT = Button(area={'cn': (600, 310, 680, 340), 'en': (600, 310, 680, 340), 'jp': (600, 310, 680, 340), 'tw': (600, 310, 680, 340)}, color={'cn': (48, 52, 62), 'en': (48, 52, 62), 'jp': (48, 52, 62), 'tw': (48, 52, 62)}, button={'cn': (600, 310, 680, 340), 'en': (600, 310, 680, 340), 'jp': (600, 310, 680, 340), 'tw': (600, 310, 680, 340)}, file={'cn': './assets/cn/shop/SHOP_AMOUNT.png', 'en': './assets/en/shop/SHOP_AMOUNT.png', 'jp': './assets/jp/shop/SHOP_AMOUNT.png', 'tw': './assets/tw/shop/SHOP_AMOUNT.png'}) @@ -16,19 +16,19 @@ SHOP_BUY_CONFIRM_AMOUNT = Button(area={'cn': (729, 602, 800, 633), 'en': (689, 5 SHOP_BUY_CONFIRM_MISTAKE = Button(area={'cn': (590, 300, 612, 318), 'en': (590, 300, 612, 318), 'jp': (590, 300, 612, 318), 'tw': (590, 300, 612, 318)}, color={'cn': (154, 79, 103), 'en': (154, 79, 103), 'jp': (154, 79, 103), 'tw': (154, 79, 103)}, button={'cn': (590, 300, 612, 318), 'en': (590, 300, 612, 318), 'jp': (590, 300, 612, 318), 'tw': (590, 300, 612, 318)}, file={'cn': './assets/cn/shop/SHOP_BUY_CONFIRM_MISTAKE.png', 'en': './assets/en/shop/SHOP_BUY_CONFIRM_MISTAKE.png', 'jp': './assets/jp/shop/SHOP_BUY_CONFIRM_MISTAKE.png', 'tw': './assets/tw/shop/SHOP_BUY_CONFIRM_MISTAKE.png'}) SHOP_BUY_CONFIRM_SELECT = Button(area={'cn': (604, 642, 676, 671), 'en': (567, 630, 712, 675), 'jp': (588, 638, 689, 669), 'tw': (558, 627, 725, 680)}, color={'cn': (236, 191, 130), 'en': (229, 171, 90), 'jp': (230, 170, 89), 'tw': (225, 155, 60)}, button={'cn': (604, 642, 676, 671), 'en': (567, 630, 712, 675), 'jp': (588, 638, 689, 669), 'tw': (558, 627, 725, 680)}, file={'cn': './assets/cn/shop/SHOP_BUY_CONFIRM_SELECT.png', 'en': './assets/en/shop/SHOP_BUY_CONFIRM_SELECT.png', 'jp': './assets/jp/shop/SHOP_BUY_CONFIRM_SELECT.png', 'tw': './assets/tw/shop/SHOP_BUY_CONFIRM_SELECT.png'}) SHOP_CLICK_SAFE_AREA = Button(area={'cn': (108, 108, 143, 233), 'en': (108, 108, 143, 233), 'jp': (108, 108, 143, 233), 'tw': (108, 108, 143, 233)}, color={'cn': (50, 57, 76), 'en': (50, 57, 76), 'jp': (50, 57, 76), 'tw': (50, 57, 76)}, button={'cn': (108, 108, 143, 233), 'en': (108, 108, 143, 233), 'jp': (108, 108, 143, 233), 'tw': (108, 108, 143, 233)}, file={'cn': './assets/cn/shop/SHOP_CLICK_SAFE_AREA.png', 'en': './assets/en/shop/SHOP_CLICK_SAFE_AREA.png', 'jp': './assets/jp/shop/SHOP_CLICK_SAFE_AREA.png', 'tw': './assets/tw/shop/SHOP_CLICK_SAFE_AREA.png'}) -SHOP_CORE = Button(area={'cn': (1161, 71, 1261, 101), 'en': (1161, 71, 1261, 101), 'jp': (1161, 71, 1261, 101), 'tw': (1161, 71, 1261, 101)}, color={'cn': (68, 71, 82), 'en': (68, 71, 82), 'jp': (68, 71, 82), 'tw': (68, 71, 82)}, button={'cn': (1161, 71, 1261, 101), 'en': (1161, 71, 1261, 101), 'jp': (1161, 71, 1261, 101), 'tw': (1161, 71, 1261, 101)}, file={'cn': './assets/cn/shop/SHOP_CORE.png', 'en': './assets/en/shop/SHOP_CORE.png', 'jp': './assets/jp/shop/SHOP_CORE.png', 'tw': './assets/tw/shop/SHOP_CORE.png'}) +SHOP_CORE = Button(area={'cn': (1163, 174, 1261, 198), 'en': (1163, 174, 1261, 198), 'jp': (1163, 174, 1261, 198), 'tw': (1163, 174, 1261, 198)}, color={'cn': (88, 91, 101), 'en': (88, 91, 101), 'jp': (88, 91, 101), 'tw': (88, 91, 101)}, button={'cn': (1163, 174, 1261, 198), 'en': (1163, 174, 1261, 198), 'jp': (1163, 174, 1261, 198), 'tw': (1163, 174, 1261, 198)}, file={'cn': './assets/cn/shop/SHOP_CORE.png', 'en': './assets/en/shop/SHOP_CORE.png', 'jp': './assets/jp/shop/SHOP_CORE.png', 'tw': './assets/tw/shop/SHOP_CORE.png'}) SHOP_CORE_SWIPE_END = Button(area={'cn': (1135, 659, 1216, 678), 'en': (1137, 658, 1182, 676), 'jp': (1093, 660, 1199, 679), 'tw': (1135, 659, 1216, 678)}, color={'cn': (126, 126, 128), 'en': (126, 126, 128), 'jp': (81, 81, 85), 'tw': (126, 126, 128)}, button={'cn': (1135, 659, 1216, 678), 'en': (1137, 658, 1182, 676), 'jp': (1093, 660, 1199, 679), 'tw': (1135, 659, 1216, 678)}, file={'cn': './assets/cn/shop/SHOP_CORE_SWIPE_END.png', 'en': './assets/en/shop/SHOP_CORE_SWIPE_END.png', 'jp': './assets/jp/shop/SHOP_CORE_SWIPE_END.png', 'tw': './assets/cn/shop/SHOP_CORE_SWIPE_END.png'}) SHOP_GEMS = Button(area={'cn': (1035, 23, 1133, 51), 'en': (1035, 23, 1133, 51), 'jp': (1035, 23, 1133, 51), 'tw': (1035, 23, 1133, 51)}, color={'cn': (55, 56, 53), 'en': (55, 56, 53), 'jp': (55, 56, 53), 'tw': (55, 56, 53)}, button={'cn': (1035, 23, 1133, 51), 'en': (1035, 23, 1133, 51), 'jp': (1035, 23, 1133, 51), 'tw': (1035, 23, 1133, 51)}, file={'cn': './assets/cn/shop/SHOP_GEMS.png', 'en': './assets/en/shop/SHOP_GEMS.png', 'jp': './assets/jp/shop/SHOP_GEMS.png', 'tw': './assets/tw/shop/SHOP_GEMS.png'}) SHOP_GIFT_SWIPE_END = Button(area={'cn': (414, 660, 494, 678), 'en': (466, 658, 568, 676), 'jp': (419, 661, 496, 678), 'tw': (414, 660, 494, 678)}, color={'cn': (138, 138, 140), 'en': (125, 126, 129), 'jp': (86, 88, 92), 'tw': (138, 138, 140)}, button={'cn': (414, 660, 494, 678), 'en': (466, 658, 568, 676), 'jp': (419, 661, 496, 678), 'tw': (414, 660, 494, 678)}, file={'cn': './assets/cn/shop/SHOP_GIFT_SWIPE_END.png', 'en': './assets/en/shop/SHOP_GIFT_SWIPE_END.png', 'jp': './assets/jp/shop/SHOP_GIFT_SWIPE_END.png', 'tw': './assets/cn/shop/SHOP_GIFT_SWIPE_END.png'}) SHOP_GOLD_COINS = Button(area={'cn': (815, 23, 922, 51), 'en': (815, 23, 922, 51), 'jp': (815, 23, 922, 51), 'tw': (815, 23, 922, 51)}, color={'cn': (61, 61, 73), 'en': (61, 61, 73), 'jp': (61, 61, 73), 'tw': (61, 61, 73)}, button={'cn': (815, 23, 922, 51), 'en': (815, 23, 922, 51), 'jp': (815, 23, 922, 51), 'tw': (815, 23, 922, 51)}, file={'cn': './assets/cn/shop/SHOP_GOLD_COINS.png', 'en': './assets/en/shop/SHOP_GOLD_COINS.png', 'jp': './assets/jp/shop/SHOP_GOLD_COINS.png', 'tw': './assets/tw/shop/SHOP_GOLD_COINS.png'}) -SHOP_GUILD_COINS = Button(area={'cn': (883, 76, 968, 101), 'en': (883, 76, 968, 101), 'jp': (887, 79, 949, 100), 'tw': (883, 76, 968, 101)}, color={'cn': (88, 91, 100), 'en': (88, 91, 100), 'jp': (110, 112, 120), 'tw': (88, 91, 100)}, button={'cn': (883, 76, 968, 101), 'en': (883, 76, 968, 101), 'jp': (887, 79, 949, 100), 'tw': (883, 76, 968, 101)}, file={'cn': './assets/cn/shop/SHOP_GUILD_COINS.png', 'en': './assets/en/shop/SHOP_GUILD_COINS.png', 'jp': './assets/jp/shop/SHOP_GUILD_COINS.png', 'tw': './assets/tw/shop/SHOP_GUILD_COINS.png'}) -SHOP_MEDAL = Button(area={'cn': (1162, 75, 1257, 105), 'en': (1162, 75, 1257, 105), 'jp': (1162, 75, 1257, 105), 'tw': (1162, 75, 1257, 105)}, color={'cn': (61, 63, 75), 'en': (61, 63, 75), 'jp': (61, 63, 75), 'tw': (61, 63, 75)}, button={'cn': (1162, 75, 1257, 105), 'en': (1162, 75, 1257, 105), 'jp': (1162, 75, 1257, 105), 'tw': (1162, 75, 1257, 105)}, file={'cn': './assets/cn/shop/SHOP_MEDAL.png', 'en': './assets/en/shop/SHOP_MEDAL.png', 'jp': './assets/jp/shop/SHOP_MEDAL.png', 'tw': './assets/tw/shop/SHOP_MEDAL.png'}) +SHOP_GUILD_COINS = Button(area={'cn': (882, 174, 970, 198), 'en': (882, 174, 970, 198), 'jp': (882, 174, 970, 198), 'tw': (882, 174, 970, 198)}, color={'cn': (92, 94, 104), 'en': (92, 94, 104), 'jp': (92, 94, 104), 'tw': (92, 94, 104)}, button={'cn': (882, 174, 970, 198), 'en': (882, 174, 970, 198), 'jp': (882, 174, 970, 198), 'tw': (882, 174, 970, 198)}, file={'cn': './assets/cn/shop/SHOP_GUILD_COINS.png', 'en': './assets/en/shop/SHOP_GUILD_COINS.png', 'jp': './assets/jp/shop/SHOP_GUILD_COINS.png', 'tw': './assets/tw/shop/SHOP_GUILD_COINS.png'}) +SHOP_MEDAL = Button(area={'cn': (1163, 174, 1261, 198), 'en': (1163, 174, 1261, 198), 'jp': (1163, 174, 1261, 198), 'tw': (1163, 174, 1261, 198)}, color={'cn': (88, 91, 101), 'en': (88, 91, 101), 'jp': (88, 91, 101), 'tw': (88, 91, 101)}, button={'cn': (1163, 174, 1261, 198), 'en': (1163, 174, 1261, 198), 'jp': (1163, 174, 1261, 198), 'tw': (1163, 174, 1261, 198)}, file={'cn': './assets/cn/shop/SHOP_MEDAL.png', 'en': './assets/en/shop/SHOP_MEDAL.png', 'jp': './assets/jp/shop/SHOP_MEDAL.png', 'tw': './assets/tw/shop/SHOP_MEDAL.png'}) SHOP_MEDAL_SWIPE_END = Button(area={'cn': (415, 660, 494, 678), 'en': (371, 658, 434, 676), 'jp': (370, 671, 501, 701), 'tw': (412, 670, 497, 686)}, color={'cn': (137, 138, 140), 'en': (128, 130, 131), 'jp': (81, 84, 91), 'tw': (143, 144, 145)}, button={'cn': (415, 660, 494, 678), 'en': (371, 658, 434, 676), 'jp': (370, 671, 501, 701), 'tw': (412, 670, 497, 686)}, file={'cn': './assets/cn/shop/SHOP_MEDAL_SWIPE_END.png', 'en': './assets/en/shop/SHOP_MEDAL_SWIPE_END.png', 'jp': './assets/jp/shop/SHOP_MEDAL_SWIPE_END.png', 'tw': './assets/tw/shop/SHOP_MEDAL_SWIPE_END.png'}) -SHOP_MERIT = Button(area={'cn': (868, 76, 967, 101), 'en': (868, 76, 967, 101), 'jp': (879, 78, 964, 99), 'tw': (868, 76, 967, 101)}, color={'cn': (82, 85, 95), 'en': (82, 85, 95), 'jp': (116, 118, 126), 'tw': (82, 85, 95)}, button={'cn': (868, 76, 967, 101), 'en': (868, 76, 967, 101), 'jp': (879, 78, 964, 99), 'tw': (868, 76, 967, 101)}, file={'cn': './assets/cn/shop/SHOP_MERIT.png', 'en': './assets/en/shop/SHOP_MERIT.png', 'jp': './assets/jp/shop/SHOP_MERIT.png', 'tw': './assets/tw/shop/SHOP_MERIT.png'}) +SHOP_MERIT = Button(area={'cn': (876, 173, 971, 197), 'en': (876, 173, 971, 197), 'jp': (876, 173, 971, 197), 'tw': (876, 173, 971, 197)}, color={'cn': (99, 101, 111), 'en': (99, 101, 111), 'jp': (99, 101, 111), 'tw': (99, 101, 111)}, button={'cn': (876, 173, 971, 197), 'en': (876, 173, 971, 197), 'jp': (876, 173, 971, 197), 'tw': (876, 173, 971, 197)}, file={'cn': './assets/cn/shop/SHOP_MERIT.png', 'en': './assets/en/shop/SHOP_MERIT.png', 'jp': './assets/jp/shop/SHOP_MERIT.png', 'tw': './assets/tw/shop/SHOP_MERIT.png'}) SHOP_MERIT_SWIPE_END = Button(area={'cn': (1135, 660, 1215, 678), 'en': (1131, 658, 1193, 676), 'jp': (1101, 677, 1211, 700), 'tw': (1131, 676, 1217, 694)}, color={'cn': (138, 139, 140), 'en': (119, 119, 122), 'jp': (77, 78, 84), 'tw': (140, 140, 142)}, button={'cn': (1135, 660, 1215, 678), 'en': (1131, 658, 1193, 676), 'jp': (1101, 677, 1211, 700), 'tw': (1131, 676, 1217, 694)}, file={'cn': './assets/cn/shop/SHOP_MERIT_SWIPE_END.png', 'en': './assets/en/shop/SHOP_MERIT_SWIPE_END.png', 'jp': './assets/jp/shop/SHOP_MERIT_SWIPE_END.png', 'tw': './assets/tw/shop/SHOP_MERIT_SWIPE_END.png'}) SHOP_META_SWIPE_END = Button(area={'cn': (394, 661, 494, 677), 'en': (381, 658, 472, 676), 'jp': (377, 663, 477, 678), 'tw': (394, 661, 494, 677)}, color={'cn': (126, 127, 129), 'en': (127, 128, 130), 'jp': (106, 107, 109), 'tw': (126, 127, 129)}, button={'cn': (394, 661, 494, 677), 'en': (381, 658, 472, 676), 'jp': (377, 663, 477, 678), 'tw': (394, 661, 494, 677)}, file={'cn': './assets/cn/shop/SHOP_META_SWIPE_END.png', 'en': './assets/en/shop/SHOP_META_SWIPE_END.png', 'jp': './assets/jp/shop/SHOP_META_SWIPE_END.png', 'tw': './assets/cn/shop/SHOP_META_SWIPE_END.png'}) SHOP_PROTOTYPE_SWIPE_END = Button(area={'cn': (1135, 660, 1215, 678), 'en': (1101, 658, 1215, 676), 'jp': (1097, 660, 1199, 678), 'tw': (1135, 660, 1215, 678)}, color={'cn': (136, 137, 139), 'en': (111, 112, 115), 'jp': (86, 87, 91), 'tw': (136, 137, 139)}, button={'cn': (1135, 660, 1215, 678), 'en': (1101, 658, 1215, 676), 'jp': (1097, 660, 1199, 678), 'tw': (1135, 660, 1215, 678)}, file={'cn': './assets/cn/shop/SHOP_PROTOTYPE_SWIPE_END.png', 'en': './assets/en/shop/SHOP_PROTOTYPE_SWIPE_END.png', 'jp': './assets/jp/shop/SHOP_PROTOTYPE_SWIPE_END.png', 'tw': './assets/cn/shop/SHOP_PROTOTYPE_SWIPE_END.png'}) -SHOP_REFRESH = Button(area={'cn': (1160, 66, 1269, 110), 'en': (1165, 71, 1264, 105), 'jp': (1185, 72, 1246, 101), 'tw': (1162, 68, 1267, 108)}, color={'cn': (181, 144, 86), 'en': (192, 146, 88), 'jp': (205, 161, 108), 'tw': (175, 135, 78)}, button={'cn': (1160, 66, 1269, 110), 'en': (1165, 71, 1264, 105), 'jp': (1185, 72, 1246, 101), 'tw': (1162, 68, 1267, 108)}, file={'cn': './assets/cn/shop/SHOP_REFRESH.png', 'en': './assets/en/shop/SHOP_REFRESH.png', 'jp': './assets/jp/shop/SHOP_REFRESH.png', 'tw': './assets/tw/shop/SHOP_REFRESH.png'}) +SHOP_REFRESH = Button(area={'cn': (1161, 162, 1270, 206), 'en': (1161, 162, 1270, 206), 'jp': (1161, 162, 1270, 206), 'tw': (1161, 162, 1270, 206)}, color={'cn': (180, 143, 86), 'en': (181, 141, 82), 'jp': (178, 142, 84), 'tw': (179, 143, 88)}, button={'cn': (1161, 162, 1270, 206), 'en': (1161, 162, 1270, 206), 'jp': (1161, 162, 1270, 206), 'tw': (1161, 162, 1270, 206)}, file={'cn': './assets/cn/shop/SHOP_REFRESH.png', 'en': './assets/en/shop/SHOP_REFRESH.png', 'jp': './assets/jp/shop/SHOP_REFRESH.png', 'tw': './assets/tw/shop/SHOP_REFRESH.png'}) SHOP_SELECT_PR1 = Button(area={'cn': (182, 212, 308, 339), 'en': (182, 212, 308, 339), 'jp': (182, 212, 308, 339), 'tw': (182, 212, 308, 339)}, color={'cn': (157, 158, 143), 'en': (157, 158, 143), 'jp': (157, 158, 143), 'tw': (157, 158, 143)}, button={'cn': (182, 212, 308, 339), 'en': (182, 212, 308, 339), 'jp': (182, 212, 308, 339), 'tw': (182, 212, 308, 339)}, file={'cn': './assets/cn/shop/SHOP_SELECT_PR1.png', 'en': './assets/en/shop/SHOP_SELECT_PR1.png', 'jp': './assets/jp/shop/SHOP_SELECT_PR1.png', 'tw': './assets/tw/shop/SHOP_SELECT_PR1.png'}) SHOP_SELECT_PR2 = Button(area={'cn': (182, 212, 310, 340), 'en': (182, 212, 310, 340), 'jp': (182, 212, 310, 340), 'tw': (182, 212, 310, 340)}, color={'cn': (160, 159, 145), 'en': (160, 159, 145), 'jp': (160, 159, 145), 'tw': (160, 159, 145)}, button={'cn': (182, 212, 310, 340), 'en': (182, 212, 310, 340), 'jp': (182, 212, 310, 340), 'tw': (182, 212, 310, 340)}, file={'cn': './assets/cn/shop/SHOP_SELECT_PR2.png', 'en': './assets/en/shop/SHOP_SELECT_PR2.png', 'jp': './assets/jp/shop/SHOP_SELECT_PR2.png', 'tw': './assets/tw/shop/SHOP_SELECT_PR2.png'}) SHOP_SELECT_PR3 = Button(area={'cn': (180, 212, 309, 340), 'en': (180, 212, 309, 340), 'jp': (180, 212, 309, 340), 'tw': (180, 212, 309, 340)}, color={'cn': (156, 156, 142), 'en': (156, 156, 142), 'jp': (156, 156, 142), 'tw': (156, 156, 142)}, button={'cn': (180, 212, 309, 340), 'en': (180, 212, 309, 340), 'jp': (180, 212, 309, 340), 'tw': (180, 212, 309, 340)}, file={'cn': './assets/cn/shop/SHOP_SELECT_PR3.png', 'en': './assets/en/shop/SHOP_SELECT_PR3.png', 'jp': './assets/jp/shop/SHOP_SELECT_PR3.png', 'tw': './assets/tw/shop/SHOP_SELECT_PR3.png'}) diff --git a/module/shop/base.py b/module/shop/base.py index e681f6733..ad3a26e16 100644 --- a/module/shop/base.py +++ b/module/shop/base.py @@ -1,7 +1,7 @@ import re from module.base.button import ButtonGrid -from module.base.decorator import cached_property +from module.base.decorator import cached_property, Config from module.base.filter import Filter from module.base.timer import Timer from module.combat.assets import GET_ITEMS_1, GET_SHIP, GET_ITEMS_3 @@ -103,7 +103,7 @@ class ShopBase(UI): ButtonGrid: """ shop_grid = ButtonGrid( - origin=(477, 152), delta=(156, 214), button_shape=(96, 96), grid_shape=(5, 2), name='SHOP_GRID') + origin=(476, 246), delta=(156, 213), button_shape=(98, 98), grid_shape=(5, 2), name='SHOP_GRID') return shop_grid def shop_items(self): diff --git a/module/shop/shop_general.py b/module/shop/shop_general.py index 39b5bb2fe..d7dad510d 100644 --- a/module/shop/shop_general.py +++ b/module/shop/shop_general.py @@ -68,19 +68,21 @@ class GeneralShop(ShopClerk, ShopUI, ShopStatus): logger.warning('Failed to handle fix currency bug in general shop, skip') break - if self._currency == 0 and self.gems == 0: - logger.info('Game bugged, coins and gems disappeared, switch between shops to reset') - self.currency_rechecked += 1 - - # 2022.06.01 General shop no longer at an expected location - # NavBar 'get_active' (0 index-based) and swap with its left - # adjacent neighbor then back (NavBar 'set' is 1 index-based) - index = self._shop_bottom_navbar.get_active(self) - self.shop_bottom_navbar_ensure(left=index) - self.shop_bottom_navbar_ensure(left=index + 1) - continue - else: - break + # if self._currency == 0 and self.gems == 0: + # logger.info('Game bugged, coins and gems disappeared, switch between shops to reset') + # self.currency_rechecked += 1 + # + # # 2022.06.01 General shop no longer at an expected location + # # NavBar 'get_active' (0 index-based) and swap with its left + # # adjacent neighbor then back (NavBar 'set' is 1 index-based) + # index = self._shop_bottom_navbar.get_active(self) + # self.shop_bottom_navbar_ensure(left=index) + # self.shop_bottom_navbar_ensure(left=index + 1) + # continue + # else: + # break + # 2023.07.13 Shop UI changed entirely, remove all these + break return self._currency diff --git a/module/shop/shop_medal.py b/module/shop/shop_medal.py index be7addb3e..0ed444f9e 100644 --- a/module/shop/shop_medal.py +++ b/module/shop/shop_medal.py @@ -1,5 +1,5 @@ from module.base.button import ButtonGrid -from module.base.decorator import cached_property, del_cached_property +from module.base.decorator import cached_property, del_cached_property, Config from module.base.timer import Timer from module.logger import logger from module.map_detection.utils import Points @@ -11,6 +11,8 @@ from module.shop.shop_status import ShopStatus from module.ui.scroll import Scroll MEDAL_SHOP_SCROLL = Scroll(MEDAL_SHOP_SCROLL_AREA, color=(247, 211, 66)) +MEDAL_SHOP_SCROLL.edge_threshold = 0.15 +MEDAL_SHOP_SCROLL.drag_threshold = 0.15 class ShopPriceOcr(DigitYuv): @@ -24,6 +26,7 @@ class ShopPriceOcr(DigitYuv): PRICE_OCR = ShopPriceOcr([], letter=(255, 223, 57), threshold=32, name='Price_ocr') TEMPLATE_MEDAL_ICON = Template('./assets/shop/cost/Medal.png') +TEMPLATE_MEDAL_ICON_2 = Template('./assets/shop/cost/Medal_2.png') class MedalShop2(ShopClerk, ShopStatus): @@ -40,8 +43,8 @@ class MedalShop2(ShopClerk, ShopStatus): Returns: np.array: [[x1, y1], [x2, y2]], location of the medal icon upper-left corner. """ - left_column = self.image_crop((489, 256, 1120, 572)) - medals = TEMPLATE_MEDAL_ICON.match_multi(left_column, similarity=0.5, threshold=5) + left_column = self.image_crop((472, 348, 1170, 648)) + medals = TEMPLATE_MEDAL_ICON_2.match_multi(left_column, similarity=0.5, threshold=5) medals = Points([(0., m.area[1]) for m in medals]).group(threshold=5) logger.attr('Medals_icon', len(medals)) return medals @@ -68,6 +71,10 @@ class MedalShop2(ShopClerk, ShopStatus): @cached_property def shop_grid(self): + return self.shop_medal_grid() + + @Config.when(SERVER='tw') + def shop_medal_grid(self): """ Returns: ButtonGrid: @@ -106,6 +113,47 @@ class MedalShop2(ShopClerk, ShopStatus): origin=(477, origin_y), delta=(156, delta_y), button_shape=(96, 96), grid_shape=(5, row), name='SHOP_GRID') return shop_grid + @Config.when(SERVER=None) + def shop_medal_grid(self): + """ + Returns: + ButtonGrid: + """ + # (472, 348, 1170, 648) + medals = self._get_medals() + count = len(medals) + if count == 0: + logger.warning('Unable to find medal icon, assume item list is at top') + origin_y = 246 + delta_y = 213 + row = 2 + elif count == 1: + y_list = medals[:, 1] + # +256, top of the crop area in _get_medals() + # -125, from the top of medal icon to the top of shop item + origin_y = y_list[0] + 348 - 127 + delta_y = 213 + row = 1 + elif count == 2: + y_list = medals[:, 1] + y1, y2 = y_list[0], y_list[1] + origin_y = min(y1, y2) + 348 - 127 + delta_y = abs(y1 - y2) + row = 2 + else: + logger.warning(f'Unexpected medal icon match result: {[m.area for m in medals]}') + origin_y = 246 + delta_y = 213 + row = 2 + + # Make up a ButtonGrid + # Original grid is: + # shop_grid = ButtonGrid( + # origin=(476, 246), delta=(156, 213), button_shape=(98, 98), grid_shape=(5, 2), name='SHOP_GRID') + shop_grid = ButtonGrid( + origin=(476, origin_y), delta=(156, delta_y), button_shape=(98, 98), grid_shape=(5, row), name='SHOP_GRID') + return shop_grid + shop_template_folder = './assets/shop/medal' @cached_property diff --git a/module/shop/shop_reward.py b/module/shop/shop_reward.py index 682cb6074..470073bcf 100644 --- a/module/shop/shop_reward.py +++ b/module/shop/shop_reward.py @@ -1,5 +1,4 @@ from module.base.decorator import Config -from module.logger import logger from module.shop.shop_core import CoreShop from module.shop.shop_general import GeneralShop from module.shop.shop_guild import GuildShop @@ -13,65 +12,30 @@ class RewardShop(ShopUI): # Munitions shops self.ui_goto_shop() + self.shop_tab.set(main=self, left=2) + self.shop_nav.set(main=self, upper=1) GeneralShop(self.config, self.device).run() self.config.task_delay(server_update=True) - @Config.when(SERVER='tw') - def run_once(self): - # Munitions shops - self.ui_goto_shop() - self.shop_swipe() - - if self.shop_bottom_navbar_ensure(left=5): - MeritShop(self.config, self.device).run() - - if self.shop_bottom_navbar_ensure(left=4): - CoreShop(self.config, self.device).run() - - if self.shop_bottom_navbar_ensure(left=2): - GuildShop(self.config, self.device).run() - - # 2022.06.01 Medal shop has been moved to page_munitions - # Now the left most shop, its UI has changed considerably - if self.shop_bottom_navbar_ensure(left=1): - MedalShop2(self.config, self.device).run() - - # Cannot go back to general shop so don't stay in page_munitions - self.ui_goto_main() - self.config.task_delay(server_update=True) - - @Config.when(SERVER=None) def run_once(self): # Munitions shops self.ui_goto_shop() - current = self._shop_bottom_navbar.get_active(main=self) - logger.info(f'Shop nav actives at left={current}') + self.shop_tab.set(main=self, left=2) + self.shop_nav.set(main=self, upper=2) + MeritShop(self.config, self.device).run() - if current is not None: - current += 1 - # core_monthly, core, merit, general, event - # core, merit, general, event, event (2 event shops sometimes) - if self.shop_bottom_navbar_ensure(left=current - 1): - MeritShop(self.config, self.device).run() - if current - 3 >= 1: - if self.shop_bottom_navbar_ensure(left=current - 3): - CoreShop(self.config, self.device).run() - else: - logger.warning('Cannot navigate to core shop, skip') - else: - logger.error('Cannot get the position of general shop, skip merit shop and core shop') + self.shop_tab.set(main=self, left=2) + self.shop_nav.set(main=self, upper=3) + GuildShop(self.config, self.device).run() - self.shop_swipe() - # gift, meta, medal, guild, prototype - # meta, gift, medal, guild, prototype [EN] - if self.shop_bottom_navbar_ensure(left=4): - GuildShop(self.config, self.device).run() + self.shop_tab.set(main=self, left=1) + self.shop_nav.set(main=self, upper=2) + CoreShop(self.config, self.device).run() - if self.shop_bottom_navbar_ensure(left=3): - MedalShop2(self.config, self.device).run() + self.shop_tab.set(main=self, left=1) + self.shop_nav.set(main=self, upper=3) + MedalShop2(self.config, self.device).run() - # Cannot go back to general shop so don't stay in page_munitions - self.ui_goto_main() self.config.task_delay(server_update=True) diff --git a/module/shop/ui.py b/module/shop/ui.py index 1d5c5c6f1..78c52af7d 100644 --- a/module/shop/ui.py +++ b/module/shop/ui.py @@ -50,6 +50,54 @@ class ShopUI(UI): return True return False + @cached_property + def shop_tab(self): + """ + Set with `self.shop_tab.set(main=self, left={index})` + - index + 1: Monthly shops + 2: General supply shops + """ + grids = ButtonGrid( + origin=(340, 93), delta=(189, 0), + button_shape=(188, 54), grid_shape=(2, 1), + name='SHOP_TAB') + return Navbar( + grids=grids, + # Yellow bottom dash + active_color=(255, 219, 83), active_threshold=221, active_count=100, + # Black bottom dash + inactive_color=(181, 178, 181), inactive_threshold=221, inactive_count=100, + ) + + @cached_property + def shop_nav(self): + """ + Set with `self.shop_nav.set(main=self, upper={index})` + - index when `shop_tab` is at 1 + 1: Core shop (limited items) + 2: Core shop monthly + 3: Medal shop + 4: Prototype shop + - index when `shop_tab` is at 2 + 1: General shop + 2: Merit shop + 3: Guild shop + 4: Meta shop + 5: Gift shop + """ + grids = ButtonGrid( + origin=(339, 217), delta=(0, 65), + button_shape=(15, 64), grid_shape=(1, 5), + name='SHOP_NAV') + return Navbar( + grids=grids, + # White vertical line to the left of shop names + active_color=(255, 255, 255), active_threshold=221, active_count=100, + # Just whatever to make it match + inactive_color=(49, 56, 82), inactive_threshold=0, inactive_count=100, + ) + def shop_refresh(self, skip_first_screenshot=True): """ Args: @@ -170,6 +218,10 @@ class ShopUI(UI): in: Any out: page_munitions """ + if self.ui_get_current_page() == page_munitions: + logger.info(f'Already at {page_munitions}') + return + self.ui_ensure(page_academy) skip_first_screenshot = True diff --git a/module/tactical/tactical_class.py b/module/tactical/tactical_class.py index e69f196ee..dcbec2f20 100644 --- a/module/tactical/tactical_class.py +++ b/module/tactical/tactical_class.py @@ -18,7 +18,7 @@ from module.tactical.assets import * from module.ui.assets import (BACK_ARROW, MAIN_GOTO_REWARD, REWARD_GOTO_TACTICAL, REWARD_CHECK, TACTICAL_CHECK) -from module.ui.ui import page_reward +from module.ui.page import page_reward SKILL_GRIDS = ButtonGrid(origin=(315, 140), delta=(621, 132), button_shape=(621, 119), grid_shape=(1, 3), name='SKILL') SKILL_LEVEL_GRIDS = SKILL_GRIDS.crop(area=(406, 98, 618, 116), name='EXP') diff --git a/module/ui/assets.py b/module/ui/assets.py index 108b05490..f21d1a08c 100644 --- a/module/ui/assets.py +++ b/module/ui/assets.py @@ -58,7 +58,7 @@ MEOWFFICER_GOTO_DORMMENU = Button(area={'cn': (24, 7, 49, 45), 'en': (24, 7, 49, MEOWFFICER_INFO = Button(area={'cn': (1090, 603, 1241, 650), 'en': (1106, 616, 1227, 638), 'jp': (1089, 608, 1240, 647), 'tw': (1124, 610, 1207, 647)}, color={'cn': (243, 214, 92), 'en': (212, 182, 77), 'jp': (247, 218, 92), 'tw': (229, 200, 87)}, button={'cn': (1090, 603, 1241, 650), 'en': (1106, 616, 1227, 638), 'jp': (1089, 608, 1240, 647), 'tw': (1124, 610, 1207, 647)}, file={'cn': './assets/cn/ui/MEOWFFICER_INFO.png', 'en': './assets/en/ui/MEOWFFICER_INFO.png', 'jp': './assets/jp/ui/MEOWFFICER_INFO.png', 'tw': './assets/tw/ui/MEOWFFICER_INFO.png'}) META_CHECK = Button(area={'cn': (120, 14, 209, 35), 'en': (148, 13, 265, 36), 'jp': (125, 11, 235, 39), 'tw': (120, 14, 209, 35)}, color={'cn': (159, 143, 144), 'en': (170, 156, 156), 'jp': (124, 105, 106), 'tw': (159, 143, 144)}, button={'cn': (120, 14, 209, 35), 'en': (148, 13, 265, 36), 'jp': (125, 11, 235, 39), 'tw': (120, 14, 209, 35)}, file={'cn': './assets/cn/ui/META_CHECK.png', 'en': './assets/en/ui/META_CHECK.png', 'jp': './assets/jp/ui/META_CHECK.png', 'tw': './assets/tw/ui/META_CHECK.png'}) MISSION_CHECK = Button(area={'cn': (120, 15, 173, 40), 'en': (123, 18, 221, 37), 'jp': (120, 14, 173, 40), 'tw': (119, 12, 176, 42)}, color={'cn': (141, 156, 194), 'en': (104, 117, 158), 'jp': (150, 165, 202), 'tw': (125, 139, 178)}, button={'cn': (120, 15, 173, 40), 'en': (123, 18, 221, 37), 'jp': (120, 14, 173, 40), 'tw': (119, 12, 176, 42)}, file={'cn': './assets/cn/ui/MISSION_CHECK.png', 'en': './assets/en/ui/MISSION_CHECK.png', 'jp': './assets/jp/ui/MISSION_CHECK.png', 'tw': './assets/tw/ui/MISSION_CHECK.png'}) -MUNITIONS_CHECK = Button(area={'cn': (121, 14, 230, 39), 'en': (115, 16, 235, 36), 'jp': (133, 14, 189, 39), 'tw': (117, 12, 232, 41)}, color={'cn': (151, 165, 203), 'en': (112, 126, 165), 'jp': (160, 176, 211), 'tw': (133, 148, 188)}, button={'cn': (121, 14, 230, 39), 'en': (115, 16, 235, 36), 'jp': (133, 14, 189, 39), 'tw': (117, 12, 232, 41)}, file={'cn': './assets/cn/ui/MUNITIONS_CHECK.png', 'en': './assets/en/ui/MUNITIONS_CHECK.png', 'jp': './assets/jp/ui/MUNITIONS_CHECK.png', 'tw': './assets/tw/ui/MUNITIONS_CHECK.png'}) +MUNITIONS_CHECK = Button(area={'cn': (32, 621, 86, 647), 'en': (25, 622, 85, 644), 'jp': (23, 625, 80, 645), 'tw': (31, 619, 88, 649)}, color={'cn': (151, 147, 147), 'en': (174, 171, 171), 'jp': (99, 91, 91), 'tw': (127, 121, 121)}, button={'cn': (32, 621, 86, 647), 'en': (25, 622, 85, 644), 'jp': (23, 625, 80, 645), 'tw': (31, 619, 88, 649)}, file={'cn': './assets/cn/ui/MUNITIONS_CHECK.png', 'en': './assets/en/ui/MUNITIONS_CHECK.png', 'jp': './assets/jp/ui/MUNITIONS_CHECK.png', 'tw': './assets/tw/ui/MUNITIONS_CHECK.png'}) OS_CHECK = Button(area={'cn': (613, 17, 627, 34), 'en': (613, 17, 627, 34), 'jp': (613, 17, 627, 34), 'tw': (613, 17, 627, 34)}, color={'cn': (58, 117, 146), 'en': (58, 117, 146), 'jp': (58, 117, 146), 'tw': (58, 117, 146)}, button={'cn': (613, 17, 627, 34), 'en': (613, 17, 627, 34), 'jp': (613, 17, 627, 34), 'tw': (613, 17, 627, 34)}, file={'cn': './assets/cn/ui/OS_CHECK.png', 'en': './assets/en/ui/OS_CHECK.png', 'jp': './assets/jp/ui/OS_CHECK.png', 'tw': './assets/tw/ui/OS_CHECK.png'}) PLAYER_CHECK = Button(area={'cn': (28, 668, 139, 688), 'en': (11, 649, 157, 705), 'jp': (26, 668, 139, 689), 'tw': (28, 668, 139, 688)}, color={'cn': (237, 204, 127), 'en': (197, 156, 97), 'jp': (237, 205, 128), 'tw': (237, 204, 127)}, button={'cn': (28, 668, 139, 688), 'en': (11, 649, 157, 705), 'jp': (26, 668, 139, 689), 'tw': (28, 668, 139, 688)}, file={'cn': './assets/cn/ui/PLAYER_CHECK.png', 'en': './assets/en/ui/PLAYER_CHECK.png', 'jp': './assets/jp/ui/PLAYER_CHECK.png', 'tw': './assets/tw/ui/PLAYER_CHECK.png'}) RAID_CHECK = Button(area={'cn': (117, 13, 226, 39), 'en': (116, 15, 197, 34), 'jp': (113, 10, 229, 41), 'tw': (116, 18, 231, 46)}, color={'cn': (153, 174, 162), 'en': (115, 135, 121), 'jp': (138, 158, 146), 'tw': (180, 176, 165)}, button={'cn': (117, 13, 226, 39), 'en': (116, 15, 197, 34), 'jp': (113, 10, 229, 41), 'tw': (116, 18, 231, 46)}, file={'cn': './assets/cn/ui/RAID_CHECK.png', 'en': './assets/en/ui/RAID_CHECK.png', 'jp': './assets/jp/ui/RAID_CHECK.png', 'tw': './assets/tw/ui/RAID_CHECK.png'}) @@ -73,9 +73,9 @@ REWARD_GOTO_COMMISSION = Button(area={'cn': (418, 271, 468, 293), 'en': (428, 27 REWARD_GOTO_MAIN = Button(area={'cn': (219, 107, 267, 158), 'en': (219, 107, 267, 158), 'jp': (219, 107, 267, 158), 'tw': (219, 107, 267, 158)}, color={'cn': (143, 116, 123), 'en': (143, 116, 123), 'jp': (143, 116, 123), 'tw': (143, 116, 123)}, button={'cn': (1037, 611, 1107, 656), 'en': (1037, 612, 1107, 657), 'jp': (1037, 611, 1107, 656), 'tw': (1037, 611, 1107, 656)}, file={'cn': './assets/cn/ui/REWARD_GOTO_MAIN.png', 'en': './assets/en/ui/REWARD_GOTO_MAIN.png', 'jp': './assets/jp/ui/REWARD_GOTO_MAIN.png', 'tw': './assets/tw/ui/REWARD_GOTO_MAIN.png'}) REWARD_GOTO_TACTICAL = Button(area={'cn': (418, 413, 468, 434), 'en': (428, 413, 457, 431), 'jp': (418, 413, 468, 434), 'tw': (418, 413, 468, 435)}, color={'cn': (143, 176, 216), 'en': (165, 192, 223), 'jp': (143, 175, 213), 'tw': (141, 175, 215)}, button={'cn': (383, 404, 503, 444), 'en': (385, 404, 502, 444), 'jp': (383, 404, 503, 444), 'tw': (383, 404, 503, 444)}, file={'cn': './assets/cn/ui/REWARD_GOTO_TACTICAL.png', 'en': './assets/en/ui/REWARD_GOTO_TACTICAL.png', 'jp': './assets/jp/ui/REWARD_GOTO_TACTICAL.png', 'tw': './assets/tw/ui/REWARD_GOTO_TACTICAL.png'}) SHIPYARD_CHECK = Button(area={'cn': (9, 131, 82, 148), 'en': (4, 126, 52, 141), 'jp': (8, 130, 82, 148), 'tw': (7, 130, 83, 150)}, color={'cn': (159, 180, 229), 'en': (133, 148, 171), 'jp': (152, 169, 202), 'tw': (142, 164, 219)}, button={'cn': (9, 131, 82, 148), 'en': (4, 126, 52, 141), 'jp': (8, 130, 82, 148), 'tw': (7, 130, 83, 150)}, file={'cn': './assets/cn/ui/SHIPYARD_CHECK.png', 'en': './assets/en/ui/SHIPYARD_CHECK.png', 'jp': './assets/jp/ui/SHIPYARD_CHECK.png', 'tw': './assets/tw/ui/SHIPYARD_CHECK.png'}) -SHOP_CHECK = Button(area={'cn': (121, 14, 174, 39), 'en': (124, 15, 197, 37), 'jp': (121, 14, 229, 39), 'tw': (121, 14, 175, 40)}, color={'cn': (160, 176, 213), 'en': (118, 133, 173), 'jp': (86, 98, 132), 'tw': (154, 170, 207)}, button={'cn': (121, 14, 174, 39), 'en': (124, 15, 197, 37), 'jp': (121, 14, 229, 39), 'tw': (121, 14, 175, 40)}, file={'cn': './assets/cn/ui/SHOP_CHECK.png', 'en': './assets/en/ui/SHOP_CHECK.png', 'jp': './assets/jp/ui/SHOP_CHECK.png', 'tw': './assets/tw/ui/SHOP_CHECK.png'}) +SHOP_CHECK = Button(area={'cn': (93, 504, 134, 544), 'en': (102, 512, 172, 548), 'jp': (93, 504, 134, 544), 'tw': (148, 620, 176, 648)}, color={'cn': (194, 204, 222), 'en': (159, 178, 205), 'jp': (185, 196, 217), 'tw': (129, 139, 155)}, button={'cn': (93, 504, 134, 544), 'en': (102, 512, 172, 548), 'jp': (93, 504, 134, 544), 'tw': (148, 620, 176, 648)}, file={'cn': './assets/cn/ui/SHOP_CHECK.png', 'en': './assets/en/ui/SHOP_CHECK.png', 'jp': './assets/jp/ui/SHOP_CHECK.png', 'tw': './assets/tw/ui/SHOP_CHECK.png'}) SHOP_GOTO_MUNITIONS = Button(area={'cn': (840, 560, 999, 600), 'en': (840, 560, 999, 600), 'jp': (836, 570, 964, 613), 'tw': (840, 560, 999, 600)}, color={'cn': (122, 87, 75), 'en': (122, 87, 75), 'jp': (118, 88, 83), 'tw': (122, 87, 75)}, button={'cn': (840, 560, 999, 600), 'en': (840, 560, 999, 600), 'jp': (836, 570, 964, 613), 'tw': (840, 560, 999, 600)}, file={'cn': './assets/cn/ui/SHOP_GOTO_MUNITIONS.png', 'en': './assets/en/ui/SHOP_GOTO_MUNITIONS.png', 'jp': './assets/jp/ui/SHOP_GOTO_MUNITIONS.png', 'tw': './assets/tw/ui/SHOP_GOTO_MUNITIONS.png'}) -SHOP_GOTO_SUPPLY_PACK = Button(area={'cn': (884, 341, 930, 383), 'en': (864, 344, 920, 412), 'jp': (876, 345, 939, 386), 'tw': (884, 341, 930, 383)}, color={'cn': (197, 131, 140), 'en': (140, 116, 79), 'jp': (183, 125, 104), 'tw': (197, 131, 140)}, button={'cn': (812, 158, 987, 440), 'en': (819, 173, 979, 433), 'jp': (814, 178, 986, 413), 'tw': (812, 158, 987, 440)}, file={'cn': './assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.png', 'en': './assets/en/ui/SHOP_GOTO_SUPPLY_PACK.png', 'jp': './assets/jp/ui/SHOP_GOTO_SUPPLY_PACK.png', 'tw': './assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.png'}) +SHOP_GOTO_SUPPLY_PACK = Button(area={'cn': (883, 537, 929, 579), 'en': (883, 537, 929, 579), 'jp': (883, 537, 929, 579), 'tw': (883, 537, 929, 579)}, color={'cn': (197, 131, 140), 'en': (197, 131, 140), 'jp': (197, 131, 140), 'tw': (197, 131, 140)}, button={'cn': (810, 353, 987, 638), 'en': (810, 353, 987, 638), 'jp': (810, 353, 987, 638), 'tw': (810, 353, 987, 638)}, file={'cn': './assets/cn/ui/SHOP_GOTO_SUPPLY_PACK.png', 'en': './assets/en/ui/SHOP_GOTO_SUPPLY_PACK.png', 'jp': './assets/jp/ui/SHOP_GOTO_SUPPLY_PACK.png', 'tw': './assets/tw/ui/SHOP_GOTO_SUPPLY_PACK.png'}) SP_CHECK = Button(area={'cn': (123, 63, 206, 109), 'en': (123, 63, 206, 109), 'jp': (125, 66, 205, 107), 'tw': (123, 63, 206, 109)}, color={'cn': (95, 110, 145), 'en': (95, 110, 145), 'jp': (78, 92, 127), 'tw': (95, 110, 145)}, button={'cn': (123, 63, 206, 109), 'en': (123, 63, 206, 109), 'jp': (125, 66, 205, 107), 'tw': (123, 63, 206, 109)}, file={'cn': './assets/cn/ui/SP_CHECK.png', 'en': './assets/en/ui/SP_CHECK.png', 'jp': './assets/jp/ui/SP_CHECK.png', 'tw': './assets/tw/ui/SP_CHECK.png'}) STORAGE_CHECK = Button(area={'cn': (120, 14, 175, 40), 'en': (123, 14, 209, 36), 'jp': (121, 13, 176, 41), 'tw': (120, 14, 175, 40)}, color={'cn': (137, 151, 188), 'en': (119, 133, 174), 'jp': (137, 156, 196), 'tw': (137, 151, 188)}, button={'cn': (120, 14, 175, 40), 'en': (123, 14, 209, 36), 'jp': (121, 13, 176, 41), 'tw': (120, 14, 175, 40)}, file={'cn': './assets/cn/ui/STORAGE_CHECK.png', 'en': './assets/en/ui/STORAGE_CHECK.png', 'jp': './assets/jp/ui/STORAGE_CHECK.png', 'tw': './assets/cn/ui/STORAGE_CHECK.png'}) SUPPLY_PACK_CHECK = Button(area={'cn': (123, 14, 230, 38), 'en': (123, 15, 209, 37), 'jp': (127, 14, 261, 40), 'tw': (121, 14, 230, 40)}, color={'cn': (145, 161, 200), 'en': (117, 131, 170), 'jp': (110, 124, 161), 'tw': (152, 168, 206)}, button={'cn': (123, 14, 230, 38), 'en': (123, 15, 209, 37), 'jp': (127, 14, 261, 40), 'tw': (121, 14, 230, 40)}, file={'cn': './assets/cn/ui/SUPPLY_PACK_CHECK.png', 'en': './assets/en/ui/SUPPLY_PACK_CHECK.png', 'jp': './assets/jp/ui/SUPPLY_PACK_CHECK.png', 'tw': './assets/tw/ui/SUPPLY_PACK_CHECK.png'}) diff --git a/module/ui/navbar.py b/module/ui/navbar.py index c9f57fdd2..3a64d581d 100644 --- a/module/ui/navbar.py +++ b/module/ui/navbar.py @@ -29,6 +29,30 @@ class Navbar: self.inactive_count = inactive_count self.name = name if name is not None else grids._name + def is_button_active(self, button, main): + """ + Args: + button (Button): + main (ModuleBase): + + Returns: + bool: + """ + return main.image_color_count( + button, color=self.active_color, threshold=self.active_threshold, count=self.active_count) + + def is_button_inactive(self, button, main): + """ + Args: + button (Button): + main (ModuleBase): + + Returns: + bool: + """ + return main.image_color_count( + button, color=self.inactive_color, threshold=self.inactive_threshold, count=self.inactive_count) + def get_info(self, main): """ Args: @@ -40,12 +64,10 @@ class Navbar: total = [] active = [] for index, button in enumerate(self.grids.buttons): - if main.image_color_count( - button, color=self.active_color, threshold=self.active_threshold, count=self.active_count): + if self.is_button_active(button, main=main): total.append(index) active.append(index) - elif main.image_color_count( - button, color=self.inactive_color, threshold=self.inactive_threshold, count=self.inactive_count): + elif self.is_button_inactive(button, main=main): total.append(index) if len(active) == 0: diff --git a/module/ui/page.py b/module/ui/page.py index 46ecee22b..e68f22f42 100644 --- a/module/ui/page.py +++ b/module/ui/page.py @@ -6,13 +6,56 @@ MAIN_CHECK = MAIN_GOTO_CAMPAIGN class Page: - parent = None + # Key: str, page name like "page_main" + # Value: Page, page instance + all_pages = {} + + @classmethod + def clear_connection(cls): + for page in cls.all_pages.values(): + page.parent = None + + @classmethod + def init_connection(cls, destination): + """ + Initialize an A* path finding among pages. + + Args: + destination (Page): + """ + cls.clear_connection() + + visited = [destination] + visited = set(visited) + while 1: + new = visited.copy() + for page in visited: + for link in cls.iter_pages(): + if link in visited: + continue + if page in link.links: + link.parent = page + new.add(link) + if len(new) == len(visited): + break + visited = new + + @classmethod + def iter_pages(cls): + return cls.all_pages.values() + + @classmethod + def iter_check_buttons(cls): + for page in cls.all_pages.values(): + yield page.check_button def __init__(self, check_button): self.check_button = check_button self.links = {} (filename, line_number, function_name, text) = traceback.extract_stack()[-2] self.name = text[:text.find('=')].strip() + self.parent = None + Page.all_pages[self.name] = self def __eq__(self, other): return self.name == other.name diff --git a/module/ui/scroll.py b/module/ui/scroll.py index 273d36fc1..f23826ad7 100644 --- a/module/ui/scroll.py +++ b/module/ui/scroll.py @@ -126,10 +126,14 @@ class Scroll: random_range (tuple(int, float)): distance_check (bool): Whether to drop short swipes skip_first_screenshot: + + Returns: + bool: If dragged. """ logger.info(f'{self.name} set to {position}') self.drag_interval.clear() self.drag_timeout.reset() + dragged = 0 if position <= self.edge_threshold: random_range = np.subtract(0, self.edge_add) if position >= 1 - self.edge_threshold: @@ -158,6 +162,9 @@ class Scroll: p2 = random_rectangle_point(self.position_to_screen(position, random_range=random_range), n=1) main.device.swipe(p1, p2, name=self.name, distance_check=distance_check) self.drag_interval.reset() + dragged += 1 + + return dragged def set_top(self, main, random_range=(-0.05, 0.05), skip_first_screenshot=True): return self.set(0.00, main=main, random_range=random_range, skip_first_screenshot=skip_first_screenshot) diff --git a/module/ui/ui.py b/module/ui/ui.py index 5f7643bc0..326de35e8 100644 --- a/module/ui/ui.py +++ b/module/ui/ui.py @@ -22,57 +22,10 @@ from module.raid.assets import RAID_FLEET_PREPARATION from module.ui.assets import (BACK_ARROW, DORM_FEED_CANCEL, DORM_INFO, DORM_TROPHY_CONFIRM, EVENT_LIST_CHECK, GOTO_MAIN, MAIN_GOTO_CAMPAIGN, MEOWFFICER_GOTO_DORMMENU, MEOWFFICER_INFO, META_CHECK, PLAYER_CHECK, RAID_CHECK, SHIPYARD_CHECK, SHOP_GOTO_SUPPLY_PACK) -from module.ui.page import (Page, page_academy, page_archives, - page_battle_pass, page_build, page_campaign, - page_campaign_menu, page_commission, page_daily, - page_dorm, page_dormmenu, page_event, - page_event_list, page_exercise, page_fleet, - page_guild, page_main, page_meowfficer, page_meta, - page_mission, page_munitions, page_os, page_raid, - page_research, page_reshmenu, page_reward, - page_shipyard, page_shop, page_sp, page_storage, - page_supply_pack, page_tactical, page_unknown) - - -# from module.ui.page import * +from module.ui.page import (Page, page_campaign, page_event, page_main, page_sp) class UI(InfoHandler): - # All pages defined. - ui_pages = [ - page_unknown, - page_main, - page_fleet, - page_guild, - page_mission, - page_event_list, - page_campaign_menu, - page_campaign, - page_exercise, - page_daily, - page_event, - page_sp, - page_raid, - page_archives, - page_reward, - page_commission, - page_tactical, - page_battle_pass, - page_reshmenu, - page_research, - page_shipyard, - page_meta, - page_dormmenu, - page_dorm, - page_meowfficer, - page_academy, - page_shop, - page_storage, - page_munitions, - page_supply_pack, - page_build, - page_os, - ] ui_current: Page def ui_page_appear(self, page): @@ -91,15 +44,15 @@ class UI(InfoHandler): return False def ui_click( - self, - click_button, - check_button, - appear_button=None, - additional=None, - confirm_wait=1, - offset=(30, 30), - retry_wait=10, - skip_first_screenshot=False, + self, + click_button, + check_button, + appear_button=None, + additional=None, + confirm_wait=1, + offset=(30, 30), + retry_wait=10, + skip_first_screenshot=False, ): """ Args: @@ -133,7 +86,7 @@ class UI(InfoHandler): if click_timer.reached(): if (isinstance(appear_button, Button) and self.appear(appear_button, offset=offset)) or ( - callable(appear_button) and appear_button() + callable(appear_button) and appear_button() ): self.device.click(click_button) click_timer.reset() @@ -202,7 +155,7 @@ class UI(InfoHandler): break # Known pages - for page in self.ui_pages: + for page in Page.iter_pages(): if page.check_button is None: continue if self.ui_page_appear(page=page): @@ -226,41 +179,23 @@ class UI(InfoHandler): logger.attr("EMULATOR__CONTROL_METHOD", self.config.Emulator_ControlMethod) logger.attr("SERVER", self.config.SERVER) logger.warning("Starting from current page is not supported") - logger.warning(f"Supported page: {[str(page) for page in self.ui_pages]}") + logger.warning(f"Supported page: {[str(page) for page in Page.iter_pages()]}") logger.warning('Supported page: Any page with a "HOME" button on the upper-right') logger.critical("Please switch to a supported page before starting Alas") raise GamePageUnknownError - def ui_goto(self, destination, offset=(30, 30), confirm_wait=0, skip_first_screenshot=True): + def ui_goto(self, destination, offset=(30, 30), skip_first_screenshot=True): """ Args: destination (Page): offset: - confirm_wait: skip_first_screenshot: """ - # Reset connection - for page in self.ui_pages: - page.parent = None - # Create connection - visited = [destination] - visited = set(visited) - while 1: - new = visited.copy() - for page in visited: - for link in self.ui_pages: - if link in visited: - continue - if page in link.links: - link.parent = page - new.add(link) - if len(new) == len(visited): - break - visited = new + Page.init_connection(destination) + self.interval_clear(list(Page.iter_check_buttons())) logger.hr(f"UI goto {destination}") - confirm_timer = Timer(confirm_wait, count=int(confirm_wait // 0.5)).start() while 1: GOTO_MAIN.clear_offset() if skip_first_screenshot: @@ -270,15 +205,12 @@ class UI(InfoHandler): # Destination page if self.appear(destination.check_button, offset=offset): - if confirm_timer.reached(): - logger.info(f'Page arrive: {destination}') - break - else: - confirm_timer.reset() + logger.info(f'Page arrive: {destination}') + break # Other pages clicked = False - for page in visited: + for page in Page.iter_pages(): if page.parent is None or page.check_button is None: continue if self.appear(page.check_button, offset=offset, interval=5): @@ -286,7 +218,6 @@ class UI(InfoHandler): button = page.links[page.parent] self.device.click(button) self.ui_button_interval_reset(button) - confirm_timer.reset() clicked = True break if clicked: @@ -297,8 +228,7 @@ class UI(InfoHandler): continue # Reset connection - for page in self.ui_pages: - page.parent = None + Page.clear_connection() def ui_ensure(self, destination, skip_first_screenshot=True): """ @@ -332,14 +262,14 @@ class UI(InfoHandler): return self.ui_ensure(destination=page_sp) def ui_ensure_index( - self, - index, - letter, - next_button, - prev_button, - skip_first_screenshot=False, - fast=True, - interval=(0.2, 0.3), + self, + index, + letter, + next_button, + prev_button, + skip_first_screenshot=False, + fast=True, + interval=(0.2, 0.3), ): """ Args: @@ -350,8 +280,6 @@ class UI(InfoHandler): skip_first_screenshot (bool): fast (bool): Default true. False when index is not continuous. interval (tuple, int, float): Seconds between two click. - step_sleep (tuple, int, float): Seconds between two step. - finish_sleep (tuple, int, float): Second to wait when arrive. """ logger.hr("UI ensure index") retry = Timer(1, count=2) @@ -457,7 +385,8 @@ class UI(InfoHandler): if self._opsi_reset_fleet_preparation_click >= 5: logger.critical("Failed to confirm OpSi fleets, too many click on RESET_FLEET_PREPARATION") logger.critical("Possible reason #1: You haven't set any fleets in operation siren") - logger.critical("Possible reason #2: Your fleets haven't satisfied the level restrictions in operation siren") + logger.critical( + "Possible reason #2: Your fleets haven't satisfied the level restrictions in operation siren") raise GameTooManyClickError if self.appear_then_click(RESET_TICKET_POPUP, offset=(30, 30), interval=3): return True