Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 23.15 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #cs
  2.           Witch Doctor Cellar Farming Bot - Version 0.4[1920x1080 AND 800x600]
  3.           Developed by Avatar88343 @ Ownedcore
  4.           Note: I rushed to put this online so the source is still very messy. I have snippets of code that is no longer used
  5.           and if statements that check for nothing. It will all be cleaned up in 0.4
  6.           ;Sentry, Companion, Spike, SS, Hot Pursuit, SS, Steady Aim,L-HA, R-elemental
  7.          
  8.          
  9.           What it does:
  10.                         *This bot will travel to the cellar in Act 1, kill the mobs, collect the gold and items, and repair your gear.
  11.          
  12.          
  13.           Newbiew Info:
  14.           This is a script that runs on AutoIt. You run this bot by Downloading AutoIt from the web (it's free) and installing it.
  15.           You then paste all this code into any text editor (such as notepad) and save it anywhere on your hard drive. Follow the Select
  16.           steps below to configure this bot before you run it.
  17.          
  18.            Special Instructions for 1920 x 1080:
  19.            1.) Set your game resolution to 1920x1080 (required)
  20.            2.) Set the display mode to Fullscreen Windowed (Don't forget!)
  21.            3.) Follow the Instructions (for all resolutions) section below
  22.            
  23.            Special Instructions for 800 x 600:
  24.  
  25.            1.)Exit Diablo 3
  26.            2.)Go to your document folder and locate the Diablo III folder
  27.            3.)Open the D3Prefs file in any editor (such as notepad)
  28.            4.)Change the following settings to the ones listed below
  29.            "DisplayModeFlags "0"
  30.            DisplayModeWindowMode "1"
  31.            DisplayModeWinLeft "428"
  32.            DisplayModeWinTop "162"
  33.            DisplayModeWinWidth "800"
  34.            DisplayModeWinHeight "600"
  35.            DisplayModeUIOptWidth "800"
  36.            DisplayModeUIOptHeight "600"
  37.            DisplayModeWidth "800"
  38.            DisplayModeHeight "600"
  39.            DisplayModeRefreshRate "75"
  40.            DisplayModeBitDepth "32""
  41.            5.) Follow the Instructions (for all resolutions) section below
  42.            
  43.          
  44.           Instructions (for all resolutions)
  45.                         1.) Bind your middle mouse button to Move (found in Key Bindings Option)
  46.                         2.) Set your build to this http://us.battle.net/d3/en/calculator/witch-doctor#jaQPiU!VZW!babbZa
  47.                         3.) Start Act 1, Quest 6 - Talk to Alaric
  48.                         4.) Hire the Scoundrel
  49.                         5.) Teleport to The Old Ruins using the waypoint and run left until you reach a checkpoint
  50.                         6.) Log out of the game
  51.                         7.) Press Space to start the bot! Space is used to pause and resume the bot
  52.                         8.) Press Z to turn off the bot
  53.          
  54.           NOTE:
  55.                         *Please make sure you are running the correct resolution settings!
  56.                         *You must be running the game in Fullscreen Windoed mode if you're using 1080P
  57.                         *You WILL need to edit the values below the comments for better results
  58.          
  59.           FEATURES:
  60.                         *Supports 1080P Fullscreen Windowed and 800x600 Windowed
  61.                         *Automatic looting of Rare, Legendary, and Set items
  62.                         *Repairs Items when damaged
  63.                         *Detects death and responds accordingly
  64.                         *Able to detect
  65.                         *Randomization for increased safety
  66.                         *Added ability to find Cellar during bad runs
  67.                         *Loots Gems (partly)
  68.          
  69.           IN DEVELOPMENT:
  70.                         *Multi-resolution support (very soon)
  71.                         *Inventory check and stash use
  72.                         *Improved combat
  73.                         *Speed improvements
  74.                         *Multiple routes to improve safety
  75.                         *45 min timeout bug
  76.                         *edit d3config
  77.          
  78.          
  79.           **Based on the code by notAres and mackus101. Special thanks to them!
  80. #ce
  81. #include <GUIConstantsEx.au3>
  82. #include <WindowsConstants.au3>
  83. ;======THESE VALUES ARE NOT EDITED WITH THE GUI ===================================
  84. $R                              =  1                    ;Leave this as 0 if you are using 1080P. Change it to 1 if you're using 800 x 600
  85. $ComputerLag    = 1000                  ;Increase this by 100-5000 if you have a slow PC.
  86. $RunSpeed               = 10                    ;Enter your character's run speed here
  87. $LootRares              = True                  ;Whether or not to loot rare and legendary items
  88. $LootBlues              = True                  ;Whether or not to loot blue items
  89. $Repair                 = True                  ;Orders the bot to repair when items are damaged
  90. $LootGems               = True                  ;A bit buggy but works sometimes
  91. $UseStash               = False                 ;Not currently supported
  92. ;======================================================================
  93.  
  94. Global $Resume[2][2]                    ;Location of the Resume Button                 
  95. Global $Leave[2][2]                             ;Location of the in-game leave button
  96. Global $GameLobbyCode[2][3]             ;Contains X, Y, and Hex color of Resume button so we can see if we're there
  97. Global $GameScreenCode[2][3]    ;Contains X, Y, and Hex color used to check if we are in an unpaused game
  98. Global $Loc1[2][2]                              ;First movement
  99. Global $Loc2[2][2]                              ;Second movement
  100. Global $Loc3[2][2]                              ;Third movement ttt
  101.  
  102. Global $CellarLocation[2][2]    ;Cellar door location
  103. Global $CellarLocation2[2]              ;Location of cellar during bad runs (ugly workaround for now)
  104. Global $AltCellar = False
  105.  
  106. Global $Loc5[2][2]                              ;Cellar hallway
  107. Global $Loc6[2][2]                              ;Cellar doorway
  108. Global $MonsterLoc[2][2]                ;Initial boss location
  109. Global $MonsterSearch[2][4]             ;Bounds of where we will find our monsters
  110. Global $GoldLoot1[2][2]                 ;First place to run when looting
  111. Global $GoldLoot2[2][2]                 ;Second place to run when looting
  112. Global $GoldLoot3[2][2]                 ;Third place to run when looting
  113. Global $LootingArea[2][4]               ; looting bounds (TL X, TL Y, BR X, BR Y)
  114. Global $CharHitBox[2][4]                ; Hitbox around user's character
  115. Global $DeathBounds[2][2]               ; Used to detect the "You Have Died" text
  116. Global $RepairCords[2][4][2]    ; Four clicks needed to repair
  117. Global $RepairCheck[2][2]               ; Used to check for repair icon
  118. Global $CellarOffset[2]                 ; Used to improve cellar clicking with 1080P/800x600           
  119. Global $CellarIcon                              ;Used to find the yellow cellar icon on the minimap (future use)
  120. Global $CellarPixel                            
  121. GLobal $GemLootOffset[2]                        ;Distance between gem and its text
  122. ActivateGUI()
  123.  
  124. ;Check for people that can't read instructions
  125. if int($R) < 0 OR int($R) > 1 Then
  126.    MsgBox(4096, "A wild illiterate appears appears!" , "Aha! I caught you! You did not read the instructions. You need to configure the bot!")
  127.    terminate()
  128. EndIf
  129.    
  130.  
  131. ;Clculate run speed
  132. Global $RunTime = 30 * (100 - $RunSpeed) + 2000 ;Length of time to run in 800x600
  133.  
  134. ;All locations are N dimensional arrays. [0][x] is for 1080P and [1][x] is for 800x600
  135. ;1080P
  136.  
  137. ;1920x1080
  138. $Resume[0][0] = 319
  139. $Resume[0][1] = 416
  140. $GameLobbyCode[0][0] = 319
  141. $GameLobbyCode[0][1] = 416
  142. $GameLobbyCode[0][2] = 4065536
  143. $GameScreenCode[0][0] = 1119
  144. $GameScreenCode[0][1] = 1044
  145. $GameScreenCode[0][2] = 0xDEFDFE
  146.  
  147. ;800x600
  148. $Resume[1][0] = 174
  149. $Resume[1][1] = 232
  150. $GameLobbyCode[1][0] = 174     
  151. $GameLobbyCode[1][1] = 232
  152. $GameLobbyCode[1][2] = 4262400
  153. $GameScreenCode[1][0] = 486
  154. $GameScreenCode[1][1] = 578
  155. $GameScreenCode[1][2] = 0x6C9BFF
  156.  
  157. ;1920x1080
  158. $Leave[0][0] = 969
  159. $Leave[0][1] = 582
  160.  
  161. ;800x600
  162. $Leave[1][0] = 397
  163. $Leave[1][1] = 322
  164.  
  165. ;1920x1080
  166. $Loc1[0][0]             = 500           ;First movement
  167. $loc1[0][1]             = 250
  168. $loc2[0][0]             = 1                     ;Second movement
  169. $loc2[0][1]             = 370
  170. $loc3[0][0]             = 400           ;Third Movement
  171. $loc3[0][1]             = 600          
  172.  
  173. ;800x600
  174. $Loc1[1][0]             = 8                     ;First movement
  175. $loc1[1][1]             = 146
  176. $loc2[1][0]             = 7                     ;Second movement
  177. $loc2[1][1]             = 300
  178. $loc3[1][0]             = 8                     ;Third Movement
  179. $loc3[1][1]             = 300  
  180.  
  181. ;1080P
  182. $CellarLocation[0][0] = 307             ;Cellar door location
  183. $CellarLocation[0][1] = 74
  184. ;800x600
  185. $CellarLocation[1][0] = 499             ;Cellar door location
  186. $CellarLocation[1][1] = 148
  187. $CellarLocation2[0] = 439
  188. $CellarLocation2[1] = 145
  189. $AltCellarLocation = False
  190.  
  191. ;Cellar offset
  192. $CellarOffset[0] = 33;
  193. $CellarOffset[1] = 10;
  194.  
  195. ;1080P
  196. $loc5[0][0]             = 116           ;Walk down hallway     
  197. $loc5[0][1]             = 986                  
  198. $loc6[0][0]             = 776           ;enter hallway
  199. $loc6[0][1]             = 328
  200. ;800x600
  201. $loc5[1][0]             = 3                     ;Walk down hallway     
  202. $loc5[1][1]             = 504                  
  203. $loc6[1][0]             = 255           ;enter hallway
  204. $loc6[1][1]             = 190
  205.  
  206. ;1080P
  207. $MonsterLoc[0][0] =     577
  208. $MonsterLoc[0][1] = 183
  209. ;800x600
  210. $MonsterLoc[1][0] =     188
  211. $MonsterLoc[1][1] = 111
  212.  
  213. ;1920x1080
  214. $MonsterSearch[0][0] = 162
  215. $MonsterSearch[0][1] = 29
  216. $MonsterSearch[0][2] = 1248
  217. $MonsterSearch[0][3] = 446
  218. ;800x600
  219. $MonsterSearch[1][0] = 40
  220. $MonsterSearch[1][1] = 53
  221. $MonsterSearch[1][2] = 424
  222. $MonsterSearch[1][3] = 191
  223.  
  224. ;1920x1080
  225. $GoldLoot1[0][0] = 402
  226. $GoldLoot1[0][1] = 306
  227. $GoldLoot2[0][0] = 1260
  228. $GoldLoot2[0][1] = 351
  229. $GoldLoot3[0][0] = 911
  230. $GoldLoot3[0][1] = 694
  231. ;800x600
  232. $GoldLoot1[1][0] = 96
  233. $GoldLoot1[1][1] = 181
  234. $GoldLoot2[1][0] = 560
  235. $GoldLoot2[1][1] = 191
  236. $GoldLoot3[1][0] = 349
  237. $GoldLoot3[1][1] = 418
  238.  
  239. ;1080P
  240. $LootingArea[0][0] = 318;550
  241. $LootingArea[0][1] = 150;300
  242. $LootingArea[0][2] = 1507;1100
  243. $LootingArea[0][3] = 736;600
  244. ;800x600
  245. $LootingArea[1][0] = 75
  246. $LootingArea[1][1] = 90
  247. $LootingArea[1][2] = 630
  248. $LootingArea[1][3] = 400
  249.  
  250. ;1080P
  251. $CharHitBox[0][0] = 790
  252. $CharHitBox[0][1] = 315
  253. $CharHitBox[0][2] = 1200
  254. $CharHitBox[0][3] = 730
  255. ;800x600
  256. $CharHitBox[1][0] = 304
  257. $CharHitBox[1][1] = 190
  258. $CharHitBox[1][2] = 468
  259. $CharHitBox[1][3] = 323
  260.  
  261. ;1080P
  262. $DeathBounds[0][0] = 538
  263. $DeathBounds[0][1] = 335
  264. ;800x600
  265. $DeathBounds[1][0] = 210
  266. $DeathBounds[1][1] = 180
  267.  
  268. ;1080P
  269. $RepairCords[0][0][0] = 1690
  270. $RepairCords[0][0][1] = 102
  271. $RepairCords[0][1][0] = 930
  272. $RepairCords[0][1][1] = 136
  273. $RepairCords[0][2][0] = 517
  274. $RepairCords[0][2][1] = 483
  275. $RepairCords[0][3][0] = 223
  276. $RepairCords[0][3][1] = 592
  277. ;800x600
  278. $RepairCords[1][0][0] = 691
  279. $RepairCords[1][0][1] = 88
  280. $RepairCords[1][1][0] = 505
  281. $RepairCords[1][1][1] = 52
  282. $RepairCords[1][2][0] = 282
  283. $RepairCords[1][2][1] = 261
  284. $RepairCords[1][3][0] = 157
  285. $RepairCords[1][3][1] = 329
  286.  
  287. ;1080P
  288. $RepairCheck[0][0] = 1507
  289. $RepairCheck[0][1] = 36
  290. ;800x600
  291. $RepairCheck[1][0] = 573
  292. $RepairCheck[1][1] = 21
  293.  
  294. ;Gem stuff
  295. $Amethyst = 0xAC7FFF
  296. $Ruby = 0xB01D2D
  297. $Emerald = 0x58EE33
  298. $Topaz = 0xFFFF59
  299.  
  300. $GemLootOffset[0] = 100
  301. $GemLootOffset[1] = 40
  302.  
  303.  
  304. HotKeySet("z", "Terminate")
  305.  
  306.  
  307. Func Terminate()
  308.     Exit 0
  309.  EndFunc
  310.  
  311. Opt('MouseCoordMode', 2)
  312. Opt('PixelCoordMode', 2)
  313. HotKeySet('{END}', 'Quit')
  314. HotKeySet('{SPACE}', 'Pause')
  315. Global $Paused
  316.  
  317. ;bot starts paused. press space to start.
  318. Pause()
  319.  
  320. ;Finding loot takes time. We don't want to overdo it
  321. $LootAttempts = 0
  322. $GemLootAttempts = 0
  323.  
  324. WinActivate('Diablo III')
  325. While 1
  326.    If WinActive('Diablo III') Then
  327.          
  328.           $AltCellarLocation = False
  329.           $LootAttempts = 0
  330.           $GemLootAttempts = 0
  331.          
  332.           ;Make sure that we are in the character selection screen ( we are looking at a spot in the Resume game button)
  333.           for $i = 15 To 0 step -1
  334.                  if InGameLobby() Then
  335.                         ExitLoop
  336.                  EndIf
  337.                  
  338.                  sleep(600)
  339.                  if $i == 1 Then
  340.                         MsgBox(4096, "Error Resuming Game", "You don't seem to be in the lobby. Did you properly configure the bot? Bot will now exit", 50)
  341.                         Terminate()
  342.                  EndIf
  343.           Next
  344.          
  345.            ;Resume the game
  346.       Click($Resume[$R][0], $Resume[$R][1])
  347.      
  348.            ;Make sure that we are in the game
  349.           for $i = 12 To 0 step -1
  350.                  if InGameplayScreen() Then
  351.                         ExitLoop
  352.                  EndIf
  353.                  
  354.                  sleep(1000)
  355.                  if $i == 1 Then
  356.                         MsgBox(4096, "Error Starting the Game", "The game did not properly load...Are you using English language? Do not use custom themes!", 50)
  357.                         Terminate()
  358.                  EndIf
  359.           Next
  360.          
  361.            
  362.           Rest(200)
  363.           Send("{2}")                          
  364.           Rest(400)
  365.          
  366.           ;Custom running for the 800x600. Sometimes I wonder if it's faster to just buy everyone a 1080P monitor...
  367.           if Int($R) == 1 Then
  368.                  MouseMove(11, 220)
  369.                  Sleep(400)
  370.                  Send("{4}")
  371.                  MouseDown("middle")
  372.                  Sleep($RunTime)
  373.                  
  374.                  MouseUp("middle")
  375.                  Sleep(2000)
  376.                  
  377.                  #cs $CellarIcon = PixelSearch(630, 70, 741, 149, 0x71341A, 5)
  378.                  if not @error then
  379.                         ConsoleWrite("Foundtheseller" & @LF)
  380.                        
  381.                  EndIf
  382.                  #ce
  383.                  
  384.          Else
  385.                  Move($Loc1[$R][0], $Loc1[$R][1])
  386.                  Sleep(200)
  387.                  Send("{4}")
  388.                  Sleep(700)
  389.                  Move($Loc2[$R][0], $Loc2[$R][1])
  390.                  Sleep(1100)
  391.                  Move($Loc3[$R][0], $Loc3[$R][1])
  392.           EndIf
  393.          
  394.          
  395.           ;Check to see if the cellar is there ```````
  396.           MouseMove($CellarLocation[$R][0], $CellarLocation[$R][1])
  397.           Sleep(400)
  398.           if Int($R) = 1 then
  399.                   $CellarPixel = PixelSearch($CellarLocation[$R][0]-30, $CellarLocation[$R][1]-30,$CellarLocation[$R][0]+20,$CellarLocation[$R][1]+20, 0x93D7F9,8)
  400.                  
  401.                   if @error Then
  402.                          MouseMove($CellarLocation2[0], $CellarLocation2[1])
  403.                          Sleep(300)
  404.                          $CellarPixel = PixelSearch($CellarLocation2[0]-30, $CellarLocation2[1]-30,$CellarLocation2[0]+20,$CellarLocation2[1]+20, 0x93D7F9,8)
  405.                          if not @error Then
  406.                                 $AltCellarLocation = True
  407.                          EndIf
  408.                  EndIf
  409.           Else
  410.                   $CellarPixel = PixelSearch($CellarLocation[$R][0]-$CellarOffset[$R], $CellarLocation[$R][1]-$CellarOffset[$R],$CellarLocation[$R][0]+4,$CellarLocation[$R][1]+4, 0x334FB7,6)
  411.           EndIf
  412.    
  413.           ;Leave the game if the Cellar is not there
  414.           if @error Then
  415.                  ConsoleWrite("Did not find the cellar " & @LF)
  416.                  Send("{SHIFTDOWN}")
  417.                  sleep(10)
  418.                  click(300,300)
  419.                  sleep(100)
  420.                  Send("{SHIFTUP}")
  421.                  leaveGame()
  422.                  Sleep(12000)
  423.                  ContinueLoop
  424.           EndIf
  425.          
  426.           ;Enter the cellar
  427.           ConsoleWrite("Entering the Cellar..." & @LF)
  428.           if $R > 0 AND $AltCellar Then
  429.                  Click($CellarLocation2[$R][0] - 4, $CellarLocation2[$R][1] - 4)
  430.           Else
  431.                  if not $AltCellarLocation Then
  432.                         Click($CellarLocation[$R][0], $CellarLocation[$R][1])
  433.                  Else
  434.                         Click($CellarLocation2[0], $CellarLocation2[1])
  435.                  EndIf
  436.           endif
  437.          
  438.           if Int($R) == 1 Then
  439.                  sleep(500+$ComputerLag)
  440.           Else
  441.                  Sleep(2500 + $ComputerLag)
  442.           EndIf
  443.          
  444.            ;Check to see if we died
  445.           if CheckForDeath() Then
  446.                  ContinueLoop
  447.           EndIf
  448.            
  449.           ;Inside the celler now - Move to the doorway
  450.           Move($Loc5[$R][0], $Loc5[$R][1])
  451.           Sleep(1500)
  452.           Move($Loc6[$R][0], $Loc6[$R][1])
  453.           sleep(10)
  454.           MouseMove($MonsterLoc[$R][0],$MonsterLoc[$R][1])
  455.           Sleep(300)
  456.  
  457.           ;Cast spell some spells on them
  458.           Send("{3}")
  459.           Sleep(350)
  460.           send("{1}")
  461.           sleep(350)
  462.          
  463.  
  464.           ;Kill all the enemies inside
  465.           while 1
  466.                  
  467.                  $MonsterBar =  PixelSearch($MonsterSearch[$R][0], $MonsterSearch[$R][1], $MonsterSearch[$R][2], $MonsterSearch[$R][3], 0xEE0000, 10)
  468.                  if @error Then
  469.                         ConsoleWrite("Didn't find any, attacking to discover potential enemies" & @LF)
  470.                         Attack($MonsterLoc[$R][0],$MonsterLoc[$R][1])
  471.                         sleep(500)
  472.                         $MonsterBar =  PixelSearch($MonsterSearch[$R][0], $MonsterSearch[$R][1], $MonsterSearch[$R][2], $MonsterSearch[$R][3], 0xEE0000, 10)
  473.                         if @error Then
  474.                            ConsoleWrite("No monsters found - Moving on")
  475.                            ExitLoop
  476.                         EndIf
  477.                  EndIf
  478.                  
  479.                  ;if CheckForNearbyMonsters() Then
  480.                         ;send("{4}")
  481.                  ;EndIf
  482.                  
  483.                  for $i = 7 To 0 step -1
  484.                         Attack($MonsterBar[0], $MonsterBar[1])
  485.                         Sleep(100)
  486.                   Next
  487.           WEnd
  488.          
  489.          
  490.           ;Loot the gold and attack anything we missed
  491.           Move($GoldLoot1[$R][0], $GoldLoot1[$R][1])
  492.           Sleep(Random(800, 900))
  493.           AttackNearbyMonsters()
  494.           Move($GoldLoot2[$R][0], $GoldLoot2[$R][1])
  495.           Sleep(Random(400,500))
  496.           AttackNearbyMonsters()
  497.           Move($GoldLoot3[$R][0], $GoldLoot3[$R][1])
  498.           sleep(Random(400,500))
  499.           AttackNearbyMonsters()
  500.          
  501.           ;Loot items
  502.           if $LootRares then
  503.                  LootRares()
  504.                  $LootAttemps = 0
  505.                  LootLegendaries()
  506.                  $LootAttempts = 0
  507.           EndIf
  508.          
  509.           if $LootBlues Then
  510.                  $LootAttempts = 0
  511.                  LootMagic()
  512.           EndIf
  513.          
  514.           if $LootGems Then
  515.                  LootGems()
  516.           EndIf
  517.                  
  518.          
  519.           ;Check to see if we died
  520.           if CheckForDeath() Then
  521.                  ContinueLoop
  522.           EndIf
  523.  
  524.  
  525.           ;Teleport to town
  526.           send("{t}")
  527.           sleep(8000)
  528.          
  529.           ;Repair if needed
  530.           if $Repair then
  531.                  RepairItems()
  532.           EndIf
  533.          
  534.           ;Leave the game
  535.           LeaveGame()
  536.           Sleep(1000)
  537.  
  538.    EndIf
  539. WEnd
  540.  
  541. Func CheckForRepair()
  542.    $RepairNeeded = PixelSearch($RepairCheck[$R][0],$RepairCheck[$R][1], $RepairCheck[$R][0]+5, $RepairCheck[$R][1]+5, 0xFFE801,10)
  543.    
  544.    if Not @error Then
  545.           return True
  546.    Else
  547.           return False
  548.    EndIf
  549. EndFunc
  550.    
  551.    
  552. Func RepairItems()
  553.    if not CheckForRepair() Then
  554.           Return
  555.    EndIf
  556.    
  557.    Move($RepairCords[$R][0][0] , $RepairCords[$R][0][1])
  558.    Sleep(2700+$ComputerLag)
  559.    MouseMove($RepairCords[$R][1][0] , $RepairCords[$R][1][1])
  560.    Sleep(400)
  561.    Click($RepairCords[$R][1][0] , $RepairCords[$R][1][1])
  562.    sleep(2200+$ComputerLag)
  563.    click($RepairCords[$R][2][0] , $RepairCords[$R][2][1])
  564.    Sleep(Random(700-900))
  565.    Click($RepairCords[$R][3][0] , $RepairCords[$R][3][1])
  566.    Sleep(500)
  567.    send("{esc}")
  568.    
  569. EndFunc
  570.  
  571.  
  572. Func LeaveGame()
  573.    send("{esc}")
  574.    Sleep(400)
  575.    Click($Leave[$R][0], $Leave[$R][1])
  576. EndFunc
  577.  
  578. Func Pause()
  579.    $Paused = Not $Paused
  580.    While $Paused
  581.       Sleep(100)
  582.       ToolTip('Paused... (Press Space to run it)', 0, 0)
  583.    WEnd
  584.    ToolTip("")
  585. EndFunc   ;
  586.  
  587. Func Click($x, $y)
  588.    MouseClick('left', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  589.    Sleep(Random(1000, 1500))
  590. EndFunc
  591.  
  592. Func Move($x, $y)
  593.    MouseClick('middle', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  594.    Sleep(Random(1000, 1500))
  595. EndFunc  
  596.  
  597. Func Attack($x, $y)
  598.    MouseClick('right', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  599. EndFunc        
  600.  
  601. Func Rest($z)
  602.    Sleep(Random($z, $z+25))
  603. EndFunc
  604.  
  605. Func CheckForDeath()
  606.    ConsoleWrite("Checking to see if we died")
  607.    $Death = PixelSearch($DeathBounds[$R][0], $DeathBounds[$R][0], $DeathBounds[$R][0]+4, $DeathBounds[$R][0]+4, 0xFFFFFF)
  608.    if not @error Then
  609.           ConsoleWrite("Died" & @LF)
  610.           LeaveGame()
  611.           Sleep(12000)
  612.           return True
  613.    Else
  614.           return False
  615.    EndIf
  616. EndFunc
  617.  
  618.  
  619. Func LootMagic()
  620.    $Magic = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], $LootingArea[$R][3], 0x6969FF, 4) ;
  621.    If not @error Then
  622.           Click($Magic[0]+5, $Magic[1]+2)
  623.           Sleep(Random(800,1000))
  624.    EndIf
  625.    
  626.    $LootAttempts+=1
  627.    if($LootAttempts > 5) then
  628.           Return
  629.    Else
  630.           LootMagic()
  631.    EndIf
  632. EndFunc
  633.    
  634.  
  635. Func LootRares()
  636.    $Rare = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], $LootingArea[$R][3], 0xBBBB00, 4) ;
  637.    If not @error Then
  638.           Click($Rare[0]+5, $Rare[1]+2)
  639.           Sleep(Random(800,1000))
  640.    EndIf
  641.    
  642.    $LootAttempts+=1
  643.    if($LootAttempts > 5) then
  644.           Return
  645.    Else
  646.           LootRares()
  647.    EndIf
  648. EndFunc
  649.    
  650.  
  651.  
  652. Func LootLegendaries()
  653.    $Legendary = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], $LootingArea[$R][3],0xBF642F, 2) ;
  654.    If not @error Then
  655.           Click($Legendary[0]+5, $Legendary[1]+2)
  656.           Sleep(Random(800,1000))
  657.    EndIf
  658.    
  659.     $set = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], $LootingArea[$R][2], 0x02CE01, 2) ;
  660.         If not @error Then
  661.           Click($set[0]+5, $set[1]+2)
  662.           Sleep(Random(800,1000))
  663.    EndIf
  664.          
  665.    $LootAttempts+=1
  666.    if($LootAttempts > 3) then
  667.           Return
  668.    Else
  669.           LootRares()
  670.    EndIf
  671. EndFunc
  672.  
  673. #CS
  674. $Amethyst = 0xAC7FFF
  675. $Ruby = 0xB01D2D
  676. $Emerald = 0x58EE33
  677. $Topaz = 0xFFFF59
  678. #ce
  679. Func LootGems()
  680.    $Gem = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], $LootingArea[$R][3],$Ruby,6) ;
  681.    If not @error Then
  682.           ConsoleWrite("Found a Ruby!" & @LF)
  683.           $Gem = PixelSearch($Gem[0] - 20, $Gem[1], $Gem[0] + 20, $Gem[1] - $GemLootOffset[$R], 0xFFFFFF)
  684.           If not @error Then
  685.                  Click($Gem[0], $Gem[1])
  686.                  Sleep(Random(400,600))
  687.           EndIf
  688.    EndIf
  689.    
  690.    $Gem = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], $LootingArea[$R][3],$Amethyst,8) ;
  691.    If not @error Then
  692.           ConsoleWrite("Found an $Amethyst!" & @LF)
  693.          $Gem = PixelSearch($Gem[0] - 20, $Gem[1], $Gem[0] + 20, $Gem[1] - $GemLootOffset[$R], 0xFFFFFF)
  694.           If not @error Then
  695.                  Click($Gem[0], $Gem[1])
  696.                  Sleep(Random(400,600))
  697.           EndIf
  698.          
  699.    EndIf
  700.    
  701.    $Gem = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], $LootingArea[$R][3],$Emerald,11) ;
  702.    If not @error Then
  703.           ConsoleWrite("Found am Emerald!" & @LF)
  704.          $Gem = PixelSearch($Gem[0] - 20, $Gem[1], $Gem[0] + 20, $Gem[1] - $GemLootOffset[$R], 0xFFFFFF)
  705.           If not @error Then
  706.                  Click($Gem[0], $Gem[1])
  707.                  Sleep(Random(400,600))
  708.           EndIf
  709.    EndIf
  710.    
  711.    $Gem = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], $LootingArea[$R][3],$Topaz,2) ;
  712.    If not @error Then
  713.           ConsoleWrite("Found a Topaz!" & @LF)
  714.          $Gem = PixelSearch($Gem[0] - 20, $Gem[1], $Gem[0] + 20, $Gem[1] - $GemLootOffset[$R], 0xFFFFFF)
  715.           If not @error Then
  716.                  Click($Gem[0], $Gem[1])
  717.                  Sleep(Random(400,600))
  718.           EndIf
  719.    EndIf
  720.  
  721.          
  722.    $GemLootAttempts+=1
  723.    if($GemLootAttempts > 3) then
  724.           Return
  725.    Else
  726.           LootGems()
  727.    EndIf
  728. EndFunc
  729.  
  730.  
  731.  
  732. Func AttackNearbyMonsters()
  733.    while 1
  734.           $MonsterData =  PixelSearch($CharHitBox[$R][0],$CharHitBox[$R][1],$CharHitBox[$R][2],$CharHitBox[$R][3], 0xEE0000, 10)
  735.                  if @error Then
  736.                         ExitLoop
  737.                  EndIf
  738.          
  739.           send("{4}")
  740.           sleep(300)
  741.           for $i = 10 To 0 step -1
  742.                  Attack($MonsterData[0], $MonsterData[1])
  743.                  Sleep(100)
  744.           Next
  745.    WEnd
  746. EndFunc
  747.  
  748. Func CheckForNearbyMonsters()
  749.    $MonsterData =  PixelSearch($CharHitBox[$R][0],$CharHitBox[$R][1],$CharHitBox[$R][2],$CharHitBox[$R][3], 0xEE0000, 10)
  750.    if @error Then
  751.           return False
  752.    Else
  753.            return True
  754.         EndIf
  755.  EndFunc
  756.  
  757.  
  758. Func SnareNearbyEnemies()
  759.    $MonsterData =  PixelSearch($CharHitBox[$R][0],$CharHitBox[$R][1],$CharHitBox[$R][2],$CharHitBox[$R][3], 0xEE0000, 10)
  760.    if not @error Then
  761.            MouseMove($MonsterData[0], $MonsterData[1])
  762.            Sleep(350)
  763.            Send("{3}")
  764.            sleep(250)
  765.         EndIf
  766.  EndFunc
  767.  
  768.  
  769.  Func InGameLobby()
  770.         MouseMove($GameLobbyCode[$R][0],$GameLobbyCode[$R][1])
  771.         Sleep(300)
  772.         PixelSearch($GameLobbyCode[$R][0],$GameLobbyCode[$R][1],$GameLobbyCode[$R][0]+10,$GameLobbyCode[$R][1]+10, $GameLobbyCode[$R][2], 10)
  773.     if not @error Then
  774.            return True
  775.         Else
  776.            return False
  777.    EndIf
  778. EndFunc
  779.  
  780.  Func InGameplayScreen()
  781.         PixelSearch($GameScreenCode[$R][0],$GameScreenCode[$R][1],$GameScreenCode[$R][0]+4,$GameScreenCode[$R][1]+3, $GameScreenCode[$R][2], 10)
  782.         if not @error Then
  783.            return True
  784.         Else
  785.            return False
  786.    EndIf
  787. EndFunc
  788.  
  789.  
  790. Func ActivateGUI()
  791.  
  792.    ;setup the UI
  793.    $Waiting = True
  794.  
  795.    $Form1 = GUICreate("D3 Witch Doctor bot by Avatar88343", 400, 200, -1, -1)
  796.    
  797.    $ResLabel = GUICtrlCreateLabel("Game Resolution", 100, 30, 100, -1)
  798.    $ResCombo = GUICtrlCreateCombo("", 100, 45, 200, -1)
  799.    GUICtrlSetData($ResCombo, "1920 x 1080|800 x 600", "Select your Res")
  800.    
  801.    $Runabel = GUICtrlCreateLabel("Character run speed (for 800x600)", 100, 75, 200, -1)
  802.    $RunInput = GUICtrlCreateInput("0" , 100, 90, 200, -1)
  803.    
  804.    $LootRareCheck = GUICtrlCreateCheckbox("Loot Rares",25,130,100,20)
  805.    GUICtrlSetState($LootRareCheck, $GUI_CHECKED)
  806.    
  807.    $LootBluesCheck = GUICtrlCreateCheckbox("Loot Blues",125,130,100,20)
  808.    GUICtrlSetState($LootRareCheck, $GUI_CHECKED)
  809.    
  810.    $LootGemsCheck = GUICtrlCreateCheckbox("Loot Gems (beta)",225,130,100,20)
  811.    
  812.    $RepairCheckbox = GUICtrlCreateCheckbox("Repair",325,130,100,20)
  813.    GUICtrlSetState($RepairCheckbox, $GUI_CHECKED)
  814.    
  815.    $StartButton = GUICtrlCreateButton("Start", 125, 160, 150, 33)
  816.        
  817.    GUISetState(@SW_SHOW)
  818.    
  819.    ;Wait for them to press start
  820.    while $Waiting
  821.           $Action = GUIGetMsg()
  822.          
  823.           if $Action = $GUI_EVENT_CLOSE then Terminate()
  824.           if $Action = $StartButton then ExitLoop
  825.          
  826.           sleep(50)
  827.    WEnd
  828.    
  829.    ;Get the values
  830.    $SelectedRes = GUICtrlRead($ResCombo)
  831.    if $SelectedRes = "1920 x 1080" Then
  832.           $R = 0
  833.    ElseIf $SelectedRes = "800 x 600" Then
  834.           $R = 1
  835.    Else
  836.           msgbox(0,"Error","You did not select a resolution! Try again")
  837.           Terminate()
  838.    EndIf
  839.    
  840.    $Runspeed = int(GUICtrlRead($RunInput))
  841.    $LootRares = GuiCtrlRead($LootRareCheck) = $GUI_CHECKED
  842.    $LootBlues = GuiCtrlRead($LootBluesCheck) = $GUI_CHECKED
  843.    $Repair = GuiCtrlRead($RepairCheckbox) = $GUI_CHECKED
  844.    $LootGems = GuiCtrlRead($LootGemsCheck) = $GUI_CHECKED
  845.    
  846.     GUISetState(@SW_HIDE)
  847. EndFunc