Skip to content

Commit

Permalink
Actually really probably maybe fixed artifact module getting randomly…
Browse files Browse the repository at this point in the history
… disabled
  • Loading branch information
Sonaza committed Oct 1, 2019
1 parent 70efb83 commit bf24c07
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion Experiencer.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
32 changes: 27 additions & 5 deletions modules/artifact.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand Down

0 comments on commit bf24c07

Please sign in to comment.