Guest User

wd_farming_bot_zeenexx_0.3

a guest
Jun 16th, 2012
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 23.21 KB | None | 0 0
  1. #include <ImageSearch.au3>
  2. #include <WindowsConstants.au3>
  3. #include <Misc.au3>
  4. #Include <WinAPI.au3>
  5.  
  6. Global $Items[6][5]
  7. Global $SoundFiles[6]
  8. Global $Resume[2]  
  9. Global $Paused
  10. Global $Leave[2]
  11. Global $GameLobbyCode[3]
  12. Global $GameScreenCode[3]
  13. Global $NetworkCode[6]
  14. Global $PasswordLoc[2]
  15. Global $Loc1[2]
  16. Global $Loc2[2]
  17. Global $Loc3[2]
  18. Global $Loc5[2]
  19. Global $Loc6[2]
  20. Global $CellarLocation[2]
  21. Global $CellarLocation2[2]
  22. Global $CellarOffset[2]    
  23. Global $MonsterLoc[2]
  24. Global $MonsterSearch[4]   
  25. Global $GoldLoot1[2]           
  26. Global $GoldLoot2[2]           
  27. Global $GoldLoot3[2]           
  28. Global $LootingArea[4] 
  29. Global $FullArea[4]
  30. Global $SellArea[4]
  31. Global $CharHitBox[4]      
  32. Global $DeathBounds[2]     
  33. Global $RepairCords[4][2]  
  34. Global $PortalCords[3][2]
  35. Global $RepairCheck[2]     
  36. Global $CellarPixel
  37. Global $FullBag = False
  38.  
  39. ;//////////////////////////////////////--CONFIG--/////////////////////////////////////////////////////////////////////////////
  40. $ComputerLag        = 0                                         ;Increase this by 50-1000 if you have a slow PC             //
  41. $LootLegendaries    = True                                      ;Whether or not to loot legendary items                     //
  42. $LootSets           = True                                      ;Whether or not to loot set items                           //
  43. $LootRares          = True                                      ;Whether or not to loot rare items                          //
  44. $LootMagics         = True                                      ;Whether or not to loot magic items (includes tomes)        //
  45. $LootTomes          = True                                      ;Whether or not to loot tomes                               //
  46. $LootGems           = True                                      ;Whether or not to loot gems                                //
  47. $Repair             = True                                      ;Orders the bot to repair when items are damaged            //
  48. $Sell               = True                                      ;Orders the bot to sell when bag is full                    //
  49. $ImgDir             = "C:\Program Files (x86)\AutoIt3\pics\"    ;Location of the image folder                               //
  50. $Sounds             = True                                      ;Enable sounds                                              //
  51. $SoundsDir          = "C:\Program Files (x86)\AutoIt3\sounds\"  ;Location of the sounds folder                              //
  52. $ShowLootArea       = True                                      ;Shows lootarea                                             //
  53. $ShowStatTooltip    = True                                      ;Shows the tooltip with statistics from the current session //
  54. $Stats              = False                                     ;Enable statistics                                          //
  55. ;       Options for the Relogfunction                                                                                       //                                 
  56. $UseRelog           = 1                                         ;Enable Relogfunction                                       //
  57. $Password           = "xxxxxxxx"                                ;Your password                                              //
  58. ;                                                                                                                           //
  59. ;       Changes below have an significantly impact on the needed time for one run!                                          //
  60. $RareLootAmount     = 1                                         ;Amount of rare items to pickup                             //
  61. $MagicLootAmount    = 3                                         ;Amount of magic items to pickup                            //
  62. $TomeLootAmount     = 1                                         ;Amount of tomes to pickup                                  //
  63. $GemLootAmount      = 2                                         ;Amount of gems to pickup                                   //
  64. $LootingArea[0]     = 570                                       ;Left   (lower -> bigger)                                   //
  65. $LootingArea[1]     = 185                                       ;Top    (lower -> bigger)                                   //
  66. $LootingArea[2]     = 1375                                      ;Right  (higher -> bigger)                                  //
  67. $LootingArea[3]     = 720                                       ;Bot    (higher -> bigger)                                  //
  68. ;/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  69.  
  70. $Items[0][0]            = "legendaryA.png|65"
  71. $Items[0][1]            = "legendaryE.png|65"
  72. $Items[0][2]            = "legendaryI.png|65"
  73. $Items[0][3]            = "legendaryO.png|65"
  74. $Items[0][4]            = "legendaryU.png|65"
  75. $Items[1][0]            = "setA.png|80"
  76. $Items[1][1]            = "setE.png|80"
  77. $Items[1][2]            = "setU.png|80"
  78. $Items[1][3]            = "setO.png|80"
  79. $Items[1][4]            = "setI.png|80"
  80. $Items[2][0]            = "rareA.png|80"
  81. $Items[2][1]            = "rareE.png|80"
  82. $Items[2][2]            = "rareI.png|80"
  83. $Items[2][3]            = "rareO.png|80"
  84. $Items[2][4]            = "rareU.png|80"
  85. $Items[3][0]            = "blueA.png|30"
  86. $Items[3][1]            = "blueE.png|30"
  87. $Items[3][2]            = "blueI.png|30"
  88. $Items[3][3]            = "blueO.png|30"
  89. $Items[3][4]            = "blueU.png|30"
  90. $Items[4][0]            = "tome.png|140"
  91. $Items[4][1]            = "uare.png|100"
  92. $Items[5][0]            = "you.png|100"
  93. $Items[5][1]            = "sellNew.png|75"
  94. $Items[5][2]            = "sell1x1.png|60"
  95.  
  96. $SoundFiles[0]          = "legendary.wav"
  97. $SoundFiles[1]          = "set.wav"
  98. $SoundFiles[2]          = "rare.wav"
  99. $SoundFiles[3]          = "magic.wav"
  100. $SoundFiles[4]          = "tome.wav"
  101. $SoundFiles[5]          = "gem.wav"
  102.  
  103. $Resume[0]              = 319
  104. $Resume[1]              = 416
  105.  
  106. $Leave[0]               = 969
  107. $Leave[1]               = 582
  108.  
  109. $GameLobbyCode[0]       = 319
  110. $GameLobbyCode[1]       = 416
  111. $GameLobbyCode[2]       = 4065536
  112.  
  113. $GameScreenCode[0]      = 1119
  114. $GameScreenCode[1]      = 1044
  115. $GameScreenCode[2]      = 0xDEFDFE
  116.  
  117. $NetworkCode[0]         = 840
  118. $NetworkCode[1]         = 410
  119. $NetworkCode[2]         = 950
  120. $NetworkCode[3]         = 440
  121. $NetworkCode[4]         = 960
  122. $NetworkCode[5]         = 630
  123.  
  124. $PasswordLoc[0]         = 820
  125. $PasswordLoc[1]         = 705
  126.  
  127. $Loc1[0]                = 500
  128. $Loc1[1]                = 250
  129. $Loc2[0]                = 1
  130. $Loc2[1]                = 370
  131. $Loc3[0]                = 400
  132. $Loc3[1]                = 600      
  133. $Loc5[0]                = 116
  134. $Loc5[1]                = 986          
  135. $Loc6[0]                = 776
  136. $Loc6[1]                = 328
  137.  
  138. $CellarLocation[0]      = 307
  139. $CellarLocation[1]      = 74
  140.  
  141. $CellarOffset           = 33
  142.  
  143. $MonsterLoc[0]          = 577
  144. $MonsterLoc[1]          = 183
  145.  
  146. $MonsterSearch[0]       = 150
  147. $MonsterSearch[1]       = 20
  148. $MonsterSearch[2]       = 1248
  149. $MonsterSearch[3]       = 446
  150.  
  151. $GoldLoot1[0]           = 577
  152. $GoldLoot1[1]           = 306
  153. $GoldLoot2[0]           = 1260
  154. $GoldLoot2[1]           = 351
  155. $GoldLoot3[0]           = 911
  156. $GoldLoot3[1]           = 694
  157.  
  158. $FullArea[0]            = 795
  159. $FullArea[1]            = 125
  160. $FullArea[2]            = 830
  161. $FullArea[3]            = 160
  162.  
  163. $SellArea[0]            = 1460
  164. $SellArea[1]            = 585
  165. $SellArea[2]            = 1900
  166. $SellArea[3]            = 875
  167.  
  168. $CharHitBox[0]          = 790
  169. $CharHitBox[1]          = 315
  170. $CharHitBox[2]          = 1200
  171. $CharHitBox[3]          = 730
  172.  
  173. $DeathBounds[0]         = 538
  174. $DeathBounds[1]         = 335
  175.  
  176. $RepairCords[0][0]      = 1690
  177. $RepairCords[0][1]      = 102
  178. $RepairCords[1][0]      = 930
  179. $RepairCords[1][1]      = 136
  180. $RepairCords[2][0]      = 517
  181. $RepairCords[2][1]      = 483
  182. $RepairCords[3][0]      = 223
  183. $RepairCords[3][1]      = 592
  184.  
  185. $RepairCheck[0]         = 1507
  186. $RepairCheck[1]         = 36
  187.  
  188. $PortalCords[0][0]      = 780
  189. $PortalCords[0][1]      = 950
  190. $PortalCords[1][0]      = 270
  191. $PortalCords[1][1]      = 930
  192. $PortalCords[2][0]      = 650
  193. $PortalCords[2][1]      = 500
  194.  
  195. $DisconnectState        = 0
  196. $Disconnects            = 0
  197.  
  198. $ISx                    = 0
  199. $ISy                    = 0
  200.  
  201. $RareLootAttempts       = 0
  202. $MagicLootAttempts      = 0
  203. $TomeLootAttempts       = 0
  204. $GemLootAttempts        = 0
  205.  
  206. $StartTime              = @HOUR & ":" & @MIN & " Uhr"
  207. $Runs                   = 0
  208. $Closed                 = 0
  209. $Runtime                = "0h 0m 0s"
  210.  
  211. $Legendaries            = 0
  212. $Sets                   = 0
  213. $Rares                  = 0
  214. $Magics                 = 0
  215. $Gems                   = 0
  216. $Tomes                  = 0
  217.  
  218. $Sold                   = 0
  219.  
  220. $LootingAreaWidth       = $LootingArea[2] - $LootingArea[0]
  221. $LootingAreaHeight      = $LootingArea[3] - $LootingArea[1]
  222.  
  223. If $ShowLootArea = True Then
  224.    DrawLootArea()  
  225. EndIf    
  226.  
  227. OnAutoItExitRegister ('OnAutoItExit')
  228. Opt('MouseCoordMode', 2)
  229. Opt('PixelCoordMode', 2)
  230.  
  231. HotKeySet('{PAUSE}', 'Pause')
  232. HotKeySet('{END}', 'Terminate')
  233.  
  234. Pause()
  235. $Timer = TimerInit()
  236.  
  237. If $ShowStatTooltip = True Then
  238.    ToolTip("Start: " & $StartTime & "  |  Runs: " & $Runs & "  |  Closed:  " & $Closed & "  |  Disconnects: " & $Disconnects & "  |  Runtime: " & $Runtime & "  |  Legendaries: " & $Legendaries & "  |  Sets: " & $Sets & "  |  Rares: " & $Rares & "  |  Magics: " & $Magics & "  |  Tomes: " & $Tomes & "  |  Gems: " & $Gems & "  |  Sold: " & $Sold, 530, 0)
  239. EndIf
  240.  
  241. WinActivate('Diablo III')
  242. While 1
  243.    If WinActive('Diablo III') Then
  244.    
  245.       While $DisconnectState < 2
  246.       for $i = 18 To 0 step -1
  247.          if InGameLobby() Then
  248.             ExitLoop
  249.          EndIf
  250.          
  251.          Sleep(600)
  252.          if $i == 1 Then
  253.             CheckForDisconnectState()
  254.             Sleep(2000 + $Computerlag)
  255.          EndIf
  256.       Next
  257.      
  258.       Click($Resume[0], $Resume[1])
  259.      
  260.       for $i = 20 To 0 step -1
  261.          if InGameplayScreen() Then
  262.             $DisconnectState = 0
  263.             ExitLoop
  264.          EndIf
  265.          
  266.          Sleep(500)
  267.          if $i == 1 Then
  268.             CheckForDisconnectState()
  269.             Sleep(2000 + $Computerlag)
  270.          EndIf
  271.       Next
  272.      
  273.       If $DisconnectState = 2 Then
  274.          If $UseRelog = 1 Then
  275.             Relog()
  276.          Else
  277.             Terminate()
  278.          EndIf
  279.       Else
  280.          If $DisconnectState = 0 Then
  281.             ExitLoop
  282.          EndIf
  283.       EndIf
  284.       WEnd
  285.      
  286.       Sleep(100 + $Computerlag)
  287.       Send("{2}")
  288.       Sleep(200 + $Computerlag)
  289.      
  290.       Move($Loc1[0], $Loc1[1])
  291.       Sleep(150 + $Computerlag)
  292.       Send("{4}")
  293.       Sleep(500 + $Computerlag)
  294.       Move($Loc2[0], $Loc2[1])
  295.       Sleep(900 + $Computerlag)
  296.       Move($Loc3[0], $Loc3[1])
  297.      
  298.       MouseMove($CellarLocation[0], $CellarLocation[1],0)
  299.       Sleep(400 + $Computerlag)
  300.       $CellarPixel = PixelSearch($CellarLocation[0]-$CellarOffset, $CellarLocation[1]-$CellarOffset,$CellarLocation[0]+4,$CellarLocation[1]+4, 0x334FB7,6)
  301.  
  302.       if @error Then
  303.          $Closed+=1
  304.          send("{t}")
  305.          Sleep(6500 + $Computerlag)
  306.          leaveGame()
  307.          ContinueLoop
  308.       EndIf
  309.      
  310.       Click($CellarLocation[0], $CellarLocation[1])
  311.  
  312.       Sleep(3200 + $Computerlag)
  313.      
  314.       if CheckForDeath() Then
  315.          ContinueLoop
  316.       EndIf
  317.        
  318.       Move($Loc5[0], $Loc5[1])
  319.       Sleep(1100 + $Computerlag)
  320.       Move($Loc6[0], $Loc6[1])
  321.       Sleep(10 + $Computerlag)
  322.       MouseMove($MonsterLoc[0],$MonsterLoc[1],0)
  323.       Sleep(150 + $Computerlag)
  324.  
  325.       send("{1}")
  326.       Sleep(200 + $Computerlag)
  327.       MouseClick('right')
  328.       Sleep(400 + $Computerlag)
  329.       Send("{3}")
  330.       Sleep(150 + $Computerlag)
  331.      
  332.       while 1
  333.          $MonsterBar = PixelSearch($MonsterSearch[0], $MonsterSearch[1], $MonsterSearch[2], $MonsterSearch[3], 0xEE0000, 10)
  334.          if @error Then
  335.             Attack($MonsterLoc[0],$MonsterLoc[1])
  336.             Sleep(850 + $Computerlag)
  337.             $MonsterBar =  PixelSearch($MonsterSearch[0], $MonsterSearch[1], $MonsterSearch[2], $MonsterSearch[3], 0xEE0000, 10)
  338.             if @error Then
  339.                ExitLoop
  340.             EndIf
  341.          EndIf
  342.      
  343.          for $i = 7 To 0 step -1
  344.             Attack($MonsterBar[0], $MonsterBar[1])
  345.             Sleep(100 + $Computerlag)
  346.           Next
  347.       WEnd
  348.      
  349.       Move($GoldLoot1[0], $GoldLoot1[1])
  350.       Sleep(200 + $Computerlag)
  351.       AttackNearbyMonsters()
  352.       MouseMove(120, 120, 0)
  353.       Sleep(100 + $Computerlag)
  354.      
  355.       #cs
  356.       Move($GoldLoot2[0], $GoldLoot2[1])
  357.       Sleep(Random(150,250))
  358.       AttackNearbyMonsters()
  359.       Move($GoldLoot3[0], $GoldLoot3[1])
  360.       Sleep(Random(150,250))
  361.       AttackNearbyMonsters()
  362.       #ce
  363.      
  364.       if $LootSets then
  365.          LootSets()
  366.       EndIf
  367.      
  368.       if $LootLegendaries then
  369.          LootLegendaries()
  370.       EndIf
  371.      
  372.       if $LootRares then
  373.          LootRares()
  374.          $RareLootAttempts = 0
  375.       EndIf
  376.      
  377.       if $LootMagics Then
  378.          LootMagics()
  379.          $MagicLootAttempts = 0
  380.       Else
  381.          if $LootTomes Then
  382.             LootTomes()
  383.             $TomesLootAttempts = 0
  384.          EndIf
  385.       EndIf
  386.      
  387.       if $LootGems Then
  388.          LootGems()
  389.          $GemLootAttempts = 0
  390.       EndIf
  391.      
  392.       if CheckForDeath() Then
  393.          ContinueLoop
  394.       EndIf
  395.      
  396.       Sleep(500 + $Computerlag)
  397.       send("{t}")
  398.       Sleep(7000 + $Computerlag)
  399.      
  400.       if $Repair then
  401.          RepairItems()
  402.       EndIf
  403.      
  404.       LeaveGame()
  405.       Sleep(1000 + $Computerlag)
  406.      
  407.    EndIf
  408. WEnd
  409.  
  410.  
  411. ;Lootfunctions
  412.  
  413. Func LootLegendaries()
  414.    
  415.    For $gI = 0 to 4
  416.       $array = StringSplit($Items[0][$gI],"|")
  417.       $file = $array[1]
  418.       $accuracy = $array[2]
  419.    
  420.       $target = _ImageSearchArea($ImgDir & $file, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $accuracy)
  421.       If $target = 1 Then
  422.          If $Sounds = True Then
  423.             SoundPlay($SoundsDir & $SoundFiles[0], 0)
  424.          EndIf
  425.          $Legendaries+=1
  426.          MouseClick("LEFT", $ISx, $ISy, 1, 0)
  427.          Sleep(300 + $Computerlag)
  428.          MouseMove(120, 120, 0)
  429.          Sleep(100 + $Computerlag)
  430.          If $Sell = True Then
  431.             CheckBagFull()
  432.             If $FullBag = True Then
  433.             $FullBag = False
  434.                LootLegendaries()
  435.             EndIf
  436.          EndIf
  437.       EndIf
  438.    Next
  439.    
  440. EndFunc
  441.  
  442. Func LootSets()
  443.    
  444.    For $gI = 0 to 4
  445.       $array = StringSplit($Items[1][$gI],"|")
  446.       $file = $array[1]
  447.       $accuracy = $array[2]
  448.    
  449.       $target = _ImageSearchArea($ImgDir & $file, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $accuracy)
  450.       If $target = 1 Then
  451.          If $Sounds = True Then
  452.             SoundPlay($SoundsDir & $SoundFiles[1], 0)
  453.          EndIf
  454.          $Sets+=1
  455.          MouseClick("LEFT", $ISx, $ISy, 1, 0)
  456.          Sleep(300 + $Computerlag)
  457.          MouseMove(120, 120, 0)
  458.          Sleep(100 + $Computerlag)
  459.          If $Sell = True Then
  460.             CheckBagFull()
  461.             If $FullBag = True Then
  462.                $FullBag = False
  463.                LootSets()
  464.             EndIf
  465.          EndIf
  466.       EndIf
  467.    Next  
  468.    
  469. EndFunc
  470.  
  471. Func LootRares()
  472.    
  473.    For $gI = 0 to 4
  474.       $array = StringSplit($Items[2][$gI],"|")
  475.       $file = $array[1]
  476.       $accuracy = $array[2]
  477.    
  478.       $target = _ImageSearchArea($ImgDir & $file, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $accuracy)
  479.       If $target = 1 Then
  480.          If $Sounds = True Then
  481.             SoundPlay($SoundsDir & $SoundFiles[2], 0)
  482.          EndIf
  483.          $Rares+=1
  484.          MouseClick("LEFT", $ISx, $ISy, 1, 0)
  485.          Sleep(300 + $Computerlag)
  486.          MouseMove(120, 120, 0)
  487.          Sleep(100 + $Computerlag)
  488.          If $Sell = True Then
  489.             CheckBagFull()
  490.             If $FullBag = True Then
  491.                $FullBag = False
  492.                LootRares()
  493.             EndIf
  494.          EndIf
  495.       EndIf
  496.    Next
  497.          
  498.    if($RareLootAttempts = $RareLootAmount) then
  499.       Return
  500.    Else
  501.       $RareLootAttempts+=1
  502.       LootRares()
  503.    EndIf
  504.    
  505. EndFunc
  506.  
  507. Func LootMagics()
  508.    
  509.    For $gI = 0 to 4
  510.       $array = StringSplit($Items[3][$gI],"|")
  511.       $file = $array[1]
  512.       $accuracy = $array[2]
  513.    
  514.       $target = _ImageSearchArea($ImgDir & $file, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $accuracy)
  515.       If $target = 1 Then
  516.          If $Sounds = True Then
  517.             SoundPlay($SoundsDir & $SoundFiles[3], 0)
  518.          EndIf
  519.          $Magics+=1
  520.          MouseClick("LEFT", $ISx, $ISy, 1, 0)
  521.          Sleep(300 + $Computerlag)
  522.          MouseMove(120, 120, 0)
  523.          Sleep(100 + $Computerlag)
  524.          If $Sell = True Then
  525.             CheckBagFull()
  526.             If $FullBag = True Then
  527.                $FullBag = False
  528.                LootMagics()
  529.             EndIf
  530.          EndIf
  531.       EndIf
  532.    Next
  533.    
  534.    if($MagicLootAttempts = $MagicLootAmount) then
  535.       Return
  536.    Else
  537.       $MagicLootAttempts+=1
  538.       LootMagics()
  539.    EndIf
  540.  
  541. EndFunc
  542.  
  543. Func LootTomes()
  544.    
  545.    $array = StringSplit($Items[4][0],"|")
  546.    $file = $array[1]
  547.    $accuracy = $array[2]
  548.    
  549.    $target = _ImageSearchArea($ImgDir & $file, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $accuracy)
  550.    If $target = 1 Then
  551.       If $Sounds = True Then
  552.             SoundPlay($SoundsDir & $SoundFiles[4], 0)
  553.          EndIf
  554.       $Tomes+=1
  555.       MouseClick("LEFT", $ISx, $ISy, 1, 0)
  556.       Sleep(500 + $Computerlag)
  557.       MouseMove(120, 120, 0)
  558.       Sleep(100 + $Computerlag)
  559.       If $Sell = True Then
  560.          CheckBagFull()
  561.          If $FullBag = True Then
  562.             $FullBag = False
  563.             LootTomes()
  564.          EndIf
  565.       EndIf
  566.    EndIf
  567.          
  568.    if($TomeLootAttempts = $TomeLootAmount) then
  569.       Return
  570.    Else
  571.       $TomeLootAttempts+=1
  572.       LootTomes()
  573.    EndIf
  574.    
  575. EndFunc
  576.    
  577. Func LootGems()
  578.    
  579.    $array = StringSplit($Items[4][1],"|")
  580.    $file = $array[1]
  581.    $accuracy = $array[2]
  582.    
  583.    $target = _ImageSearchArea($ImgDir & $file, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $accuracy)
  584.    If $target = 1 Then
  585.       If $Sounds = True Then
  586.             SoundPlay($SoundsDir & $SoundFiles[5], 0)
  587.          EndIf
  588.       $Gems+=1
  589.       MouseClick("LEFT", $ISx, $ISy, 1, 0)
  590.       Sleep(500 + $Computerlag)
  591.       MouseMove(120, 120, 0)
  592.       Sleep(100 + $Computerlag)
  593.       If $Sell = True Then
  594.          CheckBagFull()
  595.          If $FullBag = True Then
  596.             $FullBag = False
  597.             LootGems()
  598.          EndIf
  599.       EndIf
  600.    EndIf
  601.          
  602.    if($GemLootAttempts = $GemLootAmount) then
  603.       Return
  604.    Else
  605.       $GemLootAttempts+=1
  606.       LootGems()
  607.    EndIf
  608.    
  609. EndFunc
  610.  
  611.  
  612. ;Checkfunctions
  613. Func CheckBagFull()
  614.    $array = StringSplit($Items[5][0],"|")
  615.    $file = $array[1]
  616.    $accuracy = $array[2]
  617.    
  618.    $target = _ImageSearchArea($ImgDir & $file, 1, $FullArea[0], $FullArea[1], $FullArea[2], $FullArea[3], $ISx, $ISy, $accuracy)
  619.    If $target = 1 Then
  620.       $FullBag = True
  621.       SellItems()
  622.    EndIf
  623. EndFunc
  624.  
  625. Func CheckForDisconnectState()
  626.    $target = _ImageSearchArea($ImgDir & "network.png", 1, $NetworkCode[0], $NetworkCode[1], $NetworkCode[2], $NetworkCode[3], $ISx, $ISy, 10)
  627.    if $target = 1 Then
  628.       $Disconnects+=1
  629.       $DisconnectState = 1
  630.       MouseClick("LEFT", $NetworkCode[4], $NetworkCode[5], 1, 0)
  631.       Sleep(3000 + $Computerlag)
  632.    EndIf
  633.    
  634.    $target = _ImageSearchArea($ImgDir & "lost.png", 1, $NetworkCode[0], $NetworkCode[1], $NetworkCode[2], $NetworkCode[3], $ISx, $ISy, 10)
  635.    if $target = 1 Then
  636.       if $DisconnectState = 0 Then
  637.          $Disconnects+=1
  638.       EndIf
  639.       $DisconnectState = 2
  640.       MouseClick("LEFT", $NetworkCode[4], $NetworkCode[5], 1, 0)
  641.       Sleep(3000 + $Computerlag)   
  642.    EndIf
  643. EndFunc
  644.  
  645. Func CheckForDeath()
  646.    $Death = PixelSearch($DeathBounds[0], $DeathBounds[0], $DeathBounds[0]+4, $DeathBounds[0]+4, 0xFFFFFF)
  647.    if not @error Then
  648.       ConsoleWrite("Died" & @LF)
  649.       LeaveGame()
  650.       Sleep(12000 + $Computerlag)
  651.       return True
  652.    Else
  653.       return False
  654.    EndIf
  655. EndFunc
  656.  
  657. Func CheckForRepair()
  658.    $RepairNeeded = PixelSearch($RepairCheck[0],$RepairCheck[1], $RepairCheck[0]+5, $RepairCheck[1]+5, 0xFFE801,10)
  659.    if Not @error Then
  660.       return True
  661.    Else
  662.       return False
  663.    EndIf
  664. EndFunc
  665.  
  666. Func InGameLobby()
  667.     MouseMove($GameLobbyCode[0],$GameLobbyCode[1])
  668.     Sleep(300 + $Computerlag)
  669.     PixelSearch($GameLobbyCode[0],$GameLobbyCode[1],$GameLobbyCode[0]+10,$GameLobbyCode[1]+10, $GameLobbyCode[2], 10)
  670.     if not @error Then
  671.        return True
  672.     Else
  673.        return False
  674.    EndIf
  675. EndFunc
  676.  
  677. Func InGameplayScreen()
  678.     PixelSearch($GameScreenCode[0],$GameScreenCode[1],$GameScreenCode[0]+4,$GameScreenCode[1]+3, $GameScreenCode[2], 10)
  679.     if not @error Then
  680.        return True
  681.     Else
  682.        return False
  683.    EndIf
  684. EndFunc
  685.  
  686.  
  687. ;Actionfunctions
  688. Func Click($x, $y)
  689.    MouseClick('left', $x, $y, 1, 0)
  690.    Sleep(1250 + $Computerlag)
  691. EndFunc
  692.  
  693. Func Move($x, $y)
  694.    MouseClick('middle', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, 0)
  695.    Sleep(1250 + $Computerlag)
  696. EndFunc  
  697.  
  698. Func Attack($x, $y)
  699.    Send("{SHIFTDOWN}")
  700.    MouseClick('left', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, 0)
  701.    Send("{SHIFTUP}")
  702. EndFunc    
  703.  
  704. Func AttackNearbyMonsters()
  705.    while 1
  706.       $MonsterData =  PixelSearch($CharHitBox[0],$CharHitBox[1],$CharHitBox[2],$CharHitBox[3], 0xEE0000, 10)
  707.          if @error Then
  708.             ExitLoop
  709.          EndIf
  710.       send("{4}")
  711.       Sleep(300 + $Computerlag)
  712.       for $i = 10 To 0 step -1
  713.          Attack($MonsterData[0], $MonsterData[1])
  714.          Sleep(100 + $Computerlag)
  715.       Next
  716.    WEnd
  717. EndFunc
  718.  
  719. Func RepairItems()
  720.    if not CheckForRepair() Then
  721.       Return
  722.    EndIf
  723.    Move($RepairCords[0][0] , $RepairCords[0][1])
  724.    Sleep(2500 + $Computerlag)
  725.    MouseMove($RepairCords[1][0] , $RepairCords[1][1], 0)
  726.    Sleep(300 + $Computerlag)
  727.    Click($RepairCords[1][0] , $RepairCords[1][1])
  728.    Sleep(1250 + $Computerlag)
  729.    Click($RepairCords[2][0] , $RepairCords[2][1])
  730.    Sleep(500 + $Computerlag)
  731.    Click($RepairCords[3][0] , $RepairCords[3][1])
  732.    Sleep(250 + $Computerlag)
  733.    Send("{ESC}")
  734. EndFunc
  735.  
  736. Func SellItems()
  737.    Sleep(500 + $Computerlag)
  738.    Send("{t}")
  739.    Sleep(7000 + $Computerlag)
  740.    Move($RepairCords[0][0] , $RepairCords[0][1])
  741.    Sleep(2000 + $Computerlag)
  742.    MouseMove($RepairCords[1][0] , $RepairCords[1][1], 0)
  743.    Sleep(300 + $Computerlag)
  744.    Click($RepairCords[1][0] , $RepairCords[1][1])
  745.    Sleep(1200 + $Computerlag)
  746.    For $gI = 1 to 2
  747.    $array = StringSplit($Items[5][$gI],"|")
  748.    $file = $array[1]
  749.    $accuracy = $array[2]
  750.  
  751.    for $i = 40 To 0 step -1
  752.          $target = _ImageSearchArea($ImgDir & $file, 1, $SellArea[0], $SellArea[1], $SellArea[2], $SellArea[3], $ISx, $ISy, $accuracy)
  753.          If $target = 1 Then
  754.             $Sold+=1
  755.             MouseClick("RIGHT", $ISx, $ISy, 1, 0)
  756.             Sleep(200 + $Computerlag)
  757.          EndIf
  758.       Next
  759.    Next
  760.    
  761.    $RareLootAttempts        = 0
  762.    $MagicLootAttempts       = 0
  763.    $TomeLootAttempts        = 0
  764.    $GemLootAttempts         = 0
  765.    
  766.    Move($PortalCords[0][0] , $PortalCords[0][1])
  767.    Sleep(1500 + $Computerlag)
  768.    Move($PortalCords[1][0] , $PortalCords[1][1])
  769.    Sleep(1000 + $Computerlag)
  770.    MouseMove($PortalCords[2][0], $PortalCords[2][1], 0)
  771.    Sleep(500 + $Computerlag)
  772.    MouseClick("LEFT")
  773.    Sleep(2000 + $Computerlag)
  774. EndFunc
  775.  
  776. Func LeaveGame()
  777.    $Runs+=1
  778.    $Sek = Floor(TimerDiff($Timer) / 1000)
  779.    $Min = Floor($Sek / 60)
  780.    $Hour = Floor($Min / 60)
  781.    $Runtime = $Hour & "h " & ($Min-$Hour*60) & "m " & ($Sek-$Min*60) & "s"
  782.    If $ShowStatTooltip = True Then
  783.       ToolTip("Start: " & $StartTime & "  |  Runs: " & $Runs & "  |  Closed:  " & $Closed & "  |  Disconnects: " & $Disconnects & "  |  Runtime: " & $Runtime & "  |  Legendaries: " & $Legendaries & "  |  Sets: " & $Sets & "  |  Rares: " & $Rares & "  |  Magics: " & $Magics & "  |  Tomes: " & $Tomes & "  |  Gems: " & $Gems & "  |  Sold: " & $Sold, 530, 0)
  784.    EndIf
  785.    send("{ESC}")
  786.    Sleep(200 + $Computerlag)
  787.    Click($Leave[0], $Leave[1])
  788. EndFunc
  789.  
  790.  
  791.  ;Miscfunctions
  792.  Func Pause()
  793.    $Paused = Not $Paused
  794.    While $Paused
  795.       Sleep(100 + $Computerlag)
  796.       ToolTip('Paused... Press {PAUSE} to continue...', 850, 0)
  797.    WEnd
  798.    If $ShowStatTooltip = True Then
  799.       ToolTip("Start: " & $StartTime & "  |  Runs: " & $Runs & "  |  Closed:  " & $Closed & "  |  Disconnects: " & $Disconnects & "  |  Runtime: " & $Runtime & "  |  Legendaries: " & $Legendaries & "  |  Sets: " & $Sets & "  |  Rares: " & $Rares & "  |  Magics: " & $Magics & "  |  Tomes: " & $Tomes & "  |  Gems: " & $Gems & "  |  Sold: " & $Sold, 530, 0)
  800.    Else
  801.       ToolTip("")
  802.    EndIf
  803. EndFunc
  804.  
  805. Func Relog()
  806.    MouseClick("LEFT", $PasswordLoc[0], $PasswordLoc[1], 1, 0)
  807.    Send($Password)
  808.    Sleep(1000 + $Computerlag)
  809.    Send("{ENTER}")
  810.    Sleep(8000 + $Computerlag)
  811.    $DisconnectState = 0
  812. EndFunc
  813.  
  814.  Func Terminate()
  815.     Exit 0
  816.  EndFunc
  817.  
  818. Func OnAutoItExit()
  819.    If $Stats = True Then
  820.       If $Runtime = "0h 0m 0s" Then
  821.          Else
  822.          $File = FileOpen ("statistics.txt", 1)
  823.          FileWriteLine($File, "==========================")
  824.          FileWriteLine($File, "Startime: " & @TAB & @TAB & $StartTime & @LF & "Runs: " & @TAB & @TAB & $Runs & @LF & "Closed: " & @TAB & @TAB & $Closed & @LF & "Runtime: " & @TAB & @TAB & $Runtime & @LF & "Endtime: " & @TAB & @TAB & @HOUR & ":" & @MIN & " Uhr" & @LF & @LF & "Legendaries: " & @TAB & $Legendaries & @LF & "Sets: " & @TAB & @TAB & $Sets & @LF & "Rares: " & @TAB & @TAB & $Rares & @LF & "Blues: " & @TAB & @TAB & $Magics & @LF & "Gems: " & @TAB & @TAB & $Gems & @LF & "Tomes: " & @TAB & @TAB & $Tomes & @LF)
  825.          FileWriteLine($File, "==========================" & @LF & @LF)
  826.          MsgBox(32, "Statistics", "Startime: " & @TAB & $StartTime & @LF & "Runs: " & @TAB & @TAB & $Runs & @LF & "Closed: " & @TAB & @TAB & $Closed & @LF & "Runtime: " & @TAB & $Runtime & @LF & "Endtime: " & @TAB & @HOUR & ":" & @MIN & " Uhr" & @LF & @LF & "Legendaries: " & @TAB & $Legendaries & @LF & "Sets: " & @TAB & @TAB & $Sets & @LF & "Rares: " & @TAB & @TAB & $Rares & @LF & "Blues: " & @TAB & @TAB & $Magics & @LF & "Gems: " & @TAB & @TAB & $Gems & @LF & "Tomes: " & @TAB & @TAB & $Tomes & @LF)
  827.       EndIf
  828.    EndIf
  829. EndFunc
  830.  
  831. Func DrawLootArea()
  832.    $hFullScreen = WinGetHandle("Program Manager")
  833.    $hGUI = GUICreate("", $LootingAreaWidth + 2, $LootingAreaHeight + 2, $LootingArea[0], $LootingArea[1], $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TRANSPARENT))
  834.    GuiSetBkColor(0xABCDEF)
  835.    _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 0xA0)
  836.    WinSetOnTop($hGUI, "", 1)
  837.    GuiSetState()
  838.    $hDC = _WinAPI_GetWindowDC($hGUI)
  839.    $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0x0000FF)
  840.    $obj_orig = _WinAPI_SelectObject($hDC, $hPen)
  841.    $user32_dll = DllOpen("user32.dll")
  842.    _WinAPI_DrawLine($hDC, 0, 1, $LootingAreaWidth, 0)
  843.    _WinAPI_DrawLine($hDC, 1, 0, 0, $LootingAreaHeight)
  844.    _WinAPI_DrawLine($hDC, $LootingAreaWidth, $LootingAreaHeight, $LootingAreaWidth, 0)
  845.    _WinAPI_DrawLine($hDC, $LootingAreaWidth, $LootingAreaHeight, 0, $LootingAreaHeight)
  846. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment