Mercurial > wow > spotlight-hidden-artifact-skin-tracking
comparison Spotlight.lua @ 23:4ec7ae897af0 v1.7.2.0
Updated Spotlight's display to support icons - may make it easier to read for some people :) Thanks for the suggestion pros4c!
author | Vynn <mischivin@gmail.com> |
---|---|
date | Sat, 01 Apr 2017 21:54:13 -0400 |
parents | e801ab5c2e1b |
children | 6c495455f069 |
comparison
equal
deleted
inserted
replaced
22:708f1d1b81c4 | 23:4ec7ae897af0 |
---|---|
3 local dataobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("Spotlight", { | 3 local dataobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("Spotlight", { |
4 type = "data source", | 4 type = "data source", |
5 text = "Nothing to track!", | 5 text = "Nothing to track!", |
6 icon = GetInventoryItemTexture("player", 16), | 6 icon = GetInventoryItemTexture("player", 16), |
7 OnClick = function(clickedframe, button) | 7 OnClick = function(clickedframe, button) |
8 Spotlight.ShowPercent = not Spotlight.ShowPercent; | 8 if button == "LeftButton" then |
9 Spotlight.ShowPercent = not Spotlight.ShowPercent; | |
10 elseif button == "RightButton" then | |
11 Spotlight.ShowIcon = not Spotlight.ShowIcon; | |
12 end | |
9 Spotlight.Update(); | 13 Spotlight.Update(); |
10 end, | 14 end, |
11 }) | 15 }) |
12 | 16 |
13 SLASH_SPOTLIGHT1, SLASH_SPOTLIGHT2 = "/spotlight", "/Spotlight"; | 17 SLASH_SPOTLIGHT1, SLASH_SPOTLIGHT2 = "/spotlight", "/Spotlight"; |
14 | 18 |
19 local ICONS = { | |
20 PvP = "|T1339312:12:12:0:0:512:128:416:432:42:58|t", | |
21 Dungeons = "|T1339312:12:12:0:0:512:128:416:432:24:40|t", | |
22 WorldQuests = "|T1339312:12:12:0:0:512:128:428:444:87:103|t", | |
23 } | |
24 | |
15 local function SlashHandler(msg) | 25 local function SlashHandler(msg) |
16 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:"); |
17 if Spotlight.IDs then | 27 if Spotlight.IDs then |
18 for key, value in pairs(Spotlight.IDs) do | 28 for key, value in pairs(Spotlight.IDs) do |
19 print(" |cffe5cc80" .. key .. " - " .. Spotlight.Format(key, false) .. " (" .. Spotlight.Format(key, true) .. ")|r"); | 29 print(" " .. ICONS[tostring(key)] .. " |cffe5cc80" .. key .. " - " .. Spotlight.Format(key, false) .. " (" .. Spotlight.Format(key, true) .. ")|r"); |
20 end | 30 end |
21 end | 31 end |
22 end | 32 end |
23 | 33 |
24 function SlashCmdList.SPOTLIGHT(msg, editbox) | 34 function SlashCmdList.SPOTLIGHT(msg, editbox) |
43 Progress = 0, | 53 Progress = 0, |
44 Max = 1000, | 54 Max = 1000, |
45 }, | 55 }, |
46 }; | 56 }; |
47 Spotlight.ShowPercent = true; | 57 Spotlight.ShowPercent = true; |
58 Spotlight.ShowIcon = false; | |
48 end | 59 end |
49 | 60 |
50 Spotlight.IDs = { | 61 Spotlight.IDs = { |
51 Dungeons = 11152, | 62 Dungeons = 11152, |
52 WorldQuests = 11153, | 63 WorldQuests = 11153, |
94 local output = ""; | 105 local output = ""; |
95 for key, value in pairs(Spotlight.IDs) do | 106 for key, value in pairs(Spotlight.IDs) do |
96 Spotlight.Status[key].Completed = select(3, GetAchievementCriteriaInfo(value,1)); | 107 Spotlight.Status[key].Completed = select(3, GetAchievementCriteriaInfo(value,1)); |
97 if not Spotlight.Status[key].Completed then | 108 if not Spotlight.Status[key].Completed then |
98 Spotlight.Status[key].Progress = Spotlight.Calculate(key); | 109 Spotlight.Status[key].Progress = Spotlight.Calculate(key); |
99 if output == "" then | 110 if output == "" then |
111 output = " "; | |
100 else | 112 else |
101 output = output .. " ||"; | 113 output = output .. " || "; |
102 end | 114 end |
103 if Spotlight.Status[key].Progress > 0 then | 115 if Spotlight.Status[key].Progress > 0 then |
104 output = output .. string.format("|cffe5cc80 %.1s", key) .. ":|r " .. Spotlight.Format(key, Spotlight.ShowPercent); | 116 if Spotlight.ShowIcon then |
117 output = output .. ICONS[tostring(key)] .. Spotlight.Format(key, Spotlight.ShowPercent); | |
118 else | |
119 output = output .. string.format("|cffe5cc80%.1s", key) .. ":|r " .. Spotlight.Format(key, Spotlight.ShowPercent); | |
120 end | |
105 end | 121 end |
106 end | 122 end |
123 end | |
124 if output == "" then | |
125 output = " Everything Unlocked!"; | |
107 end | 126 end |
108 | 127 |
109 dataobj.icon = Spotlight.Icon | 128 dataobj.icon = Spotlight.Icon |
110 dataobj.text = output; | 129 dataobj.text = output; |
111 end | 130 end |
117 | 136 |
118 function dataobj:OnTooltipShow() | 137 function dataobj:OnTooltipShow() |
119 self:AddLine("|cffe5cc80Spotlight - Hidden Artifact Skins|r|n|n"); | 138 self:AddLine("|cffe5cc80Spotlight - Hidden Artifact Skins|r|n|n"); |
120 for k, v in pairs(Spotlight.IDs) do | 139 for k, v in pairs(Spotlight.IDs) do |
121 if not Spotlight.Status[k].Completed then | 140 if not Spotlight.Status[k].Completed then |
122 self:AddDoubleLine(k .. ":", Spotlight.Format(k, false) .. " (" .. Spotlight.Format(k, true) .. ")"); | 141 self:AddDoubleLine(ICONS[tostring(k)] .. " " .. k .. ":", Spotlight.Format(k, false) .. " (" .. Spotlight.Format(k, true) .. ")"); |
123 end | 142 end |
124 end | 143 end |
125 self:AddLine("|nClick to toggle display method"); | 144 self:AddLine("|nLeft Click to toggle Percentage or Fractional Display"); |
145 self:AddLine("|nRight Click to toggle Icon or Text Labels") | |
126 end | 146 end |
127 | 147 |
128 function dataobj:OnEnter() | 148 function dataobj:OnEnter() |
129 GameTooltip:SetOwner(self, "ANCHOR_NONE"); | 149 GameTooltip:SetOwner(self, "ANCHOR_NONE"); |
130 GameTooltip:SetPoint("TOP", self, "BOTTOM"); | 150 GameTooltip:SetPoint("TOP", self, "BOTTOM"); |