#========================================================================================================== # Written by ThaumX 16 Dec 2019 # HOTFIX Powershell script to make a simple fix to the game file. # If you are viewing this in an editor, you're doing it wrong. Right click and select "Run with Powershell" # If you receive a security confirmation message, type "Y" and press enter. # This script isn't going to work on a Mac / Linux OS machine, use the manual fix instead. #========================================================================================================== # Splash screen Write-Host -ForegroundColor WHITE " ===========================================================" Write-Host -ForegroundColor CYAN " █████╗ ██╗ ██╗ ███████╗██╗██╗ ██╗███████╗██████╗" Write-Host -ForegroundColor CYAN " ██╔══██╗██║ ██║ ██╔════╝██║╚██╗██╔╝██╔════╝██╔══██╗" Write-Host -ForegroundColor CYAN " ███████║██║ █╗ ██║ █████╗ ██║ ╚███╔╝ █████╗ ██████╔╝" Write-Host -ForegroundColor CYAN " ██╔══██║██║███╗██║ ██╔══╝ ██║ ██╔██╗ ██╔══╝ ██╔══██╗" Write-Host -ForegroundColor CYAN " ██║ ██║╚███╔███╔╝ ██║ ██║██╔╝ ██╗███████╗██║ ██║" Write-Host -ForegroundColor CYAN " ╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝" Write-Host -ForegroundColor WHITE " -----------------------------------------------------------" Write-Host -ForegroundColor GREEN " VERSION 2!!!" Write-Host -ForegroundColor CYAN " This will fix the no pregnancy bug in AW v28 and/or v29" Write-Host -ForegroundColor RED " This script MUST be located in the same directory as the" Write-Host -ForegroundColor RED " game .html file in order to work!" Write-Host -ForegroundColor WHITE " ===========================================================" $blyat = Read-Host " Press Enter to continue..." " Finding current directory" # get the local path - PSv2 safe version $scriptPath = $PSScriptRoot #split-path -parent $MyInvocation.MyCommand.Definition # print for users Write-Host -ForegroundColor WHITE " Current directory is: " $scriptPath # Array of different version file names $fileNames = "AW_v0-29-0_[elite]", "AW_v0-29-0_[cheats]", "AW_v0-29-0_[backer]", "AW_v0-29-0_[patron]", "AW_v0-29-0_[public]", "AW_v0-28-0_[elite]", "AW_v0-28-0_[cheats]", "AW_v0-28-0_[backer]", "AW_v0-28-0_[patron]", "AW_v0-28-0_[public]" $newNames = "AW_v0-29-0_elite.html", "AW_v0-29-0_cheats.html", "AW_v0-29-0_backer.html", "AW_v0-29-0_public.html", "AW_v0-28-0_elite.html", "AW_v0-28-0_cheats.html", "AW_v0-28-0_backer.html", "AW_v0-28-0_public.html" $finalPath = "none" " Searching for valid game file..." # For loop to see if any of the above files exist for ($i = 0; $i -lt 10; $i++) { #Create temporary path to test [io.fileinfo]$file = $scriptPath + "\" + $fileNames[$i] + ".html" #$testPath = $scriptPath + $fileNames[$i] + ".html" if ($file.Exists) { Write-Host -ForegroundColor GREEN $fileNames[$i] + " FOUND" $finalPath = $file.FullName $finalPath Break } else { Write-Host -ForegroundColor GRAY " did not find " $testPath } } # Check to make sure a valid script was found... if ($finalPath -eq "none") { " " Write-Host -ForegroundColor RED " ERROR: No valid game files found!" Write-Host -ForegroundColor WHITE " Please place this AW_Fixer.ps1 file in the SAME directory as your game .html file!" $blyat = Read-Host " Press Enter to close..." Exit } " " Write-Host -ForegroundColor WHITE " Reading content of game file into memory..." # get ze content of the file $content = Get-Content -LiteralPath $file Write-Host -ForegroundColor WHITE " Replacing buggy yucky code with working yummy code!" # replace broken code in file... $found = 0 $cunt = 0 ForEach ($line in $content) { $cunt ++ if ($line -match [regex]::Escape('function(e,t){for(var a=0,n=t.length-1;0<=n;n--)e<=n&&(a=n);')) { $found ++ $cock = $line -replace [regex]::Escape('function(e,t){for(var a=0,n=t.length-1;0<=n;n--)e<=n&&(a=n);'), 'function(e,t){for(var a=0,n=t.length-1;0<=n;n--)e<=n&&(a=t[n]);' "Found an issue at index " + $content.IndexOf($line) + ", line number " + $cunt + "... Fixing" $content[$content.IndexOf($line)] = $cock } } ForEach ($line in $content) { $cunt ++ if ($line -match [regex]::Escape('function(e,t){for(var a=0,n=t.length-1;0<=n;n--)e<=n&&(a=n);')) { $found ++ $cock = $line -replace [regex]::Escape('function(e,t){for(var a=0,n=t.length-1;0<=n;n--)e<=n&&(a=t[n]);'), 'function(e,t){for(var a=0,n=t.length-1;0<=n;n--)e<=t[n]&&(a=t[n]);' "Found an issue at index " + $content.IndexOf($line) + ", line number " + $cunt + "... Fixing" $content[$content.IndexOf($line)] = $cock } } " Found " + $found + " problem code" if ($found -gt 0) { Write-Host -ForegroundColor CYAN " Problem code was found and fixed" " " Write-Host -ForegroundColor WHITE " Saving the new and improved game file..." # Save the file with new content $content | Set-Content -LiteralPath $file " " } else { " No problem code was found, so you should be good to go already!" " " } Write-Host -ForegroundColor GREEN " DONE! AW is now fixed :D" $blyat = Read-Host " Press Enter to close"