-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAlgolv6-8 v3.2-beta.au3
245 lines (191 loc) · 7.8 KB
/
Algolv6-8 v3.2-beta.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
#include <INet.au3>
#include <String.au3>
#include <Constants.au3>
#include <Array.au3>
$device_touch = "event1"
HotKeySet("{F3}", "TogglePause")
Global $Paused
; Local $file = FileOpen("portales diciembre.au3", 0)
; Local $file = FileOpen("portales barcelona.au3", 0)
; Local $file = FileOpen("portales barcelona2.au3", 0)
; Local $file = FileOpen("portales barcelonaTODO.au3", 0)
Local $file = FileOpen("portales palma mallorca.au3", 0)
; $String_portal = ClipGet()
$String_portal = FileRead($file)
$Limitar_equipo = ''; '<td style="text-align:center;">2</td>' ; 1 azul 2 verde
$Limitar_Deploids = '%</td><td>(.*?)</td><td'
;Defino array con datos de los portales
Local $Portales[1][5]
$Portales[0][0] = "X"
$Portales[0][1] = "Y"
$Portales[0][2] = "Deploid"
$Portales[0][3] = "Hacks"
$Portales[0][4] = "Tiempo de hack"
$Deploids = 0
$Hacks_posibles = 5
$segundos_entre_Hacks = 300 + 30
$tiempo_ultimo_hack = _DateAdd('s', ($segundos_entre_Hacks * -1) - 1, _NowCalc())
$distancia_con_portal_anterior = 0.001 ;(7 Segundos)
; $distancia_con_portal_anterior = 0.003 ;(21 Segundos)
$Portal_anterior = ""
; '\[(.*?)\]' '[(\d.*?\,.*?\d)\].*?'
$array_temp = StringRegExp($String_portal, 'Capture(.*?)help apGain', 3)
; _ArrayDisplay($array_temp)
For $i = 0 To UBound($array_temp) - 1
$temp = StringRegExp($array_temp[$i], '\[(.*?\,.*?)\]', 3)
$temp = StringSplit($temp[0], ",")
; if StringInStr()Enemy,Friendly
If IsArray($temp) Then
$Dep_temp = StringRegExp($array_temp[$i], $Limitar_Deploids, 3)
$cant_deploid = 8 - $Dep_temp[0]
ReDim $Portales[UBound($Portales) + 1][5]
$Portales[UBound($Portales) - 1][0] = $temp[1]
$Portales[UBound($Portales) - 1][1] = $temp[2]
$Portales[UBound($Portales) - 1][2] = $cant_deploid
$Portales[UBound($Portales) - 1][3] = $Hacks_posibles
$Portales[UBound($Portales) - 1][4] = $tiempo_ultimo_hack
EndIf
Next
; _ArrayDisplay($Portales)
; Exit
_ArrayDelete($Portales, 0) ; para quitar las cabeceras
$X = 0
start_adb()
; sing_out()
; Exit
$veces = 1
While 1
$veces = $veces + 1
$distancia_menor = 99999
$Y_menor = 0
$distancia_temp = 0
$Portales[$X][3] = $Portales[$X][3] - 1
$Portales[$X][4] = _NowCalc()
; _ArrayDisplay($Portales)
Do
For $Y = 0 To UBound($Portales) - 1
If _DateDiff('h', $Portales[$Y][4], _NowCalc()) >= 4 Then $Portales[$Y][4] = $Hacks_posibles
If $Portales[$Y][3] >= 1 And _DateDiff('s', $Portales[$Y][4], _NowCalc()) > $segundos_entre_Hacks Then ;si quedan hacks disponibles, y si lleva mas de 5 min
$distancia_temp = Abs($Portales[$X][0] - $Portales[$Y][0]) + Abs($Portales[$X][1] - $Portales[$Y][1])
If $distancia_temp < $distancia_menor Then
$Y_menor = $Y ; el Numero de ITEM
$distancia_menor = $distancia_temp
EndIf
; ConsoleWrite($Y & "," & ($Portales[$Y][3] >= 1) & "," & (_DateDiff('s', $Portales[$Y][4], _NowCalc()) > $segundos_entre_Hacks) & "," & Abs(@MIN - $Portales[$Y][4]) & " " & $Portales[$Y][4] & @CRLF)
EndIf
Next
; ConsoleWrite($X & "-" & $Y_menor & "-------------------------- Sleep : " & Round($distancia_con_portal_anterior * 08000000, 5) & @CRLF)
If $distancia_menor = 99999 Then Sleep(5000)
Until $distancia_menor <> 99999
$X = $Y_menor
$lat = StringReplace(StringFormat("%.6f", $Portales[$X][0]), ".", "")
$long = StringReplace(StringFormat("%.6f", $Portales[$X][1]), ".", "") ; - 300 ,
$DistanciaMS = Round($distancia_con_portal_anterior * 08000000, 5)
$distancia_con_portal_anterior = $distancia_menor ;Para el tiempo del proximo hackeo , no del actual
; $new_distance = Int(getDistance(StringReplace($Portales[$Y_menor], ",8", ""), StringReplace($Portal_anterior, ",8", "")))
; $DistanciaMS =$DistanciaMS $new_distance / 0.002
; ConsoleWrite($Portales[$X][0] & "," & $Portales[$X][1] & " espera = " & $DistanciaMS& @crlf)
cworsend2("am startservice --ez no_history true --ei lat " & $lat & " --ei long " & $long & " -n com.lexa.fakegpsdonate/.FakeGPSService;" & "am force-stop com.lexa.fakegpsdonate;")
Sleep($DistanciaMS)
; Click en el portal
; touch_x_y(10814, 16413)
touch_x_y(12000,16500)
Sleep(1500)
cworsend2('sqlite3 /data/data/com.android.providers.settings/databases/settings.db "' & "update secure set value=0 where name='mock_location' " & '" ;')
cworsend2("am startservice --ez no_history true --ei lat " & $lat & " --ei long " & $long & " -n com.lexa.fakegpsdonate/.FakeGPSService")
For $i_clicks = 1 To 12
cworsend2('sqlite3 /data/data/com.android.providers.settings/databases/settings.db "' & "update secure set value=0 where name='mock_location' " & '" ;')
Sleep(500)
touch_x_y(21560, 30440)
Next
cworsend2("am force-stop com.lexa.fakegpsdonate")
touch_x_y(4360, 26655) ;OK en portal
Sleep(500)
touch_x_y(3000, 15598) ;abajo de hack
Sleep(500)
touch_x_y(3000, 15598) ;abajo de hack
; touch_x_y(31785, 30207);ops
; cworsend2('input keyevent 4')
; $(( $RANDOM % 10 ));
;~ if mod($veces,15) == 0 then start_adb()
WEnd
Func cworsend2($var)
; Send($var)
ConsoleWrite( $var & @CRLF)
StdinWrite($pid, $var & @CRLF)
EndFunc ;==>cworsend2
Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(100)
ToolTip('Script is "Paused"', 0, 0)
_ArrayDisplay($Portales)
ExitLoop
WEnd
ToolTip("")
EndFunc ;==>TogglePause
Func start_adb()
ProcessClose("adb.exe")
If WinExists(@scriptdir & "\adb.exe") Then WinClose(@scriptdir & "\adb.exe")
global $pid = Run(@scriptdir & "\adb shell", "", @SW_SHOW, $STDIN_CHILD + $STDOUT_CHILD)
cworsend2("su")
; cworsend("echo 1 > /sys/devices/i2c-0/0-0036/leds/lm3533-lcd-bl/brightness" & @CRLF)
cworsend2("am start -a com.nianticproject.ingress -n com.nianticproject.ingress/com.nianticproject.ingress.NemesisActivity" & @CRLF)
EndFunc
Func touch_x_y($X_mouse, $Y_mouse, $X_mouse2 = "", $Y_mouse2 = "")
$com_click = "sendevent /dev/input/"&$device_touch&" 3 0 " & $X_mouse & ";"
$com_click = $com_click & "sendevent /dev/input/"&$device_touch&" 3 1 " & $Y_mouse & ";"
$com_click = $com_click & "sendevent /dev/input/"&$device_touch&" 0 0 0" & ";"
$com_click = $com_click & "sendevent /dev/input/"&$device_touch&" 0 0 0" & ";"
$com_click = $com_click & "sendevent /dev/input/"&$device_touch&" 1 272 1" & ";"
$com_click = $com_click & "sendevent /dev/input/"&$device_touch&" 0 0 0" & ";"
If $X_mouse2 <> "" Then
$com_click = $com_click & "sendevent /dev/input/"&$device_touch&" 3 0 " & $X_mouse2 & ";"
$com_click = $com_click & "sendevent /dev/input/"&$device_touch&" 3 1 " & $Y_mouse2 & ";"
$com_click = $com_click & "sendevent /dev/input/"&$device_touch&" 0 0 0" & ";"
EndIf
$com_click = $com_click & "sendevent /dev/input/"&$device_touch&" 1 272 0" & ";"
$com_click = $com_click & "sendevent /dev/input/"&$device_touch&" 0 0 0" & ";"
cworsend2($com_click)
EndFunc ;==>touch_x_y
Func getDistance($start, $stop = "")
If $stop = "" Then Return (20)
$source = _INetGetSource("http://maps.googleapis.com/maps/api/distancematrix/xml?origins=" & _URLEncode($start) & "&destinations=" & _URLEncode($stop) & "&sensor=false&mode=walking")
$source = _StringBetween($source, "<text>", "</text>")
If UBound($source) <> 2 Then
MsgBox(0, "Error", "Ein Fehler ist aufgetreten. Falsche Angaben?")
Else
; _ArrayDisplay($source)
ConsoleWrite(@CRLF & $source[0])
Return ($source[0])
EndIf
EndFunc ;==>getDistance
Func _URLEncode($sData)
; Prog@ndy
Local $aData = StringSplit(BinaryToString(StringToBinary($sData, 4), 1), "")
Local $nChar
$sData = ""
For $i = 1 To $aData[0]
$nChar = Asc($aData[$i])
Switch $nChar
Case 45, 46, 48 - 57, 65 To 90, 95, 97 To 122, 126
$sData &= $aData[$i]
Case 32
$sData &= "+"
Case Else
$sData &= "%" & Hex($nChar, 2)
EndSwitch
Next
Return $sData
EndFunc ;==>_URLEncode
Func sing_out()
touch_x_y(31051, 30481) ;OPS
Sleep(200)
touch_x_y(32100, 27800, 32100, 5600)
Sleep(200)
touch_x_y(32053, 26163)
Sleep(200)
touch_x_y(28000, 24150)
Sleep(200)
touch_x_y(15500, 23625)
EndFunc ;==>sing_out