mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-19 23:33:33 +08:00
Merge branch 'master' of https://github.com/LmeSzinc/AzurLaneAutoScript
This commit is contained in:
@@ -9,6 +9,7 @@ from module.log_res.log_res import LogRes
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import Digit
|
||||
from module.ui.assets import BACK_ARROW
|
||||
from module.ui.page import page_campaign_menu
|
||||
|
||||
|
||||
class AcademyPtOcr(Digit):
|
||||
@@ -25,6 +26,7 @@ class AcademyPtOcr(Digit):
|
||||
pass
|
||||
return super().after_process(result)
|
||||
|
||||
|
||||
class DALPtOcr(Digit):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
@@ -58,7 +60,9 @@ class Coalition(CoalitionCombat, CampaignEvent):
|
||||
# use generic ocr model
|
||||
ocr = Digit(NEONCITY_PT_OCR, name='OCR_PT', lang='cnocr', letter=(208, 208, 208), threshold=128)
|
||||
elif event == 'coalition_20251120':
|
||||
ocr = DALPtOcr(DAL_PT_OCR, name='OCR_PT' ,letter=(255, 213, 69), threshold=128)
|
||||
ocr = DALPtOcr(DAL_PT_OCR, name='OCR_PT', letter=(255, 213, 69), threshold=128)
|
||||
elif event == 'coalition_20260122':
|
||||
ocr = Digit(FASHION_PT_OCR, name='OCR_PT', letter=(41, 40, 40), threshold=128)
|
||||
else:
|
||||
logger.error(f'ocr object is not defined in event {event}')
|
||||
raise ScriptError
|
||||
@@ -92,6 +96,15 @@ class Coalition(CoalitionCombat, CampaignEvent):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
@property
|
||||
def _coalition_has_oil_icon(self):
|
||||
"""
|
||||
Game devs are too asshole to drop oil display for UI design
|
||||
https://github.com/LmeSzinc/AzurLaneAutoScript/issues/5214
|
||||
"""
|
||||
if self.config.Campaign_Event == 'coalition_20260122':
|
||||
return False
|
||||
return True
|
||||
|
||||
def triggered_stop_condition(self, oil_check=False, pt_check=False):
|
||||
"""
|
||||
@@ -105,7 +118,7 @@ class Coalition(CoalitionCombat, CampaignEvent):
|
||||
self.config.Scheduler_Enable = False
|
||||
return True
|
||||
# Oil limit
|
||||
if oil_check:
|
||||
if oil_check and self._coalition_has_oil_icon:
|
||||
if self.check_oil():
|
||||
logger.hr('Triggered stop condition: Oil limit')
|
||||
self.config.task_delay(minute=(120, 240))
|
||||
@@ -195,10 +208,10 @@ class Coalition(CoalitionCombat, CampaignEvent):
|
||||
logger.info(f'Count: {self.run_count}')
|
||||
|
||||
# UI switches
|
||||
# if self.config.SERVER in ['tw']:
|
||||
# self.ui_goto(page_campaign_menu)
|
||||
# if self.triggered_stop_condition(oil_check=True):
|
||||
# break
|
||||
if not self._coalition_has_oil_icon:
|
||||
self.ui_goto(page_campaign_menu)
|
||||
if self.triggered_stop_condition(oil_check=True):
|
||||
break
|
||||
self.device.stuck_record_clear()
|
||||
self.device.click_record_clear()
|
||||
self.ui_goto_coalition()
|
||||
@@ -228,3 +241,9 @@ class Coalition(CoalitionCombat, CampaignEvent):
|
||||
# Scheduler
|
||||
if self.config.task_switched():
|
||||
self.config.task_stop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
self = Coalition('alas5', task='Coalition')
|
||||
self.device.screenshot()
|
||||
self.get_event_pt()
|
||||
|
||||
Reference in New Issue
Block a user