diff --git a/FiveSecondRule.lua b/FiveSecondRule.lua index 21393df..a4e75e5 100755 --- a/FiveSecondRule.lua +++ b/FiveSecondRule.lua @@ -40,12 +40,19 @@ do -- Private Scope FiveSecondRule:RegisterEvent("PLAYER_UNGHOST") FiveSecondRule:SetScript("OnEvent", function(self, event, arg1, ...) onEvent(self, event, arg1, ...) end); - FiveSecondRule:SetScript("OnUpdate", function(self, sinceLastUpdate) onUpdate(sinceLastUpdate); end); -- INITIALIZATION function Init() LoadOptions() + if (select(2, UnitClass("player")) == "WARRIOR") then + -- Disable the addon for warriors, since there is no reliable power or life to track in order to show power ticks. + DisableAddon() + return + else + EnableAddon() + end + TickBar:LoadSpells() -- LOCALIZATION FiveSecondRule:Refresh() end @@ -56,10 +63,14 @@ do -- Private Scope end function DisableAddon() + StatusBar.statusbar:Hide() + TickBar.tickbar:Hide() FiveSecondRule:SetScript("OnUpdate", nil) - DisableAddOn(ADDON_NAME) end - + + function EnableAddon() + FiveSecondRule:SetScript("OnUpdate", function(self, sinceLastUpdate) onUpdate(sinceLastUpdate); end); + end function LoadOptions() FiveSecondRule_Options = FiveSecondRule_Options or AddonUtils:deepcopy(defaults) @@ -79,25 +90,22 @@ do -- Private Scope end function onEvent(self, event, arg1, ...) - if (select(2, UnitClass("player")) == "WARRIOR") then - -- Disable the addon for warriors, since there is no reliable power or life to track in order to show power ticks. - print("FiveSecondRule addon has been disabled!") - DisableAddon() - return - end - if event == "ADDON_LOADED" then if arg1 == ADDON_NAME then Init() end end + if not FiveSecondRule_Options.enabled then + return + end + if event == "PLAYER_ENTERING_WORLD" then savePlayerPower() end - if not FiveSecondRule_Options.enabled then - return + if event == "PLAYER_EQUIPMENT_CHANGED" then + savePlayerPower() end if event == "UNIT_SPELLCAST_SUCCEEDED" then @@ -117,10 +125,6 @@ do -- Private Scope end end end - - if event == "PLAYER_EQUIPMENT_CHANGED" then - savePlayerPower() - end end function onUpdate(sinceLastUpdate) diff --git a/FiveSecondRule.toc b/FiveSecondRule.toc index a18c2b4..7e33471 100755 --- a/FiveSecondRule.toc +++ b/FiveSecondRule.toc @@ -1,7 +1,7 @@ ## Interface: 30403 ## Title: Five Second Rule ## Notes: Track the "5-second-rule" (5SR or FSR) which refers to the cooldown of five seconds after spending mana before spirit-based regen resumes. -## Version: 1.37 +## Version: 1.38 ## DefaultState: enabled ## Author: CassiniEU @ Twitch.com ## SavedVariablesPerCharacter: FiveSecondRule_Options diff --git a/FiveSecondRule.zip b/FiveSecondRule.zip new file mode 100644 index 0000000..de2101a Binary files /dev/null and b/FiveSecondRule.zip differ diff --git a/FiveSecondRule_Classic.toc b/FiveSecondRule_Classic.toc index 666ab3d..43b0e43 100755 --- a/FiveSecondRule_Classic.toc +++ b/FiveSecondRule_Classic.toc @@ -1,7 +1,7 @@ ## Interface: 11500 ## Title: Five Second Rule ## Notes: Track the "5-second-rule" (5SR or FSR) which refers to the cooldown of five seconds after spending mana before spirit-based regen resumes. -## Version: 1.37 +## Version: 1.38 ## DefaultState: enabled ## Author: CassiniEU @ Twitch.com ## SavedVariablesPerCharacter: FiveSecondRule_Options