fix: sorting almost done
This commit is contained in:
+19
-18
@@ -227,25 +227,26 @@ function Utils:GetSpecializedBagType(bagID)
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Use tooltip scanning
|
||||
local tooltip = GetScanTooltip()
|
||||
tooltip:ClearLines()
|
||||
tooltip:SetInventoryItem("player", invSlot)
|
||||
-- Use GetItemInfo to get subclass (more reliable than tooltip scanning)
|
||||
local name, _, quality, iLevel, reqLevel, class, subclass = GetItemInfo(link)
|
||||
|
||||
-- Scan tooltip lines
|
||||
for i = 1, tooltip:NumLines() do
|
||||
local line = getglobal("GudaBagScanTooltipTextLeft" .. i)
|
||||
if line then
|
||||
local text = line:GetText()
|
||||
if text then
|
||||
if string.find(text, "Soul") then
|
||||
return "soul"
|
||||
elseif string.find(text, "Quiver") then
|
||||
return "quiver"
|
||||
elseif string.find(text, "Ammo Pouch") then
|
||||
return "ammo"
|
||||
end
|
||||
end
|
||||
if subclass then
|
||||
-- Check for exact subclass matches
|
||||
local subclassLower = string.lower(subclass)
|
||||
|
||||
-- Soul Bag / Soul Pouch
|
||||
if string.find(subclassLower, "soul bag") or string.find(subclassLower, "soul pouch") then
|
||||
return "soul"
|
||||
end
|
||||
|
||||
-- Quiver
|
||||
if string.find(subclassLower, "quiver") then
|
||||
return "quiver"
|
||||
end
|
||||
|
||||
-- Ammo Pouch
|
||||
if string.find(subclassLower, "ammo pouch") then
|
||||
return "ammo"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -380,9 +380,13 @@ local function BuildTargetPositions(bagIDs, itemCount)
|
||||
})
|
||||
end
|
||||
|
||||
-- Sort bags by priority descending (highest first)
|
||||
-- Sort bags by priority descending (highest first), then by bag ID ascending
|
||||
table.sort(sortedBags, function(a, b)
|
||||
return a.priority > b.priority
|
||||
if a.priority ~= b.priority then
|
||||
return a.priority > b.priority
|
||||
end
|
||||
-- When priorities are equal, sort by bag ID ascending (0, 1, 2, 3, 4)
|
||||
return a.bagID < b.bagID
|
||||
end)
|
||||
|
||||
-- Build positions in priority order
|
||||
|
||||
+3
-3
@@ -1043,12 +1043,12 @@ function Guda_BagFrame_Sort()
|
||||
|
||||
-- If items were moved and we haven't hit the limit, do another pass
|
||||
if moveCount > 0 and passCount < maxPasses then
|
||||
-- Wait for items to settle, then sort again
|
||||
-- Wait for items to settle, then sort again (longer delay for many items)
|
||||
local frame = CreateFrame("Frame")
|
||||
local elapsed = 0
|
||||
frame:SetScript("OnUpdate", function()
|
||||
elapsed = elapsed + arg1
|
||||
if elapsed >= 0.3 then
|
||||
if elapsed >= 0.7 then
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
DoSortPass() -- Recursive call for next pass
|
||||
end
|
||||
@@ -1066,7 +1066,7 @@ function Guda_BagFrame_Sort()
|
||||
local elapsed = 0
|
||||
frame:SetScript("OnUpdate", function()
|
||||
elapsed = elapsed + arg1
|
||||
if elapsed >= 0.3 then
|
||||
if elapsed >= 0.7 then
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
BagFrame:Update()
|
||||
end
|
||||
|
||||
+3
-3
@@ -508,12 +508,12 @@ function Guda_BankFrame_Sort()
|
||||
|
||||
-- If items were moved and we haven't hit the limit, do another pass
|
||||
if moveCount > 0 and passCount < maxPasses then
|
||||
-- Wait for items to settle, then sort again
|
||||
-- Wait for items to settle, then sort again (longer delay for many items)
|
||||
local frame = CreateFrame("Frame")
|
||||
local elapsed = 0
|
||||
frame:SetScript("OnUpdate", function()
|
||||
elapsed = elapsed + arg1
|
||||
if elapsed >= 0.3 then
|
||||
if elapsed >= 0.7 then
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
DoSortPass() -- Recursive call for next pass
|
||||
end
|
||||
@@ -531,7 +531,7 @@ function Guda_BankFrame_Sort()
|
||||
local elapsed = 0
|
||||
frame:SetScript("OnUpdate", function()
|
||||
elapsed = elapsed + arg1
|
||||
if elapsed >= 0.3 then
|
||||
if elapsed >= 0.7 then
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
BankFrame:Update()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user