Add: Maritime escort

This commit is contained in:
LmeSzinc 2022-01-15 22:08:17 +08:00
parent 6e81b91a65
commit 897d179bbd
36 changed files with 186 additions and 3 deletions

View File

@ -211,6 +211,10 @@ class AzurLaneAutoScript:
from module.event.campaign_sp import CampaignSP
CampaignSP(config=self.config, device=self.device).run()
def maritime_escort(self):
from module.event.maritime_escort import MaritimeEscort
MaritimeEscort(config=self.config, device=self.device).run()
def opsi_ash_assist(self):
from module.os_ash.ash import AshBeaconAssist
AshBeaconAssist(config=self.config, device=self.device).run()

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -1226,6 +1226,19 @@
"LowHpRetreatThreshold": 0.3
}
},
"MaritimeEscort": {
"Scheduler": {
"Enable": false,
"NextRun": "2020-01-01 00:00:00",
"Command": "MaritimeEscort",
"SuccessInterval": 30,
"FailureInterval": 30,
"ServerUpdate": "00:00"
},
"MaritimeEscort": {
"Enable": true
}
},
"OpsiGeneral": {
"OpsiGeneral": {
"UseLogger": true,

View File

@ -5810,6 +5810,41 @@
}
}
},
"MaritimeEscort": {
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
},
"NextRun": {
"type": "input",
"value": "2020-01-01 00:00:00",
"validate": "datetime"
},
"Command": {
"type": "disable",
"value": "MaritimeEscort"
},
"SuccessInterval": {
"type": "disable",
"value": 30
},
"FailureInterval": {
"type": "disable",
"value": 30
},
"ServerUpdate": {
"type": "disable",
"value": "00:00"
}
},
"MaritimeEscort": {
"Enable": {
"type": "checkbox",
"value": true
}
}
},
"OpsiGeneral": {
"OpsiGeneral": {
"UseLogger": {

View File

@ -425,6 +425,8 @@ EventCd:
RaidDaily:
StageFilter: |-
hard > normal > easy
MaritimeEscort:
Enable: true
# ==================== Opsi ====================

View File

@ -41,7 +41,8 @@
"EventCd",
"EventSp",
"RaidDaily",
"WarArchives"
"WarArchives",
"MaritimeEscort"
],
"Opsi": [
"OpsiGeneral",

View File

@ -288,6 +288,11 @@ WarArchives:
Campaign:
Mode: normal
AmbushEvade: true
MaritimeEscort:
Scheduler:
SuccessInterval: 30
FailureInterval: 30
ServerUpdate: 00:00
# ==================== Opsi ====================

View File

@ -189,6 +189,9 @@ WarArchives:
- Submarine
- Emotion
- HpControl
MaritimeEscort:
- Scheduler
- MaritimeEscort
# ==================== Opsi ====================

View File

@ -282,6 +282,9 @@ class GeneratedConfig:
# Group `RaidDaily`
RaidDaily_StageFilter = 'hard > normal > easy'
# Group `MaritimeEscort`
MaritimeEscort_Enable = True
# Group `OpsiAshAssist`
OpsiAshAssist_Tier = 15

View File

@ -16,7 +16,7 @@ class ManualConfig:
> OpsiDaily > OpsiShop
> OpsiAbyssal > OpsiStronghold > OpsiObscure
> Exercise > Daily > Hard > OpsiAshAssist
> Sos > EventSp > EventAb > EventCd > RaidDaily > WarArchives
> Sos > EventSp > EventAb > EventCd > RaidDaily > WarArchives > MaritimeEscort
> OpsiMeowfficerFarming
> Event > Raid > Main
> C124LargeLeveling > C122MediumLeveling > C72MysteryFarming > GemsFarming

View File

@ -166,6 +166,10 @@
"name": "War Archives",
"help": ""
},
"MaritimeEscort": {
"name": "Maritime Escort",
"help": ""
},
"OpsiGeneral": {
"name": "OpSi General",
"help": ""
@ -1540,6 +1544,16 @@
"help": "Generally does not need to be modified or re-arranged but can do so if desired\nCan save on oil consumption if less are attacked"
}
},
"MaritimeEscort": {
"_info": {
"name": "Maritime Escort",
"help": "Enter then retreat, get about 70% of maximum rewards"
},
"Enable": {
"name": "Enable maritime Escort",
"help": ""
}
},
"OpsiAshAssist": {
"_info": {
"name": "OpSi Ash Assist Settings",

View File

@ -166,6 +166,10 @@
"name": "Task.WarArchives.name",
"help": "Task.WarArchives.help"
},
"MaritimeEscort": {
"name": "Task.MaritimeEscort.name",
"help": "Task.MaritimeEscort.help"
},
"OpsiGeneral": {
"name": "Task.OpsiGeneral.name",
"help": "Task.OpsiGeneral.help"
@ -1540,6 +1544,16 @@
"help": "RaidDaily.StageFilter.help"
}
},
"MaritimeEscort": {
"_info": {
"name": "MaritimeEscort._info.name",
"help": "MaritimeEscort._info.help"
},
"Enable": {
"name": "MaritimeEscort.Enable.name",
"help": "MaritimeEscort.Enable.help"
}
},
"OpsiAshAssist": {
"_info": {
"name": "OpsiAshAssist._info.name",

View File

@ -166,6 +166,10 @@
"name": "作战档案",
"help": ""
},
"MaritimeEscort": {
"name": "商船护航",
"help": ""
},
"OpsiGeneral": {
"name": "通用设置",
"help": ""
@ -1540,6 +1544,16 @@
"help": ""
}
},
"MaritimeEscort": {
"_info": {
"name": "商船护航",
"help": "进一下就撤退能拿约70%的奖励"
},
"Enable": {
"name": "启用商船护航",
"help": ""
}
},
"OpsiAshAssist": {
"_info": {
"name": "余烬信标支援",

View File

@ -166,6 +166,10 @@
"name": "作戰檔案",
"help": ""
},
"MaritimeEscort": {
"name": "商船護航",
"help": ""
},
"OpsiGeneral": {
"name": "通用設定",
"help": ""
@ -1540,6 +1544,16 @@
"help": ""
}
},
"MaritimeEscort": {
"_info": {
"name": "商船護航",
"help": "進一下就撤退能拿約70%的獎勵"
},
"Enable": {
"name": "啟用商船護航",
"help": ""
}
},
"OpsiAshAssist": {
"_info": {
"name": "餘燼信標支援",

10
module/event/assets.py Normal file
View File

@ -0,0 +1,10 @@
from module.base.button import Button
from module.base.template import Template
# This file was automatically generated by dev_tools/button_extract.py.
# Don't modify it manually.
ESCORT_CHECK = Button(area={'cn': (118, 15, 227, 40), 'en': (118, 15, 227, 40), 'jp': (118, 15, 227, 40), 'tw': (118, 15, 227, 40)}, color={'cn': (155, 171, 209), 'en': (155, 171, 209), 'jp': (155, 171, 209), 'tw': (155, 171, 209)}, button={'cn': (118, 15, 227, 40), 'en': (118, 15, 227, 40), 'jp': (118, 15, 227, 40), 'tw': (118, 15, 227, 40)}, file={'cn': './assets/cn/event/ESCORT_CHECK.png', 'en': './assets/en/event/ESCORT_CHECK.png', 'jp': './assets/jp/event/ESCORT_CHECK.png', 'tw': './assets/tw/event/ESCORT_CHECK.png'})
ESCORT_HARD_ENTRANCE = Button(area={'cn': (118, 15, 227, 40), 'en': (118, 15, 227, 40), 'jp': (118, 15, 227, 40), 'tw': (118, 15, 227, 40)}, color={'cn': (155, 171, 209), 'en': (155, 171, 209), 'jp': (155, 171, 209), 'tw': (155, 171, 209)}, button={'cn': (745, 284, 886, 392), 'en': (745, 284, 886, 392), 'jp': (745, 284, 886, 392), 'tw': (745, 284, 886, 392)}, file={'cn': './assets/cn/event/ESCORT_HARD_ENTRANCE.png', 'en': './assets/en/event/ESCORT_HARD_ENTRANCE.png', 'jp': './assets/jp/event/ESCORT_HARD_ENTRANCE.png', 'tw': './assets/tw/event/ESCORT_HARD_ENTRANCE.png'})
ESCORT_REMAIN = Button(area={'cn': (55, 673, 135, 694), 'en': (55, 673, 135, 694), 'jp': (55, 673, 135, 694), 'tw': (55, 673, 135, 694)}, color={'cn': (68, 96, 85), 'en': (68, 96, 85), 'jp': (68, 96, 85), 'tw': (68, 96, 85)}, button={'cn': (55, 673, 135, 694), 'en': (55, 673, 135, 694), 'jp': (55, 673, 135, 694), 'tw': (55, 673, 135, 694)}, file={'cn': './assets/cn/event/ESCORT_REMAIN.png', 'en': './assets/en/event/ESCORT_REMAIN.png', 'jp': './assets/jp/event/ESCORT_REMAIN.png', 'tw': './assets/tw/event/ESCORT_REMAIN.png'})
MAIN_GOTO_ESCORT = Button(area={'cn': (609, 265, 654, 307), 'en': (609, 265, 654, 307), 'jp': (609, 265, 654, 307), 'tw': (609, 265, 654, 307)}, color={'cn': (216, 184, 171), 'en': (216, 184, 171), 'jp': (216, 184, 171), 'tw': (216, 184, 171)}, button={'cn': (609, 265, 654, 307), 'en': (609, 265, 654, 307), 'jp': (609, 265, 654, 307), 'tw': (609, 265, 654, 307)}, file={'cn': './assets/cn/event/MAIN_GOTO_ESCORT.png', 'en': './assets/en/event/MAIN_GOTO_ESCORT.png', 'jp': './assets/jp/event/MAIN_GOTO_ESCORT.png', 'tw': './assets/tw/event/MAIN_GOTO_ESCORT.png'})

View File

@ -0,0 +1,51 @@
from module.event.assets import *
from module.exception import CampaignEnd
from module.logger import logger
from module.map.map_operation import MapOperation
from module.ocr.ocr import DigitCounter
OCR_REMAIN = DigitCounter(ESCORT_REMAIN, letter=(148, 255, 99), threshold=64)
class MaritimeEscort(MapOperation):
def is_in_escort(self):
return self.appear(ESCORT_CHECK, offset=(20, 20))
def handle_in_stage(self):
if self.is_in_escort():
if self.in_stage_timer.reached():
return True
else:
return False
else:
self.in_stage_timer.reset()
return False
def run_escort(self):
"""
Just enter and retreat, get about 70% of maximum rewards.
Pages:
in: ESCORT_CHECK
out: ESCORT_CHECK
"""
logger.hr('Maritime escort', level=1)
try:
self.enter_map(ESCORT_HARD_ENTRANCE, mode='escort')
self.withdraw()
except CampaignEnd:
pass
logger.info('Maritime escort finished')
def run(self):
self.ui_goto_main()
self.ui_click(MAIN_GOTO_ESCORT, check_button=ESCORT_CHECK, offset=(20, 150), skip_first_screenshot=True)
current, _, _ = OCR_REMAIN.ocr(self.device.image)
if current > 0:
self.run_escort()
else:
logger.info('Maritime escort already finished')
self.config.task_delay(server_update=True)

View File

@ -257,7 +257,7 @@ class MapOperation(MysteryHandler, FleetPreparation, Retirement, FastForwardHand
while 1:
self.device.screenshot()
if self.handle_popup_confirm():
if self.handle_popup_confirm('WITHDRAW'):
continue
if self.appear_then_click(WITHDRAW, interval=5):
continue