separate soulbags

This commit is contained in:
Salikh Gurgenidze
2025-11-19 19:41:08 +04:00
parent a506b88f47
commit 71fe40e8c6
2 changed files with 62 additions and 4 deletions
+48
View File
@@ -240,6 +240,54 @@ function Utils:IsAmmoQuiverBag(bagID)
return false
end
-- Check if a bag is Soul Bag
function Utils:IsSoulBag(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
-- First try GetSpecializedBagType
local bagType = self:GetSpecializedBagType(bagID)
if bagType == "soul" then
return true
end
-- Fallback: Use tooltip scanning (more reliable in 1.12.1)
local tooltip = GetScanTooltip()
tooltip:ClearLines()
tooltip:SetInventoryItem("player", invSlot)
-- Scan tooltip lines for "Soul Bag" or "Soul Pouch"
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 "Soul Bag" or "Soul Pouch" or just "Soul" in bag name
local textLower = string.lower(text)
if string.find(textLower, "soul bag") or string.find(textLower, "soul pouch") or
(string.find(textLower, "soul") and (string.find(textLower, "bag") or string.find(textLower, "pouch"))) then
return true
end
end
end
end
return false
end
-- Get specialized bag type (for sorting priority)
-- Returns: "soul", "quiver", "ammo", or nil
function Utils:GetSpecializedBagType(bagID)
+14 -4
View File
@@ -193,14 +193,17 @@ function BagFrame:DisplayItems(bagData, isOtherChar, charName)
local perRow = addon.Modules.DB:GetSetting("bagColumns") or 10
local itemContainer = getglobal("Guda_BagFrame_ItemContainer")
-- Separate bags into regular and ammo/quiver types
-- Separate bags into regular, soul, and ammo/quiver types
local regularBags = {}
local soulBags = {}
local ammoQuiverBags = {}
for _, bagID in ipairs(addon.Constants.BAGS) do
-- Skip hidden bags
if not hiddenBags[bagID] then
if addon.Modules.Utils:IsAmmoQuiverBag(bagID) then
if addon.Modules.Utils:IsSoulBag(bagID) then
table.insert(soulBags, bagID)
elseif addon.Modules.Utils:IsAmmoQuiverBag(bagID) then
table.insert(ammoQuiverBags, bagID)
else
table.insert(regularBags, bagID)
@@ -208,12 +211,19 @@ function BagFrame:DisplayItems(bagData, isOtherChar, charName)
end
end
-- Build display order: regular bags -> ammo/quiver bags -> keyring
-- Build display order: regular bags -> soul bags -> ammo/quiver bags -> keyring
local bagsToShow = {}
for _, bagID in ipairs(regularBags) do
table.insert(bagsToShow, {bagID = bagID, needsSpacing = false})
end
-- Add soul bags with spacing marker
if table.getn(soulBags) > 0 then
for i, bagID in ipairs(soulBags) do
table.insert(bagsToShow, {bagID = bagID, needsSpacing = (i == 1)})
end
end
-- Add ammo/quiver bags with spacing marker
if table.getn(ammoQuiverBags) > 0 then
for i, bagID in ipairs(ammoQuiverBags) do
@@ -230,7 +240,7 @@ function BagFrame:DisplayItems(bagData, isOtherChar, charName)
local bagID = bagInfo.bagID
local bag = bagData[bagID]
-- Add spacing before ammo/quiver or keyring sections
-- Add spacing before soul, ammo/quiver, or keyring sections
if bagInfo.needsSpacing then
if col > 0 then
-- Move to next row if not at start of row