Skip to content

Commit 03fabbf

Browse files
authored
Merge pull request #282 from mattelkins/s4t-mod
Save For Trade mod
2 parents a6d450d + 66a3eb6 commit 03fabbf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+7410
-7370
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
indent_style = space
7+
indent_size = 4
8+
trim_trailing_whitespace = true

.gitignore

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
json/*
2-
!json/1.txt
31
Accounts/*
42
!Accounts/*.ahk
5-
!Accounts/Saved/1.txt
3+
json/*
64
Logs/*
7-
!Logs/1.txt
85
Screenshots/*
9-
!Screenshots/1.txt
6+
Screenshots/Trades/**
7+
!Screenshots/Trades/
8+
!Screenshots/Trades/.gitignore
109
Scripts/*.ahk
1110
Scripts/*.ini
1211
!Scripts/1.ahk
1312
!Scripts/Main.ahk
14-
Scripts/temp/*
15-
!Scripts/temp/1.txt
16-
HeartBeat.ini
17-
Settings.ini
18-
/Scripts/sample
13+
ids.txt
1914
usernames.txt
2015
vip_ids.txt
16+
*.ini
2117
*.bak
18+
!.gitkeep

Accounts/_ExtractAccount.ahk

Lines changed: 147 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -25,177 +25,177 @@ Gui, Show, , Arturo's Account Extraction Tool ;'
2525
Return
2626

2727
SaveSettings:
28-
Gui, Submit, NoHide
29-
Gui, Destroy
30-
IniWrite, %winTitle%, ExtractAccount.ini, UserSettings, winTitle
31-
IniWrite, %fileName%, ExtractAccount.ini, UserSettings, fileName
32-
IniWrite, %folderPath%, ExtractAccount.ini, UserSettings, folderPath
33-
34-
MsgBox, Settings submitted! Extracting Account. `nIt takes a few seconds. You'll get another message box telling you it's ready.
35-
36-
adbPath := folderPath . "\MuMuPlayerGlobal-12.0\shell\adb.exe"
37-
findAdbPorts(folderPath)
38-
39-
if(!WinExist(winTitle)) {
40-
Msgbox, 16, , Can't find instance: %winTitle%. Make sure that instance is running.;'
41-
ExitApp
42-
}
43-
44-
if !FileExist(adbPath) ;if international mumu file path isn't found look for chinese domestic path
45-
adbPath := folderPath . "\MuMu Player 12\shell\adb.exe"
46-
47-
if !FileExist(adbPath) {
48-
MsgBox, 16, , Double check your folder path! It should be the one that contains the MuMuPlayer 12 folder! `nDefault is just C:\Program Files\Netease
49-
ExitApp
50-
}
51-
52-
if(!adbPorts) {
53-
Msgbox, 16, , Invalid port... Check the common issues section in the readme/github guide.
54-
ExitApp
55-
}
56-
57-
RunWait, %adbPath% connect 127.0.0.1:%adbPorts%,, Hide
58-
59-
MaxRetries := 10
60-
RetryCount := 0
61-
Loop {
62-
try {
63-
if (!adbShell) {
64-
adbShell := ComObjCreate("WScript.Shell").Exec(adbPath . " -s 127.0.0.1:" . adbPorts . " shell")
65-
; Extract the Process ID
66-
processID := adbShell.ProcessID
67-
68-
; Wait for the console window to open using the process ID
69-
WinWait, ahk_pid %processID%
70-
71-
; Minimize the window using the process ID
72-
WinMinimize, ahk_pid %processID%
73-
74-
adbShell.StdIn.WriteLine("su")
75-
}
76-
else if (adbShell.Status != 0) {
77-
Sleep, 1000
78-
}
79-
else {
80-
Sleep, 1000
81-
break
82-
}
83-
}
84-
catch {
85-
RetryCount++
86-
if(RetryCount > MaxRetries) {
87-
Msgbox, Failed to connect to the shell. Try restarting your pc/instances and try again.
88-
ExitApp
89-
}
90-
}
91-
Sleep, 1000
92-
}
93-
94-
saveAccount()
28+
Gui, Submit, NoHide
29+
Gui, Destroy
30+
IniWrite, %winTitle%, ExtractAccount.ini, UserSettings, winTitle
31+
IniWrite, %fileName%, ExtractAccount.ini, UserSettings, fileName
32+
IniWrite, %folderPath%, ExtractAccount.ini, UserSettings, folderPath
33+
34+
MsgBox, Settings submitted! Extracting Account. `nIt takes a few seconds. You'll get another message box telling you it's ready.
35+
36+
adbPath := folderPath . "\MuMuPlayerGlobal-12.0\shell\adb.exe"
37+
findAdbPorts(folderPath)
38+
39+
if(!WinExist(winTitle)) {
40+
Msgbox, 16, , Can't find instance: %winTitle%. Make sure that instance is running.;'
41+
ExitApp
42+
}
43+
44+
if !FileExist(adbPath) ;if international mumu file path isn't found look for chinese domestic path
45+
adbPath := folderPath . "\MuMu Player 12\shell\adb.exe"
46+
47+
if !FileExist(adbPath) {
48+
MsgBox, 16, , Double check your folder path! It should be the one that contains the MuMuPlayer 12 folder! `nDefault is just C:\Program Files\Netease
49+
ExitApp
50+
}
51+
52+
if(!adbPorts) {
53+
Msgbox, 16, , Invalid port... Check the common issues section in the readme/github guide.
54+
ExitApp
55+
}
56+
57+
RunWait, %adbPath% connect 127.0.0.1:%adbPorts%,, Hide
58+
59+
MaxRetries := 10
60+
RetryCount := 0
61+
Loop {
62+
try {
63+
if (!adbShell) {
64+
adbShell := ComObjCreate("WScript.Shell").Exec(adbPath . " -s 127.0.0.1:" . adbPorts . " shell")
65+
; Extract the Process ID
66+
processID := adbShell.ProcessID
67+
68+
; Wait for the console window to open using the process ID
69+
WinWait, ahk_pid %processID%
70+
71+
; Minimize the window using the process ID
72+
WinMinimize, ahk_pid %processID%
73+
74+
adbShell.StdIn.WriteLine("su")
75+
}
76+
else if (adbShell.Status != 0) {
77+
Sleep, 1000
78+
}
79+
else {
80+
Sleep, 1000
81+
break
82+
}
83+
}
84+
catch {
85+
RetryCount++
86+
if(RetryCount > MaxRetries) {
87+
Msgbox, Failed to connect to the shell. Try restarting your pc/instances and try again.
88+
ExitApp
89+
}
90+
}
91+
Sleep, 1000
92+
}
93+
94+
saveAccount()
9595

9696
ExitApp
9797
return
9898

9999
findAdbPorts(baseFolder := "C:\Program Files\Netease") {
100-
global adbPorts, winTitle
101-
; Initialize variables
102-
adbPorts := 0 ; Create an empty associative array for adbPorts
103-
mumuFolder = %baseFolder%\MuMuPlayerGlobal-12.0\vms\*
104-
if !FileExist(mumuFolder)
105-
mumuFolder = %baseFolder%\MuMu Player 12\vms\*
106-
107-
if !FileExist(mumuFolder){
108-
MsgBox, 16, , Double check your folder path! It should be the one that contains the MuMuPlayer 12 folder! `nDefault is just C:\Program Files\Netease
109-
ExitApp
110-
}
111-
; Loop through all directories in the base folder
112-
Loop, Files, %mumuFolder%, D ; D flag to include directories only
113-
{
114-
folder := A_LoopFileFullPath
115-
configFolder := folder "\configs" ; The config folder inside each directory
116-
117-
; Check if config folder exists
118-
IfExist, %configFolder%
119-
{
120-
; Define paths to vm_config.json and extra_config.json
121-
vmConfigFile := configFolder "\vm_config.json"
122-
extraConfigFile := configFolder "\extra_config.json"
123-
124-
; Check if vm_config.json exists and read adb host port
125-
IfExist, %vmConfigFile%
126-
{
127-
FileRead, vmConfigContent, %vmConfigFile%
128-
; Parse the JSON for adb host port
129-
RegExMatch(vmConfigContent, """host_port"":\s*""(\d+)""", adbHostPort)
130-
adbPort := adbHostPort1 ; Capture the adb host port value
131-
}
132-
133-
; Check if extra_config.json exists and read playerName
134-
IfExist, %extraConfigFile%
135-
{
136-
FileRead, extraConfigContent, %extraConfigFile%
137-
; Parse the JSON for playerName
138-
RegExMatch(extraConfigContent, """playerName"":\s*""(.*?)""", playerName)
139-
if(playerName1 = winTitle) {
140-
adbPorts := adbPort
141-
}
142-
}
143-
}
144-
}
100+
global adbPorts, winTitle
101+
; Initialize variables
102+
adbPorts := 0 ; Create an empty associative array for adbPorts
103+
mumuFolder = %baseFolder%\MuMuPlayerGlobal-12.0\vms\*
104+
if !FileExist(mumuFolder)
105+
mumuFolder = %baseFolder%\MuMu Player 12\vms\*
106+
107+
if !FileExist(mumuFolder){
108+
MsgBox, 16, , Double check your folder path! It should be the one that contains the MuMuPlayer 12 folder! `nDefault is just C:\Program Files\Netease
109+
ExitApp
110+
}
111+
; Loop through all directories in the base folder
112+
Loop, Files, %mumuFolder%, D ; D flag to include directories only
113+
{
114+
folder := A_LoopFileFullPath
115+
configFolder := folder "\configs" ; The config folder inside each directory
116+
117+
; Check if config folder exists
118+
IfExist, %configFolder%
119+
{
120+
; Define paths to vm_config.json and extra_config.json
121+
vmConfigFile := configFolder "\vm_config.json"
122+
extraConfigFile := configFolder "\extra_config.json"
123+
124+
; Check if vm_config.json exists and read adb host port
125+
IfExist, %vmConfigFile%
126+
{
127+
FileRead, vmConfigContent, %vmConfigFile%
128+
; Parse the JSON for adb host port
129+
RegExMatch(vmConfigContent, """host_port"":\s*""(\d+)""", adbHostPort)
130+
adbPort := adbHostPort1 ; Capture the adb host port value
131+
}
132+
133+
; Check if extra_config.json exists and read playerName
134+
IfExist, %extraConfigFile%
135+
{
136+
FileRead, extraConfigContent, %extraConfigFile%
137+
; Parse the JSON for playerName
138+
RegExMatch(extraConfigContent, """playerName"":\s*""(.*?)""", playerName)
139+
if(playerName1 = winTitle) {
140+
adbPorts := adbPort
141+
}
142+
}
143+
}
144+
}
145145
}
146146

147147
saveAccount() {
148-
global adbShell, adbPath, adbPorts, fileName
149-
if (!adbShell) {
150-
adbShell := ComObjCreate("WScript.Shell").Exec(adbPath . " -s 127.0.0.1:" . adbPorts . " shell")
151-
; Extract the Process ID
152-
processID := adbShell.ProcessID
148+
global adbShell, adbPath, adbPorts, fileName
149+
if (!adbShell) {
150+
adbShell := ComObjCreate("WScript.Shell").Exec(adbPath . " -s 127.0.0.1:" . adbPorts . " shell")
151+
; Extract the Process ID
152+
processID := adbShell.ProcessID
153153

154-
; Wait for the console window to open using the process ID
155-
WinWait, ahk_pid %processID%
154+
; Wait for the console window to open using the process ID
155+
WinWait, ahk_pid %processID%
156156

157-
; Minimize the window using the process ID
158-
WinMinimize, ahk_pid %processID%
159-
}
157+
; Minimize the window using the process ID
158+
WinMinimize, ahk_pid %processID%
159+
}
160160

161-
saveDir := A_ScriptDir "\" . fileName . ".xml"
161+
saveDir := A_ScriptDir "\" . fileName . ".xml"
162162

163-
if(FileExist(saveDir)) {
164-
MsgBox, 16, , File already exists! Delete it or input a different name then try again!
165-
ExitApp
166-
}
163+
if(FileExist(saveDir)) {
164+
MsgBox, 16, , File already exists! Delete it or input a different name then try again!
165+
ExitApp
166+
}
167167

168-
count := 0
168+
count := 0
169169

170-
Loop {
170+
Loop {
171171

172-
adbShell.StdIn.WriteLine("rm /sdcard/deviceAccount.xml")
172+
adbShell.StdIn.WriteLine("rm /sdcard/deviceAccount.xml")
173173

174-
Sleep, 500
174+
Sleep, 500
175175

176-
adbShell.StdIn.WriteLine("cp /data/data/jp.pokemon.pokemontcgp/shared_prefs/deviceAccount:.xml /sdcard/deviceAccount.xml")
176+
adbShell.StdIn.WriteLine("cp /data/data/jp.pokemon.pokemontcgp/shared_prefs/deviceAccount:.xml /sdcard/deviceAccount.xml")
177177

178-
Sleep, 500
178+
Sleep, 500
179179

180-
RunWait, % adbPath . " -s 127.0.0.1:" . adbPorts . " pull /sdcard/deviceAccount.xml """ . saveDir,, Hide
180+
RunWait, % adbPath . " -s 127.0.0.1:" . adbPorts . " pull /sdcard/deviceAccount.xml """ . saveDir,, Hide
181181

182-
Sleep, 500
182+
Sleep, 500
183183

184-
FileGetSize, OutputVar, %saveDir%
184+
FileGetSize, OutputVar, %saveDir%
185185

186-
if(OutputVar > 0)
187-
break
186+
if(OutputVar > 0)
187+
break
188188

189-
if(count > 10) {
190-
MsgBox, 16, , Tried 10 times. Failed to extract account.
191-
ExitApp
192-
}
193-
count++
194-
}
189+
if(count > 10) {
190+
MsgBox, 16, , Tried 10 times. Failed to extract account.
191+
ExitApp
192+
}
193+
count++
194+
}
195195

196-
adbShell.StdIn.WriteLine("am force-stop jp.pokemon.pokemontcgp")
196+
adbShell.StdIn.WriteLine("am force-stop jp.pokemon.pokemontcgp")
197197

198-
adbShell.StdIn.WriteLine("rm /data/data/jp.pokemon.pokemontcgp/shared_prefs/deviceAccount:.xml") ; delete account data
198+
adbShell.StdIn.WriteLine("rm /data/data/jp.pokemon.pokemontcgp/shared_prefs/deviceAccount:.xml") ; delete account data
199199

200-
MsgBox, Success! Extracted account '%fileName%.xml' to the Accounts folder, closed the game, and deleted the local save from the instance.
200+
MsgBox, Success! Extracted account '%fileName%.xml' to the Accounts folder, closed the game, and deleted the local save from the instance.
201201
}

0 commit comments

Comments
 (0)