Mercurial > wow > spotlight-hidden-artifact-skin-tracking
changeset 5:59c355620405 v0.7.1.2
Added Slash Handler for /spotlight
Updated LDB display formatting.
Added verification to initialization
author | Vynn <mischivin@gmail.com> |
---|---|
date | Sun, 29 Jan 2017 10:18:10 -0500 |
parents | 61a64da6caec |
children | 9f700e02d4d3 |
files | Spotlight.lua |
diffstat | 1 files changed, 29 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Spotlight.lua Sun Jan 29 10:17:09 2017 -0500 +++ b/Spotlight.lua Sun Jan 29 10:18:10 2017 -0500 @@ -8,6 +8,21 @@ end, }) +SLASH_SPOTLIGHT1, SLASH_SPOTLIGHT2 = "/spotlight", "/Spotlight"; + +local function SlashHandler(msg) + print("|T" .. dataobj.icon .. ":0|t |cffe5cc80Spotlight|r - Artifact Hidden Skin Progress:"); + if Spotlight.IDs then + for key, value in pairs(Spotlight.IDs) do + print(" |cffe5cc80" .. key .. " - " .. Spotlight.Format(key, false) .. " (" .. Spotlight.Format(key, true) .. ")|r"); + end + end +end + +function SlashCmdList.SPOTLIGHT(msg, editbox) + SlashHandler(msg); +end + local function Initialize () if not Spotlight.Status then Spotlight.Status = { @@ -61,9 +76,9 @@ return "ff" .. string.format("%02x", r) .. string.format("%02x", g) .. string.format("%02x", b); end - Spotlight.Format = function (key) + Spotlight.Format = function (key, showPercent) local value = Spotlight.Status[key].Progress / Spotlight.Status[key].Max; - if Spotlight.ShowPercent then + if showPercent then value = string.format("|c" .. Spotlight.GetColor(value) .. "%.1f|cffffffff%%|r", value * 100); else value = "|c" .. Spotlight.GetColor(value) .. Spotlight.Status[key].Progress .. "|cffffffff/" .. Spotlight.Status[key].Max .. "|r"; @@ -77,8 +92,12 @@ Spotlight.Status[key].Completed = select(3, GetAchievementCriteriaInfo(value,1)); if not Spotlight.Status[key].Completed then Spotlight.Status[key].Progress = Spotlight.Calculate(key); + if output == "" then + else + output = output .. " ||"; + end if Spotlight.Status[key].Progress > 0 then - output = output .. string.format(" %.1s", key) .. ":" .. Spotlight.Format(key); + output = output .. string.format("|cffe5cc80 %.1s", key) .. ":|r " .. Spotlight.Format(key, Spotlight.ShowPercent); end end end @@ -87,12 +106,14 @@ end Spotlight.Update(); + + return true end function dataobj:OnTooltipShow() - self:AddLine("Spotlight - Hidden Artifact Tracker|n|n"); + self:AddLine("|cffe5cc80Spotlight - Hidden Artifact Skins|r|n|n"); for k, v in pairs(Spotlight.IDs) do - self:AddDoubleLine(k .. ":", Spotlight.Format(k)); + self:AddDoubleLine(k .. ":", Spotlight.Format(k, false) .. " (" .. Spotlight.Format(k, true) .. ")"); end self:AddLine("|nClick to toggle display method"); end @@ -111,7 +132,9 @@ local function EventHandler(self, event, ...) if event == "VARIABLES_LOADED" then - Initialize(); + if Initialize() then + print("|T" .. dataobj.icon .. ":0|t |cffe5cc80Spotlight v" .. GetAddOnMetadata("Spotlight", "Version") .. " Loaded!|r") + end end if event == "CRITERIA_UPDATE" or "PLAYER_ENTERING_WORLD" then Spotlight.Update();