2022-02-07 09:56:52 +08:00
|
|
|
from module.meowfficer.buy import MeowfficerBuy
|
|
|
|
from module.meowfficer.fort import MeowfficerFort
|
|
|
|
from module.meowfficer.train import MeowfficerTrain
|
2023-07-02 15:24:40 +08:00
|
|
|
from module.ui.page import page_meowfficer
|
2023-11-17 20:00:32 +08:00
|
|
|
from module.meowfficer.assets import MEOWFFICER_BUY_ENTER
|
2020-08-14 11:54:30 +08:00
|
|
|
|
2021-07-19 07:27:47 +08:00
|
|
|
|
2022-02-07 09:56:52 +08:00
|
|
|
class RewardMeowfficer(MeowfficerBuy, MeowfficerFort, MeowfficerTrain):
|
2023-11-18 19:18:26 +08:00
|
|
|
def wait_meowfficer_buttons(self, skip_first_screenshot=True):
|
|
|
|
"""
|
|
|
|
MEOWFFICER_INFO and MEOWFFICER_BUY_ENTER
|
|
|
|
loads slowly than MEOWFFICER_CHECK
|
|
|
|
"""
|
|
|
|
while 1:
|
|
|
|
if skip_first_screenshot:
|
|
|
|
skip_first_screenshot = False
|
|
|
|
else:
|
|
|
|
self.device.screenshot()
|
|
|
|
|
|
|
|
if self.appear(MEOWFFICER_BUY_ENTER, offset=(20, 20)):
|
|
|
|
break
|
|
|
|
|
|
|
|
# MEOWFFICER_INFO
|
|
|
|
if self.ui_additional():
|
|
|
|
continue
|
|
|
|
|
2021-09-21 12:46:41 +08:00
|
|
|
def run(self):
|
2020-12-05 22:34:12 +08:00
|
|
|
"""
|
2022-02-07 09:56:52 +08:00
|
|
|
Execute buy, enhance, train, and fort operations
|
|
|
|
if enabled in configurations
|
2020-12-07 01:25:45 +08:00
|
|
|
|
2020-12-05 22:34:12 +08:00
|
|
|
Pages:
|
|
|
|
in: Any page
|
2021-09-21 12:46:41 +08:00
|
|
|
out: page_meowfficer
|
2020-12-05 22:34:12 +08:00
|
|
|
"""
|
2021-09-21 12:46:41 +08:00
|
|
|
if self.config.Meowfficer_BuyAmount <= 0 \
|
2022-03-06 21:11:06 +08:00
|
|
|
and not self.config.Meowfficer_FortChoreMeowfficer \
|
2022-03-07 20:27:34 +08:00
|
|
|
and not self.config.MeowfficerTrain_Enable:
|
2021-09-21 12:46:41 +08:00
|
|
|
self.config.Scheduler_Enable = False
|
|
|
|
self.config.task_stop()
|
2020-12-05 22:34:12 +08:00
|
|
|
|
|
|
|
self.ui_ensure(page_meowfficer)
|
2023-11-18 19:18:26 +08:00
|
|
|
self.wait_meowfficer_buttons() # Wait for the ui to load fully
|
2020-12-05 22:34:12 +08:00
|
|
|
|
2021-09-21 12:46:41 +08:00
|
|
|
if self.config.Meowfficer_BuyAmount > 0:
|
2020-12-05 22:34:12 +08:00
|
|
|
self.meow_buy()
|
2021-09-21 12:46:41 +08:00
|
|
|
if self.config.Meowfficer_FortChoreMeowfficer:
|
2021-07-19 07:44:35 +08:00
|
|
|
self.meow_fort()
|
|
|
|
|
2022-03-07 20:27:34 +08:00
|
|
|
# Train
|
|
|
|
if self.config.MeowfficerTrain_Enable:
|
|
|
|
self.meow_train()
|
2022-03-07 22:28:19 +08:00
|
|
|
if self.config.MeowfficerTrain_Mode == 'seamlessly':
|
2022-03-07 20:27:34 +08:00
|
|
|
self.meow_enhance()
|
2022-03-07 22:28:19 +08:00
|
|
|
elif self.meow_is_sunday():
|
|
|
|
self.meow_enhance()
|
|
|
|
else:
|
|
|
|
pass
|
2022-03-07 20:27:34 +08:00
|
|
|
|
|
|
|
# Scheduler
|
|
|
|
if self.config.MeowfficerTrain_Enable:
|
2022-03-06 21:11:06 +08:00
|
|
|
# Meowfficer training duration:
|
|
|
|
# - Blue, 2.0h ~ 2.5h
|
|
|
|
# - Purple, 5.5h ~ 6.5h
|
|
|
|
# - Gold, 9.5h ~ 10.5h
|
|
|
|
# Delay 2.5h ~ 3.5h when having meowfficers under training
|
|
|
|
self.config.task_delay(minute=(150, 210), server_update=True)
|
|
|
|
else:
|
|
|
|
self.config.task_delay(server_update=True)
|