Advertisement
Guest User

lootstash

a guest
Jun 13th, 2012
3,303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 23.86 KB | None | 0 0
  1. ;notAres' Sarkoth DH Gold Script 1.3a - 6/9/2012 - Holy shit look how beautiful this code is. Utilized ExitLoop to perfect the efficiency when dead/logging out/in need of repair
  2.     ;Thread: http://ownedcore.com/forums/diablo-3/diablo-3-bots-programs/354464-goldfarming-notares-sarkarth-dh-gold-script-autoit-script-1920x1080.html
  3.     ;Please notice I changed some variable names around and added a variable for teleport time. $waittime is now appropriately named $loadtime.
  4.     ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
  5.     ;Required build: http://us.battle.net/d3/en/calculator/demon-hunter#aRYXVT!aTW!YcaZbY
  6.     ;Required movement speed: 25% (10% boots + 15% passive 'Hot Pursuit')
  7.     ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
  8.     ;Official supported resolution: 1920x1080
  9.     ;;;;;
  10.     ;Features:
  11.     ;Loot scanning. Will only pick up rare/legendary/set pieces [IMPROVED]
  12.     ;Randomized aiming coordinates (but still static path)
  13.     ;Randomized pickup timers for variation in runs
  14.     ;Automatic repair on yellow status icon
  15.     ;Automatic resolution adjustment (16:9 only) [BUGGY - need someone to tweak coords]
  16.     ;Death check
  17.     ;Open window check (in rare case it gets stuck in menu)
  18.     ;;;;;
  19.     ;Original:
  20.     ;[Goldfarming] AFK 150k-200k Gold Per Hour by mackus101 @ ownedcore
  21.  
  22.     Opt('MouseCoordMode', 2)
  23.     Opt('PixelCoordMode', 2)
  24.      
  25.     Global $Paused
  26.     HotKeySet("=","Leave")  ;script started by pressing =
  27.     HotKeySet("-", "Pause") ;script paused by pressing -
  28.     HotKeySet("x", "Stop") ;script stopped by pressing x
  29.      
  30.     $walktime = 3000 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
  31.     $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  32.     $tptime =       6900 ; time in ms the script waits for teleport before exiting the game
  33.     $yellow =         0xFFF000 ; yellow color code (repair icon)
  34.     $red =            0xD90000 ; red color code (repair icon)
  35.     $blueInventory =  0x161D35
  36.  
  37.     $LootRares = True ; Change this to false if you don't want the bot to pick up rares (good for legendary/set only, recommend setting LootGems to False)
  38.     $LootBlues = True
  39.     $LootGems = True ; Change this to true if you want to pick up gems (messy, can fill up bag with whites/blues)
  40.     $Amethyst = 0xAC7FFF
  41.     $Ruby = 0xB01D2D
  42.     $Emerald = 0x58EE33
  43.     $Topaz = 0xFFFF59
  44.      
  45.     $runMade = 0
  46.     $go = True
  47.     $Leave = False
  48.     $Dead = False
  49.     $Logout = False
  50.     $Window = False
  51.     $default_resolutionX = 1920
  52.     $default_resolutionY = 1080
  53.     $x_ratio = 1600 / $default_resolutionX
  54.     $y_ratio = 900 / $default_resolutionY
  55.     $i = 0
  56.      
  57.     Call("RestartRun")
  58.      
  59.     Func RestartRun()
  60.        While $go
  61.               if($Leave) Then
  62.                      $i = 0
  63.                      Sleep(1000) ;had to add this since the icon doesn't show up RIGHT away in game
  64.                      Call("CheckDead")
  65.                      Call("CheckRepair")
  66.  
  67.                      If $Window Then
  68.                             MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  69.                             Sleep($loadtime)
  70.                             $Window = False
  71.                             ExitLoop
  72.                      ElseIf $Dead or $Logout Then
  73.                             ExitLoop
  74.                      EndIf
  75.                      MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
  76.                      Send("2")
  77.                      Send("4")
  78.                      Sleep(140)
  79.                      Send("4")
  80.                      Sleep(140)
  81.                      Send("4")
  82.                      Sleep(140)
  83.                      Send("4")
  84.                      Sleep(80)
  85.                      Send("4")
  86.                      Sleep(80)
  87.                      Send("4")
  88.                      Sleep(80)
  89.                      Send("4")
  90.                      Sleep(80)
  91.                      Send("4")
  92.                      Sleep(80)
  93.                      Sleep(300)
  94.                      MouseMove(Round(290*$x_ratio),Round(270*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  95.                      Sleep(700)
  96.                      Call("CheckDead")
  97.                      If $Window Then
  98.                             MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  99.                             Sleep($loadtime)
  100.                             $Window = False
  101.                             ExitLoop
  102.                      ElseIf $Dead or $Logout Then
  103.                             ExitLoop
  104.                      EndIf
  105.                      $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
  106.                                If Not @error Then
  107.                                       MouseClick("left",Round(290*$x_ratio),Round(270*$y_ratio)) ;Entrance to cellar
  108.                                       Sleep(400)
  109.                                       Send("1")
  110.                                       Send("3")
  111.                                       Sleep($walktime)
  112.                                       MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
  113.                                       Sleep(2500)
  114.                                       MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
  115.                                       Sleep(10)
  116.                                       Send("{SHIFTDOWN}")
  117.                                       MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2)
  118.                                       MouseDown("right") ;attack middle
  119.                                       Sleep(6100)
  120.                                       MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
  121.                                       Sleep(10)
  122.                                       Send("{SHIFTUP}")
  123.                                       Sleep(400)
  124.                                       MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death
  125.                                       Sleep(2100)
  126.                                       MouseClick("middle",Round(580*$x_ratio),Round(460*$y_ratio)) ;move to left top corner for gold
  127.                                       Sleep(1100)
  128.                                       MouseClick("middle",Round(1330*$x_ratio),Round(330*$y_ratio)) ;move to right top corner for gold
  129.                                       Sleep(1100)
  130.                                       MouseClick("middle",Round(1010*$x_ratio),Round(940*$y_ratio)) ;move to middle before looting
  131.                                       Call("CheckLoot")
  132.                                       Send("t")
  133.                                       Sleep($tptime)
  134.                                       Call("Town")
  135.                                       Call("CheckDead")
  136.                                      
  137.                                       If Not $Dead And Not $Window Then
  138.                                              Sleep(100)
  139.                                              Send("{ESCAPE}") ;menu
  140.                                              Sleep(20)
  141.                                              MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  142.                                              Sleep(2500)
  143.                                              Send("{SPACE}") ;close any open windows
  144.                                              Sleep(500)
  145.                                              Call("MainMenu")
  146.                                              MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  147.                                              Sleep($loadtime)
  148.                                       ElseIf $Window Then
  149.                                              MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  150.                                              Sleep($loadtime)
  151.                                              $Window = False ; reset the flag so it doesn't think a window is always up
  152.                                       EndIf
  153.                                Else
  154.                                       Sleep(50)
  155.                                       Send("t")
  156.                                       Sleep($tptime)
  157.                                       Call("CheckDead")
  158.                                       Call("CheckWindow")
  159.                                       If Not $Dead And Not $Window Then
  160.                                              Sleep(100)
  161.                                              Send("{ESCAPE}") ;menu
  162.                                              Sleep(10)
  163.                                              MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  164.                                              Sleep(2500)
  165.                                              Send("{SPACE}") ;close any open windows
  166.                                              Sleep(500)
  167.                                              Call("MainMenu")
  168.                                              MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  169.                                              Sleep($loadtime)
  170.                                       ElseIf $Window Then
  171.                                              Call("MainMenu")
  172.                                              MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  173.                                              Sleep($loadtime)
  174.                                              $Window = False ; reset the flag so it doesn't think a window is always up
  175.                                       EndIf
  176.                             EndIf
  177.               EndIf
  178.        WEnd
  179.     EndFunc
  180.      
  181.     Func CheckDead()
  182.     Call("CheckWindow")
  183.     $Pixeltest = PixelGetColor(Round(740*$x_ratio), Round(850*$y_ratio))
  184.     If Hex($Pixeltest, 6) == "0C0404" OR Hex($Pixeltest, 6) == "310000" Then
  185.        If Not $Window Then
  186.               $Dead = True
  187.               Sleep(100)
  188.               Send("{Escape}")
  189.               Sleep(10)
  190.               MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  191.               Sleep(2500)
  192.               Call("MainMenu")
  193.               MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  194.               Sleep($loadtime)
  195.            ElseIf $Window Then
  196.               Call("MainMenu")
  197.               MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  198.               Sleep($loadtime)
  199.               $Window = False
  200.        EndIf
  201.     ElseIf Hex($Pixeltest, 6) == "0C0000" OR Hex($Pixeltest, 6) == "030101" Then
  202.        Sleep(10000)
  203.        If Not $Window Then
  204.               $Dead = True
  205.               Sleep($loadtime)
  206.               Call("MainMenu")
  207.               MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  208.               Sleep($loadtime)
  209.            ElseIf $Window Then
  210.               Call("MainMenu")
  211.               MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  212.               Sleep($loadtime)
  213.               $Window = False
  214.        EndIf
  215.     Else
  216.        $Dead = False
  217.     EndIf
  218.     EndFunc
  219.      
  220.     Func CheckWindow()
  221.     $Pixeltest2 = PixelGetColor(Round(1580*$x_ratio), Round(100*$y_ratio))
  222.     If Hex($Pixeltest2, 6) == "653B23" Then
  223.        Sleep(200)
  224.        Send("{SPACE}") ;close any open windows
  225.        $Window = True
  226.     Else
  227.        $Window = False
  228.     EndIf
  229.     Sleep(300)
  230.     EndFunc
  231.      
  232.     Func CheckRepair()
  233.     $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  234.        If Not @error Then
  235.               Call("DoRepair")
  236.        EndIf
  237.     $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  238.        If Not @error Then
  239.               Call("DoRepair")
  240.        EndIf
  241.     EndFunc
  242.      
  243.     Func DoRepair()
  244.     Sleep(100)
  245.     Send("t")
  246.     Sleep($tptime)
  247.     MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  248.     Sleep(1500)
  249.     MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  250.     Sleep(1500)
  251.     MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  252.     Sleep(1200)
  253.     MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  254.     Sleep(400)
  255.     MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  256.     Sleep(200)
  257.     Call("CheckDead")
  258.     If Not $Dead and Not $Logout Then
  259.        Send("{ESCAPE}") ;closes repair tab
  260.        Sleep(100)
  261.        Send("{ESCAPE}") ;menu
  262.        Sleep(10)
  263.        MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  264.        Sleep($loadtime)
  265.        MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  266.        Sleep($loadtime)
  267.     EndIf
  268.     EndFunc
  269.  
  270.     Func MainMenu() ;verifies the screen is at the main menu before attempting to start the next game to avoid getting trapped in menus.
  271.           Local $Menu = False
  272.           While $Menu = False
  273.           $Pixeltestmm = PixelGetColor(Round(251*$x_ratio), Round(284*$y_ratio)) ;tests for main menu
  274.                  If Hex($Pixeltestmm, 6) == "683C02" Then
  275.                         $Menu = True
  276.                  Else
  277.                         $Pixeltestgm = PixelGetColor(Round(937*$x_ratio), Round(246*$y_ratio)) ;checks if game menu is open
  278.                         If Hex($Pixeltestgm, 6) == "621610" Then
  279.                            Send("{Escape}") ;return to main menu
  280.                            $Menu = True
  281.                         Else
  282.                            $Pixeltestgmexit = PixelGetColor(Round(975*$x_ratio), Round(428*$y_ratio)) ;checks if exit game menu is open
  283.                            If Hex($Pixeltestgmexit, 6) == "FFA300" Then
  284.                                   Send("{Escape}")
  285.                                   Send("{Escape}")
  286.                                   $Menu = True
  287.                            Else
  288.                                   $Pixeltestbm = PixelGetColor(Round(958*$x_ratio), Round(150*$y_ratio)) ;checks if banner customization window is open
  289.                                   If Hex($Pixeltestbm, 6) == "933618" Then
  290.                                          Send("{Escape}")
  291.                                          $Menu = True
  292.                                   Else
  293.                                          $Pixeltestpm = PixelGetColor(Round(1506*$x_ratio), Round(138*$y_ratio)) ;checks if player window is open
  294.                                          If Hex($Pixeltestpm, 6) == "320c08" Then
  295.                                                 Send("{Escape}")
  296.                                                 $Menu = True
  297.                                          EndIf
  298.                                   EndIf
  299.                            EndIf
  300.                         EndIf
  301.                  EndIf
  302.           WEnd
  303.        EndFunc
  304.        
  305. Func Town()
  306.    $runMade = $runMade + 1
  307.    If $runMade > 5 Then
  308.       MouseClick("left", 890, 253)      ;go to chest
  309.       Sleep(2000)
  310.       MouseClick("left", 438, 223)      ; 1st tab
  311.       Sleep(500);
  312.       Call("DropInChest");
  313.       MouseClick("left", 436, 328)      ; 2nd tab
  314.       Sleep(500);
  315.       Call("DepositRare")
  316.       MouseClick("left", 436, 430)      ; 3rd tab
  317.       Sleep(500);
  318.       Call("DepositRare")
  319.       Send("{ESCAPE}") ;close windows
  320.       Sleep(500)
  321.       MouseClick("left", 767, 559)      ;go back to tp spot
  322.       Sleep(1500)
  323.       MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  324.       Sleep(1500)
  325.       MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  326.       Sleep(1500)
  327.       MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  328.       Sleep(1200)
  329.       VendorAll()
  330.       ;SellBlue()
  331.       ;Sleep(500)
  332.       ;SellWhite()
  333.       MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  334.       Sleep(400)
  335.       MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  336.       Sleep(200)
  337.       Send("{ESCAPE}") ;close windows
  338.       Sleep(500)
  339.       $runMade = 0
  340.    EndIf
  341. EndFunc
  342.  
  343. Func DropInChest()
  344.    $Tomes = PixelSearch(1170,513,1593,758,0x7B4B1D)
  345.    If Not @error Then
  346.          MouseClick("right", $Tomes[0], $Tomes[1])
  347.          Sleep(500)
  348.          $i+= 1
  349.          If $i <= 10 Then
  350.                Call("DropInChest")
  351.          EndIf
  352.    EndIf
  353.    $Amethyst1 = PixelSearch(1170,513,1593,758,0xC246FD)
  354.    If Not @error Then
  355.          MouseClick("right", $Amethyst1[0], $Amethyst1[1])
  356.          Sleep(500)
  357.          $i+= 1
  358.          If $i <= 10 Then
  359.                Call("DropInChest")
  360.          EndIf
  361.    EndIf
  362.    $Amethyst2 = PixelSearch(1170,513,1593,758,0xC140FB)
  363.    If Not @error Then
  364.          MouseClick("right", $Amethyst2[0], $Amethyst2[1])
  365.          Sleep(500)
  366.          $i+= 1
  367.          If $i <= 10 Then
  368.                Call("DropInChest")
  369.          EndIf
  370.    EndIf
  371.    $Ruby1 = PixelSearch(1170,513,1593,758,0xE0110D)
  372.    If Not @error Then
  373.          MouseClick("right", $Ruby1[0], $Ruby1[1])
  374.          Sleep(500)
  375.          $i+= 1
  376.          If $i <= 10 Then
  377.                Call("DropInChest")
  378.          EndIf
  379.       EndIf
  380.    $Ruby2 = PixelSearch(1170,513,1593,758,0xF10E10)
  381.    If Not @error Then
  382.          MouseClick("right", $Ruby2[0], $Ruby2[1])
  383.          Sleep(500)
  384.          $i+= 1
  385.          If $i <= 10 Then
  386.                Call("DropInChest")
  387.          EndIf
  388.    EndIf
  389.    $Emerald1 = PixelSearch(1170,513,1593,758,0x46E245)
  390.    If Not @error Then
  391.          MouseClick("right", $Emerald1[0], $Emerald1[1])
  392.          Sleep(500)
  393.          $i+= 1
  394.          If $i <= 10 Then
  395.                Call("DropInChest")
  396.          EndIf
  397.       EndIf
  398.    $Emerald2 = PixelSearch(1170,513,1593,758,0x49DE45)
  399.    If Not @error Then
  400.          MouseClick("right", $Emerald2[0], $Emerald2[1])
  401.          Sleep(500)
  402.          $i+= 1
  403.          If $i <= 10 Then
  404.                Call("DropInChest")
  405.          EndIf
  406.    EndIf
  407.    $Topaz1 = PixelSearch(1170,513,1593,758,0xDE930F)
  408.    If Not @error Then
  409.          MouseClick("right", $Topaz1[0], $Topaz1[1])
  410.          Sleep(500)
  411.          $i+= 1
  412.          If $i <= 10 Then
  413.                Call("DropInChest")
  414.          EndIf
  415.       EndIf  
  416.    
  417.    $Topaz2 = PixelSearch(1170,513,1593,758,0xCB8100)
  418.    If Not @error Then
  419.          MouseClick("right", $Topaz2[0], $Topaz2[1])
  420.          Sleep(500)
  421.          $i+= 1
  422.          If $i <= 10 Then
  423.                Call("DropInChest")
  424.          EndIf
  425.       EndIf
  426. EndFunc
  427.  
  428. Func VendorAll()
  429.    For $i = 0 To 9 Step 1
  430.       MouseClick("right", 1206 + (40 * $i), 525)
  431.       Sleep(25)
  432.       MouseClick("right", 1206 + (40 * $i), 525 + 40)
  433.       Sleep(25)
  434.       MouseClick("right", 1206 + (40 * $i), 525 + 80)
  435.       Sleep(25)
  436.       MouseClick("right", 1206 + (40 * $i), 525 + 120)
  437.       Sleep(25)
  438.       MouseClick("right", 1206 + (40 * $i), 525 + 160)
  439.       Sleep(25)
  440.       MouseClick("right", 1206 + (40 * $i), 525 + 200)
  441.       Sleep(25)
  442.    Next
  443. EndFunc
  444.  
  445. Func DepositRare()
  446.     Sleep(Random(200,700))
  447.     $unique1 = PixelSearch(1170,513,1593,758,0x693B0E) ; unique1
  448.     If Not @error Then
  449.        MouseClick ('right', $unique1[0], $unique1[1])
  450.        Sleep(Random(300,600))
  451.        $i+= 1
  452.        If $i <= 8 Then
  453.               Call("DepositRare")
  454.        EndIf
  455.     EndIf
  456.     $unique2= PixelSearch(1170,513,1593,758,0x9B6429) ; unique2
  457.     If Not @error Then
  458.        MouseClick ('right', $unique2[0], $unique2[1])
  459.        Sleep(Random(200,600))
  460.        $i+= 1
  461.        If $i <= 8 Then
  462.               Call("DepositRare")
  463.        EndIf
  464.     EndIf
  465.    $rare1 = PixelSearch(1170,513,1593,758,0x554914) ; rare1
  466.    If Not @error Then
  467.          MouseClick ('right', $rare1[0], $rare1[1])
  468.          Sleep(Random(200,500))
  469.          $i+= 1
  470.          If $i <= 8 Then
  471.                Call("DepositRare")
  472.          EndIf
  473.    EndIf
  474.    $rare2 = PixelSearch(1170,513,1593,758,0x7E711B) ; rare2
  475.    If Not @error Then
  476.          MouseClick ('right', $rare2[0], $rare2[1])
  477.          Sleep(Random(300,500))
  478.          $i+= 1
  479.          If $i <= 8 Then
  480.                Call("DepositRare")
  481.          EndIf
  482.    EndIf
  483.    $rare3 = PixelSearch(1170,513,1593,758,0x8E8725) ; rare3
  484.    If Not @error Then
  485.          MouseClick("right", $rare3[0], $rare3[1])
  486.          Sleep(500)
  487.          $i+= 1
  488.          If $i <= 8 Then
  489.                Call("DepositRare")
  490.          EndIf
  491.    EndIf
  492.    $rare4 = PixelSearch(1170,513,1593,758,0x817726) ; rare4
  493.    If Not @error Then
  494.          MouseClick("right", $rare4[0], $rare4[1])
  495.          Sleep(500)
  496.          $i+= 1
  497.          If $i <= 8 Then
  498.                Call("DepositRare")
  499.          EndIf
  500.    EndIf
  501.    $rare5 = PixelSearch(1170,513,1593,758,0x5B4A08) ; rare5
  502.    If Not @error Then
  503.          MouseClick("right", $rare5[0], $rare5[1])
  504.          Sleep(500)
  505.          $i+= 1
  506.          If $i <= 8 Then
  507.                Call("DepositRare")
  508.          EndIf
  509.    EndIf
  510.    $rare6 = PixelSearch(1170,513,1593,758,0x8D831F) ; rare6
  511.    If Not @error Then
  512.          MouseClick("right", $rare6[0], $rare6[1])
  513.          Sleep(500)
  514.          $i+= 1
  515.          If $i <= 8 Then
  516.                Call("DepositRare")
  517.          EndIf
  518.    EndIf
  519. EndFunc
  520.  
  521.      
  522.     Func CheckLoot()
  523.     Sleep(Random(500,2000))
  524.     $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
  525.     If Not @error Then
  526.        MouseClick ('left', $SetLoot[0], $SetLoot[1])
  527.        Sleep(Random(800,1200))
  528.        $i+= 1
  529.        If $i <= 6 Then
  530.               Call("CheckLoot")
  531.        EndIf
  532.     EndIf
  533.     $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
  534.     If Not @error Then
  535.        MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1])
  536.        Sleep(Random(800,1200))
  537.        $i+= 1
  538.        If $i <= 6 Then
  539.               Call("CheckLoot")
  540.        EndIf
  541.     EndIf
  542.     If $LootRares Then
  543.        $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
  544.        If Not @error Then
  545.               MouseClick ('left', $RareLoot[0], $RareLoot[1])
  546.               Sleep(Random(700,900))
  547.               $i+= 1
  548.               If $i <= 6 Then
  549.                      Call("CheckLoot")
  550.               EndIf
  551.        EndIf
  552.     EndIf
  553.     If $LootBlues Then
  554.        $BlueLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x5555CD, 2) ; blue loot (darker for compatibility)
  555.        If Not @error Then
  556.               MouseClick ('left', $BlueLoot[0], $BlueLoot[1])
  557.               Sleep(Random(700,900))
  558.               $i+= 1
  559.               If $i <= 6 Then
  560.                      Call("CheckLoot")
  561.               EndIf
  562.        EndIf
  563.     EndIf
  564.     If $LootGems Then
  565.        $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
  566.        If Not @error Then
  567.               MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
  568.               Sleep(Random(900,1400))
  569.               $i+= 1
  570.               If $i <= 10 Then
  571.                      Call("CheckLoot")
  572.               EndIf
  573.        EndIf
  574.        $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
  575.        If Not @error Then
  576.               MouseClick("left", $RubyDrop[0], $RubyDrop[1])
  577.               Sleep(Random(900,1400))
  578.               $i+= 1
  579.               If $i <= 10 Then
  580.                      Call("CheckLoot")
  581.               EndIf
  582.        EndIf
  583.        $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
  584.        If Not @error Then
  585.               MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
  586.               Sleep(Random(900,1400))
  587.               $i+= 1
  588.               If $i <= 10 Then
  589.                      Call("CheckLoot")
  590.               EndIf
  591.        EndIf
  592.        $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
  593.        If Not 1 = 1 Then ; change to 'If Not @error Then' if you want to search for topazes
  594.               MouseClick("left", $TopazDrop[0], $TopazDrop[1])
  595.               Sleep(Random(900,1400))
  596.               $i+= 1
  597.               If $i <= 10 Then
  598.                      Call("CheckLoot")
  599.               EndIf
  600.        EndIf
  601.     EndIf
  602.     EndFunc
  603.      
  604.     Func Pause()
  605.        $Leave = False
  606.     EndFunc
  607.      
  608.     Func Stop() ;to allow the script to stop
  609.         Exit
  610.     EndFunc
  611.      
  612.     Func Leave()
  613.        $Leave = True
  614.     EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement