forked from tdymel/TCPPClientDownloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClientCreator.ps1
84 lines (64 loc) · 2.91 KB
/
ClientCreator.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Exit the script when there is a error
$ErrorActionPreference = "Stop"
echo "Installing prerequisites..."
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "This script needs to be run As Admin to install all dependencies!"
read-host "If you are sure you want to continue, ENTER to confirm..."
} else {
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
refreshenv
choco install vcredist-all openssl -y
}
echo "Starting..."
mkdir ClientCreator
cd ClientCreator
echo "Downloading dependencies..."
Invoke-Webrequest https://raw.githubusercontent.com/Geigerkind/TCPPClientDownloader/master/ClientDownloader.ps1 -Outfile ClientDownloader.ps1
Invoke-Webrequest https://github.com/Geigerkind/TCPPClientDownloader/raw/master/WoWRegeneration.exe -Outfile WoWRegeneration.exe
Invoke-Webrequest https://github.com/Geigerkind/TCPPClientDownloader/raw/master/connection_patcher.exe -Outfile connection_patcher.exe
Invoke-Webrequest https://github.com/Geigerkind/TCPPClientDownloader/raw/master/WTF.zip -Outfile WTF.zip
Expand-Archive -LiteralPath WTF.zip -DestinationPath ./
rm WTF.zip
echo "Downloading client..."
.\ClientDownloader.ps1
rm ClientDownloader.ps1
mv connection_patcher.exe wow434
mv WoWRegeneration.exe wow434
mv WTF wow434
cd wow434
# .\WoWRegeneration.exe
# $process = Start-Process -FilePath ".\WoWRegeneration.exe" -PassThru -RedirectStandardInput $true
# Adapted from by https://stackoverflow.com/a/16100200/13620003
$psi = New-Object System.Diagnostics.ProcessStartInfo;
$psi.FileName = ".\ClientCreator\wow434\WoWRegeneration.exe"; #process file
$psi.WorkingDirectory = ".\ClientCreator\wow434"
$psi.UseShellExecute = $false; #start the process from it's own executable file
$psi.RedirectStandardInput = $true; #enable the process to read from standard input
$process = [System.Diagnostics.Process]::Start($psi);
$process.StandardInput.WriteLine("07"); # Set locale to enUs
$process.StandardInput.WriteLine("01"); # Set OS to win
$process.StandardInput.WriteLine("y"); # Continue
Wait-Process -Id $process.Id
mv WoW-15595/Data .
rm -r WoW-15595
rm WoWRegeneration.exe
# read-host "Press ENTER to continue..."
echo "Patching clients..."
echo "y" | .\connection_patcher.exe Wow.exe
echo "y" | .\connection_patcher.exe Wow-64.exe
rm connection_patcher.exe
rm Wow.exe
rm Wow-64.exe
rm Battle.net.dll
rm Battle.net-64.dll
mv Wow_Patched.exe Wow.exe
mv Battle.net_Patched.dll Battle.net.dll
mv Wow-64_Patched.exe Wow-64.exe
mv Battle.net-64_Patched.dll Battle.net-64.dll
echo "Cleaning up..."
cd ../../
mv ClientCreator/wow434 .
rm -r ClientCreator
echo "Done!"
read-host "Press ENTER to exit..."