From a21cafc72d82988e7202fa14efd307e1a81581b6 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 21 Oct 2020 09:37:12 -0500 Subject: [PATCH] Revert "Use name instead of icon file" This reverts commit 78678ea8b924654d5bcf741a6563b3d9bd8617dd. --- Scoreboard.lua | 16 ++++++++-------- config.lua | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Scoreboard.lua b/Scoreboard.lua index 7588bf6..c7296d9 100644 --- a/Scoreboard.lua +++ b/Scoreboard.lua @@ -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 @@ -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 @@ -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"); diff --git a/config.lua b/config.lua index c94f3c8..ed50570 100644 --- a/config.lua +++ b/config.lua @@ -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