1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 13:19:25 +08:00
Files
Alas/module/os/operation_siren.py
0O0o0oOoO00 8d17eeb803 Merge remote-tracking branch 'LmeSzinc/master' into dev
# Conflicts:
#	module/coalition/coalition.py
#	module/config/argument/args.json
2026-01-23 10:21:18 +08:00

115 lines
4.7 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
class OperationSiren(
OpsiDaily,
OpsiShop,
OpsiVoucher,
OpsiMeowfficerFarming,
OpsiHazard1Leveling,
OpsiObscure,
OpsiAbyssal,
OpsiArchive,
OpsiStronghold,
OpsiMonthBoss,
OpsiExplore,
OpsiCrossMonth,
):
"""
Operation Siren main class that combines all task modules.
"""
pass
class OperationSiren(OperationSiren):
def os_hazard1_leveling(self):
logger.hr('OS hazard 1 leveling', level=1)
# Without these enabled, CL1 gains 0 profits
self.config.override(
OpsiGeneral_DoRandomMapEvent=True,
OpsiGeneral_AkashiShopFilter='ActionPoint',
)
full_config = self.config.full_config
no_opsi_meowfficer_farming = full_config.OpsiHazard1Leveling_OpsiHazard1Leveling_NoOpsiMeowfficerFarming
no_yellow_coin_limit = full_config.OpsiHazard1Leveling_OpsiHazard1Leveling_NoYellowCoinLimit
action_point_upper_limit = full_config.OpsiHazard1Leveling_OpsiHazard1Leveling_ActionPointUpperLimit
if no_opsi_meowfficer_farming:
logger.info(f"No OpsiMeowfficerFarming is enabled in OpsiHazard1Leveling")
else:
if not self.config.is_task_enabled('OpsiMeowfficerFarming'):
self.config.cross_set(keys='OpsiMeowfficerFarming.Scheduler.Enable', value=True)
while True:
# Limited action point preserve of hazard 1 to 200
self.config.OS_ACTION_POINT_PRESERVE = 200
if self.config.is_task_enabled('OpsiAshBeacon') \
and not self._ash_fully_collected \
and self.config.OpsiAshBeacon_EnsureFullyCollected:
logger.info('Ash beacon not fully collected, ignore action point limit temporarily')
self.config.OS_ACTION_POINT_PRESERVE = 0
logger.attr('OS_ACTION_POINT_PRESERVE', self.config.OS_ACTION_POINT_PRESERVE)
if not no_yellow_coin_limit:
if self.get_yellow_coins() < self.config.OS_CL1_YELLOW_COINS_PRESERVE:
logger.info(f'Reach the limit of yellow coins, preserve={self.config.OS_CL1_YELLOW_COINS_PRESERVE}')
with self.config.multi_set():
self.config.task_delay(server_update=True)
if not self.is_in_opsi_explore():
self.config.task_call('OpsiMeowfficerFarming')
self.config.task_stop()
self.get_current_zone()
# Preset action point to 70
# When running CL1 oil is for running CL1, not meowfficer farming
keep_current_ap = True
if self.config.OpsiGeneral_BuyActionPointLimit > 0:
keep_current_ap = False
self.action_point_set(cost=70, keep_current_ap=keep_current_ap, check_rest_ap=True)
if self._action_point_total >= action_point_upper_limit and not no_opsi_meowfficer_farming:
with self.config.multi_set():
self.config.task_delay(server_update=True)
if not self.is_in_opsi_explore():
self.config.task_call('OpsiMeowfficerFarming')
self.config.task_stop()
if self.config.OpsiHazard1Leveling_TargetZone != 0:
zone = self.config.OpsiHazard1Leveling_TargetZone
else:
zone = 22
logger.hr(f'OS hazard 1 leveling, zone_id={zone}', level=1)
if self.zone.zone_id != zone or not self.is_zone_name_hidden:
self.globe_goto(self.name_to_zone(zone), types='SAFE', refresh=True)
self.fleet_set(self.config.OpsiFleet_Fleet)
self.run_strategic_search()
self.handle_after_auto_search()
self.config.check_task_switch()
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()