comparison Spotlight.lua @ 14:6ee128c4bd4d v0.7.1.4

One more bug fix with initializing the addon.
author Vynn <mischivin@gmail.com>
date Mon, 06 Feb 2017 10:41:09 -0500
parents 38285b3ff70f
children e801ab5c2e1b
comparison
equal deleted inserted replaced
13:f653da97b5bd 14:6ee128c4bd4d
1 local initizlized = false;
2
1 local dataobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("Spotlight", { 3 local dataobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("Spotlight", {
2 type = "data source", 4 type = "data source",
3 text = "Nothing to track!", 5 text = "Nothing to track!",
4 icon = GetInventoryItemTexture("player", 16), 6 icon = GetInventoryItemTexture("player", 16),
5 OnClick = function(clickedframe, button) 7 OnClick = function(clickedframe, button)
21 23
22 function SlashCmdList.SPOTLIGHT(msg, editbox) 24 function SlashCmdList.SPOTLIGHT(msg, editbox)
23 SlashHandler(msg); 25 SlashHandler(msg);
24 end 26 end
25 27
26 local function Initialize () 28 local function Initialize()
27 if not Spotlight.Status then 29 if not Spotlight.Status then
28 Spotlight.Status = { 30 Spotlight.Status = {
29 Dungeons = { 31 Dungeons = {
30 Completed = false, 32 Completed = false,
31 Progress = 0, 33 Progress = 0,
134 end 136 end
135 137
136 local function EventHandler(self, event, ...) 138 local function EventHandler(self, event, ...)
137 if event == "VARIABLES_LOADED" then 139 if event == "VARIABLES_LOADED" then
138 if Initialize() then 140 if Initialize() then
139 print("|T" .. GetInventoryItemTexture("player", 16) .. ":0|t |cffe5cc80Spotlight v" .. GetAddOnMetadata("Spotlight", "Version") .. " Loaded!|r") 141 initialized = true;
142 print("|T" .. (Spotlight.Icon or 1355359) .. ":0|t |cffe5cc80Spotlight v" .. GetAddOnMetadata("Spotlight", "Version") .. " Loaded!|r");
140 end 143 end
141 end 144 end
142 if event == "CRITERIA_UPDATE" or "PLAYER_ENTERING_WORLD" then 145 if event == "CRITERIA_UPDATE" or "PLAYER_ENTERING_WORLD" and initialized then
143 Spotlight.Update(); 146 Spotlight.Update();
144 end 147 end
145 end 148 end
146 149
147 local EventListener = CreateFrame("FRAME", "Spotlight"); 150 local EventListener = CreateFrame("FRAME", "Spotlight");