Update Among Us - TOHE.ps1

This commit is contained in:
2024-10-07 14:39:30 +00:00
parent cbd7443c73
commit 4d9b6811f2

View File

@@ -1,24 +1,27 @@
$gameName = "Among Us" #Powershell $A = (curl https://gitea.resta.us/resta.us/public/raw/branch/main/Among%20Us%20-%20TOHE.ps1).content; Invoke-Expression $A
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
# Search for the game in the registry $gameName = "Among Us"
$gameKey = Get-ChildItem $registryPath | Where-Object {(Get-ItemProperty $_.PSPath).DisplayName -like "*$gameName*"} $registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$GamePath = (Get-ItemProperty $gameKey.PSPath).InstallLocation
if ($GamePath) # Search for the game in the registry
{ $gameKey = Get-ChildItem $registryPath | Where-Object {(Get-ItemProperty $_.PSPath).DisplayName -like "*$gameName*"}
$ModURL = "https://github.com/EnhancedNetwork/TownofHost-Enhanced/releases/download/v2.0.3/TOH-Enhanced.2.0.3.zip" $GamePath = (Get-ItemProperty $gameKey.PSPath).InstallLocation
$Temp = "C:\Temp\Among Us" if ($GamePath)
$installPath = $GamePath -replace ".{9}$" {
Remove-Item "$installPath\TOHE" -Recurse -Force -ErrorAction SilentlyContinue $ModURL = "https://github.com/EnhancedNetwork/TownofHost-Enhanced/releases/download/v2.0.3/TOH-Enhanced.2.0.3.zip"
Remove-Item "C:\Users\$env:Username\Desktop\Among Us - TOHE" -Recurse -Force -ErrorAction SilentlyContinue $Temp = "C:\Temp\Among Us"
New-Item $Temp -ItemType Directory -Force -ErrorAction SilentlyContinue $installPath = $GamePath -replace ".{9}$"
Curl -Uri $ModURL -OutFile "$Temp\File.zip" Remove-Item "$installPath\TOHE" -Recurse -Force -ErrorAction SilentlyContinue
Copy-Item -Path "$installPath\$gameName" -Destination "$installPath\TOHE" -Recurse Remove-Item "C:\Users\$env:Username\Desktop\Among Us - TOHE" -Recurse -Force -ErrorAction SilentlyContinue
Expand-Archive "$Temp\File.zip" -DestinationPath "$installPath\TOHE" New-Item $Temp -ItemType Directory -Force -ErrorAction SilentlyContinue
New-Item -ItemType SymbolicLink -Path "C:\Users\$env:Username\Desktop" -Name "Among Us - TOHE" -Value "$installPath\TOHE\Among Us.exe" Curl -Uri $ModURL -OutFile "$Temp\File.zip"
Remove-Item "$Temp" -Recurse Copy-Item -Path "$installPath\$gameName" -Destination "$installPath\TOHE" -Recurse
} Expand-Archive "$Temp\File.zip" -DestinationPath "$installPath\TOHE"
else New-Item -ItemType SymbolicLink -Path "C:\Users\$env:Username\Desktop" -Name "Among Us - TOHE" -Value "$installPath\TOHE\Among Us.exe"
{ Remove-Item "$Temp" -Recurse
Write-Output "Cannot autodetect the game's install location. Please manually install the mods." }
else
{
Write-Output "Cannot autodetect the game's install location. Please manually install the mods."
} }