Code:
#include <SimpleTesseractColor.au3>
HotKeySet("=", "StashLoot")
HotKeySet("-", "Stop") ;script stopped by pressing x
Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"),$Kill = ProcessList("AutoIt3_x64.exe"), $x_ratio, $y_ratio, $i = 0, $gX = 0, $gY = 0, $StashSelectedTab = 0
Global $gems[4] = ["Em1.png", "Ru1.png", "To1.png", "Am1.png"]
$x_ratio = $size[0] / 800
$y_ratio = $size[1] / 600
$pngLoc = @ScriptDir & "\pics\" & @DesktopWidth & "x" & @DesktopHeight& "\"
;full stash tab select
$StashSelectedTab = 0
Global $StashTabs[3][2] = [[281,127], [281,199], [285,271]]
;Stash Loot!
$StashLegendary = 1 ;1 if you want to store Legendary items in the stash
$StashSet = 1 ;1 if you want to store Set items in the stash
$StashRare = 1 ;1 if you want to store Rare items in the stash
$StashMagic = 0 ;1 if you want to store Magic items in the stash
$StashTomes = 1 ;1 if you want to store Tomes items in the stash
$StashGems = 1 ;1 if you want to store Gems items in the stash
$StashLoot = $StashMagic + $StashRare + $StashLegendary + $Stashset + $StashGems + $StashTomes
;Anal Loot!!
$AnalLoot = 1
$RareSalvageiLvl = 61 ;and below to Salvage #
$MagicSalvageiLvl = 61 ;and below to Salvage #
$RareStashiLvl = 63 ;and above to Stash #
$MagicStashiLvl = 63 ;and above to Stash #
$RareVendoriLvl = 60 ;and below to Vendor #
$MagicVendoriLvl = 60 ;and below to Vendor #
Global $AnalyzedLoot[10][6]
;====DONT CHANGE=====;
$AnalSalvage = 0 ;determines whether not theres items to salvage
$AnalRareIdentify = 0 ;determines whether not theres a rare to identify, don't change
$AnalVendor = 0
Func StashLoot()
MouseClick("left", 465* $x_ratio,172* $y_ratio)
sleep(1600)
If $StashSelectedTab > 0 Then MouseClick("left", Round($StashTabs[$StashSelectedTab][0] * $x_ratio) ,Round($StashTabs[$StashSelectedTab][1] * $x_ratio), 1, 4)
;Tomes
If $StashTomes = 1 And $StashLoot > 0 Then
sleep(80)
;Tomes
While $StashTomes = 1
Sleep(Random(50, 150))
If _ImageSearchArea($pngLoc & "TomeIcon.png", 1, Round(515 * $x_ratio),Round(323 * $y_ratio),Round(791 * $x_ratio),Round(489 * $y_ratio), $gX, $gY, 30) Then
MouseClick("right", $gX, $gY, 1, 4)
Sleep(80)
Else
ExitLoop
EndIf
If CheckFullStash() = 0 Then ExitLoop
WEnd
;Gems
If $StashGems = 1 And $StashLoot > 0 Then
Sleep(Random(20, 100))
For $sg = 0 To 3
If _ImageSearchArea($pngLoc & $gems[$sg], 1, Round(515 * $x_ratio),Round(323 * $y_ratio),Round(791 * $x_ratio),Round(489 * $y_ratio), $gX, $gY, 140) Then
MouseClick("right", $gX, $gY, 1, 3)
EndIf
If CheckFullStash() = 0 Then ExitLoop
Next
EndIf
EndIf
If $StashLegendary = 1 And $StashLoot > 0 Then
StashItems(0x8B6029, 0)
StashItems(0x7A4E18, 0)
StashItems(0x422408, 0)
EndIf
If $AnalLoot = 1 And $StashLoot > 0 Then
MouseMove(Round($StashTabs[$StashSelectedTab][0] * $x_ratio) ,Round($StashTabs[$StashSelectedTab][1] * $x_ratio), 2)
AnalLoot()
Send("{SPACE}")
If $AnalSalvage = 1 Then
If $AnalRareIdentify = 1 Then
DoIdentify()
EndIf
DoSalvage()
EndIf
If $AnalVendor = 1 Then
If $AnalRareIdentify = 1 Then
DoIdentify()
EndIf
VendorLoot()
EndIf
EndIF
$AnalSalvage = 0
$AnalRareIdentify = 0
$AnalVendor = 0
EndFunc ;==>StashLoot
Func StashItems($color, $tolerance)
$c = 0
While $c <= 20
Sleep(Random(20, 100))
$StashPixel = PixelSearch(Round(515 * $x_ratio),Round(323 * $y_ratio),Round(791 * $x_ratio),Round(489 * $y_ratio), $color, $tolerance)
If Not @error Then
MouseClick("right", $StashPixel[0] + 1, $StashPixel[1], 1, 4)
$c += 1
Else
ExitLoop
EndIf
If CheckFullStash() = 0 Then ExitLoop
WEnd
EndFunc ;==>StashItems
Func CheckFullStash()
If _ImageSearchArea($pngLoc & "FullStash.png", 1, Round(320 * $x_ratio),Round(72 * $y_ratio), Round(376 * $y_ratio),Round(88 * $x_ratio), $gX, $gY, 140) Then
If $StashSelectedTab < 2 Then
$StashSelectedTab += 1
ElseIf $StashSelectedTab = 2 Then
$StashLoot = 0
Return 0
EndIf
Do
Sleep(100)
Until Not _ImageSearchArea($pngLoc & "FullStash.png", 1, Round(320 * $x_ratio),Round(72 * $y_ratio), Round(376 * $y_ratio),Round(88 * $x_ratio), $gX, $gY, 140)
MouseClick("right")
MouseClick("left", Round($StashTabs[$StashSelectedTab][0] * $x_ratio) ,Round($StashTabs[$StashSelectedTab][1] * $x_ratio), 1, 4)
EndIf
Return 1
EndFunc
Func AnalLoot()
$slot1topx = 519 ; first slot x coordinate
$slot1topy = 325; first slot y coordinate
$slot1botx = 545 ; first slot x coordinate
$slot1boty = 351; first slot y coordinate
$offset = 27 ; offset for each slot
$iLvl = 0
For $i = 0 To 9
For $j = 0 To 5
$StashPixelRare1 = PixelSearch($slot1topx + $i * $offset, $slot1topy + $j * $offset, $slot1botx + $i * $offset,$slot1boty + $j * $offset, 0x4A3C0B, 2)
$StashPixelRare2 = PixelSearch($slot1topx + $i * $offset, $slot1topy + $j * $offset, $slot1botx + $i * $offset,$slot1boty + $j * $offset, 0x514711, 2)
If IsArray($StashPixelRare1) Then
MouseMove($StashPixelRare1[0] + 1, $StashPixelRare1[1])
$iLvl = GetiLvl()
If $iLvl > 0 Then
If $iLvl >= $RareStashiLvl Then
ToolTip($iLvl & " Stashing Rare @ " & $StashPixelRare1[0] +1 & "," & $StashPixelRare1[1],10,10,"Analyzing Loot")
MouseClick("Right", $StashPixelRare1[0] + 1, $StashPixelRare1[1], 1, 4)
Elseif $iLvl <= $RareSalvageiLvl And $iLvl > $RareVendoriLvl Then
ToolTip ($iLvl & " Salvaging Rare @ " & $StashPixelRare1[0] +1 & "," & $StashPixelRare1[1],10,10,"Analyzing Loot")
$AnalyzedLoot[$i][$j] = $StashPixelRare1[0] +1 & "," & $StashPixelRare1[1] & ",Salvage,Rare," & $iLvl
$AnalSalvage = 1
$AnalRareIdentify = 1
Elseif $iLvl <= $RareVendoriLvl Then
ToolTip ($iLvl & " Vendoring Rare @ " & $StashPixelRare1[0] +1 & "," & $StashPixelRare1[1],10,10,"Analyzing Loot")
$AnalyzedLoot[$i][$j] = $StashPixelRare1[0] +1 & "," & $StashPixelRare1[1] & ",Vendor,Rare," & $iLvl
$AnalRareIdentify = 1
$AnalVendor = 1
EndIf
EndIf
ElseIf IsArray($StashPixelRare2) Then
MouseMove($StashPixelRare2[0] + 1, $StashPixelRare2[1])
$iLvl = GetiLvl()
If $iLvl > 0 Then
If $iLvl >= $RareStashiLvl Then
ToolTip ($iLvl & " Stashing Rare @ " & $StashPixelRare2[0] +1 & "," & $StashPixelRare2[1],10,10,"Analyzing Loot")
MouseClick("Right", $StashPixelRare2[0] + 1, $StashPixelRare2[1], 1, 4)
Elseif $iLvl <= $RareSalvageiLvl And $iLvl > $RareVendoriLvl Then
ToolTip ($iLvl & " Salvaging Rare @ " & $StashPixelRare2[0] +1 & "," & $StashPixelRare2[1],10,10,"Analyzing Loot")
$AnalyzedLoot[$i][$j] = $StashPixelRare2[0] +1 & "," & $StashPixelRare2[1] & ",Salvage,Rare," & $iLvl
$AnalSalvage = 1
$AnalRareIdentify = 1
Elseif $iLvl <= $RareVendoriLvl Then
ToolTip ($iLvl & " Vendoring Rare @ " & $StashPixelRare2[0] +1 & "," & $StashPixelRare2[1],10,10,"Analyzing Loot")
$AnalyzedLoot[$i][$j] = $StashPixelRare2[0] +1 & "," & $StashPixelRare2[1] & ",Vendor,Rare," & $iLvl
$AnalRareIdentify = 1
$AnalVendor = 1
EndIf
EndIf
Else
$StashPixelMagic1 = PixelSearch($slot1topx + $i * $offset, $slot1topy + $j * $offset, $slot1botx + $i * $offset,$slot1boty + $j * $offset, 0x141C2F, 2)
$StashPixelMagic2 = PixelSearch($slot1topx + $i * $offset, $slot1topy + $j * $offset, $slot1botx + $i * $offset,$slot1boty + $j * $offset, 0x1B3854, 2)
If IsArray($StashPixelMagic1) Then
MouseMove($StashPixelMagic1[0] + 1, $StashPixelMagic1[1])
$iLvl = GetiLvl()
If $iLvl >= $MagicStashiLvl Then
ToolTip ($iLvl & " Stashing Magic @ " & $StashPixelMagic1[0] +1 & "," & $StashPixelMagic1[1],10,10,"Analyzing Loot")
MouseClick("Right", $StashPixelMagic1[0] + 1, $StashPixelMagic1[1], 1, 4)
Elseif $iLvl <= $MagicSalvageiLvl And $iLvl > $MagicVendoriLvl Then
ToolTip ($iLvl & " Salvaging Magic @ " & $StashPixelMagic1[0] +1 & "," & $StashPixelMagic1[1],10,10,"Analyzing Loot")
$AnalyzedLoot[$i][$j] = $StashPixelMagic1[0] +1 & "," & $StashPixelMagic1[1] & ",Salvage,Magic," & $iLvl
$AnalSalvage = 1
Elseif $iLvl <= $MagicVendoriLvl Then
ToolTip ($iLvl & " Vendoring Magic @ " & $StashPixelMagic1[0] +1 & "," & $StashPixelMagic1[1],10,10,"Analyzing Loot")
$AnalyzedLoot[$i][$j] = $StashPixelMagic1[0] +1 & "," & $StashPixelMagic1[1] & ",Vendor,Magic," & $iLvl
$AnalVendor = 1
EndIf
ElseIf IsArray($StashPixelMagic2) Then
MouseMove($StashPixelMagic2[0] + 1, $StashPixelMagic2[1])
$iLvl = GetiLvl()
If $iLvl >= $MagicStashiLvl Then
ToolTip ($iLvl & " Stashing Magic @ " & $StashPixelMagic2[0] +1 & "," & $StashPixelMagic2[1],10,10,"Analyzing Loot")
MouseClick("Right", $StashPixelMagic2[0] + 1, $StashPixelMagic2[1], 1, 4)
Elseif $iLvl <= $MagicSalvageiLvl And $iLvl > $MagicVendoriLvl Then
ToolTip ($iLvl & " Salvaging Magic @ " & $StashPixelMagic2[0] +1 & "," & $StashPixelMagic2[1],10,10,"Analyzing Loot")
$AnalyzedLoot[$i][$j] = $StashPixelMagic2[0] +1 & "," & $StashPixelMagic2[1] & ",Salvage,Magic," & $iLvl
$AnalSalvage = 1
Elseif $iLvl <= $MagicVendoriLvl Then
ToolTip ($iLvl & " Vendoring Magic @ " & $StashPixelMagic2[0] +1 & "," & $StashPixelMagic2[1],10,10,"Analyzing Loot")
$AnalyzedLoot[$i][$j] = $StashPixelRare2[0] +1 & "," & $StashPixelRare2[1] & ",Vendor,Magic," & $iLvl
$AnalVendor = 1
EndIf
EndIf
EndIf
If CheckFullStash() = 0 Then ExitLoop
Next
Next
EndFunc ;==>AnalLoot
Func DoIdentify()
Send("c")
$arr = 0
For $i = 0 To 9
For $j = 0 To 5
If StringRegExp($AnalyzedLoot[$i][$j],"Rare") Then
$arr = StringSplit($AnalyzedLoot[$i][$j], ",")
ToolTip ($arr[5] & " Identify " & $arr[4] & " @ " & $arr[1] & "," & $arr[2],10,10,"Identify Loot")
MouseClick("Right",$arr[1] * $x_ratio,$arr[2] * $y_ratio,2)
Sleep(Random(3000, 3250))
EndIF
Next
Next
Send("c")
EndFunc
Func DoSalvage()
MouseClick("Left",799,290,1)
sleep(1600)
MouseClick("Left",562,211,1)
sleep(1000)
MouseClick("Left",286,268,1)
sleep(300)
MouseClick("Left",151,159,1)
$arr = 0
For $i = 0 To 9
For $j = 0 To 5
If StringRegExp($AnalyzedLoot[$i][$j],"Salvage") Then
$arr = StringSplit($AnalyzedLoot[$i][$j], ",")
ToolTip ($arr[5] & " Salvaging " & $arr[4] & " @ " & $arr[1] & "," & $arr[2],10,10,"Salvaging Loot")
MouseClick("Left",$arr[1],$arr[2],1)
If $arr[4] == "Rare" Then
Send("{Enter}")
EndIf
sleep(150)
EndIF
Next
Next
Send("{Space}")
sleep(200)
MouseClick("Left",0,316,1)
sleep(1600)
MouseClick("Left",367,196,1)
sleep(400)
If _ImageSearchArea($pngLoc & "ExEss.png", 1, Round(515 * $x_ratio),Round(323 * $y_ratio),Round(791 * $x_ratio),Round(489 * $y_ratio), $gX, $gY, 50) Then
Sleep(600)
MouseClick("right", $gX, $gY, 1, 1)
EndIf
EndFunc
Func VendorLoot()
$slot1x = Round(530 * $x_ratio) ; first slot x coordinate
$slot1y = Round(338 * $y_ratio); first slot y coordinate
$offset = 27 ; offset for each slot
MouseMove(Round(759 * $x_ratio),Round(0 * $y_ratio),1) ;begin movement towards merchant
Send("{3 down}")
Sleep(1400)
Send("{3 up}")
MouseClick("left",Round(275 * $x_ratio), Round(246 * $y_ratio), 6) ;NPC Merchant to the right of cain's home
sleep(300)
$arr = 0
For $i = 0 To 9
For $j = 0 To 5
If StringRegExp($AnalyzedLoot[$i][$j],"Vendor") Then
$arr = StringSplit($AnalyzedLoot[$i][$j], ",")
ToolTip ($arr[5] & " Vendoring " & $arr[4] & " @ " & $arr[1] & "," & $arr[2],10,10,"Vendoring Loot")
MouseClick("Right",$arr[1],$arr[2],1)
sleep(150)
EndIF
Next
Next
Sleep(200)
MouseClick("left", Round(282 * $x_ratio),Round(267 * $y_ratio), 1) ;button to open up repair menu
Sleep(400)
MouseClick("left", Round(142 * $x_ratio),Round(295 * $y_ratio), 1) ;button to pay for repairs
Sleep(200)
Send("{ESCAPE}")
EndFunc ;==>VendorLoot
Func GetiLvl()
$gX = 0
$gY = 0
$mousePos = MouseGetPos()
$mouseQuad = 0
If _ImageSearchArea($pngLoc & "ItemLevel800x600.png",1, $mousePos[0]-300*$x_ratio, 0, $mousePos[0]+70*$x_ratio, $size[1],$gX,$gY, 100) Then ;searchs area based off mouse postion
$capture = _TesseractScreenCapture(0, "", 1, 9, Round($gX-5 * $x_ratio), Round($gY-10 * $y_ratio), Round($gX + 40 * $x_ratio), Round($gY + 10 * $y_ratio), 0) ;get ilvl text based off of item level postion
$iLvl = StringRegExpReplace($capture,"[a-zA-Z|:;~.,<?_=+|-]","") ;strip unwanted characters
Return $iLvl
Else
Return 0
EndIf
EndFunc
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
$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
Func Stop()
Exit
EndFunc
While 1
Sleep(100)
WEnd