Advertisement
Guest User

With doctor autoit 0.2 cib v2 error/disconnect handle

a guest
Jun 15th, 2012
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 34.21 KB | None | 0 0
  1. #cs
  2.  
  3.     ADD detection of character screen and loading screen done
  4.  
  5.               Witch Doctor Cellar Farming Bot - Version 0.2 Revision by cib v2, ImageSearch for autoit used, follow instructions below to download it and install
  6.                 Developed by Avatar88343 @ Ownedcore
  7.                 Revision by cib V2, ImageSearch need, follow instructions below to download it and install
  8.                 HELL / INFERNO, LOOT GEMS, LEGEND, RARE, SET, TOME BLUE, CONECTION ERROR HANDLED, INFINITE AUTO LOGIN SUPPORT, NOTHING TO DO JUST LOOK AT YOUR BOT AND SELL UR INVENTORY WHEN FULL
  9.                 !!! FRENCH VERSION IF YOU WANT TO USE WITH ANOTHER LANGUAGE U GOT TO CHANGE THE IMAGE SEARCH PNGS IN THE DIRECTORY WITH ONES ACCORDING TO YOUR LANGUAGE !!!!
  10.                 !!! U CAN REPLACE THEMS WITH THE ONE IN THE IMAGESEARCH PACKAGE FOR ENGLISH VERSION  !!!!
  11.  
  12.               What it does:
  13.                             *This bot will travel to the cellar in Act 1, kill the mobs, collect the gold, the rare legend and set items, potions, blue tomes, and repair your gear.
  14.                             *It fully support randomly disconnect, has an autologin feature !! and handled this fucking error message popup !!
  15. ;~                          *Tested in Hell and Inferno, making 200-220K / hour in Inferno with a 210% GF Gear
  16.                             *Need at leat 9K of dps !!
  17.                             *Death less times with the use of minions
  18.                             *Bot Log feature, you can trace what happens and tweak it for better result
  19.  
  20.               Instructions:
  21.                             1.) Bind your middle mouse button to Move (found in Key Bindings Option)
  22.                             1.a) Ensure T is bound to teleport to town
  23.                             1.b) Ensure show items names is always on, to do this go to option/game desactivate reveal item names when it drops and change show item name to always
  24.                             1.c) Ensure Shift key is set to stay in place when casting
  25.                             2.) Set your build to this http://us.battle.net/d3/en/calculator/witch-doctor#ZhiTPU!VgW!abcZba
  26.                             3.) Set your game resolution to 1920x1080 Fullscreen windowed (required)
  27.                             3.) Start Act 1, Quest 6 - Talk to Alaric
  28.                             4.) Hire the sorceress and set all her spells to the right column, ( give her good stuff too it's better )
  29.                             5.) Teleport to The Old Ruins using the waypoint and run left until you reach a checkpoint
  30.                             6.) Log out of the game (disconnect to the login screen)
  31.                             7.) Install Imagesearch for AutoIt, folowwing instructions below
  32.                             7.a) Put in the pngs folder the pngs you want to use for items detection ( set to work with pngs of diablo 3 french version )
  33.                             7.b) Change the png folder variable in the Imagesearch looting variables according to your system
  34.                             7.c) If u change pngs in the foldr u need to change variables in the Imagesearch looting variables according to
  35.                                 ( total number of pngs, setup the png array with the appropriate files located in the png folder)
  36.                             8.) Type your diablo 3 password in the $motdepasse variable for autologin, and fill the diablo 3 login screen battle net account with your email, this script doesn't support password length more than 19 characters
  37.                             9.) Save the script !
  38.                             10.) Ensure diablo 3 is in at loginscreen, not really need, it should work if u're in the character screen, but do not start it when in game.
  39.                             11.) Run the script and Press NumPAd+ to start the bot! NumPad+ is used to pause and resume the bot
  40.                             12.) You can read the log in the file c:|bot.log, realtime update, this file is flush at each start
  41.                             13.) Press Numpad- to exit the bot
  42.  
  43.               Installing imagesearch for autoit
  44.  
  45.                             ;Download: http://www.mediafire.com/?vtx9l1woj61h8r6 (1.4a new link)
  46.                             ;If your Windows installation is x64, use the 64-bit native AutoIt and the x64 directory in the archive
  47.                             ;Extract and copy AutoIt3 folder to Program Files directory
  48.                             ;Extract and copy all dlls to C:\Windows\ directory (optionally copy the MSVCR dlls to System32 as well)
  49.                             ;Extract pics directory anywhere and update the $directory var - INCLUDE TRAILING BACKSLASH: C:\pics\
  50.                             ;If you are running anything but fullscreen mode, the size of letters will mismatch and not loot anything. Resize or make your own pngs.
  51.  
  52.               NOTE:
  53.                             *1920 x 1080 fullscreen windowed is the only resolution currently supported (800x600 is not supported in this revision)
  54.                             *You must be running the game in Fullscreen Windoed mode
  55.                             *You may need to edit the values below the comments for better results
  56.  
  57.  
  58.              *Based on the code by notAres and mackus101. Special thanks to them!
  59.     #ce
  60.  
  61.     ;======EDIT THESE VALUES ACCORDINLY ===================================
  62.     $R                              = 0                             ;0 for 1920x1080 dont change this, only supported 1920
  63.     $ComputerLag    = 1100                  ;Increase this by 100-5000 if you have a slow PC. Gently tune it down until timings are right
  64.     $Repair                 = True                  ;Orders the bot to repair when items are damaged
  65.     $UseStash               = False                 ;Not currently supported
  66.     ;======================================================================
  67.     #include <Date.au3>
  68.     #include <File.au3>
  69.  
  70.  
  71. ;ImageSearch Looting Variables ---------------------------------------------------------------------------------------------
  72.     #include <ImageSearch.au3>  ;         IF U GOT ERROR ON THIS LINE THEN IMAGESEARCH FOR AUTOIT HASN'T BEEN INSTALL CORRECTLY
  73.  
  74.     Global $directory = "C:\gamez\Diablo III\autobit\pics\" ; CHANGE THIS! Point it to the directory with the imagesearch pngs, dont forget the \ at the end, keep it in "" <------ NEED TO CHANGE THIS
  75.     Global $file = ""
  76.     Global $urlString = ""
  77.     Global $totalItems = 10 ; set this variable to the number of pngs contains in $directory                                                                                <------ CHANGE THIS IF U CHANGE THE PNGS
  78.     Global $pick[$totalItems]
  79.     Global $i = 0, $gX = 0, $gY = 0
  80.     $pick[0] = "grim02.png" ; set all variables to the names of the pngs contains in $directory, dont forget the ""                                                         <------ CHANGE THIS IF U CHANGE THE PNGS
  81.     $pick[1] = "gem01.png"                                                                                                                                                  ;<------ CHANGE THIS IF U CHANGE THE PNGS
  82.     $pick[2] = "gem02.png"                                                                                                                                                  ;<------ CHANGE THIS IF U CHANGE THE PNGS
  83.     $pick[3] = "gem03.png"                                                                                                                                                  ;<------ CHANGE THIS IF U CHANGE THE PNGS
  84.     $pick[4] = "gem04.png"                                                                                                                                                  ;<------ CHANGE THIS IF U CHANGE THE PNGS
  85.     $pick[5] = "potion.png"                                                                                                                                                 ;<------ CHANGE THIS IF U CHANGE THE PNGS
  86.     $pick[6] = "legendaryE.png"                                                                                                                                             ;<------ CHANGE THIS IF U CHANGE THE PNGS
  87.     $pick[7] = "legendaryU.png"                                                                                                                                             ;<------ CHANGE THIS IF U CHANGE THE PNGS
  88.     $pick[8] = "setE.png"                                                                                                                                                   ;<------ CHANGE THIS IF U CHANGE THE PNGS
  89.     $pick[9] = "setU.png"                                                                                                                                                   ;<------ CHANGE THIS IF U CHANGE THE PNGS
  90.  
  91. ; -----------------------------------------------------------------------------------------
  92.  
  93.     Global $Resume[2][2]                    ;Location of the Resume Button
  94.     Global $Leave[2][2]                             ;Location of the in-game leave button
  95.     Global $GameLobbyCode[2][3]     ;Contains X, Y, and Hex color of Resume button so we can see if we're there
  96.     Global $GameScreenCode[2][3]    ;Contains X, Y, and Hex color used to check if we are in an unpaused game
  97.     Global $Loc1[2][2]                              ;First movement
  98.     Global $Loc2[2][2]                              ;Second movement
  99.     Global $Loc3[2][2]                              ;Third movement ttt
  100.  
  101.     Global $CellarLocation[2][2]    ;Cellar door location
  102.     Global $CellarLocation2[2][2]   ;Location of cellar during bad runs (ugly workaround for now)
  103.     Global $AltCellar = False
  104.  
  105.     Global $Loc5[2][2]                              ;Cellar hallway
  106.     Global $Loc6[2][2]                              ;Cellar doorway
  107.     Global $MonsterLoc[2][2]                ;Initial boss location
  108.     Global $MonsterSearch[2][4]             ;Bounds of where we will find our monsters
  109.     Global $GoldLoot1[2][2]                 ;First place to run when looting
  110.     Global $GoldLoot2[2][2]                 ;Second place to run when looting
  111.     Global $GoldLoot3[2][2]                 ;Third place to run when looting
  112.     Global $LootingArea[2][4]               ; looting bounds (TL X, TL Y, BR X, BR Y)
  113.     Global $CharHitBox[2][4]                ; Hitbox around user's character
  114.     Global $DeathBounds[2][2]               ; Used to detect the "You Have Died" text
  115.     Global $RepairCheck[2][2]               ; Used to check for repair icon
  116.     Global $RepairCords[2][4][2]    ; Four clicks needed to repair
  117.     Global $CellarOffset[2]
  118.     ;Global $MonsterData[2]
  119.     Global $furl = "c:\bot.log" ; log file url
  120.     Global $ErrorReport = 0
  121.     Global $ErrorPass = 0
  122.     Global $ErrorPassMax = 1000
  123.     Global $motdepasse = "ur password here"  ; !!!!!!!!!!!!!!!!!!!!! TYPE YOUR DIABLO 3 PASSWORD HERE KEEP IT BETWEEN "" !!!!!!!!!!!!!!!!!!!!!!                             <------ NEED TO CHANGE THIS
  124.     Global $restartloop = 0
  125.     Global $loginpassed = 0
  126.     Global $logintestpass = 1
  127.  
  128.  
  129.  
  130.  
  131.  
  132.     ;All locations are N dimensional arrays. [0][x] is for 1080P and [1][x] is for 800x600
  133.     ;1080P
  134.     $Resume[0][0] = 319
  135.     $Resume[0][1] = 416
  136.     $GameLobbyCode[0][0] = 319
  137.     $GameLobbyCode[0][1] = 416
  138.     $GameLobbyCode[0][2] = 4065536 ;dec
  139.     $GameScreenCode[0][0] = 1119
  140.     $GameScreenCode[0][1] = 1044
  141.     $GameScreenCode[0][2] = 0xDEFDFE
  142.  
  143.     ;800x600
  144.     $Resume[1][0] = 142
  145.     $Resume[1][1] = 251
  146.     $GameLobbyCode[1][0] = 0                        ;Undefined
  147.     $GameLobbyCode[1][1] = 0
  148.     $GameLobbyCode[1][2] = 0
  149.     $GameScreenCode[1][0] = 0
  150.     $GameScreenCode[1][1] = 0
  151.     $GameScreenCode[1][2] = 0
  152.  
  153.     ;1080P
  154.     $Leave[0][0] = 1042
  155.     $Leave[0][1] = 582
  156.  
  157.     ;800x600
  158.     $Leave[1][0] = 400
  159.     $Leave[1][1] = 342
  160.  
  161.     ;1920x1080
  162.     $Loc1[0][0]             = 500           ;First movement
  163.     $loc1[0][1]             = 250
  164.     $loc2[0][0]             = 1                     ;Second movement
  165.     $loc2[0][1]             = 370
  166.     $loc3[0][0]             = 400           ;Third Movement
  167.     $loc3[0][1]             = 600
  168.  
  169.     ;800x600
  170.     $Loc1[1][0]             = 8                     ;First movement
  171.     $loc1[1][1]             = 146
  172.     $loc2[1][0]             = 7                     ;Second movement
  173.     $loc2[1][1]             = 300
  174.     $loc3[1][0]             = 8                     ;Third Movement
  175.     $loc3[1][1]             = 300
  176.  
  177.     ;1080P
  178.     $CellarLocation[0][0] = 307             ;Cellar door location
  179.     $CellarLocation[0][1] = 74
  180.     ;800x600
  181.     $CellarLocation[1][0] = 38              ;Cellar door location
  182.     $CellarLocation[1][1] = 98
  183.     $CellarLocation2[1][0] = 10             ;Location of cellar during bad runs
  184.     $CellarLocation2[1][1] = 34
  185.  
  186.     $CellarOffset[0] = 33;
  187.     $CellarOffset[1] = 14;
  188.  
  189.     ;1080P
  190.     $loc5[0][0]             = 116           ;Walk down hallway
  191.     $loc5[0][1]             = 986
  192.     $loc6[0][0]             = 740           ;enter hallway
  193.     $loc6[0][1]             = 295
  194.     ;$loc6[0][0]             = 776           ;enter hallway
  195.     ;$loc6[0][1]             = 328
  196.     ;800x600
  197.     $loc5[1][0]             = 3                     ;Walk down hallway
  198.     $loc5[1][1]             = 504
  199.     $loc6[1][0]             = 255           ;enter hallway
  200.     $loc6[1][1]             = 190
  201.  
  202.     ;1080P
  203.     $MonsterLoc[0][0] =     590
  204.     $MonsterLoc[0][1] =     261
  205.     ;800x600
  206.     $MonsterLoc[1][0] =     188
  207.     $MonsterLoc[1][1] =     111
  208.  
  209.     ;1920x1080
  210.     $MonsterSearch[0][0] = 10
  211.     $MonsterSearch[0][1] = 90
  212.     $MonsterSearch[0][2] = 1500
  213.     $MonsterSearch[0][3] = 750
  214.     ;800x600
  215.     $MonsterSearch[1][0] = 40
  216.     $MonsterSearch[1][1] = 53
  217.     $MonsterSearch[1][2] = 424
  218.     $MonsterSearch[1][3] = 191
  219.  
  220.     ;1920x1080
  221.     $GoldLoot1[0][0] = 402
  222.     $GoldLoot1[0][1] = 306
  223.     $GoldLoot2[0][0] = 1260
  224.     $GoldLoot2[0][1] = 351
  225.     $GoldLoot3[0][0] = 911
  226.     $GoldLoot3[0][1] = 694
  227.     ;800x600
  228.     $GoldLoot1[1][0] = 96
  229.     $GoldLoot1[1][1] = 181
  230.     $GoldLoot2[1][0] = 560
  231.     $GoldLoot2[1][1] = 191
  232.     $GoldLoot3[1][0] = 349
  233.     $GoldLoot3[1][1] = 418
  234.  
  235.     ;1080P
  236.     $LootingArea[0][0] = 15
  237.     $LootingArea[0][1] = 20
  238.     $LootingArea[0][2] = 1550
  239.     $LootingArea[0][3] = 890
  240.     ;800x600
  241.     $LootingArea[1][0] = 75
  242.     $LootingArea[1][1] = 90
  243.     $LootingArea[1][2] = 630
  244.     $LootingArea[1][3] = 360
  245.  
  246.     ;1080P
  247.     $CharHitBox[0][0] = 790
  248.     $CharHitBox[0][1] = 315
  249.     $CharHitBox[0][2] = 1200
  250.     $CharHitBox[0][3] = 730
  251.     ;800x600
  252.     $CharHitBox[1][0] = 304
  253.     $CharHitBox[1][1] = 190
  254.     $CharHitBox[1][2] = 468
  255.     $CharHitBox[1][3] = 323
  256.  
  257.     ;1080P (NOT DONEEEEEEEEEEEEE)
  258.     $DeathBounds[0][0] = 538
  259.     $DeathBounds[0][1] = 335
  260.     ;800x600
  261.     $DeathBounds[1][0] = 210
  262.     $DeathBounds[1][1] = 180
  263.  
  264.     ;1080P
  265.     $RepairCords[0][0][0] = 1690
  266.     $RepairCords[0][0][1] = 102
  267.     $RepairCords[0][1][0] = 930
  268.     $RepairCords[0][1][1] = 136
  269.     $RepairCords[0][2][0] = 517
  270.     $RepairCords[0][2][1] = 483
  271.     $RepairCords[0][3][0] = 223
  272.     $RepairCords[0][3][1] = 592
  273.     ;800x600
  274.     $RepairCords[1][0][0] = 691
  275.     $RepairCords[1][0][1] = 88
  276.     $RepairCords[1][1][0] = 505
  277.     $RepairCords[1][1][1] = 52
  278.     $RepairCords[1][2][0] = 282
  279.     $RepairCords[1][2][1] = 261
  280.     $RepairCords[1][3][0] = 157
  281.     $RepairCords[1][3][1] = 329
  282.  
  283.     ;1080P
  284.     $RepairCheck[0][0] = 1507
  285.     $RepairCheck[0][1] = 36
  286.     ;800x600
  287.     $RepairCheck[1][0] = 573
  288.     $RepairCheck[1][1] = 21
  289.  
  290.  
  291.  
  292.     HotKeySet("{NUMPADSUB}", "Terminate")
  293.     HotKeySet("{NUMPADMULT}","InGameplayScreen")
  294.     HotKeySet("{NUMPADADD}","Pause")
  295.  
  296.     Opt('MouseCoordMode', 2)
  297.     Opt('PixelCoordMode', 2)
  298.     ;HotKeySet('{SPACE}', 'Pause')
  299.     Global $Paused
  300.  
  301.  
  302. ; ################################################################### MAIN CODE ######################################################################
  303.  
  304.     FileDelete ( $furl )
  305.     Local $botlogflush = FileWriteLine ( $furl, " ########### INIT BOT ####### " )
  306.  
  307.  
  308.  
  309.  
  310.  
  311.     ;bot starts paused. press P to start.
  312.     Pause()
  313.  
  314.     Local $file = FileOpen($furl, 1)
  315.     $fwrite = _FileWriteLog($file, " ############ BOT START #############")
  316.     FileClose($file)
  317.     $LootAttempts = 0
  318.     $GemLootAttempts = 0
  319.     WinActivate('Diablo III')
  320.     Sleep(300)
  321.     While 1
  322.         While $restartloop == 0
  323.             $loginpassed = 0
  324.             While $loginpassed == 0
  325.                 if Errortest() Then
  326.                     Local $file = FileOpen($furl, 1)
  327.                     $fwrite = _FileWriteLog($file, " !!!!!!!!!!! ERROR DETECTION STEP 01 !!!!! ")
  328.                     FileClose($file)
  329.                     If IsOnLoginScreen() Then
  330.                         $ErrorReport = 0
  331.                         ExitLoop 2
  332.                     EndIf
  333.                     If InGameLobby() Then
  334.                         $ErrorReport = 0
  335.                         ExitLoop
  336.                     EndIf
  337.                 EndIf
  338.                 If IsOnLoginScreen() Then
  339.                     ToolTip("SENDING MOT DE PASSE", 10, 100)
  340.                     Sleep(800)
  341.                     Click(1112, 704)
  342.                     Sleep(300)
  343.                     Click(1112, 704)
  344.                     Sleep(800)
  345.                     Send("{BACKSPACE 20}")
  346.                     Sleep(50)
  347.                     Send($motdepasse)
  348.                     Sleep(50)
  349.                     Send("{ENTER}")
  350.                     Sleep(300)
  351.                     ToolTip("MOT DE PASSE SEND", 10, 120)
  352.                     $loadpass = 0
  353.                     While IsLoginScreenLoading()
  354.                         ToolTip("Loading ....... pass " & $loadpass & "/300", 10, 120)
  355.                         $loadpass +=1
  356.                         If $loadpass >= 300 Then
  357.                             Local $file = FileOpen($furl, 1)
  358.                             $fwrite = _FileWriteLog($file, " LOGIN TIMEOUT 5min")
  359.                             FileClose($file)
  360.                             $restartloop = 1
  361.                             ExitLoop
  362.                         EndIf
  363.                         Sleep(1000)
  364.                     WEnd
  365.                     if Errortest() Then
  366.                         ToolTip("ERROR APPEND AFTER PASSWORD TYPE IN loadpass" & $loadpass, 10, 150)
  367.                         Local $file = FileOpen($furl, 1)
  368.                         $fwrite = _FileWriteLog($file, " !!!!!!!!! ERROR APPEND AFTER PASSWORD TYPE IN !!!!!!! pass " & $loadpass)
  369.                         FileClose($file)
  370.                         $restartloop = 1
  371.                         $loadpass +=1
  372.                         Sleep(500)
  373.                     EndIf
  374.                     IF $loadpass == 0 Then
  375.                         $restartloop = 1
  376.                     EndIf
  377.                     If $restartloop == 1 Then
  378.                         ExitLoop 2
  379.                     EndIf
  380.                     if InGameLobby() Then
  381.                         ToolTip("SUCCESSFUL LOGIN", 10, 150)
  382.                         Local $file = FileOpen($furl, 1)
  383.                         $fwrite = _FileWriteLog($file, " Succesfull Login")
  384.                         FileClose($file)
  385.                         ExitLoop ; exiting WEnd
  386.                     EndIf
  387.                 EndIf
  388.                 if InGameLobby() Then
  389.                     ToolTip("IN GAME LOBBY", 10, 150)
  390.                     Local $file = FileOpen($furl, 1)
  391.                     $fwrite = _FileWriteLog($file, " IN GAME LOBBY")
  392.                     FileClose($file)
  393.                     ExitLoop
  394.                 EndIf
  395.                 $logintestpass += 1
  396.                 ToolTip("LOGIN PASS" & $logintestpass, 10, 150)
  397.                 Local $file = FileOpen($furl, 1)
  398.                 $fwrite = _FileWriteLog($file," LOGIN PASS " & $logintestpass)
  399.                 FileClose($file)
  400.                 Sleep(Random(2000,3000))
  401.             WEnd
  402.  
  403.           While $ErrorReport == 0 And $ErrorPass < $ErrorPassMax
  404.               #cs
  405.               ;Make sure that we are in the character selection screen ( we are looking at a spot in the Resume game button)
  406.               for $i = 6 To 0 step -1
  407.                         if InGameLobby() Then
  408.                             ExitLoop
  409.                         EndIf
  410.                         if Errortest() Then
  411.                             Local $file = FileOpen($furl, 1)
  412.                             $fwrite = _FileWriteLog($file, " ERROR APPEND IN LOBBY TEST")
  413.                             FileClose($file)
  414.                             ExitLoop
  415.                         EndIf
  416.  
  417.                         Sleep(600)
  418.                         if $i == 1 Then
  419.                             ;MsgBox(4096, "Error Resuming Game", "You don't seem to be in the lobby. Bot will now exit", 50)
  420.                             Local $file = FileOpen($furl, 1)
  421.                             $fwrite = _FileWriteLog($file, " IN LOBBY TEST TIMEOUT TRYING TO RELOGIN")
  422.                             FileClose($file)
  423.                             $ErrorReport = 1
  424.                             ;Terminate()
  425.                             ExitLoop
  426.  
  427.                         EndIf
  428.                 Next
  429.                 #ce
  430.                 $AltCellar = False
  431.                 $LootAttempts = 0
  432.                 $GemLootAttempts = 0
  433.                 Click($Resume[$R][0], $Resume[$R][1])           ;Resume the game
  434.                 for $i = 6 To 0 step -1                         ;Make sure that we are in the game
  435.                      if InGameplayScreen() Then
  436.                         ExitLoop
  437.                     EndIf
  438.                     if Errortest() Then
  439.                         Local $file = FileOpen($furl, 1)
  440.                         $fwrite = _FileWriteLog($file, " ERROR APPEND IN INGAME TEST 01")
  441.                         FileClose($file)
  442.                         $restartloop = 0
  443.                         ExitLoop 2
  444.                     EndIf
  445.                     sleep(1000)
  446.                      if $i == 1 Then
  447.                             ;MsgBox(4096, "Error Starting the Game", "The game did not properly load...", 50)
  448.                             Local $file = FileOpen($furl, 1)
  449.                             $fwrite = _FileWriteLog($file, " IN GAME TEST TIMEOUT TRYING TO RELOGIN")
  450.                             FileClose($file)
  451.                             ;Terminate()
  452.                             $ErrorReport = 1
  453.                             ExitLoop
  454.                      EndIf
  455.                 Next
  456.                 Local $file = FileOpen($furl, 1)
  457.                 $fwrite = _FileWriteLog($file, " ---------- ENTERING GAME -----------") ; Write to the logfile passing the filehandle returned by FileOpen.
  458.                 FileClose($file)
  459.                 ;Get close to the cellar
  460.                 Sleep(500)
  461.                 Move($Loc1[$R][0], $Loc1[$R][1])
  462.                 Sleep(400)
  463.                 Send("{4}")
  464.                 Sleep(700)
  465.                 if $R > 0 Then
  466.                      sleep(500)
  467.                 EndIf
  468.                 Move($Loc2[$R][0], $Loc2[$R][1])
  469.                 Sleep(1100)
  470.                 Move($Loc3[$R][0], $Loc3[$R][1])
  471.                 ;Check to see if it's there
  472.                 MouseMove($CellarLocation[$R][0], $CellarLocation[$R][1])
  473.                 Sleep(700)
  474.                 $CellarPixel = PixelSearch($CellarLocation[$R][0]-$CellarOffset[$R], $CellarLocation[$R][1]-$CellarOffset[$R],$CellarLocation[$R][0]+4,$CellarLocation[$R][1]+4, 0x334FB7,8)
  475.                 ;Sometimes the 800x600 path gets buggy and we need to adjust...
  476.                 if @error AND $R > 0 Then
  477.                      MouseMove($CellarLocation2[$R][0],$CellarLocation2[$R][1])
  478.                      Sleep(350)
  479.                      $CellarPixel = PixelSearch(6, 18,9,23, 0x334FB7,6)
  480.                      if not @error Then
  481.                             $AltCellar = True
  482.                      EndIf
  483.                 EndIf
  484.                 ;Leave the game if the Cellar is not there
  485.                 if @error Then
  486.                      Send("{3}")
  487.                      Sleep(200)
  488.                      Send("{2}")
  489.                      Sleep(200)
  490.                      ConsoleWrite("Did not find the cellar " & @LF)
  491.                      Local $file = FileOpen($furl, 1)
  492.                     $fwrite = _FileWriteLog($file, " NO CELLAR FOUND")
  493.                     FileClose($file)
  494.  
  495.                      SnareNearbyEnemies()
  496.                      leaveGame()
  497.                      Sleep(12000)
  498.                      ContinueLoop
  499.                  EndIf
  500.  
  501.                 Local $file = FileOpen($furl, 1)
  502.                 $fwrite = _FileWriteLog($file, " ENTERING CELLAR") ; Write to the logfile passing the filehandle returned by FileOpen.
  503.                 FileClose($file)
  504.  
  505.               ;Enter the cellar
  506.               ConsoleWrite("Found the cellar" & @LF)
  507.              ; if not $AltCellar Then
  508.  
  509.               if $R > 0 AND $AltCellar Then
  510.                      Click($CellarLocation2[$R][0] - 4, $CellarLocation2[$R][1] - 4)
  511.               Else
  512.                      Click($CellarLocation[$R][0], $CellarLocation[$R][1])
  513.               endif
  514.               ;else
  515.                     ; Click($CellarLocation2[$R][0], $CellarLocation2[$R][1])
  516.               ;EndIf
  517.               Sleep(1800 + $ComputerLag)
  518.  
  519.                ;Check to see if we died
  520.               if CheckForDeath() Then
  521.                      ContinueLoop
  522.               EndIf
  523.  
  524.               ;Inside the celler now - Move to the doorway and summon minions
  525.  
  526.               Send("{2}")
  527.                      Sleep(200)
  528.                      Send("{3}")
  529.                      Sleep(600)
  530.               Move($Loc5[$R][0], $Loc5[$R][1])
  531.               Sleep(1700)
  532.               Move($Loc6[$R][0], $Loc6[$R][1])
  533.               Sleep(300)
  534.  
  535.  
  536.               ;Cast spell 1 on the pack
  537.               MouseMove(611, 247)
  538.               Send ("{SHIFTDOWN}")
  539.               Sleep(150)
  540.               MouseClick("left")
  541.               Sleep(50)
  542.               Send ("{SHIFTUP}")
  543.               MouseMove(611, 247)
  544.               Sleep(150)
  545.               Send("{1}")
  546.               Sleep(500)
  547.               Send("{1}")
  548.               Sleep(500)
  549.               Send("{1}")
  550.               Sleep(500)
  551.               Send("{1}")
  552.               Sleep(500)
  553.               Send("{4}")
  554.               Sleep(250)
  555.  
  556.               ;Kill all the enemies inside
  557.               while 1
  558.  
  559.                      $MonsterBar =  PixelSearch($MonsterSearch[$R][0], $MonsterSearch[$R][1], $MonsterSearch[$R][2], $MonsterSearch[$R][3], 0xEE0000, 10)
  560.                      if @error Then
  561.                             ConsoleWrite("Didn't find any, attacking to discover potential enemies" & @LF)
  562.                             Attack($MonsterLoc[$R][0],$MonsterLoc[$R][1])
  563.                             sleep(500)
  564.                             Attack($MonsterLoc[$R][0]-20,$MonsterLoc[$R][1]-10)
  565.                             sleep(500)
  566.                             Attack($MonsterLoc[$R][0]+30,$MonsterLoc[$R][1]+10)
  567.                             Sleep(400)
  568.                             $MonsterBar =  PixelSearch($MonsterSearch[$R][0], $MonsterSearch[$R][1], $MonsterSearch[$R][2], $MonsterSearch[$R][3], 0xEE0000, 10)
  569.                             if @error Then
  570.                                ConsoleWrite("No monsters found - Moving on")
  571.                                ExitLoop
  572.                             EndIf
  573.                      EndIf
  574.  
  575.                      ;if CheckForNearbyMonsters() Then
  576.                             ;send("{4}")
  577.                      ;EndIf
  578.  
  579.                      for $i = 7 To 0 step -1
  580.                             Attack($MonsterBar[0], $MonsterBar[1])
  581.                             Sleep(100)
  582.                       Next
  583.                   WEnd
  584.  
  585.  
  586.               ToolTip('Looting Gold...', 0, 150)
  587.                 Local $file = FileOpen($furl, 1)
  588.                 $fwrite = _FileWriteLog($file, " LOOTING GOLD")
  589.                 FileClose($file)
  590.  
  591.  
  592.               ;Loot the gold and attack anything we missed
  593.               sleep(300)
  594.  
  595.               Move(437, 338)
  596.               Sleep(900)
  597.               Move(1322, 315)
  598.               Sleep(500)
  599.               Move(838, 762)
  600.               Sleep(500)
  601.               AttackNearbyMonsters()
  602.               ToolTip("")
  603.  
  604.               ;Loot items
  605.               Sleep(350)
  606.               Loot()
  607.               $LootAttemps = 0
  608.  
  609.               ;Check to see if we died
  610.               if CheckForDeath() Then
  611.                      ContinueLoop
  612.               EndIf
  613.  
  614.  
  615.               ;Teleport to town
  616.               send("{t}")
  617.               sleep(8000)
  618.  
  619.               ;Repair if needed
  620.               if $Repair then
  621.                      RepairItems()
  622.               EndIf
  623.  
  624.               ;Leave the game
  625.  
  626.               LeaveGame()
  627.               Sleep(1000)
  628.           WEnd
  629.           $ErrorReport = 0
  630.           $ErrorPass += 1
  631.           If $ErrorPass >= $ErrorPassMax Then
  632.               Local $file = FileOpen($furl, 1)
  633.               $fwrite = _FileWriteLog($file, " ERROR PASS MAX REACHED EXITING BOT")
  634.               FileClose($file)
  635.               Terminate()
  636.           EndIf
  637.  
  638.       WEnd
  639.       $restartloop = 0
  640.       $logintestpass = 0
  641.       Local $file = FileOpen($furl, 1)
  642.       $fwrite = _FileWriteLog($file, " --------- RESTARTING MAIN LOOP ----------")
  643.       FileClose($file)
  644.       ToolTip("Restarting loop in 5sec",10, 150)
  645.       Sleep(Random (3000, 6000))
  646.  
  647.     WEnd
  648.  
  649. ; #################################################### FUNCTIONS CODE ####################################################
  650.  
  651.  
  652.  
  653.     Func CheckForRepair()
  654.        $RepairNeeded = PixelSearch($RepairCheck[$R][0],$RepairCheck[$R][1], $RepairCheck[$R][0]+5, $RepairCheck[$R][1]+5, 0xFFE801,10)
  655.  
  656.        if Not @error Then
  657.               return True
  658.        Else
  659.               return False
  660.        EndIf
  661.     EndFunc
  662.  
  663.  
  664.     Func RepairItems()
  665.        if not CheckForRepair() Then
  666.               Return
  667.           EndIf
  668.  
  669.          Local $file = FileOpen($furl, 1)
  670.                 $fwrite = _FileWriteLog($file, " REPAIR ITEMS") ; Write to the logfile passing the filehandle returned by FileOpen.
  671.                 FileClose($file)
  672.  
  673.        Move($RepairCords[$R][0][0] , $RepairCords[$R][0][1])
  674.        Sleep(2700+$ComputerLag)
  675.        MouseMove($RepairCords[$R][1][0] , $RepairCords[$R][1][1])
  676.        Sleep(400)
  677.        Click($RepairCords[$R][1][0] , $RepairCords[$R][1][1])
  678.        sleep(2200+$ComputerLag)
  679.        click($RepairCords[$R][2][0] , $RepairCords[$R][2][1])
  680.        Sleep(Random(700-900))
  681.        Click($RepairCords[$R][3][0] , $RepairCords[$R][3][1])
  682.        Sleep(500)
  683.        send("{esc}")
  684.  
  685.     EndFunc
  686.  
  687.  
  688.     Func LeaveGame()
  689.         Local $file = FileOpen($furl, 1)
  690.                 $fwrite = _FileWriteLog($file, " ---------- LEAVING GAME -----------") ; Write to the logfile passing the filehandle returned by FileOpen.
  691.                 FileClose($file)
  692.  
  693.         ;If $fwrite <> 1 Then
  694.             ;        MsgBox(0, "Error", "Unable to open file.")
  695.             ;    EndIf
  696.        send("{esc}")
  697.        Sleep(400)
  698.        Click($Leave[$R][0], $Leave[$R][1])
  699.     EndFunc
  700.  
  701.     Func Pause()
  702.        $Paused = Not $Paused
  703.        While $Paused
  704.           Sleep(100)
  705.           ToolTip('Paused...', 0, 0)
  706.        WEnd
  707.        ToolTip("")
  708.    EndFunc   ;
  709.  
  710.    Func SilentPause()
  711.        $Paused = Not $Paused
  712.        While $Paused
  713.           Sleep(100)
  714.           ;ToolTip('Paused...', 0, 0)
  715.        WEnd
  716.        ToolTip("")
  717.     EndFunc   ;
  718.  
  719.     Func Click($x, $y)
  720.        MouseClick('left', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  721.        Sleep(Random(1000, 1500))
  722.     EndFunc
  723.  
  724.     Func Move($x, $y)
  725.        MouseClick('middle', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  726.        Sleep(Random(1000, 1500))
  727.     EndFunc
  728.  
  729.     Func Attack($x, $y)
  730.        MouseClick('right', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  731.     EndFunc
  732.  
  733.     Func Rest($z)
  734.        Sleep(Random($z, $z+25))
  735.     EndFunc
  736.  
  737.     Func CheckForDeath()
  738.        $Death = PixelSearch($DeathBounds[$R][0], $DeathBounds[$R][0], $DeathBounds[$R][0]+4, $DeathBounds[$R][0]+4, 0xFFFFFF)
  739.        if not @error Then
  740.             Local $file = FileOpen($furl, 1)
  741.                 $fwrite = _FileWriteLog($file, " DEAAAAD") ; Write to the logfile passing the filehandle returned by FileOpen.
  742.                 FileClose($file)
  743.               ConsoleWrite("Died" & @LF)
  744.               LeaveGame()
  745.               Sleep(12000)
  746.               return True
  747.        Else
  748.               return False
  749.        EndIf
  750.     EndFunc
  751.  
  752.     #cs
  753.     Func LootBlues()
  754.         $LootAttempts=0
  755.         While ($LootAttempts < 3)
  756.             $lootpass = "LOOT BLUE PASS "
  757.             $lootpass &= $LootAttempts
  758.             ToolTip($lootpass, 0, 150)
  759.             Send("!")
  760.             Sleep(250)
  761.             $Blue = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], $LootingArea[$R][3], 0x6969FF, 2) ;
  762.             If not @error Then
  763.                 Click($Blue[0], $Blue[1])
  764.                 Sleep(Random(800,1000))
  765.             EndIf
  766.             $LootAttempts+=1
  767.        WEnd
  768.        ToolTip("")
  769.    EndFunc
  770.    #ce
  771.  
  772.  
  773.    Func Loot()
  774.         $LootAttempts=0                       ; LOOT RARE DESACTIVATE IT IF U WANT
  775.         While ($LootAttempts < 2)
  776.             $lootpass = "LOOT RARE PASS "
  777.             $lootpass &= $LootAttempts
  778.             ToolTip($lootpass, 0, 150)
  779.             Sleep(250)
  780.             $Rare = PixelSearch($LootingArea[$R][0], $LootingArea[$R][1], $LootingArea[$R][2], $LootingArea[$R][3], 0xFFFF00, 6) ;
  781.             If not @error Then
  782.                 Local $file = FileOpen($furl, 1)
  783.                 $fwrite = _FileWriteLog($file, " LOOTING 1 RARE")
  784.                 FileClose($file)
  785.                 Click($Rare[0], $Rare[1])
  786.                 Sleep(1600)
  787.             EndIf
  788.             $LootAttempts+=1
  789.         WEnd
  790.  
  791.          For $gI = 0 to ($totalItems - 5)  ; LOOT GEMS POTIONS
  792.             $file = $pick[$gI]
  793.             $urlString = $directory & $file
  794.             ToolTip("SEARCHING " & $urlString, 10, 100)
  795.             $Target = _ImageSearchArea($urlString,1,400,200,1520,800,$gX,$gY,80)
  796.             sleep(50)
  797.             If $Target Then
  798.                 Local $file = FileOpen($furl, 1)
  799.                 $fwrite = _FileWriteLog($file, " LOOTING 1 GEM OR TOME")
  800.                 FileClose($file)
  801.                 ToolTip("FIND " & $Target & " " & $urlString & " POS " & $gX & "-" & $gY, 10, 100)
  802.                 Click($gX, $gY)
  803.                 sleep(500)
  804.                 $Target = _ImageSearchArea($urlString,1,400,200,1520,800,$gX,$gY,80)
  805.                 Sleep(50)
  806.                 If $Target Then
  807.                     Local $file = FileOpen($furl, 1)
  808.                 $fwrite = _FileWriteLog($file, " LOOTING 1 GEM OR TOME")
  809.                 FileClose($file)
  810.                     Click($gX, $gY)
  811.                     sleep(500)
  812.                     $Target = _ImageSearchArea($urlString,1,400,200,1520,800,$gX,$gY,80)
  813.                     Sleep(50)
  814.                     If $Target Then
  815.                         Local $file = FileOpen($furl, 1)
  816.                 $fwrite = _FileWriteLog($file, " LOOTING 1 GEM OR TOME")
  817.                 FileClose($file)
  818.                         Click($gX, $gY)
  819.                         sleep(500)
  820.                     EndIf
  821.                 EndIf
  822.  
  823.             EndIf
  824.             ToolTip("", 10, 100)
  825.         Next
  826.  
  827.         For $gI = 6 to ($totalItems - 1)  ; LOOT LEGEND AND SET GEAR
  828.             $file = $pick[$gI]
  829.             $urlString = $directory & $file
  830.             ToolTip("SEARCHING " & $urlString, 10, 100)
  831.             $Target = _ImageSearchArea($urlString,1,400,200,1520,800,$gX,$gY,40)
  832.             sleep(50)
  833.             If $Target Then
  834.                 Local $file = FileOpen($furl, 1)
  835.                 $fwrite = _FileWriteLog($file, " LOOTING 1 LEGEND OR SET")
  836.                 FileClose($file)
  837.                 ToolTip("FIND " & $Target & " " & $urlString & " POS " & $gX & "-" & $gY, 10, 100)
  838.                 Click($gX, $gY)
  839.                 sleep(500)
  840.                 $Target = _ImageSearchArea($urlString,1,400,200,1520,800,$gX,$gY,40)
  841.                 Sleep(50)
  842.                 If $Target Then
  843.                     Local $file = FileOpen($furl, 1)
  844.                 $fwrite = _FileWriteLog($file, " LOOTING 1 LEGEND OR SET")
  845.                 FileClose($file)
  846.                     Click($gX, $gY)
  847.                     sleep(500)
  848.                 EndIf
  849.             EndIf
  850.             ToolTip("", 10, 100)
  851.         Next
  852.  
  853.        ToolTip("")
  854.    EndFunc
  855.  
  856.  
  857.  
  858.     Func AttackNearbyMonsters()
  859.        while 1
  860.               $MonsterData =  PixelSearch($CharHitBox[$R][0],$CharHitBox[$R][1],$CharHitBox[$R][2],$CharHitBox[$R][3], 0xEE0000, 10)
  861.                      if @error Then
  862.                             ExitLoop
  863.                      EndIf
  864.  
  865.               send("{4}")
  866.               sleep(300)
  867.               for $i = 10 To 0 step -1
  868.                      Attack($MonsterData[0], $MonsterData[1])
  869.                      Sleep(100)
  870.               Next
  871.        WEnd
  872.     EndFunc
  873.  
  874.     Func CheckForNearbyMonsters()
  875.        $MonsterData =  PixelSearch($CharHitBox[$R][0],$CharHitBox[$R][1],$CharHitBox[$R][2],$CharHitBox[$R][3], 0xEE0000, 10)
  876.        if @error Then
  877.               return False
  878.        Else
  879.                return True
  880.             EndIf
  881.      EndFunc
  882.  
  883.  
  884.     Func SnareNearbyEnemies()
  885.        $MonsterData =  PixelSearch($CharHitBox[$R][0],$CharHitBox[$R][1],$CharHitBox[$R][2],$CharHitBox[$R][3], 0xEE0000, 10)
  886.        if not @error Then
  887.                MouseMove($MonsterData[0], $MonsterData[1])
  888.                Sleep(350)
  889.                Send("{3}")
  890.                sleep(250)
  891.             EndIf
  892.      EndFunc
  893.  
  894.  
  895.     Func InGameLobby()
  896.             MouseMove($GameLobbyCode[$R][0],$GameLobbyCode[$R][1])
  897.             Sleep(300)
  898.             PixelSearch($GameLobbyCode[$R][0],$GameLobbyCode[$R][1],$GameLobbyCode[$R][0]+10,$GameLobbyCode[$R][1]+10, $GameLobbyCode[$R][2], 10)
  899.         if not @error Then
  900.                return True
  901.             Else
  902.                return False
  903.        EndIf
  904.    EndFunc
  905.  
  906.  
  907.    Func ErrorTest()
  908.         ToolTip("Testing Connexion Error Dectection", 10, 100)
  909.         $file = "ok.png"
  910.         $urlString = $directory & $file
  911.         $Target = _ImageSearchArea($urlString,1,410,230,1940,880 ,$gX,$gY,10)
  912.         If $Target == 1 Then
  913.             ToolTip("Connexion Error detected", 10, 100)
  914.             Local $file = FileOpen($furl, 1)
  915.             $fwrite = _FileWriteLog($file, " !!!!!!!!!!!!!!!! ERROR DETECTED !!!!!!!!!!!!!!! PASS " & $ErrorPass)
  916.             FileClose($file)
  917.             $ErrorReport = 1
  918.             Click($gX, $gY)
  919.             Sleep(500)
  920.             return True
  921.         Else
  922.             ToolTip("No connexion error", 10, 100)
  923.             return False
  924.         EndIf
  925.     EndFunc
  926.  
  927.     Func IsOnLoginScreen()
  928.         ToolTip("is on login screen", 10, 100)
  929.         $file = "loginscreen.png"
  930.         $urlString = $directory & $file
  931.         $Target = _ImageSearchArea($urlString,1,980,280,1010,300,$gX,$gY,10)
  932.         If $Target == 1 Then
  933.             ToolTip("LOGIN SCREEN", 10, 100)
  934.             Local $file = FileOpen($furl, 1)
  935.             $fwrite = _FileWriteLog($file, "LOGIN SCREEN ENTER PASSWORD")
  936.             FileClose($file)
  937.             return True
  938.         Else
  939.             ToolTip("NO LOGIN", 10, 100)
  940.             return False
  941.         EndIf
  942.     EndFunc
  943.  
  944.     Func IsLoginScreenLoading()
  945.         ToolTip("IS LODAING SCREEN", 10, 100)
  946.         $file = "loginscreenload.png"
  947.         $urlString = $directory & $file
  948.         $Target = _ImageSearchArea($urlString,1,1030,380,1070,415,$gX,$gY,10)
  949.         If $Target == 1 Then
  950.             ToolTip("LOADING SCREEN", 10, 100)
  951.             return True
  952.         Else
  953.             ToolTip("NO LOADING", 10, 100)
  954.             return False
  955.         EndIf
  956.     EndFunc
  957.  
  958.      Func InGameplayScreen()
  959.             PixelSearch($GameScreenCode[$R][0],$GameScreenCode[$R][1],$GameScreenCode[$R][0]+4,$GameScreenCode[$R][1]+3, $GameScreenCode[$R][2], 10)
  960.             if not @error Then
  961.                return True
  962.             Else
  963.                return False
  964.        EndIf
  965.    EndFunc
  966.  
  967.    Func Terminate()
  968.         Local $file = FileOpen($furl, 1)
  969.                 $fwrite = _FileWriteLog($file, " ############ BOT ENDED #############")
  970.                 FileClose($file)
  971.         Exit 0
  972.      EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement