mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 14:29:26 +08:00
103 lines
4.2 KiB
Python
103 lines
4.2 KiB
Python
from module.logger import logger
|
|
from module.os.config import OSConfig
|
|
from module.os.tasks.abyssal import OpsiAbyssal
|
|
from module.os.tasks.archive import OpsiArchive
|
|
from module.os.tasks.cross_month import OpsiCrossMonth
|
|
from module.os.tasks.daily import OpsiDaily
|
|
from module.os.tasks.explore import OpsiExplore
|
|
from module.os.tasks.hazard_leveling import OpsiHazard1Leveling
|
|
from module.os.tasks.meowfficer_farming import OpsiMeowfficerFarming
|
|
from module.os.tasks.month_boss import OpsiMonthBoss
|
|
from module.os.tasks.obscure import OpsiObscure
|
|
from module.os.tasks.shop import OpsiShop
|
|
from module.os.tasks.stronghold import OpsiStronghold
|
|
from module.os.tasks.voucher import OpsiVoucher
|
|
|
|
from datetime import datetime, timedelta
|
|
from module.notify import handle_notify
|
|
from module.exception import ScriptError
|
|
from module.equipment.assets import EQUIPMENT_OPEN
|
|
from module.os.ship_exp import ship_info_get_level_exp
|
|
from module.os.ship_exp_data import LIST_SHIP_EXP
|
|
from module.os.assets import FLEET_FLAGSHIP
|
|
|
|
class OperationSiren(
|
|
OpsiDaily,
|
|
OpsiShop,
|
|
OpsiVoucher,
|
|
OpsiMeowfficerFarming,
|
|
OpsiHazard1Leveling,
|
|
OpsiObscure,
|
|
OpsiAbyssal,
|
|
OpsiArchive,
|
|
OpsiStronghold,
|
|
OpsiMonthBoss,
|
|
OpsiExplore,
|
|
OpsiCrossMonth,
|
|
):
|
|
"""
|
|
Operation Siren main class that combines all task modules.
|
|
"""
|
|
|
|
|
|
def os_check_leveling(self):
|
|
def os_check_leveling(self):
|
|
logger.hr('OS check leveling', level=1)
|
|
logger.attr('OpsiCheckLeveling_LastRun', self.config.OpsiCheckLeveling_LastRun)
|
|
time_run = self.config.OpsiCheckLeveling_LastRun + timedelta(hours=6)
|
|
logger.info(f'Task OpsiCheckLeveling run time is {time_run}')
|
|
if datetime.now().replace(microsecond=0) < time_run:
|
|
logger.info('Not running time, skip')
|
|
return
|
|
target_level = self.config.OpsiCheckLeveling_TargetLevel
|
|
if not isinstance(target_level, int) or target_level < 0 or target_level > 125:
|
|
logger.error(f'Invalid target level: {target_level}, must be an integer between 0 and 125')
|
|
raise ScriptError(f'Invalid opsi ship target level: {target_level}')
|
|
if target_level == 0:
|
|
logger.info('Target level is 0, skip')
|
|
return
|
|
|
|
logger.attr('Fleet to check', self.config.OpsiFleet_Fleet)
|
|
self.fleet_set(self.config.OpsiFleet_Fleet)
|
|
self.ship_info_enter(FLEET_FLAGSHIP)
|
|
all_full_exp = True
|
|
|
|
while 1:
|
|
self.device.screenshot()
|
|
level, exp = ship_info_get_level_exp(main=self)
|
|
current_total_exp = LIST_SHIP_EXP[level - 1] + exp
|
|
logger.info(
|
|
f'Level: {level}, Exp: {exp}, Total Exp: {current_total_exp}, Target Exp: {LIST_SHIP_EXP[target_level - 1]}')
|
|
if current_total_exp < LIST_SHIP_EXP[target_level - 1]:
|
|
all_full_exp = False
|
|
break
|
|
if not self.ship_view_next():
|
|
break
|
|
|
|
if all_full_exp:
|
|
logger.info(f'All ships in fleet {self.config.OpsiFleet_Fleet} are full exp, '
|
|
f'level {target_level} or above')
|
|
handle_notify(
|
|
self.config.Error_OnePushConfig,
|
|
title=f"Alas <{self.config.config_name}> level check passed",
|
|
content=f"<{self.config.config_name}> {self.config.task} reached level limit {target_level} or above."
|
|
)
|
|
self.ui_back(appear_button=EQUIPMENT_OPEN, check_button=self.is_in_map)
|
|
self.config.OpsiCheckLeveling_LastRun = datetime.now().replace(microsecond=0)
|
|
if all_full_exp and self.config.OpsiCheckLeveling_DelayAfterFull:
|
|
logger.info('Delay task after all ships are full exp')
|
|
self.config.task_delay(server_update=True)
|
|
self.config.task_stop()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
self = OperationSiren('alas', task='OpsiMonthBoss')
|
|
|
|
self.config = self.config.merge(OSConfig())
|
|
|
|
self.device.screenshot()
|
|
self.os_init()
|
|
|
|
logger.hr("OS clear Month Boss", level=1)
|
|
self.clear_month_boss()
|