mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-22 08:28:06 +08:00
Merge branch 'master' of https://github.com/LmeSzinc/AzurLaneAutoScript
This commit is contained in:
BIN
assets/shop/os/METARedBookT1_2.png
Normal file
BIN
assets/shop/os/METARedBookT1_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
assets/shop/os/OrdnanceTestingReportT3_6.png
Normal file
BIN
assets/shop/os/OrdnanceTestingReportT3_6.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
BIN
assets/shop/os/RepairPackFull2_2.png
Normal file
BIN
assets/shop/os/RepairPackFull2_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
assets/shop/os/RepairPackFull_2.png
Normal file
BIN
assets/shop/os/RepairPackFull_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
assets/shop/os/TuningSampleOffence_4.png
Normal file
BIN
assets/shop/os/TuningSampleOffence_4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -1,7 +1,7 @@
|
||||
from module.base.utils import get_color, red_overlay_transparency
|
||||
from module.campaign.campaign_base import CampaignBase as CampaignBase_
|
||||
from module.handler.assets import MAP_ENEMY_SEARCHING
|
||||
from module.map.assets import SWITCH_OVER
|
||||
from module.ui.page import page_event
|
||||
|
||||
|
||||
class CampaignBase(CampaignBase_):
|
||||
@@ -12,3 +12,9 @@ class CampaignBase(CampaignBase_):
|
||||
return red_overlay_transparency(
|
||||
MAP_ENEMY_SEARCHING.color, get_color(self.device.image, MAP_ENEMY_SEARCHING.area)
|
||||
) > self.MAP_ENEMY_SEARCHING_OVERLAY_TRANSPARENCY_THRESHOLD
|
||||
|
||||
def handle_exp_info(self):
|
||||
# Random background hits EXP_INFO_B
|
||||
if self.ui_page_appear(page_event):
|
||||
return False
|
||||
return super().handle_exp_info()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from module.base.utils import get_color, red_overlay_transparency
|
||||
from ..campaign_war_archives.campaign_base import CampaignBase as CampaignBase_
|
||||
from module.handler.assets import MAP_ENEMY_SEARCHING
|
||||
from module.map.assets import SWITCH_OVER
|
||||
from module.ui.page import page_event
|
||||
from ..campaign_war_archives.campaign_base import CampaignBase as CampaignBase_
|
||||
|
||||
|
||||
class CampaignBase(CampaignBase_):
|
||||
@@ -12,3 +12,9 @@ class CampaignBase(CampaignBase_):
|
||||
return red_overlay_transparency(
|
||||
MAP_ENEMY_SEARCHING.color, get_color(self.device.image, MAP_ENEMY_SEARCHING.area)
|
||||
) > self.MAP_ENEMY_SEARCHING_OVERLAY_TRANSPARENCY_THRESHOLD
|
||||
|
||||
def handle_exp_info(self):
|
||||
# Random background hits EXP_INFO_B
|
||||
if self.ui_page_appear(page_event):
|
||||
return False
|
||||
return super().handle_exp_info()
|
||||
|
||||
@@ -71,7 +71,10 @@ class GitManager(DeployConfig):
|
||||
@property
|
||||
def goc_client(self):
|
||||
client = GitOverCdnClient(
|
||||
url='https://vip.123pan.cn/1818706573/pack/LmeSzinc_AzurLaneAutoScript_master',
|
||||
url=[
|
||||
'https://vip.123pan.cn/1818706573/pack/LmeSzinc_AzurLaneAutoScript_master',
|
||||
'https://1818706573.v.123yx.com/1818706573/pack/LmeSzinc_AzurLaneAutoScript_master',
|
||||
],
|
||||
folder=self.root_filepath,
|
||||
source='origin',
|
||||
branch='master',
|
||||
@@ -102,4 +105,4 @@ class GitManager(DeployConfig):
|
||||
|
||||
if __name__ == '__main__':
|
||||
self = GitManager()
|
||||
self.goc_client.get_status()
|
||||
self.goc_client.get_status()
|
||||
|
||||
@@ -52,10 +52,14 @@ class GitOverCdnClient:
|
||||
def __init__(self, url, folder, source='origin', branch='master', git='git'):
|
||||
"""
|
||||
Args:
|
||||
url: http://127.0.0.1:22251/pack/LmeSzinc_AzurLaneAutoScript_master/
|
||||
url (str | list[str]): http://127.0.0.1:22251/pack/LmeSzinc_AzurLaneAutoScript_master/
|
||||
folder: D:/AzurLaneAutoScript
|
||||
"""
|
||||
self.url = url.strip('/')
|
||||
if isinstance(url, str):
|
||||
self.urls = [url.strip('/')]
|
||||
else:
|
||||
self.urls = [u.strip('/') for u in url]
|
||||
self.url = self.urls[0]
|
||||
self.folder = folder.replace('\\', '/')
|
||||
self.source = source
|
||||
self.branch = branch
|
||||
@@ -100,29 +104,31 @@ class GitOverCdnClient:
|
||||
|
||||
@cached_property
|
||||
def latest_commit(self) -> str:
|
||||
try:
|
||||
for url_base in self.urls:
|
||||
self.url = url_base
|
||||
url = self.urlpath('/latest.json')
|
||||
self.logger.info(f'Fetch url: {url}')
|
||||
resp = self.session.get(url, timeout=3)
|
||||
except Exception as e:
|
||||
self.logger.error(f'Failed to get remote commit: {e}')
|
||||
return ''
|
||||
|
||||
if resp.status_code == 200:
|
||||
try:
|
||||
info = json.loads(resp.text)
|
||||
commit = info['commit']
|
||||
self.logger.attr('LatestCommit', commit)
|
||||
return commit
|
||||
except json.JSONDecodeError:
|
||||
self.logger.error(f'Failed to get remote commit, response is not a json: {resp.text}')
|
||||
return ''
|
||||
except KeyError:
|
||||
self.logger.error(f'Failed to get remote commit, key "commit" is not found: {resp.text}')
|
||||
return ''
|
||||
else:
|
||||
self.logger.error(f'Failed to get remote commit, status={resp.status_code}, text={resp.text}')
|
||||
return ''
|
||||
resp = self.session.get(url, timeout=3)
|
||||
except Exception as e:
|
||||
self.logger.error(f'Failed to get remote commit: {e}')
|
||||
continue
|
||||
|
||||
if resp.status_code == 200:
|
||||
try:
|
||||
info = json.loads(resp.text)
|
||||
commit = info['commit']
|
||||
self.logger.attr('LatestCommit', commit)
|
||||
return commit
|
||||
except json.JSONDecodeError:
|
||||
self.logger.error(f'Failed to get remote commit, response is not a json: {resp.text}')
|
||||
except KeyError:
|
||||
self.logger.error(f'Failed to get remote commit, key "commit" is not found: {resp.text}')
|
||||
else:
|
||||
self.logger.error(f'Failed to get remote commit, status={resp.status_code}, text={resp.text}')
|
||||
|
||||
self.url = self.urls[0]
|
||||
return ''
|
||||
|
||||
def download_pack(self):
|
||||
try:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from typing import List
|
||||
|
||||
from module.base.button import ButtonGrid
|
||||
from module.base.decorator import cached_property
|
||||
from module.base.template import Template
|
||||
@@ -6,9 +7,9 @@ from module.logger import logger
|
||||
from module.map_detection.utils import Points
|
||||
from module.os_handler.map_event import MapEventHandler
|
||||
from module.os_handler.os_status import OSStatus
|
||||
from module.os_shop.item import OSShopItem as Item, OSShopItemGrid as ItemGrid
|
||||
from module.os_shop.selector import Selector
|
||||
from module.os_shop.ui import OSShopUI, OS_SHOP_SCROLL
|
||||
from module.os_shop.item import OSShopItem as Item, OSShopItemGrid as ItemGrid
|
||||
from module.statistics.utils import load_folder
|
||||
|
||||
|
||||
@@ -133,19 +134,21 @@ class PortShop(OSStatus, OSShopUI, Selector, MapEventHandler):
|
||||
|
||||
while True:
|
||||
pre_pos = self.pre_scroll(pre_pos, cur_pos)
|
||||
_items = self.os_shop_get_items(i, cur_pos)
|
||||
|
||||
for _ in range(2):
|
||||
_items = []
|
||||
for _ in range(3):
|
||||
_items = self.os_shop_get_items(i, cur_pos)
|
||||
if not len(_items) or any(not item.is_known_item() for item in _items):
|
||||
logger.warning('Empty OS shop or empty items, confirming')
|
||||
self.device.sleep((0.3, 0.5))
|
||||
self.device.screenshot()
|
||||
_items = self.os_shop_get_items(i, cur_pos)
|
||||
continue
|
||||
else:
|
||||
items += _items
|
||||
logger.info(f'Found {len(_items)} items in shop {i + 1} at pos {cur_pos:.2f}')
|
||||
break
|
||||
# always add items, even if last item list contains unknown items
|
||||
# so any known items can be scanned
|
||||
items += _items
|
||||
|
||||
if OS_SHOP_SCROLL.at_bottom(main=self):
|
||||
logger.info('OS shop reach bottom, stop')
|
||||
|
||||
Reference in New Issue
Block a user