-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ debug\frames.lua | |
|
||
theme\masque.lua | ||
|
||
data\categories.lua | ||
data\items.lua | ||
|
||
util\color.lua | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
local addonName = ... ---@type string | ||
|
||
---@class BetterBags: AceAddon | ||
local addon = LibStub('AceAddon-3.0'):GetAddon(addonName) | ||
|
||
---@class Categories: AceModule | ||
---@field private itemToCategory table<number, string> | ||
local categories = addon:NewModule('Categories') | ||
|
||
function categories:OnInitialize() | ||
self.itemToCategory = {} | ||
end | ||
|
||
---@param id number The ItemID of the item to add to a custom category. | ||
---@param category string The name of the custom category to add the item to. | ||
function categories:AddItemToCategory(id, category) | ||
self.itemToCategory[id] = category | ||
end | ||
|
||
---@param id number The ItemID of the item to lookup a custom category for. | ||
---@return string | ||
function categories:GetCustomCategory(id) | ||
return self.itemToCategory[id] | ||
end | ||
|
||
---@param id number The ItemID of the item to remove from a custom category. | ||
function categories:RemoveItemFromCategory(id) | ||
self.itemToCategory[id] = nil | ||
end | ||
|
||
categories:Enable() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters