-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYanilleWatchman.au3
142 lines (124 loc) · 3.4 KB
/
YanilleWatchman.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
#include <Misc.au3>
AutoItSetOption("SendKeyDownDelay", 100)
Func SearchForWatchman()
Local $colors[3] = [0x000543, 0x460001, 0x7B512E]
Local $colorTrues[3] = [0, 0, 0]
$w1 = PixelSearch(565, 50, 1515, 945, $colors[0], 3)
If(IsArray($w1)) Then
$w2 = PixelSearch($w1[0] - 75, $w1[1] - 75, $w1[0] + 75, $w1[1] + 75, $colors[1], 3)
If(IsArray($w2)) Then
$w3 = PixelSearch($w2[0] - 75, $w2[1] - 75, $w2[0] + 75, $w2[1] + 75, $colors[2], 3)
If(IsArray($w3)) Then
uMouseMove(($w1[0] + $w2[0] + $w3[0])/3, ($w1[1] + $w2[1] + $w3[1])/3)
$m = MouseGetPos()
MouseMove($m[0] + Random(0, 3), $m[1] + Random(0, 3))
Return
EndIf
EndIf
EndIf
EndFunc
Func IsWatchman()
$yellow = 0xFFFF00
$w = PixelGetColor(58, 35)
$a = PixelGetColor(69, 35)
$t = PixelGetColor(74, 32)
$c = PixelGetColor(80, 35)
Return ($w == $yellow And $a == $yellow And $t == $yellow And $c == $yellow)
EndFunc
Func Distance($to, $from)
Return Sqrt((($to[0] - $from[0])*($to[0] - $from[0]))+(($to[1] - $from[1])*($to[1] - $from[1])))
EndFunc
Func DirectionTo($to, $from)
Local $ret[2] = [0, 0]
Local $dist = 0
$dist = Distance($to, $from)
If($dist > 0 Or $dist < 0) Then
$ret[0] = ($to[0] - $from[0]) / $dist
$ret[1] = ($to[1] - $from[1]) / $dist
EndIf
Return $ret
EndFunc
Func uMouseMove($x, $y)
Local $to[2] = [$x, $y]
Local $m = MouseGetPos()
While($m[0] <> $x Or $m[1] <> $y And Not _IsPressed(11))
$m = MouseGetPos()
$d = DirectionTo($to, $m)
$dist = Distance($to, $m)
If($dist < 5) Then
MouseMove($x, $y, 0)
Return
Else
If($dist < Random(15, 45)) Then
MouseMove($m[0] + ($d[0] * 2), $m[1] + ($d[1] * 2), 1)
Else
MouseMove($m[0] + $d[0] + Random(-1, 1), $m[1] + $d[1] + Random(-1, 1), 0)
EndIf
EndIf
WEnd
EndFunc
Func HpTooLow()
If(PixelGetColor(761, 987) == 0x23292C) Then
Return True
EndIf
EndFunc
Func GatherAdrenaline()
While(PixelGetColor(955, 988) == 0x23292C And Not _IsPressed(11))
SearchForWatchman()
If(IsWatchman()) Then
MouseClick("left")
Sleep(Random(5421, 7193))
EndIf
WEnd
Sleep(Random(892, 1736))
Send("9")
EndFunc
Func MissingHP()
Return PixelGetColor(810 - Random(0, 10), 987) == 0x23292C
EndFunc
Func EatBread()
Local $l = 1750
Local $r = 1908
Local $t = 667
Local $b = 918
Local $bread = PixelSearch(1750 + Random(0, $r - $l), 667 + Random(0, $b - $t), 1908, 918, 0xB79110, 3)
If(IsArray($bread)) Then
Sleep(Random(0, 354))
uMouseMove($bread[0] + Random(0, 5), $bread[1] + Random(0, 5))
MouseClick("left")
Sleep(Random(1000, 2000))
Return $bread
EndIf
EndFunc
Func Pickpocket()
Local $m = MouseGetPos()
MouseClick("right")
uMouseMove($m[0], $m[1] + Random(40, 50))
Sleep(Random(75, 425))
MouseClick("left")
Sleep(Random(75, 125))
uMouseMove($m[0] + Random(-5, 5), $m[1] + Random(-5, 5))
Sleep(10)
EndFunc
Sleep(5000)
Local $count = 0
Local $maxCount = 5
While(Not _IsPressed(11))
If(HpTooLow()) Then
GatherAdrenaline()
EndIf
If(MissingHP()) Then
EatBread()
ElseIf($count > $maxCount) Then
EatBread()
$count = 0
$maxCount = Random(7, 15)
EndIf
SearchForWatchman()
If(IsWatchman()) Then
Pickpocket()
If(Random(0, 10) > 5) Then
EatBread()
EndIf
EndIf
WEnd