Realm Wars: Difference between revisions

From LANCommander
(Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Release Date = {{Game.InfoBox.ReleaseDate|Windows|March 1, 2003}} }} {{Game.ActionBox |Actions = {{Game.ActionBox.Row|Name = Play|Path = RealmWars.exe|Arguments = |WorkingDirectory = |Primary = True}} }} {{Game.Scripts.Install |Name = Install Script |Description = |RequiresAdmin = False |Contents = <syntaxhighlight lang="powershell" line> $InstallDir = $PSScriptRoot Add-Type -AssemblyName System.Windows.Forms $Dis...")
 
No edit summary
 
Line 2: Line 2:
{{Game.InfoBox
{{Game.InfoBox
|Cover = cover.jpg
|Cover = cover.jpg
|Developers =
|Publishers =
|Release Date =
|Release Date =
{{Game.InfoBox.ReleaseDate|Windows|March 1, 2003}}
{{Game.InfoBox.ReleaseDate|Windows|March 1, 2003}}
|Genres =
}}
}}


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


{{Game.Scripts.Install
{{Game.Scripts.Install
Line 15: Line 22:
|Description =  
|Description =  
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$InstallDir = $PSScriptRoot
<syntaxhighlight lang="powershell" line>
Add-Type -AssemblyName System.Windows.Forms
# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = [System.Windows.Forms.Screen]::AllScreens | Where-Object Primary | Select Bounds
$Display = Get-PrimaryDisplay


function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
{
Write-ReplaceContentInFile -Pattern '^\$pref::Server::Info = "(.+)";' -Substitution "`$pref::Server::Info = ""Older than your mother!"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
Write-ReplaceContentInFile -Pattern '^\$pref::Server::Name = "(.+)";' -Substitution "`$pref::Server::Name = ""Vintage"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
    [IO.File]::WriteAllLines($FilePath, $content)
Write-ReplaceContentInFile -Pattern '^\$pref::Server::MaxPlayers = "(.+)";' -Substitution "`$pref::Server::MaxPlayers = ""16"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
}
Write-ReplaceContentInFile -Pattern '^\$pref::Video::displayDevice = "(.+)";' -Substitution "`$pref::Video::displayDevice = ""OpenGL"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
 
Write-ReplaceContentInFile -Pattern '^\$pref::Video::fullScreen = "(.+)";' -Substitution "`$pref::Video::fullScreen = ""1"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
function Get-43Resolution([int]$Width, [int]$Height) {
Write-ReplaceContentInFile -Pattern '^\$pref::Video::resolution = "(.+)";' -Substitution "`$pref::Video::resolution = ""$($Display.Bounds.Width) $($Resolution.Height) 32"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
    $ratio = 4 / 3
 
    if (($Width -gt $Height) -or ($Width -eq $Height)) {
        return @{ Width = [math]::Round($ratio * $Height); Height = $Height }
    }
 
    if ($Width -lt $Height) {
        return @{ Width = $Width; Height = [math]::Round($Width / $ratio) }
    }
}
 
# Accessible via $Resolution.Height, $Resolution.Width
$Resolution = Get-43Resolution -Width $Display.Width -Height $Display.Height


# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^\$pref::Server::Info = "(.+)";' -Substitution "`$pref::Server::Info = ""Older than your mother!"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Regex '^\$pref::Server::Info = "(.+)";' -Replacement "`$pref::Server::Info = ""Older than your mother!"";" -FilePath "$InstallDir\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Server::Name = "(.+)";' -Substitution "`$pref::Server::Name = ""Vintage"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Regex '^\$pref::Server::Name = "(.+)";' -Replacement "`$pref::Server::Name = ""Vintage"";" -FilePath "$InstallDir\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Server::MaxPlayers = "(.+)";' -Substitution "`$pref::Server::MaxPlayers = ""16"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Regex '^\$pref::Server::MaxPlayers = "(.+)";' -Replacement "`$pref::Server::MaxPlayers = ""16"";" -FilePath "$InstallDir\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Video::displayDevice = "(.+)";' -Substitution "`$pref::Video::displayDevice = ""OpenGL"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Regex '^\$pref::Video::displayDevice = "(.+)";' -Replacement "`$pref::Video::displayDevice = ""OpenGL"";" -FilePath "$InstallDir\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Video::fullScreen = "(.+)";' -Substitution "`$pref::Video::fullScreen = ""1"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Regex '^\$pref::Video::fullScreen = "(.+)";' -Replacement "`$pref::Video::fullScreen = ""1"";" -FilePath "$InstallDir\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Video::resolution = "(.+)";' -Substitution "`$pref::Video::resolution = ""$($Display.Bounds.Width) $($Display.Bounds.Height) 32"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Regex '^\$pref::Video::resolution = "(.+)";' -Replacement "`$pref::Video::resolution = ""$($Resolution.Width) $($Resolution.Height) 32"";" -FilePath "$InstallDir\common\client\prefs.cs"
</syntaxhighlight>
</syntaxhighlight>
}}
}}
 
           
{{Game.Scripts.NameChange
{{Game.Scripts.NameChange
|Name = Name Change Script
|Name = Name Change Script
|Description =  
|Description =  
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$InstallDir = $PSScriptRoot
<syntaxhighlight lang="powershell" line>
$NewName = $args[0]
Write-ReplaceContentInFile -Pattern '^\$pref::Player::Name = "(.+)";' -Substitution "`$pref::Player::Name = ""$NewPlayerAlias"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
 
Write-ReplaceContentInFile -Pattern '^\$pref::Player::Name = "(.+)";' -Substitution "`$pref::Player::Name = ""$NewPlayerAlias"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}
 
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Regex '^\$pref::Player::Name = "(.+)";' -Replacement "`$pref::Player::Name = ""$NewName"";" -FilePath "$InstallDir\common\client\prefs.cs"
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 21:55, 8 January 2024

Release Date
Windows: March 1, 2003
View at PCGamingWiki

Actions

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

Install Script

# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay

# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^\$pref::Server::Info = "(.+)";' -Substitution "`$pref::Server::Info = ""Older than your mother!"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Server::Name = "(.+)";' -Substitution "`$pref::Server::Name = ""Vintage"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Server::MaxPlayers = "(.+)";' -Substitution "`$pref::Server::MaxPlayers = ""16"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Video::displayDevice = "(.+)";' -Substitution "`$pref::Video::displayDevice = ""OpenGL"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Video::fullScreen = "(.+)";' -Substitution "`$pref::Video::fullScreen = ""1"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Video::resolution = "(.+)";' -Substitution "`$pref::Video::resolution = ""$($Display.Bounds.Width) $($Resolution.Height) 32"";" -FilePath "$InstallDirectory\common\client\prefs.cs"

Write-ReplaceContentInFile -Pattern '^\$pref::Server::Info = "(.+)";' -Substitution "`$pref::Server::Info = ""Older than your mother!"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Server::Name = "(.+)";' -Substitution "`$pref::Server::Name = ""Vintage"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Server::MaxPlayers = "(.+)";' -Substitution "`$pref::Server::MaxPlayers = ""16"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Video::displayDevice = "(.+)";' -Substitution "`$pref::Video::displayDevice = ""OpenGL"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Video::fullScreen = "(.+)";' -Substitution "`$pref::Video::fullScreen = ""1"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Video::resolution = "(.+)";' -Substitution "`$pref::Video::resolution = ""$($Display.Bounds.Width) $($Display.Bounds.Height) 32"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"

Name Change Script

Write-ReplaceContentInFile -Pattern '^\$pref::Player::Name = "(.+)";' -Substitution "`$pref::Player::Name = ""$NewPlayerAlias"";" -FilePath "$InstallDirectory\common\client\prefs.cs"
Write-ReplaceContentInFile -Pattern '^\$pref::Player::Name = "(.+)";' -Substitution "`$pref::Player::Name = ""$NewPlayerAlias"";" -FilePath "$InstallDirectory\rw\client\prefs.cs"