Okay guys. Here is my version of blacks with just a few things changed around.
*When I say "my version" I mean, 99.999999% Blacks, with a couple small changes to guarantee you maintain high GPH.
Doesn't walk backwards when entering cellar.
Sprints to vendor successfully every time.
Vendor number counts down.
Better TP dectection timing, set detection to True automatically (helps with GPH if it can catch it correctly if you are hit)
A pictures is worth a thousand words... prove it.. yada yada...
Code:
; Blaksack's mod 1.93u
; added TP fail detection
; made ilvl optional
; timing improvements
;- optional cellar grid search
;- optional hour wait after X runs
;-Added latest changes from NotAres 1.93 including all the iLVL60-63 stuff dont forget new images: http://www45.zippyshare.com/v/15622375/file.html
;-Fixed the OCR bug where 0 is seen as O
;-Added option to use another war shout and call ancients before warping out on failed runs called $ExtraSafeExit
;-Added LATMs legendary item count fix
;-cleaned up cellar detection code - i hate repeated lines! you can define your own cellar co-ords at line 234ish
; enhanced cellar find
; item salvaging
; stash tab choosing
; full logging
; gold income OCR
; custom keys for skills
; for latest version see http://pastebin.com/PtE6XJ4W
; you will need tesseract from https://tesseract-ocr.googlecode.com/files/tesseract-ocr-setup-3.01-1.exe
; and you will need tesserect library to in your auto it include folder from https://dl.dropbox.com/u/22203901/Tesseract.au3
; you will also need image files and search dlls from https://dl.dropbox.com/u/9955791/BotFiles.zip
; and http://www45.zippyshare.com/v/15622375/file.html
; see for instructions http://www.ownedcore.com/forums/diablo-3/diablo-3-bots-programs/d3-gold-profiles/354464-goldfarming-notares-sarkoth-dh-gold-script-autoit-script-1920x1080.html
; use this build http://us.battle.net/d3/en/calculator/barbarian#TUXgkj!ghV!bYcbZa
;notAres' Gold Script for BARBARIAN 1.9 - 6/16/2012
;YOU MUST START THE BOT AT THE RESUME GAME SCREEN!
;Thread: http://www.ownedcore.com/forums/diablo-3/diablo-3-bots-programs/d3-gold-profiles/355316-goldfarming-barbarian-sarkoth-goldfarming-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/barbarian#TUXgkj!ghV!bYcbZa
;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 <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
; YOU MUST ALSO UNCOMMENT THE #include LINE TO ENABLE ENHANCED CELLAR FIND
$UseEnhancedCellarFind = True
#include <FastFind.au3>
;=========== mypart ===========;
#include <Tesseract.au3>
If $UseEnhancedCellarFind Then
FFSetDebugMode(0)
AutoItSetOption("WinTitleMatchMode", 4)
Global $FFhWnd = WinGetHandle("Diablo III")
EndIf
Global $numitem, $numgem, $numtomb, $numgold, $numpot, $lblGold, $numsold, $numstashed, $monold = 0, $mon = 0, $monstart = 0, $SprintStart, $lootany
Opt('MouseCoordMode', 2)
Opt('PixelCoordMode', 2)
Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $ver = "BlackSack 1.9.3u ", $hFont = 0, $title, $Paused, $Go = False, $i = 0, $gX = 0, $gY = 0, $LegendaryCount = 0, $SetCount = 0, $RareCount = 0, $MagicCount = 0, $GemCount = 0, $TomeCount = 0, $deathCount = 0, $cellarCount = 0, $t = TimerInit(), $rt = 0, $run = 0, $yellow = 0xFFF000, $red = 0xD90000, $lblRun, $lblLocation, $lblStatus, $lblLast, $lblRuntime, $lblGear, $lblItems
Global $str_Stash, $str_StashGems, $str_StashMisc, $str_Vendor, $str_Salvage, $int_TownPosition
For $i = 0 To Random(0, 3, 1)
$title &= Chr(Random(97, 122, 1))
Next
For $i = 0 To Random(2, 5, 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 $size = 0 Then
MsgBox(16, "Error", "Diablo III is not running, cannot grab resolution!" & @CRLF & "Exiting...")
Exit
EndIf
;====================================;
;============= SETTINGS =============;
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
HotKeySet("0", "GoTown") ;script stopped by pressing x
$movementSpeed = 0 ;This is the % increase movement speed you have. 25 = 25%, 0 = 0%, 50 = 50%
;Custom Loot
$pngLoc = "C:\Program Files (x86)\AutoIt3\pics\" ;Location of the .PNGs (NO SUBFOLDERS - ALL PNGS GO HERE)
;Array of items to loot (GEMS AND TOMES ALREADY INCLUDED)
Global $pick[1] = ["gold.png|50"]
;$pick[0] = "gold.png|50"
;$pick[1] = "mythic.png|50" ;png|Tolerance
;$pick[2] = "item3.png"
;General
$ExtraSafeExit = True ;use ancients when you port back to prevent death if you have low HP
$RunsUntilMenuWait = 0 ;wait for 1 hour at menu after x successful runs, set to 0 to disable
$TakeMissShots = False ;take screenshots into \shots folder on every cellar miss for finding positions
$SarkothKillTime = 200 ;additional time delay to wait for sarkoth to die use 2800 for 10K dps 800 for 15kdps etc
$DetectTPFail = True ;set true to immediatly exit game if TP is inturrupted (requires TP.png)
$TPProtectTime = 3.0 ;number of seconds to check for TP inturrupt if TPfail detection is enabled if your pc is slow reduce this number
$ReduceLegendSearch = True ; limit legendary searching to lower part of screen to reduce false finds
$CheckLootWhilePorting = False; continue scanning for loot while you port back incase sakroth dies late
;define your own cellar co-ords here, list the most likely ones first for efficiency
;change the [4] to how many co-ords you listed
Dim $celx[5] = [300, 210, 190, 250, 230]
Dim $cely[5] = [179, 179, 224, 160, 210]
;Buttons
$Skill1 = "1"
$Skill2 = "2"
$Skill3 = "3"
$Skill4 = "4"
$TownPortalButton = "t"
$Inventory = "i"
;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
$Identify = False ;True to enable identifying items before stashing/vendoring
$mLoot = 11 ;Nuber of successful runs until Stash and Vendor
$mLootOff = 2 ;Stash and Vendor after mLoot +- X number of runs (Variability)
;Variability ==NEW SETTINGS==
$Timer = False ;True and the bot will add random sleep intervals
$walktime = 2000 ;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 = 6000 ;Time (in ms) the script waits for teleport before exiting the game
;Stashing/vendoring COMMON
$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
$VendorRare = False ;True if you want to vendor Rares
$VendorMagic = True ;True if you want to vendor Magic
$GemTab = 1 ;Tab to put gems and tombs in
$ItemTab = 2 ;Tab to put any items in
$NextItemTab = 3 ;Next Tab to put any items in when first one is full
;--------------------------------------------TRADITIONAL----------------------------------------------------
;Stashing/vendoring TRADITIONAL METHOD to enable set line 155 to FALSE
$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
$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
;SALVAGE - setting this will OVERRIDE traditional vendoring options - it will be skipped
; make sure you have a stack of each material in your bottom row( which is not scanned )for it to add To
; otherwise it will start tying to salvage your craft items and do nothing!
$SalvageLoot = False
;Vendoring ==NEW SETTINGS==
$VendorLoot = True ;True if you want to vendor anything
$vendorAll = False ;True if you want to right click all items when talking to vendor
$vendorRows = 6 ;# of rows to vendor, starting from the top (default = 5: bottom row is safe)
$vendorCols = 10 ;# of columns to vendor, starting from left
;--------------------------------------------TRADITIONAL----------------------------------------------------
;--------------------------------------------iLVL----------------------------------------------------
$UseiLVL = False ;set true or false to enable the iLVL system THIS OVERRIDES ALL "TRADITIONAL" SETTINGS
;====================================;
;New Analyze Loot Settings Options are "salvage", "stash", and "vend"
$i59Rare = "stash"
$i60Rare = "stash"
$i61Rare = "stash"
$i62Rare = "stash"
$i63Rare = "stash"
$i59Magic = "vend"
$i60Magic = "vend"
$i61Magic = "vend"
$i62Magic = "vend"
$i63Magic = "stash"
;====================================;
;--------------------------------------------iLVL----------------------------------------------------
$x_ratio = $size[0] / 1920
$y_ratio = $size[1] / 1080
$mLootIn = $mLoot ;DO NOT CHANGE, how many more runs till next manage
$RunsUntilMenuWaitCnt = $RunsUntilMenuWait
$totalItems = UBound($pick) ;Number of items in the pick array
If $totalItems < 1 Then $LootCustom = False
$movementSpeed = 1 + ($movementSpeed / 100)
If $TakeMissShots Then
DirCreate("shots")
EndIf
If Not FileExists($pngLoc & "MainMenu.png") Then
$pngLoc = @ScriptDir & "\pics\"
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
EndIf
Call("SetupGUI")
While 1
Call("RestartRun")
WEnd
Func RestartRun()
If ($Go) Then
$i = 0
Send("{SPACE}")
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, "Runs till vendor: " & $mLootIn & ", Run Number: " & $run)
GUICtrlSetData($lblLocation, "Location: Main Menu")
GUICtrlSetData($lblStatus, "Status: Starting Game")
RandClick("left", Round(230 * $x_ratio), Round(416 * $y_ratio), 120, 20, 1, 6) ;Random Click on the resume button
CheckFor("OldRuins", "Area", 0, 0, 0, 0, $loadtime / 1000)
;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("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))
$rand = Random(40000, 80000)
GUICtrlSetData($lblStatus, "Status: Input Limit - Waiting " & Round($rand / 1000) & " seconds.")
Sleep($rand)
Send("{SPACE}")
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))
Sleep(100)
Send("{SPACE}")
Return
Else
GUICtrlSetData($lblStatus, "ERROR: Cannot find Resume button")
Return
EndIf
$CellarWasFound = 0
;Make sure we are in the right area before beginning run
If CheckFor("OldRuins", "Area") Then
Sleep(200)
Send($Skill3)
Sleep(100)
GUICtrlSetData($lblLocation, "Location: Old Ruins")
Call("CheckRepair")
$cellfoundat = -1
If $UseEnhancedCellarFind Then
RandClick("middle", Round(587 * $x_ratio), Round(350 * $y_ratio), 2, 2) ;starts the main run
Sleep(Random(700, 710))
RandMove(Round(16 * $x_ratio), Round(350 * $y_ratio), 2, 2)
Sleep(Random(5, 10))
Send($Skill1) ;leap
Sleep(700)
DoSprint()
Sleep(50)
RandClick("middle", Round(2 * $x_ratio), Round(350 * $y_ratio), 1, 1, 1, 1)
Sleep(800)
RandClick("middle", Round(2 * $x_ratio), Round(400 * $y_ratio), 1, 1)
walktime(Round(2 * $x_ratio), Round(400 * $y_ratio))
; cellar check on minimap
FFSnapShot(1593 * $x_ratio, 62 * $y_ratio, 1880 * $x_ratio, 350 * $y_ratio, 0)
Local $bColorArray[3] = [0x692A09, 0x5A2408, 0x6A2A0A]
FFAddColor($bColorArray)
FFAddExcludedArea(1824 * $x_ratio, 80 * $y_ratio, 1912 * $x_ratio, 353 * $y_ratio)
;FFSaveBMP("CellarMinimap_" & @HOUR & @MIN & @SEC, false) ;->uncomment if you wanna see the cellar minimap detection bmp ( gets saved where the script runs )
Local $aCoords = FFBestSpot(2, 1, 4, 367 * $x_ratio, 135 * $y_ratio, -1, 25, False)
If Not @error And IsArray($aCoords) Then
$cellfoundat = 1 ;found the cellar
FFResetColors()
Else
AddLog("enhanced fail")
EndIf
Else
;Start Run
RandClick("middle", Round(587 * $x_ratio), Round(333 * $y_ratio), 2, 2) ;starts the main run
Sleep(Random(990, 1140) / $movementSpeed)
RandMove(Round(96 * $x_ratio), Round(383 * $y_ratio), 2, 2)
Sleep(Random(5, 10))
Send($Skill1) ;leap
Sleep(700)
DoSprint()
Sleep(50)
RandClick("middle", Round(56 * $x_ratio), Round(360 * $y_ratio), 1, 1)
walktime(Round(56 * $x_ratio), Round(360 * $y_ratio))
For $i = 0 To UBound($celx) - 1
MouseMove(Round($celx[$i] * $x_ratio), Round($cely[$i] * $y_ratio), 1) ;moves cursor over to the cellar
Sleep(120)
;$Pixel2 = PixelSearch(600, 0, Round(1000 * $x_ratio), Round(300 * $y_ratio), 0xffffff, 5)
$Pixel2 = PixelSearch(0, 0, Round(600 * $x_ratio), Round(600 * $y_ratio), 0x334FB7, 3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
If Not @error Then
$cellfoundat = $i
ExitLoop
EndIf
Next
Sleep(100)
EndIf
If CheckDead() Then
Return
EndIf
;Checks if Dank Cellar is Open
If $cellfoundat > -1 Then
GUICtrlSetData($lblStatus, "Status: Cellar - Found at " & $cellfoundat + 1)
Call("AddLog", "Cellar Found at: " & $cellfoundat + 1)
$cellarCount += 1
$cellaratx = 1000 * $x_ratio
$cellaraty = 500 * $y_ratio
DoSprint()
If $UseEnhancedCellarFind Then
RandClick("middle", Round(400 * $x_ratio), Round(400 * $y_ratio), 1, 1)
walktime(Round(400 * $x_ratio), Round(400 * $y_ratio))
Local $cellpos = EnhancedFind(0, 0, 1300, 300, 1090, 280)
$cellaratx = $cellpos[0]
$cellaraty = $cellpos[1]
RandClick("left", Round($cellaratx), Round($cellaraty), 1, 1, 2, 2) ;Entrance to cellar
walktime(Round($cellaratx), Round($cellaraty))
;Call("AddLog",walktime(Round($cellaratx), Round($cellaraty),0,True))
;RandClick("left", Round(993 * $x_ratio), Round(469 * $y_ratio), 1, 1, 2, 2) ;Entrance to cellar
Else
;standard method co-ords
$cellaratx = $celx[$cellfoundat] * $x_ratio
$cellaraty = $cely[$cellfoundat] * $y_ratio
RandClick("left", Round($cellaratx), Round($cellaraty), 1, 1, 2, 2) ;Entrance to cellar
walktime(Round($cellaratx), Round($cellaraty), 1000)
EndIf
CheckFor("DankCellar", "Area", 0, 0, 0, 0, 1)
$CellarWasFound = 1
Else ;ABORT RUN
GUICtrlSetData($lblStatus, "Status: Cellar - Not Found" & @CRLF)
Call("AddLog", 'No Cellar')
If $TakeMissShots Then
CaptureToTIFF("", "", "", "shots\NoCell_" & String($run) & ".tif", 1, 0, 0, 0, 0)
EndIf
If $ExtraSafeExit Then
Send($Skill2) ;grim harvest
Sleep(500)
Send($Skill4) ;ancients
Sleep(500)
EndIf
Send("{SHIFTDOWN}")
RandClick("left", Round(900 * $x_ratio), Round(600 * $y_ratio), 100, 100) ;earthquake
Send("{SHIFTUP}")
Sleep(620)
Call("TownPortal")
If Not CheckDead() Then
Call("LeaveGame")
EndIf
Return
EndIf
Else
Call("TownPortal")
If Not CheckDead() Then
Call("LeaveGame")
EndIf
Return
EndIf
$TryRecover = 0
If Not CheckFor("DankCellar", "Area", 0, 0, 0, 0, .5) Then
;600 450 3s
RandClick("left", Round(993 * $x_ratio), Round(469 * $y_ratio), 1) ;Entrance to cellar
$TryRecover = 1
If Not CheckFor("DankCellar", "Area", 0, 0, 0, 0, 1.5) Then
If $UseEnhancedCellarFind Then
$TryRecover = 3
$cellpos = EnhancedFind(0, 0, 1300, 450, 1000, 350, True)
RandClick("left", Round($cellpos[0]), Round($cellpos[1]), 1) ;Entrance to cellar
Else
$TryRecover = 2
RandClick("left", Round(600 * $x_ratio), Round(450 * $y_ratio), 1)
EndIf
CheckFor("DankCellar", "Area", 0, 0, 0, 0, 4)
EndIf
EndIf
;Checks that the player is in the Dank Cellar
If CheckFor("DankCellar", "Area") Then
GUICtrlSetData($lblLocation, "Location: Dank Cellar")
If $TryRecover = 1 Then Call("AddLog", 'OnCellar Recovery Success from ontop')
If $TryRecover = 2 Then Call("AddLog", 'OnCellar Recovery Success From wall')
If $TryRecover = 3 Then Call("AddLog", 'OnCellar Recovery Success using enhanced find')
RandClick("middle", Round(80 * $x_ratio), Round(830 * $y_ratio), 1, 1) ;moves to doorway leading to rare inside cellar
walktime(Round(80 * $x_ratio), Round(830 * $y_ratio), -100)
;Sleep(Random(2250, 2300))
GUICtrlSetData($lblStatus, "Status: Attacking Sarkoth")
RandMove(Round(350 * $x_ratio), Round(60 * $y_ratio), 1) ;hovers over the rare Sarkoth
Send($Skill1)
Sleep(200)
Send("{SHIFTDOWN}")
RandClick("left", Round(11 * $x_ratio), Round(1037 * $y_ratio), 10, 10) ;earthquake
Sleep(200)
RandClick("left", Round(11 * $x_ratio), Round(1037 * $y_ratio), 10, 10) ;earthquake
Send("{SHIFTUP}")
Sleep(800)
Send($Skill2)
Sleep(140)
Send($Skill2)
Sleep(100)
Send($Skill2)
Sleep(100)
Send($Skill4)
Sleep(100)
Send($Skill4)
Sleep(100)
Send($Skill4)
Sleep(200)
MouseClick("right", Round(694 * $x_ratio), Round(929 * $y_ratio)) ;cancel aura thanks to LATM
If CheckDead() Then
Return
EndIf
Sleep(Random($SarkothKillTime, $SarkothKillTime + 400))
RandClick("middle", Round(730 * $x_ratio), Round(585 * $y_ratio), 1, 1) ;move to left top corner for gold
Sleep(Random(850, 1350))
RandClick("middle", Round(1205 * $x_ratio), Round(380 * $y_ratio), 1, 1) ;move to right top corner for gold
Sleep(Random(900, 1400))
RandClick("middle", Round(1121 * $x_ratio), Round(805 * $y_ratio), 1, 1) ;move to middle before looting
Sleep(Random(900, 1150))
GUICtrlSetData($lblStatus, "Status: Looting")
$numgem = 0
$numtomb = 0
$numgold = 0
$numpot = 0
$numitem = 0
DoSprint()
Call("Loot")
RandSleep(0, 6, 30)
Send($TownPortalButton)
Sleep(200)
Send($Inventory)
Sleep(200)
$mon = _TesseractScreenCapture(0, "", 1, 2, 1454 * $x_ratio, 508 * $y_ratio, (1920 - 1571) * $x_ratio, (1080 - 525) * $y_ratio, 0)
$mon = CleanOCR($mon)
$mondelt = Number($mon) - Number($monold)
If $mondelt > 15000 Then $mondelt = 5000
If $monstart = 0 Then $monstart = Number($mon) - $mondelt
Send($Inventory)
Sleep(50)
GUICtrlSetData($lblGold, "Gold: " & $mon & ", Run: " & $mondelt & ", Gain: " & Number($mon) - $monstart)
$monold = $mon
If $CheckLootWhilePorting Then
$lootany = 0
For $retryloot = 1 To 4
Sleep(450)
Loot(True)
If $lootany > 0 Then
Call("AddLog", 'Got extra loot on attempt ' & $retryloot)
Call("TownPortal")
ExitLoop
EndIf
Next
EndIf
Call("AddLog", 'Gold: ' & $mon & ', Gold Delt: ' & $mondelt & ', Items: ' & $numitem & ', Gems: ' & $numgem & ', Books: ' & $numtomb & ', Potions: ' & $numpot & ', GoldPick: ' & $numgold)
Else
If $TryRecover = 1 Then
Call("AddLog", 'OnCellar Recovery Failure')
EndIf
If $CellarWasFound = 1 Then
Call("AddLog", 'Cellar was found but didnt end up there')
EndIf
If $TakeMissShots Then
CaptureToTIFF("", "", "", "shots\MissCell_" & String($run) & ".tif", 1, 0, 0, 0, 0)
EndIf
Sleep(10)
Send("{SHIFTDOWN}")
RandClick("left", Round(900 * $x_ratio), Round(600 * $y_ratio), 100, 100) ;earthquake
Send("{SHIFTUP}")
Sleep(620)
Call("TownPortal")
If Not CheckDead() Then
Call("LeaveGame")
EndIf
Return
EndIf
;After successful run
If Not CheckDead() Then
Sleep(5600)
If $mLootIn = 1 And CheckFor("NewTristram", "Area") Then ;If its time to manage loot and we are in town
$mLootIn = Round(Random($mLoot - $mLootOff, $mLoot + $mLootOff)) ;Reset Counter
If $UseiLVL Then
Call("AnalyseLoots")
Else
If $Identify Then Call("Identify")
If $StashLoot Then Call("StashLoot")
If $SalvageLoot Then
Call("SalvageLoot")
Else
If $VendorLoot Then Call("VendorLoot")
EndIf
EndIf
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("LeaveGame")
EndIf
If ($RunsUntilMenuWaitCnt = 1) And ($RunsUntilMenuWait > 0) Then
$RunsUntilMenuWaitCnt = $RunsUntilMenuWait
Sleep(Random(3550000, 3650000)) ;wait 1 hour
Else
$RunsUntilMenuWaitCnt -= 1
EndIf
Return
Else
Return
EndIf
EndIf
EndFunc ;==>RestartRun
;Helper Functions
Func EnhancedFind($x1 = 0, $y1 = 0, $x2 = 577, $y2 = 220, $xpos = 367, $ypos = 135, $recov = False)
For $retry = 1 To 3
; take 2 snapshots and black out everything that did not change
FFSnapShot($x1 * $x_ratio, $y1 * $y_ratio, $x2 * $x_ratio, $y2 * $y_ratio, 2)
Sleep(50)
FFSnapShot($x1 * $x_ratio, $y1 * $y_ratio, $x2 * $x_ratio, $y2 * $y_ratio, 3)
FFKeepChanges(3, 2, 25)
;FFSaveBMP("CellarOpen_" & @HOUR & @MIN & @SEC, false) ->uncomment if you wanna see the cellar minimap motion map
; do special search for the color in our motionmap
Local $aColorArray[3] = [0x7897EB, 0x404E9E, 0x536CB6]
FFAddColor($aColorArray) ; add color to find array
;Func FFBestSpot($SizeSearch, $MinNbPixel, $OptNbPixel, $PosX, $PosY, $Color, $ShadeVariation = 0, $ForceNewSnap = True, $Left = 0, $Top = 0, $Right = 0, $Bottom = 0, $NoSnapShot = $FFLastSnap, $WindowHandle = -1)
Local $cellarCoords = FFBestSpot(10, 1, 4, $xpos * $x_ratio, $ypos * $y_ratio, -1, 25, False) ; search for the opening
If @error Or Not IsArray($cellarCoords) Then
Call("AddLog", "The motionmap failed on try " & $retry & " with code " & @error)
FFResetColors()
Else
ExitLoop
EndIf
Next
If (Not @error) And IsArray($cellarCoords) Then
FFResetColors()
If Not $recov Then GUICtrlSetData($lblStatus, "Status: Cellar - Found position " & $cellarCoords[0] * $x_ratio & ", " & $cellarCoords[1] * $y_ratio)
If Not $recov Then Call("AddLog", "Cellar - Found position " & $cellarCoords[0] * $x_ratio & ", " & $cellarCoords[1] * $y_ratio)
Else
If $TakeMissShots Then
CaptureToTIFF("", "", "", "shots\NoCell_" & String($run) & ".tif", 1, 0, 0, 0, 0)
EndIf
$cellarCoords[0] = 1000 * $x_ratio
$cellarCoords[1] = 500 * $y_ratio
EndIf
Return $cellarCoords
EndFunc ;==>EnhancedFind
Func SetupGUI()
$frmBot = GUICreate($title & $ver & " - Updating", 290, 140, Round(1580 * $x_ratio), Round(900 * $y_ratio), -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
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)
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
Call("AddLog", "Logged out")
GUICtrlSetData($lblStatus, "Status: Logging out")
CheckFor("MainMenu", "", Round(40 * $x_ratio), Round(300 * $y_ratio), Round(400 * $x_ratio), Round(450 * $y_ratio), $loadtime / 1000)
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")
Call("AddLog", "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")
Call("AddLog", "You have died")
$deathCount += 1
Call("LeaveGame")
For $c = 1 To 110 + $loadtime / 100
Sleep(100)
If CheckFor("MainMenu", "", Round(40 * $x_ratio), Round(300 * $y_ratio), Round(400 * $x_ratio), Round(450 * $y_ratio), 0.1) Then ExitLoop
Next
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()
Sleep(Random(75, 150))
Call("TownPortal")
If CheckDead() Then
Return
EndIf
If CheckFor("NewTristram", "Area") 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 CheckDead() Then
Call("LeaveGame")
EndIf
EndIf
EndFunc ;==>DoRepair
Func CalcTime()
$srt = TimerDiff($rt)
GUICtrlSetData($lblLast, "Last Runtime: " & Round($srt / 1000, 2) & " seconds.")
$trt = TimerDiff($t)
$total = Round((($trt / 1000) / 60) / 60, 4)
Call("AddLog", "Last Runtime: " & Round($srt / 1000, 2) & " seconds.")
;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, "Runtime: " & $hours & ":" & Ceiling($minutes) & ", GPH: " & Ceiling((Number($mon) - $monstart) / ($trt / 3600000)))
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
If $seconds = 6 Then $seconds = 2.5
EndIf
$c = 0
$string = $pngLoc & $img & ".png"
Do
$c += 1
Sleep(200)
If $c > ($seconds * 5) 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)
GUICtrlSetData($lblStatus, "Status: Area found! " & $img)
Return True
EndFunc ;==>CheckFor
Func DoSprint()
RandClick("right", Round(15 * $x_ratio), Round(1055 * $y_ratio)) ;sprint
$SprintStart = TimerInit()
EndFunc ;==>DoSprint
Func WalkTime($lootx, $looty, $extra = 0, $returnv = False)
$PPmSsprint = (960 / 2100) * $movementSpeed
$PPmSwalk = (960 / 3000) * $movementSpeed
Dim $BarbFeet[2] = [960 * $x_ratio, 505 * $y_ratio]
$dist = Sqrt(($BarbFeet[0] - $lootx) ^ 2 + ($BarbFeet[1] - $looty) ^ 2)
$sprintremain = 3000 - TimerDiff($SprintStart)
;determine if sprint is still active to choose run speed
If $sprintremain > 0 Then ;duration of sprint - 100 for safty
;calculate milliseconds per pixel for this run, return delay
;calculate composite sleep time
If $dist < $PPmSsprint * $sprintremain Then
$stime = ($dist / $PPmSsprint + $extra)
Else
$stime = (($sprintremain + ($dist - $sprintremain * $PPmSsprint) / $PPmSwalk) + $extra)
EndIf
Else
$stime = ($dist / $PPmSwalk + $extra)
EndIf
If Not $returnv Then
Sleep($stime)
EndIf
Return $stime
EndFunc ;==>WalkTime
Func Loot($extra = False)
MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
If Not $extra Then
If $LootGems Then
LootImage("square.png", 90, 10)
EndIf
If $LootTomes Then
LootImage("tome.png", 90, 10)
EndIf
If $LootMagic Then
$mac = LootGear(0x6969FF, 0)
$MagicCount += $mac
$numitem -= $mac
EndIf
EndIf
If $LootRares Then
$RareCount += LootGear(0xBBBB00, 1)
EndIf
If Not $extra Then
If $LootLegendaries Then
If $ReduceLegendSearch Then
$LegendaryCount += LootGear(0xBF642F, 1, 365, 442, 380)
$LegendaryCount += LootGear(0xBF642F, 1, 442, 1690, 115)
Else
$LegendaryCount += LootGear(0xBF642F, 1)
EndIf
EndIf
EndIf
If $LootSets Then
$SetCount += LootGear(0x02CE01, 2)
EndIf
If $LootCustom Then
Call("LootCustom")
EndIf
Call("ShowLoot")
EndFunc ;==>Loot
Func LootGear($color, $tolerance = 2, $x1 = 400, $x2 = 1690, $y1 = 20, $y2 = 900)
$count = 0
$Loot = PixelSearch(Round($x1 * $x_ratio), Round($y1 * $y_ratio), Round($x2 * $x_ratio), Round($y2 * $y_ratio), $color, $tolerance)
If Not @error Then
While Not @error
$count += 1
MouseClick('left', $Loot[0], $Loot[1], 1, 1)
Sleep(20)
MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
WalkTime($Loot[0], $Loot[1])
;Sleep(Random(700, 800))
;Run at max 10 times per quality
$lootany += 1
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 ;==>LootGear
Func LootImage($img, $tol, $max = 10)
$count = 0
$gX = 0
$gY = 0
GUICtrlSetData($lblStatus, "Status: Looting - " & $img)
While _ImageSearchArea($pngLoc & $img, 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, $tol)
$count += 1
MouseClick("left", $gX, $gY - 3, 1, 1)
Sleep(50)
MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
$lootany += 1
If $img == "square.png" Then
$GemCount += 1
$numgem += 1
ElseIf $img == "tome.png" Then
$TomeCount += 1
$numtomb += 1
ElseIf $img == "gold.png" Then
$numgold += 1
ElseIf $img == "mythic.png" Then
$numpot += 1
EndIf
WalkTime($gX, $gY)
If $count >= $max Then
ExitLoop
EndIf
WEnd
EndFunc ;==>LootImage
Func LootCustom()
For $i = 0 To ($totalItems - 1)
$array = StringSplit($pick[$i], "|")
LootImage($array[1], $array[2], 5)
Next
EndFunc ;==>LootCustom
Func Identify()
Send($Inventory)
Sleep(1300)
$count = 0
While _ImageSearchArea($pngLoc & "unidentified.png", 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $gX, $gY, 120)
$count += 1
GUICtrlSetData($lblStatus, "Status: Identifying")
MouseClick("right", $gX, $gY, 1, 4)
MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
Sleep(Random(3000, 3500))
If $count >= 30 Then
ExitLoop
EndIf
WEnd
Send($Inventory)
Sleep(200)
EndFunc ;==>Identify
Func CleanOCR($text)
$out = ""
For $i = 1 To StringLen($text)
$chr = Asc(StringMid($text, $i, 1))
If $chr >= 48 And $chr <= 57 Then $out = $out & Chr($chr)
If $chr = 79 Then $out = $out & '0'
Next
Return $out
EndFunc ;==>CleanOCR
Func ClickTab($Tabno)
If $Tabno = 1 Then RandClick("left", Round(517 * $x_ratio), Round(229 * $y_ratio), 3, 4)
If $Tabno = 2 Then RandClick("left", Round(517 * $x_ratio), Round(361 * $y_ratio), 3, 4)
If $Tabno = 3 Then RandClick("left", Round(517 * $x_ratio), Round(486 * $y_ratio), 3, 4)
Sleep(Random(100, 200))
EndFunc ;==>ClickTab
Func UseNextTab()
If $ItemTab = $NextItemTab Then
Call("AddLog", "Stash full Both tabs full, disabling stashing")
$StashLegendary = False
$StashRare = False
$StashMagic = False
Else
Call("AddLog", "Stash full Using next tab")
$ItemTab = $NextItemTab
EndIf
EndFunc ;==>UseNextTab
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 ;==>AddLog
Func StashLoot()
GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
MouseClick("left", 1064 * $x_ratio, 256 * $y_ratio)
Sleep(Random(800, 1000))
ClickTab($GemTab)
;Tomes
If $StashTomes Then
GUICtrlSetData($lblStatus, "Status: Stashing Tomes")
ClickImage("TomeIcon.png", 140, 1)
EndIf
;Gems (DOESN'T STASH BOTTOM ROW!)
If $StashGems Then
GUICtrlSetData($lblStatus, "Status: Stashing Gems")
For $i = 0 To 7
ClickImage($gems[$i], 150, 1)
Next
EndIf
$numstashed = 0;
ClickTab($ItemTab)
If $StashLegendary Then
ClickItems(0xFF7F00, 2, True, 5)
ClickItems(0x8F5C25, 2, True, 5)
EndIf
If $StashRare Then
ClickItems(0x4A3C0B, 1, True, 20)
EndIf
If $StashMagic Then
ClickItems(0x182037, 1, True, 30)
EndIf
Call("AddLog", "Stashed Items: " & $numstashed)
Sleep(Random(300, 400))
Send("{SPACE}")
EndFunc ;==>StashLoot
Func VendorLoot()
GUICtrlSetData($lblStatus, "Status: Vendoring Items")
Sleep(Random(200, 300))
Send($Skill3)
Sleep(Random(200, 300))
Send("{ESCAPE}")
DoSprint()
If Not $StashLoot Then ;Move from TP towards vendor
Sleep(Random(100, 300))
MouseClick("middle", 1565 * $x_ratio, 50 * $y_ratio)
walktime(1565 * $x_ratio, 50 * $y_ratio, 100)
Else ;Move from Stash towards vendor
Sleep(Random(100, 300))
MouseClick("middle", 1560 * $x_ratio, 120 * $y_ratio)
walktime(1560 * $x_ratio, 120 * $y_ratio, 100)
EndIf
MouseClick("left", 1030 * $x_ratio, 210 * $y_ratio) ;Talk to vendor
walktime(1030 * $x_ratio, 210 * $y_ratio, 250)
$numsold = 0;
;All
If $vendorAll Then
For $c = 1 To $vendorCols
For $r = 1 To $vendorRows
RandClick("right", (((($c - 1) * 50) + 32 + 1400) * $x_ratio), (((($r - 1) * 51) + 32 + 580) * $y_ratio), 2, 2, 1, 2.5)
Next
Next
EndIf
;Rares
If $VendorRare Then
ClickItems(0x4A3C0B, 2)
EndIf
;Magic
If $VendorMagic Then
ClickItems(0x182037, 2)
EndIf
$montmp = $mon
$mon = _TesseractScreenCapture(0, "", 1, 2, 1454 * $x_ratio, 508 * $y_ratio, (1920 - 1571) * $x_ratio, (1080 - 525) * $y_ratio, 0)
$mon = CleanOCR($mon)
If $mon > 0 Then
$mondelt = Number($mon) - Number($monold)
GUICtrlSetData($lblGold, "Gold: " & $mon & ", Sold value: " & $mondelt)
$monold = $mon
Call("AddLog", "Sold Items: " & $numsold & ", Sold value: " & $mondelt)
Else
$mLootIn = 1
$mon = $montmp
Call("AddLog", "Somthing went wrong in town, retrying next time")
GUICtrlSetData($lblGold, "Vend fail, retry next run")
Return
EndIf
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(400)
$mon = _TesseractScreenCapture(0, "", 1, 2, 1454 * $x_ratio, 508 * $y_ratio, (1920 - 1571) * $x_ratio, (1080 - 525) * $y_ratio, 0)
$mon = CleanOCR($mon)
$mondelt = Number($mon) - Number($monold)
GUICtrlSetData($lblGold, "Gold: " & $mon & ", Repair cost: " & $mondelt)
$monold = $mon
Call("AddLog", "Repair Cost: " & - $mondelt)
GUICtrlSetData($lblStatus, "Status: Done With Vendor")
Send("{ESCAPE}")
EndFunc ;==>VendorLoot
Func ClickItems($color, $tolerance, $checkfull = False, $max = 30)
$c = 0
While $c < $max
RandMove(1200 * $x_ratio, 600 * $y_ratio, 5, 5, 2)
Sleep(Random(60, 120))
$StashPixel = PixelSearch(1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $color, $tolerance)
If Not @error Then
MouseClick("right", $StashPixel[0], $StashPixel[1], 1, 4)
$c += 1
If $checkfull Then
$numstashed += 1
Else
$numsold += 1
EndIf
Else
ExitLoop
EndIf
WEnd
Sleep(Random(60, 120))
If $checkfull Then
If $c = $max Then Call("UseNextTab")
ClickTab($ItemTab)
EndIf
EndFunc ;==>ClickItems
Func ClickImage($image, $tolerance, $max = 20)
For $c = 1 To $max
RandMove(1200 * $x_ratio, 600 * $y_ratio, 5, 5, 2)
Sleep(Random(100, 300))
If _ImageSearchArea($pngLoc & $image, 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $gX, $gY, $tolerance) Then
MouseClick("right", $gX, $gY, 1, 4)
Sleep(120)
Else
ExitLoop
EndIf
Next
EndFunc ;==>ClickImage
Func SalvageLoot()
DoSprint()
GUICtrlSetData($lblStatus, "Status: Salvaging Items")
Sleep(Random(300, 500))
MouseClick("middle", 1786 * $x_ratio, 535 * $y_ratio)
walktime(1786 * $x_ratio, 535 * $y_ratio, 100)
;Sleep(2000)
MouseClick("left", 1430 * $x_ratio, 390 * $y_ratio) ;Talk to anvil
;Sleep(3000)
walktime(1430 * $x_ratio, 390 * $y_ratio, 100)
$c = 0
While $c <= 20
Sleep(Random(200, 300))
$MagicPixel = PixelSearch(1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 830 * $y_ratio, 0x182037, 1)
If Not @error Then
MouseClick("left", 265 * $x_ratio, 291 * $y_ratio, 1, 4)
Sleep(Random(200, 300))
MouseClick("left", $MagicPixel[0], $MagicPixel[1], 1, 4)
Sleep(Random(200, 300))
MouseClick("left", 1072 * $x_ratio, 375 * $y_ratio, 1, 4)
RandMove(1200 * $x_ratio, 600 * $y_ratio, 5, 5, 2)
Sleep(40)
$c += 1
Else
ExitLoop
EndIf
WEnd
Call("AddLog", "Salvaged Items: " & $c)
Send("{ESCAPE}")
Sleep(Random(300, 500))
EndFunc ;==>SalvageLoot
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 LeaveGame()
Call("RandSleep")
GUICtrlSetData($lblStatus, "Status: Leaving Game")
Send("{Escape}")
Sleep(200)
RandClick("left", Round(956 * $x_ratio), Round(579 * $y_ratio), 120, 20) ;Random Click on the leave button
Call("CalcTime")
Sleep($loadtime)
EndFunc ;==>LeaveGame
Func TownPortalShort()
$gX = 0
$gY = 0
$c = 0
GUICtrlSetData($lblStatus, "Status: Waiting for TP bar")
Do
$c += 1
Sleep(200)
If $c > 4 Then Return
Until _ImageSearchArea($pngLoc & "TP.png", 1, 600, 200, 1000, 500, $gX, $gY, 50)
$seconds = $TPProtectTime
$c = 0
Do
$c += 1
GUICtrlSetData($lblStatus, "Status: Prepared for inturrupt, " & $seconds * 5 - $c)
Sleep(200)
If $c > ($seconds * 5) Then ;Make sure we never get stuck here for infinity.
GUICtrlSetData($lblStatus, "Status: safe, doing long wait for town")
Sleep($tptime - $seconds * 1000 - 1200)
GUICtrlSetData($lblStatus, "Status: detecting town")
CheckFor("NewTristram", "Area")
Sleep(300)
Return
EndIf
Until Not _ImageSearchArea($pngLoc & "TP.png", 1, 600, 200, 1000, 500, $gX, $gY, 50)
EndFunc ;==>TownPortalShort
Func TownPortal()
GUICtrlSetData($lblStatus, "Status: Returning to Town")
Send($TownPortalButton)
If $DetectTPFail Then
Call("TownPortalShort")
Else
Sleep(Random($tptime, $tptime + 500))
EndIf
EndFunc ;==>TownPortal
#region OtherStuff
Func Moving($time)
Sleep($time / $movementSpeed)
EndFunc ;==>Moving
Func RandClick($clickType, $xpos, $ypos, $xOff = 10, $yOff = 10, $clicks = 1, $speed = 4)
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 RandSleep($min = 5, $max = 45, $chance = 3)
$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 ;==>RandSleep
;Hotkey Functions
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)
GUICtrlSetData($lblItems, "Magic: " & $MagicCount & " - Gems: " & $GemCount & " - Tomes: " & $TomeCount)
EndFunc ;==>ShowLoot
Func Stop() ;to allow the script to stop
Exit
EndFunc ;==>Stop
Func GoTown()
$mLootIn = 1
EndFunc ;==>GoTown
Func AnalyseLoots() ; Grid search + ilvl detection, a little bit slower than old method but computes db for fast stashing/vendoring/new salvaging
;ConsoleWrite("---- NEW ANALYSIS ----" & @crlf)
$str_Stash = ""
$str_StashGems = ""
$str_StashMisc = ""
$str_Vendor = ""
$str_Salvage = ""
$int_TownPosition = 0
$int_emptygrid = 0
$str_Ignore = ""
$nX = 0
$nY = 0
GUICtrlSetData($lblStatus, "Status: Analysing loots")
Send("c")
Sleep(500)
For $y = 0 To 5
$int_emptygrid = 0
MouseMove(1435, Round(609 + (45 * $y)), 1)
Sleep(500)
For $x = 0 To 9
If StringInStr($str_Ignore, 1435 + (48 * $x) & "," & 609 + (45 * $y)) Then ContinueLoop
MouseMove(1435 + (48 * $x), 609 + (45 * $y), 1)
Sleep(300)
If _ImageSearchArea($pngLoc & "tt_check.png", 0, Round((1435 + (48 * $x) - 455) * $x_ratio), Round((609 + (45 * $y) - 500) * $y_ratio), Round((1435 + (48 * $x) - 35) * $x_ratio), Round(1080 * $y_ratio), $gX, $gY, 10) Then ; If tooltip exists
$int_emptygrid = 0
If _ImageSearchArea($pngLoc & "tt_unidentified.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) And $Identify Then ; Identify items.
MouseClick("secondary")
Sleep(Random(3000, 3500, 1))
EndIf
If _ImageSearchArea($pngLoc & "tt_square.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) Then ; Gem, automatic stashing.
$str_StashGems = $str_StashGems & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "tt_tome.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) Then ; Tome, automatic stashing.
$str_StashMisc = $str_StashMisc & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "tt_exquisite.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) Then ; Crafting, automatic stashing.
$str_StashMisc = $str_StashMisc & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "tt_iridescent.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) Then ; Crafting, automatic stashing.
$str_StashMisc = $str_StashMisc & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "tt_fiery.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) Then ; Crafting, automatic stashing (faster than the pixel detection below).
$str_StashMisc = $str_StashMisc & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "tt_plan.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 60) Then ; Plans, automatic stashing.
$str_StashMisc = $str_StashMisc & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "tt_neck.png", 0, $gX + 320, $gY + 60, $gX + 425, $gY + 150, $nX, $nY, 60) == 0 And _ImageSearchArea($pngLoc & "tt_waist.png", 0, $gX + 320, $gY + 60, $gX + 425, $gY + 150, $nX, $nY, 60) == 0 And _ImageSearchArea($pngLoc & "tt_finger.png", 0, $gX + 320, $gY + 60, $gX + 425, $gY + 150, $nX, $nY, 60) == 0 And _ImageSearchArea($pngLoc & "tt_follower.png", 0, $gX + 320, $gY + 60, $gX + 425, $gY + 150, $nX, $nY, 60) == 0 Then
$str_Ignore = $str_Ignore & "|" & 1435 + (48 * $x) & "," & 609 + (45 * ($y + 1))
EndIf
$tt_title = PixelSearch($gX, $gY, $gX + 425, $gY + 70, 0x00FF00, 1) ; Set, no ilvl check since they drop rarely. Goes to stash.
If Not @error Then
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ContinueLoop
EndIf
$tt_title = PixelSearch($gX, $gY, $gX + 425, $gY + 70, 0xBF642F, 1) ; Legendary, no ilvl check since they drop rarely. Goes to stash.
If Not @error Then
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ContinueLoop
EndIf
$tt_title = PixelSearch($gX, $gY, $gX + 425, $gY + 70, 0xFFFF00, 1) ; Rare
If Not @error Then
If _ImageSearchArea($pngLoc & "ilvl59.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Rare ilvl 59
If (getOption("i59r") == 1) Then
$str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
ElseIf (getOption("i59r") == 2) Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
EndIf
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "ilvl60.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Rare ilvl 60, goes to salvage
If (getOption("i60r") == 1) Then
$str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
ElseIf (getOption("i60r") == 2) Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
EndIf
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "ilvl61.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Rare ilvl 61, goes to salvage
If (getOption("i61r") == 1) Then
$str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
ElseIf (getOption("i61r") == 2) Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
EndIf
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "ilvl62.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Rare ilvl 62, goes to salvage
If (getOption("i62r") == 1) Then
$str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
ElseIf (getOption("i62r") == 2) Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
EndIf
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "ilvl63.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Rare ilvl 63, goes to stash
If (getOption("i63r") == 1) Then
$str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ElseIf (getOption("i63r") == 2) Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
EndIf
ContinueLoop
EndIf
; Below ilvl 59
If $StashRare Then
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ElseIf $VendorRare Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
EndIf
ContinueLoop
EndIf
$tt_title = PixelSearch($gX, $gY, $gX + 425, $gY + 70, 0x6969FF, 1) ; Magic
If Not @error Then
If _ImageSearchArea($pngLoc & "ilvl59.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Magic ilvl 59
If (getOption("i59m") == 1) Then
$str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ElseIf (getOption("i59m") == 2) Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
EndIf
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "ilvl60.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Magic ilvl 60, goes to salvage
If (getOption("i60m") == 1) Then
$str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ElseIf (getOption("i60m") == 2) Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
EndIf
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "ilvl61.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Magic ilvl 61, goes to salvage
If (getOption("i61m") == 1) Then
$str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ElseIf (getOption("i61m") == 2) Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
EndIf
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "ilvl62.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Magic ilvl 62, goes to salvage
If (getOption("i62m") == 1) Then
$str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ElseIf (getOption("i62m") == 2) Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
EndIf
ContinueLoop
EndIf
If _ImageSearchArea($pngLoc & "ilvl63.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Magic ilvl 63, goes to stash
If (getOption("i63m") == 1) Then
$str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ElseIf (getOption("i63m") == 2) Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
Else
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
EndIf
ContinueLoop
EndIf
; Below ilvl 59
If $StashMagic Then
$str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
ElseIf $VendorMagic Then
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
Else
$str_Ignore = $str_Ignore & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
EndIf
ContinueLoop
EndIf
; Probably white/gray trash bugged pick, add to vendor string
$str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
Else
$int_emptygrid += 1
If $int_emptygrid == 2 Then ; If there's nothing 2 times in a row in a row (see wut i did thar?), it probably ends here, skip to the next row.
$int_emptygrid = 0
ExitLoop
Else
ContinueLoop
EndIf
EndIf
Next
Next
Send("c")
Sleep(500)
;Call("AddLog", "Stash gear : " & $str_Stash )
;Call("AddLog", "Stash misc : " & $str_StashMisc )
;Call("AddLog", "Stash gems : " & $str_StashGems )
;Call("AddLog", "Salvage : " & $str_Salvage )
;Call("AddLog", "Vendor : " & $str_Vendor )
;Call("AddLog", "Ignored Square : " & $str_Ignore )
Call("AddLog", "Stashed Items: " & UBound(StringSplit($str_Stash, "|")))
If $str_Stash <> "" Or $str_StashGems <> "" Or $str_StashMisc <> "" Then Call("StashLoot_new")
If $str_Salvage <> "" Then Call("SalvageLoot_new")
If $str_Vendor <> "" Then Call("VendorLoot_new")
EndFunc ;==>AnalyseLoots
Func StashLoot_new()
$arr_split = ""
$pos_split = ""
GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
MouseClick("left", 1064 * $x_ratio, 256 * $y_ratio)
Moving(1600)
$int_TownPosition = 1
;Gems Page 1
If $str_StashGems <> "" Then
ClickTab($GemTab)
$str_StashGems = StringMid($str_StashGems, 2)
$arr_split = StringSplit($str_StashGems, "|")
For $i = 1 To $arr_split[0]
Sleep(Random(300, 350))
$pos_split = StringSplit($arr_split[$i], ",", 2)
MouseClick("right", $pos_split[0], $pos_split[1], 1, 3)
Next
EndIf
;Tomes/Crafting Materials/Plans/Etc Page 2
If $str_StashMisc <> "" Then
ClickTab($GemTab)
$str_StashMisc = StringMid($str_StashMisc, 2)
$arr_split = StringSplit($str_StashMisc, "|")
For $i = 1 To $arr_split[0]
Sleep(Random(300, 350))
$pos_split = StringSplit($arr_split[$i], ",", 2)
MouseClick("right", $pos_split[0], $pos_split[1], 1, 3)
Next
EndIf
;Gears Page 2
If $str_Stash <> "" Then
$str_Stash = StringMid($str_Stash, 2)
$arr_split = StringSplit($str_Stash, "|")
For $i = 1 To $arr_split[0]
Sleep(Random(80, 100))
If Random() < 0.5 Then
ClickTab($ItemTab)
Else
ClickTab($NextItemTab)
EndIf
Sleep(Random(300, 350))
$pos_split = StringSplit($arr_split[$i], ",", 2)
MouseClick("right", $pos_split[0], $pos_split[1], 1, 3)
Next
EndIf
Sleep(Random(100, 150))
Send("{SPACE}")
EndFunc ;==>StashLoot_new
Func SalvageLoot_new()
$arr_split = ""
$pos_split = ""
GUICtrlSetData($lblStatus, "Status: Salvaging loots")
If $int_TownPosition = 0 Then ; Starting from TP
MouseClick("middle", 1582 * $x_ratio, 527 * $y_ratio)
Moving(2000)
MouseClick("left", 1661 * $x_ratio, 409 * $y_ratio)
Moving(2500)
Else ; Starting from Stash
MouseClick("middle", 1484 * $x_ratio, 583 * $y_ratio)
Moving(2000)
MouseClick("left", 1773 * $x_ratio, 484 * $y_ratio)
Moving(2500)
EndIf
$int_TownPosition = 2
MouseClick("left", 263 * $x_ratio, 287 * $y_ratio)
$str_Salvage = StringMid($str_Salvage, 2)
$arr_split = StringSplit($str_Salvage, "|")
For $i = 1 To $arr_split[0]
Sleep(Random(300, 400))
$pos_split = StringSplit($arr_split[$i], ",")
MouseClick("left", $pos_split[1], $pos_split[2], 1, 3)
If $pos_split[0] == 3 Then
Send("{ENTER}")
Sleep(1000)
EndIf
Next
Sleep(Random(300, 400))
Send("{SPACE}")
EndFunc ;==>SalvageLoot_new
Func VendorLoot_new()
$arr_split = ""
$pos_split = ""
GUICtrlSetData($lblStatus, "Status: Vendoring Items")
If $int_TownPosition = 0 Then ; Starting from TP
MouseClick("middle", 1565 * $x_ratio, 50 * $y_ratio)
ElseIf $int_TownPosition = 1 Then ; Starting from Stash
MouseClick("middle", 1560 * $x_ratio, 120 * $y_ratio)
Else ; Starting from Blacksmith
MouseClick("middle", 738 * $x_ratio, 64 * $y_ratio)
EndIf
Moving(3000)
MouseClick("left", 1030 * $x_ratio, 210 * $y_ratio) ;Talk to vendor
Moving(3000)
$str_Vendor = StringMid($str_Vendor, 2)
$arr_split = StringSplit($str_Vendor, "|")
For $i = 1 To $arr_split[0]
Sleep(Random(100, 300))
$pos_split = StringSplit($arr_split[$i], ",", 2)
MouseClick("right", $pos_split[0], $pos_split[1], 1, 3)
If PixelGetColor(819 * $x_ratio, 375 * $y_ratio) == 0x370C00 Then Send("{ENTER}")
Next
Sleep(Random(100, 200))
$mon = _TesseractScreenCapture(0, "", 1, 2, 1454 * $x_ratio, 508 * $y_ratio, (1920 - 1571) * $x_ratio, (1080 - 525) * $y_ratio, 0)
$mon = CleanOCR($mon)
$mondelt = Number($mon) - Number($monold)
GUICtrlSetData($lblGold, "Gold: " & $mon & ", Sold value: " & $mondelt)
$monold = $mon
Call("AddLog", "Sold Items: " & $arr_split[0] & ", Sold value: " & $mondelt)
Sleep(Random(200, 300))
RandClick("left", Round(521 * $x_ratio), Round(506 * $y_ratio), 1, 1) ;button to open up repair menu
Sleep(200)
RandClick("left", Round(260 * $x_ratio), Round(595 * $y_ratio), 1, 1) ;button to pay for repairs
Sleep(400)
$mon = _TesseractScreenCapture(0, "", 1, 2, 1454 * $x_ratio, 508 * $y_ratio, (1920 - 1571) * $x_ratio, (1080 - 525) * $y_ratio, 0)
$mon = CleanOCR($mon)
$mondelt = Number($mon) - Number($monold)
GUICtrlSetData($lblGold, "Gold: " & $mon & ", Repair cost: " & $mondelt)
$monold = $mon
Call("AddLog", "Repair Cost: " & - $mondelt)
GUICtrlSetData($lblStatus, "Status: Done With Vendor")
Send("{SPACE}")
EndFunc ;==>VendorLoot_new
Func getOption($option) ;Gets the correct INI settings corrisponding to the vend/stash/salvage of items.
If ($option == "i59r") Then
If ($i59Rare = "salvage") Then
Return 1
ElseIf ($i59Rare = "vend") Then
Return 2
Else
Return 0
EndIf
ElseIf ($option == "i60r") Then
If ($i60Rare = "salvage") Then
Return 1
ElseIf ($i60Rare = "vend") Then
Return 2
Else
Return 0
EndIf
ElseIf ($option == "i61r") Then
If ($i61Rare = "salvage") Then
Return 1
ElseIf ($i61Rare = "vend") Then
Return 2
Else
Return 0
EndIf
ElseIf ($option == "i62r") Then
If ($i62Rare = "salvage") Then
Return 1
ElseIf ($i62Rare = "vend") Then
Return 2
Else
Return 0
EndIf
ElseIf ($option == "i63r") Then
If ($i63Rare = "salvage") Then
Return 1
ElseIf ($i63Rare = "vend") Then
Return 2
Else
Return 0
EndIf
ElseIf ($option == "i59m") Then
If ($i59Magic = "salvage") Then
Return 1
ElseIf ($i59Magic = "vend") Then
Return 2
Else
Return 0
EndIf
ElseIf ($option == "i60m") Then
If ($i60Magic = "salvage") Then
Return 1
ElseIf ($i60Magic = "vend") Then
Return 2
Else
Return 0
EndIf
ElseIf ($option == "i61m") Then
If ($i61Magic = "salvage") Then
Return 1
ElseIf ($i61Magic = "vend") Then
Return 2
Else
Return 0
EndIf
ElseIf ($option == "i62m") Then
If ($i62Magic = "salvage") Then
Return 1
ElseIf ($i62Magic = "vend") Then
Return 2
Else
Return 0
EndIf
ElseIf ($option == "i63m") Then
If ($i63Magic = "salvage") Then
Return 1
ElseIf ($i63Magic = "vend") Then
Return 2
Else
Return 0
EndIf
Else
Return 0
EndIf
EndFunc ;==>getOption
#endregion OtherStuff