feat: rename category
This commit is contained in:
@@ -19,7 +19,7 @@ addon.Modules.CategoryManager = CategoryManager
|
|||||||
-- Default category definitions that replicate the existing hardcoded behavior
|
-- Default category definitions that replicate the existing hardcoded behavior
|
||||||
local DEFAULT_CATEGORIES = {
|
local DEFAULT_CATEGORIES = {
|
||||||
order = {
|
order = {
|
||||||
"BoE", "Weapon", "Armor", "Consumable", "Food", "Drink",
|
"Home", "BoE", "Weapon", "Armor", "Consumable", "Food", "Drink",
|
||||||
"Trade Goods", "Reagent", "Recipe", "Quiver", "Container",
|
"Trade Goods", "Reagent", "Recipe", "Quiver", "Container",
|
||||||
"Soul Bag", "Miscellaneous", "Quest", "Junk", "Class Items", "Keyring"
|
"Soul Bag", "Miscellaneous", "Quest", "Junk", "Class Items", "Keyring"
|
||||||
},
|
},
|
||||||
@@ -212,6 +212,16 @@ local DEFAULT_CATEGORIES = {
|
|||||||
enabled = true,
|
enabled = true,
|
||||||
isBuiltIn = true,
|
isBuiltIn = true,
|
||||||
},
|
},
|
||||||
|
["Home"] = {
|
||||||
|
name = "Home",
|
||||||
|
icon = "Interface\\Icons\\INV_Misc_Rune_01",
|
||||||
|
rules = {},
|
||||||
|
matchMode = "all",
|
||||||
|
priority = 0,
|
||||||
|
enabled = true,
|
||||||
|
isBuiltIn = true,
|
||||||
|
hideControls = true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,11 +600,12 @@ function CategoryManager:EvaluateRule(rule, itemData, bagID, slotID, isOtherChar
|
|||||||
-- ruleValue can be a single ID or a table of IDs
|
-- ruleValue can be a single ID or a table of IDs
|
||||||
if type(ruleValue) == "table" then
|
if type(ruleValue) == "table" then
|
||||||
for _, id in ipairs(ruleValue) do
|
for _, id in ipairs(ruleValue) do
|
||||||
if itemID == id then return true end
|
if itemID == tonumber(id) then return true end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
return itemID == ruleValue
|
-- Convert string to number if needed
|
||||||
|
return itemID == tonumber(ruleValue)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif ruleType == "isSoulShard" then
|
elseif ruleType == "isSoulShard" then
|
||||||
|
|||||||
+12
-1
@@ -508,8 +508,15 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
header:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", startX + currentX, startY - currentY)
|
header:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", startX + currentX, startY - currentY)
|
||||||
header:SetWidth(blockWidth)
|
header:SetWidth(blockWidth)
|
||||||
|
|
||||||
|
-- Get display name from category definition
|
||||||
local displayName = catName
|
local displayName = catName
|
||||||
header.fullName = catName
|
if addon.Modules.CategoryManager then
|
||||||
|
local catDef = addon.Modules.CategoryManager:GetCategory(catName)
|
||||||
|
if catDef and catDef.name then
|
||||||
|
displayName = catDef.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
header.fullName = displayName
|
||||||
header.isShortened = false
|
header.isShortened = false
|
||||||
if string.len(displayName) > 8 and numItems < 2 then
|
if string.len(displayName) > 8 and numItems < 2 then
|
||||||
displayName = string.sub(displayName, 1, 6) .. "..."
|
displayName = string.sub(displayName, 1, 6) .. "..."
|
||||||
@@ -574,6 +581,10 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- Also check if Empty section should show
|
||||||
|
if totalFreeSlots > 0 then
|
||||||
|
hasAnyBottom = true
|
||||||
|
end
|
||||||
|
|
||||||
if hasAnyBottom then
|
if hasAnyBottom then
|
||||||
y = y - 10
|
y = y - 10
|
||||||
|
|||||||
+13
-2
@@ -35,8 +35,19 @@ function Guda_CategorizeItem(itemData, bagID, slotID, categories, specialItems,
|
|||||||
-- Priority 1: Special items (Hearthstone, Mounts, Tools)
|
-- Priority 1: Special items (Hearthstone, Mounts, Tools)
|
||||||
-- These are handled separately and go into specialItems table, not categories
|
-- These are handled separately and go into specialItems table, not categories
|
||||||
if string.find(itemName, "Hearthstone") then
|
if string.find(itemName, "Hearthstone") then
|
||||||
table.insert(specialItems.Hearthstone, {bagID = bagID, slotID = slotID, itemData = itemData})
|
-- Only show in Home section if Home category is enabled
|
||||||
return
|
local showHome = true
|
||||||
|
if addon.Modules.CategoryManager then
|
||||||
|
local homeCat = addon.Modules.CategoryManager:GetCategory("Home")
|
||||||
|
if homeCat then
|
||||||
|
showHome = homeCat.enabled
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if showHome then
|
||||||
|
table.insert(specialItems.Hearthstone, {bagID = bagID, slotID = slotID, itemData = itemData})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- If Home is disabled, fall through to normal categorization
|
||||||
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})
|
||||||
return
|
return
|
||||||
|
|||||||
+32
-11
@@ -1345,17 +1345,37 @@ function Guda_SettingsPopup_CategoriesTab_Update()
|
|||||||
row.builtInText:Hide()
|
row.builtInText:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Enable/disable move buttons based on position
|
-- Hide all controls for hideControls categories (only checkbox visible)
|
||||||
if dataIndex == 1 then
|
if categoryDef.hideControls then
|
||||||
row.upBtn:Disable()
|
row.editBtn:Hide()
|
||||||
|
row.upBtn:Hide()
|
||||||
|
row.downBtn:Hide()
|
||||||
|
row.deleteBtn:Hide()
|
||||||
|
row.builtInText:Hide()
|
||||||
else
|
else
|
||||||
row.upBtn:Enable()
|
row.editBtn:Show()
|
||||||
end
|
row.upBtn:Show()
|
||||||
|
row.downBtn:Show()
|
||||||
|
|
||||||
if dataIndex == totalCategories then
|
-- Enable/disable move buttons based on position
|
||||||
row.downBtn:Disable()
|
if dataIndex == 1 then
|
||||||
else
|
row.upBtn:Disable()
|
||||||
row.downBtn:Enable()
|
else
|
||||||
|
-- Check if category above has hideControls (can't move above it)
|
||||||
|
local aboveCatId = categoryOrder[dataIndex - 1]
|
||||||
|
local aboveCatDef = Guda.Modules.CategoryManager:GetCategory(aboveCatId)
|
||||||
|
if aboveCatDef and aboveCatDef.hideControls then
|
||||||
|
row.upBtn:Disable()
|
||||||
|
else
|
||||||
|
row.upBtn:Enable()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if dataIndex == totalCategories then
|
||||||
|
row.downBtn:Disable()
|
||||||
|
else
|
||||||
|
row.downBtn:Enable()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set text color based on enabled state
|
-- Set text color based on enabled state
|
||||||
@@ -1404,11 +1424,11 @@ function Guda_SettingsPopup_AddCategory_OnClick()
|
|||||||
|
|
||||||
-- Create new category definition
|
-- Create new category definition
|
||||||
local newDef = {
|
local newDef = {
|
||||||
name = "New Category " .. counter,
|
name = "Custom " .. counter,
|
||||||
icon = "Interface\\Icons\\INV_Misc_QuestionMark",
|
icon = "Interface\\Icons\\INV_Misc_QuestionMark",
|
||||||
rules = {},
|
rules = {},
|
||||||
matchMode = "any",
|
matchMode = "any",
|
||||||
priority = 50,
|
priority = 80,
|
||||||
enabled = true,
|
enabled = true,
|
||||||
isBuiltIn = false,
|
isBuiltIn = false,
|
||||||
}
|
}
|
||||||
@@ -1466,6 +1486,7 @@ local RULE_TYPE_OPTIONS = {
|
|||||||
{ id = "itemType", name = "Item Type" },
|
{ id = "itemType", name = "Item Type" },
|
||||||
{ id = "itemSubtype", name = "Item Subtype" },
|
{ id = "itemSubtype", name = "Item Subtype" },
|
||||||
{ id = "namePattern", name = "Name Contains" },
|
{ id = "namePattern", name = "Name Contains" },
|
||||||
|
{ id = "itemID", name = "Item ID" },
|
||||||
{ id = "quality", name = "Quality (exact)" },
|
{ id = "quality", name = "Quality (exact)" },
|
||||||
{ id = "qualityMin", name = "Quality (min)" },
|
{ id = "qualityMin", name = "Quality (min)" },
|
||||||
{ id = "isBoE", name = "Bind on Equip" },
|
{ id = "isBoE", name = "Bind on Equip" },
|
||||||
|
|||||||
Reference in New Issue
Block a user