0c89853 - Remove debug prints
[wowui.git] / OmaLog / Logging.lua
1 -- Logging.lua
2 local _;
3 local print = print;
4 local LoggingCombat = LoggingCombat;
5 local GetInstanceInfo = GetInstanceInfo;
6 local CTimerAfter = C_Timer.After;
7 local frame = CreateFrame("Frame", "OmaLogger");
8 frame:Hide();
9
10 local minRaidMapID = 1520;
11 --local minDungMapID = 1456;
12
13 local function shouldLog()
14     local _, zoneType, difficulty, _, _, _, _, mapID = GetInstanceInfo();
15     if zoneType == "raid" and mapID >= minRaidMapID then
16         if difficulty == 17 then -- LFR
17             return false;
18         elseif difficulty == 16 then -- Mythic
19             return true;
20         elseif difficulty == 15 then -- Heroic
21             return true;
22         elseif difficulty == 14 then -- Normal
23             return true;
24         end
25     --elseif zoneType == "party" and mapID >= minDungMapID then
26     --    if difficulty == 8 or difficulty == 23 then
27     --        return true;
28     --    end
29     end
30
31     return false;
32 end
33
34 local prevLogging = nil;
35 local function updateZone()
36     local log = shouldLog();
37     if log then
38         LoggingCombat(true);
39         print("<><><><><><><><><><><>");
40         print("Started Combat Log");
41         print("<><><><><><><><><><><>");
42     elseif prevLogging and LoggingCombat() then
43         print("<><><><><><><><><><><>");
44         print("Ended Combat Log");
45         print("<><><><><><><><><><><>");
46     end
47     prevLogging = log;
48 end
49
50 frame:SetScript("OnEvent", function(self, event)
51     if event == "ZONE_CHANGED_NEW_AREA" then
52         CTimerAfter(3, updateZone);
53     elseif event == "CHALLENGE_MODE_START" then
54         CTimerAfter(1, updateZone);
55     end
56 end);
57 frame:RegisterEvent("ZONE_CHANGED_NEW_AREA");
58 --frame:RegisterEvent("CHALLENGE_MODE_START"); -- for logging M+