Dungeons & Dragons: Dragonshard: Difference between revisions

From LANCommander
(Created new page for Dungeons & Dragons: Dragonshard)
 
No edit summary
 
Line 5: Line 5:
{{Game.InfoBox.Developer|Liquid Entertainment}}
{{Game.InfoBox.Developer|Liquid Entertainment}}
|Publishers =
|Publishers =
{{Game.InfoBox.Developer|Atari, Inc.}}
{{Game.InfoBox.Publisher|Atari, Inc.}}
|Release Date =
|Release Date =
{{Game.InfoBox.ReleaseDate|Windows|September 21, 2005}}
{{Game.InfoBox.ReleaseDate|Windows|September 21, 2005}}
Line 14: Line 14:
{{Game.ActionBox
{{Game.ActionBox
|Actions =  
|Actions =  
{{Game.ActionBox.Row|Name = Play|Path = {InstallDir}\Dragonshard.exe|Arguments = |WorkingDirectory = |Primary = True}}
{{Game.ActionBox.Row|Name = Play|Path = {InstallDir}\Dragonshard.exe|Arguments = -nointro|WorkingDirectory = |Primary = True}}
}}
}}


Line 21: Line 21:
|Name = Install Script
|Name = Install Script
|Description =  
|Description =  
|RequiresAdmin = True
|RequiresAdmin = False
|Contents =
|Contents =
<syntaxhighlight lang="powershell" line>
<syntaxhighlight lang="powershell" line>
Line 33: Line 33:
Write-ReplaceContentInFile -Pattern '^Height(.+)' -Substitution "Height = $($Display.Bounds.Height)" -FilePath "$InstallDirectory\DND.ini"
Write-ReplaceContentInFile -Pattern '^Height(.+)' -Substitution "Height = $($Display.Bounds.Height)" -FilePath "$InstallDirectory\DND.ini"


New-Item -Path "registry::\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Liquid Entertainment"
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"
New-Item -Path "registry::\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Liquid Entertainment\Dragonshard"
New-ItemProperty -Path "registry::\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Liquid Entertainment\Dragonshard" -Name "Program" -Value "Dragonshard.exe" -Force
New-ItemProperty -Path "registry::\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Liquid Entertainment\Dragonshard" -Name "Install Path" -Value "$InstallDirectory" -Force
New-ItemProperty -Path "registry::\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Liquid Entertainment\Dragonshard" -Name "CD Key" -Value "JDZJ-QD6B-437T-WBDY" -Force


# cmd /c mkdir '%userprofile%\Documents\My Games'
New-Item -Path "$VirtualStore\WOW6432Node\Liquid Entertainment"
# cmd /c mkdir '%userprofile%\Documents\My Games\Dragonshard'
New-Item -Path "$VirtualStore\WOW6432Node\Liquid Entertainment\Dragonshard"
# cmd /c mklink /j '%userprofile%\Documents\My Games\Dragonshard' '$InstallDiretory\Dragonshard'
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Liquid Entertainment\Dragonshard" -Name "Program" -Value "Dragonshard.exe" -Force
#
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Liquid Entertainment\Dragonshard" -Name "Install Path" -Value "$InstallDirectory" -Force
# $filePath = "$InstallDiretory\DNDini"
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Liquid Entertainment\Dragonshard" -Name "CD Key" -Value "JDZJ-QD6B-437T-WBDY" -Force
#
# # Get the screen resolution
# Add-Type -AssemblyName System.Windows.Forms
# $screen = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Size
# $width = $screen.Width
# $height= $screen.Height
#
# # Read the content of the file
# $content = Get-Content -Path $filePath
#
# # Loop through each line in the file
# for ($i = 0; $i -lt $content.Count; $i++) {
#    $line = $content[$i]
#
#    # Check if the line contains "Resolution"
#    if ($line -like '*Width*') {
#    $line
#        # Replace the line with the updated width
#        $content[$i] = "Width            =$width"
#       
#    }
#    if ($line -like '*Height*') {
#    $line
#        # Replace the line with the updated width
#        $content[$i] = "Height            =$height"
#       
#    }
#   
#  }
#
# # Save the updated content back to the file
# $content | Set-Content -Path $filePath
#
# $filePath = "$env:USERPROFILE\Documents\My Games\Dragonshard\Profiles\test.pro"
# # Get the screen resolution
# Add-Type -AssemblyName System.Windows.Forms
# $screen = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Size
# $width = $screen.Width
# $height= $screen.Height
#
# # Read the content of the file
# $content = Get-Content -Path $filePath
#
# # Loop through each line in the file
# for ($i = 0; $i -lt $content.Count; $i++) {
#    $line = $content[$i]
#
#    # Check if the line contains "Resolution"
#    if ($line -like '*video_resolutionX*') {
#    $line
#        # Replace the line with the updated width
#        $content[$i] = "video_resolutionX ""$Width"""
#       
#    }
#    # Check if the line contains "Resolution"
#    if ($line -like '*video_resolutionY*') {
#    $line
#        # Replace the line with the updated width
#        $content[$i] = "video_resolutionY ""$Height"""
#       
#    }
#  }
#
# # Save the updated content back to the file
# $content | Set-Content -Path $filePath
#
</syntaxhighlight>
</syntaxhighlight>
}}
}}
Line 116: Line 46:
|Name = Uninstall Script
|Name = Uninstall Script
|Description =  
|Description =  
|RequiresAdmin = True
|RequiresAdmin = False
|Contents =
|Contents =
<syntaxhighlight lang="powershell" line>
<syntaxhighlight lang="powershell" line>
$Documents = [Environment]::GetFolderPath("MyDocuments")
$Documents = [Environment]::GetFolderPath("MyDocuments")
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"


Remove-Item -Path "$Documents\My Games\Dragonshard" -Force -Recurse
Remove-Item -Path "$Documents\My Games\Dragonshard" -Force -Recurse
Remove-Item -Path "registry::\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Liquid Entertainment" -Force -Recurse
Remove-Item -Path "$VirtualStore\WOW6432Node\Liquid Entertainment" -Force -Recurse
</syntaxhighlight>
</syntaxhighlight>
}}
}}
Line 168: Line 99:


[IO.File]::WriteAllBytes("$Documents\My Games\Dragonshard\Profiles\profiles.dat", $NameBytes)
[IO.File]::WriteAllBytes("$Documents\My Games\Dragonshard\Profiles\profiles.dat", $NameBytes)
#$filePath = "$env:USERPROFILE\Documents\My Games\Dragonshard\Profiles\test.pro"
## Get the screen resolution
#Add-Type -AssemblyName System.Windows.Forms
#$screen = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Size
#$width = $screen.Width
#$height= $screen.Height
#
## Read the content of the file
#$content = Get-Content -Path $filePath
#
## Loop through each line in the file
#for ($i = 0; $i -lt $content.Count; $i++) {
#    $line = $content[$i]
#
#    # Check if the line contains "player_name"
#    if ($line -like '*player_name*') {
#    $line
#        # Replace the line with the updated width
#        $content[$i] = "player_name ""$NewPlayerAlias"""
#       
#    }
#    # Check if the line contains "player_filename"
#    if ($line -like '*player_filename*') {
#    $line
#        # Replace the line with the updated width
#        $content[$i] = "player_filename ""$NewPlayerAlias"""
#       
#    }
#  }
#
## Save the updated content back to the file
#$content | Set-Content -Path $filePath
#
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 00:42, 22 February 2024

Developers
Liquid Entertainment
Publishers
Atari, Inc.
Release Date
Windows: September 21, 2005
Genres
StrategyRole-playing (RPG)
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play {InstallDir}\Dragonshard.exe -nointro True

Install Script

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

Write-ReplaceContentInFile -Pattern '^video_resolutionX "(.+)"' -Substitution "video_resolutionX ""$($Display.Bounds.Width)""" -FilePath "$InstallDirectory\Dragonshard\Profiles\test.pro"
Write-ReplaceContentInFile -Pattern '^video_resolutionY "(.+)"' -Substitution "video_resolutionY ""$($Display.Bounds.Height)""" -FilePath "$InstallDirectory\Dragonshard\Profiles\test.pro"

Write-ReplaceContentInFile -Pattern '^Width(.+)' -Substitution "Width = $($Display.Bounds.Width)" -FilePath "$InstallDirectory\DND.ini"
Write-ReplaceContentInFile -Pattern '^Height(.+)' -Substitution "Height = $($Display.Bounds.Height)" -FilePath "$InstallDirectory\DND.ini"

$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"

New-Item -Path "$VirtualStore\WOW6432Node\Liquid Entertainment"
New-Item -Path "$VirtualStore\WOW6432Node\Liquid Entertainment\Dragonshard"
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Liquid Entertainment\Dragonshard" -Name "Program" -Value "Dragonshard.exe" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Liquid Entertainment\Dragonshard" -Name "Install Path" -Value "$InstallDirectory" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Liquid Entertainment\Dragonshard" -Name "CD Key" -Value "JDZJ-QD6B-437T-WBDY" -Force

Uninstall Script

$Documents = [Environment]::GetFolderPath("MyDocuments")
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"

Remove-Item -Path "$Documents\My Games\Dragonshard" -Force -Recurse
Remove-Item -Path "$VirtualStore\WOW6432Node\Liquid Entertainment" -Force -Recurse

Name Change Script

$Documents = [Environment]::GetFolderPath("MyDocuments")
$NewPlayerAlias = $NewPlayerAlias.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'
$OldPlayerAlias = $NewPlayerAlias.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'
$Display = Get-PrimaryDisplay
$Guid = [Guid]::NewGuid()

# Trim a string down to a specified amount of characters
if ($NewPlayerAlias.Length -gt 20) {
    $NewPlayerAlias = $NewPlayerAlias.Substring(0, 20);
}

if ($OldPlayerAlias.Length -gt 20) {
    $OldPlayerAlias = $OldPlayerAlias.Substring(0, 20);
}

if (Test-Path "$Documents\My Games\Dragonshard\Profiles\$OldPlayerAlias.pro") {
    Move-Item "$Documents\My Games\Dragonshard\Profiles\$OldPlayerAlias.pro" "$Documents\My Games\Dragonshard\Profiles\$NewPlayerAlias.pro"
} else {
    New-Item -ItemType Directory -Path "$Documents\My Games"
    New-Item -ItemType Directory -Path "$Documents\My Games\Dragonshard"
    New-Item -ItemType Directory -Path "$Documents\My Games\Dragonshard\Profiles"
    Copy-Item -Path "$InstallDirectory\Dragonshard\Profiles\test.pro" -Destination "$Documents\My Games\Dragonshard\Profiles\$NewPlayerAlias.pro"
}

# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^player_name "(.+)"' -Substitution "player_name ""$NewPlayerAlias""" -FilePath "$Documents\My Games\Dragonshard\Profiles\$NewPlayerAlias.pro"
Write-ReplaceContentInFile -Pattern '^player_filename "(.+)"' -Substitution "player_filename ""$NewPlayerAlias""" -FilePath "$Documents\My Games\Dragonshard\Profiles\$NewPlayerAlias.pro"
Write-ReplaceContentInFile -Pattern '^guid "(.+)"' -Substitution "guid ""{$($Guid.ToString())}""" -FilePath "$Documents\My Games\Dragonshard\Profiles\$NewPlayerAlias.pro"

# The profiles.dat file selects the last used profile. It's a binary file that starts with a 5 byte header with offset 0x01 describing the length of the name based on character count.
# The profile name itself is UTF16 encoded and is suffixed by two bytes of 0x00, probably to denote end-of-file.
$Header = @([byte] 0x00, 0x15, 0x00, 0x00, 0x00)
$NameBytes = ConvertTo-StringBytes -Input "$NewPlayerAlias" -Utf16 1 -MaxLength 21 -MinLength 21
$NameBytes = $Header + $NameBytes

[IO.File]::WriteAllBytes("$Documents\My Games\Dragonshard\Profiles\profiles.dat", $NameBytes)