Code:
Global $stashPosition = 1, $dummyX = 0, $dummyY = 0
Func RandMouseMove($xPos, $yPos, $xOff = 10, $yOff = 10, $clicks = 1, $speed = 0)
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)))
MouseMove($randX, $randY, $speed)
EndFunc
Func StashIsFull($left, $right)
$pixel = PixelSearch(710, 135, 748, 161, 0xFF0000, 1)
If Not @error And $stashPosition < 3 Then
$stashPosition += 1
If $stashPosition = 2 Then
Sleep(200)
MouseClick("left", 500 * $x_ratio, 360 * $y_ratio, 1, 4)
Sleep(200)
Else
Sleep(200)
MouseClick("left", 500 * $x_ratio, 520 * $y_ratio, 1, 4)
Sleep(200)
EndIf
MouseClick("right", $left, $right, 1, 4)
Sleep(8000)
EndIf
EndFunc
Code:
Func StashLoot()
GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
MouseClick("left", 1064 * $x_ratio, 256 * $y_ratio)
Moving(1600)
; Move to First Tab Of Stash
If $stashPosition = 1 Then
MouseClick("left", 500 * $x_ratio, 200 * $y_ratio, 1, 4)
ElseIf $stashPosition = 2 Then
MouseClick("left", 500 * $x_ratio, 360 * $y_ratio, 1, 4)
Else
MouseClick("left", 500 * $x_ratio, 520 * $y_ratio, 1, 4)
EndIf
;Tomes
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("right", $gX, $gY, 1, 4)
Sleep(50)
StashIsFull($gX, $gY)
Sleep(80)
EndIf
If $StashLegendary == True Then
StashItems(0xFF7F00, 0)
StashItems(0x8F5C25, 1)
EndIf
If $StashRare == True Then
StashItems(0x4A3C0B, 1)
EndIf
;Gems
GUICtrlSetData($lblStatus, "Status: Stashing Gems")
Sleep(Random(20, 100))
For $i = 0 To 3
If _ImageSearchArea($pngLoc & $gems[$i], 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $gX, $gY, 140) Then
MouseClick("right", $gX, $gY, 1, 3)
Sleep(50)
StashIsFull($gX, $gY)
EndIf
Next
$popupLeft = 995
$popupTop = 830
$popupRight = 1140
$popupBottom = 1080
$magicLeft = 1050
$magicRight = 1160
$ringAmuletLeft = 1300
$ringAmuletRight = 1462
$magicTop = 595
$magicBot = 800
$mTop = $magicTop
$mBot = $magicBot
$pTop = $popupTop
;Stash ilvl 62, ilvl 63 and ilvl 61 rings and amulets
GUICtrlSetData($lblStatus, "Status: ilvl62 and ilvl63")
For $c = 1 To $vendorCols
If $c > 1 Then
$popupLeft += 49
$popupRight += 51
$magicLeft += 49
$magicRight += 51
$ringAmuletLeft += 49
$ringAmuletRight += 51
EndIf
For $r = 1 To $vendorRows
$randX = (((($c - 1) * 50) + 32 + 1400) * $x_ratio)
$randY = (((($r - 1) * 50) + 32 + 580) * $y_ratio)
RandMouseMove($randX, $randY, 2, 2, 0)
sleep(Random(180,230))
If _ImageSearchArea($pngLoc & 'magicitem.png', 1, $magicLeft, $mTop, $magicRight, $mBot, $dummyX, $dummyY, 20) Then
If _ImageSearchArea($pngLoc & 'ilvl62.png', 1, $popupLeft, $pTop, $popupRight, $popupBottom, $dummyX, $dummyY, 20) Or _ImageSearchArea($pngLoc & 'ilvl63.png', 1, $popupLeft, $pTop, $popupRight, $popupBottom, $dummyX, $dummyY, 20) Then
MouseClick("right", $randX, $randY, 1, 1)
Sleep(50)
StashIsFull($randX, $randY)
ElseIf _ImageSearchArea($pngLoc & 'ilvl61.png', 1, $popupLeft, $pTop, $popupRight, $popupBottom, $dummyX, $dummyY, 20) Then
If _ImageSearchArea($pngLoc & 'item_ring.png', 1, $ringAmuletLeft, $mTop, $ringAmuletRight, $mBot, $dummyX, $dummyY, 20) Or _ImageSearchArea($pngLoc & 'item_amulet.png', 1, $ringAmuletLeft, $mTop, $ringAmuletRight, $mBot, $dummyX, $dummyY, 20) Then
MouseClick("right", $randX, $randY, 1, 1)
Sleep(50)
StashIsFull($randX, $randY)
EndIf
EndIf
EndIf
Next
Next
Sleep(Random(200, 500))
Send("{SPACE}")
EndFunc ;==>StashLoot