Code:
-21
+21 Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $ver = "1.9.3", $ini = "DH.ini", $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, $str_Stash, $str_StashGems, $str_StashMisc, $str_Vendor, $str_Salvage, $int_TownPosition
-292 to 297
+292 Call("AnalyseLoots")
Functions
Func AnalyseLoots() ; Grid search + ilvl detection, a little bit slower than old method but computes db for fast stashing/vendoring/new salvaging
$str_Stash = ""
$str_StashGems = ""
$str_StashTomes = ""
$str_Vendor = ""
$str_Salvage = ""
$int_TownPosition = 0
GUICtrlSetData($lblStatus, "Status: Analysing loots")
Send("c")
Sleep(500)
For $y = 0 to 5
Mousemove(1435,Round(609+(45*$y)),2)
For $x = 0 to 9
Mousemove(1435+(48*$x),609+(45*$y),2)
Sleep(100)
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, 20) Then ; If tooltip exists
if _ImageSearchArea($pngLoc & "tt_square.png", 0, $gX, $gY, $gX+425, $gY+70,$gX,$gY,20) 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,20) 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,20) 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,20) 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,20) 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,20) Then ; Plans, automatic stashing.
$str_StashMisc = $str_StashMisc & "|" & 1435+(48*$x) & "," & 609+(45*$y)
ContinueLoop
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, goes to salvage
$str_Salvage = $str_Salvage & "|" & 1435+(48*$x) & "," & 609+(45*$y)
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
$str_Salvage = $str_Salvage & "|" & 1435+(48*$x) & "," & 609+(45*$y)
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
$str_Salvage = $str_Salvage & "|" & 1435+(48*$x) & "," & 609+(45*$y)
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
$str_Salvage = $str_Salvage & "|" & 1435+(48*$x) & "," & 609+(45*$y)
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
$str_Stash = $str_Stash & "|" & 1435+(48*$x) & "," & 609+(45*$y)
ContinueLoop
endif
; Below ilvl 59, goes to vendor
$str_Vendor = $str_Vendor & "|" & 1435+(48*$x) & "," & 609+(45*$y)
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, goes to salvage
$str_Salvage = $str_Salvage & "|" & 1435+(48*$x) & "," & 609+(45*$y)
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
$str_Salvage = $str_Salvage & "|" & 1435+(48*$x) & "," & 609+(45*$y)
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
$str_Salvage = $str_Salvage & "|" & 1435+(48*$x) & "," & 609+(45*$y)
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
$str_Salvage = $str_Salvage & "|" & 1435+(48*$x) & "," & 609+(45*$y)
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
$str_Stash = $str_Stash & "|" & 1435+(48*$x) & "," & 609+(45*$y)
ContinueLoop
endif
; Below ilvl 59, goes to vendor
$str_Vendor = $str_Vendor & "|" & 1435+(48*$x) & "," & 609+(45*$y)
ContinueLoop
endif
; Probably white/gray trash bugged pick, add to vendor string
$str_Vendor = $str_Vendor & "|" & 1435+(48*$x) & "," & 609+(45*$y)
Else
ContinueLoop
EndIf
Next
Next
Send("c")
Sleep(500)
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
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
MouseClick("left", 500 * $x_ratio, 200 * $y_ratio, 1, 3)
$str_StashGems = StringMid($str_StashGems,2)
$arr_split = StringSplit($str_StashGems,"|")
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)
Next
EndIf
;Tomes/Crafting Materials/Plans/Etc Page 2
if $str_StashMisc <> "" Then
MouseClick("left", 500 * $x_ratio, 360 * $y_ratio, 1, 3)
$str_StashMisc = StringMid($str_StashMisc,2)
$arr_split = StringSplit($str_StashMisc,"|")
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)
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(100, 300))
$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
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(100, 300))
$pos_split = StringSplit($arr_split[$i], ",", 2)
MouseClick("left", $pos_split[0], $pos_split[1], 1, 3)
Sleep(100)
if PixelGetColor(819*$x_ratio,375*$y_ratio) == 0x370C00 then Send("{ENTER}")
Next
Sleep(Random(100, 150))
Send("{SPACE}")
EndFunc
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(500, 800))
Send("{SPACE}")
EndFunc