一键换装内嵌 gmweb:取消独立 exe 启动并支持页面热键
This commit is contained in:
1 parent
ab778e9e4c
commit
1e936bfb84
3 files changed
+153
-19
No files matched your search
+10
-19
@@ -134,9 +134,6 @@ PVF_PATH = os.path.join(CLIENT_DIR, "Script.pvf")
|
||||
|
||||
# 一键换装工具(独立工具,放在服务端根目录的 LoadoutTool 文件夹下)
|
||||
LOADOUT_DIR = os.path.join(SERVER_ROOT, "LoadoutTool")
|
||||
LOADOUT_EXE = os.path.join(LOADOUT_DIR, "换装工具.exe")
|
||||
if not os.path.exists(LOADOUT_EXE):
|
||||
LOADOUT_EXE = os.path.join(LOADOUT_DIR, "DNFLoadout.exe")
|
||||
|
||||
# 一键换装的持久化配置路径
|
||||
LOADOUT_CONFIG = os.path.join(LOADOUT_DIR, "config.json")
|
||||
@@ -767,25 +764,19 @@ def flow_stop_server():
|
||||
|
||||
|
||||
def flow_launch_loadout():
|
||||
"""一键换装:启动 DNFLoadout.exe。"""
|
||||
log("== 一键换装 ==")
|
||||
if not os.path.exists(LOADOUT_EXE):
|
||||
log("[错误] 找不到换装工具:%s" % LOADOUT_EXE)
|
||||
return
|
||||
"""One-click loadout: open the embedded gmweb loadout page."""
|
||||
log("== One-click loadout ==")
|
||||
if not server_running():
|
||||
log("[提示] 服务端未运行,换装工具可能无法连接。建议先「开始游戏」。")
|
||||
log("正在启动换装工具…")
|
||||
log("[hint] server is not running; loadout may not read characters/equipment")
|
||||
url = "http://127.0.0.1:%d/#loadout" % GM_WEB_PORT
|
||||
log("opening loadout page: %s" % url)
|
||||
try:
|
||||
subprocess.Popen(
|
||||
[LOADOUT_EXE], cwd=LOADOUT_DIR,
|
||||
creationflags=DETACHED_PROCESS | CREATE_NO_WINDOW,
|
||||
close_fds=True)
|
||||
log("换装工具已启动。")
|
||||
webbrowser.open(url)
|
||||
log("loadout page opened; the in-game GM window has the same tab")
|
||||
except Exception as e:
|
||||
log("[错误] 启动失败:%s" % repr(e))
|
||||
log("[error] open failed: %s" % repr(e))
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ 数据库 / Native 客户端初始化
|
||||
# ------------------------------------------------------------------ Database / Native client initialization
|
||||
def load_instance(path):
|
||||
if not path or not os.path.exists(path):
|
||||
return {}
|
||||
@@ -1074,7 +1065,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||
"client_dir_exists": os.path.isdir(client_dir),
|
||||
"control_exists": os.path.exists(CONTROL),
|
||||
"sponsor_exists": os.path.exists(SPONSOR_IMG),
|
||||
"loadout_exists": os.path.exists(LOADOUT_EXE),
|
||||
"loadout_exists": True,
|
||||
"db": DB_PATH,
|
||||
"db_exists": bool(DB_PATH) and os.path.exists(DB_PATH),
|
||||
"native_available": NATIVE is not None,
|
||||
|
||||
Reference in new issue
Block a user