mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-16 03:27:24 +08:00
Merge branch 'master' of https://github.com/LmeSzinc/AzurLaneAutoScript
This commit is contained in:
@@ -77,6 +77,7 @@ class Config:
|
|||||||
}
|
}
|
||||||
HOMO_EDGE_COLOR_RANGE = (0, 17)
|
HOMO_EDGE_COLOR_RANGE = (0, 17)
|
||||||
HOMO_EDGE_HOUGHLINES_THRESHOLD = 180
|
HOMO_EDGE_HOUGHLINES_THRESHOLD = 180
|
||||||
|
MAP_ENSURE_EDGE_INSIGHT_CORNER = 'bottom-left'
|
||||||
|
|
||||||
MAP_SWIPE_MULTIPLY = 1.492
|
MAP_SWIPE_MULTIPLY = 1.492
|
||||||
MAP_SWIPE_MULTIPLY_MINITOUCH = 1.442
|
MAP_SWIPE_MULTIPLY_MINITOUCH = 1.442
|
||||||
|
|||||||
@@ -690,6 +690,7 @@
|
|||||||
"GeneralShop": {
|
"GeneralShop": {
|
||||||
"UseGems": false,
|
"UseGems": false,
|
||||||
"Refresh": false,
|
"Refresh": false,
|
||||||
|
"BuySkinBox": false,
|
||||||
"Filter": "BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2\n> Cube\n> FoodT6 > FoodT5"
|
"Filter": "BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2\n> Cube\n> FoodT6 > FoodT5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3173,6 +3173,10 @@
|
|||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
"value": false
|
"value": false
|
||||||
},
|
},
|
||||||
|
"BuySkinBox": {
|
||||||
|
"type": "checkbox",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
"Filter": {
|
"Filter": {
|
||||||
"type": "textarea",
|
"type": "textarea",
|
||||||
"value": "BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2\n> Cube\n> FoodT6 > FoodT5"
|
"value": "BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2\n> Cube\n> FoodT6 > FoodT5"
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ Reward:
|
|||||||
GeneralShop:
|
GeneralShop:
|
||||||
UseGems: false
|
UseGems: false
|
||||||
Refresh: false
|
Refresh: false
|
||||||
|
BuySkinBox: false
|
||||||
Filter: |-
|
Filter: |-
|
||||||
BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2
|
BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2
|
||||||
> Cube
|
> Cube
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ class GeneratedConfig:
|
|||||||
# Group `GeneralShop`
|
# Group `GeneralShop`
|
||||||
GeneralShop_UseGems = False
|
GeneralShop_UseGems = False
|
||||||
GeneralShop_Refresh = False
|
GeneralShop_Refresh = False
|
||||||
|
GeneralShop_BuySkinBox = False
|
||||||
GeneralShop_Filter = 'BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2\n> Cube\n> FoodT6 > FoodT5'
|
GeneralShop_Filter = 'BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2\n> Cube\n> FoodT6 > FoodT5'
|
||||||
|
|
||||||
# Group `GuildShop`
|
# Group `GuildShop`
|
||||||
|
|||||||
@@ -1017,6 +1017,10 @@
|
|||||||
"name": "Allow Shop Refresh",
|
"name": "Allow Shop Refresh",
|
||||||
"help": "Refreshing will consume 50 gems"
|
"help": "Refreshing will consume 50 gems"
|
||||||
},
|
},
|
||||||
|
"BuySkinBox": {
|
||||||
|
"name": "Buy Equip Skin Boxes",
|
||||||
|
"help": "In order to reduce maintenance costs, the skin box selectors in the filter will not be updated with the game, but Alas will consider any unknown items with a quantity of 1 and consume 7000 coins as skin boxes and buy them."
|
||||||
|
},
|
||||||
"Filter": {
|
"Filter": {
|
||||||
"name": "Item Filter",
|
"name": "Item Filter",
|
||||||
"help": "All options have been defined at <https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/reward_shop_filter_string>"
|
"help": "All options have been defined at <https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/reward_shop_filter_string>"
|
||||||
|
|||||||
@@ -1017,6 +1017,10 @@
|
|||||||
"name": "GeneralShop.Refresh.name",
|
"name": "GeneralShop.Refresh.name",
|
||||||
"help": "GeneralShop.Refresh.help"
|
"help": "GeneralShop.Refresh.help"
|
||||||
},
|
},
|
||||||
|
"BuySkinBox": {
|
||||||
|
"name": "GeneralShop.BuySkinBox.name",
|
||||||
|
"help": "GeneralShop.BuySkinBox.help"
|
||||||
|
},
|
||||||
"Filter": {
|
"Filter": {
|
||||||
"name": "GeneralShop.Filter.name",
|
"name": "GeneralShop.Filter.name",
|
||||||
"help": "GeneralShop.Filter.help"
|
"help": "GeneralShop.Filter.help"
|
||||||
|
|||||||
@@ -1017,6 +1017,10 @@
|
|||||||
"name": "刷新商店",
|
"name": "刷新商店",
|
||||||
"help": "刷新需要消耗50钻石"
|
"help": "刷新需要消耗50钻石"
|
||||||
},
|
},
|
||||||
|
"BuySkinBox": {
|
||||||
|
"name": "买外观装备箱",
|
||||||
|
"help": "为降低维护成本,过滤器中的外观箱选择器不会随游戏更新,但Alas会将任何未知的,数量为1的,消耗7000物资的物品视为外观箱,并购买"
|
||||||
|
},
|
||||||
"Filter": {
|
"Filter": {
|
||||||
"name": "商店过滤器",
|
"name": "商店过滤器",
|
||||||
"help": ""
|
"help": ""
|
||||||
|
|||||||
@@ -1017,6 +1017,10 @@
|
|||||||
"name": "刷新軍火商商店",
|
"name": "刷新軍火商商店",
|
||||||
"help": "需要消耗50鑽石"
|
"help": "需要消耗50鑽石"
|
||||||
},
|
},
|
||||||
|
"BuySkinBox": {
|
||||||
|
"name": "買外觀裝備箱",
|
||||||
|
"help": "為降低維護成本,過濾器中的外觀箱選擇器不會隨遊戲更新,但Alas會將任何未知的,數量為1的,消耗7000物資的物品視為外觀箱,併購買"
|
||||||
|
},
|
||||||
"Filter": {
|
"Filter": {
|
||||||
"name": "商店過濾器",
|
"name": "商店過濾器",
|
||||||
"help": ""
|
"help": ""
|
||||||
|
|||||||
@@ -180,6 +180,25 @@ class ShopBase(UI):
|
|||||||
logger.warning(f'shop_check_item --> Missing func shop_{key}_check_item')
|
logger.warning(f'shop_check_item --> Missing func shop_{key}_check_item')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _is_shop_custom_item(self, item, shop_type='general'):
|
||||||
|
"""
|
||||||
|
Buy custom items without the restriction of filter string.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item (Item):
|
||||||
|
shop_type (str): String assists with shop_get_items
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool:
|
||||||
|
"""
|
||||||
|
if shop_type == 'general':
|
||||||
|
if self.config.GeneralShop_BuySkinBox:
|
||||||
|
if (not item.is_known_item()) and item.amount == 1 and item.cost == 'Coins' and item.price == 7000:
|
||||||
|
logger.info(f'Item {item} is considered to be an equip skin box')
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def shop_get_item_to_buy(self, shop_type='general', selection=''):
|
def shop_get_item_to_buy(self, shop_type='general', selection=''):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
@@ -187,7 +206,7 @@ class ShopBase(UI):
|
|||||||
selection: String user configured value, items desired
|
selection: String user configured value, items desired
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
list[Item]: List of Item object to buy, or an empty list if nothing to buy.
|
Item: Item to buy, or None.
|
||||||
"""
|
"""
|
||||||
items = self.shop_get_items(key=shop_type)
|
items = self.shop_get_items(key=shop_type)
|
||||||
self.shop_get_currency(key=shop_type)
|
self.shop_get_currency(key=shop_type)
|
||||||
@@ -200,21 +219,22 @@ class ShopBase(UI):
|
|||||||
f'was provided for {shop_type}: {selection}')
|
f'was provided for {shop_type}: {selection}')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
buy = []
|
|
||||||
for select in selection:
|
for select in selection:
|
||||||
# 'Choice Ship' purchases are not supported
|
# 'Choice Ship' purchases are not supported
|
||||||
if 'ship' in select.lower():
|
if 'ship' in select.lower():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
|
if self._is_shop_custom_item(item, shop_type=shop_type):
|
||||||
|
return item
|
||||||
if select not in item.alt_name:
|
if select not in item.alt_name:
|
||||||
continue
|
continue
|
||||||
if not self.shop_check_item(item, key=shop_type):
|
if not self.shop_check_item(item, key=shop_type):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
buy.append(item)
|
return item
|
||||||
|
|
||||||
return buy
|
return None
|
||||||
|
|
||||||
def shop_buy_execute(self, item, skip_first_screenshot=True):
|
def shop_buy_execute(self, item, skip_first_screenshot=True):
|
||||||
"""
|
"""
|
||||||
@@ -270,17 +290,15 @@ class ShopBase(UI):
|
|||||||
"""
|
"""
|
||||||
logger.hr(f'{shop_type} shop buy', level=2)
|
logger.hr(f'{shop_type} shop buy', level=2)
|
||||||
count = 0
|
count = 0
|
||||||
for _ in range(3):
|
for _ in range(12):
|
||||||
logger.hr('Buy execute')
|
item = self.shop_get_item_to_buy(shop_type, selection)
|
||||||
items = self.shop_get_item_to_buy(shop_type, selection)
|
if item is None:
|
||||||
if items:
|
|
||||||
for item in items:
|
|
||||||
self.shop_buy_execute(item)
|
|
||||||
count += 1
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
logger.info('Shop buy finished')
|
logger.info('Shop buy finished')
|
||||||
return count
|
return count
|
||||||
|
else:
|
||||||
|
self.shop_buy_execute(item)
|
||||||
|
count += 1
|
||||||
|
continue
|
||||||
|
|
||||||
logger.warning('Too many items to buy, stopped')
|
logger.warning('Too many items to buy, stopped')
|
||||||
return count
|
return count
|
||||||
|
|||||||
Reference in New Issue
Block a user