Skip to content

Commit

Permalink
Stop logging when exiting desired map IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudbells committed Apr 16, 2021
1 parent 30d165b commit c094e44
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions AutoLoggerClassic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local Y_SPACING = -25
local BUTTONS_PER_ROW = 3

-- Variables.
local hasInitialized = false -- true if init has been called.
local minimapIcon = LibStub("LibDBIcon-1.0")
local buttons = {}
local classicRaids = {
Expand Down Expand Up @@ -138,9 +139,6 @@ end
-- Called when player clicks a checkbutton.
function AutoLoggerClassicCheckButton_OnClick(self)
ALCOptions.instances[self.instance] = not ALCOptions.instances[self.instance]
for k, v in pairs(ALCOptions.instances) do
print(k, v)
end
toggleLogging()
end

Expand All @@ -157,7 +155,7 @@ function AutoLoggerClassic_OnEvent(self, event, ...)
if event == "ADDON_LOADED" and ... == "AutoLoggerClassic" then
ALCOptions = ALCOptions or {}
ALCOptions.minimapTable = ALCOptions.minimapTable or {}
if not ALCOptions.instances then
if not ALCOptions.instances or ALCOptions.instances[532] == nil then -- Check for 532 because if player had addon already all TBC raids will be off by default.
ALCOptions.instances = {
-- Classic raids:
[249] = true, -- Onyxia's Lair
Expand All @@ -183,9 +181,11 @@ function AutoLoggerClassic_OnEvent(self, event, ...)
elseif event == "RAID_INSTANCE_WELCOME" then
toggleLogging()
elseif event == "PLAYER_ENTERING_WORLD" then
init()
AutoLoggerClassicFrame:Hide()
if not hasInitialized then
init()
AutoLoggerClassicFrame:Hide()
hasInitialized = true
end
toggleLogging()
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
end
end

0 comments on commit c094e44

Please sign in to comment.