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%"

View File

@@ -0,0 +1,82 @@
@echo off
::由于cmd环境的不同,utf8字符集的文件在命令行中执行时中文会出现乱码
::因此所有的回显内容都使用英文
::CODER BY Mr.Yu POWERD BY iBAT
::date: 2022/07/13
set RegPath=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
reg query %RegPath% |findstr /c:"Steam App 221100">nul 2>nul
if %errorlevel% neq 0 (
goto :findSteamPath
)
for /f "tokens=1,2 delims=:" %%i in ('reg query "%RegPath%\Steam App 221100" /v "InstallLocation" ^|find "InstallLocation"') do (
set desc=From Regedit
set Device=%%i
set "DayzPath=%%j"
)
set DayzPath=%Device:~-1%:%DayzPath%
goto :next
:findSteamPath
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
set RegPath=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Valve\Steam
) else (
goto :notFind
)
for /f "tokens=3 delims= " %%i in ('reg query "%RegPath%" /v "InstallPath"') do (
set "SteamPath=%%i"
)
set "libraryPath=%SteamPath%\steamapps\libraryfolders.vdf"
for /f "delims=" %%i in ('type "%libraryPath%" ^|find "path"') do (
for /f "tokens=2 delims= " %%j in ('echo %%i') do (
if exist %%j\steamapps\common\DayZ (
set desc=From config
set "DayzPath=%%~j\steamapps\common\DayZ"
goto :next
)
)
)
goto :notFind
:next
set DayzPath=%DayzPath:\\=\%
@REM echo GamePath = [%desc%: %DayzPath%]
call .\SetUp.bat "%DayzPath%"
goto :eof
:notFind
cls
if Exist ".\tmp\dayzInstallPath.tmp" (
set "DayzPath="
for /f "delims=" %%i in ('type .\tmp\dayzInstallPath.tmp') do set "DayzPath=%%i"
goto :continue
)
set desc=Get it manually
echo [No installation directory for DayZ was found, please set it manually!]
echo.
@REM 请将dayz的安装目录文件夹拖动到此窗口
set /p "DayzPath=Please drag and drop the DayZ folder to this window:"
:continue
if "%DayzPath%" equ "" (
echo [Fail]The path is empty, end the run, press any key to exit!
pause >nul 2>nul
goto :eof
) else if not exist "%DayzPath%" (
echo [Fail]The path you entered does not exist, please re-enter it!
choice /t 3 /c ync /d y >nul
del /F/Q ".\tmp\dayzInstallPath.tmp"
goto :notFind
)
echo %DayzPath%|findstr /E "DayZ" 2>nul >nul
if %errorlevel% neq 0 (
echo [Fail]The path you entered is not the game installation directory, please re-enter it!
choice /t 3 /c ync /d y >nul
del /F/Q ".\tmp\dayzInstallPath.tmp"
goto :notFind
)
@REM echo [Successful] enjoy it!
echo %DayzPath%>".\tmp\dayzInstallPath.tmp"
goto :next

BIN
DayZBoot/SteamCMD/jq.exe Normal file

Binary file not shown.

Binary file not shown.

23
DayZBoot/config.json Normal file
View File

@@ -0,0 +1,23 @@
{
"PlayerCFG" : {
"Desc" : "此部分需要玩家进行配置, 设置玩家的steam账号密码,设置一个昵称.",
"SteamAccount" : "seafileadmin",
"SteamPassword" : "ailaopo1314.0",
"NickName" : "DcrClub_1",
"AutoUpdateMod" : true
},
"ServerCFG" : {
"Desc" : "此部分需要服主进行配置, 需要设置要链接的IP和端口,以及需要挂载的模组ID",
"GameID" : 221100,
"ServerIp" : "8.210.216.190",
"ServerPort" : 2302,
"LoadedMod" : [
1559212036,
1828439124,
3298976659,
3287409694,
3276386418,
2966069604
]
}
}

View File

@@ -0,0 +1,10 @@
@ShutdownOnFailedCommand 1
@NoPromptForPassword 0
login seafileadmin ailaopo1314.0
workshop_download_item 221100 1559212036 validate
workshop_download_item 221100 1828439124 validate
workshop_download_item 221100 3298976659 validate
workshop_download_item 221100 3287409694 validate
workshop_download_item 221100 3276386418 validate
workshop_download_item 221100 2966069604 validate
quit

View File

@@ -0,0 +1,3 @@
@echo off
start "" SetUp.bat 1
exit

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

View File

@@ -0,0 +1,30 @@
玩家必看:
解压后的文件夹名字以及解压后的整体文件夹名字 绝对不可以有中文
解压后的文件夹名字以及解压后的整体文件夹名字 绝对不可以有中文
解压后的文件夹名字以及解压后的整体文件夹名字 绝对不可以有中文
中文路径会导致 steamcmd 运行错误
玩家下载本脚本后, 首先需要编辑 config.json文件的 玩家部分
1, 需要设置玩家的steam账号以及密码, 账号密码仅保存在你本地,不会外泄.
2, 需要自己设定一个玩家昵称, 默认为 DZ_ZhangSan
3, 不要修改服主设置的部分, 否则会导致进入服务器失败.
4, 第一次运行脚本 config.json中的参数 AutoUpdateMod 必须为 true
之后的运行如果mod没有更新,可以设置为 "AutoUpdateMod" : false
以上部分设置完毕后, 双击 "开始游戏.bat" 运行 (不要双击StartGame.bat)
脚本会自动寻找DayZ的安装路径!
如果出现如下提示:
[No installation directory for DayZ was found, please set it manually]
Please drag and drop the DayZ folder to this window:
代表没有找到dayz的游戏路径,需要你手动将dayz的安装目录拖动至命令窗口中, 具体参考gif图片:
设置dayz游戏路径.gif
服主必看:
服主下载本脚本后, 首先需要编辑 config.json文件中的 服主部分
1, 服主需要设置自己服务器的IP地址以及连接端口.
2, 服主需要设置自己服务器玩家需要挂载的模组ID, 注意格式
3, 以上信息, 务必填写正确, 否则会导致玩家无法进入游戏.

View File

@@ -8,3 +8,4 @@
| ---- | ---- | | ---- | ---- |
| DayZServerStart | DayZ开服脚本 | | DayZServerStart | DayZ开服脚本 |
| PlayerDataReturnGear | 单玩家数据回档 | | PlayerDataReturnGear | 单玩家数据回档 |
| DayZBoot | 玩家端 启动游戏 直连脚本 |