Mercurial > wow > spotlight-hidden-artifact-skin-tracking
comparison Spotlight.lua @ 9:cbf645630277
Reduced a couple of instances of a redundant function call
author | Vynn <mischivin@gmail.com> |
---|---|
date | Wed, 01 Feb 2017 14:18:49 -0500 |
parents | a30c29933ebc |
children | 38285b3ff70f |
comparison
equal
deleted
inserted
replaced
8:a30c29933ebc | 9:cbf645630277 |
---|---|
9 }) | 9 }) |
10 | 10 |
11 SLASH_SPOTLIGHT1, SLASH_SPOTLIGHT2 = "/spotlight", "/Spotlight"; | 11 SLASH_SPOTLIGHT1, SLASH_SPOTLIGHT2 = "/spotlight", "/Spotlight"; |
12 | 12 |
13 local function SlashHandler(msg) | 13 local function SlashHandler(msg) |
14 print("|T" .. dataobj.icon .. ":0|t |cffe5cc80Spotlight|r - Artifact Hidden Skin Progress:"); | 14 print("|T" .. Spotlight.Icon .. ":0|t |cffe5cc80Spotlight|r - Artifact Hidden Skin Progress:"); |
15 if Spotlight.IDs then | 15 if Spotlight.IDs then |
16 for key, value in pairs(Spotlight.IDs) do | 16 for key, value in pairs(Spotlight.IDs) do |
17 print(" |cffe5cc80" .. key .. " - " .. Spotlight.Format(key, false) .. " (" .. Spotlight.Format(key, true) .. ")|r"); | 17 print(" |cffe5cc80" .. key .. " - " .. Spotlight.Format(key, false) .. " (" .. Spotlight.Format(key, true) .. ")|r"); |
18 end | 18 end |
19 end | 19 end |
85 end | 85 end |
86 return value; | 86 return value; |
87 end | 87 end |
88 | 88 |
89 Spotlight.Update = function (self) | 89 Spotlight.Update = function (self) |
90 Spotlight.Icon = GetInventoryItemTexture("player", 16); | |
91 | |
90 local output = ""; | 92 local output = ""; |
91 for key, value in pairs(Spotlight.IDs) do | 93 for key, value in pairs(Spotlight.IDs) do |
92 Spotlight.Status[key].Completed = select(3, GetAchievementCriteriaInfo(value,1)); | 94 Spotlight.Status[key].Completed = select(3, GetAchievementCriteriaInfo(value,1)); |
93 if not Spotlight.Status[key].Completed then | 95 if not Spotlight.Status[key].Completed then |
94 Spotlight.Status[key].Progress = Spotlight.Calculate(key); | 96 Spotlight.Status[key].Progress = Spotlight.Calculate(key); |
99 if Spotlight.Status[key].Progress > 0 then | 101 if Spotlight.Status[key].Progress > 0 then |
100 output = output .. string.format("|cffe5cc80 %.1s", key) .. ":|r " .. Spotlight.Format(key, Spotlight.ShowPercent); | 102 output = output .. string.format("|cffe5cc80 %.1s", key) .. ":|r " .. Spotlight.Format(key, Spotlight.ShowPercent); |
101 end | 103 end |
102 end | 104 end |
103 end | 105 end |
104 dataobj.icon = GetInventoryItemTexture("player", 16); | 106 |
107 dataobj.icon = Spotlight.Icon | |
105 dataobj.text = output; | 108 dataobj.text = output; |
106 end | 109 end |
107 | 110 |
108 Spotlight.Update(); | 111 Spotlight.Update(); |
109 | 112 |
131 end | 134 end |
132 | 135 |
133 local function EventHandler(self, event, ...) | 136 local function EventHandler(self, event, ...) |
134 if event == "VARIABLES_LOADED" then | 137 if event == "VARIABLES_LOADED" then |
135 if Initialize() then | 138 if Initialize() then |
136 print("|T" .. GetInventoryItemTexture("player", 16) .. ":0|t |cffe5cc80Spotlight v" .. GetAddOnMetadata("Spotlight", "Version") .. " Loaded!|r") | 139 print("|T" .. Spotlight.Icon .. ":0|t |cffe5cc80Spotlight v" .. GetAddOnMetadata("Spotlight", "Version") .. " Loaded!|r") |
137 end | 140 end |
138 end | 141 end |
139 if event == "CRITERIA_UPDATE" or "PLAYER_ENTERING_WORLD" then | 142 if event == "CRITERIA_UPDATE" or "PLAYER_ENTERING_WORLD" then |
140 Spotlight.Update(); | 143 Spotlight.Update(); |
141 end | 144 end |