11b769e - Don't inspect priests to get spec, CD is same anyway
[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 raidIDs = {
11     [1861] = "Uldir",
12 };
13 local dungeonIDs = {
14     [1594] = "The Undermine",
15     [1754] = "Freehold",
16     [1762] = "King's Rest",
17     [1763] = "Atal'Dazar",
18     [1771] = "Tol Dagor",
19     [1822] = "Siege of Boralus",
20     [1841] = "Underrot",
21     [1862] = "Waycrest Manor",
22     [1864] = "Shrine of the Storm",
23     [1877] = "Temple of Sethraliss",
24 };
25
26 local function shouldLog()
27     local _, zoneType, difficulty, _, _, _, _, mapID = GetInstanceInfo();
28     if zoneType == "raid" then print(mapID) end
29     if zoneType == "raid" and raidIDs[mapID] then
30         if difficulty == 17 then -- LFR
31             return false;
32         elseif difficulty == 16 then -- Mythic
33             return true;
34         elseif difficulty == 15 then -- Heroic
35             return true;
36         elseif difficulty == 14 then -- Normal
37             return true;
38         end
39     elseif zoneType == "party" and dungeonIDs[mapID] then
40         if difficulty == 8 or difficulty == 23 then
41             return true;
42         end
43     end
44
45     return false;
46 end
47
48 local prevLogging = nil;
49 local function updateZone()
50     local log = shouldLog();
51     if log then
52         LoggingCombat(true);
53         print("<><><><><><><><><><><>");
54         print("Started Combat Log");
55         print("<><><><><><><><><><><>");
56     elseif prevLogging and LoggingCombat() then
57         print("<><><><><><><><><><><>");
58         print("Ended Combat Log");
59         print("<><><><><><><><><><><>");
60     end
61     prevLogging = log;
62 end
63
64 frame:SetScript("OnEvent", function(self, event)
65     if event == "ZONE_CHANGED_NEW_AREA" then
66         CTimerAfter(3, updateZone);
67     elseif event == "CHALLENGE_MODE_START" then
68         CTimerAfter(1, updateZone);
69     end
70 end);
71 frame:RegisterEvent("ZONE_CHANGED_NEW_AREA");
72 --frame:RegisterEvent("CHALLENGE_MODE_START"); -- for logging M+