2020-09-18 21:43:32 +08:00
|
|
|
from module.campaign.campaign_base import CampaignBase
|
2021-10-25 18:49:56 +08:00
|
|
|
from module.daemon.daemon_base import DaemonBase
|
|
|
|
|
from module.exception import CampaignEnd
|
2020-09-18 21:43:32 +08:00
|
|
|
from module.handler.ambush import MAP_AMBUSH_EVADE
|
2022-04-15 03:37:54 +08:00
|
|
|
from module.map.map_operation import FLEET_PREPARATION, MAP_PREPARATION
|
2020-03-29 01:22:46 +08:00
|
|
|
|
|
|
|
|
|
2021-10-25 18:49:56 +08:00
|
|
|
class AzurLaneDaemon(DaemonBase, CampaignBase):
|
|
|
|
|
def run(self):
|
2020-03-29 01:22:46 +08:00
|
|
|
while 1:
|
|
|
|
|
self.device.screenshot()
|
|
|
|
|
|
|
|
|
|
# If is running a combat, do nothing.
|
|
|
|
|
if self.is_combat_executing():
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# Combat
|
|
|
|
|
if self.combat_appear():
|
|
|
|
|
self.combat_preparation()
|
2020-05-22 21:48:56 +08:00
|
|
|
try:
|
2021-10-25 18:49:56 +08:00
|
|
|
if self.handle_battle_status():
|
|
|
|
|
self.combat_status(expected_end='no_searching')
|
2020-05-22 21:48:56 +08:00
|
|
|
continue
|
|
|
|
|
except CampaignEnd:
|
2020-03-29 01:22:46 +08:00
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# Map operation
|
2021-10-25 18:49:56 +08:00
|
|
|
if self.appear_then_click(MAP_AMBUSH_EVADE, offset=(20, 20)):
|
2020-03-29 01:22:46 +08:00
|
|
|
self.device.sleep(1)
|
|
|
|
|
continue
|
2021-10-25 18:49:56 +08:00
|
|
|
if self.handle_mystery_items():
|
2020-03-29 01:22:46 +08:00
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# Map preparation
|
2021-10-25 18:49:56 +08:00
|
|
|
if self.config.Daemon_EnterMap:
|
2021-06-20 17:03:35 +08:00
|
|
|
if self.appear_then_click(MAP_PREPARATION, offset=(20, 20), interval=2):
|
2020-03-29 01:22:46 +08:00
|
|
|
continue
|
2023-10-19 21:36:19 +08:00
|
|
|
if self.appear_then_click(FLEET_PREPARATION, offset=(20, 50), interval=2):
|
2020-03-29 01:22:46 +08:00
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# Retire
|
2021-09-04 11:10:43 +08:00
|
|
|
if self.handle_retirement():
|
|
|
|
|
continue
|
2020-03-29 01:22:46 +08:00
|
|
|
|
|
|
|
|
# Emotion
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
# Urgent commission
|
2021-10-25 18:49:56 +08:00
|
|
|
if self.handle_urgent_commission():
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# Popups
|
|
|
|
|
if self.handle_guild_popup_cancel():
|
|
|
|
|
return True
|
|
|
|
|
if self.handle_vote_popup():
|
2020-03-29 01:22:46 +08:00
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# Story
|
2021-10-25 18:49:56 +08:00
|
|
|
if self.story_skip():
|
|
|
|
|
continue
|
2020-03-29 01:22:46 +08:00
|
|
|
|
|
|
|
|
# End
|
|
|
|
|
# No end condition, stop it manually.
|
|
|
|
|
|
|
|
|
|
return True
|
2021-10-25 18:49:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
b = AzurLaneDaemon('alas', task='Daemon')
|
|
|
|
|
b.run()
|