mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-19 02:33:34 +08:00
Add: shop and build modules
This commit is contained in:
45
module/shop/shop_merit.py
Normal file
45
module/shop/shop_merit.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from module.base.button import ButtonGrid
|
||||
from module.base.decorator import cached_property
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import Digit
|
||||
from module.shop.assets import *
|
||||
from module.shop.base import ShopBase, ShopItemGrid
|
||||
|
||||
OCR_SHOP_MERIT = Digit(SHOP_MERIT, letter=(239, 239, 239), name='OCR_SHOP_MERIT')
|
||||
|
||||
|
||||
class MeritShop(ShopBase):
|
||||
_shop_merit = 0
|
||||
|
||||
def shop_merit_get_currency(self):
|
||||
"""
|
||||
Ocr shop merit currency
|
||||
"""
|
||||
self._shop_merit = OCR_SHOP_MERIT.ocr(self.device.image)
|
||||
logger.info(f'Merit: {self._shop_merit}')
|
||||
|
||||
@cached_property
|
||||
def shop_merit_items(self):
|
||||
"""
|
||||
Returns:
|
||||
ShopItemGrid:
|
||||
"""
|
||||
shop_grid = self.shop_grid
|
||||
shop_merit_items = ShopItemGrid(shop_grid, templates={}, amount_area=(60, 74, 96, 95))
|
||||
shop_merit_items.load_template_folder('./assets/merit_shop')
|
||||
shop_merit_items.load_cost_template_folder('./assets/shop_cost')
|
||||
return shop_merit_items
|
||||
|
||||
def shop_merit_check_item(self, item):
|
||||
"""
|
||||
Args:
|
||||
item: Item to check
|
||||
|
||||
Returns:
|
||||
bool:
|
||||
"""
|
||||
if item.cost == 'Merit':
|
||||
if item.price > self._shop_merit:
|
||||
return False
|
||||
return True
|
||||
return False
|
||||
Reference in New Issue
Block a user