1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-17 06:25:25 +08:00
This commit is contained in:
GH Action - Upstream Sync
2025-08-25 11:19:11 +00:00
68 changed files with 490 additions and 56 deletions

View File

@@ -1,14 +1,16 @@
import re
import numpy as np
from module.base.button import ButtonGrid
from module.base.decorator import cached_property
from module.base.decorator import Config, cached_property
from module.base.filter import Filter
from module.base.timer import Timer
from module.combat.assets import GET_ITEMS_1, GET_ITEMS_3, GET_SHIP
from module.logger import logger
from module.shop.assets import *
from module.shop.shop_select_globals import *
from module.statistics.item import ItemGrid
from module.statistics.item import Item, ItemGrid
from module.tactical.tactical_class import Book
from module.ui.ui import UI
@@ -43,13 +45,23 @@ FILTER_ATTR = ('group', 'sub_genre', 'tier')
FILTER = Filter(FILTER_REGEX, FILTER_ATTR)
class ShopItem_250814(Item):
"""
Calculation result of unsold ship_T2 is 0.36, so 0.3 is taken as threshold,
result of sold product is < 0.2
"""
def predict_valid(self):
mean = np.mean(np.max(self.image, axis=2) > 139)
return mean > 0.3
class ShopItemGrid(ItemGrid):
def predict(self, image, name=True, amount=True, cost=False, price=False, tag=False):
"""
Define new attributes to predicted Item obj for shop item filtering
"""
super().predict(image, name, amount, cost, price, tag)
for item in self.items:
# Set defaults
item.group, item.sub_genre, item.tier = None, None, None
@@ -86,6 +98,10 @@ class ShopItemGrid(ItemGrid):
return self.items
class ShopItemGrid_250814(ShopItemGrid):
item_class = ShopItem_250814
class ShopBase(UI):
_currency = 0
shop_template_folder = ''
@@ -99,6 +115,7 @@ class ShopBase(UI):
return ''
@cached_property
@Config.when(SERVER='tw')
def shop_grid(self):
"""
Returns:
@@ -108,6 +125,18 @@ class ShopBase(UI):
origin=(476, 246), delta=(156, 213), button_shape=(98, 98), grid_shape=(5, 2), name='SHOP_GRID')
return shop_grid
@cached_property
@Config.when(SERVER=None)
def shop_grid(self):
"""
New UI in 2025-08-14
Returns:
ButtonGrid:
"""
shop_grid = ButtonGrid(
origin=(226, 238), delta=(162, 217), button_shape=(64, 64), grid_shape=(5, 2), name='SHOP_GRID')
return shop_grid
def shop_items(self):
"""
Returns: