Upd: Flagship changing (#3556)

* Upd: Flagship changing asset

* Upd: Equipment enter

* Upd: Fleet detail check

* Refactor: equipment changing

* Upd: asset exercise/EQUIP_ENTER

* Refactor: rename equipment functions

* Fix: avoid GameTooManyClickError when EQUIPMENT_SCROLL disappears

* Upd: [CN] assets EQUIP_1/2/3

* Fix: skip first screenshot in equipment.py
This commit is contained in:
Air111 2024-04-19 01:40:40 +08:00 committed by GitHub
parent 27693a6762
commit 2507b0fa6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
39 changed files with 211 additions and 215 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -2,8 +2,7 @@ from module.campaign.campaign_base import CampaignBase
from module.campaign.run import CampaignRun
from module.combat.assets import BATTLE_PREPARATION
from module.equipment.assets import *
from module.equipment.equipment_change import EquipmentChange
from module.equipment.fleet_equipment import OCR_FLEET_INDEX
from module.equipment.fleet_equipment import FleetEquipment
from module.exception import CampaignEnd, ScriptError
from module.handler.assets import AUTO_SEARCH_MAP_OPTION_OFF
from module.logger import logger
@ -68,7 +67,7 @@ class GemsCampaignOverride(CampaignBase):
raise CampaignEnd('Emotion withdraw')
class GemsFarming(CampaignRun, Dock, EquipmentChange):
class GemsFarming(CampaignRun, Dock, FleetEquipment):
def load_campaign(self, name, folder='campaign_main'):
super().load_campaign(name, folder)
@ -96,22 +95,11 @@ class GemsFarming(CampaignRun, Dock, EquipmentChange):
def change_vanguard_equip(self):
return 'equip' in self.config.GemsFarming_ChangeVanguard
def _fleet_detail_enter(self):
"""
Enter GEMS_FLEET page
"""
self.ui_ensure(page_fleet)
_fleet_to_change = self.config.Fleet_Fleet1
if self.config.Fleet_FleetOrder == 'fleet1_all_fleet2_standby':
_fleet_to_change = self.config.Fleet_Fleet1
elif self.config.Fleet_FleetOrder == 'fleet1_standby_fleet2_all':
_fleet_to_change = self.config.Fleet_Fleet2
self.ui_ensure_index(_fleet_to_change, letter=OCR_FLEET_INDEX,
next_button=FLEET_NEXT, prev_button=FLEET_PREV, skip_first_screenshot=True)
def _ship_detail_enter(self, button):
self._fleet_detail_enter()
self.equip_enter(button)
def fleet_enter(self, fleet=None):
fleet = self.config.Fleet_Fleet1
if self.config.Fleet_FleetOrder == 'fleet1_standby_fleet2_all':
fleet = self.config.Fleet_Fleet2
super().fleet_enter(fleet)
def flagship_change(self):
"""
@ -128,24 +116,23 @@ class GemsFarming(CampaignRun, Dock, EquipmentChange):
index_list = range(0, 5)
logger.hr('Change flagship', level=1)
logger.attr('ChangeFlagship', self.config.GemsFarming_ChangeFlagship)
self.fleet_enter()
if self.change_flagship_equip:
logger.hr('Record flagship equipment', level=2)
self._ship_detail_enter(FLEET_ENTER_FLAGSHIP)
self.record_equipment(index_list=index_list)
self._equip_take_off_one()
self.ui_back(page_fleet.check_button)
self.fleet_enter_ship(FLEET_DETAIL_ENTER_FLAGSHIP)
self.ship_equipment_record_image(index_list=index_list)
self.ship_equipment_take_off()
self.fleet_back()
logger.hr('Change flagship', level=2)
self._fleet_detail_enter()
success = self.flagship_change_execute()
if self.change_flagship_equip:
logger.hr('Equip flagship equipment', level=2)
self._ship_detail_enter(FLEET_ENTER_FLAGSHIP)
self._equip_take_off_one()
self.equipment_take_on(index_list=index_list)
self.ui_back(page_fleet.check_button)
self.fleet_enter_ship(FLEET_DETAIL_ENTER_FLAGSHIP)
self.ship_equipment_take_off()
self.ship_equipment_take_on_image(index_list=index_list)
self.fleet_back()
return success
@ -159,24 +146,23 @@ class GemsFarming(CampaignRun, Dock, EquipmentChange):
logger.hr('Change vanguard', level=1)
logger.attr('ChangeVanguard', self.config.GemsFarming_ChangeVanguard)
self.fleet_enter()
if self.change_vanguard_equip:
logger.hr('Record vanguard equipment', level=2)
self._ship_detail_enter(FLEET_ENTER)
self.record_equipment()
self._equip_take_off_one()
self.ui_back(page_fleet.check_button)
self.fleet_enter_ship(FLEET_DETAIL_ENTER)
self.ship_equipment_record_image()
self.ship_equipment_take_off()
self.fleet_back()
logger.hr('Change vanguard', level=2)
self._fleet_detail_enter()
success = self.vanguard_change_execute()
if self.change_vanguard_equip:
logger.hr('Equip vanguard equipment', level=2)
self._ship_detail_enter(FLEET_ENTER)
self._equip_take_off_one()
self.equipment_take_on()
self.ui_back(page_fleet.check_button)
self.fleet_enter_ship(FLEET_DETAIL_ENTER)
self.ship_equipment_take_off()
self.ship_equipment_take_on_image()
self.fleet_back()
return success

View File

@ -4,7 +4,7 @@ from module.base.utils import get_color
from module.combat.assets import BATTLE_PREPARATION
from module.combat.combat import Combat
from module.daily.assets import *
from module.equipment.fleet_equipment import DailyEquipment
from module.daily.equipment import DailyEquipment
from module.logger import logger
from module.ocr.ocr import Digit
from module.ui.assets import BACK_ARROW, DAILY_CHECK

39
module/daily/equipment.py Normal file
View File

@ -0,0 +1,39 @@
from module.equipment.fleet_equipment import FleetEquipment
from module.logger import logger
from module.ui.page import page_main
class DailyEquipment(FleetEquipment):
def fleet_enter(self, fleet=None):
fleet = self.config.FLEET_DAILY
if isinstance(fleet, list):
logger.info(f'Multiple daily fleets are set, change equipment only for the first one. fleet: {fleet}')
fleet = fleet[0]
super().fleet_enter(fleet)
def equipment_take_on(self):
if self.config.FLEET_DAILY_EQUIPMENT is None:
return False
if self.equipment_has_take_on:
return False
self.fleet_enter()
self.fleet_equipment_take_on_preset(preset_record=self.config.FLEET_DAILY_EQUIPMENT)
self.ui_back(page_main.check_button)
self.equipment_has_take_on = True
self.device.sleep(1)
return True
def equipment_take_off(self):
if self.config.FLEET_DAILY_EQUIPMENT is None:
return False
if not self.equipment_has_take_on:
return False
self.fleet_enter()
self.fleet_equipment_take_off()
self.ui_back(page_main.check_button)
self.equipment_has_take_on = False
self.device.sleep(1)
return True

View File

@ -9,9 +9,9 @@ EQUIPMENT_OPEN = Button(area={'cn': (1139, 87, 1231, 111), 'en': (1143, 90, 1229
EQUIPMENT_SCROLL_BOTTOM = Button(area={'cn': (1256, 575, 1264, 583), 'en': (1256, 575, 1264, 583), 'jp': (1256, 575, 1264, 583), 'tw': (1256, 575, 1264, 583)}, color={'cn': (244, 209, 66), 'en': (244, 209, 66), 'jp': (244, 209, 66), 'tw': (244, 209, 66)}, button={'cn': (1256, 575, 1264, 583), 'en': (1256, 575, 1264, 583), 'jp': (1256, 575, 1264, 583), 'tw': (1256, 575, 1264, 583)}, file={'cn': './assets/cn/equipment/EQUIPMENT_SCROLL_BOTTOM.png', 'en': './assets/en/equipment/EQUIPMENT_SCROLL_BOTTOM.png', 'jp': './assets/jp/equipment/EQUIPMENT_SCROLL_BOTTOM.png', 'tw': './assets/tw/equipment/EQUIPMENT_SCROLL_BOTTOM.png'})
EQUIPPING_OFF = Button(area={'cn': (25, 565, 60, 589), 'en': (30, 585, 59, 605), 'jp': (25, 565, 60, 589), 'tw': (25, 565, 60, 589)}, color={'cn': (94, 101, 104), 'en': (65, 70, 96), 'jp': (94, 101, 104), 'tw': (94, 101, 104)}, button={'cn': (25, 565, 60, 589), 'en': (30, 585, 59, 605), 'jp': (25, 565, 60, 589), 'tw': (25, 565, 60, 589)}, file={'cn': './assets/cn/equipment/EQUIPPING_OFF.png', 'en': './assets/en/equipment/EQUIPPING_OFF.png', 'jp': './assets/jp/equipment/EQUIPPING_OFF.png', 'tw': './assets/tw/equipment/EQUIPPING_OFF.png'})
EQUIPPING_ON = Button(area={'cn': (26, 485, 60, 510), 'en': (32, 563, 54, 583), 'jp': (26, 485, 60, 510), 'tw': (26, 485, 60, 510)}, color={'cn': (184, 191, 214), 'en': (164, 173, 208), 'jp': (184, 191, 214), 'tw': (184, 191, 214)}, button={'cn': (26, 486, 57, 584), 'en': (7, 559, 78, 606), 'jp': (26, 486, 57, 584), 'tw': (26, 483, 61, 590)}, file={'cn': './assets/cn/equipment/EQUIPPING_ON.png', 'en': './assets/en/equipment/EQUIPPING_ON.png', 'jp': './assets/jp/equipment/EQUIPPING_ON.png', 'tw': './assets/tw/equipment/EQUIPPING_ON.png'})
EQUIP_1 = Button(area={'cn': (1191, 266, 1247, 319), 'en': (1200, 273, 1241, 314), 'jp': (1191, 265, 1248, 320), 'tw': (1190, 265, 1249, 319)}, color={'cn': (98, 142, 207), 'en': (77, 130, 192), 'jp': (97, 142, 206), 'tw': (102, 147, 211)}, button={'cn': (1191, 266, 1247, 319), 'en': (1200, 273, 1241, 314), 'jp': (1191, 265, 1248, 320), 'tw': (1190, 265, 1249, 319)}, file={'cn': './assets/cn/equipment/EQUIP_1.png', 'en': './assets/en/equipment/EQUIP_1.png', 'jp': './assets/jp/equipment/EQUIP_1.png', 'tw': './assets/tw/equipment/EQUIP_1.png'})
EQUIP_2 = Button(area={'cn': (1191, 366, 1247, 419), 'en': (1200, 374, 1241, 415), 'jp': (1191, 365, 1248, 420), 'tw': (1190, 365, 1249, 419)}, color={'cn': (95, 139, 202), 'en': (77, 130, 192), 'jp': (94, 138, 201), 'tw': (100, 144, 208)}, button={'cn': (1191, 366, 1247, 419), 'en': (1200, 374, 1241, 415), 'jp': (1191, 365, 1248, 420), 'tw': (1190, 365, 1249, 419)}, file={'cn': './assets/cn/equipment/EQUIP_2.png', 'en': './assets/en/equipment/EQUIP_2.png', 'jp': './assets/jp/equipment/EQUIP_2.png', 'tw': './assets/tw/equipment/EQUIP_2.png'})
EQUIP_3 = Button(area={'cn': (1191, 466, 1247, 519), 'en': (1200, 475, 1241, 516), 'jp': (1190, 467, 1249, 520), 'tw': (1190, 466, 1249, 520)}, color={'cn': (94, 137, 201), 'en': (80, 132, 192), 'jp': (89, 134, 197), 'tw': (97, 142, 205)}, button={'cn': (1191, 466, 1247, 519), 'en': (1200, 475, 1241, 516), 'jp': (1190, 467, 1249, 520), 'tw': (1190, 466, 1249, 520)}, file={'cn': './assets/cn/equipment/EQUIP_3.png', 'en': './assets/en/equipment/EQUIP_3.png', 'jp': './assets/jp/equipment/EQUIP_3.png', 'tw': './assets/tw/equipment/EQUIP_3.png'})
EQUIP_1 = Button(area={'cn': (1211, 274, 1230, 315), 'en': (1200, 273, 1241, 314), 'jp': (1191, 265, 1248, 320), 'tw': (1190, 265, 1249, 319)}, color={'cn': (133, 181, 222), 'en': (77, 130, 192), 'jp': (97, 142, 206), 'tw': (102, 147, 211)}, button={'cn': (1211, 274, 1230, 315), 'en': (1200, 273, 1241, 314), 'jp': (1191, 265, 1248, 320), 'tw': (1190, 265, 1249, 319)}, file={'cn': './assets/cn/equipment/EQUIP_1.png', 'en': './assets/en/equipment/EQUIP_1.png', 'jp': './assets/jp/equipment/EQUIP_1.png', 'tw': './assets/tw/equipment/EQUIP_1.png'})
EQUIP_2 = Button(area={'cn': (1211, 374, 1230, 416), 'en': (1200, 374, 1241, 415), 'jp': (1191, 365, 1248, 420), 'tw': (1190, 365, 1249, 419)}, color={'cn': (130, 179, 220), 'en': (77, 130, 192), 'jp': (94, 138, 201), 'tw': (100, 144, 208)}, button={'cn': (1211, 374, 1230, 416), 'en': (1200, 374, 1241, 415), 'jp': (1191, 365, 1248, 420), 'tw': (1190, 365, 1249, 419)}, file={'cn': './assets/cn/equipment/EQUIP_2.png', 'en': './assets/en/equipment/EQUIP_2.png', 'jp': './assets/jp/equipment/EQUIP_2.png', 'tw': './assets/tw/equipment/EQUIP_2.png'})
EQUIP_3 = Button(area={'cn': (1211, 475, 1230, 517), 'en': (1200, 475, 1241, 516), 'jp': (1190, 467, 1249, 520), 'tw': (1190, 466, 1249, 520)}, color={'cn': (130, 179, 220), 'en': (80, 132, 192), 'jp': (89, 134, 197), 'tw': (97, 142, 205)}, button={'cn': (1211, 475, 1230, 517), 'en': (1200, 475, 1241, 516), 'jp': (1190, 467, 1249, 520), 'tw': (1190, 466, 1249, 520)}, file={'cn': './assets/cn/equipment/EQUIP_3.png', 'en': './assets/en/equipment/EQUIP_3.png', 'jp': './assets/jp/equipment/EQUIP_3.png', 'tw': './assets/tw/equipment/EQUIP_3.png'})
EQUIP_CONFIRM = Button(area={'cn': (792, 623, 959, 677), 'en': (809, 633, 940, 658), 'jp': (792, 623, 960, 674), 'tw': (792, 623, 960, 677)}, color={'cn': (222, 154, 59), 'en': (236, 192, 133), 'jp': (222, 152, 55), 'tw': (223, 153, 57)}, button={'cn': (792, 623, 959, 677), 'en': (793, 620, 961, 673), 'jp': (792, 623, 960, 674), 'tw': (792, 623, 960, 677)}, file={'cn': './assets/cn/equipment/EQUIP_CONFIRM.png', 'en': './assets/en/equipment/EQUIP_CONFIRM.png', 'jp': './assets/jp/equipment/EQUIP_CONFIRM.png', 'tw': './assets/tw/equipment/EQUIP_CONFIRM.png'})
EQUIP_OFF = Button(area={'cn': (907, 565, 1037, 610), 'en': (911, 564, 1034, 607), 'jp': (908, 564, 1039, 612), 'tw': (907, 565, 1037, 611)}, color={'cn': (112, 153, 216), 'en': (91, 142, 212), 'jp': (110, 151, 213), 'tw': (106, 150, 214)}, button={'cn': (907, 565, 1037, 610), 'en': (911, 564, 1034, 607), 'jp': (908, 564, 1039, 612), 'tw': (907, 565, 1037, 611)}, file={'cn': './assets/cn/equipment/EQUIP_OFF.png', 'en': './assets/en/equipment/EQUIP_OFF.png', 'jp': './assets/jp/equipment/EQUIP_OFF.png', 'tw': './assets/tw/equipment/EQUIP_OFF.png'})
EQUIP_SAVE = Button(area={'cn': (355, 312, 452, 433), 'en': (355, 312, 452, 433), 'jp': (407, 312, 476, 404), 'tw': (355, 312, 452, 433)}, color={'cn': (170, 156, 122), 'en': (170, 156, 122), 'jp': (119, 94, 128), 'tw': (170, 156, 122)}, button={'cn': (355, 312, 452, 433), 'en': (355, 312, 452, 433), 'jp': (407, 312, 476, 404), 'tw': (355, 312, 452, 433)}, file={'cn': './assets/cn/equipment/EQUIP_SAVE.png', 'en': './assets/en/equipment/EQUIP_SAVE.png', 'jp': './assets/jp/equipment/EQUIP_SAVE.png', 'tw': './assets/tw/equipment/EQUIP_SAVE.png'})
@ -21,8 +21,12 @@ EQUIP_TAKE_ON_1 = Button(area={'cn': (907, 338, 991, 431), 'en': (907, 338, 991,
EQUIP_TAKE_ON_2 = Button(area={'cn': (866, 511, 950, 604), 'en': (866, 511, 950, 604), 'jp': (866, 511, 950, 604), 'tw': (866, 511, 950, 604)}, color={'cn': (117, 118, 127), 'en': (117, 118, 127), 'jp': (117, 118, 127), 'tw': (117, 118, 127)}, button={'cn': (866, 511, 950, 604), 'en': (866, 511, 950, 604), 'jp': (866, 511, 950, 604), 'tw': (866, 511, 950, 604)}, file={'cn': './assets/cn/equipment/EQUIP_TAKE_ON_2.png', 'en': './assets/en/equipment/EQUIP_TAKE_ON_2.png', 'jp': './assets/jp/equipment/EQUIP_TAKE_ON_2.png', 'tw': './assets/tw/equipment/EQUIP_TAKE_ON_2.png'})
EQUIP_TAKE_ON_3 = Button(area={'cn': (129, 252, 213, 345), 'en': (129, 252, 213, 345), 'jp': (129, 252, 213, 345), 'tw': (129, 252, 213, 345)}, color={'cn': (105, 108, 115), 'en': (105, 108, 115), 'jp': (105, 108, 115), 'tw': (105, 108, 115)}, button={'cn': (129, 252, 213, 345), 'en': (129, 252, 213, 345), 'jp': (129, 252, 213, 345), 'tw': (129, 252, 213, 345)}, file={'cn': './assets/cn/equipment/EQUIP_TAKE_ON_3.png', 'en': './assets/en/equipment/EQUIP_TAKE_ON_3.png', 'jp': './assets/jp/equipment/EQUIP_TAKE_ON_3.png', 'tw': './assets/tw/equipment/EQUIP_TAKE_ON_3.png'})
EQUIP_TAKE_ON_4 = Button(area={'cn': (128, 432, 212, 525), 'en': (128, 432, 212, 525), 'jp': (128, 432, 212, 525), 'tw': (128, 432, 212, 525)}, color={'cn': (109, 111, 120), 'en': (109, 111, 120), 'jp': (109, 111, 120), 'tw': (109, 111, 120)}, button={'cn': (128, 432, 212, 525), 'en': (128, 432, 212, 525), 'jp': (128, 432, 212, 525), 'tw': (128, 432, 212, 525)}, file={'cn': './assets/cn/equipment/EQUIP_TAKE_ON_4.png', 'en': './assets/en/equipment/EQUIP_TAKE_ON_4.png', 'jp': './assets/jp/equipment/EQUIP_TAKE_ON_4.png', 'tw': './assets/tw/equipment/EQUIP_TAKE_ON_4.png'})
FLEET_DETAIL = Button(area={'cn': (906, 644, 1008, 699), 'en': (906, 644, 1008, 699), 'jp': (906, 644, 1008, 699), 'tw': (906, 644, 1008, 699)}, color={'cn': (166, 170, 188), 'en': (166, 170, 188), 'jp': (166, 170, 188), 'tw': (166, 170, 188)}, button={'cn': (906, 644, 1008, 699), 'en': (906, 644, 1008, 699), 'jp': (906, 644, 1008, 699), 'tw': (906, 644, 1008, 699)}, file={'cn': './assets/cn/equipment/FLEET_DETAIL.png', 'en': './assets/en/equipment/FLEET_DETAIL.png', 'jp': './assets/jp/equipment/FLEET_DETAIL.png', 'tw': './assets/tw/equipment/FLEET_DETAIL.png'})
FLEET_DETAIL_CHECK = Button(area={'cn': (904, 684, 1102, 701), 'en': (904, 684, 1102, 701), 'jp': (904, 684, 1102, 701), 'tw': (904, 684, 1102, 701)}, color={'cn': (225, 168, 105), 'en': (225, 168, 105), 'jp': (225, 168, 105), 'tw': (225, 168, 105)}, button={'cn': (904, 684, 1102, 701), 'en': (904, 684, 1102, 701), 'jp': (904, 684, 1102, 701), 'tw': (904, 684, 1102, 701)}, file={'cn': './assets/cn/equipment/FLEET_DETAIL_CHECK.png', 'en': './assets/en/equipment/FLEET_DETAIL_CHECK.png', 'jp': './assets/jp/equipment/FLEET_DETAIL_CHECK.png', 'tw': './assets/tw/equipment/FLEET_DETAIL_CHECK.png'})
FLEET_DETAIL_ENTER = Button(area={'cn': (729, 314, 802, 438), 'en': (729, 314, 802, 438), 'jp': (729, 314, 802, 438), 'tw': (729, 314, 802, 438)}, color={'cn': (154, 149, 147), 'en': (154, 149, 147), 'jp': (154, 149, 147), 'tw': (154, 149, 147)}, button={'cn': (729, 314, 802, 438), 'en': (729, 314, 802, 438), 'jp': (729, 314, 802, 438), 'tw': (729, 314, 802, 438)}, file={'cn': './assets/cn/equipment/FLEET_DETAIL_ENTER.png', 'en': './assets/en/equipment/FLEET_DETAIL_ENTER.png', 'jp': './assets/jp/equipment/FLEET_DETAIL_ENTER.png', 'tw': './assets/tw/equipment/FLEET_DETAIL_ENTER.png'})
FLEET_DETAIL_ENTER_FLAGSHIP = Button(area={'cn': (103, 327, 176, 437), 'en': (103, 327, 176, 437), 'jp': (103, 327, 176, 437), 'tw': (103, 327, 176, 437)}, color={'cn': (141, 135, 138), 'en': (141, 135, 138), 'jp': (141, 135, 138), 'tw': (141, 135, 138)}, button={'cn': (103, 327, 176, 437), 'en': (103, 327, 176, 437), 'jp': (103, 327, 176, 437), 'tw': (103, 327, 176, 437)}, file={'cn': './assets/cn/equipment/FLEET_DETAIL_ENTER_FLAGSHIP.png', 'en': './assets/en/equipment/FLEET_DETAIL_ENTER_FLAGSHIP.png', 'jp': './assets/jp/equipment/FLEET_DETAIL_ENTER_FLAGSHIP.png', 'tw': './assets/tw/equipment/FLEET_DETAIL_ENTER_FLAGSHIP.png'})
FLEET_ENTER = Button(area={'cn': (502, 474, 517, 489), 'en': (502, 474, 517, 489), 'jp': (502, 474, 517, 489), 'tw': (502, 474, 517, 489)}, color={'cn': (58, 62, 77), 'en': (58, 62, 77), 'jp': (58, 62, 77), 'tw': (58, 62, 77)}, button={'cn': (502, 474, 517, 489), 'en': (502, 474, 517, 489), 'jp': (502, 474, 517, 489), 'tw': (502, 474, 517, 489)}, file={'cn': './assets/cn/equipment/FLEET_ENTER.png', 'en': './assets/en/equipment/FLEET_ENTER.png', 'jp': './assets/jp/equipment/FLEET_ENTER.png', 'tw': './assets/tw/equipment/FLEET_ENTER.png'})
FLEET_ENTER_FLAGSHIP = Button(area={'cn': (577, 306, 604, 321), 'en': (577, 306, 604, 321), 'jp': (577, 306, 604, 321), 'tw': (577, 306, 604, 321)}, color={'cn': (95, 83, 74), 'en': (95, 83, 74), 'jp': (95, 83, 74), 'tw': (95, 83, 74)}, button={'cn': (577, 306, 604, 321), 'en': (577, 306, 604, 321), 'jp': (577, 306, 604, 321), 'tw': (577, 306, 604, 321)}, file={'cn': './assets/cn/equipment/FLEET_ENTER_FLAGSHIP.png', 'en': './assets/en/equipment/FLEET_ENTER_FLAGSHIP.png', 'jp': './assets/jp/equipment/FLEET_ENTER_FLAGSHIP.png', 'tw': './assets/tw/equipment/FLEET_ENTER_FLAGSHIP.png'})
FLEET_ENTER_FLAGSHIP = Button(area={'cn': (577, 277, 605, 291), 'en': (577, 277, 605, 291), 'jp': (577, 277, 605, 291), 'tw': (577, 277, 605, 291)}, color={'cn': (132, 124, 128), 'en': (132, 124, 128), 'jp': (132, 124, 128), 'tw': (132, 124, 128)}, button={'cn': (577, 277, 605, 291), 'en': (577, 277, 605, 291), 'jp': (577, 277, 605, 291), 'tw': (577, 277, 605, 291)}, file={'cn': './assets/cn/equipment/FLEET_ENTER_FLAGSHIP.png', 'en': './assets/en/equipment/FLEET_ENTER_FLAGSHIP.png', 'jp': './assets/jp/equipment/FLEET_ENTER_FLAGSHIP.png', 'tw': './assets/tw/equipment/FLEET_ENTER_FLAGSHIP.png'})
FLEET_NEXT = Button(area={'cn': (1234, 327, 1254, 356), 'en': (1234, 327, 1254, 356), 'jp': (1234, 327, 1254, 356), 'tw': (1234, 327, 1254, 356)}, color={'cn': (72, 93, 125), 'en': (72, 93, 125), 'jp': (72, 93, 125), 'tw': (72, 93, 125)}, button={'cn': (1234, 327, 1254, 356), 'en': (1234, 327, 1254, 356), 'jp': (1234, 327, 1254, 356), 'tw': (1234, 327, 1254, 356)}, file={'cn': './assets/cn/equipment/FLEET_NEXT.png', 'en': './assets/en/equipment/FLEET_NEXT.png', 'jp': './assets/jp/equipment/FLEET_NEXT.png', 'tw': './assets/tw/equipment/FLEET_NEXT.png'})
FLEET_PREV = Button(area={'cn': (26, 327, 46, 356), 'en': (26, 327, 46, 356), 'jp': (26, 327, 46, 356), 'tw': (26, 327, 46, 356)}, color={'cn': (72, 93, 125), 'en': (72, 93, 125), 'jp': (72, 93, 125), 'tw': (72, 93, 125)}, button={'cn': (26, 327, 46, 356), 'en': (26, 327, 46, 356), 'jp': (26, 327, 46, 356), 'tw': (26, 327, 46, 356)}, file={'cn': './assets/cn/equipment/FLEET_PREV.png', 'en': './assets/en/equipment/FLEET_PREV.png', 'jp': './assets/jp/equipment/FLEET_PREV.png', 'tw': './assets/tw/equipment/FLEET_PREV.png'})
OCR_FLEET_INDEX = Button(area={'cn': (957, 113, 987, 163), 'en': (957, 113, 987, 163), 'jp': (957, 113, 987, 163), 'tw': (957, 113, 987, 163)}, color={'cn': (36, 54, 86), 'en': (36, 54, 86), 'jp': (36, 54, 86), 'tw': (36, 54, 86)}, button={'cn': (957, 113, 987, 163), 'en': (957, 113, 987, 163), 'jp': (957, 113, 987, 163), 'tw': (957, 113, 987, 163)}, file={'cn': './assets/cn/equipment/OCR_FLEET_INDEX.png', 'en': './assets/en/equipment/OCR_FLEET_INDEX.png', 'jp': './assets/jp/equipment/OCR_FLEET_INDEX.png', 'tw': './assets/tw/equipment/OCR_FLEET_INDEX.png'})

View File

@ -8,11 +8,6 @@ from module.retire.assets import EQUIP_CONFIRM as RETIRE_EQUIP_CONFIRM
from module.storage.storage import StorageHandler
from module.ui.assets import BACK_ARROW
from module.ui.navbar import Navbar
from module.ui.switch import Switch
equipping_filter = Switch('Equiping_filter')
equipping_filter.add_status('on', check_button=EQUIPPING_ON)
equipping_filter.add_status('off', check_button=EQUIPPING_OFF)
SWIPE_DISTANCE = 250
SWIPE_RANDOM_RANGE = (-40, -20, 40, 20)
@ -21,11 +16,7 @@ SWIPE_RANDOM_RANGE = (-40, -20, 40, 20)
class Equipment(StorageHandler):
equipment_has_take_on = False
def equipping_set(self, enable=False):
if equipping_filter.set('on' if enable else 'off', main=self):
self.wait_until_stable(SWIPE_AREA)
def _equip_view_swipe(self, distance, check_button=EQUIPMENT_OPEN):
def _ship_view_swipe(self, distance, check_button=EQUIPMENT_OPEN):
swipe_count = 0
swipe_timer = Timer(5, count=10)
self.handle_info_bar()
@ -36,7 +27,7 @@ class Equipment(StorageHandler):
if not swipe_timer.started() or swipe_timer.reached():
swipe_timer.reset()
self.device.swipe_vector(vector=(distance, 0), box=SWIPE_AREA.area, random_range=SWIPE_RANDOM_RANGE,
padding=0, duration=(0.1, 0.12), name='EQUIP_SWIPE')
padding=0, duration=(0.1, 0.12), name='SHIP_SWIPE')
# self.wait_until_appear(check_button, offset=(30, 30))
skip_first_screenshot = True
while 1:
@ -47,14 +38,14 @@ class Equipment(StorageHandler):
if self.appear(check_button, offset=(30, 30)):
break
if self.appear(RETIRE_EQUIP_CONFIRM, offset=(30, 30)):
logger.info('RETIRE_EQUIP_CONFIRM popup in _equip_view_swipe()')
logger.info('RETIRE_EQUIP_CONFIRM popup in _ship_view_swipe()')
return False
swipe_count += 1
self.device.screenshot()
if self.appear(RETIRE_EQUIP_CONFIRM, offset=(30, 30)):
logger.info('RETIRE_EQUIP_CONFIRM popup in _equip_view_swipe()')
logger.info('RETIRE_EQUIP_CONFIRM popup in _ship_view_swipe()')
return False
if SWIPE_CHECK.match(self.device.image):
if swipe_count > 1:
@ -66,13 +57,13 @@ class Equipment(StorageHandler):
logger.info('New ship detected on swipe')
return True
def equip_view_next(self, check_button=EQUIPMENT_OPEN):
return self._equip_view_swipe(distance=-SWIPE_DISTANCE, check_button=check_button)
def ship_view_next(self, check_button=EQUIPMENT_OPEN):
return self._ship_view_swipe(distance=-SWIPE_DISTANCE, check_button=check_button)
def equip_view_prev(self, check_button=EQUIPMENT_OPEN):
return self._equip_view_swipe(distance=SWIPE_DISTANCE, check_button=check_button)
def ship_view_prev(self, check_button=EQUIPMENT_OPEN):
return self._ship_view_swipe(distance=SWIPE_DISTANCE, check_button=check_button)
def equip_enter(self, click_button, check_button=EQUIPMENT_OPEN, long_click=True, skil_first_screenshot=True):
def ship_info_enter(self, click_button, check_button=EQUIPMENT_OPEN, long_click=True, skil_first_screenshot=True):
enter_timer = Timer(10)
while 1:
@ -88,7 +79,7 @@ class Equipment(StorageHandler):
# Long click accidentally became normal click, exit from dock
if long_click:
if self.appear(DOCK_CHECK, offset=(20, 20), interval=3):
logger.info(f'equip_enter {DOCK_CHECK} -> {BACK_ARROW}')
logger.info(f'ship_info_enter {DOCK_CHECK} -> {BACK_ARROW}')
self.device.click(BACK_ARROW)
continue
if enter_timer.reached():
@ -99,7 +90,7 @@ class Equipment(StorageHandler):
enter_timer.reset()
@cached_property
def _equip_side_navbar(self):
def _ship_side_navbar(self):
"""
pry_sidebar 3 options
research.
@ -119,14 +110,14 @@ class Equipment(StorageHandler):
equipment.
detail.
"""
equip_side_navbar = ButtonGrid(
ship_side_navbar = ButtonGrid(
origin=(21, 118), delta=(0, 94.5), button_shape=(60, 75), grid_shape=(1, 5), name='DETAIL_SIDE_NAVBAR')
return Navbar(grids=equip_side_navbar,
return Navbar(grids=ship_side_navbar,
active_color=(247, 255, 173), active_threshold=221,
inactive_color=(140, 162, 181), inactive_threshold=221)
def equip_side_navbar_ensure(self, upper=None, bottom=None):
def ship_side_navbar_ensure(self, upper=None, bottom=None):
"""
Ensure able to transition to page
Whether page has completely loaded is handled
@ -153,25 +144,25 @@ class Equipment(StorageHandler):
Returns:
bool: if side_navbar set ensured
"""
if self._equip_side_navbar.get_total(main=self) == 3:
if self._ship_side_navbar.get_total(main=self) == 3:
if upper == 1 or bottom == 3:
logger.warning('Transitions to "research" is not supported')
return False
if self._equip_side_navbar.set(self, upper=upper, bottom=bottom):
if self._ship_side_navbar.set(self, upper=upper, bottom=bottom):
return True
return False
def _equip_take_off_one(self, skip_first_screenshot=True):
def ship_equipment_take_off(self, skip_first_screenshot=True):
bar_timer = Timer(5)
off_timer = Timer(5)
confirm_timer = Timer(5)
while 1:
if skip_first_screenshot:
self.device.screenshot()
else:
skip_first_screenshot = False
else:
self.device.screenshot()
# End
# if self.handle_info_bar():
@ -197,36 +188,34 @@ class Equipment(StorageHandler):
bar_timer.reset()
continue
def equipment_take_off(self, enter, out, fleet):
def fleet_equipment_take_off(self, enter, long_click, out):
"""
Args:
enter (Button): Long click to edit equipment.
enter (Button): Button to edit equipment.
long_click (bool): How to click enter
out (Button): Button to confirm exit success.
fleet (list[int]): list of equipment record. [3, 1, 1, 1, 1, 1]
"""
logger.hr('Equipment take off')
self.equip_enter(enter)
self.ship_info_enter(enter, long_click=long_click)
for index in '9'.join([str(x) for x in fleet if x > 0]):
index = int(index)
if index == 9:
self.equip_view_next()
else:
self._equip_take_off_one()
self.ui_click(click_button=EQUIPMENT_CLOSE, check_button=EQUIPMENT_OPEN, offset=None)
while True:
self.ship_equipment_take_off()
self.ui_click(click_button=EQUIPMENT_CLOSE, check_button=EQUIPMENT_OPEN, offset=None)
if not self.ship_view_next():
break
self.ui_back(out)
self.equipment_has_take_on = False
def _equip_take_on_one(self, index, skip_first_screenshot=True):
def ship_equipment_take_on_preset(self, index, skip_first_screenshot=True):
bar_timer = Timer(5)
on_timer = Timer(5)
while 1:
if skip_first_screenshot:
self.device.screenshot()
else:
skip_first_screenshot = False
else:
self.device.screenshot()
# End
# if self.handle_info_bar():
@ -251,22 +240,23 @@ class Equipment(StorageHandler):
on_timer.reset()
continue
def equipment_take_on(self, enter, out, fleet):
def fleet_equipment_take_on_preset(self, preset_record, enter, long_click, out):
"""
Args:
enter (Button): Long click to edit equipment.
preset_record (list[int]): list of equipment record. [3, 1, 1, 1, 1, 1]
enter (Button): Button to edit equipment.
long_click (bool): How to click enter
out (Button): Button to confirm exit success.
fleet (list[int]): list of equipment record. [3, 1, 1, 1, 1, 1]
"""
logger.hr('Equipment take on')
self.equip_enter(enter)
self.ship_info_enter(enter, long_click=long_click)
for index in '9'.join([str(x) for x in fleet if x > 0]):
for index in '9'.join([str(x) for x in preset_record if x > 0]):
index = int(index)
if index == 9:
self.equip_view_next()
self.ship_view_next()
else:
self._equip_take_on_one(index=index)
self.ship_equipment_take_on_preset(index=index)
self.ui_click(click_button=EQUIPMENT_CLOSE, check_button=EQUIPMENT_OPEN, offset=None)
self.ui_back(out)

View File

@ -6,6 +6,7 @@ from module.equipment.equipment import Equipment
from module.logger import logger
from module.ui.assets import BACK_ARROW
from module.ui.scroll import Scroll
from module.ui.switch import Switch
# Button of 5 equipments
EQUIP_INFO_BAR = ButtonGrid(
@ -16,68 +17,58 @@ EQUIPMENT_GRID = ButtonGrid(
EQUIPMENT_SCROLL = Scroll(EQUIP_SCROLL, color=(247, 211, 66), name='EQUIP_SCROLL')
SIM_VALUE = 0.90
equipping_filter = Switch('Equipping_filter')
equipping_filter.add_status('on', check_button=EQUIPPING_ON)
equipping_filter.add_status('off', check_button=EQUIPPING_OFF)
class EquipmentChange(Equipment):
equip_list = {}
equipping_list = []
equipment_list = {}
def get_equiping_list(self, skip_first_screenshot=True):
'''
Pages:
in: ship's details
'''
logger.info("Get equipping list")
if skip_first_screenshot:
pass
else:
self.device.screenshot()
index = 0
self.equipping_list = []
for button in EQUIPMENT_GRID.buttons:
def equipping_set(self, enable=False):
if equipping_filter.set('on' if enable else 'off', main=self):
self.wait_until_stable(SWIPE_AREA)
def ship_equipment_record_image(self, index_list=range(0, 5)):
"""
Record equipment through upgrade page
Notice: The equipment icons in the upgrade page are the same size as the icons in the equipment status
"""
logger.info('RECORD EQUIPMENT')
self.ship_side_navbar_ensure(bottom=1)
self.equipment_list = {}
for index, button in enumerate(EQUIPMENT_GRID.buttons):
if index not in index_list:
continue
crop_image = self.image_crop(button)
edge_value = np.mean(np.abs(cv2.Sobel(crop_image, 3, 1, 1)))
# Nothing is 0.15~1
# +1 is 40
# +10 is 46
if edge_value > 10:
self.equipping_list.append(index)
index += 1
logger.info(f"Equipping list: {self.equipping_list}")
def record_equipment(self, index_list=range(0, 5)):
'''
Record equipment through upgrade page
Notice: The equipment icons in the upgrade page are the same size as the icons in the equipment status
'''
logger.info('RECORD EQUIPMENT')
self.equip_side_navbar_ensure(bottom=1)
self.get_equiping_list()
for index in index_list:
if index in self.equipping_list:
logger.info(f'Record {index}')
logger.info('Enter equipment info')
self.ui_click(appear_button=EQUIPMENT_OPEN, click_button=EQUIP_INFO_BAR[(
index, 0)], check_button=UPGRADE_ENTER)
logger.info('Enter upgrade inform')
# Enter equipment info
self.ui_click(appear_button=EQUIPMENT_OPEN,
click_button=EQUIP_INFO_BAR[(index, 0)],
check_button=UPGRADE_ENTER)
# Enter upgrade inform
self.ui_click(click_button=UPGRADE_ENTER,
check_button=UPGRADE_ENTER_CHECK, skip_first_screenshot=True)
logger.info('Save equipment tamplate')
self.equip_list[index] = self.image_crop(EQUIP_SAVE)
logger.info('Quit upgrade inform')
self.equipment_list[index] = self.image_crop(EQUIP_SAVE)
# Quit upgrade inform
self.ui_click(
click_button=UPGRADE_QUIT, check_button=EQUIPMENT_OPEN, appear_button=UPGRADE_ENTER_CHECK,
skip_first_screenshot=True)
logger.info(f"Recorded equipment index list: {list(self.equipment_list.keys())}")
def equipment_take_on(self, index_list=range(0, 5), skip_first_screenshot=True):
'''
def ship_equipment_take_on_image(self, index_list=range(0, 5), skip_first_screenshot=True):
"""
Equip the equipment previously recorded
'''
"""
logger.info('Take on equipment')
self.equip_side_navbar_ensure(bottom=2)
self.ship_side_navbar_ensure(bottom=2)
for index in index_list:
if index in self.equipping_list:
if index in self.equipment_list:
logger.info(f'Take on {index}')
enter_button = globals()[
'EQUIP_TAKE_ON_{index}'.format(index=index)]
@ -85,7 +76,7 @@ class EquipmentChange(Equipment):
self.ui_click(enter_button, check_button=EQUIPPING_ON,
skip_first_screenshot=skip_first_screenshot, offset=(5, 5))
self.handle_info_bar()
self._find_equip(index)
self._find_equipment(index)
@Config.when(DEVICE_CONTROL_METHOD='minitouch')
def _equipment_swipe(self, distance=190):
@ -108,13 +99,13 @@ class EquipmentChange(Equipment):
self.device.screenshot()
def _equip_equipment(self, point, offset=(100, 100)):
'''
"""
Equip Equipment then back to ship details
Confirm the popup
Pages:
in: EQUIPMENT STATUS
out: SHIP_SIDEBAR_EQUIPMENT
'''
"""
logger.info('Equip equipment')
button = Button(area=(), color=(), button=(point[0], point[1], point[0] + offset[0], point[1] + offset[1]),
name='EQUIPMENT')
@ -122,23 +113,28 @@ class EquipmentChange(Equipment):
logger.info('Equip confirm')
self.ui_click(click_button=EQUIP_CONFIRM, check_button=SHIP_INFO_EQUIPMENT_CHECK)
def _find_equip(self, index):
'''
def _find_equipment(self, index):
"""
Find the equipment previously recorded
Pages:
in: EQUIPMENT STATUS
'''
"""
self.equipping_set(False)
res = cv2.matchTemplate(self.device.screenshot(), np.array(
self.equip_list[index]), cv2.TM_CCOEFF_NORMED)
self.equipment_list[index]), cv2.TM_CCOEFF_NORMED)
_, sim, _, point = cv2.minMaxLoc(res)
if sim > SIM_VALUE:
self._equip_equipment(point)
return
if not EQUIPMENT_SCROLL.appear(main=self):
logger.warning('No recorded equipment was found.')
self.ui_back(check_button=globals()[f'EQUIP_TAKE_ON_{index}'], appear_button=EQUIPPING_OFF)
return
for _ in range(0, 15):
self._equipment_swipe()
@ -146,7 +142,7 @@ class EquipmentChange(Equipment):
self.device.click(BACK_ARROW)
continue
res = cv2.matchTemplate(self.device.screenshot(), np.array(
self.equip_list[index]), cv2.TM_CCOEFF_NORMED)
self.equipment_list[index]), cv2.TM_CCOEFF_NORMED)
_, sim, _, point = cv2.minMaxLoc(res)
if sim > SIM_VALUE:

View File

@ -1,6 +1,5 @@
from module.equipment.assets import *
from module.equipment.equipment import Equipment
from module.logger import logger
from module.equipment.equipment_change import EquipmentChange
from module.ocr.ocr import Digit
from module.ui.assets import FLEET_CHECK
from module.ui.page import page_fleet
@ -8,40 +7,31 @@ from module.ui.page import page_fleet
OCR_FLEET_INDEX = Digit(OCR_FLEET_INDEX, letter=(90, 154, 255), threshold=128, alphabet='123456')
class DailyEquipment(Equipment):
equipment_has_take_on = False
@property
def _fleet_daily(self):
fleet = self.config.FLEET_DAILY
if isinstance(fleet, list):
logger.info(f'Multiple daily fleets are set, change equipment only for the first one. fleet: {fleet}')
return fleet[0]
else:
return fleet
def equipment_take_on(self):
if self.config.FLEET_DAILY_EQUIPMENT is None:
return False
if self.equipment_has_take_on:
return False
class FleetEquipment(EquipmentChange):
def fleet_enter(self, fleet):
self.ui_ensure(page_fleet)
self.ui_ensure_index(self._fleet_daily, letter=OCR_FLEET_INDEX, next_button=FLEET_NEXT, prev_button=FLEET_PREV)
super().equipment_take_on(enter=FLEET_ENTER, out=FLEET_CHECK, fleet=self.config.FLEET_DAILY_EQUIPMENT)
self.equipment_has_take_on = True
self.device.sleep(1)
return True
self.ui_ensure_index(fleet, letter=OCR_FLEET_INDEX,
next_button=FLEET_NEXT, prev_button=FLEET_PREV, skip_first_screenshot=True)
def equipment_take_off(self):
if self.config.FLEET_DAILY_EQUIPMENT is None:
return False
if not self.equipment_has_take_on:
return False
def fleet_equipment_take_on_preset(self, preset_record, enter=FLEET_DETAIL_ENTER_FLAGSHIP,
long_click=False, out=FLEET_DETAIL_CHECK):
self.ui_click(FLEET_DETAIL, appear_button=page_fleet.check_button,
check_button=FLEET_DETAIL_CHECK, skip_first_screenshot=True)
super().fleet_equipment_take_on_preset(preset_record=preset_record, enter=FLEET_DETAIL_ENTER_FLAGSHIP,
long_click=False, out=FLEET_DETAIL_CHECK)
self.ui_back(FLEET_CHECK)
self.ui_ensure(page_fleet)
self.ui_ensure_index(self._fleet_daily, letter=OCR_FLEET_INDEX, next_button=FLEET_NEXT, prev_button=FLEET_PREV)
super().equipment_take_off(enter=FLEET_ENTER, out=FLEET_CHECK, fleet=self.config.FLEET_DAILY_EQUIPMENT)
self.equipment_has_take_on = False
self.device.sleep(1)
return True
def fleet_equipment_take_off(self, enter=FLEET_DETAIL_ENTER_FLAGSHIP, long_click=False, out=FLEET_DETAIL_CHECK):
self.ui_click(FLEET_DETAIL, appear_button=page_fleet.check_button,
check_button=FLEET_DETAIL_CHECK, skip_first_screenshot=True)
super().fleet_equipment_take_off(enter=enter, long_click=long_click, out=out)
self.ui_back(FLEET_CHECK)
def fleet_enter_ship(self, button):
self.ui_click(FLEET_DETAIL, appear_button=page_fleet.check_button,
check_button=FLEET_DETAIL_CHECK, skip_first_screenshot=True)
self.ship_info_enter(button, long_click=False)
def fleet_back(self):
self.ui_back(FLEET_DETAIL_CHECK)
self.ui_back(FLEET_CHECK)

View File

@ -9,7 +9,7 @@ CLICK_SAFE_AREA = Button(area={'cn': (1215, 637, 1260, 686), 'en': (1215, 637, 1
DEFENDER_HP_AREA = Button(area={'cn': (691, 43, 1004, 58), 'en': (691, 43, 1004, 58), 'jp': (691, 44, 1005, 56), 'tw': (691, 43, 1004, 58)}, color={'cn': (239, 51, 15), 'en': (239, 51, 15), 'jp': (244, 115, 98), 'tw': (239, 51, 15)}, button={'cn': (691, 43, 1004, 58), 'en': (691, 43, 1004, 58), 'jp': (691, 44, 1005, 56), 'tw': (691, 43, 1004, 58)}, file={'cn': './assets/cn/exercise/DEFENDER_HP_AREA.png', 'en': './assets/en/exercise/DEFENDER_HP_AREA.png', 'jp': './assets/jp/exercise/DEFENDER_HP_AREA.png', 'tw': './assets/tw/exercise/DEFENDER_HP_AREA.png'})
EQUIP_EDIT_ACTIVE = Button(area={'cn': (51, 608, 245, 668), 'en': (50, 607, 247, 670), 'jp': (53, 610, 245, 667), 'tw': (51, 607, 247, 668)}, color={'cn': (191, 159, 109), 'en': (186, 157, 105), 'jp': (192, 159, 109), 'tw': (191, 159, 109)}, button={'cn': (51, 608, 245, 668), 'en': (50, 607, 247, 670), 'jp': (53, 610, 245, 667), 'tw': (51, 607, 247, 668)}, file={'cn': './assets/cn/exercise/EQUIP_EDIT_ACTIVE.png', 'en': './assets/en/exercise/EQUIP_EDIT_ACTIVE.png', 'jp': './assets/jp/exercise/EQUIP_EDIT_ACTIVE.png', 'tw': './assets/tw/exercise/EQUIP_EDIT_ACTIVE.png'})
EQUIP_EDIT_INACTIVE = Button(area={'cn': (51, 608, 246, 667), 'en': (50, 607, 247, 670), 'jp': (50, 610, 244, 668), 'tw': (50, 608, 246, 669)}, color={'cn': (89, 112, 158), 'en': (88, 111, 156), 'jp': (90, 113, 160), 'tw': (92, 115, 160)}, button={'cn': (51, 608, 246, 667), 'en': (50, 607, 247, 670), 'jp': (50, 610, 244, 668), 'tw': (50, 608, 246, 669)}, file={'cn': './assets/cn/exercise/EQUIP_EDIT_INACTIVE.png', 'en': './assets/en/exercise/EQUIP_EDIT_INACTIVE.png', 'jp': './assets/jp/exercise/EQUIP_EDIT_INACTIVE.png', 'tw': './assets/tw/exercise/EQUIP_EDIT_INACTIVE.png'})
EQUIP_ENTER = Button(area={'cn': (351, 446, 361, 456), 'en': (351, 446, 361, 456), 'jp': (351, 446, 361, 456), 'tw': (351, 446, 361, 456)}, color={'cn': (252, 251, 252), 'en': (252, 251, 252), 'jp': (252, 251, 252), 'tw': (252, 251, 252)}, button={'cn': (351, 446, 361, 456), 'en': (351, 446, 361, 456), 'jp': (351, 446, 361, 456), 'tw': (351, 446, 361, 456)}, file={'cn': './assets/cn/exercise/EQUIP_ENTER.png', 'en': './assets/en/exercise/EQUIP_ENTER.png', 'jp': './assets/jp/exercise/EQUIP_ENTER.png', 'tw': './assets/tw/exercise/EQUIP_ENTER.png'})
EQUIP_ENTER = Button(area={'cn': (432, 283, 442, 293), 'en': (432, 283, 442, 293), 'jp': (432, 283, 442, 293), 'tw': (432, 283, 442, 293)}, color={'cn': (207, 206, 206), 'en': (207, 206, 206), 'jp': (207, 206, 206), 'tw': (207, 206, 206)}, button={'cn': (432, 283, 442, 293), 'en': (432, 283, 442, 293), 'jp': (432, 283, 442, 293), 'tw': (432, 283, 442, 293)}, file={'cn': './assets/cn/exercise/EQUIP_ENTER.png', 'en': './assets/en/exercise/EQUIP_ENTER.png', 'jp': './assets/jp/exercise/EQUIP_ENTER.png', 'tw': './assets/tw/exercise/EQUIP_ENTER.png'})
EXERCISE_PREPARATION = Button(area={'cn': (543, 539, 741, 599), 'en': (541, 537, 743, 601), 'jp': (549, 543, 736, 595), 'tw': (542, 539, 742, 600)}, color={'cn': (235, 186, 114), 'en': (234, 182, 102), 'jp': (235, 184, 111), 'tw': (236, 187, 117)}, button={'cn': (543, 539, 741, 599), 'en': (541, 537, 743, 601), 'jp': (549, 543, 736, 595), 'tw': (542, 539, 742, 600)}, file={'cn': './assets/cn/exercise/EXERCISE_PREPARATION.png', 'en': './assets/en/exercise/EXERCISE_PREPARATION.png', 'jp': './assets/jp/exercise/EXERCISE_PREPARATION.png', 'tw': './assets/tw/exercise/EXERCISE_PREPARATION.png'})
NEW_OPPONENT = Button(area={'cn': (1065, 340, 1204, 382), 'en': (1064, 339, 1205, 384), 'jp': (1064, 339, 1204, 383), 'tw': (1066, 342, 1203, 381)}, color={'cn': (129, 166, 220), 'en': (128, 165, 221), 'jp': (131, 165, 220), 'tw': (138, 172, 222)}, button={'cn': (1065, 340, 1204, 382), 'en': (1064, 339, 1205, 384), 'jp': (1064, 339, 1204, 383), 'tw': (1066, 342, 1203, 381)}, file={'cn': './assets/cn/exercise/NEW_OPPONENT.png', 'en': './assets/en/exercise/NEW_OPPONENT.png', 'jp': './assets/jp/exercise/NEW_OPPONENT.png', 'tw': './assets/tw/exercise/NEW_OPPONENT.png'})
OCR_EXERCISE_REMAIN = Button(area={'cn': (1153, 140, 1178, 165), 'en': (1153, 140, 1178, 165), 'jp': (1153, 140, 1178, 165), 'tw': (1153, 140, 1178, 165)}, color={'cn': (96, 132, 113), 'en': (96, 132, 113), 'jp': (96, 132, 113), 'tw': (96, 132, 113)}, button={'cn': (1153, 140, 1178, 165), 'en': (1153, 140, 1178, 165), 'jp': (1153, 140, 1178, 165), 'tw': (1153, 140, 1178, 165)}, file={'cn': './assets/cn/exercise/OCR_EXERCISE_REMAIN.png', 'en': './assets/en/exercise/OCR_EXERCISE_REMAIN.png', 'jp': './assets/jp/exercise/OCR_EXERCISE_REMAIN.png', 'tw': './assets/tw/exercise/OCR_EXERCISE_REMAIN.png'})

View File

@ -174,15 +174,15 @@ class ExerciseCombat(HpDaemon, OpponentChoose, ExerciseEquipment):
return False
self._choose_opponent(0)
super().equipment_take_off()
self.equipment_take_off()
self._preparation_quit()
# def equipment_take_on(self):
# if self.config.EXERCISE_FLEET_EQUIPMENT is None:
# return False
# if self.equipment_has_take_on:
# return False
#
# self._choose_opponent(0)
# super().equipment_take_on()
# self._preparation_quit()
def equipment_take_on(self):
if self.config.EXERCISE_FLEET_EQUIPMENT is None:
return False
if self.equipment_has_take_on:
return False
self._choose_opponent(0)
super().equipment_take_on()
self._preparation_quit()

View File

@ -1,10 +1,10 @@
from module.base.timer import Timer
from module.combat.assets import BATTLE_PREPARATION
from module.equipment.equipment import Equipment
from module.equipment.equipment_change import EquipmentChange
from module.exercise.assets import *
class ExerciseEquipment(Equipment):
class ExerciseEquipment(EquipmentChange):
def _active_edit(self):
timer = Timer(5)
while 1:
@ -32,23 +32,12 @@ class ExerciseEquipment(Equipment):
break
def equipment_take_on(self):
if self.config.EXERCISE_FLEET_EQUIPMENT is None:
return False
if self.equipment_has_take_on:
return False
self._active_edit()
super().equipment_take_on(enter=EQUIP_ENTER, out=BATTLE_PREPARATION, fleet=self.config.EXERCISE_FLEET_EQUIPMENT)
self.fleet_equipment_take_on_preset(preset_record=self.config.EXERCISE_FLEET_EQUIPMENT, enter=EQUIP_ENTER,
long_click=True, out=BATTLE_PREPARATION)
self._inactive_edit()
return True
def equipment_take_off(self):
if self.config.EXERCISE_FLEET_EQUIPMENT is None:
return False
if not self.equipment_has_take_on:
return False
self._active_edit()
super().equipment_take_off(enter=EQUIP_ENTER, out=BATTLE_PREPARATION, fleet=self.config.EXERCISE_FLEET_EQUIPMENT)
self.fleet_equipment_take_off(enter=EQUIP_ENTER, long_click=True, out=BATTLE_PREPARATION)
self._inactive_edit()
return True

View File

@ -1,17 +1,19 @@
from module.equipment.equipment import Equipment
from module.equipment.equipment_change import EquipmentChange
from module.hard.assets import *
from module.map.assets import *
class HardEquipment(Equipment):
class HardEquipment(EquipmentChange):
def equipment_take_on(self):
if self.config.FLEET_HARD_EQUIPMENT is None:
return False
if self.equipment_has_take_on:
return False
enter = EQUIP_ENTER_1 if self.config.FLEET_HARD == 1 else EQUIP_ENTER_2
super().equipment_take_on(enter=enter, out=FLEET_PREPARATION, fleet=self.config.FLEET_HARD_EQUIPMENT)
enter = EQUIP_ENTER_1 if self.config.Hard_HardFleet == 1 else EQUIP_ENTER_2
self.fleet_equipment_take_on_preset(preset_record=self.config.FLEET_HARD_EQUIPMENT, enter=enter,
long_click=True, out=FLEET_PREPARATION)
return True
def equipment_take_off(self):
@ -20,6 +22,6 @@ class HardEquipment(Equipment):
if not self.equipment_has_take_on:
return False
enter = EQUIP_ENTER_1 if self.config.FLEET_HARD == 1 else EQUIP_ENTER_2
super().equipment_take_off(enter=enter, out=FLEET_PREPARATION, fleet=self.config.FLEET_HARD_EQUIPMENT)
enter = EQUIP_ENTER_1 if self.config.Hard_HardFleet == 1 else EQUIP_ENTER_2
self.fleet_equipment_take_off(enter=enter, long_click=True, out=FLEET_PREPARATION)
return True

View File

@ -1,13 +1,13 @@
from module.base.button import ButtonGrid
from module.base.decorator import cached_property
from module.base.timer import Timer
from module.equipment.equipment import Equipment
from module.logger import logger
from module.ocr.ocr import DigitCounter
from module.retire.assets import *
from module.ui.scroll import Scroll
from module.ui.setting import Setting
from module.ui.switch import Switch
from module.ui.ui import UI
DOCK_SORTING = Switch('Dork_sorting')
DOCK_SORTING.add_status('Ascending', check_button=SORT_ASC, click_button=SORTING_CLICK)
@ -28,7 +28,7 @@ DOCK_SCROLL = Scroll(DOCK_SCROLL, color=(247, 211, 66), name='DOCK_SCROLL')
OCR_DOCK_SELECTED = DigitCounter(DOCK_SELECTED, threshold=64, name='OCR_DOCK_SELECTED')
class Dock(Equipment):
class Dock(UI):
def handle_dock_cards_loading(self):
# Poor implementation.
self.device.sleep((1, 1.5))