diff --git a/CHANGELOG.md b/CHANGELOG.md index 5625869..a4fa93e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 3.1.3 +* Actually really probably maybe fixed the artifact module getting randomly disabled. + ## 3.1.2 * Fixed artifact module getting randomly disabled when changing zones. diff --git a/Experiencer.toc b/Experiencer.toc index 70cf39d..a38f045 100644 --- a/Experiencer.toc +++ b/Experiencer.toc @@ -2,7 +2,7 @@ ## Title: Experiencer ## Notes: Simple but advanced tracking progress bar addon ## Author: Sonaza -## Version: 3.1.2 +## Version: 3.1.3 ## OptionalDeps: Ace3 ## SavedVariables: ExperiencerDB, ExperiencerDB_module_experience, ExperiencerDB_module_reputation, ExperiencerDB_module_artifact, ExperiencerDB_module_honor, ExperiencerDB_module_conquest diff --git a/modules/artifact.lua b/modules/artifact.lua index 2dc9726..384516b 100644 --- a/modules/artifact.lua +++ b/modules/artifact.lua @@ -25,12 +25,37 @@ module.hasArtifact = true; function module:Initialize() self:RegisterEvent("AZERITE_ITEM_EXPERIENCE_CHANGED"); - self:RegisterEvent("UNIT_INVENTORY_CHANGED"); module.apInSession = 0; - module:UpdateHasArtifact(); + if (UnitLevel("player") < 110) then + self:RegisterEvent("PLAYER_LEVEL_UP"); + module.hasArtifact = false; + else + C_Timer.After(4, function() + self:RegisterEvent("UNIT_INVENTORY_CHANGED"); + module:UpdateHasArtifact(); + end); + end end +function module:PLAYER_LEVEL_UP(event, level) + if (level >= 110) then + self:RegisterEvent("UNIT_INVENTORY_CHANGED"); + self:RegisterEvent("QUEST_LOG_UPDATE"); + self:UnregisterEvent("PLAYER_LEVEL_UP"); + end +end + +local HEART_OF_AZEROTH_ITEM_ID = 158075; +local HEART_OF_AZEROTH_QUEST_ID = 51211; + +function module:QUEST_LOG_UPDATE(event) + if (C_QuestLog.IsQuestFlaggedCompleted(HEART_OF_AZEROTH_QUEST_ID)) then + module.hasArtifact = true; + self:UnregisterEvent("QUEST_LOG_UPDATE"); + end +end + function module:UNIT_INVENTORY_CHANGED(event, unit) if (unit ~= "player") then return end module:UpdateHasArtifact(); @@ -41,9 +66,6 @@ function module:IsDisabled() return not module.hasArtifact; end -local HEART_OF_AZEROTH_ITEM_ID = 158075; -local HEART_OF_AZEROTH_QUEST_ID = 51211; - function module:UpdateHasArtifact() local playerLevel = UnitLevel("player"); if (playerLevel < 110) then