AzurLaneAutoScript/module/exercise/equipment.py
Air111 2507b0fa6b
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
2024-04-19 01:40:40 +08:00

44 lines
1.4 KiB
Python

from module.base.timer import Timer
from module.combat.assets import BATTLE_PREPARATION
from module.equipment.equipment_change import EquipmentChange
from module.exercise.assets import *
class ExerciseEquipment(EquipmentChange):
def _active_edit(self):
timer = Timer(5)
while 1:
self.device.screenshot()
if timer.reached() and self.appear_then_click(EQUIP_EDIT_INACTIVE):
timer.reset()
# End
if self.appear(EQUIP_EDIT_ACTIVE):
self.device.sleep((0.2, 0.3))
break
def _inactive_edit(self):
timer = Timer(5)
while 1:
self.device.screenshot()
if timer.reached() and self.appear_then_click(EQUIP_EDIT_ACTIVE):
timer.reset()
# End
if self.appear(EQUIP_EDIT_INACTIVE):
self.device.sleep((0.2, 0.3))
break
def equipment_take_on(self):
self._active_edit()
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()
def equipment_take_off(self):
self._active_edit()
self.fleet_equipment_take_off(enter=EQUIP_ENTER, long_click=True, out=BATTLE_PREPARATION)
self._inactive_edit()