mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 03:58:22 +08:00
Fix: Trying to add prefix "1" on empty Opsi shop amount
and log empty OCR result
This commit is contained in:
@@ -11,6 +11,19 @@ OCR_SHOP_YELLOW_COINS = Digit(SHOP_YELLOW_COINS, letter=(239, 239, 239), thresho
|
||||
OCR_SHOP_PURPLE_COINS = Digit(SHOP_PURPLE_COINS, letter=(255, 255, 255), name='OCR_SHOP_PURPLE_COINS')
|
||||
|
||||
|
||||
class OSShopAmount(Digit):
|
||||
def after_process(self, result):
|
||||
result = result.replace('I', '1').replace('D', '0').replace('S', '5')
|
||||
|
||||
prev = result
|
||||
if result.startswith('0'):
|
||||
result = '1' + result
|
||||
logger.warning(f'OS shop amount {prev} is revised to {result}')
|
||||
|
||||
result = super().after_process(result)
|
||||
return result
|
||||
|
||||
|
||||
class OSShopHandler(UI, MapEventHandler):
|
||||
_shop_yellow_coins = 0
|
||||
_shop_purple_coins = 0
|
||||
@@ -29,6 +42,7 @@ class OSShopHandler(UI, MapEventHandler):
|
||||
shop_grid = ButtonGrid(
|
||||
origin=(237, 219), delta=(189, 224), button_shape=(98, 98), grid_shape=(4, 2), name='SHOP_GRID')
|
||||
shop_items = ItemGrid(shop_grid, templates={}, amount_area=(60, 74, 96, 95))
|
||||
shop_items.price_ocr = OSShopAmount([], letter=(255, 223, 57), threshold=32, name='Price_ocr')
|
||||
shop_items.load_template_folder('./assets/shop/os')
|
||||
shop_items.load_cost_template_folder('./assets/shop/os_cost')
|
||||
return shop_items
|
||||
|
||||
Reference in New Issue
Block a user