Skip to content

Commit

Permalink
Revert "Use name instead of icon file"
Browse files Browse the repository at this point in the history
This reverts commit 78678ea.
  • Loading branch information
solocommand committed Oct 21, 2020
1 parent 38b7d6e commit a21cafc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions Scoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ do
addon.dataobj = dataobj

-- Remove any non-word characters that cause issues saving in other locales
local function getCurrencyKey(name) return gsub(name, "[^a-zA-Z]", "") end
local function getIconKey(icon) return gsub(icon, "[^%w]", "") end

local function fmtIcon(icon)
local text
Expand Down Expand Up @@ -116,7 +116,7 @@ do
for i=1, size do
local c = C_CurrencyInfo.GetCurrencyListInfo(i)
if (not c.isHeader) then
if (addon:getCurrency(c.name) and not c.isTypeUnused) then
if (addon:getCurrency(c.iconFileID) and not c.isTypeUnused) then
text = text..renderItem(c.name, c.quantity, c.iconFileID, c.maxQuantity)
if (i ~= size) then text = text.." " end
end
Expand Down Expand Up @@ -187,15 +187,15 @@ do
updateText()
end

function addon:setCurrency(name, value)
local nk = getCurrencyKey(name)
addon.db.currencies[nk] = value
function addon:setCurrency(icon, value)
local ik = getIconKey(icon)
addon.db.currencies[ik] = value
updateText()
end

function addon:getCurrency(name)
local nk = getCurrencyKey(name)
return addon.db.currencies[nk] == true
function addon:getCurrency(icon)
local ik = getIconKey(icon)
return addon.db.currencies[ik] == true
end

f:RegisterEvent("PLAYER_ENTERING_WORLD");
Expand Down
4 changes: 2 additions & 2 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ local function build()
type = 'toggle',
order = 20 + i,
name = c.name,
get = function() return addon:getCurrency(c.name) end,
set = function(i, v) return addon:setCurrency(c.name, v) end,
get = function() return addon:getCurrency(c.iconFileID) end,
set = function(i, v) return addon:setCurrency(c.iconFileID, v) end,
}
end
end
Expand Down

0 comments on commit a21cafc

Please sign in to comment.