Skip to content

Commit

Permalink
Update core.lua to remove redundant category wiping logic and corre…
Browse files Browse the repository at this point in the history
…ct color code in `Hearthstones.lua` database
  • Loading branch information
N6REJ committed Aug 9, 2024
1 parent d71684c commit 2a0f22f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Databases/Global/Hearthstones.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local _, addonTable = ...
-- Database
-----------------------------------------------------------
local db = {
["|cff16B7FFHearthstones|r"] = {
["|cff16A0FFHearthstones|r"] = {
-- ID, --Item name
173523, -- Tirisfal Camp Scroll
128353, -- Admiral's Compass
Expand Down
9 changes: 1 addition & 8 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,9 @@ local categories = BetterBags:GetModule('Categories')
---@class Localization: AceModule
local L = BetterBags:GetModule('Localization')

--- Initializwe seen categgories
local seenCategories = {}

--- Parse thru items. If category is new wipe it else just add items to it.
local function parseItems(db)
for category, items in pairs(db) do
if not seenCategories[category] then
categories:WipeCategory(L:G(category))
seenCategories[category] = true
end
for _, item in pairs(items) do
if C_Item.GetItemInfoInstant(item) then
categories:AddItemToCategory(item, L:G(category))
Expand All @@ -31,6 +24,6 @@ end
--- Parse thru categories and if its been seen before mark it as such
for dbName, db in pairs(addonTable.Database) do
if type(db) == "table" then
parseItems(db, seenCategories)
parseItems(db)
end
end

0 comments on commit 2a0f22f

Please sign in to comment.