ebee0bd - Add autologging
authorAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Sun, 18 Mar 2018 14:17:15 +0000
committerAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Sun, 18 Mar 2018 14:17:15 +0000
OmaLog/Logging.lua [new file with mode: 0644]
OmaLog/OmaLog.toc [new file with mode: 0644]

diff --git a/OmaLog/Logging.lua b/OmaLog/Logging.lua
new file mode 100644 (file)
index 0000000..093f456
--- /dev/null
@@ -0,0 +1,58 @@
+-- Logging.lua
+local _;
+local print = print;
+local LoggingCombat = LoggingCombat;
+local GetInstanceInfo = GetInstanceInfo;
+local CTimerAfter = C_Timer.After;
+local frame = CreateFrame("Frame", "OmaLogger");
+frame:Hide();
+
+local minRaidMapID = 1520;
+--local minDungMapID = 1456;
+
+local function shouldLog()
+    local _, zoneType, difficulty, _, _, _, _, mapID = GetInstanceInfo();
+    if zoneType == "raid" and mapID >= minRaidMapID then
+        if difficulty == 17 then -- LFR
+            return false;
+        elseif difficulty == 16 then -- Mythic
+            return true;
+        elseif difficulty == 15 then -- Heroic
+            return true;
+        elseif difficulty == 14 then -- Normal
+            return true;
+        end
+    --elseif zoneType == "party" and mapID >= minDungMapID then
+    --    if difficulty == 8 or difficulty == 23 then
+    --        return true;
+    --    end
+    end
+
+    return false;
+end
+
+local prevLogging = nil;
+local function updateZone()
+    local log = shouldLog();
+    if log then
+        LoggingCombat(true);
+        print("<><><><><><><><><><><>");
+        print("Started Combat Log");
+        print("<><><><><><><><><><><>");
+    elseif prevLogging and LoggingCombat() then
+        print("<><><><><><><><><><><>");
+        print("Ended Combat Log");
+        print("<><><><><><><><><><><>");
+    end
+    prevLogging = log;
+end
+
+frame:SetScript("OnEvent", function(self, event)
+    if event == "ZONE_CHANGED_NEW_AREA" then
+        CTimerAfter(3, updateZone);
+    elseif event == "CHALLENGE_MODE_START" then
+        CTimerAfter(1, updateZone);
+    end
+end);
+frame:RegisterEvent("ZONE_CHANGED_NEW_AREA");
+--frame:RegisterEvent("CHALLENGE_MODE_START"); -- for logging M+
diff --git a/OmaLog/OmaLog.toc b/OmaLog/OmaLog.toc
new file mode 100644 (file)
index 0000000..b3e957d
--- /dev/null
@@ -0,0 +1,7 @@
+## Interface: 70300
+## Title: Oma Autolog
+## Version: 1.0
+## Author: schyrio
+## Notes: My Autologger
+
+Logging.lua