Add: OpsiCrossMonth, not tested

This commit is contained in:
LmeSzinc 2022-11-30 01:40:53 +08:00
parent 43c96719a1
commit b8d06b12e5
14 changed files with 198 additions and 8 deletions

View File

@ -308,6 +308,10 @@ class AzurLaneAutoScript:
from module.campaign.os_run import OSCampaignRun
OSCampaignRun(config=self.config, device=self.device).opsi_meowfficer_farming()
def opsi_cross_month(self):
from module.campaign.os_run import OSCampaignRun
OSCampaignRun(config=self.config, device=self.device).opsi_cross_month()
def main(self):
from module.campaign.run import CampaignRun
CampaignRun(config=self.config, device=self.device).run(

View File

@ -1594,6 +1594,16 @@
"Submarine": false
}
},
"OpsiCrossMonth": {
"Scheduler": {
"Enable": false,
"NextRun": "2020-01-01 00:00:00",
"Command": "OpsiCrossMonth",
"SuccessInterval": 0,
"FailureInterval": 120,
"ServerUpdate": "00:00"
}
},
"Daemon": {
"Daemon": {
"EnterMap": true

View File

@ -74,3 +74,10 @@ class OSCampaignRun(OSMapOperation):
self.campaign.os_stronghold()
except ActionPointLimit:
self.config.opsi_task_delay(ap_limit=True)
def opsi_cross_month(self):
try:
self.load_campaign()
self.campaign.os_cross_month()
except ActionPointLimit:
self.campaign.os_cross_month_end()

View File

@ -7907,6 +7907,39 @@
}
}
},
"OpsiCrossMonth": {
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
},
"NextRun": {
"type": "datetime",
"value": "2020-01-01 00:00:00",
"validate": "datetime"
},
"Command": {
"type": "input",
"value": "OpsiCrossMonth",
"display": "hide"
},
"SuccessInterval": {
"type": "input",
"value": 0,
"display": "hide"
},
"FailureInterval": {
"type": "input",
"value": 120,
"display": "hide"
},
"ServerUpdate": {
"type": "input",
"value": "00:00",
"display": "hide"
}
}
},
"Daemon": {
"Daemon": {
"EnterMap": {

View File

@ -57,7 +57,8 @@
"OpsiObscure",
"OpsiAbyssal",
"OpsiStronghold",
"OpsiMeowfficerFarming"
"OpsiMeowfficerFarming",
"OpsiCrossMonth"
],
"Tool": [
"Daemon",

View File

@ -263,6 +263,8 @@ OpsiMeowfficerFarming:
- Scheduler
- OpsiMeowfficerFarming
- OpsiFleet
OpsiCrossMonth:
- Scheduler
# ==================== Tool ====================

View File

@ -287,11 +287,9 @@ class AzurLaneConfig(ConfigUpdater, ManualConfig, GeneratedConfig, ConfigWatcher
"Reward",
]
)
limit_next_run(
["Commission", "Reward"], limit=now + timedelta(hours=12, seconds=-1)
)
limit_next_run(["Commission", "Reward"], limit=now + timedelta(hours=12, seconds=-1))
limit_next_run(["Research"], limit=now + timedelta(hours=24, seconds=-1))
limit_next_run(["OpsiExplore"], limit=now + timedelta(days=31, seconds=-1))
limit_next_run(["OpsiExplore", "OpsiCrossMonth"], limit=now + timedelta(days=31, seconds=-1))
limit_next_run(self.args.keys(), limit=now + timedelta(hours=24, seconds=-1))
def override(self, **kwargs):

View File

@ -10,6 +10,7 @@ class ManualConfig:
SCHEDULER_PRIORITY = """
Restart
> OpsiCrossMonth
> Commission > Tactical > Research
> Exercise
> Dorm > Meowfficer > Guild > Gacha

View File

@ -218,6 +218,10 @@
"name": "Meowfficer Farming",
"help": ""
},
"OpsiCrossMonth": {
"name": "Cross Month Daily",
"help": " ALAS will enter OpSi 10min before OpSi reset, wait until OpSi reset but not exit OpSi. Then do the daily, obscure, abyssal and meowfficer farming to get extra gold plates. When running dailies, settings in task \"OpsiDaily\" are used, the rest function are the same.\n IMPORTANT: Please do not touch the game while ALAS is waiting for OpSi reset."
},
"Daemon": {
"name": "Normal Semi-auto",
"help": ""

View File

@ -218,6 +218,10 @@
"name": "Task.OpsiMeowfficerFarming.name",
"help": "Task.OpsiMeowfficerFarming.help"
},
"OpsiCrossMonth": {
"name": "Task.OpsiCrossMonth.name",
"help": "Task.OpsiCrossMonth.help"
},
"Daemon": {
"name": "Task.Daemon.name",
"help": "Task.Daemon.help"

View File

@ -218,6 +218,10 @@
"name": "短猫相接",
"help": ""
},
"OpsiCrossMonth": {
"name": "跨月每日",
"help": " Alas将在大世界跨月重置之前10分钟进入大世界等待大世界重置但不退出大世界然后完成新一天的大世界每日、隐秘海域、深渊海域和短猫相接以获得额外的金菜。运行大世界每日时按\"大世界每日\"任务设置运行,其余同理。\n 重要Alas等待跨月期间请不要操作游戏。"
},
"Daemon": {
"name": "半自动点击",
"help": ""

View File

@ -218,6 +218,10 @@
"name": "短貓相接",
"help": ""
},
"OpsiCrossMonth": {
"name": "跨月每日",
"help": " Alas將在大世界跨月重置之前10分鐘進入大世界等待大世界重置但不退出大世界然後完成新一天的大世界每日、隱秘海域、深淵海域和短貓相接以獲得額外的金菜。運行大世界每日時按\"大世界每日\"任務設置運行,其餘同理。\n 重要Alas等待跨月期間請不要操作遊戲。"
},
"Daemon": {
"name": "半自動點擊",
"help": ""

View File

@ -359,9 +359,14 @@ class OSMap(OSFleet, Map, GlobeCamera):
"""
remain = get_os_reset_remain()
if remain <= 0:
logger.info('Just less than 1 day to OpSi reset, '
'set OpsiMeowfficerFarming.ActionPointPreserve to 0 temporarily')
self.config.override(OpsiMeowfficerFarming_ActionPointPreserve=0)
if self.config.cross_get('OpsiCrossMonth.Scheduler.Enable', default=False):
logger.info('Just less than 1 day to OpSi reset, OpsiCrossMonth is enabled'
'set OpsiMeowfficerFarming.ActionPointPreserve to 300 temporarily')
self.config.override(OpsiMeowfficerFarming_ActionPointPreserve=300)
else:
logger.info('Just less than 1 day to OpSi reset, '
'set OpsiMeowfficerFarming.ActionPointPreserve to 0 temporarily')
self.config.override(OpsiMeowfficerFarming_ActionPointPreserve=0)
return True
elif remain <= 2:
logger.info('Just less than 3 days to OpSi reset, '

View File

@ -1,3 +1,5 @@
from datetime import datetime, timedelta
import numpy as np
from module.config.utils import (get_os_next_reset,
@ -121,6 +123,117 @@ class OperationSiren(OSMap):
self.config.task_delay(server_update=True)
def os_cross_month_end(self):
self.config.task_delay(target=get_os_next_reset() - timedelta(minutes=10))
self.config.task_stop()
def os_cross_month(self):
next_reset = get_os_next_reset()
now = datetime.now()
logger.attr('OpsiNextReset', next_reset)
# Check start time
if next_reset < now:
raise ScriptError(f'Invalid OpsiNextReset: {next_reset} < {now}')
if next_reset - now > timedelta(days=3):
logger.error('Too long to next reset, OpSi might reset already. '
'Running OpsiCrossMonth is meaningless, stopped.')
self.os_cross_month_end()
if next_reset - now > timedelta(minutes=10):
logger.error('Too long to next reset, too far from OpSi reset. '
'Running OpsiCrossMonth is meaningless, stopped.')
self.os_cross_month_end()
# Now we are 10min before OpSi reset
logger.hr('Wait until OpSi reset', level=1)
logger.warning('ALAS is now waiting for next OpSi reset, please DO NOT touch the game during wait')
while 1:
logger.info(f'Wait until {next_reset}')
now = datetime.now()
remain = (next_reset - now).total_seconds()
if remain <= 0:
break
else:
self.device.sleep(min(remain, 60))
continue
logger.hr('OpSi reset', level=3)
logger.hr('OpSi clear daily', level=1)
def false_func(*args, **kwargs):
return False
self.is_in_opsi_explore = false_func
while 1:
# If unable to receive more dailies, finish them and try again.
success = self.os_mission_overview_accept()
# Re-init zone name
# MISSION_ENTER appear from the right,
# need to confirm that the animation has ended,
# or it will click on MAP_GOTO_GLOBE
self.zone_init()
self.os_finish_daily_mission()
if success:
break
logger.hr('OS clear abyssal', level=1)
self.config.override(
OpsiGeneral_DoRandomMapEvent=False,
HOMO_EDGE_DETECT=False,
STORY_OPTION=0,
OpsiGeneral_UseLogger=True,
# Obscure
OpsiObscure_ForceRun=True,
OpsiFleet_Fleet=self.config.cross_get('OpsiObscure.OpsiFleet.Fleet'),
OpsiFleet_Submarine=False,
# Abyssal
OpsiFleetFilter_Filter=self.config.cross_get('OpsiAbyssal.OpsiFleetFilter.Filter'),
OpsiAbyssal_ForceRun=True,
)
if self.storage_get_next_item('ABYSSAL', use_logger=True):
self.zone_init()
result = self.run_abyssal()
if not result:
self.map_exit()
self.fleet_repair(revert=False)
logger.hr('OS clear obscure', level=1)
if self.storage_get_next_item('OBSCURE', use_logger=True):
self.zone_init()
self.fleet_set(self.config.OpsiFleet_Fleet)
self.os_order_execute(
recon_scan=True,
submarine_call=False)
self.run_auto_search(rescan=False)
self.map_exit()
self.handle_after_auto_search()
logger.hr(f'OS meowfficer farming, hazard_level=3', level=1)
self.config.override(
OpsiGeneral_DoRandomMapEvent=True,
HOMO_EDGE_DETECT=True,
STORY_OPTION=-2,
# Meowfficer farming
OpsiFleet_Fleet=self.config.cross_get('OpsiMeowfficerFarming.OpsiFleet.Fleet'),
OpsiFleet_Submarine=False,
OpsiMeowfficerFarming_ActionPointPreserve=0,
OpsiMeowfficerFarming_HazardLevel=3,
OpsiMeowfficerFarming_TargetZone=0,
)
while 1:
zones = self.zone_select(hazard_level=3) \
.delete(SelectedGrids([self.zone])) \
.delete(SelectedGrids(self.zones.select(is_port=True))) \
.sort_by_clock_degree(center=(1252, 1012), start=self.zone.location)
logger.hr(f'OS meowfficer farming, zone_id={zones[0].zone_id}', level=1)
self.globe_goto(zones[0])
self.fleet_set(self.config.OpsiFleet_Fleet)
self.os_order_execute(
recon_scan=False,
submarine_call=False)
self.run_auto_search()
self.handle_after_auto_search()
def os_shop(self):
self.os_port_daily(mission=False, supply=self.config.OpsiShop_BuySupply)
self.config.task_delay(server_update=True)