;notAres' Sarkoth DH Gold Script 1.5d - 6/13/2012 - Added a GUI. Added autoupdate. Incorporated almost all of Shimizoki's changes
;YOU MUST START THE BOT AT THE RESUME GAME SCREEN NOW!
;Thread:
http://ownedcore.com/forums/diablo-3...1920x1080.html
;;;;;
;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
;Required build:
http://us.battle.net/d3/en/calculato...XVT!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
#include <ImageSearch.au3> ;comment this if you are not using the new looting system
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt('MouseCoordMode', 2)
Opt('PixelCoordMode', 2)
Global $size = WinGetClientSize("[CLASS

3 Main Window Class]"), $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 $size = 0 Then
MsgBox(16,"Error","Diablo III is not running, cannot grab resolution!" & @CRLF & "Exiting...")
Exit
ElseIf ($size[0]/$size[1]) <> 16/9 Then
$size[1]-=30 ;adjusts ratio for titlebar if not 16:9
EndIf
;============= SETTINGS =============;
;Change to match your abilities (1-4 by default)z
$skillCaltrops = "1"
$skillSmokeScreen = "2"
$skillPreparation = "3"
$skillCompanion = "4"
$movementSpeed = 25 ;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|40" ;png|Tolerance
;$pick[1] = "item2.png"
;$pick[2] = "item3.png"
;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 = False ;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
;Vendoring
$VendorLoot = True ;True if you want to vendor Items
$VendorRare = True ;True if you want to vendor Rares
$VendorMagic = True ;True if you want to vendor Magic
;Variability
$Timer = True ;True and the bot will add random sleep intervals
$walktime = 2800 ; 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","1.5d")
$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", 280, 121, Round(1540*$x_ratio), Round(920*$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: Starting Game", 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)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While $go
Call("RestartRun")
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func RestartRun()
If Not FileExists($pngLoc & "MainMenu.png") Then
MsgBox(16, "Fatal Error", "ERROR: Cannot find: " & $pngLoc & "MainMenu.png" & @CRLF & "Make sure your directory is set properly in the script")
Exit
EndIf
If($Leave) Then
Send("{SPACE}")
Sleep(100)
Send("{SPACE}")
$i = 0
;Checks if the player is in the Main Menu
If CheckFor("MainMenu") Then
$run += 1
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
Else
GUICtrlSetData($lblStatus, "ERROR: Cannot find Resume button")
Return
EndIf
If CheckFor("OldRuins", "Area", 1560*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 60*$y_ratio) Then
GUICtrlSetData($lblLocation, "Location: Old Ruins")
;Check if player needs to repair
Call("CheckRepair")
;Start Run
RandClick("middle", Round(500*$x_ratio), Round(250*$y_ratio), 5, 5) ;starts the run [waypoint 1]
Moving(1100)
Send($skillSmokeScreen)
Moving(440)
RandClick("middle", Round(3*$y_ratio), Round(370*$y_ratio), 2, 2) ;waits ~1 second then [waypoint 2]
Moving(1875)
RandClick("middle", Round(400*$x_ratio), Round(600*$y_ratio), 5, 5) ;middle of courtyard [waypoint 3]
Moving(50)
Send($skillSmokeScreen)
Moving(25)
Send($skillPreparation)
Moving(750)
Send($skillCaltrops)
Sleep(300)
RandMove(Round(300*$x_ratio),Round(70*$y_ratio), 5, 5) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
Sleep(100)
Call("CheckDead")
If $Dead or $Logout 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")
MouseClick("left", Round(300*$x_ratio), Round(70*$y_ratio), 1) ;Entrance to cellar
Moving(500)
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")
Call("LeaveGame")
Return
EndIf
Else
Call("TownPortal")
Call("LeaveGame")
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(100*$x_ratio), Round(1000*$y_ratio), 1) ;moves to doorway leading to rare inside cellar
Sleep(Random(2200, 2800))
MouseMove(Round(460*$x_ratio),Round(80*$y_ratio), 1) ;hovers over the rare Sarkoth
Sleep(10)
Send("{SHIFTDOWN}")
GUICtrlSetData($lblStatus, "Status: Attacking Sarkoth")
MouseDown("right") ;ATTACK
Sleep(1300)
Send($skillCompanion)
Sleep(3000)
MouseUp("right")
MouseClick("left",Round(460*$x_ratio),Round(80*$y_ratio),1)
MouseMove(Round(240*$x_ratio),Round(75*$y_ratio),1) ;attack left
Sleep(40)
MouseDown("right")
Sleep(2800)
MouseUp("right")
MouseMove(Round(590*$x_ratio),Round(50*$y_ratio),1) ;attack right
MouseDown("right")
Sleep(1800)
MouseUp("right")
MouseDown("left")
MouseMove(Round(Random(240,260)*$x_ratio),Round(75*$y_ratio),1) ;attack left
Sleep(1200)
MouseMove(Round(Random(560,600)*$x_ratio),Round(50*$y_ratio),1) ;attack right
Sleep(800)
MouseUP("left")
Sleep(10)
MouseClick("right", Round(630*$x_ratio), Round(18*$y_ratio)) ;break the table & chair
Sleep(Random(50, 150))
Send("{SHIFTUP}")
Sleep(Random(300, 750))
RandClick("middle", Round(530*$x_ratio), Round(190*$y_ratio)) ;location of sarkoth after death
Sleep(Random(1700, 2000))
GUICtrlSetData($lblStatus, "Status: Looting")
Send($skillCompanion)
Call("Loot")
RandSleep(1, 6, 50)
Send($skillCompanion)
Call("TownPortal")
Else
Send($skillCaltrops)
Sleep(620)
Send($skillSmokeScreen)
Sleep(40)
Call("TownPortal")
Call("LeaveGame")
EndIf
;After successful run
If Not $Logout And Not $Dead Then
If $mLootIn == 1 Then ;If its time to manage loot
If $StashLoot Then
Call("StashLoot")
EndIf
If $VendorLoot Then
Call("VendorLoot")
EndIf
$mLootIn = Round(Random($mLoot-$mLootOff, $mLoot+$mLootOff)) ;Reset Counter
Else
$mLootIn -= 1
EndIf
Call("LeaveGame")
Return
Else
Return
EndIf
EndIf
EndFunc
;Helper Functions
Func CheckDead()
$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")
$Dead = True
Call("LeaveGame")
Sleep(11000)
Else
$Dead = False
EndIf
$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
Sleep(11000)
Sleep($loadtime)
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 $Dead Then
Return
EndIf
If CheckFor("NewTristram", "Area") Then
MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
Moving(1875)
MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
Moving(1875)
MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
Sleep(1200)
MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
Sleep(400)
MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
Sleep(200)
Send("{Escape}")
Call("LeaveGame")
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
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
While _ImageSearchArea($pngLoc & $file,1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,$accuracy)
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
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
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
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))
Call("CheckDead")
If $Dead or $Logout Then
Return
EndIf
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))
;Legendaries
While $StashLegendary
Sleep(Random(200, 300))
$LegendPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x4D2C0D, 0)
If Not @error Then
GUICtrlSetData($lblStatus, "Status: Stashing Legendaries")
MouseClick("right", $LegendPixel[0], $LegendPixel[1])
Else
ExitLoop
EndIf
WEnd
;Rares
While $StashRare
Sleep(Random(200, 300))
$RarePixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x4A3C0B, 1)
If Not @error Then
GUICtrlSetData($lblStatus, "Status: Stashing Rares")
MouseClick("right", $RarePixel[0], $RarePixel[1])
Else
ExitLoop
EndIf
WEnd
;Tomes
If _ImageSearchArea($pngLoc & "tomeIcon.png",1,1398*$x_ratio, 572*$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,1)
Sleep(Random(500, 750))
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
;Magic
While $StashMagic
Sleep(Random(100, 300))
$MagicPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 2)
If Not @error Then
GUICtrlSetData($lblStatus, "Status: Stashing Magic")
MouseClick("right", $MagicPixel[0], $MagicPixel[1])
Else
ExitLoop
EndIf
WEnd
Sleep(Random(1000, 3000))
Send("{ESCAPE}")
EndFunc
Func VendorLoot()
GUICtrlSetData($lblStatus, "Status: Vendoring Items")
If Not $StashLoot Then ;Move from TP towards vendor
Sleep(Random(300, 500))
MouseClick("left", 1565*$x_ratio, 50*$y_ratio)
Else ;Move from Stash towards vendor
Sleep(Random(300, 500))
MouseClick("left", 1560*$x_ratio, 120*$y_ratio)
EndIf
Sleep(3000)
MouseClick("left", 1030*$x_ratio, 210*$y_ratio) ;Talk to vendor
Sleep(3000)
;Rares
If $VendorRare Then
ConsoleWrite("Selling Rare - ")
$c = 0
While $VendorRare
Sleep(Random(200, 300))
$RarePixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x4A3C0B, 1)
If Not @error Then
MouseClick("right", $RarePixel[0], $RarePixel[1])
$c += 1
Else
ConsoleWrite($c & @CRLF)
ExitLoop
EndIf
WEnd
EndIf
;Magic
If $VendorMagic Then
ConsoleWrite("Selling Magic - ")
$c = 0
While True
Sleep(Random(100, 300))
$MagicPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 2)
If Not @error Then
MouseClick("right", $MagicPixel[0], $MagicPixel[1])
$c += 1
Else
ConsoleWrite($c & @CRLF)
ExitLoop
EndIf
WEnd
EndIf
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)
MsgBox(-1,"Success","Download Complete! Please restart the bot by running Update.au3" & @CRLF & "Exiting...")
FileDelete(@ScriptDir & "\version.ini")
Exit
EndIf
EndIf
EndIf
EndFunc
;Hotkey Functions
Func Leave()
$Leave = True
EndFunc
Func Pause()
$Leave = False
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