-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTowerTest.au3
More file actions
183 lines (162 loc) · 6.07 KB
/
TowerTest.au3
File metadata and controls
183 lines (162 loc) · 6.07 KB
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
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Misc.au3>
#include <Date.au3>
#include <ImageSearch.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
Local $tower, $y = 0, $x = 0, $click = 0, $toweroption, $open, $chest, $proceed, $HW, $click, $done, $final
$HW = "[REGEXPTITLE:(?i)(.*Hero Wars.*)]"
Func ClickIt($xoff = 0, $yoff = 0)
MouseClick("left", $x + $xoff, $y + $yoff, 1)
$x = 0
$y = 0
EndFunc
Func MoveIt($xoff = 0, $yoff = 0)
MouseMove($x + $xoff, $y + $yoff)
$x = 0
$y = 0
EndFunc
Func ResetXY()
$x = 0
$y = 0
EndFunc
Func FindImage($imagepath, $clickyes, $skip, $seconds = 20, $xoff = 5, $yoff = 5)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Parameters: $imagepath Relevant or direct path to BMP image
; $clickyes (bool) True/False to click on found image
; $skip (bool) True/False to bypass the Abort/Retry/Ignore if an image cannot be found
; $seconds (int) Number of seconds to search for the image, default is 20 seconds
; $xoff (int) X offset
; $yoff (int) Y offset
; Return Values: 0 if image not found and Ignored
; 1 if image found
; 2 if image not found and skipped
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$t = 0
ConsoleWrite("Processing " & $imagepath & @CRLF)
While 1
ToolTip($t & " of " & $seconds & " - Running - " & $imagepath, 10, 10)
If _ImageSearch($imagepath, 0, $x, $y, 80) Then
If $clickyes = True Then
ClickIt($xoff, $yoff)
ElseIf $clickyes = False Then
MoveIt($xoff, $yoff)
EndIf
Return 1
ToolTip("")
ExitLoop 1
EndIf
Sleep(500)
$t = $t + 0.5
If $t = $seconds AND $skip = True Then
Return 2
ToolTip("")
ExitLoop 1
ElseIf $t = $seconds AND Not $skip AND Not _ImageSearch($imagepath, 0, $x, $y, 120) Then
$return = MsgBox(2, "Error", "Unable to find image " & $imagepath & ", continue?") ; Abort (3), Retry (4), Ignore (5)
If $return = 3 Then
Exit
ElseIf $return = 4 Then
$t = 0
ElseIf $return = 5 Then
Return 0
ToolTip("")
ExitLoop 1
EndIf
EndIf
WEnd
EndFunc
WinWaitActive($HW,"")
If @WDAY = 1 Or @WDAY = 7 Then
FindImage('Images\Guild-TitanValley-HallOfFame.bmp', True, True, 5)
Sleep(500)
FindImage('Images\00-Close.bmp', True, False)
Else
FindImage('Images\Guild-TitanValley-Tournament.bmp', True, True)
Do
If FindImage('Images\Guild-TitanValley-Tournament-Raid.bmp', True, True) = 1 then
Sleep(500)
FindImage('Images\Guild-TitanValley-Tournament-Raid.bmp', True, True)
FindImage('Images\Guild-TitanValley-Tournament-Raid-OK.bmp', True, True)
FindImage('Images\Guild-TitanValley-Tournament-Raid-Claim.bmp', True, True, 5)
EndIf
Until FindImage('Images\Guild-TitanValley-Tournament-Raid.bmp', False, True, 5) = 2
Sleep(500)
If FindImage('Images\Guild-TitanValley-Tournament-Raid-Chest.bmp', True, True) = 1 then
FindImage('Images\Guild-TitanValley-Tournament-Raid-Chest-Claim.bmp', True, True)
FindImage('Images\Tower-PointsReward.bmp', True, True)
EndIf
FindImage('Images\00-Close.bmp', True, False)
EndIf
Sleep(500)
;FindImage('Images\00-Close.bmp', True, False)
;FindImage('Images\Guild-TitanValley-TitanArtifacts.bmp', True, False)
;~ If FindImage('Images\Artifact-Small-Grey.bmp', True, True, 5) = 1 then
;~ If FindImage('Images\Artifact-Long-Grey.bmp', True, False, 5) = 1 then
;~ If FindImage('Images\Artifact-UpgradeLevel.bmp', True, True, 5) = 2 Then
;~ FindImage('Images\Artifact-PlusLevel.bmp', True, True)
;~ EndIf
;~ EndIf
;~ ElseIf FindImage('Images\Artifact-Small-Green.bmp', True, True, 5) = 1 then
;~ If FindImage('Images\Artifact-Long-Green.bmp', True, False, 5) = 1 Then
;~ If FindImage('Images\Artifact-UpgradeLevel.bmp', True, True, 5) = 2 Then
;~ FindImage('Images\Artifact-PlusLevel.bmp', True, True)
;~ EndIf
;~ EndIf
;~ ElseIf FindImage('Images\Artifact-Small-Blue.bmp', True, True, 5) = 1 then
;~ If FindImage('Images\Artifact-Long-Blue.bmp', True, False, 5) = 1 Then
;~ If FindImage('Images\Artifact-UpgradeLevel.bmp', True, True, 5) = 2 Then
;~ FindImage('Images\Artifact-PlusLevel.bmp', True, True)
;~ EndIf
;~ EndIf
;~ ElseIf FindImage('Images\Artifact-Small-Purple.bmp', True, True, 5) = 1 then
;~ If FindImage('Images\Artifact-Long-Purple.bmp', True, False, 5) = 1 Then
;~ If FindImage('Images\Artifact-UpgradeLevel.bmp', True, True, 5) = 2 Then
;~ FindImage('Images\Artifact-PlusLevel.bmp', True, True)
;~ EndIf
;~ EndIf
;~ ElseIf FindImage('Images\Artifact-Small-Gold.bmp', True, True, 5) = 1 then
;~ If FindImage('Images\Artifact-Long-Gold.bmp', True, False, 5) = 1 Then
;~ If FindImage('Images\Artifact-UpgradeLevel.bmp', True, True, 5) = 2 Then
;~ FindImage('Images\Artifact-PlusLevel.bmp', True, True)
;~ EndIf
;~ EndIf
;~ EndIf
;~ Sleep(500)
;~ FindImage('Images\00-Close.bmp', True, False)
;~ Sleep(500)
;~ FindImage('Images\00-Close.bmp', True, False)
;~ Sleep(500)
;~ If FindImage('Images\Artifact-Small-Grey.bmp', True, True) = 1 then
;~ If FindImage('Images\Artifact-Long-Grey.bmp', True, True) = 1 then
;~ ElseIf FindImage('Images\Artifact-Small-Green.bmp', True, True) = 1 then
;~ If FindImage('Images\Artifact-Long-Green.bmp', True, True) = 1 then
;~ ElseIf FindImage('Images\Artifact-Small-Blue.bmp', True, True) = 1 then
;~ If FindImage('Images\Artifact-Long-Blue.bmp', True, True) = 1 then
;~ ElseIf FindImage('Images\Artifact-Small-Purple.bmp', True, True) = 1 then
;~ If FindImage('Images\Artifact-Long-Purple.bmp', True, True) = 1 then
;~ ElseIf FindImage('Images\Artifact-Small-Gold.bmp', True, True) = 1 then
;~ If FindImage('Images\Artifact-Long-Gold.bmp', True, True) = 1 then
;~ EndIf
#cs
ToDo:
Dungeon, get all oracle cards
titan valley, alter of elements, open orb
titan valley, tournament, raid until no raid, chest, close
Grand Arena, collect
manual things:
Heart of Power, All
Titan Valley, Titan Artifacts
Sanctuary, All (maybe pet egg, but that's still hard to do)
Guild War
Arena
Hero, Level
Hero, Skills x3
Hero, Skin
Campaign Mission x10
Campaign Spec Mission x3
Airship, Artifact Level
#ce