Revert "Revert "Show current quest XP on xp bar (#17)""

This reverts commit b37859db92.
This commit is contained in:
Andrew6810
2022-12-14 10:58:37 -07:00
parent b37859db92
commit 6313d7afbe
4 changed files with 429 additions and 190 deletions
+40 -19
View File
@@ -1,13 +1,10 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule("DataBars")
--Lua functions
--WoW API / Variables
local GetExpansionLevel = GetExpansionLevel
local MAX_PLAYER_LEVEL_TABLE = MAX_PLAYER_LEVEL_TABLE
function mod:OnLeave()
if (self == ElvUI_ExperienceBar and mod.db.experience.mouseover) or (self == ElvUI_ReputationBar and mod.db.reputation.mouseover) then
function mod.OnLeave(self)
if (self == ElvUI_ExperienceBar and mod.db.experience.mouseover)
or (self == ElvUI_ReputationBar and mod.db.reputation.mouseover)
then
E:UIFrameFadeOut(self, 1, self:GetAlpha(), 0)
end
GameTooltip:Hide()
@@ -33,27 +30,51 @@ function mod:CreateBar(name, onEnter, onClick, ...)
return bar
end
function mod:CreateBarBubbles(bar)
local bubbles = CreateFrame("Frame", "$parent_Bubbles", bar)
bubbles:SetAllPoints()
bubbles.textures = {}
function mod:UpdateDataBarDimensions()
self:UpdateExperienceDimensions()
self:UpdateReputationDimensions()
for i = 1, 19 do
bubbles.textures[i] = bubbles:CreateTexture(nil, "OVERLAY")
bubbles.textures[i]:SetTexture(0, 0, 0, 1)
end
bar.bubbles = bubbles
return bubbles
end
function mod:PLAYER_LEVEL_UP(level)
local maxLevel = MAX_PLAYER_LEVEL_TABLE[GetExpansionLevel()]
if (level ~= maxLevel or not self.db.experience.hideAtMaxLevel) and self.db.experience.enable then
self:UpdateExperience("PLAYER_LEVEL_UP", level)
function mod:UpdateBarBubbles(bar, db)
if db.showBubbles then
local vertical = db.orientation ~= "HORIZONTAL"
local width = vertical and db.width or 1
local height = not vertical and db.height or 1
local offset = (vertical and db.height or db.width) / 20
for i, texture in ipairs(bar.bubbles.textures) do
texture:Size(width, height)
texture:Point("TOPLEFT", bar, "TOPLEFT", vertical and 0 or offset * i, vertical and -offset * i or 0)
texture:Show()
end
else
self.expBar:Hide()
for _, texture in ipairs(bar.bubbles.textures) do
texture:Hide()
end
end
end
function mod:UpdateDataBarDimensions()
self:ExperienceBar_UpdateDimensions()
self:ReputationBar_UpdateDimensions()
end
function mod:Initialize()
self.db = E.db.databars
self:LoadExperienceBar()
self:LoadReputationBar()
self:RegisterEvent("PLAYER_LEVEL_UP")
self.maxExpansionLevel = MAX_PLAYER_LEVEL_TABLE[GetAccountExpansionLevel()]
self:ExperienceBar_Load()
self:ReputationBar_Load()
end
local function InitializeCallback()