-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPalworld_default.ps1
More file actions
70 lines (68 loc) · 3.81 KB
/
Palworld_default.ps1
File metadata and controls
70 lines (68 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Function New-LaunchScriptPalworldPS {
# Palworld Dedicated Server
# APP ID # 2394010
#
################## Change Default Variables #################
# Server IP
${global:IP} = "${ip}"
# Server Port
$global:port = "8211"
# Query Port
# $global:queryport = "27017"
# Rcon Port
$global:rconport = "25575"
# Rcon Password
$global:rconpassword = "$RANDOMPASSWORD"
# Server Password
$global:serverpassword = " "
# Maxplayers
$global:maxplayers = "32"
# Server Name
$global:hostname = "SERVERNAME"
##############################/\##############################
###################### Do not change below #####################
# System Directory
$global:systemdir = "$serverdir"
# Server Config Directory
$global:servercfgdir = "$serverdir\Pal\Saved\Config\WindowsServer"
# Server Executable
$global:executable = "PalServer"
# Server Executable Directory
$global:executabledir = "$serverdir"
# Gamedig Query
$global:querytype = "protocol-valve"
# Game Process
$global:process = "PalServer-Win64-Shipping-Cmd"
# Log Directory
$global:logdirectory = "$serverdir\Pal\Saved\Logs"
# Server Log
$global:consolelog = "Palserver.log"
# Game-Server-Config Directory
$global:gamedirname = ""
# Game-Server-Config
$global:servercfg = "PalWorldSettings.ini"
# Server Launch Command
# '@("${executable} -port=$port -players=$maxplayers -publicip=$extip -publicport=xxxx -publiclobby -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS -logformat=text")'
$global:launchParams = '@("${executable} -port=$port -players=$maxplayers -publicip=$extip -publicport=$port -publiclobby -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS -logformat=text")'
Get-UserInput
Get-Infomessage "*** starting Server before Setting $servercfg Please Wait ***" 'info'
Set-Location $executabledir
Start-process cmd -Args @("/c ${executable}") -NoNewWindow
while (!(Get-Process $process -ea SilentlyContinue )) {
Wait-process -Name $process -Timeout 45 >$null 2>&1
}
Get-Infomessage "*** stopping Server before Setting $servercfg Please Wait ***" 'info'
Get-StopServer
Try {
# Copy-Item $serverdir\DefaultPalWorldSettings.ini $servercfgdir\$servercfg -Force
# Write-log "info: Copy-Item $serverdir\DefaultPalWorldSettings.ini $servercfgdir\$servercfg -Force"
$palwordini = Get-Content $serverdir\DefaultPalWorldSettings.ini
New-Item -ItemType File -Path $servercfgdir\$servercfg -Force
Set-Content -Path $servercfgdir\$servercfg -Value $palwordini
Write-log "info: New-Item $servercfgdir\$servercfg "
}
Catch {
Write-log "Warning: $($_.Exception.Message)"
}
(Get-Content -Path $serverdir\DefaultPalWorldSettings.ini -Raw) -replace ( 'ServerName=".+r"',"ServerName=`"$hostname`"") -replace ( 'AdminPassword=""',"AdminPassword=`"$rconpassword`"") -replace ( 'ServerPassword=""',"ServerPassword=`"$serverpassword`"") -replace ( 'ServerPlayerMaxNum=32',"ServerPlayerMaxNum=$maxplayers") -replace ( 'RCONEnabled=False',"RCONEnabled=$true") -replace ( 'RCONPort=.+75',"RCONPort=$rconport") -replace ( 'PublicPort=.+11',"PublicPort=$port") | Set-Content -Path $servercfgdir\$servercfg -Force
}