Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;notAres' Sarkoth DH Gold Script 1.6e - 6/14/2012 - Gem stashing added. Multiple fixes with new functions. Added exit game check.
- ;YOU MUST START THE BOT AT THE RESUME GAME SCREEN NOW!
- ;Thread: http://ownedcore.com/forums/diablo-3/diablo-3-bots-programs/354464-goldfarming-notares-sarkoth-dh-gold-script-autoit-script-1920x1080.html
- ;;;;;
- ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
- ;Required build: http://us.battle.net/d3/en/calculator/demon-hunter#aRYXVT!aTW!YcaZbY
- ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
- ;Official supported resolution: 1920x1080
- ;;;;;
- ;Original by mackus101 @ ownedcore
- ;ImageSearch contributions by rvbfreak, goofinator, and asuRob
- ;Refactoring and additional functions by Shimizoki
- ;=========== DO NOT TOUCH ===========;
- #RequireAdmin
- ;#include <ImageSearch.au3> ;NO LONGER INCLUDED! Function added to script. Duh. :)
- #include <GUIConstantsEx.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- ;=========== OCR ===========;
- #include <Tesseract.au3>
- Global $numitem, $numgem, $numtomb, $numgold, $numpot, $monold = 0
- ;====================================;
- Opt('MouseCoordMode', 2)
- Opt('PixelCoordMode', 2)
- Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $ver = "1.6e", $Paused, $go = True, $Leave = False, $Dead = False, $Logout = False, $i = 0, $gX = 0, $gY = 0, $LegendaryCount = 0, $SetCount = 0, $RareCount = 0, $MagicCount = 0, $GemCount = 0, $TomeCount = 0, $t = TimerInit(), $rt = 0, $run = 0, $yellow = 0xFFF000, $red = 0xD90000
- If @OSArch = "X64" Then DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
- If $size = 0 Then
- MsgBox(16,"Error","Diablo III is not running, cannot grab resolution!" & @CRLF & "Exiting...")
- Exit
- EndIf
- ;====================================;
- ;============= SETTINGS =============;
- ;Change to match your abilities (1-4 by default)z
- $skillCaltrops = "1"
- $skillSmokeScreen = "2"
- $skillPreparation = "3"
- $skillCompanion = "4"
- $movementSpeed = 0 ;This is the % increase movement speed you have. 25 = 25%, 0 = 0%, 50 = 50%
- ;Custom Loot
- $pngLoc = "C:\pics\" ;Location of the .PNGs (NO SUBFOLDERS - ALL PNGS GO HERE)
- $totalItems = 1 ;Number of items in the pick array
- Global $pick[$totalItems] ;DONT CHANGE THIS
- ;Array of items to loot (GEMS AND TOMES ALREADY INCLUDED)
- $pick[0] = "mythic.png|120" ;png|Tolerance
- ;Looting
- $LootSets = True ;True if you want to pick up Sets
- $LootLegendaries = True ;True if you want to pick up Legendaries
- $LootRares = True ;True if you want to pick up Rares
- $LootMagic = True ;True if you want to pick up Magic
- $LootGems = True ;True if you want to pick up Gems
- $LootTomes = True ;True if you want to pick up Tome of Secrets
- $LootCustom = false ;True if you want to pick up Custom Items (The items in the pick array above)
- ;Manage Loot
- $mLoot = 6 ;Nuber of successful runs until Stash and Vendor
- $mLootOff = 2 ;Stash and Vendor after mLoot +- X number of runs (Variability)
- ;Stashing
- $StashLoot = True ;True if you want to store Items in the stash
- $StashLegendary = True ;True if you want to store Legendary items in the stash
- $StashRare = True ;True if you want to store Rare items in the stash
- $StashMagic = False ;True if you want to store Magic items in the stash
- $StashTomes = True ;True if you want to store Tomes items in the stash
- $StashGems = True ;True if you want to store Gems items in the stash
- ;Vendoring
- $VendorLoot = True ;True if you want to vendor Items
- $VendorRare = False ;True if you want to vendor Rares
- $VendorMagic = True ;True if you want to vendor Magic
- ;Variability
- $Timer = False ;True and the bot will add random sleep intervals
- $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
- $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
- $tptime = 6900 ; time in ms the script waits for teleport before exiting the game
- ;====================================;
- $x_ratio = $size[0] / 1920
- $y_ratio = $size[1] / 1080
- $mLootIn = $mLoot ;DO NOT CHANGE, how many more runs till next manage
- $movementSpeed = 1+($movementSpeed/100)
- $VersionsInfo = "http://pastebin.com/raw.php?i=L8hHSZJi"
- $oldVersion = IniRead("updater.ini","Version","Version",$ver)
- $newVersion = "0.0"
- ;Call("DoUpdate")
- HotKeySet("=","Leave") ;script started by pressing =
- HotKeySet("-", "Pause") ;script paused by pressing -
- HotKeySet("x", "Stop") ;script stopped by pressing x
- HotKeySet("z", "ShowLoot") ;script stopped by pressing z
- #Region ### START Koda GUI section ###
- $frmBot = GUICreate("notAres' Sarkoth Extension v" & $ver, 350, 136, Round(1540*$x_ratio), Round(900*$y_ratio), -1, BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
- GUISetBkColor(0xC0C0C0)
- $lblRun = GUICtrlCreateLabel("Run Number: 0 - Runs till vendor: 0", 4, 0, 280, 24)
- GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
- GUICtrlSetColor(-1, 0xFF0000)
- $lblLocation = GUICtrlCreateLabel("Location: Main Menu", 12, 20, 240, 17)
- $lblStatus = GUICtrlCreateLabel("Status: ", 12, 35, 240, 17)
- $lblLast = GUICtrlCreateLabel("Last Runtime: 0 seconds", 12, 50, 240, 17)
- $lblRuntime = GUICtrlCreateLabel("Total Runtime: 0 hours, 0 minutes", 12, 65, 240, 17)
- $lblGear = GUICtrlCreateLabel("Legendary: 0 - Set: 0 - Rare: 0", 12, 80, 240, 17)
- $lblItems = GUICtrlCreateLabel("Magic: 0 - Gems: 0 - Tomes: 0", 12, 95, 240, 17)
- $lblGold = GUICtrlCreateLabel("Gold: 0", 12, 110, 240, 17)
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- If Not FileExists($pngLoc & "MainMenu.png") Then
- MsgBox(16, "Fatal Error", "FATAL ERROR: Cannot find: " & $pngLoc & "MainMenu.png" & @CRLF & "Make sure your directory is set properly in the script")
- Exit
- EndIf
- While $go
- Call("RestartRun")
- WEnd
- Func RestartRun()
- If($Leave) Then
- $i = 0
- ;Checks if the player is in the Main Menu
- If CheckFor("MainMenu", "", Round(40*$x_ratio), Round(300*$y_ratio), Round(400*$x_ratio), Round(600*$y_ratio), 6, 100) Then
- GUICtrlSetData($lblRun, "Run Number: " & $run & " - Runs till vendor: " & $mLootIn)
- GUICtrlSetData($lblLocation, "Location: Main Menu")
- GUICtrlSetData($lblStatus, "Status: Starting Game")
- While True
- RandClick("left", Round(230*$x_ratio), Round(416*$y_ratio), 120, 20) ;Random Click on the resume button
- If CheckFor("LimitError", "", Round(720*$x_ratio), Round(480*$y_ratio), Round(960*$x_ratio), Round(600*$y_ratio), 3, 60) Then
- Sleep(Random(1000, 2000))
- RandClick("left", Round(960*$y_ratio), Round(635*$x_ratio), 50 ,10)
- $rand = Random(40000, 80000)
- GUICtrlSetData($lblStatus, "Status: Input Limit - Waiting " & Round($rand/1000) & " seconds.")
- Sleep($rand)
- Else
- ExitLoop
- EndIf
- WEnd
- $rt = TimerInit()
- $Logout = False
- ElseIf Call("CheckDead") Then
- Return
- ElseIf CheckFor("ExitGame", "", Round(700*$x_ratio), Round(340*$y_ratio), Round(1200*$x_ratio), Round(500*$y_ratio), 3, 60) Then
- MouseClick("left", Round(1064*$x_ratio), Round(632*$y_ratio))
- Sleep(100)
- Send("{SPACE}")
- Return
- Else
- GUICtrlSetData($lblStatus, "ERROR: Cannot find Resume button")
- Return
- EndIf
- If CheckFor("OldRuins", "Area", 1500*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 80*$y_ratio, 6, 180) Then
- GUICtrlSetData($lblLocation, "Location: Old Ruins")
- ;Check if player needs to repair
- Call("CheckRepair")
- ;Start Run
- MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
- Send("{4 DOWN}")
- Sleep(3500)
- Send("{4 UP}")
- Sleep(100)
- MouseMove(Round(356*$x_ratio),Round(200*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
- Sleep(790)
- If Call("CheckDead") Then
- Return
- EndIf
- ;Checks if Dank Cellar is Open
- $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3)
- If Not @error Then
- GUICtrlSetData($lblStatus, "Status: Cellar - Found")
- $run += 1
- MouseClick("left", Round(356*$x_ratio), Round(200*$y_ratio), 1) ;Entrance to cellar
- Moving(550)
- Send($skillSmokeScreen)
- Moving($walktime)
- Else ;ABORT RUN
- GUICtrlSetData($lblStatus, "Status: Cellar - Not Found" & @CRLF)
- Sleep(10)
- RandClick("middle", Round(1100*$x_ratio), Round(600*$y_ratio)) ;moves between caltrops for safety before teleporting back to town
- Moving(250)
- Send($skillCaltrops)
- Sleep(620)
- Send($skillSmokeScreen)
- Sleep(40)
- Call("TownPortal")
- If Not Call("CheckDead") Then
- Call("LeaveGame")
- EndIf
- Return
- EndIf
- Else
- Call("TownPortal")
- If Not Call("CheckDead") Then
- Call("LeaveGame")
- EndIf
- Return
- EndIf
- ;Checks that the player is in the Dank Cellar
- If CheckFor("DankCellar", "Area", 1560*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 60*$y_ratio) Then
- GUICtrlSetData($lblLocation, "Location: Dank Cellar")
- MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
- Sleep(Random(2200, 2800))
- Send(3)
- Sleep(30)
- MouseClick("middle",Round(440*$x_ratio),Round(80*$y_ratio), 1) ;attacks the rare Sarkoth
- Sleep(2100)
- Send("{SHIFTDOWN}")
- Sleep(10)
- GUICtrlSetData($lblStatus, "Status: Attacking Sarkoth")
- MouseClick("left")
- Sleep(10)
- Send(2)
- Sleep(10)
- MouseDown("right") ;attack middle
- Sleep(3500)
- MouseClick("right",Round(960*$x_ratio),Round(502*$y_ratio),2)
- Sleep(100)
- Send("{SHIFTUP}")
- Sleep(10)
- Send(3)
- Sleep(10)
- GUICtrlSetData($lblStatus, "Status: Looting")
- MouseClick("middle",Round(637*$x_ratio),Round(540*$y_ratio)) ;move to left top corner for gold
- Sleep(1100)
- MouseClick("middle",Round(1320*$x_ratio),Round(310*$y_ratio)) ;move to right top corner for gold
- Sleep(1100)
- MouseClick("middle",Round(975*$x_ratio),Round(827*$y_ratio)) ;move to middle before
- $numitem =0
- $numgem=0
- $numtomb=0
- $numgold=0
- $numpot=0
- GUICtrlSetData($lblStatus, "Status: Looting")
- Call("Loot")
- RandSleep(1, 6, 50)
- Send("i")
- Sleep(140)
- $mon = _TesseractScreenCapture( 0, "", 1, 2,1454,508,1920-1571,1080-525, 0)
- $mon = StringReplace($mon , ",", "")
- $mon = StringReplace($mon , @CRLF, "")
- $mon = StringReplace($mon , " ", "")
- $mondelt = Number($mon) - Number($monold)
- Call("AddLog",'Gold: ' & $mon & ', Gold Delt: ' & $mondelt & ', Items: ' & $numitem & ', Gems: ' & $numgem & ', Books: ' & $numtomb & ', Potions: ' & $numpot & ', GoldPick: ' & $numgold)
- Send("i")
- GUICtrlSetData($lblGold, "Gold: " & $mon & ", This Run: " & $mondelt)
- $monold=$mon
- Call("TownPortal")
- Else
- Sleep(620)
- Sleep(40)
- Call("TownPortal")
- If Not Call("CheckDead") Then
- Call("LeaveGame")
- EndIf
- EndIf
- ;After successful run
- If Not $Logout And Not $Dead Then
- If $mLootIn == 1 And CheckFor("NewTristram", "Area", 1500*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 80*$y_ratio, 6, 180) Then ;If its time to manage loot and we are in town
- If $StashLoot Then
- Call("StashLoot")
- EndIf
- If $VendorLoot Then
- Call("VendorLoot")
- EndIf
- $mLootIn = Round(Random($mLoot-$mLootOff, $mLoot+$mLootOff)) ;Reset Counter
- ElseIf Not CheckFor("NewTristram", "Area", 1500*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 80*$y_ratio, 6, 180) Then
- GUICtrlSetData($lblStatus, "Status: Skipping vendor")
- Sleep(1000)
- Else
- $mLootIn -= 1
- EndIf
- If Not Call("CheckDead") Then
- Call("LeaveGame")
- EndIf
- Return
- Else
- Return
- EndIf
- EndIf
- EndFunc
- ;Helper Functions
- Func AddLog($logtxt)
- Local $file = FileOpen("log.txt", 1)
- $msg = @MDAY & '/' & @MON & '/' & @YEAR & ' ' & @HOUR & ':' & @MIN & ':' & @SEC & ': ' & $logtxt & @CRLF
- FileWrite($file, $msg )
- FileClose($file)
- ConsoleWrite( $msg)
- EndFunc
- Func CheckDead()
- $LogoutTimerCancel = PixelSearch(Round(900*$x_ratio), Round(240*$y_ratio), Round(1010*$x_ratio), Round(290*$y_ratio), 0x993827) ; checks for cancel button on logout timer
- If Not @error Then
- $Logout = True
- Call("AddLog","Logged out")
- GUICtrlSetData($lblStatus, "Status: Logging out")
- Sleep(11000)
- Sleep($loadtime)
- Return 1
- EndIf
- $YouHaveDied = PixelSearch(Round(620*$x_ratio), Round(325*$y_ratio), Round(625*$x_ratio), Round(330*$y_ratio), 0xFFFFFF) ; checks for white text "YOU HAVE DIED"
- If Not @error Then
- GUICtrlSetData($lblStatus, "Status: Dead")
- Call("AddLog","You have died")
- $Dead = True
- Call("LeaveGame")
- Sleep(11000)
- Return 1
- Else
- $Dead = False
- Return 0
- EndIf
- EndFunc
- Func CheckRepair()
- $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
- If Not @error Then
- Call("DoRepair")
- EndIf
- $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
- If Not @error Then
- Call("DoRepair")
- EndIf
- EndFunc
- Func DoRepair()
- Sleep(Random(75, 150))
- Call("TownPortal")
- If Call("CheckDead") Then
- Return
- EndIf
- If CheckFor("NewTristram", "Area", 1500*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 80*$y_ratio, 6, 180) Then
- RandClick("left", Round(1480*$x_ratio),Round(281*$y_ratio),1,1) ;begin movement towards merchant
- Moving(1875)
- RandClick("left", Round(1316*$x_ratio),Round(206*$y_ratio),1,1) ;moves to get merchant in screen
- Moving(1875)
- RandClick("left", Round(845*$x_ratio),Round(225*$y_ratio),1,1) ;NPC Merchant to the right of cain's home
- Sleep(1200)
- RandClick("left", Round(521*$x_ratio),Round(506*$y_ratio),1,1) ;button to open up repair menu
- Sleep(400)
- RandClick("left", Round(260*$x_ratio),Round(595*$y_ratio),1,1) ;button to pay for repairs
- Sleep(200)
- Send("{Escape}")
- Call("AddLog","Repair")
- If Not Call("CheckDead") Then
- Call("LeaveGame")
- EndIf
- EndIf
- EndFunc
- Func CalcTime()
- $srt = TimerDiff($rt)
- GUICtrlSetData($lblLast, "Last Runtime: " & Round($srt/1000,2) & " seconds.")
- $trt = TimerDiff($t)
- $total = Round((($trt/1000)/60)/60,4)
- ;Total runtiume calculation.
- $hours = Floor((($trt/1000)/60)/60)
- $minutes = (($trt/1000)/60)
- ;trim minutes if runtime is more then 1 hour.
- If $minutes > 60 Then
- While $minutes > 60
- $minutes -=60
- WEnd
- EndIf
- GUICtrlSetData($lblRuntime, "Total Runtime: " & $hours & " hours, "& Ceiling($minutes) &" minutes")
- EndFunc
- Func CheckFor($img, $type = "", $startX = 0, $startY = 0, $endX = @DesktopWidth, $endY = @DesktopHeight, $seconds = 5 ,$tolerance = 130)
- $c = 0
- $string = $pngLoc & $img & ".png"
- Do
- $c +=1
- Sleep(100)
- If $c > ($seconds*10) Then ;Make sure we never get stuck here for infinity.
- If $type = "Area" Then
- GUICtrlSetData($lblStatus, "Status: Area not found - " & $img)
- EndIf
- Return False
- EndIf
- Until _ImageSearchArea($string, 1, $startX, $startY, $endX, $endY, $gX, $gY, $tolerance)
- Return True
- EndFunc
- Func LeaveGame()
- $Logout = True
- Call("RandSleep")
- GUICtrlSetData($lblStatus, "Status: Leaving Game")
- Sleep(Random(100, 500))
- Send("{Escape}")
- Sleep(Random(100, 500))
- RandClick("left", Round(956*$x_ratio), Round(579*$y_ratio), 120, 20) ;Random Click on the leave button
- Call("CalcTime")
- EndFunc
- Func Loot()
- Sleep(Random(500,2000))
- MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
- If $LootSets Then
- $SetCount += LootGear(0x02CE01, 2)
- EndIf
- If $LootLegendaries Then
- $LegendaryCount += LootGear(0xBF642F, 0)
- EndIf
- If $LootRares Then
- $RareCount += LootGear(0xBBBB00, 2)
- EndIf
- If $LootMagic Then
- $MagicCount += LootGear(0x6969FF, 2)
- EndIf
- If $LootGems Then
- Call("LootGems")
- EndIf
- If $LootTomes Then
- Call("LootTomes")
- EndIf
- If $LootCustom Then
- Call("LootCustom")
- EndIf
- Call("ShowLoot")
- EndFunc
- Func LootGear($color, $tolerance = 2)
- $count = 0
- $Loot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $color, $tolerance)
- If Not @error Then
- While Not @error
- $count += 1
- MouseClick ('left', $Loot[0], $Loot[1])
- Sleep(Random(700,900))
- MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
- ;Run at max 10 times per quality
- If $count >= 10 Then
- ExitLoop
- EndIf
- $Loot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $color, $tolerance)
- WEnd
- EndIf
- $numitem += $count;
- Return $count
- EndFunc
- Func LootCustom()
- $gX = 0
- $gY = 0
- for $i = 0 to ($totalItems - 1)
- $array = StringSplit($pick[$i],"|")
- $file = $array[1]
- $accuracy = $array[2]
- $urlString = $pngLoc & $file
- $count = 0
- While _ImageSearchArea($pngLoc & $file,1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,$accuracy)
- $count += 1
- if $i = 0 then $numpot+=1
- if $i = 1 then $numgold+=1
- sleep(Random(75, 150))
- MouseClick("left",$gX,$gY,1,1)
- sleep(Random(800, 1200))
- MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
- If $count >= 10 Then
- ExitLoop
- EndIf
- WEnd
- next
- EndFunc
- Func LootGems()
- $gX = 0
- $gY = 0
- While _ImageSearchArea($pngLoc & "square.png",1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,90)
- sleep(Random(75, 150))
- MouseClick("left",$gX,$gY)
- $GemCount += 1
- $numgem += 1
- sleep(Random(800, 1200))
- MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
- WEnd
- EndFunc
- Func LootTomes()
- $gX = 0
- $gY = 0
- While _ImageSearchArea($pngLoc & "tome.png",1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,90)
- sleep(Random(75, 150))
- MouseClick("left",$gX,$gY)
- $TomeCount += 1
- $numtomb += 1
- sleep(Random(800, 1200))
- MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
- WEnd
- EndFunc
- Func Moving($time)
- Sleep($time/$movementSpeed)
- EndFunc
- Func RandClick($clickType, $xPos, $yPos, $xOff = 20, $yOff = 20)
- $randX = Round(Random($xPos-($xOff*$x_ratio), $xPos+($xOff*$x_ratio)))
- $randY = Round(Random($yPos-($yOff*$y_ratio), $yPos+($yOff*$y_ratio)))
- MouseClick($clickType, $randX, $randY)
- EndFunc
- Func RandMove($xPos, $yPos, $xOff = 20, $yOff = 20)
- $randX = Round(Random($xPos-($xOff*$x_ratio), $xPos+($xOff*$x_ratio)))
- $randY = Round(Random($yPos-($yOff*$y_ratio), $yPos+($yOff*$y_ratio)))
- MouseMove($randX, $randY)
- EndFunc
- Func RandSleep($min = 30, $max = 45, $chance = 5)
- $randNum = Round(Random(1, 100))
- If $Timer And $randNum <= $chance Then
- $sleepTime = Random($min*1000, $max*1000)
- GUICtrlSetData($lblStatus, "Status: Random Sleep - " & Round($sleepTime/1000) & " secs")
- For $c = 0 To 10
- Sleep($sleepTime/10)
- Next
- EndIf
- EndFunc
- Func TownPortal()
- GUICtrlSetData($lblStatus, "Status: Returning to Town")
- Send("t")
- Sleep(Random($tptime, $tptime+500))
- EndFunc
- Func StashLoot()
- GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
- Sleep(Random(1000, 1500))
- MouseClick("left", 1064*$x_ratio, 256*$y_ratio)
- Sleep(Random(1500, 2000))
- $numstashed=0;
- ;Legendaries
- if $StashLegendary then
- StashItems(0xFF7F00, 0)
- StashItems(0x8F5C25, 1)
- EndIf
- ;$sc = 0
- ;While $sc < 5
- ;Sleep(Random(200, 300))
- ;$LegendPixel = PixelSearch(1400*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0xFF7F00, 0)
- ;$LegendPixel = PixelSearch(1400*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0xFF7F00, 0)
- ;If Not @error Then
- ;GUICtrlSetData($lblStatus, "Status: Stashing Legendaries")
- ;MouseClick("right", $LegendPixel[0], $LegendPixel[1])
- ;$numstashed += 1;
- ;Else
- ;ExitLoop
- ;EndIf
- ;$sc += 1
- ;WEnd
- ;if $sc=5 then Call("AddLog","Stash full")
- ;EndIf
- ;==>StashItems
- ;Rares
- if $StashRare then
- $sc = 0
- While $sc < 10
- Sleep(Random(200, 300))
- $RarePixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x544A11, 1)
- If Not @error Then
- GUICtrlSetData($lblStatus, "Status: Stashing Rares")
- MouseClick("right", $RarePixel[0], $RarePixel[1])
- $numstashed += 1;
- Else
- ExitLoop
- EndIf
- $sc += 1
- WEnd
- if $sc=10 then Call("AddLog","Stash full")
- EndIf
- ;Tomes
- While $StashTomes == True
- Sleep(Random(100, 300))
- If _ImageSearchArea($pngLoc & "TomeIcon.png", 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $gX, $gY, 140) Then
- GUICtrlSetData($lblStatus, "Status: Stashing Tomes")
- MouseClick("left", 500 * $x_ratio, 360 * $y_ratio, 1, 4)
- MouseClick("right", $gX, $gY, 1, 4)
- Sleep(80)
- MouseClick("left", 500 * $x_ratio, 200 * $y_ratio, 1, 4)
- Else
- ExitLoop
- EndIf
- WEnd
- ;old tomes
- ;If _ImageSearchArea($pngLoc & "TomeIcon.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,200) Then
- ; GUICtrlSetData($lblStatus, "Status: Stashing Tomes")
- ; MouseClick("right",$gX,$gY,1,1)
- ; Sleep(Random(400, 600))
- ;EndIf
- ;Magic
- if $StashMagic then
- $sc = 0
- While $sc < 20
- Sleep(Random(100, 300))
- $MagicPixel = PixelSearch(1400*$x_ratio, 580*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 1)
- If Not @error Then
- GUICtrlSetData($lblStatus, "Status: Stashing Magic")
- MouseClick("right", $MagicPixel[0], $MagicPixel[1])
- $numstashed += 1;
- Else
- ExitLoop
- EndIf
- $sc += 1
- WEnd
- if $sc=20 then Call("AddLog","Stash full")
- EndIf
- Call("AddLog","Stashed Items: " & $numstashed )
- ;Gems
- If $StashGems Then
- GUICtrlSetData($lblStatus, "Status: Stashing Gems")
- for $gemtype = 1 to 8
- if $gemtype = 1 then $gemnane = "Ru1.png"
- if $gemtype = 2 then $gemnane = "Ru2.png"
- if $gemtype = 3 then $gemnane = "Em1.png"
- if $gemtype = 4 then $gemnane = "Em2.png"
- if $gemtype = 5 then $gemnane = "To1.png"
- if $gemtype = 6 then $gemnane = "To2.png"
- if $gemtype = 7 then $gemnane = "Am1.png"
- if $gemtype = 8 then $gemnane = "Am2.png"
- If _ImageSearchArea($pngLoc & $gemnane ,1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,180) Then
- GUICtrlSetData($lblStatus, "Status: Stashing Gems")
- MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
- Sleep(Random(200, 500))
- MouseClick("right",$gX,$gY,1,1)
- Sleep(Random(400, 600))
- MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
- Sleep(Random(200, 500))
- EndIf
- Next
- EndIf
- Sleep(Random(1000, 3000))
- Send("{SPACE}")
- EndFunc
- Func StashItems($color, $tolerance)
- $sc = 0
- While $sc <= 20
- Sleep(Random(20, 100))
- $StashPixel = PixelSearch(1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $color, $tolerance)
- If Not @error Then
- MouseClick("right", $StashPixel[0] + 4, $StashPixel[1], 1, 4)
- $sc += 1
- Else
- ExitLoop
- EndIf
- WEnd
- EndFunc
- Func VendorLoot()
- GUICtrlSetData($lblStatus, "Status: Vendoring Items")
- If Not $StashLoot Then ;Move from TP towards vendor
- Sleep(Random(300, 500))
- MouseClick("middle", 1565*$x_ratio, 50*$y_ratio)
- Else ;Move from Stash towards vendor
- Sleep(Random(300, 500))
- MouseClick("middle", 1560*$x_ratio, 120*$y_ratio)
- EndIf
- Sleep(3000)
- Send("c")
- Sleep(700)
- While _ImageSearchArea($pngLoc & "unidentified.png", 1, 1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, $gX, $gY, 120)
- GUICtrlSetData($lblStatus, "Status: Identifying")
- Sleep(Random(75, 150))
- RandClick("right",$gX,$gY,1,1)
- Sleep(Random(2400, 2800))
- WEnd
- Send("c")
- Sleep(600)
- MouseClick("left", 1030*$x_ratio, 210*$y_ratio) ;Talk to vendor
- Sleep(3000)
- $numsold=0;
- ;Rares
- If $VendorRare Then
- $c = 0
- While $c <= 10
- Sleep(Random(200, 300))
- $RarePixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x544A11, 1)
- If Not @error Then
- MouseClick("right", $RarePixel[0], $RarePixel[1])
- $numsold += 1
- $c += 1
- Else
- ExitLoop
- EndIf
- WEnd
- EndIf
- ;Magic
- If $VendorMagic Then
- $c = 0
- While $c <= 25
- Sleep(Random(200, 300))
- $MagicPixel = PixelSearch(1400*$x_ratio, 580*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 1)
- If Not @error Then
- MouseClick("right", $MagicPixel[0], $MagicPixel[1])
- $numsold += 1
- $c += 1
- Else
- ExitLoop
- EndIf
- WEnd
- EndIf
- Call("AddLog","Sold Items: " & $numsold )
- Sleep(200)
- RandClick("left", Round(521*$x_ratio),Round(506*$y_ratio),1,1) ;button to open up repair menu
- Sleep(300)
- RandClick("left", Round(260*$x_ratio),Round(595*$y_ratio),1,1) ;button to pay for repairs
- Sleep(200)
- Call("AddLog","Sell and Repair")
- Sleep(Random(1000, 3000))
- GUICtrlSetData($lblStatus, "Status: Done With Vendor")
- Send("{ESCAPE}")
- EndFunc
- Func DoUpdate()
- $Ini = InetGet($VersionsInfo,@ScriptDir & "\version.ini") ;download version.ini
- If $Ini = 0 Then ;was the download of version.ini successful?
- MsgBox(0,"ERROR","The server seems to be offline. No update will be done.")
- Else
- $newVersion = IniRead (@ScriptDir & "\version.ini","Version","Version","") ;reads the new version out of version.ini
- If $NewVersion = $oldVersion Then ;compare old and new
- ;MsgBox (0,"No update","There is no update available!")
- FileDelete(@ScriptDir & "\version.ini")
- Else
- $msg = MsgBox (4,"Update","There is a new version existing: " & $newVersion & " ! You are using: " & $oldVersion & ". Do you want to download the new version?")
- If $msg = 7 Then ;No was pressed
- FileDelete(@ScriptDir & "\version.ini")
- ElseIf $msg = 6 Then ;OK was pressed
- $downloadLink = IniRead(@ScriptDir & "\version.ini","Version","download","NotFound")
- $dlhandle = InetGet($downloadLink,@ScriptDir & "\Update.au3",1,1)
- ProgressOn("Update", "Downloading Updates", "",-1,-1,16) ;creates an progressbar
- $Size = InetGetSize($downloadLink,1) ;get the size of the update
- While Not InetGetInfo($dlhandle, 2)
- $Percent = (InetGetInfo($dlhandle,0)/$Size)*100
- ProgressSet( $Percent, $Percent & " percent") ;update progressbar
- Sleep(1)
- WEnd
- ProgressSet(100 , "Done", "Complete") ;show complete progressbar
- sleep(500)
- ProgressOff() ;close progress window
- IniWrite("updater.ini","version","version",$NewVersion)
- InetClose($dlhandle)
- $iniMsg = IniRead(@ScriptDir & "\version.ini","Version","message","Exiting...")
- MsgBox(-1,"Success","Download Complete! Please restart the bot by running Update.au3" & @CRLF & $iniMsg)
- FileDelete(@ScriptDir & "\version.ini")
- Exit
- EndIf
- EndIf
- EndIf
- EndFunc
- Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance)
- If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage
- $findImage = "*TRANSBLACK " & $findImage
- If @AutoItX64 Then
- $result = DllCall("ImageSearchDLL_x64.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)
- Else
- $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)
- EndIf
- If $result = "0" Then
- Return 0
- EndIf
- ; Otherwise get the x,y location of the match and the size of the image to
- ; compute the centre of search
- $array = StringSplit($result[0],"|")
- If(UBound($array) >= 4) Then
- $x=Int(Number($array[2]))
- $y=Int(Number($array[3]))
- If $resultPosition = 1 Then
- $x=$x + Int(Number($array[4])/2)
- $y=$y + Int(Number($array[5])/2)
- EndIf
- Return 1
- EndIf
- EndFunc
- ;Hotkey Functions
- Func Leave()
- $Leave = True
- EndFunc
- Func Pause()
- $Leave = False
- EndFunc
- Func TogglePause()
- $Paused = Not $Paused
- While $Paused
- Sleep(100)
- WinSetTitle("notAres", "", "notAres' DH Extension v" & $ver & " - Paused")
- ToolTip('Script is "Paused"', 0, 0)
- WEnd
- WinSetTitle("notAres", "", "notAres' DH Extension v" & $ver & " - Running")
- ToolTip("")
- EndFunc
- Func ShowLoot()
- GUICtrlSetData($lblGear, "Legendary: " & $LegendaryCount & " - Set: " & $SetCount & " - Rare: " & $RareCount)
- GUICtrlSetData($lblItems, "Magic: " & $MagicCount & " - Gems: " & $GemCount & " - Tomes: " & $TomeCount)
- EndFunc
- Func Stop() ;to allow the script to stop
- Exit
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement