mirror of
https://github.com/wess09/AzurLaneAutoScript.git
synced 2026-05-14 06:38:38 +08:00
移除OCR验证
This commit is contained in:
parent
68d4370878
commit
0f9d1c63b4
@ -681,43 +681,22 @@ class RewardCommission(UI, InfoHandler):
|
||||
continue
|
||||
|
||||
if self.appear(FUEL_MAXED, offset=(20, 20), interval=1):
|
||||
from module.ocr.ocr import Ocr
|
||||
# Use cnocr model for Chinese text, white letter color, and the new OCR_FUEL_MAXED asset
|
||||
ocr = Ocr(OCR_FUEL_MAXED, lang='cnocr', letter=(255, 255, 255), threshold=128)
|
||||
text = ocr.ocr(self.device.image)
|
||||
logger.info(f"FUEL_MAXED OCR text: {text}")
|
||||
normalized_text = str(text).strip().lower()
|
||||
# Use unicode escapes to avoid source-file encoding issues.
|
||||
fuel_maxed_keywords = [
|
||||
'\u77f3\u6cb9', # \u77f3\u6cb9
|
||||
'\u71c3\u6cb9', # \u71c3\u6cb9
|
||||
'oil',
|
||||
]
|
||||
if any(keyword in normalized_text for keyword in fuel_maxed_keywords):
|
||||
logger.info("Fuel maxed confirmed by OCR, skip reward receive")
|
||||
|
||||
import os
|
||||
import time
|
||||
from PIL import Image
|
||||
os.makedirs('log/error', exist_ok=True)
|
||||
debug_image_path = f"log/error/FUEL_MAXED_debug_{int(time.time())}.png"
|
||||
Image.fromarray(self.device.image).save(debug_image_path)
|
||||
logger.info(f"Saved OCR-confirmed triggering frame to {debug_image_path}")
|
||||
|
||||
# Force-write buy-food flag to config file.
|
||||
# This avoids losing the flag when multiple config updates happen in one loop.
|
||||
self.config.modified['Dorm.Dorm.BuyFood'] = True
|
||||
self.config.save()
|
||||
self.config.task_call('Dorm')
|
||||
self.config.task_delay(minute=1)
|
||||
# Write again after task_delay(), because it triggers an immediate update().
|
||||
self.config.modified['Dorm.Dorm.BuyFood'] = True
|
||||
self.config.save()
|
||||
logger.info(
|
||||
f"Dorm buy-food flag set to: {self.config.cross_get('Dorm.Dorm.BuyFood')}"
|
||||
)
|
||||
self.config.task_stop()
|
||||
break
|
||||
logger.info("Fuel maxed, skip reward receive")
|
||||
|
||||
# Force-write buy-food flag to config file.
|
||||
# This avoids losing the flag when multiple config updates happen in one loop.
|
||||
self.config.modified['Dorm.Dorm.BuyFood'] = True
|
||||
self.config.save()
|
||||
self.config.task_call('Dorm')
|
||||
self.config.task_delay(minute=1)
|
||||
# Write again after task_delay(), because it triggers an immediate update().
|
||||
self.config.modified['Dorm.Dorm.BuyFood'] = True
|
||||
self.config.save()
|
||||
logger.info(
|
||||
f"Dorm buy-food flag set to: {self.config.cross_get('Dorm.Dorm.BuyFood')}"
|
||||
)
|
||||
self.config.task_stop()
|
||||
break
|
||||
|
||||
for button in [GET_SHIP]:
|
||||
if click_timer.reached() and self.appear(button, interval=1):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user