Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKrowi committed Aug 18, 2022
1 parent 61e2e0e commit 0c861f0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 24 deletions.
4 changes: 4 additions & 0 deletions Data/EventData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,17 @@ function GetSavedWorldEvents(activeWorldEvents, currentDate)
end

function GetNewWorldEvents(activeWorldEvents)
-- print("GetNewWorldEvents(activeWorldEvents)")
for _, event in next, data.WorldEvents do
-- print(event.Id, event.ID, event.Icon, event.Name, event.MapID, event.TotalDuration);
if event.EventDetails == nil and addon.Options.db.EventReminders.WorldEvents[event.ID] then
local poiInfo = C_AreaPoiInfo.GetAreaPOIInfo(event.MapID, event.ID);
-- print(poiInfo);
if poiInfo then -- The event is active
local secondsLeft = C_AreaPoiInfo.GetAreaPOISecondsLeft(event.ID);
-- diagnostics.Debug(secondsLeft);
if secondsLeft == nil or secondsLeft == 0 then
-- print("problem", event.Id)
return; -- C_AreaPoiInfo is not yet properly loaded
end

Expand Down
40 changes: 26 additions & 14 deletions Globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -462,19 +462,6 @@ function addon.ChangeAchievementMicroButtonOnClick()
end);
end

-- function KrowiAF_FireEvent(event, ...)
-- event=event:upper();-- Events are always uppercase
-- local list={GetFramesRegisteredForEvent(event)};-- Get list of frames
-- for _,frame in ipairs(list) do
-- local func=frame:GetScript("OnEvent");-- Get OnEvent handler
-- if func then
-- print(frame:GetName());
-- end-- Run it if there is one
-- end
-- end

-- /run KrowiAF_FireEvent("ACHIEVEMENT_EARNED");

local cachedIsNotWotLKClassic, cachedIsWotLKClassic;
function addon.IsNotWotLKClassic()
if cachedIsNotWotLKClassic ~= nil then
Expand Down Expand Up @@ -528,4 +515,29 @@ end

function addon.GetCovenantName(covenantID)
return C_Covenants and C_Covenants.GetCovenantData(covenantID).name or covenantID;
end
end

-- function KrowiAF_FireEvent(event, ...)
-- event=event:upper();-- Events are always uppercase
-- local list={GetFramesRegisteredForEvent(event)};-- Get list of frames
-- for _,frame in ipairs(list) do
-- local func=frame:GetScript("OnEvent");-- Get OnEvent handler
-- if func then
-- print(frame:GetName());
-- end-- Run it if there is one
-- end
-- end

-- /run KrowiAF_FireEvent("ACHIEVEMENT_EARNED");

-- function KrowiAF_GetAreaPOILeft()
-- for i = 1, 7216 do
-- local left = C_AreaPoiInfo.GetAreaPOISecondsLeft(i);
-- if left then
-- print(i, left);
-- end
-- end
-- print(i)
-- end

-- /run KrowiAF_GetAreaPOILeft();
18 changes: 8 additions & 10 deletions Objects/Event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ local event = objects.Event;

event.__index = event;
function event:New(id, icon, name, mapID, totalDuration)
local self = {};
setmetatable(self, event);
local instance = setmetatable({}, event);

self.Id = id or 0;
self.ID = self.Id;
self.Icon = icon or 0;
self.Name = name;
self.MapID = mapID;
self.TotalDuration = totalDuration;

return self;
instance.Id = id or 0;
instance.ID = instance.Id;
instance.Icon = icon or 0;
instance.Name = name;
instance.MapID = mapID;
instance.TotalDuration = totalDuration;
return instance;
end

function event:AddAchievement(achievement)
Expand Down

0 comments on commit 0c861f0

Please sign in to comment.