Code:
Func AnalLoot()
DebugLog(@CRLF & "****************************************************" & @CRLF & _
"iLvl Analyzing " & @CRLF & _
"****************************************************")
GUICtrlSetData($lblStatus, "Status: Stashing And Analyzing Loot")
AnalScan()
ArrayClear($AnalyzedLoot)
$rt = TimerInit()
For $i = 0 To 9
For $j = 0 To 5
$SlotPixelLine = PixelSearch(Round(($slotLineTopX + $i * $offset) * $x_ratio), Round(($slotLineTopY + $j * $offset) * $y_ratio), Round(($slotLineBotX + $i * $offset) * $x_ratio), Round(($slotLineBotY + $j * $offset) * $y_ratio), 0x2C1B14,1)
$MiddleOfCell = PixelSearch(Round(($CellMiddleTopX + $i * $offset) * $x_ratio), Round(($CellMiddleTopY + $j * $offset) * $y_ratio), Round(($CellMiddleBotX + $i * $offset) * $x_ratio), Round(($CellMiddleBotY + $j * $offset) * $y_ratio), 0x130C08)
If Not IsArray($MiddleOfCell) Then
If IsArray($SlotPixelLine) Or $slotError >= 1 Or $j = 0 Then
$slotError = 0
MouseMove(Round(($slot1x + $i * $offset) * $x_ratio), Round(($slot1y + $j * $offset) * $y_ratio),1)
Sleep($AnalSpeed)
$ItemInfo = StringSplit(GetItemInfo(), ",")
If StringRegExp($ItemInfo[1],"Magic") Then
DebugLog("Magic Item Found iLvl=" &$ItemInfo[2]&" @ Cell " & $i & "," & $j)
If $ItemInfo[2] < 0 Then
$AnalyzedLoot[$i][$j] = Round(($slot1x + $i * $offset) * $x_ratio) & "," & Round(($slot1y + $j * $offset) * $y_ratio) & ",Vendor,Magic," & $ItemInfo[2]
$AnalVendor = 1
Else
If $ItemInfo[2] >= $MagicStashiLvl Then
GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Stashing Magic @ " & $i & "," & $j)
$AnalyzedLoot[$i][$j] = Round(($slot1x + $i * $offset) * $x_ratio) & "," & Round(($slot1y + $j * $offset) * $y_ratio) & ",Stashed,Magic," & $ItemInfo[2]
MouseClick("Right", Round(($slot1x + $i * $offset) * $x_ratio), Round(($slot1y + $j * $offset) * $y_ratio), 1)
Elseif $ItemInfo[2] <= $MagicSalvageiLvl And $ItemInfo[2] > $MagicVendoriLvl Then
GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Salvaging Magic @ " & $i & "," & $j)
$AnalyzedLoot[$i][$j] = Round(($slot1x + $i * $offset) * $x_ratio) & "," & Round(($slot1y + $j * $offset) * $y_ratio) & ",Salvage,Magic," & $ItemInfo[2]
$AnalSalvage = 1
Elseif $ItemInfo[2] <= $MagicVendoriLvl Then
GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Vendoring Magic @ " & $i & "," & $j)
$AnalyzedLoot[$i][$j] = Round(($slot1x + $i * $offset) * $x_ratio) & "," & Round(($slot1y + $j * $offset) * $y_ratio) & ",Vendor,Magic," & $ItemInfo[2]
$AnalVendor = 1
EndIf
EndIf
ElseIf StringRegExp($ItemInfo[1],"Rare") Then
DebugLog("Rare Item Found iLvl=" &$ItemInfo[2]&" @ Cell " & $i & "," & $j)
If $ItemInfo[2] < 0 Then
$AnalyzedLoot[$i][$j] = Round(($slot1x + $i * $offset) * $x_ratio) & "," & Round(($slot1y + $j * $offset) * $y_ratio) & ",Vendor,Rare," & $ItemInfo[2]
$AnalRareIdentify = 1
$AnalVendor = 1
Else
If $ItemInfo[2] >= $RareStashiLvl Then
GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Stashing Rare @ " & $i & "," & $j)
MouseClick("Right", Round(($slot1x + $i * $offset) * $x_ratio), Round(($slot1y + $j * $offset) * $y_ratio), 1)
Elseif $ItemInfo[2] <= $RareSalvageiLvl And $ItemInfo[2] > $RareVendoriLvl Then
GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Salvaging Rare @ " & $i & "," & $j)
$AnalyzedLoot[$i][$j] = Round(($slot1x + $i * $offset) * $x_ratio) & "," & Round(($slot1y + $j * $offset) * $y_ratio) & ",Salvage,Rare," & $ItemInfo[2]
$AnalRareIdentify = 1
$AnalSalvage = 1
ElseIf $ItemInfo[2] <= $RareVendoriLvl Then
GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Vendoring Rare @ " & $i & "," & $j)
$AnalyzedLoot[$i][$j] = Round(($slot1x + $i * $offset) * $x_ratio) & "," & Round(($slot1y + $j * $offset) * $y_ratio) & ",Vendor,Rare," & $ItemInfo[2]
$AnalRareIdentify = 1
$AnalVendor = 1
EndIf
EndIf
ElseIf StringRegExp($ItemInfo[1],"Set") Or StringRegExp($ItemInfo[1],"Legendary") Then
DebugLog($ItemInfo[1] & " Item Found iLvl=" &$ItemInfo[2]&" @ Cell " & $i & "," & $j)
GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Stashing " & $ItemInfo[1] & " @ " & $i & "," & $j)
$AnalyzedLoot[$i][$j] = Round(($slot1x + $i * $offset) * $x_ratio) & "," & Round(($slot1y + $j * $offset) * $y_ratio) & ",Stashed,Set/Legendary," & $ItemInfo[2]
MouseClick("Right", Round(($slot1x + $i * $offset) * $x_ratio), Round(($slot1y + $j * $offset) * $y_ratio), 1)
ElseIf StringRegExp($ItemInfo[1],"Crafting") Or StringRegExp($ItemInfo[1],"Tomes") Or StringRegExp($ItemInfo[1],"Gem") Or StringRegExp($ItemInfo[1],"Tome") _
Or StringRegExp($ItemInfo[1],"RareRing") Or StringRegExp($ItemInfo[1], "RareAmmy") Or StringRegExp($ItemInfo[1], "BlackSmithPlan") Then
DebugLog($ItemInfo[1] & " @ Cell " & $i & "," & $j)
GUICtrlSetData($lblStatus, "Status: Stashing " & $ItemInfo[1] & " @ " & $i & "," & $j)
$AnalyzedLoot[$i][$j] = Round(($slot1x + $i * $offset) * $x_ratio) & "," & Round(($slot1y + $j * $offset) * $y_ratio) & ",Stashed," &$ItemInfo[1]& ",0"
MouseClick("Right", Round(($slot1x + $i * $offset) * $x_ratio), Round(($slot1y + $j * $offset) * $y_ratio), 1)
ElseIf $ItemInfo[1] = 0 Then
DebugLog("Unknown Item Found iLvl=0 @ Cell " & $i & "," & $j)
GUICtrlSetData($lblStatus, "Status: Vendoring Unknown @ " & $i & "," & $j)
$AnalyzedLoot[$i][$j] = Round(($slot1x + $i * $offset) * $x_ratio) & "," & Round(($slot1y + $j * $offset) * $y_ratio) & ",Vendor,Unknown,0"
$AnalVendor = 1
Else
$slotError += 1
EndIF
EndIf
EndIf
If CheckFullStash() = 0 Then ExitLoop
Next
Next
$srt = TimerDiff($rt)
$AnalTime = Round($srt / 1000, 2)
DebugLog(@CRLF & "iLvl Analyzing took " & $AnalTime & " Seconds" & @CRLF & _
"****************************************************")
EndFunc ;==>AnalLoot