Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonaza committed Aug 30, 2016
2 parents 688e750 + 31fe847 commit 6f8c198
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 22 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## 2.0.7
* Fixed chat message error with artifact weapons.
* Fixed flashing bar with artifact weapon level up.
* Added information about total artifact power and unspent points for the artifact bar.
* Fixed animating bar sometimes scrolling about even when it wasn't supposed to.

## 2.0.6
* Changed bar updates to be buffered to make several consequential gains update properly.
* Made animations even nicer.
* Fixed percentage showing remaining number instead of current value when using current & max value text mode.
* Fixed text not updating when resetting experience session.

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 and Advanced Experience and Reputation Progress Bar
## Author: Sonaza
## Version: 2.0.6
## Version: 2.0.7
## OptionalDeps: Ace3
## SavedVariables: ExperiencerDB, ExperiencerDB_module_experience, ExperiencerDB_module_reputation, ExperiencerDB_module_artifact, ExperiencerDB_module_honor

Expand Down
23 changes: 17 additions & 6 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ function Addon:StopAnimation()
end
end

Addon.BufferModuleChanged = false;
Addon.HasModuleChanged = false;

function Addon:TriggerBufferedUpdate(instant)
local module = Addon:GetActiveModule();
Expand All @@ -305,7 +305,7 @@ function Addon:TriggerBufferedUpdate(instant)
local isLoss = false;
local changeCurrent = data.current;

if(Addon.PreviousData and not Addon.BufferModuleChanged) then
if(Addon.PreviousData and not Addon.HasModuleChanged) then
if(data.level == Addon.PreviousData.level and data.current < Addon.PreviousData.current) then
isLoss = true;
changeCurrent = Addon.PreviousData.current;
Expand All @@ -331,7 +331,7 @@ function Addon:TriggerBufferedUpdate(instant)

Addon:SetAnimationSpeed(1.0);

if(valueHasChanged) then
if(valueHasChanged and not Addon.HasModuleChanged) then
if(Addon.PreviousData and not isLoss) then
local current = data.current;
local previous = Addon.PreviousData.current;
Expand All @@ -356,7 +356,7 @@ function Addon:TriggerBufferedUpdate(instant)
ExperiencerFrameBars.main:ProcessChangesInstantly();
end

if(not instant and valueHasChanged) then
if(not instant and valueHasChanged and not Addon.HasModuleChanged) then
if(not isLoss) then
ExperiencerFrameBars.change.fadegain_in:Stop();
ExperiencerFrameBars.change.fadegain_out:Stop();
Expand Down Expand Up @@ -420,6 +420,11 @@ function Addon:UpdateBars(instant)
ExperiencerFrameBars.change:SetValue(changeCurrent);
end

if(Addon.HasModuleChanged) then
Addon.ChangeTarget = changeCurrent;
ExperiencerFrameBars.change:SetValue(Addon.ChangeTarget);
end

if(data.rested and data.rested > 0) then
ExperiencerFrameBars.rested:Show();
ExperiencerFrameBars.rested:SetMinMaxValues(data.min, data.max);
Expand Down Expand Up @@ -906,12 +911,18 @@ function Experiencer_OnUpdate(self, elapsed)
if(Addon.db.global.FlashLevelUp) then
local module = Addon:GetActiveModule();
if(module.levelUpRequiresAction) then
if(progress >= 1 and not ExperiencerFrameBars.highlight:IsVisible()) then
local canLevelUp = module:CanLevelUp();
ExperiencerFrameBars.highlight:SetMinMaxValues(minvalue, maxvalue);
ExperiencerFrameBars.highlight:SetValue(current);

if(canLevelUp and not ExperiencerFrameBars.highlight:IsVisible()) then
ExperiencerFrameBars.highlight.fadein:Play();
elseif(progress < 1 and ExperiencerFrameBars.highlight:IsVisible()) then
elseif(not canLevelUp and ExperiencerFrameBars.highlight:IsVisible()) then
ExperiencerFrameBars.highlight.flash:Stop();
ExperiencerFrameBars.highlight.fadeout:Play();
end
else
ExperiencerFrameBars.highlight:Hide();
end
end
end
Expand Down
61 changes: 51 additions & 10 deletions modules/artifact.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ local module = Addon:RegisterModule("artifact", {
global = {
ShowArtifactName = true,
ShowRemaining = true,
ShowUnspentPoints = true,
ShowTotalArtifactPower = false,
},
},
});
Expand All @@ -33,6 +35,12 @@ function module:Update(elapsed)

end

function module:CanLevelUp()
local _, _, _, _, totalXP, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo();
local numPoints = MainMenuBar_GetNumArtifactTraitsPurchasableFromXP(pointsSpent, totalXP);
return numPoints > 0;
end

function module:HasCompletedArtifactIntro()
local quests = {
40408, -- Paladin
Expand Down Expand Up @@ -87,34 +95,55 @@ function module:GetText()
);
end

if(artifactXP >= xpForNextPoint) then
if(self.db.global.ShowTotalArtifactPower) then
tinsert(outputText,
"|cff86ff3Ready to spend a point!|r"
("%s |cffffdd00total artifact power|r"):format(BreakUpLargeNumbers(totalXP))
);
end

if(self.db.global.ShowUnspentPoints and numPoints > 0) then
tinsert(outputText,
("|cff86ff33%d unspent point%s|r"):format(numPoints, numPoints == 1 and "" or "s")
);
end

return table.concat(outputText, " ");
end

function module:HasChatMessage()
return not HasArtifactEquipped(), "No artifact equipped.";
return HasArtifactEquipped(), "No artifact equipped.";
end

function module:GetChatMessage()
local outputText = {};

local itemID, altItemID, name, icon, totalXP, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo();
local numPoints, artifactXP, xpForNextPoint = MainMenuBar_GetNumArtifactTraitsPurchasableFromXP(pointsSpent, totalXP);

local remaining = xpForNextPoint - artifactXP;
local progress = artifactXP / (xpForNextPoint > 0 and xpForNextPoint or 1);

return ("%s is currently level %s at %s/%s power (%d%%) with %d%% to go."):format(
tinsert(outputText, ("%s is currently rank %s"):format(
name,
pointsSpent,
BreakUpLargeNumbers(artifactXP),
BreakUpLargeNumbers(xpForNextPoint),
math.ceil(progress * 100),
math.ceil((1-progress) * 100)
);
pointsSpent
));

if(pointsSpent > 0) then
tinsert(outputText, ("at %s/%s power (%.1f%%) with %.1f%% to go"):format(
BreakUpLargeNumbers(artifactXP),
BreakUpLargeNumbers(xpForNextPoint),
progress * 100,
(1-progress) * 100
));

if(numPoints > 0) then
tinsert(outputText,
("(%d unspent point%s)"):format(numPoints, numPoints == 1 and "" or "s")
);
end
end

return table.concat(outputText, " ");
end

function module:GetBarData()
Expand Down Expand Up @@ -164,6 +193,18 @@ function module:GetOptionsMenu()
checked = function() return self.db.global.ShowArtifactName; end,
isNotRadio = true,
},
{
text = "Show total artifact power",
func = function() self.db.global.ShowTotalArtifactPower = not self.db.global.ShowTotalArtifactPower; module:RefreshText(); end,
checked = function() return self.db.global.ShowTotalArtifactPower; end,
isNotRadio = true,
},
{
text = "Show unspent points",
func = function() self.db.global.ShowUnspentPoints = not self.db.global.ShowUnspentPoints; module:RefreshText(); end,
checked = function() return self.db.global.ShowUnspentPoints; end,
isNotRadio = true,
},
};

return menudata;
Expand Down
12 changes: 7 additions & 5 deletions modules/honor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ local module = Addon:RegisterModule("honor", {
},
});

module.levelUpRequiresAction = true;

local HONOR_UNLOCK_LEVEL = 110;

function module:Initialize()
Expand All @@ -31,11 +33,11 @@ function module:IsDisabled()
end

function module:Update(elapsed)
if(not CanPrestige()) then
module.levelUpRequiresAction = false;
else
module.levelUpRequiresAction = true;
end

end

function module:CanLevelUp()
return CanPrestige();
end

function module:GetText()
Expand Down

0 comments on commit 6f8c198

Please sign in to comment.