diff --git a/core.lua b/core.lua
index 55d76dc..e15dbda 100644
--- a/core.lua
+++ b/core.lua
@@ -15,10 +15,10 @@ XIVBar.defaults = {
},
color = {
barColor = {
- r = 0.25,
- g = 0.25,
- b = 0.25,
- a = 1
+ r = 0.094,
+ g = 0.094,
+ b = 0.094,
+ a = 0.75
},
normal = {
r = 0.8,
@@ -245,12 +245,7 @@ function XIVBar:Refresh()
self.frames.bgTexture:SetAllPoints()
if self.db.profile.color.useCC then
- self.frames.bgTexture:SetColorTexture(
- RAID_CLASS_COLORS[self.constants.playerClass].r,
- RAID_CLASS_COLORS[self.constants.playerClass].g,
- RAID_CLASS_COLORS[self.constants.playerClass].b,
- barColor.a
- )
+ self.frames.bgTexture:SetColorTexture(self:GetClassColors())
else
self.frames.bgTexture:SetColorTexture(barColor.r, barColor.g, barColor.b, barColor.a)
end
@@ -261,6 +256,10 @@ function XIVBar:Refresh()
end
end
+function XIVBar:GetClassColors()
+ return RAID_CLASS_COLORS[self.constants.playerClass].r, RAID_CLASS_COLORS[self.constants.playerClass].g, RAID_CLASS_COLORS[self.constants.playerClass].b, self.db.profile.color.barColor.a
+end
+
function XIVBar:RGBAToHex(r, g, b, a)
a = a or 1
r = r <= 1 and r >= 0 and r or 0
diff --git a/locales/enUS.lua b/locales/enUS.lua
index 31e2bea..4077283 100644
--- a/locales/enUS.lua
+++ b/locales/enUS.lua
@@ -75,6 +75,7 @@ L['Total'] = true;
L['Currency'] = true;
L['Show XP Bar Below Max Level'] = true;
+L['Use Class Colors for XP Bar'] = true;
L['Show Tooltips'] = true;
L['Text on Right'] = true;
L['Toggle Currency Frame'] = true;
diff --git a/modules/currency.lua b/modules/currency.lua
index 5dc80a9..2dd4f2b 100644
--- a/modules/currency.lua
+++ b/modules/currency.lua
@@ -32,7 +32,7 @@ end
function CurrencyModule:OnEnable()
if self.currencyFrame == nil then
- self.currencyFrame = CreateFrame("FRAME", nil, xb:GetFrame('goldFrame'))
+ self.currencyFrame = CreateFrame("FRAME", 'XIV_currencyFrame', xb:GetFrame('goldFrame'))
xb:RegisterFrame('currencyFrame', self.currencyFrame)
end
@@ -44,6 +44,8 @@ end
function CurrencyModule:OnDisable()
self.currencyFrame:Hide()
self:UnregisterEvent('CURRENCY_DISPLAY_UPDATE')
+ self:UnregisterEvent('PLAYER_XP_UPDATE')
+ self:UnregisterEvent('PLAYER_LEVEL_UP')
end
function CurrencyModule:Refresh()
@@ -55,8 +57,40 @@ function CurrencyModule:Refresh()
for i = 1, 3 do
self.curButtons[i]:Hide()
end
+ self.xpFrame:Hide()
if xb.constants.playerLevel < MAX_PLAYER_LEVEL and db.modules.currency.showXPbar then
+ --self.xpFrame = self.xpFrame or CreateFrame("BUTTON", nil, self.currencyFrame)
+
+ local textHeight = floor((xb:GetHeight() - 4) / 2)
+ self.xpIcon:SetTexture(xb.constants.mediaPath..'datatexts\\exp')
+ self.xpIcon:SetSize(iconSize, iconSize)
+ self.xpIcon:SetPoint('LEFT')
+ self.xpIcon:SetVertexColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+
+ self.xpText:SetFont(xb.LSM:Fetch(xb.LSM.MediaType.FONT, db.text.font), textHeight)
+ self.xpText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ self.xpText:SetText(string.upper(LEVEL..' '..tostring(xb.constants.playerLevel)..' '..UnitClass('player')))
+ self.xpText:SetPoint('TOPLEFT', self.xpIcon, 'TOPRIGHT', 5, 0)
+
+ self.xpBar:SetStatusBarTexture(1, 1, 1)
+ if db.modules.currency.xpBarCC then
+ self.xpBar:SetStatusBarColor(xb:GetClassColors())
+ else
+ self.xpBar:SetStatusBarColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+ end
+ self.xpBar:SetMinMaxValues(0, UnitXPMax('player'))
+ self.xpBar:SetValue(UnitXP('player'))
+ self.xpBar:SetSize(self.xpText:GetStringWidth(), (iconSize - textHeight - 2))
+ self.xpBar:SetPoint('BOTTOMLEFT', self.xpIcon, 'BOTTOMRIGHT', 5, 0)
+
+ self.xpBarBg:SetAllPoints()
+ self.xpBarBg:SetColorTexture(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ --self.xpBar = self.xpBar or CreateFrame('STATUSBAR', nil, self.xpFrame)
+ --self.xpBarBg = self.xpBarBg or self.xpBar:CreateTexture(nil, 'BACKGROUND')
+ self.currencyFrame:SetSize(iconSize + self.xpText:GetStringWidth() + 5, xb:GetHeight())
+ self.xpFrame:SetAllPoints()
+ self.xpFrame:Show()
else -- show xp bar/show currencies
local iconsWidth = 0
for i = 1, 3 do
@@ -154,7 +188,9 @@ function CurrencyModule:RegisterFrameEvents()
end)
end
self:RegisterEvent('CURRENCY_DISPLAY_UPDATE', 'Refresh')
- self:SecureHook('BackpackTokenFrame_Update', 'Refresh') -- Ugh, why is there no event for this?
+ self:RegisterEvent('PLAYER_XP_UPDATE', 'Refresh')
+ self:RegisterEvent('PLAYER_LEVEL_UP', 'Refresh')
+ --self:SecureHook('BackpackTokenFrame_Update', 'Refresh') -- Ugh, why is there no event for this?
self.currencyFrame:EnableMouse(true)
self.currencyFrame:SetScript('OnEnter', function()
@@ -167,6 +203,17 @@ function CurrencyModule:RegisterFrameEvents()
GameTooltip:Hide()
end
end)
+
+ self.xpFrame:SetScript('OnEnter', function()
+ if InCombatLockdown() then return; end
+ self.xpText:SetTextColor(unpack(xb:HoverColors()))
+ end)
+
+ self.xpFrame:SetScript('OnLeave', function()
+ if InCombatLockdown() then return; end
+ local db = xb.db.profile
+ self.xpText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ end)
--[[
self.goldButton:EnableMouse(true)
self.goldButton:RegisterForClicks("AnyUp")
@@ -206,6 +253,7 @@ function CurrencyModule:RegisterFrameEvents()
end
function CurrencyModule:ShowTooltip()
+ if xb.constants.playerLevel < MAX_PLAYER_LEVEL and xb.db.profile.modules.currency.showXPbar then return; end
GameTooltip:SetOwner(self.currencyFrame, 'ANCHOR_'..xb.miniTextPosition)
GameTooltip:AddLine("[|cff6699FF"..L['Currency'].."|r]")
GameTooltip:AddLine(" ")
@@ -245,6 +293,7 @@ function CurrencyModule:GetDefaultOptions()
return 'currency', {
enabled = true,
showXPbar = true,
+ xpBarCC = false,
showTooltip = true,
textOnRight = true,
currencyOne = '0',
@@ -271,19 +320,26 @@ function CurrencyModule:GetConfig()
order = 1,
type = "toggle",
get = function() return xb.db.profile.modules.currency.showXPbar; end,
- set = function(_, val) xb.db.profile.modules.currency.showXPbar = val; self:Refresh(); end,
- width = "full"
+ set = function(_, val) xb.db.profile.modules.currency.showXPbar = val; self:Refresh(); end
+ },
+ xpBarCC = {
+ name = L['Use Class Colors for XP Bar'],
+ order = 2,
+ type = "toggle",
+ get = function() return xb.db.profile.modules.currency.xpBarCC; end,
+ set = function(_, val) xb.db.profile.modules.currency.xpBarCC = val; self:Refresh(); end,
+ disabled = function() return not xb.db.profile.modules.currency.showXPbar end
},
showTooltip = {
name = L['Show Tooltips'],
- order = 2,
+ order = 3,
type = "toggle",
get = function() return xb.db.profile.modules.currency.showTooltip; end,
set = function(_, val) xb.db.profile.modules.currency.showTooltip = val; self:Refresh(); end
},
textOnRight = {
name = L['Text on Right'],
- order = 3,
+ order = 4,
type = "toggle",
get = function() return xb.db.profile.modules.currency.textOnRight; end,
set = function(_, val) xb.db.profile.modules.currency.textOnRight = val; self:Refresh(); end
@@ -291,8 +347,9 @@ function CurrencyModule:GetConfig()
currency = {
type = 'group',
name = L['Currency Select'],
- order = 4,
+ order = 5,
inline = true,
+ --disabled = function() return (xb.constants.playerLevel < MAX_PLAYER_LEVEL and xb.db.profile.modules.currency.showXPbar); end, -- keep around in case
args = {
currencyOne = {
name = L['First Currency'], -- DROPDOWN, GoldModule:GetCurrencyOptions