-
Notifications
You must be signed in to change notification settings - Fork 0
/
AutoE7.au3
268 lines (227 loc) · 5.5 KB
/
AutoE7.au3
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#comments-start
-dieptt
App screen: W:1920, H:1080
Interval: 1000 ms
Get App: Ctr + Shift + A/B/Check
OpenApp----------------------
kr.supercreative.epic7.AppActivity
#comments-end
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <Android.au3>
#include <GUIGenerator.au3>
;-------------
Global $struct = DllStructCreate($tagPoint)
_SystemConfig()
CreateGUI(200, 250)
While 1
Sleep(100)
Info()
WEnd
; Start >>>>
Func Start()
If Not $application Then
MsgBox(0,"AutoE7","Press Ctrl + Shift + A to connect device")
Return 0
EndIf
ToolTip("")
SetPosition()
TrayItemSetState($tciStart,4)
If GUICtrlRead($gcbStart)="Start" Then
GUICtrlSetData($gcbStart,"Stop")
TrayItemSetText($tciStart,"Stop")
Else
GUICtrlSetData($gcbStart,"Start")
TrayItemSetText($tciStart,"Start")
EndIf
;~ AutoClick()
; Buy energy first
; If CheckboxChecked($gccBuyEnergy)=True Then
; EnterPurchaseState()
; Else
ExitPurchaseState()
; Endif
$start=Not $start
If $start Then
Replay(1)
Else
Replay(0)
EndIf
EndFunc
Func Replay($t)
$time=50
;~ $time=GUICtrlRead($gclInterval)*1000
$time=Int($time)
If $t=1 Then
AdlibRegister("AutoClick",$time)
Else
AdlibUnRegister("AutoClick")
EndIf
EndFunc
Func AutoClick()
$ratiow = 100
$ratioh = 100
; Check Purchase State
ConsoleWrite("Autoclick count = " & $click & @CRLF)
If $click=$saveNormal Then
$click=0
$isStartLoop=False
$loopInterval=GUICtrlRead($gclInterval)
ConsoleWrite("Now wait until " & $loopInterval & "s" & @CRLF)
$loopInterval=Int($loopInterval)
Sleep($loopInterval*1000)
Else
$isStartLoop=True
Endif
$x = $posXNormal[$click]*$ratiow/100
$y = $posYNormal[$click]*$ratioh/100
$click += 1
If $click>0 Then
Click($x,$y)
Endif
EndFunc
Func EnterPurchaseState()
$purchased=True
$click=0
$timeDelayPurchase=TimerInit()
EndFunc
Func ExitPurchaseState()
$purchased=False
$click=0
$timeStartPurchase=TimerInit()
EndFunc
;click function
Func Click($x=0, $y=0)
$lParam = _WinAPI_MakeLong($x, $y)
ConsoleWrite("Start click at " & $x & "- " & $y & @CRLF)
Runwait(@ComSpec & " /q /c " & "adb shell input tap "& $x &" " & $y,@ScriptDir,@SW_HIDE)
$timeSleep = GUICtrlRead($gclIntervalClick)
ConsoleWrite("time sleep per click = " & $timeSleep & @CRLF)
Sleep(Number($timeSleep))
EndFunc
Func GetApp()
;DllStructSetData($struct, "x", MouseGetPos(0))
;DllStructSetData($struct, "y", MouseGetPos(1))
_Android_Connect();
GUICtrlSetData($gcConnectStatus,"Connecting...")
GUICtrlSetColor($gcConnectStatus, $COLOR_BLUE)
Sleep(4000)
While 1
if(_Android_IsOnline()) Then
GUICtrlSetData($gcConnectStatus,"Connected!")
GUICtrlSetColor($gcConnectStatus, $COLOR_RED)
$resolution = _Android_GetResolution()
ExitLoop
EndIf
Sleep(500)
WEnd
$application = 1
GetAppSize()
EndFunc
Func SetPosInMenu($mode)
Switch $mode
Case "Adventure"
$posXNormal[($i)/2] = $MENU[$i]
$posYNormal[($i-1)/2] = $MENU[$i]
EndSwitch
EndFunc
Func CheckBuy()
If GUICtrlRead($gccComboBuyEnergy)=$STR_COMBO_NONE Then
Return 0
ElseIf GUICtrlRead($gccComboBuyEnergy)=$STR_COMBO_USE_GEM Then
Return 1
ElseIf GUICtrlRead($gccComboBuyEnergy)=$STR_COMBO_USE_LEAF Then
Return 2
EndIf
EndFunc
Func SetPosition()
If GUICtrlRead($gcComboMode)=$STR_COMBO_ADVENTURE Then
;------------------- Add pos adventure
$isStartLoop=True
$totalArray=0
If CheckBuy()=0 Then
$posXNormal[0] = $BUY_CANCEL[0]
$posYNormal[0] = $BUY_CANCEL[1]
$totalArray = UBound($ADVENTURE)+1
$i = 2
ElseIf CheckBuy()=1 Then
$posXNormal[0] = $BUY_GEM[0]
$posYNormal[0] = $BUY_GEM[1]
$posXNormal[1] = $BUY_CONFIRM[0]
$posYNormal[1] = $BUY_CONFIRM[1]
$totalArray = UBound($ADVENTURE)+3
$i = 4
ElseIf CheckBuy()=2 Then
$posXNormal[0] = $BUY_CONFIRM[0]
$posYNormal[0] = $BUY_CONFIRM[1]
$totalArray = UBound($ADVENTURE)+1
$i = 2
EndIf
For $j = 0 To UBound($ADVENTURE)-1
ConsoleWrite("j = " & $j & @CRLF)
If Mod($j, 2) = 0 Then
$posXNormal[($j+$i)/2] = $ADVENTURE[$j]
Else
$posYNormal[($j+$i-1)/2] = $ADVENTURE[$j]
EndIf
Next
$saveNormal = ($totalArray+1)/2
ConsoleWrite("save normal = " & $saveNormal & @CRLF)
ElseIf GUICtrlRead($gcComboMode)=$STR_COMBO_HUNT Then
$isStartLoop=False
EndIf
EndFunc
Func GetAppSize()
Local $index = StringInStr($resolution,"x")
$appheight = StringLeft($resolution,$index-1);
$appwidth = StringRight( $resolution,$index)
$ratiow = ($appwidth - $TaskbarSize)*100/$SCREEN_SIZE[0]
$ratioh = $appheight*100/$SCREEN_SIZE[1]
EndFunc
Func Info()
If Not $application Then
Return 0
EndIf
GetAppSize()
GUICtrlSetData($gclW,$appwidth)
GUICtrlSetData($gclH,$appheight)
GUICtrlSetData($gclS,$click)
EndFunc
Func Show()
TrayItemSetState($tciShow,4)
$visible=Not $visible
If $visible=True Then
GUISetState(@SW_SHOW)
Else
GUISetState(@SW_HIDE)
EndIf
EndFunc
Func CheckboxChecked($idControlID)
Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc
Func GetAppKey()
Switch GUICtrlRead($gcComboSetKey)
Case "A"
HotKeySet("^+b")
HotKeySet("^+c")
GetApp()
Case "B"
HotKeySet("^+a")
HotKeySet("^+c")
GetApp()
Case "C"
HotKeySet("^+a")
HotKeySet("^+b")
GetApp()
Case Else
HotKeySet("^+a")
HotKeySet("^+b")
HotKeySet("^+c")
EndSwitch
EndFunc
; <<<< End
Func Close()
Exit
EndFunc