Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BetterBags category function #46

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Equipment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3017,6 +3017,38 @@ if LibStub and LibStub:GetLibrary("AceAddon-3.0", true) then
end
end

-- BetterBags
if LibStub and LibStub:GetLibrary("AceAddon-3.0", true) then
local BetterBags = LibStub("AceAddon-3.0"):GetAddon("BetterBags", true)

if BetterBags then
local setCategories = {}
local categories = BetterBags:GetModule('Categories')
categories:RegisterCategoryFunction("BtWLoadouts", function(data)
local location = PackLocation(data.bagid, data.slotid)
local sets = {}
local set = GetEnabledSetsForLocation(location, sets)[1]
if set then
local category = format(L["Set: %s"], set.name)
setCategories[category] = true
return category
end
return nil
end)

-- Delete custom categories created by BtWLoadouts on character logout
-- This ensures only categories for sets enabled for the current character are displayed
local frame = CreateFrame("Frame")
frame:SetScript("OnEvent", function ()
for category in pairs(setCategories) do
categories:DeleteCategory(category)
end
end)
frame:RegisterEvent("PLAYER_LOGOUT")
frame:Hide()
end
end

-- LibItemSearch, used by Bagnon to display borders around items within equipment sets
if LibStub and LibStub:GetLibrary("LibItemSearch-1.2", true) then
local Lib = LibStub("LibItemSearch-1.2")
Expand Down