Skip to content

Commit

Permalink
fix: name 'ghproxy' is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Night-stars-1 committed May 14, 2023
1 parent 00a4b7a commit f684c1d
Showing 1 changed file with 64 additions and 62 deletions.
126 changes: 64 additions & 62 deletions Honkai_Star_Rail.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,28 @@
except:
pass

up_data = [
{
'url_proxy': ghproxy,
'raw_proxy': rawghproxy,
'skip_verify': False,
'type': "star",
'version': "beta-2.7_test",
'url_zip': "https://github.com/Starry-Wind/Honkai-Star-Rail/archive/refs/heads/beta-2.7_test.zip",
'unzip_path': ".",
'keep_folder': ['.git','logs','temp','map','tmp'],
'keep_file': ['config.json','version.json','Honkai_Star_Rail.py','star_list.json'],
'zip_path': "Honkai-Star-Rail-beta-2.7_test/",
'name': "脚本"
},
{
'url_proxy': ghproxy,
'raw_proxy': rawghproxy,
'skip_verify': False,
'type': "map",
'version': "map",
'url_zip': "https://github.com/Starry-Wind/Honkai-Star-Rail/archive/refs/heads/map.zip",
'unzip_path': "map",
'keep_folder': [],
'keep_file': [],
'zip_path': "Honkai-Star-Rail-map/map",
'name': "地图"
},
{
'url_proxy': ghproxy,
'raw_proxy': rawghproxy,
'skip_verify': False,
'type': "temp",
'version': "map",
'url_zip': "https://github.com/Starry-Wind/Honkai-Star-Rail/archive/refs/heads/map.zip",
'unzip_path': "temp",
'keep_folder': [],
'keep_file': [],
'zip_path': "Honkai-Star-Rail-map/temp",
'name': "图片"
},
]

def main():
global up_data
main_start()
up_data()
if isadmin() == 1:
start = input('请输入起始地图(如果从头开始请输入0):')
if "-" in start and "_" in start or start == '0':
log.info("脚本将于5秒后运行,请确保你的游戏置顶")
time.sleep(5)
get_width()
from tools.map import map
map_instance = map()
log.info("开始运行,请勿移动鼠标和键盘")
log.info("若脚本运行无反应,请使用管理员权限运行")
start = '1-1_1' if start == '0' else start
map_instance.auto_map(start) # 读取配置
else:
log.info("错误编号")
webhook_and_log("脚本已经完成运行")
else:
log.info("请以管理员权限运行")

def main_start():
if not read_json_file(CONFIG_FILE_NAME, False).get('start'):
title = "请选择下载代理地址:(不使用代理选空白选项)"
options = ['https://ghproxy.com/', 'https://ghproxy.net/', 'hub.fgit.ml', '']
Expand All @@ -69,36 +47,60 @@ def main():
option, index = pick(options, title, indicator='=>', default_index=0)
modify_json_file(CONFIG_FILE_NAME, "auto_battle_persistence", index)
modify_json_file(CONFIG_FILE_NAME, "start", True)

def up_data():
if not read_json_file(CONFIG_FILE_NAME, False).get('map_debug'):
ghproxy = read_json_file(CONFIG_FILE_NAME, False).get('github_proxy', "")
if "rawgithub_proxy" not in read_json_file(CONFIG_FILE_NAME, False):
log.info("未检测到必要更新,强制更新脚本,请重新运行脚本")
init_config_file(0,0)
raise Exception("未检测到必要更新,强制更新脚本,请重新运行脚本")

rawghproxy = read_json_file(CONFIG_FILE_NAME, False).get('rawgithub_proxy', "")
# asyncio.run(check_file(ghproxy, "map"))
# asyncio.run(check_file(ghproxy, "temp"))
up_data = [
{
'url_proxy': ghproxy,
'raw_proxy': rawghproxy,
'skip_verify': False,
'type': "star",
'version': "beta-2.7_test",
'url_zip': "https://github.com/Starry-Wind/Honkai-Star-Rail/archive/refs/heads/beta-2.7_test.zip",
'unzip_path': ".",
'keep_folder': ['.git','logs','temp','map','tmp'],
'keep_file': ['config.json','version.json','Honkai_Star_Rail.py','star_list.json'],
'zip_path': "Honkai-Star-Rail-beta-2.7_test/",
'name': "脚本"
},
{
'url_proxy': ghproxy,
'raw_proxy': rawghproxy,
'skip_verify': False,
'type': "map",
'version': "map",
'url_zip': "https://github.com/Starry-Wind/Honkai-Star-Rail/archive/refs/heads/map.zip",
'unzip_path': "map",
'keep_folder': [],
'keep_file': [],
'zip_path': "Honkai-Star-Rail-map/map",
'name': "地图"
},
{
'url_proxy': ghproxy,
'raw_proxy': rawghproxy,
'skip_verify': False,
'type': "temp",
'version': "map",
'url_zip': "https://github.com/Starry-Wind/Honkai-Star-Rail/archive/refs/heads/map.zip",
'unzip_path': "temp",
'keep_folder': [],
'keep_file': [],
'zip_path': "Honkai-Star-Rail-map/temp",
'name': "图片"
},
]
for up in up_data:
update_file_main(**up)
if isadmin() == 1:
start = input('请输入起始地图(如果从头开始请输入0):')
if "-" in start and "_" in start or start == '0':
log.info("脚本将于5秒后运行,请确保你的游戏置顶")
time.sleep(5)
get_width()
from tools.map import map
map_instance = map()
log.info("开始运行,请勿移动鼠标和键盘")
log.info("若脚本运行无反应,请使用管理员权限运行")
start = '1-1_1' if start == '0' else start
map_instance.auto_map(start) # 读取配置
else:
log.info("错误编号")
webhook_and_log("脚本已经完成运行")
else:
log.info("请以管理员权限运行")


def isadmin():
return ctypes.windll.shell32.IsUserAnAdmin()
Expand Down

0 comments on commit f684c1d

Please sign in to comment.