Praetorians

From LANCommander
Release Date
Windows: February 28, 2003
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play {InstallDir}\Praetorians.exe True

Install Script

The game requires some default files to be thrown in the "Documents" folder.

$Documents = [Environment]::GetFolderPath("MyDocuments")
$Display = Get-PrimaryDisplay
$DefaultPlayerName = "68 101 102 97 117 108 116"

Write-ReplaceContentInFile -Pattern '*NOMBRE_JUGADOR  \d+ (.+)' -Substitution "*NOMBRE_JUGADOR  $($DefaultPlayerName.Length) $DefaultPlayerName" -FilePath "$InstallDirectory\Default.usr"
Write-ReplaceContentInFile -Pattern 'C:\\Games\\Praetorians' -Substitution "$InstallDirectory" -FilePath "$InstallDirectory\Default.usr"
Write-ReplaceContentInFile -Pattern 'C:\\Users\\Pat\\Documents' -Substitution "$Documents" -FilePath "$InstallDirectory\Default.usr"

New-Item -ItemType Directory -Force -Path "$Documents\Praetorians\Profiles"

Copy-Item -Path "$InstallDirectory\Default.usr" -Destination "$Documents\Praetorians\Profiles\Default.usr"

$PatchDirectory = "$InstallDirectory\Patches\$($Display.Bounds.Width)x$($Display.Bounds.Height)"

if (Test-Path $PatchDirectory) {
    Copy-Item -Path "$PatchDirectory\*" -Destination "$InstallDirectory" -Recurse    
}

New-Item -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\Pyro Studios"
New-Item -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\Pyro Studios\Praetorians"
New-Item -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\Pyro Studios\Praetorians Game"
New-Item -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\Pyro Studios\Praetorians Game\Config"
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\Pyro Studios\Praetorians Game\Config" -Name "Perfil" -Value "Default" -Force

Uninstall Script

$Documents = [Environment]::GetFolderPath("MyDocuments")

Remove-Item "$Documents\Praetorians" -Recurse -ErrorAction Ignore

Remove-Item -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\Pyro Studios\Praetorians" -Recurse -Force
Remove-Item -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\Pyro Studios\Praetorians Game" -Recurse -Force

Name Change Script

The player name is stored as an ASCII encoded string in a .usr profile file in the Documents folder. The first number of the ASCII string is the length of the string.

$Documents = [Environment]::GetFolderPath("MyDocuments")

$bytes = ConvertTo-StringBytes -Input $NewPlayerAlias -MaxLength 18
$array = @()

foreach ($byte in $bytes) {
    $array += [System.Convert]::ToUInt32($byte)
}

$NewPlayerAlias = [System.String]::Join(' ', $array)

New-Item -ItemType Directory -Force -Path "$Documents\Praetorians\Profiles"
Copy-Item -Path "$InstallDirectory\Default.usr" -Destination "$Documents\Praetorians\Profiles\Default.usr"

Write-ReplaceContentInFile -Pattern '\*NOMBRE_JUGADOR  \d+ (.*)' -Substitution "*NOMBRE_JUGADOR  $($array.Length) $NewPlayerAlias" -FilePath "$Documents\Praetorians\Profiles\Default.usr"
Write-ReplaceContentInFile -Pattern '\*NOMBRE_SKIRMISH  \d+ (.*)' -Substitution "*NOMBRE_SKIRMISH  $($array.Length) $NewPlayerAlias" -FilePath "$Documents\Praetorians\Profiles\Default.usr"