Moved Namalsk patching.

Namalsk server mods patching moved to update scope.
This commit is contained in:
Vladislav Salikov
2024-11-19 22:05:52 +03:00
parent a8a061464f
commit 206599127c
4 changed files with 114 additions and 77 deletions

View File

@@ -1,6 +1,19 @@
@echo off
set scriptPath=%~dp0
set customPath=D:\DayZ\Server\.customs
set customPath=Z:\Servers\dayzserver\.customs
set d=%DATE%
set t=%TIME:~0,8%
set t=%t: =0%
set t=%t::=-%
set day=%d:~0,2%
set month=%d:~3,2%
set year=%d:~6%
set filename=wDayzManager_%year%-%month%-%day%_%t%.log
::: Kill ghost instances
taskkill /im DayZServer_x64.exe /F >nul 2>&1
timeout 3 /nobreak >nul
cd /d %scriptPath%
pushd %scriptPath%
@@ -12,11 +25,6 @@ if "%1" equ "-U" set update=1
if "%1" equ "-u" set update=1
if "%1" equ "--update" set update=1
powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 %update%
@REM powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 %update% > wDayzManager.log
@REM echo Customization...
@REM cd /d %customPath%
@REM copy /Y messages.xml d:\dayz\server\mpmissions\hardcore.namalsk\db
powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 %update% > %filename%
popd

View File

@@ -1,14 +1,13 @@
; wDayzManager.ini
[Config]
serverLocation=D:\DayZ\Server
steamCMD=D:\DayZ\SteamCMD
; steamCMD=V:\SteamCMD
serverLocation=Z:\Servers\dayzserver
steamCMD=Z:\SteamCMD
steamUser=w0lf_2k
appidGame=221100
appidServer=223350
rotateLogs=0
daysAmount=3
rotateLogs=1
daysAmount=7
rotatedLogsFolderName=RotatedLogs
; rotatedLogsFolderName=
becFolderName=BEC
@@ -38,18 +37,58 @@ updateHour=4
[ServerMods]
@SurvivorMissions=1988925918
[Server-5]
serverPort=35500
[Server-1]
serverPort=35100
serverConfig=serverDZ.cfg
serverExeName=DayZServer_x64.exe
serverCPU=4
; startupClientMods=@CF;@COT
startupClientMods=@CF;@VPPAdminTools;@Namalsk_Island;@Namalsk_Survival
serverCPU=2
startupClientMods=@CF;@VPPadminTools
startupServerMods=
additionalParams= -name=Server -filePatching
namalskMission=Hardcore
additionalParams= -name=Server -adminLog
namalskMission=
; [Server 6]
[Server-2]
serverPort=35200
serverConfig=serverDZ.cfg
serverExeName=DayZServer_x64.exe
serverCPU=2
startupClientMods=@CF;@VPPadminTools
startupServerMods=
additionalParams= -name=Server -adminLog
namalskMission=
[Server-3]
serverPort=35300
serverConfig=serverDZ.cfg
serverExeName=DayZServer_x64.exe
serverCPU=2
startupClientMods=@CF;@VPPadminTools;@Namalsk_Island;@Namalsk_Survival
startupServerMods=
additionalParams= -name=Server -adminLog
namalskMission=Regular
[Server-4]
serverPort=35400
serverConfig=serverDZ.cfg
serverExeName=DayZServer_x64.exe
serverCPU=2
startupClientMods=@CF;@VPPadminTools
startupServerMods=
additionalParams= -name=Server -adminLog
namalskMission=
; [Server-5]
; serverPort=35500
; serverConfig=serverDZ.cfg
; serverExeName=DayZServer_x64.exe
; serverCPU=4
; ; startupClientMods=@CF;@COT
; startupClientMods=@CF;@VPPAdminTools;@Namalsk_Island;@Namalsk_Survival
; startupServerMods=
; additionalParams= -name=Server -filePatching
; namalskMission=Hardcore
; [Server-6]
; serverPort=35600
; serverConfig=serverDZ.cfg
; serverExeName=DayZServer_x64.exe

View File

@@ -11,10 +11,10 @@ param (
$param = 0
)
[bool]$update = $param
[bool]$noDelete = $true # For tests - don't delete logs
[bool]$noDelete = $false # For tests - don't delete logs
[string]$logFile = ".\wDayzManager.log"
[string]$steamScript = "wDayzManager.txt"
[string]$iniFile = "wDayzManager.ini"
[string]$iniFile = ".\wDayzManager.ini"
if (-not (Test-Path $iniFile)) {
Write-Error "Can't find file '$iniFile'"
Exit
@@ -25,6 +25,10 @@ $date = Get-Date
[int]$currentDay = ([datetime]$date).Day
[int]$currentHour = ([datetime]$date).Hour
$date2 = Get-Date -Format 's' | ForEach-Object { $_ -replace 'T', ' ' }
Write-Host "$($date2) Starting wDayzManager script"
Write-Host "update = $($update), noDelete = $($noDelete)"
$ini = $config = $servers = $clientMods = $serverMods = $steamProcess = $null
$modNI = $modNS = $namalskMission = $pathNamalskMission = $null
$dayzProcess = $becProcess = $instance = $null
@@ -35,8 +39,6 @@ $startupClientMods = $startupServerMods = $startupMods = $startupParams = $null
$serverProfile = $additionalParams = $dayzArguments = $dayz = $bec = $becArguments = $null
$logsName = $atLogsLocation = $becLogsLocation = $rotatedLogsLocation = $null
Write-Host "=========="
$ini = (Get-IniContent -FilePath $iniFile)
$config = $ini.Config
[string]$serverLocation = $config.serverLocation
@@ -121,6 +123,33 @@ if ($update) {
}
Start-Sleep -Seconds 1
# Patching Namalsk
[bool]$isNamalskIslandPresent = $false
[bool]$isNamalskSurvivalPresent = $false
$clientMods.Item1 | ForEach-Object {
if ($_ -like "*namalsk*" -and $_ -like "*island*") {
$isNamalskIslandPresent = $true
$modNI = $_
Write-Host "Patching Namalsk Island server meta.cpp file ..."
$whatFind_NI = "2288339650"
$replaceWith_NI = "2289456201"
$content = Get-Content -Path "$($serverLocation)\$($modNI)\meta.cpp"
$content = $content -replace $whatFind_NI, $replaceWith_NI
Set-Content -Path "$($serverLocation)\$($modNI)\meta.cpp" -Value $content
}
if ($_ -like "*namalsk*" -and $_ -like "*survival*") {
$isNamalskSurvivalPresent = $true
$modNS = $_
Write-Host "Patching Namalsk Survival server meta.cpp file ..."
$whatFind_NS = "2288336145"
$replaceWith_NS = "2289461232"
$content = Get-Content -Path "$($serverLocation)\$($modNS)\meta.cpp"
$content = $content -replace $whatFind_NS, $replaceWith_NS
Set-Content -Path "$($serverLocation)\$($modNS)\meta.cpp" -Value $content
}
}
# # Customizing servers
# # Overwriting default messages.xml from Namalsk by custom file
# if (Test-Path -Path "$($serverLocation)\.customs") {
@@ -130,34 +159,7 @@ if ($update) {
Write-Host "End of updating server."
Start-Sleep -Seconds 1
}
Write-Host
# Patching Namalsk
[bool]$isNamalskIslandPresent = $false
[bool]$isNamalskSurvivalPresent = $false
$clientMods.Item1 | ForEach-Object {
if ($_ -like "*namalsk*" -and $_ -like "*island*") {
$isNamalskIslandPresent = $true
$modNI = $_
Write-Host "Patching Namalsk Island server meta.cpp file ..."
$whatFind_NI = "2288339650"
$replaceWith_NI = "2289456201"
$content = Get-Content -Path "$($serverLocation)\$($modNI)\meta.cpp"
$content = $content -replace $whatFind_NI, $replaceWith_NI
Set-Content -Path "$($serverLocation)\$($modNI)\meta.cpp" -Value $content
}
if ($_ -like "*namalsk*" -and $_ -like "*survival*") {
$isNamalskSurvivalPresent = $true
$modNS = $_
Write-Host "Patching Namalsk Survival server meta.cpp file ..."
$whatFind_NS = "2288336145"
$replaceWith_NS = "2289461232"
$content = Get-Content -Path "$($serverLocation)\$($modNS)\meta.cpp"
$content = $content -replace $whatFind_NS, $replaceWith_NS
Set-Content -Path "$($serverLocation)\$($modNS)\meta.cpp" -Value $content
}
}
Write-Host
if ($rotateLogs) {
@@ -411,18 +413,22 @@ foreach ($srv in $servers) {
# Write-Host " daysAmount: $($daysAmount)"
# Write-Host " noDelete: $($noDelete)"
# # Starting servers
# Set-Location -Path "$($serverLocation)"
# $dayzProcess[$processID] = Start-Process -FilePath $dayz -ArgumentList $dayzArguments -PassThru
# Starting servers
Set-Location -Path "$($serverLocation)"
$dayzProcess[$processID] = Start-Process -FilePath $dayz -ArgumentList $dayzArguments -PassThru
# $dayzProcess[$processID]
# if ($becLocation) {
# Set-Location -Path "$($becLocation)"
# $becProcess[$processID] = Start-Process -FilePath $bec -ArgumentList $becArguments -PassThru
# $becProcess[$processID]
# }
# Starting BEC
if ($becLocation) {
Set-Location -Path "$($becLocation)"
$becProcess[$processID] = Start-Process -FilePath $bec -ArgumentList $becArguments -PassThru
# $becProcess[$processID]
}
$processID++
Write-Host
Start-Sleep -Seconds 1
}
# Start-Sleep -Seconds 5
Write-Host "=========="
Write-Host "End of wDayzManager script"

View File

@@ -1,16 +0,0 @@
// wDayzManager.txt - Steam script
@NoPromptForPassword 1
@ShutdownOnFailedCommand 1
force_install_dir "D:\DayZ\Server"
login w0lf_2k
app_update 223350 validate
workshop_download_item 221100 2731398623 validate
workshop_download_item 221100 1559212036 validate
workshop_download_item 221100 1564026768 validate
workshop_download_item 221100 1828439124 validate
workshop_download_item 221100 1623711988 validate
workshop_download_item 221100 2288339650 validate
workshop_download_item 221100 2288336145 validate
workshop_download_item 221100 2561482171 validate
workshop_download_item 221100 1988925918 validate
quit