fix: category spacing
This commit is contained in:
+40
-11
@@ -155,6 +155,46 @@ function Utils:FormatTimeAgo(timestamp)
|
|||||||
end
|
end
|
||||||
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 an item is a quest item by scanning its tooltip
|
||||||
|
function Utils:IsQuestItemTooltip(bagID, slotID)
|
||||||
|
if not bagID or not slotID then return false end
|
||||||
|
|
||||||
|
local tooltip = GetScanTooltip()
|
||||||
|
tooltip:ClearLines()
|
||||||
|
tooltip:SetBagItem(bagID, slotID)
|
||||||
|
|
||||||
|
-- Check all tooltip lines for quest-related text
|
||||||
|
for i = 1, tooltip:NumLines() do
|
||||||
|
local line = getglobal("GudaBagScanTooltipTextLeft" .. i)
|
||||||
|
if line then
|
||||||
|
local text = line:GetText()
|
||||||
|
if text then
|
||||||
|
-- Check for quest starter patterns
|
||||||
|
if string.find(text, "Quest Starter") or
|
||||||
|
string.find(text, "This Item Begins a Quest") or
|
||||||
|
string.find(text, "Use: Starts a Quest") then
|
||||||
|
return true
|
||||||
|
-- Check for regular quest item patterns
|
||||||
|
elseif string.find(text, "Quest Item") or
|
||||||
|
string.find(text, "Manual") then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- Get bag slot count
|
-- Get bag slot count
|
||||||
function Utils:GetBagSlotCount(bagID)
|
function Utils:GetBagSlotCount(bagID)
|
||||||
if bagID == -1 then
|
if bagID == -1 then
|
||||||
@@ -190,17 +230,6 @@ function Utils:TruncateText(text, maxLen)
|
|||||||
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)
|
function Utils:IsAmmoQuiverBag(bagID)
|
||||||
-- Skip backpack, bank, and keyring
|
-- Skip backpack, bank, and keyring
|
||||||
if bagID == 0 or bagID == -1 or bagID == -2 then
|
if bagID == 0 or bagID == -1 or bagID == -2 then
|
||||||
|
|||||||
+11
-5
@@ -422,6 +422,12 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
local cat = itemData.class or "Miscellaneous"
|
local cat = itemData.class or "Miscellaneous"
|
||||||
local itemName = itemData.name or ""
|
local itemName = itemData.name or ""
|
||||||
|
|
||||||
|
-- Force Quest category if it's a quest item (tooltip scan)
|
||||||
|
-- For other characters, we rely on the saved class, but for current we can be more accurate
|
||||||
|
if not isOtherChar and addon.Modules.Utils:IsQuestItemTooltip(bagID, slotID) then
|
||||||
|
cat = "Quest"
|
||||||
|
end
|
||||||
|
|
||||||
-- Detect Hearthstone
|
-- Detect Hearthstone
|
||||||
if string.find(itemName, "Hearthstone") then
|
if string.find(itemName, "Hearthstone") then
|
||||||
table.insert(specialItems.Hearthstone, {bagID = bagID, slotID = slotID, itemData = itemData})
|
table.insert(specialItems.Hearthstone, {bagID = bagID, slotID = slotID, itemData = itemData})
|
||||||
@@ -509,7 +515,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
local blockHeight = 20 + (blockRows * (buttonSize + spacing)) + 5 -- 20 header, 5 padding
|
local blockHeight = 20 + (blockRows * (buttonSize + spacing)) + 5 -- 20 header, 5 padding
|
||||||
|
|
||||||
-- Check if it fits in current row
|
-- Check if it fits in current row
|
||||||
if currentX > 0 and currentX + blockWidth > totalWidth + 5 then
|
if currentX > 0 and currentX + blockWidth + 20 > totalWidth + 5 then
|
||||||
currentX = 0
|
currentX = 0
|
||||||
currentY = currentY + rowMaxHeight
|
currentY = currentY + rowMaxHeight
|
||||||
rowMaxHeight = 0
|
rowMaxHeight = 0
|
||||||
@@ -553,7 +559,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if blockHeight > rowMaxHeight then rowMaxHeight = blockHeight end
|
if blockHeight > rowMaxHeight then rowMaxHeight = blockHeight end
|
||||||
currentX = currentX + blockWidth
|
currentX = currentX + blockWidth + 20
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -605,7 +611,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
local blockHeight = 20 + (blockRows * (buttonSize + spacing))
|
local blockHeight = 20 + (blockRows * (buttonSize + spacing))
|
||||||
|
|
||||||
-- Check if it fits in current row (Inline block for bottom sections too)
|
-- Check if it fits in current row (Inline block for bottom sections too)
|
||||||
if col > 0 and (col * (buttonSize + spacing)) + blockWidth > totalWidth + 5 then
|
if col > 0 and (col * (buttonSize + spacing)) + blockWidth + 20 > totalWidth + 5 then
|
||||||
col = 0
|
col = 0
|
||||||
y = y - sectionMaxHeight - 5
|
y = y - sectionMaxHeight - 5
|
||||||
sectionMaxHeight = 0
|
sectionMaxHeight = 0
|
||||||
@@ -642,10 +648,10 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if blockHeight > sectionMaxHeight then sectionMaxHeight = blockHeight end
|
if blockHeight > sectionMaxHeight then sectionMaxHeight = blockHeight end
|
||||||
col = col + blockCols
|
col = col + blockCols + math.ceil(20 / (buttonSize + spacing))
|
||||||
|
|
||||||
-- If we wrapped exactly at the end of a block
|
-- If we wrapped exactly at the end of a block
|
||||||
if col >= perRow then
|
if (col * (buttonSize + spacing)) >= totalWidth then
|
||||||
col = 0
|
col = 0
|
||||||
y = y - sectionMaxHeight - 5
|
y = y - sectionMaxHeight - 5
|
||||||
sectionMaxHeight = 0
|
sectionMaxHeight = 0
|
||||||
|
|||||||
+10
-5
@@ -297,6 +297,11 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
|
|
||||||
local cat = itemData.class or "Miscellaneous"
|
local cat = itemData.class or "Miscellaneous"
|
||||||
|
|
||||||
|
-- Force Quest category if it's a quest item (tooltip scan)
|
||||||
|
if not isOtherChar and addon.Modules.Utils:IsQuestItemTooltip(bagID, slotID) then
|
||||||
|
cat = "Quest"
|
||||||
|
end
|
||||||
|
|
||||||
-- Split Equipment into Weapon and Armor
|
-- Split Equipment into Weapon and Armor
|
||||||
if itemData.equipSlot and itemData.equipSlot ~= "" then
|
if itemData.equipSlot and itemData.equipSlot ~= "" then
|
||||||
if itemData.class == "Weapon" or itemData.class == "Armor" then
|
if itemData.class == "Weapon" or itemData.class == "Armor" then
|
||||||
@@ -375,7 +380,7 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
local blockHeight = 20 + (blockRows * (buttonSize + spacing)) + 5
|
local blockHeight = 20 + (blockRows * (buttonSize + spacing)) + 5
|
||||||
|
|
||||||
-- Check if it fits in current row
|
-- Check if it fits in current row
|
||||||
if currentX > 0 and currentX + blockWidth > totalWidth + 5 then
|
if currentX > 0 and currentX + blockWidth + 20 > totalWidth + 5 then
|
||||||
currentX = 0
|
currentX = 0
|
||||||
currentY = currentY + rowMaxHeight
|
currentY = currentY + rowMaxHeight
|
||||||
rowMaxHeight = 0
|
rowMaxHeight = 0
|
||||||
@@ -419,7 +424,7 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if blockHeight > rowMaxHeight then rowMaxHeight = blockHeight end
|
if blockHeight > rowMaxHeight then rowMaxHeight = blockHeight end
|
||||||
currentX = currentX + blockWidth
|
currentX = currentX + blockWidth + 20
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -471,7 +476,7 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
local blockHeight = 20 + (blockRows * (buttonSize + spacing))
|
local blockHeight = 20 + (blockRows * (buttonSize + spacing))
|
||||||
|
|
||||||
-- Check if it fits in current row (Inline block for bottom sections too)
|
-- Check if it fits in current row (Inline block for bottom sections too)
|
||||||
if col > 0 and (col * (buttonSize + spacing)) + blockWidth > totalWidth + 5 then
|
if col > 0 and (col * (buttonSize + spacing)) + blockWidth + 20 > totalWidth + 5 then
|
||||||
col = 0
|
col = 0
|
||||||
y = y - sectionMaxHeight - 5
|
y = y - sectionMaxHeight - 5
|
||||||
sectionMaxHeight = 0
|
sectionMaxHeight = 0
|
||||||
@@ -508,10 +513,10 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if blockHeight > sectionMaxHeight then sectionMaxHeight = blockHeight end
|
if blockHeight > sectionMaxHeight then sectionMaxHeight = blockHeight end
|
||||||
col = col + blockCols
|
col = col + blockCols + math.ceil(20 / (buttonSize + spacing))
|
||||||
|
|
||||||
-- If we wrapped exactly at the end of a block
|
-- If we wrapped exactly at the end of a block
|
||||||
if col >= perRow then
|
if (col * (buttonSize + spacing)) >= totalWidth then
|
||||||
col = 0
|
col = 0
|
||||||
y = y - sectionMaxHeight - 5
|
y = y - sectionMaxHeight - 5
|
||||||
sectionMaxHeight = 0
|
sectionMaxHeight = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user