-
Notifications
You must be signed in to change notification settings - Fork 6
/
getGacha.ps1
75 lines (61 loc) · 2.69 KB
/
getGacha.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
Add-Type -AssemblyName System.Web
$ProgressPreference = 'SilentlyContinue'
#Find Game
Write-Output "Attempting to find game path automatically..."
$64 = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
$32 = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$gamePath = (Get-ItemProperty -Path $32, $64 | Where-Object { $_.DisplayName -like "*wuthering*" } | Select InstallPath).PSObject.Properties.Value
$gachaLogPathExists = Test-Path ($gamePath + '\Wuthering Waves Game\Client\Binaries\Win64\ThirdParty\KrPcSdk_Global\KRSDKRes\KRSDKWebView')
$method = "automatic"
if (!$gamePath -or !$gachaLogPathExists) {
$method = "manual"
Write-Output " "
Write-Output "Couldn't automatically find game path. Please enter game path manually."
Write-Output "Ex. E:\Wuthering Waves"
Write-Output " "
$path = read-host "Game path: "
if ($path) {
if ($path.EndsWith("Wuthering Waves")) {
$gamePath = $path
Write-Output "Manually found game path."
} elseif ($path.EndsWith("Wuthering Waves Game")) {
$gamePath = $path.replace("Wuthering Waves Game", "")
Write-Output "Manually found game path."
} else {
Write-Output "Invalid game path. Please try again."
}
} else {
Write-Output "Invalid game path. Please try again."
}
} else {
Write-Output "Automatically found game path."
}
Write-Output " "
$gachaLogPath = $gamePath + '\Wuthering Waves Game\Client\Binaries\Win64\ThirdParty\KrPcSdk_Global\KRSDKRes\KRSDKWebView'
#Find Gacha Url
if (Test-Path ($gachaLogPath + "\debug.log") -PathType Leaf) {
Write-Output "Finding Gacha Url..."
Copy-Item -Path ($gachaLogPath + "\debug.log") -Destination ($gachaLogPath + "\debug_copy.log")
$cacheData = Get-Content ($gachaLogPath + "\debug.log")
Remove-Item -Path ($gachaLogPath + "\debug_copy.log")
$cacheDataLines = $cacheData -split '1/0/'
$url = ""
for ($i = $cacheDataLines.Length - 1; $i -ge 0; $i--) {
$line = $cacheDataLines[$i]
if ($line.Contains("https://aki-gm-resources-oversea.aki-game.net/aki/gacha/index.html#/record")) {
$url = (($line -split ': "')[1].replace('",', "")) + ("&wa_method=" + $method)
break
}
}
if ($url) {
Write-Output " "
Write-Output $url
Set-Clipboard -Value $url
Write-Output " "
Write-Output "Gacha Url has been saved to clipboard."
} else {
Write-Output "Unable to find Gacha Url. Please open Convene Records in game."
}
} else {
Write-Output "Unable to find Gacha Url. Please open Convene Records in game."
}