comparison Spotlight.lua @ 26:6c495455f069

Fixed a bug in the LDB display for completed skins (thanks pros4c for catching!). Changed the way unlocked skins are displayed in most circumstances.
author Vynn <mischivin@gmail.com>
date Sun, 02 Apr 2017 14:22:45 -0400
parents 4ec7ae897af0
children 915a2b4cd5d5
comparison
equal deleted inserted replaced
25:2a0df868533a 26:6c495455f069
24 24
25 local function SlashHandler(msg) 25 local function SlashHandler(msg)
26 print("|T" .. Spotlight.Icon .. ":0|t |cffe5cc80Spotlight|r - Artifact Hidden Skin Progress:"); 26 print("|T" .. Spotlight.Icon .. ":0|t |cffe5cc80Spotlight|r - Artifact Hidden Skin Progress:");
27 if Spotlight.IDs then 27 if Spotlight.IDs then
28 for key, value in pairs(Spotlight.IDs) do 28 for key, value in pairs(Spotlight.IDs) do
29 print(" " .. ICONS[tostring(key)] .. " |cffe5cc80" .. key .. " - " .. Spotlight.Format(key, false) .. " (" .. Spotlight.Format(key, true) .. ")|r"); 29 if not Spotlight.Status[key].Completed then
30 print(" " .. ICONS[tostring(key)] .. " |cffe5cc80" .. key .. " - " .. Spotlight.Format(key, false) .. " (" .. Spotlight.Format(key, true) .. ")|r");
31 else
32 print(" " .. ICONS[tostring(key)] .. " |cffe5cc80" .. key .. " - |cff00ff00Completed!|r");
33 end
30 end 34 end
31 end 35 end
32 end 36 end
33 37
34 function SlashCmdList.SPOTLIGHT(msg, editbox) 38 function SlashCmdList.SPOTLIGHT(msg, editbox)
105 local output = ""; 109 local output = "";
106 for key, value in pairs(Spotlight.IDs) do 110 for key, value in pairs(Spotlight.IDs) do
107 Spotlight.Status[key].Completed = select(3, GetAchievementCriteriaInfo(value,1)); 111 Spotlight.Status[key].Completed = select(3, GetAchievementCriteriaInfo(value,1));
108 if not Spotlight.Status[key].Completed then 112 if not Spotlight.Status[key].Completed then
109 Spotlight.Status[key].Progress = Spotlight.Calculate(key); 113 Spotlight.Status[key].Progress = Spotlight.Calculate(key);
110 if output == "" then 114 if Spotlight.Status[key].Progress >= 0 then
111 output = " "; 115 if output == "" then
112 else 116 output = " ";
113 output = output .. " || "; 117 else
114 end 118 output = output .. " || ";
115 if Spotlight.Status[key].Progress > 0 then 119 end
116 if Spotlight.ShowIcon then 120 if Spotlight.ShowIcon then
117 output = output .. ICONS[tostring(key)] .. Spotlight.Format(key, Spotlight.ShowPercent); 121 output = output .. ICONS[tostring(key)] .. Spotlight.Format(key, Spotlight.ShowPercent);
118 else 122 else
119 output = output .. string.format("|cffe5cc80%.1s", key) .. ":|r " .. Spotlight.Format(key, Spotlight.ShowPercent); 123 output = output .. string.format("|cffe5cc80%.1s", key) .. ":|r " .. Spotlight.Format(key, Spotlight.ShowPercent);
120 end 124 end
121 end 125 end
122 end 126 end
123 end 127 end
124 if output == "" then 128 if output == "" then
125 output = " Everything Unlocked!"; 129 output = " |cff00ff00All Hidden Skins Unlocked!|r";
126 end 130 end
127 131
128 dataobj.icon = Spotlight.Icon 132 dataobj.icon = Spotlight.Icon
129 dataobj.text = output; 133 dataobj.text = output;
130 end 134 end
137 function dataobj:OnTooltipShow() 141 function dataobj:OnTooltipShow()
138 self:AddLine("|cffe5cc80Spotlight - Hidden Artifact Skins|r|n|n"); 142 self:AddLine("|cffe5cc80Spotlight - Hidden Artifact Skins|r|n|n");
139 for k, v in pairs(Spotlight.IDs) do 143 for k, v in pairs(Spotlight.IDs) do
140 if not Spotlight.Status[k].Completed then 144 if not Spotlight.Status[k].Completed then
141 self:AddDoubleLine(ICONS[tostring(k)] .. " " .. k .. ":", Spotlight.Format(k, false) .. " (" .. Spotlight.Format(k, true) .. ")"); 145 self:AddDoubleLine(ICONS[tostring(k)] .. " " .. k .. ":", Spotlight.Format(k, false) .. " (" .. Spotlight.Format(k, true) .. ")");
146 else
147 self:AddDoubleLine(ICONS[tostring(k)] .. " " .. k .. ":", "|cff00ff00Completed!|r";
148
142 end 149 end
143 end 150 end
144 self:AddLine("|nLeft Click to toggle Percentage or Fractional Display"); 151 self:AddLine("|nLeft Click to toggle Percentage or Fractional Display");
145 self:AddLine("|nRight Click to toggle Icon or Text Labels") 152 self:AddLine("|nRight Click to toggle Icon or Text Labels")
146 end 153 end