separate ammo puch/ quiver
This commit is contained in:
@@ -157,3 +157,55 @@ function Utils:TruncateText(text, maxLen)
|
|||||||
end
|
end
|
||||||
return string.sub(text, 1, maxLen - 3) .. "..."
|
return string.sub(text, 1, maxLen - 3) .. "..."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Create hidden tooltip for scanning (only once)
|
||||||
|
local scanTooltip = nil
|
||||||
|
local function GetScanTooltip()
|
||||||
|
if not scanTooltip then
|
||||||
|
scanTooltip = CreateFrame("GameTooltip", "GudaBagScanTooltip", nil, "GameTooltipTemplate")
|
||||||
|
scanTooltip:SetOwner(WorldFrame, "ANCHOR_NONE")
|
||||||
|
end
|
||||||
|
return scanTooltip
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if a bag is Quiver or Ammo Pouch
|
||||||
|
function Utils:IsAmmoQuiverBag(bagID)
|
||||||
|
-- Skip backpack, bank, and keyring
|
||||||
|
if bagID == 0 or bagID == -1 or bagID == -2 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get the bag item
|
||||||
|
local invSlot = ContainerIDToInventoryID(bagID)
|
||||||
|
if not invSlot then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local link = GetInventoryItemLink("player", invSlot)
|
||||||
|
if not link then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use tooltip scanning to get item class (more reliable in 1.12.1)
|
||||||
|
local tooltip = GetScanTooltip()
|
||||||
|
tooltip:ClearLines()
|
||||||
|
tooltip:SetInventoryItem("player", invSlot)
|
||||||
|
|
||||||
|
-- Scan tooltip lines for "Quiver" or "Ammo Pouch"
|
||||||
|
-- In vanilla, the item type appears on the right side of line 2 or 3
|
||||||
|
for i = 1, tooltip:NumLines() do
|
||||||
|
local line = getglobal("GudaBagScanTooltipTextLeft" .. i)
|
||||||
|
if line then
|
||||||
|
local text = line:GetText()
|
||||||
|
if text then
|
||||||
|
-- Check if the line contains "Quiver" or "Ammo Pouch"
|
||||||
|
if string.find(text, "Quiver") or string.find(text, "Ammo Pouch") then
|
||||||
|
addon:Print("Bag " .. bagID .. " detected as Quiver/Ammo: " .. text)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|||||||
+35
-11
@@ -187,26 +187,50 @@ function BagFrame:DisplayItems(bagData, isOtherChar, charName)
|
|||||||
local perRow = addon.Modules.DB:GetSetting("bagColumns") or 10
|
local perRow = addon.Modules.DB:GetSetting("bagColumns") or 10
|
||||||
local itemContainer = getglobal("Guda_BagFrame_ItemContainer")
|
local itemContainer = getglobal("Guda_BagFrame_ItemContainer")
|
||||||
|
|
||||||
-- Build bag list - include keyring if toggled on, skip hidden bags
|
-- Separate bags into regular and ammo/quiver types
|
||||||
local bagsToShow = {}
|
local regularBags = {}
|
||||||
|
local ammoQuiverBags = {}
|
||||||
|
|
||||||
for _, bagID in ipairs(addon.Constants.BAGS) do
|
for _, bagID in ipairs(addon.Constants.BAGS) do
|
||||||
-- Skip bags that are hidden
|
-- Skip hidden bags
|
||||||
if not hiddenBags[bagID] then
|
if not hiddenBags[bagID] then
|
||||||
table.insert(bagsToShow, bagID)
|
if addon.Modules.Utils:IsAmmoQuiverBag(bagID) then
|
||||||
|
table.insert(ammoQuiverBags, bagID)
|
||||||
|
else
|
||||||
|
table.insert(regularBags, bagID)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add keyring (-2) at the end if toggled on and not hidden
|
-- Debug output
|
||||||
if showKeyring and not hiddenBags[-2] then
|
addon:Print("Regular bags: " .. table.getn(regularBags) .. ", Ammo/Quiver bags: " .. table.getn(ammoQuiverBags))
|
||||||
table.insert(bagsToShow, -2) -- Insert at end
|
|
||||||
|
-- Build display order: regular bags -> ammo/quiver bags -> keyring
|
||||||
|
local bagsToShow = {}
|
||||||
|
for _, bagID in ipairs(regularBags) do
|
||||||
|
table.insert(bagsToShow, {bagID = bagID, needsSpacing = false})
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, bagID in ipairs(bagsToShow) do
|
-- Add ammo/quiver bags with spacing marker
|
||||||
|
if table.getn(ammoQuiverBags) > 0 then
|
||||||
|
addon:Print("Adding " .. table.getn(ammoQuiverBags) .. " ammo/quiver bags with spacing")
|
||||||
|
for i, bagID in ipairs(ammoQuiverBags) do
|
||||||
|
table.insert(bagsToShow, {bagID = bagID, needsSpacing = (i == 1)})
|
||||||
|
addon:Print(" Ammo/Quiver bag " .. bagID .. " - needsSpacing: " .. tostring(i == 1))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add keyring at the end if toggled on and not hidden
|
||||||
|
if showKeyring and not hiddenBags[-2] then
|
||||||
|
table.insert(bagsToShow, {bagID = -2, needsSpacing = true})
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, bagInfo in ipairs(bagsToShow) do
|
||||||
|
local bagID = bagInfo.bagID
|
||||||
local bag = bagData[bagID]
|
local bag = bagData[bagID]
|
||||||
|
|
||||||
-- Add spacing before keyring section
|
-- Add spacing before ammo/quiver or keyring sections
|
||||||
if bagID == -2 then
|
if bagInfo.needsSpacing then
|
||||||
-- Add spacing before keyring
|
|
||||||
if col > 0 then
|
if col > 0 then
|
||||||
-- Move to next row if not at start of row
|
-- Move to next row if not at start of row
|
||||||
col = 0
|
col = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user