fix: bankview for category types
This commit is contained in:
+15
-13
@@ -419,22 +419,14 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
if bag and bag.slots then
|
if bag and bag.slots then
|
||||||
for slotID, itemData in pairs(bag.slots) do
|
for slotID, itemData in pairs(bag.slots) do
|
||||||
if itemData then
|
if itemData then
|
||||||
local cat = itemData.class or "Miscellaneous"
|
local cat = "Miscellaneous"
|
||||||
local itemName = itemData.name or ""
|
local itemName = itemData.name or ""
|
||||||
|
|
||||||
-- Force Quest category if it's a quest item (tooltip scan)
|
-- Priority 1: Special items (Hearthstone, Mounts, Tools)
|
||||||
-- 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
|
|
||||||
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})
|
||||||
-- Detect Mounts
|
|
||||||
elseif addon.Modules.SortEngine and addon.Modules.SortEngine.IsMount and addon.Modules.SortEngine.IsMount(itemData.texture) then
|
elseif addon.Modules.SortEngine and addon.Modules.SortEngine.IsMount and addon.Modules.SortEngine.IsMount(itemData.texture) then
|
||||||
table.insert(specialItems.Mount, {bagID = bagID, slotID = slotID, itemData = itemData})
|
table.insert(specialItems.Mount, {bagID = bagID, slotID = slotID, itemData = itemData})
|
||||||
-- Detect Tools category
|
|
||||||
elseif string.find(itemName, "Runed .* Rod") or
|
elseif string.find(itemName, "Runed .* Rod") or
|
||||||
string.find(itemName, "Fishing Pole") or
|
string.find(itemName, "Fishing Pole") or
|
||||||
string.find(itemName, "Mining Pick") or
|
string.find(itemName, "Mining Pick") or
|
||||||
@@ -445,8 +437,14 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
string.find(itemName, "Skinning Knife") or
|
string.find(itemName, "Skinning Knife") or
|
||||||
itemName == "Blood Scythe" then
|
itemName == "Blood Scythe" then
|
||||||
table.insert(specialItems.Tools, {bagID = bagID, slotID = slotID, itemData = itemData})
|
table.insert(specialItems.Tools, {bagID = bagID, slotID = slotID, itemData = itemData})
|
||||||
-- Detect Food and Drink
|
|
||||||
|
-- Priority 2: Quest Items
|
||||||
|
elseif (not isOtherChar and addon.Modules.Utils:IsQuestItemTooltip(bagID, slotID)) or itemData.class == "Quest" then
|
||||||
|
table.insert(categories["Quest"], {bagID = bagID, slotID = slotID, itemData = itemData})
|
||||||
|
|
||||||
|
-- Priority 3: Food and Drink
|
||||||
elseif itemData.class == "Consumable" then
|
elseif itemData.class == "Consumable" then
|
||||||
|
cat = "Consumable"
|
||||||
local sub = itemData.subclass or ""
|
local sub = itemData.subclass or ""
|
||||||
if sub == "Food & Drink" or string.find(sub, "Food") or string.find(sub, "Drink") then
|
if sub == "Food & Drink" or string.find(sub, "Food") or string.find(sub, "Drink") then
|
||||||
if string.find(sub, "Drink") then
|
if string.find(sub, "Drink") then
|
||||||
@@ -456,15 +454,19 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData})
|
table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData})
|
||||||
-- Split Equipment into Weapon and Armor
|
|
||||||
|
-- Priority 4: Equipment (Weapon and Armor)
|
||||||
elseif itemData.equipSlot and itemData.equipSlot ~= "" then
|
elseif itemData.equipSlot and itemData.equipSlot ~= "" then
|
||||||
if itemData.class == "Weapon" or itemData.class == "Armor" then
|
if itemData.class == "Weapon" or itemData.class == "Armor" then
|
||||||
cat = itemData.class
|
cat = itemData.class
|
||||||
else
|
else
|
||||||
cat = "Armor" -- Accessories etc usually fall here if equippable
|
cat = "Armor"
|
||||||
end
|
end
|
||||||
table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData})
|
table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData})
|
||||||
|
|
||||||
|
-- Priority 5: Other Categories
|
||||||
else
|
else
|
||||||
|
cat = itemData.class or "Miscellaneous"
|
||||||
if not categories[cat] then cat = "Miscellaneous" end
|
if not categories[cat] then cat = "Miscellaneous" end
|
||||||
table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData})
|
table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData})
|
||||||
end
|
end
|
||||||
|
|||||||
+18
-32
@@ -269,21 +269,16 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
-- Helper to assign category
|
-- Helper to assign category
|
||||||
local function CategorizeItem(itemData, bagID, slotID)
|
local function CategorizeItem(itemData, bagID, slotID)
|
||||||
local itemName = itemData.name or ""
|
local itemName = itemData.name or ""
|
||||||
|
local cat = "Miscellaneous"
|
||||||
|
|
||||||
-- Detect Hearthstone
|
-- Priority 1: Special items (Hearthstone, Mounts, Tools)
|
||||||
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})
|
||||||
return
|
return
|
||||||
end
|
elseif addon.Modules.SortEngine and addon.Modules.SortEngine.IsMount and addon.Modules.SortEngine.IsMount(itemData.texture) then
|
||||||
|
|
||||||
-- Detect Mounts
|
|
||||||
if addon.Modules.SortEngine and addon.Modules.SortEngine.IsMount and addon.Modules.SortEngine.IsMount(itemData.texture) then
|
|
||||||
table.insert(specialItems.Mount, {bagID = bagID, slotID = slotID, itemData = itemData})
|
table.insert(specialItems.Mount, {bagID = bagID, slotID = slotID, itemData = itemData})
|
||||||
return
|
return
|
||||||
end
|
elseif string.find(itemName, "Runed .* Rod") or
|
||||||
|
|
||||||
-- Detect Tools category
|
|
||||||
if string.find(itemName, "Runed .* Rod") or
|
|
||||||
string.find(itemName, "Fishing Pole") or
|
string.find(itemName, "Fishing Pole") or
|
||||||
string.find(itemName, "Mining Pick") or
|
string.find(itemName, "Mining Pick") or
|
||||||
string.find(itemName, "Blacksmith Hammer") or
|
string.find(itemName, "Blacksmith Hammer") or
|
||||||
@@ -296,8 +291,13 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Detect Food and Drink
|
-- Priority 2: Quest Items
|
||||||
if itemData.class == "Consumable" then
|
if (not isOtherChar and addon.Modules.Utils:IsQuestItemTooltip(bagID, slotID)) or itemData.class == "Quest" then
|
||||||
|
cat = "Quest"
|
||||||
|
|
||||||
|
-- Priority 3: Food and Drink
|
||||||
|
elseif itemData.class == "Consumable" then
|
||||||
|
cat = "Consumable"
|
||||||
local sub = itemData.subclass or ""
|
local sub = itemData.subclass or ""
|
||||||
if sub == "Food & Drink" or string.find(sub, "Food") or string.find(sub, "Drink") then
|
if sub == "Food & Drink" or string.find(sub, "Food") or string.find(sub, "Drink") then
|
||||||
if string.find(sub, "Drink") then
|
if string.find(sub, "Drink") then
|
||||||
@@ -306,39 +306,25 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
cat = "Food"
|
cat = "Food"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local cat = itemData.class or "Miscellaneous"
|
-- Priority 4: Equipment (Weapon and Armor)
|
||||||
|
elseif itemData.equipSlot and itemData.equipSlot ~= "" then
|
||||||
-- 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
|
|
||||||
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
|
||||||
cat = itemData.class
|
cat = itemData.class
|
||||||
else
|
else
|
||||||
cat = "Armor"
|
cat = "Armor"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Priority 5: Other Categories
|
||||||
|
else
|
||||||
|
cat = itemData.class or "Miscellaneous"
|
||||||
end
|
end
|
||||||
|
|
||||||
if not categories[cat] then cat = "Miscellaneous" end
|
if not categories[cat] then cat = "Miscellaneous" end
|
||||||
table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData})
|
table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Bank main slots (bagID -1)
|
-- Bank slots
|
||||||
local bankMain = bankData[-1]
|
|
||||||
if bankMain and bankMain.slots then
|
|
||||||
for slotID, itemData in pairs(bankMain.slots) do
|
|
||||||
if itemData then
|
|
||||||
CategorizeItem(itemData, -1, slotID)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Bank bags
|
|
||||||
for _, bagID in ipairs(addon.Constants.BANK_BAGS) do
|
for _, bagID in ipairs(addon.Constants.BANK_BAGS) do
|
||||||
if not hiddenBankBags[bagID] then
|
if not hiddenBankBags[bagID] then
|
||||||
local bag = bankData[bagID]
|
local bag = bankData[bagID]
|
||||||
|
|||||||
Reference in New Issue
Block a user