SHOW:
|
|
- or go back to the newest paste.
1 | Global $Paused | |
2 | HotKeySet("=","Leave") ;script started by pressing = | |
3 | HotKeySet("-", "Pause") ;script paused by pressing - | |
4 | HotKeySet("x", "Stop") ;script stopped by pressing x | |
5 | ||
6 | $walktime = 3000 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times | |
7 | $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives | |
8 | $tptime = 6900 ; time in ms the script waits for teleport before exiting the game | |
9 | $yellow = 0xFFF000 ; yellow color code (repair icon) | |
10 | $red = 0xD90000 ; red color code (repair icon) | |
11 | ||
12 | $LootRares = True ; Change this to false if you don't want the bot to pick up rares (good for legendary/set only, recommend setting LootGems to False) | |
13 | $LootGems = False ; Change this to true if you want to pick up gems (messy, can fill up bag with whites/blues) | |
14 | $Amethyst = 0xAC7FFF | |
15 | $Ruby = 0xB01D2D | |
16 | $Emerald = 0x58EE33 | |
17 | $Topaz = 0xFFFF59 | |
18 | ||
19 | $go = True | |
20 | $Leave = False | |
21 | $Dead = False | |
22 | $Logout = False | |
23 | $Window = False | |
24 | $default_resolutionX = 1920 | |
25 | $default_resolutionY = 1080 | |
26 | $x_ratio = @Desktopwidth / $default_resolutionX | |
27 | $y_ratio = @Desktopheight / $default_resolutionY | |
28 | $i = 0 | |
29 | ||
30 | Call("RestartRun") | |
31 | ||
32 | Func RestartRun() | |
33 | While $go | |
34 | if($Leave) Then | |
35 | $i = 0 | |
36 | Sleep(1000) ;had to add this since the icon doesn't show up RIGHT away in game | |
37 | Call("CheckDead") | |
38 | Call("CheckRepair") | |
39 | If $Window Then | |
40 | Call("MainMenu") | |
41 | MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu | |
42 | Sleep($loadtime) | |
43 | $Window = False | |
44 | ExitLoop | |
45 | ElseIf $Dead or $Logout Then | |
46 | ExitLoop | |
47 | EndIf | |
48 | MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run | |
49 | Send("4") | |
50 | Sleep(140) | |
51 | Send("4") | |
52 | Sleep(140) | |
53 | Send("4") | |
54 | Sleep(140) | |
55 | Send("4") | |
56 | Sleep(80) | |
57 | Send("4") | |
58 | Sleep(80) | |
59 | Send("4") | |
60 | Sleep(80) | |
61 | Send("4") | |
62 | Sleep(80) | |
63 | Send("4") | |
64 | Sleep(80) | |
65 | Send("1") | |
66 | Send("3") | |
67 | Sleep(800) | |
68 | MouseMove(Round(290*$x_ratio),Round(270*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted | |
69 | Sleep(700) | |
70 | Call("CheckDead") | |
71 | If $Window Then | |
72 | Call("MainMenu") | |
73 | MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu | |
74 | Sleep($loadtime) | |
75 | $Window = False | |
76 | ExitLoop | |
77 | ElseIf $Dead or $Logout Then | |
78 | ExitLoop | |
79 | EndIf | |
80 | $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be) | |
81 | If Not @error Then | |
82 | MouseClick("left",Round(290*$x_ratio),Round(270*$y_ratio)) ;Entrance to cellar | |
83 | Sleep(400) | |
84 | ||
85 | Sleep($walktime) | |
86 | MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar | |
87 | Sleep(2500) | |
88 | MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth | |
89 | Sleep(10) | |
90 | Send("{SHIFTDOWN}") | |
91 | MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2) | |
92 | MouseDown("right") ;attack middle | |
93 | Sleep(7800) | |
94 | MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair | |
95 | Sleep(10) | |
96 | Send("{SHIFTUP}") | |
97 | Sleep(400) | |
98 | MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death | |
99 | Sleep(2100) | |
100 | ||
101 | Call("CheckLoot") | |
102 | Send("t") | |
103 | Sleep($tptime) | |
104 | Call("CheckDead") | |
105 | If Not $Logout And Not $Dead And Not $Window Then | |
106 | Sleep(300) | |
107 | Send("{ESCAPE}") ;menu | |
108 | Sleep(200) | |
109 | MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game | |
110 | Sleep($loadtime) | |
111 | Call("CheckDead") | |
112 | If Not $Logout Then | |
113 | Call("MainMenu") | |
114 | - | Else |
114 | + | |
115 | Sleep($loadtime) | |
116 | EndIf | |
117 | Else | |
118 | Call("MainMenu") | |
119 | MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu | |
120 | Sleep($loadtime) | |
121 | $Window = False ; reset the flag so it doesn't think a window is always up | |
122 | EndIf | |
123 | Else | |
124 | Send("2") | |
125 | Sleep(700) | |
126 | Send("t") | |
127 | Sleep($tptime) | |
128 | Call("CheckDead") | |
129 | If Not $Logout And Not $Dead And Not $Window Then | |
130 | Sleep(300) | |
131 | Send("{ESCAPE}") ;menu | |
132 | Sleep(200) | |
133 | MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game | |
134 | Sleep($loadtime) | |
135 | Call("CheckDead") | |
136 | - | Else |
136 | + | |
137 | Call("MainMenu") | |
138 | MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu | |
139 | Sleep($loadtime) | |
140 | EndIf | |
141 | Else | |
142 | Call("MainMenu:) | |
143 | MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu | |
144 | Sleep($loadtime) | |
145 | $Window = False ; reset the flag so it doesn't think a window is always up | |
146 | EndIf | |
147 | EndIf | |
148 | EndIf | |
149 | WEnd | |
150 | Call("RestartRun") | |
151 | EndFunc | |
152 | ||
153 | Func CheckDead() | |
154 | Call("CheckWindow") | |
155 | $YouHaveDied = PixelSearch(Round(620*$x_ratio), Round(325*$y_ratio), Round(625*$x_ratio), Round(330*$y_ratio), 0xFFFFFF) ; checks for white text "YOU HAVE DIED" | |
156 | If Not @error Then | |
157 | If Not $Window Then | |
158 | $Dead = True | |
159 | Sleep(100) | |
160 | Send("{Escape}") | |
161 | - | Else |
161 | + | |
162 | MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game | |
163 | Sleep(11000) | |
164 | Sleep($loadtime) | |
165 | Call("MainMenu") | |
166 | MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu | |
167 | Sleep($loadtime) | |
168 | Else | |
169 | Call("MainMenu") | |
170 | MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu | |
171 | Sleep($loadtime) | |
172 | $Dead = False | |
173 | EndIf | |
174 | Else | |
175 | $Dead = False | |
176 | EndIf | |
177 | $LogoutTimerCancel = PixelSearch(Round(900*$x_ratio), Round(240*$y_ratio), Round(1010*$x_ratio), Round(290*$y_ratio), 0x993827) ; checks for cancel button on logout timer | |
178 | If Not @error Then | |
179 | - | Else |
179 | + | |
180 | Sleep($loadtime) | |
181 | If Not $Window Then | |
182 | $Dead = True | |
183 | $Logout = True | |
184 | Sleep($loadtime) | |
185 | Call("MainMenu) | |
186 | MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu | |
187 | Sleep($loadtime) | |
188 | Else | |
189 | Call("MainMenu) | |
190 | MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu | |
191 | Sleep($loadtime) | |
192 | $Logout = False | |
193 | EndIf | |
194 | Else | |
195 | $Logout = False | |
196 | EndIf | |
197 | EndFunc | |
198 | ||
199 | Func CheckWindow() | |
200 | $CloseButton = PixelSearch(Round(1570*$x_ratio), Round(110*$y_ratio), Round(1590*$x_ratio), Round(120*$y_ratio), 0x8C2300) ; checks for the red color of the "X" on an open window | |
201 | If Not @error Then | |
202 | Sleep(200) | |
203 | Send("{SPACE}") ;close any open windows | |
204 | $Window = True | |
205 | Else | |
206 | $Window = False | |
207 | EndIf | |
208 | EndFunc | |
209 | ||
210 | Func CheckRepair() | |
211 | $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow) | |
212 | If Not @error Then | |
213 | Call("DoRepair") | |
214 | EndIf | |
215 | $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red) | |
216 | If Not @error Then | |
217 | Call("DoRepair") | |
218 | EndIf | |
219 | EndFunc | |
220 | ||
221 | Func DoRepair() | |
222 | Sleep(100) | |
223 | Send("t") | |
224 | Sleep($tptime) | |
225 | MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant | |
226 | Sleep(1500) | |
227 | MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen | |
228 | Sleep(1500) | |
229 | MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home | |
230 | Sleep(1200) | |
231 | MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu | |
232 | Sleep(400) | |
233 | MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs | |
234 | Sleep(200) | |
235 | Call("CheckDead") | |
236 | If Not $Dead and Not $Logout Then | |
237 | Send("{ESCAPE}") ;closes repair tab | |
238 | Sleep(100) | |
239 | Send("{ESCAPE}") ;menu | |
240 | Sleep(10) | |
241 | MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game | |
242 | Sleep($loadtime) | |
243 | Call("MainMenu) | |
244 | MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu | |
245 | Sleep($loadtime) | |
246 | EndIf | |
247 | EndFunc | |
248 | ||
249 | Func CheckLoot() | |
250 | Sleep(Random(500,2000)) | |
251 | $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot | |
252 | If Not @error Then | |
253 | MouseClick ('left', $SetLoot[0], $SetLoot[1]) | |
254 | Sleep(Random(800,1200)) | |
255 | $i+= 1 | |
256 | If $i <= 6 Then | |
257 | Call("CheckLoot") | |
258 | EndIf | |
259 | EndIf | |
260 | $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot | |
261 | If Not @error Then | |
262 | MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1]) | |
263 | Sleep(Random(800,1200)) | |
264 | $i+= 1 | |
265 | If $i <= 6 Then | |
266 | Call("CheckLoot") | |
267 | EndIf | |
268 | EndIf | |
269 | If $LootRares Then | |
270 | $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility) | |
271 | If Not @error Then | |
272 | MouseClick ('left', $RareLoot[0], $RareLoot[1]) | |
273 | Sleep(Random(700,900)) | |
274 | $i+= 1 | |
275 | If $i <= 6 Then | |
276 | Call("CheckLoot") | |
277 | EndIf | |
278 | EndIf | |
279 | EndIf | |
280 | If $LootGems Then | |
281 | $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8) | |
282 | If Not @error Then | |
283 | MouseClick("left", $AmethystDrop[0], $AmethystDrop[1]) | |
284 | Sleep(Random(900,1400)) | |
285 | $i+= 1 | |
286 | If $i <= 10 Then | |
287 | Call("CheckLoot") | |
288 | EndIf | |
289 | EndIf | |
290 | $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6) | |
291 | If Not @error Then | |
292 | MouseClick("left", $RubyDrop[0], $RubyDrop[1]) | |
293 | Sleep(Random(900,1400)) | |
294 | $i+= 1 | |
295 | If $i <= 10 Then | |
296 | Call("CheckLoot") | |
297 | EndIf | |
298 | EndIf | |
299 | $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11) | |
300 | If Not @error Then | |
301 | MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1]) | |
302 | Sleep(Random(900,1400)) | |
303 | $i+= 1 | |
304 | If $i <= 10 Then | |
305 | Call("CheckLoot") | |
306 | EndIf | |
307 | EndIf | |
308 | $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2) | |
309 | If Not 1 = 1 Then ; change to 'If Not @error Then' if you want to search for topazes | |
310 | MouseClick("left", $TopazDrop[0], $TopazDrop[1]) | |
311 | Sleep(Random(900,1400)) | |
312 | $i+= 1 | |
313 | If $i <= 10 Then | |
314 | Call("CheckLoot") | |
315 | EndIf | |
316 | EndIf | |
317 | EndIf | |
318 | EndFunc | |
319 | ||
320 | Func MainMenu() ;verifies the screen is at the main menu before attempting to start the next game to avoid getting trapped in menus. | |
321 | Local $Menu = False | |
322 | While $Menu = False | |
323 | $Pixeltestmm = PixelGetColor(Round(251*$x_ratio), Round(284*$y_ratio)) ;tests for main menu | |
324 | If Hex($Pixeltestmm, 6) == "683C02" Then | |
325 | $Menu = True | |
326 | Else | |
327 | $Pixeltestgm = PixelGetColor(Round(937*$x_ratio), Round(246*$y_ratio)) ;checks if game menu is open | |
328 | If Hex($Pixeltestgm, 6) == "621610" Then | |
329 | Send("{Escape}") ;return to main menu | |
330 | $Menu = True | |
331 | Else | |
332 | $Pixeltestgmexit = PixelGetColor(Round(975*$x_ratio), Round(428*$y_ratio)) ;checks if exit game menu is open | |
333 | If Hex($Pixeltestgmexit, 6) == "FFA300" Then | |
334 | Send("{Escape}") | |
335 | Send("{Escape}") | |
336 | $Menu = True | |
337 | Else | |
338 | $Pixeltestbm = PixelGetColor(Round(958*$x_ratio), Round(150*$y_ratio)) ;checks if banner customization window is open | |
339 | If Hex($Pixeltestbm, 6) == "933618" Then | |
340 | Send("{Escape}") | |
341 | $Menu = True | |
342 | Else | |
343 | $Pixeltestpm = PixelGetColor(Round(1506*$x_ratio), Round(138*$y_ratio)) ;checks if player window is open | |
344 | If Hex($Pixeltestpm, 6) == "320c08" Then | |
345 | Send("{Escape}") | |
346 | $Menu = True | |
347 | EndIf | |
348 | EndIf | |
349 | EndIf | |
350 | EndIf | |
351 | EndIf | |
352 | WEnd | |
353 | EndFunc | |
354 | ||
355 | Func Pause() | |
356 | $Leave = False | |
357 | EndFunc | |
358 | ||
359 | Func Stop() ;to allow the script to stop | |
360 | Exit | |
361 | EndFunc | |
362 | ||
363 | Func Leave() | |
364 | $Leave = True | |
365 | EndFunc |