Praetorians: Difference between revisions

From LANCommander
(Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Developers = {{Game.InfoBox.Developer|Pyro Studios}} |Publishers = {{Game.InfoBox.Publisher|Eidos Interactive}} {{Game.InfoBox.Publisher|Kalypso Media}} |Release Date = {{Game.InfoBox.ReleaseDate|Windows|February 28, 2003}} |Genres = {{Game.InfoBox.Genre|Real Time Strategy (RTS)}} {{Game.InfoBox.Genre|Strategy}} {{Game.InfoBox.Genre|Indie}} | PCGamingWiki = Praetorians }} {{Game.ActionBox |Actions = {{Game.ActionBox...")
 
No edit summary
 
Line 3: Line 3:
|Cover = cover.jpg
|Cover = cover.jpg
|Developers =
|Developers =
{{Game.InfoBox.Developer|Pyro Studios}}
 
|Publishers =
|Publishers =
{{Game.InfoBox.Publisher|Eidos Interactive}}
 
{{Game.InfoBox.Publisher|Kalypso Media}}
|Release Date =
|Release Date =
{{Game.InfoBox.ReleaseDate|Windows|February 28, 2003}}
{{Game.InfoBox.ReleaseDate|Windows|February 28, 2003}}
|Genres =
|Genres =
{{Game.InfoBox.Genre|Real Time Strategy (RTS)}}
 
{{Game.InfoBox.Genre|Strategy}}
|PCGamingWiki = Praetorians}}
{{Game.InfoBox.Genre|Indie}}
| PCGamingWiki = Praetorians
}}


{{Game.ActionBox
{{Game.ActionBox
|Actions =  
|Actions =  
{{Game.ActionBox.Row|Name = Play|Path = Praetorians.exe|Arguments = |WorkingDirectory = |Primary = True}}
{{Game.ActionBox.Row|Name = Play|Path = {InstallDir}\Praetorians.exe|Arguments = |WorkingDirectory = |Primary = True}}
}}
}}


{{Game.SaveBox
|Paths =
{{Game.SaveBox.Row|Type = File|Path = %USERPROFILE%\Documents\Praetorians}}
}}


{{Game.Scripts.Install
{{Game.Scripts.Install
|Name = Install Script
|Name = Install Script
|Description = The game requires some default files to be thrown in the "Documents" folder.
|Description = The game requires some default files to be thrown in the "Documents" folder.
|RequiresAdmin = True
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$NewName = $args[0]
<syntaxhighlight lang="powershell" line>
$InstallDir = $PSScriptRoot
$Documents = [Environment]::GetFolderPath("MyDocuments")
$Display = Get-PrimaryDisplay
$DefaultPlayerName = "68 101 102 97 117 108 116"


function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
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"
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
Write-ReplaceContentInFile -Pattern 'C:\\Users\\Pat\\Documents' -Substitution "$Documents" -FilePath "$InstallDirectory\Default.usr"
    [IO.File]::WriteAllLines($FilePath, $content)
}


$DefaultPlayerName = "68 101 102 97 117 108 116"
New-Item -ItemType Directory -Force -Path "$Documents\Praetorians\Profiles"


Write-ReplaceContentInFile -Regex '*NOMBRE_JUGADOR  11 (.+)' -Replacement "*NOMBRE_JUGADOR  11 $DefaultPlayerName" -FilePath "$InstallDir\Default.usr"
Copy-Item -Path "$InstallDirectory\Default.usr" -Destination "$Documents\Praetorians\Profiles\Default.usr"
Write-ReplaceContentInFile -Regex 'C:\Games\Praetorians' -Replacement "$InstallDir" -FilePath "$InstallDir\Default.usr"
Write-ReplaceContentInFile -Regex 'C:\Users\Pat' -Replacement "$($env:USERPROFILE)" -FilePath "$InstallDir\Default.usr"


New-Item -ItemType Directory -Force -Path "$($env:USERPROFILE)\Documents\Praetorians\Profiles"
$PatchDirectory = "$InstallDirectory\Patches\$($Display.Bounds.Width)x$($Display.Bounds.Height)"


Copy-Item -Path "$InstallDir\Default.usr" -Destination "$($env:USERPROFILE)\Documents\Praetorians\Profiles\Default.usr"
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
</syntaxhighlight>
</syntaxhighlight>
}}
}}
           
{{Game.Scripts.Uninstall
|Name = Uninstall Script
|Description =
|RequiresAdmin = False
|Contents =
<syntaxhighlight lang="powershell" line>
$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
</syntaxhighlight>
}}
           
{{Game.Scripts.NameChange
{{Game.Scripts.NameChange
|Name = Name Change Script
|Name = Name Change Script
|Description = 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.
|Description = 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.
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$NewName = $args[0]
<syntaxhighlight lang="powershell" line>
$InstallDir = $PSScriptRoot
$Documents = [Environment]::GetFolderPath("MyDocuments")
$Length = $NewName.Length


function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
$bytes = ConvertTo-StringBytes -Input $NewPlayerAlias -MaxLength 18
{
$array = @()
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}
 
function Get-AsciiBytesAsString([string]$InputString, [int]$MaxLength)
{
    $characters = $InputString.ToCharArray()
    $array = @()
    $count = 0
 
    foreach ($char in $characters)
    {
        if ($count -lt $MaxLength)
        {
            $array += [System.Convert]::ToUInt32($char)
            $count++
        }
    }


     return [System.String]::Join(' ', $array)
foreach ($byte in $bytes) {
     $array += [System.Convert]::ToUInt32($byte)
}
}


$NewName = Get-AsciiBytesAsString -InputString $newName -MaxLength 18
$NewPlayerAlias = [System.String]::Join(' ', $array)
 
Write-ReplaceContentInFile -Regex '\*NOMBRE_JUGADOR  7 (.+)' -Replacement "*NOMBRE_JUGADOR  $Length $NewName" -FilePath "$InstallDir\Default.usr"
Write-ReplaceContentInFile -Regex '\*NOMBRE_SKIRMISH  7 (.+)' -Replacement "*NOMBRE_SKIRMISH  $Length $NewName" -FilePath "$InstallDir\Default.usr"


New-Item -ItemType Directory -Force -Path "$($env:USERPROFILE)\Documents\Praetorians\Profiles"
New-Item -ItemType Directory -Force -Path "$Documents\Praetorians\Profiles"
Copy-Item -Path "$InstallDirectory\Default.usr" -Destination "$Documents\Praetorians\Profiles\Default.usr"


Copy-Item -Path "$InstallDir\Default.usr" -Destination "$($env:USERPROFILE)\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"
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 03:30, 6 January 2024

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"