update: 更新玩家启动脚本

This commit is contained in:
2024-11-17 15:39:32 +08:00
parent f11710dc90
commit f94be80552
10 changed files with 207 additions and 1 deletions

57
DayZBoot/SetUp.bat Normal file
View File

@@ -0,0 +1,57 @@
@echo off
Setlocal enabledelayedexpansion
::fsutil behavior set disablelastaccess 0 >nul
::CODER BY 稻草人 POWERD BY iBAT
cd /d %~dp0
if not exist tmp mkdir tmp
set path=%path%;%~dp0SteamCMD
if "%~1" NEQ "1" goto :startup
if "%~1" equ "1" call getDayzInstallPath & goto :eof
:startup
set "gameDirectory=%~1"
set dayz_client=%gameDirectory%\DayZ_BE.exe
::玩家设置的属性
for /f "delims=" %%i in ('jq -r ".PlayerCFG.AutoUpdateMod" config.json') do (
set auto_update=%%i
)
for /f "delims=" %%i in ('jq -r ".PlayerCFG.SteamAccount" config.json') do (
set player_steam_account=%%i
)
for /f "delims=" %%i in ('jq -r ".PlayerCFG.SteamPassword" config.json') do (
set player_steam_password=%%i
)
for /f "delims=" %%i in ('jq -r ".PlayerCFG.NickName" config.json') do (
set player_nick=%%i
)
::服主设置的属性
for /f "delims=" %%i in ('jq -r ".ServerCFG.GameID" config.json') do (
set game_id=%%i
)
for /f "delims=" %%i in ('jq -r ".ServerCFG.ServerIp" config.json') do (
set server_ip=%%i
)
for /f "delims=" %%i in ('jq -r ".ServerCFG.ServerPort" config.json') do (
set server_port=%%i
)
::处理模组的更新
set load_mods=" "
echo @ShutdownOnFailedCommand 1 > "tmp\steamscript.txt"
echo @NoPromptForPassword 0 >> "tmp\steamscript.txt"
echo login %player_steam_account% %player_steam_password% >> "tmp\steamscript.txt"
for /f "delims=" %%i in ('jq -c ".ServerCFG.LoadedMod[]" config.json') do (
echo workshop_download_item %game_id% %%i validate >> "tmp\steamscript.txt"
if !load_mods! equ " " (
set load_mods=%~dp0SteamCMD\steamapps\workshop\content\221100\%%i;
) else (
set load_mods=!load_mods!%~dp0SteamCMD\steamapps\workshop\content\221100\%%i;
)
)
echo quit >> "tmp\steamscript.txt"
if %auto_update% equ true (
steamcmd +runscript ..\tmp\steamscript.txt
)
start "" "%dayz_client%" -connect=%server_ip% -port=%server_port% "-name=%player_nick%" -noPause "-mod=%load_mods%"