Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ImageSearch.au3> ;comment this if you are not using the new looting system
- #include <GUIConstantsEx.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- #Region ### START Koda GUI section ###
- $frmBot = GUICreate("notAres' Sarkoth Bot", 270, 121, 1540, 926, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
- $lblRun = GUICtrlCreateLabel("Run Number: 0 - Runs until vendor/repair: 0", 4, 4, 260, 17)
- GUICtrlSetFont(-1, 5, 800, 0, "MS Sans Serif")
- GUICtrlSetColor(-1, 0xFF0000)
- $lblLocation = GUICtrlCreateLabel("Location: Main Menu", 31, 19, 240, 17)
- $lblStatus = GUICtrlCreateLabel("Status: Resuming Game", 31, 35, 240, 17)
- $lblLast = GUICtrlCreateLabel("Last Runtime: 0 seconds", 31, 51, 240, 17)
- $lblRuntime = GUICtrlCreateLabel("Total Runtime: 0 hours, 0 minutes", 31, 67, 240, 17)
- $lblGear = GUICtrlCreateLabel("Legendary: 0 - Set: 0 - Rare: 0", 31, 83, 240, 17)
- $lblItems = GUICtrlCreateLabel("Magic: 0 - Gems: 0 - Tomes: 0", 31, 99, 240, 17)
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- Opt('MouseCoordMode', 2)
- Opt('PixelCoordMode', 2)
- Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $Paused, $go = True, $Leave = False, $Dead = False, $Logout = False, $Window = False, $ExitButton, $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
- $VersionsInfo = "http://pastebin.com/raw.php?i=L8hHSZJi"
- $oldVersion = IniRead("updater.ini","Version","Version","1.5")
- $newVersion = "0.0"
- Call("DoUpdate")
- HotKeySet("{F1}","Leave") ;script started by pressing F1
- HotKeySet("{F2}", "Pause") ;script paused by pressing F2
- HotKeySet("{F3}", "Stop") ;script stopped by pressing F3
- HotKeySet("{F4}", "ShowLoot") ;script stopped by pressing F4
- If $size = 0 Then
- MsgBox(4096,"Error","Diablo III is not running, cannot grab resolution!")
- 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 = 10 ;This is the % increase movement speed you have. 25 = 25%, 0 = 0%, 50 = 50%
- ;Custom Loot
- $pngLoc = "C:\pics\" ;Location of the .PNGs
- $totalItems = 18 ;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] = "square.png|40"
- $pick[2] = "tome.png|40"
- $pick[3] = "legendaryA.png|20"
- $pick[4] = "legendaryE.png|20"
- $pick[5] = "legendaryI.png|10"
- $pick[6] = "legendaryO.png|20"
- $pick[7] = "legendaryU.png|20"
- $pick[8] = "setA.png|30"
- $pick[9] = "setE.png|30"
- $pick[10] = "setU.png|30"
- $pick[11] = "setO.png|30"
- $pick[12] = "setI.png|30"
- $pick[13] = "rareA.png|20" ; comment/delete these and adjust $totalItems to disable rare looting
- $pick[14] = "rareE.png|20"
- $pick[15] = "rareI.png|20"
- $pick[16] = "rareO.png|20"
- $pick[17] = "rareU.png|20" ; end comment
- ;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 = True ;True if you want to pick up Custom Items (The items in the pick array above)
- ;Manage Loot
- $mLoot = 8 ;Nuber of successful runs until Stash and Vendor
- $mLootOff = 1 ;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
- ;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 = 3400 ; 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] / 1440
- $y_ratio = $size[1] / 900
- $mLootIn = $mLoot ;DO NOT CHANGE, how many more runs till next manage
- $movementSpeed = 1+($movementSpeed/100)
- While $go
- Call("RestartRun")
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Exit
- EndSwitch
- WEnd
- Func RestartRun()
- If($Leave) Then
- $i = 0
- ;Checks if the player is in the Main Menu
- If CheckFor("MainMenu") Then
- $run += 1
- GUICtrlSetData($lblRun, "Run Number: " & $run & " - Runs till management: " & $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) 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 Reached - Waiting " & Round($rand/1000) & " seconds.")
- Sleep($rand)
- Else
- ExitLoop
- EndIf
- WEnd
- $rt = TimerInit()
- $Window = False
- $Logout = False
- Else
- 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")
- Call("CheckDead")
- If $Dead OR $Logout Then
- Return
- EndIf
- ;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)
- Call("CheckDead")
- If $Dead 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(356*$x_ratio), Round(200*$y_ratio), 1) ;Entrance to cellar
- Moving(200)
- 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 $Logout And Not $Dead And Not $Window Then
- Call("LeaveGame")
- Return
- Else
- $Window = False ; reset the flag so it doesn't think a window is always up
- Return
- EndIf
- EndIf
- Call("CheckDead")
- If $Dead or $Logout Then
- Return
- EndIf
- Else
- Call("TownPortal")
- If $Dead Then
- Return
- EndIf
- 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(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(12000)
- MouseClick("right",Round(960*$x_ratio),Round(502*$y_ratio),2)
- Sleep(100)
- Send("{SHIFTUP}")
- 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 looting
- Call("Loot")
- RandSleep(1, 6, 50)
- Call("TownPortal")
- Call("CheckDead")
- If $Dead or $Logout Then
- Return
- EndIf
- Else
- Send($skillCaltrops)
- Sleep(620)
- Send($skillSmokeScreen)
- Sleep(40)
- Call("TownPortal")
- If $Dead Then
- Return
- EndIf
- Call("LeaveGame")
- EndIf
- ;After successful run
- If Not $Logout And Not $Dead And Not $Window 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
- $Window = False ; reset the flag so it doesn't think a window is always up
- 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 = 100)
- $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) ; Magic loot (darker for compatibility)
- 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) ; Magic loot (darker for compatibility)
- 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 = 10, $max = 20, $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 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 TownPortal()
- GUICtrlSetData($lblStatus, "Status: Returning to Town")
- Send("t")
- Sleep(Random($tptime, $tptime+500))
- Call("CheckDead")
- 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
- ;------------------------------- Begin download the zip file --------------------------------------;
- $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
- ;------------------------------- Write the new version for future updates --------------------------------------;
- IniWrite("updater.ini","version","version",$NewVersion)
- InetClose($dlhandle)
- MsgBox(-1,"Success","Download Complete! Please restart the bot by running Update.au3")
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement