Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;=========== DO NOT TOUCH ===========;
- #RequireAdmin
- #include <GUIConstantsEx.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- #include <SimpleTesseractColor.au3>
- #include <ScreenCapture.au3>
- Opt('MouseCoordMode', 2)
- Opt('PixelCoordMode', 2)
- Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $Kill = ProcessList("AutoIt3_x64.exe"), $ver = "2.0.0", $ini = "25s.ini", $dps = 18500, $hFont = 0, $title, $Paused, $Go = 0, $i = 0, $gX = 0, $gY = 0, $LegendaryCount = 0, $SetCount = 0, $RareCount = 0, $deathCount = 0, $repairCount = 0, $closedcellarCount = 0, $cellarCount = 0, $t = TimerInit(), $rt = 0, $run = 0, $yellow = 0xFFF000, $red = 0xD90000, $lblRun, $lblLocation, $lblStatus, $lblLast, $lblRuntime, $lblGear, $lblItems,$lblGold, $lblFailed, $StartingGold = 0,$AccumulatedGold = 0,$GPH = 0, $OpenCellarAvg = 0, $OpenCellarSec = 0,$ClosedCellarAvg, $ClosedCellarSec = 0,$CellCoord = -1, $c = 0
- For $i = 1 To $Kill[0][0]
- $CurrentPID = @AutoItPID
- If $CurrentPID < $Kill[$i][1] or $CurrentPID > $Kill[$i][1] Then
- ProcessClose($Kill[$i][1])
- EndIf
- Next
- For $i = 0 To Random(0, 7, 1)
- $title &= Chr(Random(97, 122, 1))
- Next
- For $i = 0 To Random(5, 10, 1)
- $title &= Chr(Random(65, 90, 1))
- Next
- $title &= " "
- Global $gems[8] = ["Ru1.png", "Ru2.png", "Em1.png", "Em2.png", "To1.png", "To2.png", "Am1.png", "Am2.png"]
- If @OSArch = "X64" Then DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
- If @OSArch = "X64" And Not @AutoItX64 Then MsgBox(16, "ERROR", "Why aren't you running the 64-bit AutoIt??? Expect bugs!")
- If @OSArch = "X64" And Not @AutoItX64 Then MsgBox(16, "ERROR", "Why aren't you running the 64-bit AutoIt??? Expect bugs!")
- ;====================================;
- ;============= SETTINGS: DONT CHANGE HERE, CHANGE WZD.INI =============;
- HotKeySet("=", "Begin") ;script toggled on/off by pressing =
- HotKeySet("{PAUSE}", "TogglePause") ;script toggle pause by pressing Pause/Break key
- HotKeySet("x", "Stop") ;script stopped by pressing x
- ;Cellar Check Coords HERE
- Global $cellarCoordx[6] = [255, 600, 175, 315, 265, 280]
- Global $cellarCoordy[6] = [290, 435, 305, 314, 340, 302]
- ;Change to match your abilities (1-4 by default)z
- $DiamondSkin = "1"
- $MirrorImage = "2"
- $Teleport = "3"
- $MagicWeapon = "4"
- $movementSpeed = 0 ;This is the % increase movement speed you have. 25 = 25%, 0 = 0% (25% is the movement cap but SS + Displacement avg = 32%)
- ;Custom Loot
- $pngLoc = @ScriptDir & "\pics\" & @DesktopWidth & "x" & @DesktopHeight& "\"
- ;Looting
- $LootSets = 1 ;1 if you want to pick up Sets
- $LootLegendaries = 1;1 if you want to pick up Legendaries
- $LootRares = 1 ;1 if you want to pick up Rares
- $LootTomes = 1 ;1 if you want to pick up Tome of Secrets
- $mLoot = 250;Nuber of successful runs until Stash and Vendor
- $mLootOff = 2 ;Stash and Vendor after mLoot +- X number of runs (Variability)
- $StashLoot = 1
- $StashLegendary = 1 ;1 if you want to store Legendary items in the stash
- $StashRare = 1 ;1 if you want to store Rare items in the stash
- $StashTomes = 1 ;1 if you want to store Tomes items in the stash
- ;Variability ==NEW SETTINGS==
- $walktime = 3600 ;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 = 4500 ;Time (in ms) the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
- $tptime = 4700;Time (in ms) the script waits for teleport before exiting the game
- ;====================================;
- If FileExists($ini) Then
- Call("ReadINI")
- Call("CreateINI")
- Else
- Call("CreateINI")
- EndIf
- $dps = $dps * 3
- $attackTime = (170000 / $dps) * 1000
- If $size = 0 Then
- MsgBox(16, "Error", "Diablo III is not running, cannot grab resolution!" & @CRLF & "Exiting...")
- Exit
- EndIf
- $x_ratio = $size[0] / 1920
- $y_ratio = $size[1] / 1080
- $mLootIn = $mLoot
- $movementSpeed = 1 + ($movementSpeed / 100)
- $VersionsInfo = "http://bit.ly/LF1Rp6"
- $oldVersion = IniRead("updater.ini", "Version", "Version", $ver)
- $newVersion = "0.0"
- If Not FileExists($pngLoc & "MainMenu.png") Then
- MsgBox(16, "Fatal Error", "FATAL ERROR: Cannot find: " & $pngLoc & "MainMenu.png" & @CRLF & "Make sure your desktop resolution is either 1600x900 or 1920x1080")
- Exit
- EndIf
- Call("DoUpdate")
- Call("SetupGUI")
- While 1
- Call("RestartRun")
- WEnd
- Func RestartRun()
- If ($Go) Then
- $i = 0
- WinSetTitle($title, "", $title & $ver & " - Running")
- MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 1) ;Moves mouse out of the way
- ;Checks if the player is Dead/Logout/Window, then if in Main Menu, etc.
- If CheckDead() Then
- Return
- ElseIf CheckFor("ExitGame", "", Round(860 * $x_ratio), Round(400 * $y_ratio), Round(1040 * $x_ratio), Round(450 * $y_ratio), 0.5, 140) Then
- GUICtrlSetData($lblStatus, "Status: Exit window up")
- MouseClick("left", Round(1064 * $x_ratio), Round(632 * $y_ratio))
- Sleep(100)
- Send("{SPACE}")
- Return
- ElseIf CheckFor("MainMenu", "", Round(40 * $x_ratio), Round(300 * $y_ratio), Round(400 * $x_ratio), Round(450 * $y_ratio)) Then
- GUICtrlSetData($lblRun, "Run Number: " & $run & " - Runs till vendor: " & $mLootIn)
- GUICtrlSetData($lblLocation, "Location: Main Menu")
- GUICtrlSetData($lblStatus, "Status: Starting Game")
- RandClick("left", Round(230 * $x_ratio), Round(416 * $y_ratio), 120, 20, 1, 1) ;Random Click on the resume button
- Sleep($loadtime)
- $rt = TimerInit()
- $run += 1
- ElseIf CheckFor("OldRuins", "Area") Or CheckFor("NewTristram", "Area") Or CheckFor("DankCellar", "Area") Then
- Call("TownPortal")
- Call("LeaveGame")
- Return
- ElseIf CheckFor("Disconnect", "", Round(700 * $x_ratio), Round(340 * $y_ratio), Round(1200 * $x_ratio), Round(600 * $y_ratio), 1, 140) Then
- GUICtrlSetData($lblStatus, "Status: Network Disconnect window up")
- MouseClick("left", Round(960 * $x_ratio), Round(632 * $y_ratio),1)
- Sleep(100)
- Send("{SPACE}")
- Return
- ElseIf CheckFor("LimitError", "", Round(700 * $x_ratio), Round(340 * $y_ratio), Round(1200 * $x_ratio), Round(600 * $y_ratio), 1, 140) Then
- MouseClick("left", Round(960 * $y_ratio), Round(635 * $x_ratio),1)
- $rand = Random(40000, 80000)
- GUICtrlSetData($lblStatus, "Status: Input Limit - Waiting " & Round($rand / 1000) & " seconds.")
- Sleep($rand)
- Send("{SPACE}")
- Return
- Else
- GUICtrlSetData($lblStatus, "ERROR: Cannot find Resume button")
- Return
- EndIf
- ;Make sure we are in the right area before beginning run
- If CheckFor("OldRuins", "Area") Then
- Sleep(100)
- GUICtrlSetData($lblLocation, "Location: Old Ruins")
- Call("CheckRepair")
- If $StartingGold = 0 Then Call("GoldPerHour")
- ;Start Run
- MouseClick("middle", Round(0 * $x_ratio),Round(250 * $y_ratio),1) ;starts the main run
- Send("{3 down}")
- Sleep(2000)
- Send("{3 up}")
- SLEEP(100)
- send($DiamondSkin)
- Moving(100)
- If FindCellar() = 1 Then
- If CheckDead() Then
- Return
- EndIf
- GUICtrlSetData($lblStatus, "Status: Cellar - Found")
- MouseClick("left",$cellarCoordx[$CellCoord],$cellarCoordy[$CellCoord],1)
- Moving($walktime)
- Else ;ABORT RUN
- ;_ScreenCapture_SetBMPFormat(0)
- ;_ScreenCapture_Capture(@ScriptDir & "\shots\Shot"& $run & ".bmp")
- GUICtrlSetData($lblStatus, "Status: Cellar - Not Found" & @CRLF)
- Send($MirrorImage)
- Sleep(300)
- send("{SHIFTDOWN}")
- sleep(200)
- Mouseclick("left")
- sleep(300)
- send("{SHIFTUP}")
- sleep(400)
- Call("TownPortal")
- If Not CheckDead() Then
- Call("ClosedCellar")
- Call("LeaveGame")
- EndIf
- Return
- EndIf
- Else
- Call("TownPortal")
- If Not CheckDead() Then
- Call("ClosedCellar")
- Call("LeaveGame")
- EndIf
- Return
- EndIf
- ;Checks that the player is in the Dank Cellar
- If CheckFor("DankCellar", "Area") Then
- GUICtrlSetData($lblLocation, "Location: Dank Cellar")
- RandClick("middle", Round(20 * $x_ratio),Round(708 * $y_ratio), 1, 1) ;moves to doorway leading to rare inside cellar
- Sleep(Random(2200, 2500))
- RandMove(Round(440 * $x_ratio),Round(80 * $y_ratio), 1, 1) ;hovers over the rare Sarkoth
- sleep(150)
- Send($MagicWeapon)
- sleep(200)
- Send("{SHIFTDOWN}")
- GUICtrlSetData($lblStatus, "Status: Attacking Sarkoth")
- MouseDown("right") ;ATTACK
- Sleep($attackTime)
- MouseUp("right")
- Sleep(150)
- Send("{SHIFTUP}")
- sleep(1450)
- Send("2") ;archon teleport
- MouseClick("right",Round(755*$x_ratio),Round(936* $y_ratio),1) ;cancel archon
- send("{SHIFTDOWN}")
- sleep(200)
- Mouseclick("left")
- sleep(200)
- send("{SHIFTUP}")
- GUICtrlSetData($lblStatus, "Status: Looting")
- Call("Loot")
- Call("TownPortal")
- Else
- ;_ScreenCapture_SetBMPFormat(0)
- ;_ScreenCapture_Capture(@ScriptDir & "\shots\Shot"& $run & ".bmp")
- Send($MirrorImage)
- Sleep(300)
- send("{SHIFTDOWN}")
- sleep(200)
- Mouseclick("left")
- sleep(300)
- send("{SHIFTUP}")
- sleep(400)
- Call("TownPortal")
- If Not CheckDead() Then
- Call("ClosedCellar")
- Call("LeaveGame")
- EndIf
- Return
- EndIf
- ;After successful run
- If Not CheckDead() Then
- Sleep(300)
- If $mLootIn = 1 And CheckFor("NewTristram", "Area") Then ;If its time to manage loot and we are in town
- If $StashLoot == 1 Then
- Call("StashLoot")
- EndIf
- $mLootIn = Round(Random($mLoot - $mLootOff, $mLoot + $mLootOff)) ;Reset Counter
- ElseIf Not CheckFor("NewTristram", "Area") Then
- GUICtrlSetData($lblStatus, "Status: Skipping vendor, not in New Tristram")
- Sleep(3000)
- ElseIf $mLootIn <= 0 Then
- $mLootIn = 1
- Else
- $mLootIn -= 1
- EndIf
- If Not CheckDead() Then
- Call("OpenCellar")
- Call("LeaveGame")
- EndIf
- Return
- Else
- Return
- EndIf
- EndIf
- EndFunc ;==>RestartRun
- Func SetupGUI()
- $frmBot = GUICreate($title & $ver & " - Updating", 280, 110, Round(0 * $x_ratio), Round(0 * $y_ratio), -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
- GUISetBkColor(0xC0C0C0)
- $lblRun = GUICtrlCreateLabel("Run Number: 0 - Runs till stash: 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)
- $lblRuntime = GUICtrlCreateLabel("Total Runtime: 0 hours, 0 minutes", 12, 50, 240, 17)
- $lblLast = GUICtrlCreateLabel("Open Cellar Avg: 0s - Closed Cellar Avg: 0s", 12, 65, 240, 17)
- $lblGear = GUICtrlCreateLabel("Legendary: 0 - Set: 0 - Rare: 0", 12, 80, 240, 17)
- $lblGold = GUICtrlCreateLabel("0 Per Hour - Accumulated Gold: 0", 12, 95, 240, 17)
- GUISetState(@SW_SHOW)
- EndFunc ;==>SetupGUI
- 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
- GUICtrlSetData($lblStatus, "Status: Logging out")
- Sleep(11000)
- Sleep($loadtime)
- Return 1
- EndIf
- $CloseButton = PixelSearch(Round(1570 * $x_ratio), Round(110 * $y_ratio), Round(1590 * $x_ratio), Round(120 * $y_ratio), 0x8C2300) ; checks for the red color of the "X" on an open window
- If Not @error Then
- GUICtrlSetData($lblStatus, "Status: Open Window")
- Sleep(200)
- Send("{SPACE}") ;close any open windows
- 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")
- $deathCount += 1
- Call("LeaveGame")
- Sleep(11000)
- Sleep($loadtime)
- Return 1
- Else
- Return 0
- EndIf
- EndFunc ;==>CheckDead
- 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 ;==>CheckRepair
- Func DoRepair()
- Call("TownPortal")
- sleep(2000)
- $repairCount += 1
- If CheckDead() Then
- Return
- EndIf
- If CheckFor("NewTristram", "Area") Then
- RandMove(Round(1530 * $x_ratio), Round(0 * $y_ratio), 1, 1) ;begin movement towards merchant
- Send("{3 down}")
- Sleep(1200)
- Send("{3 up}")
- RandClick("left", Round(796 * $x_ratio), Round(474 * $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}")
- If Not CheckDead() Then
- Call("LeaveGame")
- EndIf
- EndIf
- EndFunc ;==>DoRepair
- Func ClosedCellar()
- $closedcellarCount += 1
- $srt = TimerDiff($rt)
- $ClosedCellarSec = $ClosedCellarSec + Round($srt / 1000, 2)
- $ClosedCellarAvg = $ClosedCellarSec / $closedcellarCount
- EndFunc
- Func OpenCellar()
- $cellarCount += 1
- $srt = TimerDiff($rt)
- $OpenCellarSec = $OpenCellarSec + Round($srt / 1000, 2)
- $OpenCellarAvg = $OpenCellarSec / $cellarCount
- EndFunc
- Func CalcTime()
- GUICtrlSetData($lblLast, "Open Cellar Avg: " & Round($OpenCellarAvg,1) & "s - " & "Closed Cellar Avg: " & Round($ClosedCellarAvg,1) & "s")
- $trt = TimerDiff($t)
- $total = Round((($trt / 1000) / 60) / 60, 4)
- ;Total runtime 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 ;==>CalcTime
- Func CheckFor($img, $type = "", $startX = 0, $startY = 0, $endX = @DesktopWidth, $endY = @DesktopHeight, $seconds = 6, $tolerance = 140)
- If $type = "Area" Then
- $startX = 1500 * $x_ratio
- $startY = 0 * $y_ratio
- $endX = 1920 * $x_ratio
- $endY = 90 * $y_ratio
- $seconds = 2.5
- EndIf
- $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 0
- EndIf
- Until _ImageSearchArea($string, 1, $startX, $startY, $endX, $endY, $gX, $gY, $tolerance)
- Return 1
- EndFunc ;==>CheckFor
- Func Loot()
- Sleep(Random(100, 300))
- MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
- If $LootSets == 1 Then
- $SetCount += LootGear(0x02CE01)
- EndIf
- If $LootLegendaries == 1 Then
- $LegendaryCount += LootGear(0xBF642F, 0)
- EndIf
- If $LootRares == 1 Then
- $RareCount += LootGear(0xBBBB00)
- EndIf
- If $LootTomes == 1 Then
- Call("LootTomes")
- EndIf
- Call("ShowLoot")
- EndFunc ;==>Loot
- 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], 1, 3)
- Sleep(50)
- MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 1) ;Moves mouse out of the way
- sleep(500)
- ;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 ;==>LootGear
- Func LootTomes()
- $count = 0
- $gX = 0
- $gY = 0
- While _ImageSearchArea($pngLoc & "tome.png", 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, 90)
- $count += 1
- MouseClick("left", $gX, $gY - 3, 1, 3)
- Sleep(50)
- MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
- Sleep(1000)
- If $count >= 10 Then
- ExitLoop
- EndIf
- WEnd
- EndFunc ;==>LootTomes
- Func StashLoot()
- GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
- MouseClick("left", 1064 * $x_ratio, 256 * $y_ratio)
- Moving(1600)
- ;Tomes
- While $StashTomes == 1
- 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
- If $StashLegendary == 1 Then
- StashItems(0xFF7F00, 0)
- StashItems(0x8F5C25, 1)
- EndIf
- If $StashRare == 1 Then
- StashItems(0x4A3C0B, 1)
- EndIf
- Sleep(Random(200, 800))
- Send("{SPACE}")
- EndFunc ;==>StashLoot
- Func StashItems($color, $tolerance)
- $c = 0
- While $c <= 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)
- $c += 1
- Else
- ExitLoop
- EndIf
- WEnd
- EndFunc ;==>StashItems
- Func DoUpdate()
- $ini = InetGet($VersionsInfo, @ScriptDir & "\version.ini") ;download version.ini
- If $ini = 0 Then ;was the download of version.ini successful?
- MsgBox(16, "Fatal 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(68, "Update", "A new version is available: " & $newVersion & "! Current version: " & $oldVersion & @CRLF & "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_" & $newVersion & ".zip", 1, 1)
- ProgressOn("Update", "Downloading Updates", "", -1, -1, 16) ;creates a progressbar
- $size = InetGetSize($downloadLink, 1) ;get the size of the update
- While Not InetGetInfo($dlhandle, 2)
- $Percent = Round((InetGetInfo($dlhandle, 0) / $size) * 100)
- ProgressSet($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(64, "Success", "Download Complete!" & @CRLF & "Please restart the bot by extracting the Au3 from Update_" & $newVersion & ".zip" & @CRLF & $iniMsg)
- FileDelete(@ScriptDir & "\version.ini")
- Exit
- EndIf
- EndIf
- EndIf
- WinSetTitle($title, "", $title & $ver & " - Waiting")
- EndFunc ;==>DoUpdate
- Func ReadINI()
- $DPS = IniRead($ini, "DPS", "DPS", $DPS)
- $DiamondSkin = IniRead($ini, "Skills", "DiamondSkin", $DiamondSkin)
- $MirrorImage = IniRead($ini, "Skills", "MirrorImage", $MirrorImage)
- $Teleport = IniRead($ini, "Skills", "Teleport", $Teleport)
- $MagicWeapon = IniRead($ini, "Skills", "Magic Weapon", $MagicWeapon)
- $movementSpeed = IniRead($ini, "Additional", "Movement Speed", $movementSpeed)
- $walktime = IniRead($ini, "Additional", "Walk Time", $walktime)
- $loadtime = IniRead($ini, "Additional", "Load Time", $loadtime)
- $tptime = IniRead($ini, "Additional", "Teleport Time", $tptime)
- $LootSets = IniRead($ini, "Looting", "Sets", $LootSets)
- $LootLegendaries = IniRead($ini, "Looting", "Legendaries", $LootLegendaries)
- $LootRares = IniRead($ini, "Looting", "Rares", $LootRares)
- $LootTomes = IniRead($ini, "Looting", "Tomes", $LootTomes)
- $mLoot = IniRead($ini, "ManageLoot", "Every", $mLoot)
- $StashLegendary = IniRead($ini, "Stashing", "Legendaries", $StashLegendary)
- $StashRare = IniRead($ini, "Stashing", "Rares", $StashRare)
- $StashTomes = IniRead($ini, "Stashing", "Tomes", $StashTomes)
- $mLootOff = IniRead($ini, "Variability", "Manage Off By", $mLootOff)
- EndFunc ;==>ReadINI
- Func CreateINI()
- IniWrite($ini, "DPS", "DPS", $DPS)
- IniWrite($ini, "Skills", "DiamondSkin", $DiamondSkin)
- IniWrite($ini, "Skills", "MirrorImage", $MirrorImage)
- IniWrite($ini, "Skills", "Teleport", $Teleport)
- IniWrite($ini, "Skills", "Magic Weapon", $MagicWeapon)
- IniWrite($ini, "Additional", "Movement Speed", $movementSpeed)
- IniWrite($ini, "Additional", "Walk Time", $walktime)
- IniWrite($ini, "Additional", "Load Time", $loadtime)
- IniWrite($ini, "Additional", "Teleport Time", $tptime)
- IniWrite($ini, "Looting", "Sets", $LootSets)
- IniWrite($ini, "Looting", "Legendaries", $LootLegendaries)
- IniWrite($ini, "Looting", "Rares", $LootRares)
- IniWrite($ini, "Looting", "Tomes", $LootTomes)
- IniWrite($ini, "ManageLoot", "Every", $mLoot)
- IniWrite($ini, "Stashing", "Legendaries", $StashLegendary)
- IniWrite($ini, "Stashing", "Rares", $StashRare)
- IniWrite($ini, "Stashing", "Tomes", $StashTomes)
- IniWrite($ini, "Variability", "Manage Off By", $mLootOff)
- EndFunc ;==>CreateINI
- 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 ;==>_ImageSearchArea
- Func FindCellar()
- $CellCoord = -1
- $c = 0
- Do
- If $c >= Ubound($cellarCoordx) Then ;Make sure we never get stuck here for infinity.
- If $CellCoord = -1 Then $CellCoord = 0
- Return 0
- EndIf
- sleep(50)
- RandMove(Round($cellarCoordx[$c] * $x_ratio), Round($cellarCoordy[$c] * $y_ratio), 1, 1) ;moves cursor over to the cellar
- $mousePos = MouseGetPos()
- sleep(50)
- If $c = 1 then
- $Pixel2 = PixelSearch($mousePos[0] - 71 * $x_ratio,$mousePos[1] - 148 * $y_ratio,$mousePos[0] + 139 * $x_ratio,$mousePos[1] + 22 * $y_ratio, 0x007CB7F8, 3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
- Else
- $Pixel2 = PixelSearch($mousePos[0] - 71 * $x_ratio,$mousePos[1] - 148 * $y_ratio,$mousePos[0] + 139 * $x_ratio,$mousePos[1] + 22 * $y_ratio, 0x334FB7, 3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
- EndIf
- If Not @Error Then
- $CellCoord = $c
- Return 1
- EndIf
- $c += 1
- Until $CellCoord >= 0
- If $CellCoord = -1 Then $CellCoord = 0
- Return 1
- EndFunc
- Func GoldPerHour()
- Send("i")
- Sleep(200)
- $CurrentGold = _TesseractScreenCapture(0, "", 1, 2, 1450*$x_ratio, 504*$y_ratio, 1570*$x_ratio, 530*$y_ratio, 0)
- Sleep(200)
- Send("i")
- $CurrentGold = StringRegExpReplace($CurrentGold, "[^0-9]", "")
- $trt = TimerDiff($t)
- If $StartingGold <= 0 Then $StartingGold = $CurrentGold
- If $StartingGold > 0 Then $AccumulatedGold = $CurrentGold - $StartingGold
- $GPH = $AccumulatedGold / ($trt / 1000) * 3600
- If $GPH >= 0 and $AccumulatedGold >=0 then
- If $GPH > 1000000 Then
- $GPH = Round($GPH/1000000,2) & "M"
- ElseIf $GPH > 1000 Then
- $GPH = Round($GPH/1000) & "K"
- EndIF
- If $AccumulatedGold > 1000000 Then
- $AccumulatedGold = Round($AccumulatedGold/1000000,2) & "M"
- ElseIf $AccumulatedGold > 1000 Then
- $AccumulatedGold = Round($AccumulatedGold/1000) & "K"
- EndIF
- GUICtrlSetData($lblGold,$GPH & " Per Hour - Accumulated Gold: " & $AccumulatedGold)
- EndIf
- EndFunc ;==>GoldPerHour
- Func LeaveGame()
- GUICtrlSetData($lblStatus, "Status: Leaving Game")
- Send("{SPACE}")
- sleep(200)
- Send("{Escape}")
- RandClick("left", Round(956 * $x_ratio), Round(579 * $y_ratio), 120, 1) ;Random Click on the leave button
- Call("CalcTime")
- Sleep($loadtime)
- EndFunc ;==>LeaveGame
- Func TownPortal()
- GUICtrlSetData($lblStatus, "Status: Returning to Town")
- Send("t")
- Call("GoldPerHour")
- Sleep($tptime)
- EndFunc ;==>TownPortal
- Func Moving($time)
- Sleep($time / $movementSpeed)
- EndFunc ;==>Moving
- Func RandClick($clickType, $xPos, $yPos, $xOff = 10, $yOff = 10, $clicks = 1, $speed = 1)
- If $xOff < 1 Then $xOff = 1
- If $yOff < 1 Then $yOff = 1
- $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, $clicks, $speed)
- EndFunc ;==>RandClick
- Func RandMove($xPos, $yPos, $xOff = 10, $yOff = 10, $speed = 1)
- $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, $speed)
- EndFunc ;==>RandMove
- Func Begin()
- $Go = Not $Go
- If Not $Go Then WinSetTitle($title, "", $title & $ver & " - Halted")
- EndFunc ;==>Begin
- Func TogglePause()
- $Paused = Not $Paused
- While $Paused
- Sleep(100)
- WinSetTitle($title, "", $title & $ver & " - Paused")
- ToolTip('[PAUSED] - Deaths: ' & $deathCount & ' | Cellars: ' & $cellarCount, 0, 0)
- WEnd
- WinSetTitle($title, "", $title & $ver & " - Running")
- ToolTip("")
- EndFunc ;==>TogglePause
- Func ShowLoot()
- GUICtrlSetData($lblGear, "Legendary: " & $LegendaryCount & " - Set: " & $SetCount & " - Rare: " & $RareCount)
- EndFunc ;==>ShowLoot
- Func StopLog()
- $repairCountPercent = $repairCount / $run
- $deathsCountPercent = $deathCount / $run
- $cellarCountPercent = $cellarCount / $run
- $closedCellarCountPercent = ($run - $cellarCount) / $run
- $trt = TimerDiff($t)
- ;Total runtime calculation.
- $hours = Floor((($trt / 1000) / 60) / 60)
- $minutes = (($trt / 1000) / 60)
- If $minutes > 60 Then
- While $minutes > 60
- $minutes -= 60
- WEnd
- EndIf
- _FileWriteLog("Dank Cellar Log.txt", @CRLF & "************************************************" & @CRLF & _
- "Chancity's Dank Celler" & @CRLF & @CRLF & "Stats:" & @CRLF & _
- "Total Runtime: " & $hours & " hours, " & Ceiling($minutes) & " minutes" & @CRLF & _
- "Total Cellars Found: " & $cellarCount & " (" & Round($cellarCountPercent * 100,.00) & "%" & ")" & @CRLF & _
- "Total Cellars Not Found: " & $run - $cellarCount & " (" & Round($closedCellarCountPercent * 100,.00) & "%" & ")" & @CRLF & _
- "Total Deaths: " & $deathCount & " (" & Round($deathsCountPercent * 100,.00) & "%" & ")" & @CRLF & _
- "Total Repairs: " & $repairCount & " (" & Round($repairCountPercent * 100,.00) & "%" & ")" & @CRLF & @CRLF & "Loot:" & @CRLF & _
- "Legendary: " & $LegendaryCount & " - Set: " & $SetCount & " - Rare: " & $RareCount & @CRLF & _
- $GPH & " Per Hour - Accumulated Gold: " & $AccumulatedGold & @CRLF & _
- "************************************************")
- EndFunc
- Func Stop() ;to allow the script to stop
- Call("StopLog")
- Exit
- EndFunc ;==>Stop
Advertisement
Add Comment
Please, Sign In to add comment