Skip to content

Commit

Permalink
Fixed yesterday's fix that broke everything
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonaza committed Aug 24, 2018
1 parent 966c5df commit 7606bbc
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 28 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.0.3
* Fixed yesterday's fix that broke everything.

## 3.0.2
* Fixed update issues with reputation bar while auto watch is enabled.

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.0.1
## Version: 3.0.3
## OptionalDeps: Ace3
## SavedVariables: ExperiencerDB, ExperiencerDB_module_experience, ExperiencerDB_module_reputation, ExperiencerDB_module_artifact, ExperiencerDB_module_honor, ExperiencerDB_module_conquest

Expand Down
2 changes: 1 addition & 1 deletion core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ function ExperiencerModuleBarsMixin:OnUpdate(elapsed)

if(self.hasBuffer) then
self.bufferTimeout = self.bufferTimeout - elapsed;
if(self.bufferTimeout <= 0.0 and not self.module:AllowedToBufferUpdate()) then
if(self.bufferTimeout <= 0.0 and self.module:AllowedToBufferUpdate()) then
self:TriggerBufferedUpdate();
self.hasBuffer = false;
end
Expand Down
54 changes: 28 additions & 26 deletions modules/reputation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function module:Initialize()
end

module.AutoWatchRecent = {};
module.AutoWatchUpdate = 0;
module.AutoWatchRecentTimeout = 0;
end

Expand Down Expand Up @@ -631,6 +632,7 @@ function module:UPDATE_FACTION(event, ...)
local instant = false;
if(name ~= module.Tracked or not name) then
instant = true;
module.AutoWatchUpdate = 0;
end
module.Tracked = name;

Expand Down Expand Up @@ -663,26 +665,30 @@ function module:CHAT_MSG_COMBAT_FACTION_CHANGE(event, message, ...)

module.recentReputations[reputation].amount = module.recentReputations[reputation].amount + amount;

if(self.db.global.AutoWatch.Enabled) then
local name = GetWatchedFactionInfo();
if(not self.db.global.AutoWatch.IgnoreGuild or not isGuild) then
module.AutoWatchUpdate = true;
module.AutoWatchRecentTimeout = 0.1;

if(not module.AutoWatchRecent[reputation]) then
module.AutoWatchRecent[reputation] = 0;
end
module.AutoWatchRecent[reputation] = module.AutoWatchRecent[reputation] + amount;
if(self.db.global.AutoWatch.Enabled and module.AutoWatchUpdate ~= 2) then
local factionListIndex, factionID = module:GetReputationID(reputation);
if(not factionListIndex) then return end

if(self.db.global.AutoWatch.IgnoreInactive and IsFactionInactive(factionListIndex)) then return end
if(self.db.global.AutoWatch.IgnoreBodyguard and BODYGUARD_FACTIONS[factionID] ~= nil) then return end
if(self.db.global.AutoWatch.IgnoreGuild and isGuild) then return end

module.AutoWatchUpdate = 1;
module.AutoWatchRecentTimeout = 0.1;

if(not module.AutoWatchRecent[reputation]) then
module.AutoWatchRecent[reputation] = 0;
end
module.AutoWatchRecent[reputation] = module.AutoWatchRecent[reputation] + amount;
end
end

function module:AllowedToBufferUpdate()
return not module.AutoWatchUpdate;
return module.AutoWatchUpdate == 0;
end

function module:Update(elapsed)
if (module.AutoWatchUpdate) then
if (module.AutoWatchUpdate == 1) then
if (module.AutoWatchRecentTimeout > 0.0) then
module.AutoWatchRecentTimeout = module.AutoWatchRecentTimeout - elapsed;
end
Expand All @@ -696,24 +702,20 @@ function module:Update(elapsed)
largestGain = gain;
end
end
if (selectedFaction) then
module:UpdateAutoWatch(selectedFaction);

local name = GetWatchedFactionInfo();
if (selectedFaction ~= name) then
local factionListIndex, factionID = module:GetReputationID(selectedFaction);
if(factionListIndex) then
SetWatchedFactionIndex(factionListIndex);
end
module.AutoWatchUpdate = 2;
else
module.AutoWatchUpdate = 0;
end

module.AutoWatchRecentTimeout = 0;
module.AutoWatchUpdate = false;
wipe(module.AutoWatchRecent);
end
end
end

function module:UpdateAutoWatch(reputation)
local factionListIndex, factionID = module:GetReputationID(reputation);
if(not factionListIndex) then return end

if(self.db.global.AutoWatch.IgnoreInactive and IsFactionInactive(factionListIndex)) then return end
if(self.db.global.AutoWatch.IgnoreBodyguard and BODYGUARD_FACTIONS[factionID] ~= nil) then return end

SetWatchedFactionIndex(factionListIndex);
end

0 comments on commit 7606bbc

Please sign in to comment.