metin2-private-server / scripts /ensure_stack.ps1
manus4oHER's picture
Upload folder using huggingface_hub
65b3647 verified
Raw
History Blame Contribute Delete
1.77 kB
$ErrorActionPreference = "Continue"
$root = Resolve-Path (Join-Path $PSScriptRoot "..")
$open = Join-Path $root "vendor\open-mt2"
$data = Join-Path $root "runtime\mariadb-data"
function Port-Listen([int]$port) {
return [bool](netstat -an | Select-String ":$port\s+.*LISTENING")
}
# Redis
if (-not (Port-Listen 6379)) {
$redis = "C:\Program Files\Redis\redis-server.exe"
if (Test-Path $redis) { Start-Process $redis -WindowStyle Minimized; Start-Sleep 2 }
}
# MariaDB
if (-not (Port-Listen 3306)) {
$mysqld = "C:\Program Files\MariaDB 12.3\bin\mysqld.exe"
if (Test-Path $mysqld) {
New-Item -ItemType Directory -Force -Path (Join-Path $root "runtime") | Out-Null
Start-Process $mysqld -ArgumentList @(
"--datadir=$data","--port=3306","--bind-address=127.0.0.1",
"--innodb-buffer-pool-size=128M","--console"
) -WindowStyle Hidden
Start-Sleep 6
}
}
# Auth
if (-not (Port-Listen 11002)) {
Start-Process cmd.exe -ArgumentList "/c","cd /d `"$open`" && npx cross-env LOG_LEVEL=info tsnd -r tsconfig-paths/register --transpile-only --env-file=.env src/auth/main.ts" -WindowStyle Minimized
Start-Sleep 4
}
# Game
if (-not (Port-Listen 13001)) {
Start-Process cmd.exe -ArgumentList "/c","cd /d `"$open`" && npx cross-env LOG_LEVEL=info tsnd -r tsconfig-paths/register --transpile-only --env-file=.env src/game/main.ts" -WindowStyle Minimized
Start-Sleep 6
}
Write-Host "Ports:"
foreach ($p in 6379,3306,11002,13001) {
Write-Host (" {0}: {1}" -f $p, $(if (Port-Listen $p) {"UP"} else {"DOWN"}))
}
Write-Host "Auth/Game: 127.0.0.1:11002 / 13001 | login admin/admin"
Write-Host "Client: copy client_config\serverinfo.py into TMP4 client"
Write-Host "Gold: python scripts\set_player_gold.py --name CHAR --gold 999999999"