diff --git a/embeds.xml b/embeds.xml
index 61b51c8..14c0d68 100644
--- a/embeds.xml
+++ b/embeds.xml
@@ -3,6 +3,7 @@
<Include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
<Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml"/>
<Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/>
+ <Include file="Libs\AceHook-3.0\AceHook-3.0.xml"/>
<Include file="Libs\AceDB-3.0\AceDB-3.0.xml"/>
<Include file="Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml"/>
<Include file="Libs\AceLocale-3.0\AceLocale-3.0.xml"/>
diff --git a/locales/enUS.lua b/locales/enUS.lua
index b570894..31e2bea 100644
--- a/locales/enUS.lua
+++ b/locales/enUS.lua
@@ -77,3 +77,8 @@ L['Currency'] = true;
L['Show XP Bar Below Max Level'] = true;
L['Show Tooltips'] = true;
L['Text on Right'] = true;
+L['Toggle Currency Frame'] = true;
+L['Currency Select'] = true;
+L['First Currency'] = true;
+L['Second Currency'] = true;
+L['Third Currency'] = true;
diff --git a/modules/currency.lua b/modules/currency.lua
index 13bbc53..5dc80a9 100644
--- a/modules/currency.lua
+++ b/modules/currency.lua
@@ -1,321 +1,328 @@
-local addon, ns = ...
-local cfg = ns.cfg
-local unpack = unpack
---------------------------------------------------------------
-if not cfg.currency.show then return end
-
-local iconPos = "RIGHT"
-local textPos = "LEFT"
-
-if cfg.currency.textOnRight then
- iconPos = "LEFT"
- textPos = "RIGHT"
+local AddOnName, XIVBar = ...;
+local _G = _G;
+local xb = XIVBar;
+local L = XIVBar.L;
+
+local CurrencyModule = xb:NewModule("CurrencyModule", 'AceEvent-3.0', 'AceHook-3.0')
+
+function CurrencyModule:GetName()
+ return L['Currency'];
+end
+
+function CurrencyModule:OnInitialize()
+ self.rerollItems = {
+ 697, -- Elder Charm of Good Fortune
+ 752, -- Mogu Rune of Fate
+ 776, -- Warforged Seal
+ 994, -- Seal of Tempered Fate
+ 1129, -- Seal of Inevitable Fate
+ 1273, -- Seal of Broken Fate
+ }
+
+ self.intToOpt = {
+ [1] = 'currencyOne',
+ [2] = 'currencyTwo',
+ [3] = 'currencyThree'
+ }
+
+ self.curButtons = {}
+ self.curIcons = {}
+ self.curText = {}
+end
+
+function CurrencyModule:OnEnable()
+ if self.currencyFrame == nil then
+ self.currencyFrame = CreateFrame("FRAME", nil, xb:GetFrame('goldFrame'))
+ xb:RegisterFrame('currencyFrame', self.currencyFrame)
+ end
+
+ self:CreateFrames()
+ self:RegisterFrameEvents()
+ self:Refresh()
+end
+
+function CurrencyModule:OnDisable()
+ self.currencyFrame:Hide()
+ self:UnregisterEvent('CURRENCY_DISPLAY_UPDATE')
+end
+
+function CurrencyModule:Refresh()
+ local db = xb.db.profile
+ if self.currencyFrame == nil then return; end
+ if not db.modules.currency.enabled then return; end
+
+ local iconSize = db.text.fontSize + db.general.barPadding
+ for i = 1, 3 do
+ self.curButtons[i]:Hide()
+ end
+
+ if xb.constants.playerLevel < MAX_PLAYER_LEVEL and db.modules.currency.showXPbar then
+ else -- show xp bar/show currencies
+ local iconsWidth = 0
+ for i = 1, 3 do
+ if db.modules.currency[self.intToOpt[i]] ~= '0' then
+ iconsWidth = iconsWidth + self:StyleCurrencyFrame(tonumber(db.modules.currency[self.intToOpt[i]]), i)
+ end
+ end
+ self.curButtons[1]:SetPoint('LEFT')
+ self.curButtons[2]:SetPoint('LEFT', self.curButtons[1], 'RIGHT', 5, 0)
+ self.curButtons[3]:SetPoint('LEFT', self.curButtons[2], 'RIGHT', 5, 0)
+ self.currencyFrame:SetSize(iconsWidth, xb:GetHeight())
+ end -- show currencies
+
+ --self.currencyFrame:SetSize(self.goldButton:GetSize())
+ self.currencyFrame:SetPoint('RIGHT', self.currencyFrame:GetParent(), 'LEFT', -(db.general.moduleSpacing), 0)
end
-local currencyFrame = CreateFrame("Frame",nil, cfg.SXframe)
-currencyFrame:SetPoint("LEFT", cfg.SXframe, "CENTER", 340,0)
-currencyFrame:SetSize(16, 16)
-
----------------------------------------------
--- XP BAR
----------------------------------------------
-local xpFrame = CreateFrame("BUTTON",nil, cfg.SXframe)
-xpFrame:SetPoint("LEFT", cfg.SXframe, "CENTER", 350,0)
-xpFrame:SetSize(16, 16)
-xpFrame:EnableMouse(true)
-xpFrame:RegisterForClicks("AnyUp")
-
-local xpIcon = xpFrame:CreateTexture(nil,"OVERLAY",nil,7)
-xpIcon:SetSize(16, 16)
-xpIcon:SetPoint("LEFT")
-xpIcon:SetTexture(cfg.mediaFolder.."datatexts\\exp")
-xpIcon:SetVertexColor(unpack(cfg.color.normal))
-
-local xpText = xpFrame:CreateFontString(nil, "OVERLAY")
-xpText:SetFont(cfg.text.font, cfg.text.normalFontSize)
-xpText:SetPoint("RIGHT",xpFrame,2,0 )
-xpText:SetTextColor(unpack(cfg.color.normal))
-
-local xpStatusbar = CreateFrame("StatusBar", nil, xpFrame)
-xpStatusbar:SetStatusBarTexture(1,1,1)
-xpStatusbar:SetStatusBarColor(unpack(cfg.color.normal))
-xpStatusbar:SetPoint("TOPLEFT", xpText, "BOTTOMLEFT",0,-2)
-
-local xpStatusbarBG = xpStatusbar:CreateTexture(nil,"BACKGROUND",nil,7)
-xpStatusbarBG:SetPoint("TOPLEFT", xpText, "BOTTOMLEFT",0,-2)
-xpStatusbarBG:SetColorTexture(unpack(cfg.color.inactive))
-
-xpFrame:SetScript("OnEnter", function()
- if InCombatLockdown() then return end
- xpIcon:SetVertexColor(unpack(cfg.color.hover))
- xpStatusbar:SetStatusBarColor(unpack(cfg.color.hover))
- if not cfg.currency.showTooltip then return end
- local mxp = UnitXPMax("player")
- local xp = UnitXP("player")
- local nxp = mxp - xp
- local rxp = GetXPExhaustion()
- local name, standing, minrep, maxrep, value = GetWatchedFactionInfo()
-
- if cfg.core.position ~= "BOTTOM" then
- GameTooltip:SetOwner(xpStatusbar, cfg.tooltipPos)
- else
- GameTooltip:SetOwner(xpFrame, cfg.tooltipPos)
- end
-
- GameTooltip:AddLine("[|cff6699FFExperience Bar|r]")
- GameTooltip:AddLine(" ")
- GameTooltip:AddDoubleLine(COMBAT_XP_GAIN, format(cfg.SVal(xp)).."|cffffd100/|r"..format(cfg.SVal(mxp)).." |cffffd100/|r "..floor((xp/mxp)*1000)/10 .."%",NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b,1,1,1)
- GameTooltip:AddDoubleLine(NEED, format(cfg.SVal(nxp)).." |cffffd100/|r "..floor((nxp/mxp)*1000)/10 .."%",NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b,1,1,1)
- if rxp then
- GameTooltip:AddDoubleLine(TUTORIAL_TITLE26, format(cfg.SVal(rxp)) .." |cffffd100/|r ".. floor((rxp/mxp)*1000)/10 .."%", NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b,1,1,1)
- end
- GameTooltip:Show()
-end)
-
-xpFrame:SetScript("OnLeave", function()
- xpIcon:SetVertexColor(unpack(cfg.color.normal))
- xpStatusbar:SetStatusBarColor(unpack(cfg.color.normal))
- if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end
-end)
-
----------------------------------------------
--- REROLL
----------------------------------------------
-local rerollFrame = CreateFrame("BUTTON",nil, currencyFrame)
-rerollFrame:SetPoint("LEFT")
-rerollFrame:SetSize(16, 16)
-rerollFrame:EnableMouse(true)
-rerollFrame:RegisterForClicks("AnyUp")
-
-local rerollIcon = rerollFrame:CreateTexture(nil,"OVERLAY",nil,7)
-rerollIcon:SetSize(16, 16)
-rerollIcon:SetPoint(iconPos)
-rerollIcon:SetTexture(cfg.mediaFolder.."datatexts\\reroll")
-rerollIcon:SetVertexColor(unpack(cfg.color.inactive))
-
-local rerollText = rerollFrame:CreateFontString(nil, "OVERLAY")
-rerollText:SetFont(cfg.text.font, cfg.text.normalFontSize)
---rerollText:SetPoint(iconPos,rerollIcon,textPos,-2,0)
-rerollText:SetPoint(textPos)
-rerollText:SetTextColor(unpack(cfg.color.inactive))
-
-rerollFrame:SetScript("OnEnter", function()
- if InCombatLockdown() then return end
- rerollIcon:SetVertexColor(unpack(cfg.color.hover))
- if not cfg.currency.showTooltip then return end
- GameTooltip:SetOwner(currencyFrame, cfg.tooltipPos)
- GameTooltip:AddLine("[|cff6699FFReroll|r]")
- GameTooltip:AddLine(" ")
- local SoIFname, SoIFamount, SoIFicon, SoIFearnedThisWeek, SoIFweeklyMax, SoIFtotalMax, SoIFisDiscovered = GetCurrencyInfo(1129)
- if SoIFamount > 0 then
- GameTooltip:AddLine(SoIFname,1,1,0)
- GameTooltip:AddDoubleLine("|cffffff00Weekly: |cffffffff"..SoIFearnedThisWeek.."|cffffff00/|cffffffff"..SoIFweeklyMax, "|cffffff00Total: |cffffffff"..SoIFamount.."|cffffff00/|cffffffff"..SoIFtotalMax)
- else
- local SoTFname, SoTFamount, SoTFicon, SoTFearnedThisWeek, SoTFweeklyMax, SoTFtotalMax, SoTFisDiscovered = GetCurrencyInfo(994)
- if SoTFamount > 0 then
- GameTooltip:AddDoubleLine(SoTFname, "|cffffff00Total: |cffffffff"..SoTFamount.."|cffffff00/|cffffffff"..SoTFtotalMax)
- end
- end
- GameTooltip:Show()
-end)
-
-rerollFrame:SetScript("OnLeave", function()
- if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end
- rerollIcon:SetVertexColor(unpack(cfg.color.inactive))
-end)
-
-rerollFrame:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "LeftButton" then
- ToggleCharacter("TokenFrame")
- end
-end)
-
----------------------------------------------
--- HONOR
----------------------------------------------
-
-local honorFrame = CreateFrame("BUTTON",nil, currencyFrame)
-honorFrame:SetPoint("LEFT",rerollFrame,"RIGHT",2,0)
-honorFrame:SetSize(16, 16)
-honorFrame:EnableMouse(true)
-honorFrame:RegisterForClicks("AnyUp")
-
-local honorIcon = honorFrame:CreateTexture(nil,"OVERLAY",nil,7)
-honorIcon:SetSize(16, 16)
-honorIcon:SetPoint(iconPos)
-honorIcon:SetTexture(cfg.mediaFolder.."datatexts\\honor")
-honorIcon:SetVertexColor(unpack(cfg.color.inactive))
-
-local honorText = honorFrame:CreateFontString(nil, "OVERLAY")
-honorText:SetFont(cfg.text.font, cfg.text.normalFontSize)
-honorText:SetPoint(textPos)
-honorText:SetTextColor(unpack(cfg.color.inactive))
-
-honorFrame:SetScript("OnEnter", function()
- if InCombatLockdown() then return end
- honorIcon:SetVertexColor(unpack(cfg.color.hover))
- if not cfg.currency.showTooltip then return end
- GameTooltip:SetOwner(currencyFrame, cfg.tooltipPos)
- GameTooltip:AddLine("[|cff6699FFHonor Level:|r"..UnitHonorLevel("player").."]")
- GameTooltip:AddLine(" ")
- GameTooltip:AddDoubleLine(concName,"|cffffff00Honor: |cffffffff"..UnitHonor("player").."|cffffff00/|cffffffff"..UnitHonorMax("player"))
- GameTooltip:Show()
-end)
-
-honorFrame:SetScript("OnLeave", function()
- if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end
- honorIcon:SetVertexColor(unpack(cfg.color.inactive))
-end)
-
-honorFrame:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "LeftButton" then
- ToggleCharacter("TokenFrame")
- end
-end)
-
----------------------------------------------
--- GARRISON RECOURCES
----------------------------------------------
-
-local garrisonFrame = CreateFrame("BUTTON",nil, currencyFrame)
-garrisonFrame:SetPoint("LEFT",honorFrame,"RIGHT",2,0)
-garrisonFrame:SetSize(16, 16)
-garrisonFrame:EnableMouse(true)
-garrisonFrame:RegisterForClicks("AnyUp")
-
-local garrisonIcon = garrisonFrame:CreateTexture(nil,"OVERLAY",nil,7)
-garrisonIcon:SetSize(16, 16)
-garrisonIcon:SetPoint(iconPos)
-garrisonIcon:SetTexture(cfg.mediaFolder.."datatexts\\garres")
-garrisonIcon:SetVertexColor(unpack(cfg.color.inactive))
-
-local garrisonText = garrisonFrame:CreateFontString(nil, "OVERLAY")
-garrisonText:SetFont(cfg.text.font, cfg.text.normalFontSize)
-garrisonText:SetPoint(textPos)
-garrisonText:SetTextColor(unpack(cfg.color.inactive))
-
-garrisonFrame:SetScript("OnEnter", function()
- if InCombatLockdown() then return end
- garrisonIcon:SetVertexColor(unpack(cfg.color.hover))
- if not cfg.currency.showTooltip then return end
- GameTooltip:SetOwner(currencyFrame, cfg.tooltipPos)
- GameTooltip:AddLine("[|cff6699FFGarrison Recources|r]")
- GameTooltip:AddLine(" ")
- local grName, grAmount, _, _, _, grTotalMax = GetCurrencyInfo(824)
- local oilName, oilAmount, _, _, _, oilTotalMax, oilIsDiscovered = GetCurrencyInfo(1101)
- local apexisName, apexisAmount = GetCurrencyInfo(823)
- local DICName, DICAmount, _, _, _, DICTotalMax = GetCurrencyInfo(980)
-
- GameTooltip:AddDoubleLine(grName, "|cffffffff"..format(cfg.SVal(grAmount)).."|cffffff00/|cffffffff"..format(cfg.SVal(grTotalMax)))
- if oilIsDiscovered then
- GameTooltip:AddDoubleLine(oilName, "|cffffffff"..format(cfg.SVal(oilAmount)).."|cffffff00/|cffffffff"..format(cfg.SVal(oilTotalMax)))
- end
- GameTooltip:AddDoubleLine(apexisName, "|cffffffff"..format(cfg.SVal(apexisAmount)))
- if DICAmount > 0 then
- GameTooltip:AddDoubleLine(DICName, "|cffffffff"..format(cfg.SVal(DICAmount)).."|cffffff00/|cffffffff"..format(cfg.SVal(DICTotalMax)))
- end
- GameTooltip:Show()
-end)
-
-garrisonFrame:SetScript("OnLeave", function()
- if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end
- garrisonIcon:SetVertexColor(unpack(cfg.color.inactive))
-end)
-
-garrisonFrame:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "LeftButton" then
- ToggleCharacter("TokenFrame")
- end
-end)
-
-
----------------------------------------------
--- FUNCTIONS
----------------------------------------------
-local function updateXP(xp, mxp)
- if UnitLevel("player") == MAX_PLAYER_LEVEL or not cfg.currency.showXPbar then
- xpFrame:Hide()
- xpFrame:EnableMouse(false)
- currencyFrame:Show()
- else
- currencyFrame:Hide()
- xpFrame:Show()
- xpFrame:EnableMouse(true)
- xpStatusbar:SetMinMaxValues(0, mxp)
- xpStatusbar:SetValue(xp)
- xpText:SetText("LEVEL "..UnitLevel("player").." "..cfg.CLASS)
- xpFrame:SetSize(xpText:GetStringWidth()+18, 16)
- xpStatusbar:SetSize(xpText:GetStringWidth(),3)
- xpStatusbarBG:SetSize(xpText:GetStringWidth(),3)
- end
+function CurrencyModule:StyleCurrencyFrame(curId, i)
+ local db = xb.db.profile
+ local iconSize = db.text.fontSize + db.general.barPadding
+ local icon = xb.constants.mediaPath..'datatexts\\garres'
+ if tContains(self.rerollItems, curId) then
+ icon = xb.constants.mediaPath..'datatexts\\reroll'
+ end
+ local _, curAmount, _ = GetCurrencyInfo(curId)
+
+ local iconPoint = 'RIGHT'
+ local textPoint = 'LEFT'
+ local padding = -5
+
+ if xb.db.profile.modules.currency.textOnRight then
+ iconPoint = 'LEFT'
+ textPoint = 'RIGHT'
+ padding = -(padding)
+ end
+
+ self.curIcons[i]:ClearAllPoints()
+ self.curText[i]:ClearAllPoints()
+
+ self.curIcons[i]:SetTexture(icon)
+ self.curIcons[i]:SetSize(iconSize, iconSize)
+ self.curIcons[i]:SetPoint(iconPoint)
+ self.curIcons[i]:SetVertexColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+
+ self.curText[i]:SetFont(xb.LSM:Fetch(xb.LSM.MediaType.FONT, db.text.font), db.text.fontSize)
+ self.curText[i]:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ self.curText[i]:SetText(curAmount)
+ self.curText[i]:SetPoint(iconPoint, self.curIcons[i], textPoint, padding, 0)
+
+ local buttonWidth = iconSize + self.curText[i]:GetStringWidth() + 5
+ self.curButtons[i]:SetSize(buttonWidth, xb:GetHeight())
+ self.curButtons[i]:Show()
+ return buttonWidth
end
----------------------------------------------
--- EVENT HANDELING
----------------------------------------------
-
-local eventframe = CreateFrame("Frame")
-eventframe:RegisterEvent("PLAYER_ENTERING_WORLD")
-eventframe:RegisterEvent("PLAYER_XP_UPDATE")
-eventframe:RegisterEvent("PLAYER_LEVEL_UP")
-eventframe:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
-eventframe:RegisterEvent("CHAT_MSG_CURRENCY")
-eventframe:RegisterEvent("TRADE_CURRENCY_CHANGED")
-eventframe:RegisterEvent("MODIFIER_STATE_CHANGED")
-
-eventframe:SetScript("OnEvent", function(this, event, arg1, arg2, arg3, arg4, ...)
- --if event == "PLAYER_ENTERING_WORLD" or event == "PLAYER_XP_UPDATE" or event == "PLAYER_LEVEL_UP" then
- if UnitLevel("player") ~= MAX_PLAYER_LEVEL and cfg.currency.showXPbar then
- mxp = UnitXPMax("player")
- xp = UnitXP("player")
- updateXP(xp, mxp)
- currencyFrame:Hide()
- else
- xpFrame:Hide()
- end
-
- if event == "MODIFIER_STATE_CHANGED" then
- if InCombatLockdown() then return end
- if arg1 == "LSHIFT" or arg1 == "RSHIFT" then
- if UnitLevel("player") == MAX_PLAYER_LEVEL or not cfg.currency.showXPbar then return end
- if arg2 == 1 then
- xpFrame:Hide()
- xpFrame:EnableMouse(false)
- currencyFrame:Show()
- elseif arg2 == 0 then
- currencyFrame:Hide()
- xpFrame:EnableMouse(true)
- xpFrame:Show()
- end
- end
- end
-
-
-
-
- -- reroll currency
- local SoIFname, SoIFamount, _, _, _, SoIFtotalMax, SoIFisDiscovered = GetCurrencyInfo(1129)
- if SoIFamount > 0 then
- rerollText:SetText(SoIFamount)
- else
- local SoTFname, SoTFamount, _, _, _, SoTFtotalMax, SoTFisDiscovered = GetCurrencyInfo(994)
- if SoTFamount > 0 then rerollText:SetText(SoTFamount) end
- end
- rerollFrame:SetSize(rerollText:GetStringWidth()+18, 16)
-
- -- honor currency
- honorText:SetText(UnitHonor("player"))
- honorFrame:SetSize(honorText:GetStringWidth()+18, 16)
-
- currencyFrame:SetSize(rerollFrame:GetWidth()+honorFrame:GetWidth()+6,16)
-
- -- garrison currency
- local grName, grAmount, _, grEarnedThisWeek, grWeeklyMax, grTotalMax, grIsDiscovered = GetCurrencyInfo(824)
- garrisonText:SetText(grAmount)
- garrisonFrame:SetSize(garrisonText:GetStringWidth()+18, 16)
-
- currencyFrame:SetSize(rerollFrame:GetWidth()+honorFrame:GetWidth()+garrisonFrame:GetWidth()+6,16)
-end)
+function CurrencyModule:CreateFrames()
+ for i = 1, 3 do
+ self.curButtons[i] = self.curButtons[i] or CreateFrame("BUTTON", nil, self.currencyFrame)
+ self.curIcons[i] = self.curIcons[i] or self.curButtons[i]:CreateTexture(nil, 'OVERLAY')
+ self.curText[i] = self.curText[i] or self.curButtons[i]:CreateFontString(nil, "OVERLAY")
+ self.curButtons[i]:Hide()
+ end
+
+ self.xpFrame = self.xpFrame or CreateFrame("BUTTON", nil, self.currencyFrame)
+ self.xpIcon = self.xpIcon or self.xpFrame:CreateTexture(nil, 'OVERLAY')
+ self.xpText = self.xpText or self.xpFrame:CreateFontString(nil, 'OVERLAY')
+ self.xpBar = self.xpBar or CreateFrame('STATUSBAR', nil, self.xpFrame)
+ self.xpBarBg = self.xpBarBg or self.xpBar:CreateTexture(nil, 'BACKGROUND')
+ self.xpFrame:Hide()
+end
+
+function CurrencyModule:RegisterFrameEvents()
+
+ for i = 1, 3 do
+ self.curButtons[i]:EnableMouse(true)
+ self.curButtons[i]:RegisterForClicks("AnyUp")
+ self.curButtons[i]:SetScript('OnEnter', function()
+ if InCombatLockdown() then return; end
+ self.curText[i]:SetTextColor(unpack(xb:HoverColors()))
+ if xb.db.profile.modules.currency.showTooltip then
+ self:ShowTooltip()
+ end
+ end)
+ self.curButtons[i]:SetScript('OnLeave', function()
+ if InCombatLockdown() then return; end
+ local db = xb.db.profile
+ self.curText[i]:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ if xb.db.profile.modules.currency.showTooltip then
+ GameTooltip:Hide()
+ end
+ end)
+ self.curButtons[i]:SetScript('OnClick', function()
+ if InCombatLockdown() then return; end
+ ToggleCharacter('TokenFrame')
+ end)
+ end
+ self:RegisterEvent('CURRENCY_DISPLAY_UPDATE', 'Refresh')
+ self:SecureHook('BackpackTokenFrame_Update', 'Refresh') -- Ugh, why is there no event for this?
+
+ self.currencyFrame:EnableMouse(true)
+ self.currencyFrame:SetScript('OnEnter', function()
+ if xb.db.profile.modules.currency.showTooltip then
+ self:ShowTooltip()
+ end
+ end)
+ self.currencyFrame:SetScript('OnLeave', function()
+ if xb.db.profile.modules.currency.showTooltip then
+ GameTooltip:Hide()
+ end
+ end)
+ --[[
+ self.goldButton:EnableMouse(true)
+ self.goldButton:RegisterForClicks("AnyUp")
+
+ self.goldButton:SetScript('OnEnter', function()
+ if InCombatLockdown() then return; end
+ self.goldText:SetTextColor(unpack(xb:HoverColors()))
+ self.bagText:SetTextColor(unpack(xb:HoverColors()))
+
+ GameTooltip:SetOwner(CurrencyModule.goldFrame, 'ANCHOR_'..xb.miniTextPosition)
+ GameTooltip:AddLine("[|cff6699FF"..L['Gold'].."|r - |cff82c5ff"..xb.constants.playerFactionLocal.." "..xb.constants.playerRealm.."|r]")
+ GameTooltip:AddLine(" ")
+
+ local totalGold = 0
+ for charName, goldData in pairs(xb.db.factionrealm) do
+ GameTooltip:AddDoubleLine(charName, CurrencyModule:FormatCoinText(goldData.currentMoney), 1, 1, 0, 1, 1, 1)
+ totalGold = totalGold + goldData.currentMoney
+ end
+ GameTooltip:AddLine(" ")
+ GameTooltip:AddDoubleLine(L['Total'], CurrencyModule:FormatCoinText(totalGold), 1, 1, 0, 1, 1, 1)
+ GameTooltip:AddDoubleLine('<'..L['Left-Click']..'>', L['Toggle Bags'], 1, 1, 0, 1, 1, 1)
+ GameTooltip:Show()
+ end)
+
+ self.goldButton:SetScript('OnLeave', function()
+ if InCombatLockdown() then return; end
+ local db = xb.db.profile
+ self.goldText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ self.bagText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ GameTooltip:Hide()
+ end)
+
+ self.goldButton:SetScript('OnClick', function(_, button)
+ if InCombatLockdown() then return; end
+ ToggleAllBags()
+ end)]]--
+end
+
+function CurrencyModule:ShowTooltip()
+ GameTooltip:SetOwner(self.currencyFrame, 'ANCHOR_'..xb.miniTextPosition)
+ GameTooltip:AddLine("[|cff6699FF"..L['Currency'].."|r]")
+ GameTooltip:AddLine(" ")
+
+ for i = 1, 3 do
+ if xb.db.profile.modules.currency[self.intToOpt[i]] ~= '0' then
+ local curId = tonumber(xb.db.profile.modules.currency[self.intToOpt[i]])
+ local name, count, _, _, _, totalMax, _, _ = GetCurrencyInfo(curId)
+ GameTooltip:AddDoubleLine(name, string.format('%d/%d', count, totalMax), 1, 1, 0, 1, 1, 1)
+ end
+ end
+
+ GameTooltip:AddLine(" ")
+ GameTooltip:AddDoubleLine('<'..L['Left-Click']..'>', L['Toggle Currency Frame'], 1, 1, 0, 1, 1, 1)
+ GameTooltip:Show()
+end
+
+function CurrencyModule:GetCurrencyOptions()
+ local curOpts = {
+ ['0'] = ''
+ }
+ for i = 1, GetCurrencyListSize() do
+ local _, isHeader, _, isUnused = GetCurrencyListInfo(i)
+ if not isHeader and not isUnused then
+ local cL = GetCurrencyListLink(i)
+ local colon, _ = strfind(cL, ':', 1, true)
+ local pipeS, _ = strfind(cL, '|h', colon, true)
+ local itemId = strsub(cL, colon + 1, pipeS - 1)
+ local name, _ = GetCurrencyInfo(itemId)
+ curOpts[tostring(itemId)] = name
+ end
+ end
+ return curOpts
+end
+
+function CurrencyModule:GetDefaultOptions()
+ return 'currency', {
+ enabled = true,
+ showXPbar = true,
+ showTooltip = true,
+ textOnRight = true,
+ currencyOne = '0',
+ currencyTwo = '0',
+ currencyThree = '0'
+ }
+end
+
+function CurrencyModule:GetConfig()
+ return {
+ name = self:GetName(),
+ type = "group",
+ args = {
+ enable = {
+ name = ENABLE,
+ order = 0,
+ type = "toggle",
+ get = function() return xb.db.profile.modules.currency.enabled; end,
+ set = function(_, val) xb.db.profile.modules.currency.enabled = val; self:Refresh(); end,
+ width = "full"
+ },
+ showXPbar = {
+ name = L['Show XP Bar Below Max Level'],
+ 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"
+ },
+ showTooltip = {
+ name = L['Show Tooltips'],
+ order = 2,
+ 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,
+ 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
+ },
+ currency = {
+ type = 'group',
+ name = L['Currency Select'],
+ order = 4,
+ inline = true,
+ args = {
+ currencyOne = {
+ name = L['First Currency'], -- DROPDOWN, GoldModule:GetCurrencyOptions
+ type = "select",
+ order = 1,
+ values = function() return self:GetCurrencyOptions(); end,
+ style = "dropdown",
+ get = function() return xb.db.profile.modules.currency.currencyOne; end,
+ set = function(info, value) xb.db.profile.modules.currency.currencyOne = value; self:Refresh(); end,
+ },
+ currencyTwo = {
+ name = L['Second Currency'], -- DROPDOWN, GoldModule:GetCurrencyOptions
+ type = "select",
+ order = 2,
+ values = function() return self:GetCurrencyOptions(); end,
+ style = "dropdown",
+ get = function() return xb.db.profile.modules.currency.currencyTwo; end,
+ set = function(info, value) xb.db.profile.modules.currency.currencyTwo = value; self:Refresh(); end,
+ },
+ currencyThree = {
+ name = L['Third Currency'], -- DROPDOWN, GoldModule:GetCurrencyOptions
+ type = "select",
+ order = 3,
+ values = function() return self:GetCurrencyOptions(); end,
+ style = "dropdown",
+ get = function() return xb.db.profile.modules.currency.currencyThree; end,
+ set = function(info, value) xb.db.profile.modules.currency.currencyThree = value; self:Refresh(); end,
+ }
+ }
+ }
+ }
+ }
+end
diff --git a/modules/load_modules.xml b/modules/load_modules.xml
index 32b56ff..9b18e8a 100644
--- a/modules/load_modules.xml
+++ b/modules/load_modules.xml
@@ -5,4 +5,5 @@
<Script file="armor.lua" />
<Script file="travel.lua" />
<Script file="gold.lua" />
+ <Script file="currency.lua" />
</Ui>
diff --git a/modules/micromenu.lua b/modules/micromenu.lua
index 3c09942..282f6c4 100644
--- a/modules/micromenu.lua
+++ b/modules/micromenu.lua
@@ -196,7 +196,9 @@ function MenuModule:RegisterFrameEvents()
end
end
- self:RegisterEvent('GUILD_ROSTER_UPDATE', 'UpdateGuildText')
+ self:RegisterEvent('GUILD_ROSTER_UPDATE', function()
+ self:UpdateGuildText(true)
+ end)
self:RegisterEvent('BN_FRIEND_ACCOUNT_ONLINE', 'UpdateFriendText')
self:RegisterEvent('BN_FRIEND_ACCOUNT_OFFLINE', 'UpdateFriendText')
self:RegisterEvent('FRIENDLIST_UPDATE', 'UpdateFriendText')
@@ -209,7 +211,10 @@ function MenuModule:UnregisterFrameEvents()
self:UnregisterEvent('FRIENDLIST_UPDATE')
end
-function MenuModule:UpdateGuildText()
+function MenuModule:UpdateGuildText(isEvent)
+ if isEvent == nil then
+ GuildRoster()
+ end
if IsInGuild() then
local _, onlineMembers = GetNumGuildMembers()
self.text.guild:SetText(onlineMembers)
@@ -341,6 +346,7 @@ function MenuModule:GuildHover(hoverFunc)
hoverFunc()
return
end
+ GuildRoster()
GameTooltip:SetOwner(MenuModule.frames.guild, 'ANCHOR_'..xb.miniTextPosition)
GameTooltip:AddLine("[|cff6699FF"..L['Guild'].."|r]")
GameTooltip:AddLine(" ")
diff --git a/modules/old/currency.lua b/modules/old/currency.lua
new file mode 100644
index 0000000..13bbc53
--- /dev/null
+++ b/modules/old/currency.lua
@@ -0,0 +1,321 @@
+local addon, ns = ...
+local cfg = ns.cfg
+local unpack = unpack
+--------------------------------------------------------------
+if not cfg.currency.show then return end
+
+local iconPos = "RIGHT"
+local textPos = "LEFT"
+
+if cfg.currency.textOnRight then
+ iconPos = "LEFT"
+ textPos = "RIGHT"
+end
+
+local currencyFrame = CreateFrame("Frame",nil, cfg.SXframe)
+currencyFrame:SetPoint("LEFT", cfg.SXframe, "CENTER", 340,0)
+currencyFrame:SetSize(16, 16)
+
+---------------------------------------------
+-- XP BAR
+---------------------------------------------
+local xpFrame = CreateFrame("BUTTON",nil, cfg.SXframe)
+xpFrame:SetPoint("LEFT", cfg.SXframe, "CENTER", 350,0)
+xpFrame:SetSize(16, 16)
+xpFrame:EnableMouse(true)
+xpFrame:RegisterForClicks("AnyUp")
+
+local xpIcon = xpFrame:CreateTexture(nil,"OVERLAY",nil,7)
+xpIcon:SetSize(16, 16)
+xpIcon:SetPoint("LEFT")
+xpIcon:SetTexture(cfg.mediaFolder.."datatexts\\exp")
+xpIcon:SetVertexColor(unpack(cfg.color.normal))
+
+local xpText = xpFrame:CreateFontString(nil, "OVERLAY")
+xpText:SetFont(cfg.text.font, cfg.text.normalFontSize)
+xpText:SetPoint("RIGHT",xpFrame,2,0 )
+xpText:SetTextColor(unpack(cfg.color.normal))
+
+local xpStatusbar = CreateFrame("StatusBar", nil, xpFrame)
+xpStatusbar:SetStatusBarTexture(1,1,1)
+xpStatusbar:SetStatusBarColor(unpack(cfg.color.normal))
+xpStatusbar:SetPoint("TOPLEFT", xpText, "BOTTOMLEFT",0,-2)
+
+local xpStatusbarBG = xpStatusbar:CreateTexture(nil,"BACKGROUND",nil,7)
+xpStatusbarBG:SetPoint("TOPLEFT", xpText, "BOTTOMLEFT",0,-2)
+xpStatusbarBG:SetColorTexture(unpack(cfg.color.inactive))
+
+xpFrame:SetScript("OnEnter", function()
+ if InCombatLockdown() then return end
+ xpIcon:SetVertexColor(unpack(cfg.color.hover))
+ xpStatusbar:SetStatusBarColor(unpack(cfg.color.hover))
+ if not cfg.currency.showTooltip then return end
+ local mxp = UnitXPMax("player")
+ local xp = UnitXP("player")
+ local nxp = mxp - xp
+ local rxp = GetXPExhaustion()
+ local name, standing, minrep, maxrep, value = GetWatchedFactionInfo()
+
+ if cfg.core.position ~= "BOTTOM" then
+ GameTooltip:SetOwner(xpStatusbar, cfg.tooltipPos)
+ else
+ GameTooltip:SetOwner(xpFrame, cfg.tooltipPos)
+ end
+
+ GameTooltip:AddLine("[|cff6699FFExperience Bar|r]")
+ GameTooltip:AddLine(" ")
+ GameTooltip:AddDoubleLine(COMBAT_XP_GAIN, format(cfg.SVal(xp)).."|cffffd100/|r"..format(cfg.SVal(mxp)).." |cffffd100/|r "..floor((xp/mxp)*1000)/10 .."%",NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b,1,1,1)
+ GameTooltip:AddDoubleLine(NEED, format(cfg.SVal(nxp)).." |cffffd100/|r "..floor((nxp/mxp)*1000)/10 .."%",NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b,1,1,1)
+ if rxp then
+ GameTooltip:AddDoubleLine(TUTORIAL_TITLE26, format(cfg.SVal(rxp)) .." |cffffd100/|r ".. floor((rxp/mxp)*1000)/10 .."%", NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b,1,1,1)
+ end
+ GameTooltip:Show()
+end)
+
+xpFrame:SetScript("OnLeave", function()
+ xpIcon:SetVertexColor(unpack(cfg.color.normal))
+ xpStatusbar:SetStatusBarColor(unpack(cfg.color.normal))
+ if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end
+end)
+
+---------------------------------------------
+-- REROLL
+---------------------------------------------
+local rerollFrame = CreateFrame("BUTTON",nil, currencyFrame)
+rerollFrame:SetPoint("LEFT")
+rerollFrame:SetSize(16, 16)
+rerollFrame:EnableMouse(true)
+rerollFrame:RegisterForClicks("AnyUp")
+
+local rerollIcon = rerollFrame:CreateTexture(nil,"OVERLAY",nil,7)
+rerollIcon:SetSize(16, 16)
+rerollIcon:SetPoint(iconPos)
+rerollIcon:SetTexture(cfg.mediaFolder.."datatexts\\reroll")
+rerollIcon:SetVertexColor(unpack(cfg.color.inactive))
+
+local rerollText = rerollFrame:CreateFontString(nil, "OVERLAY")
+rerollText:SetFont(cfg.text.font, cfg.text.normalFontSize)
+--rerollText:SetPoint(iconPos,rerollIcon,textPos,-2,0)
+rerollText:SetPoint(textPos)
+rerollText:SetTextColor(unpack(cfg.color.inactive))
+
+rerollFrame:SetScript("OnEnter", function()
+ if InCombatLockdown() then return end
+ rerollIcon:SetVertexColor(unpack(cfg.color.hover))
+ if not cfg.currency.showTooltip then return end
+ GameTooltip:SetOwner(currencyFrame, cfg.tooltipPos)
+ GameTooltip:AddLine("[|cff6699FFReroll|r]")
+ GameTooltip:AddLine(" ")
+ local SoIFname, SoIFamount, SoIFicon, SoIFearnedThisWeek, SoIFweeklyMax, SoIFtotalMax, SoIFisDiscovered = GetCurrencyInfo(1129)
+ if SoIFamount > 0 then
+ GameTooltip:AddLine(SoIFname,1,1,0)
+ GameTooltip:AddDoubleLine("|cffffff00Weekly: |cffffffff"..SoIFearnedThisWeek.."|cffffff00/|cffffffff"..SoIFweeklyMax, "|cffffff00Total: |cffffffff"..SoIFamount.."|cffffff00/|cffffffff"..SoIFtotalMax)
+ else
+ local SoTFname, SoTFamount, SoTFicon, SoTFearnedThisWeek, SoTFweeklyMax, SoTFtotalMax, SoTFisDiscovered = GetCurrencyInfo(994)
+ if SoTFamount > 0 then
+ GameTooltip:AddDoubleLine(SoTFname, "|cffffff00Total: |cffffffff"..SoTFamount.."|cffffff00/|cffffffff"..SoTFtotalMax)
+ end
+ end
+ GameTooltip:Show()
+end)
+
+rerollFrame:SetScript("OnLeave", function()
+ if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end
+ rerollIcon:SetVertexColor(unpack(cfg.color.inactive))
+end)
+
+rerollFrame:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "LeftButton" then
+ ToggleCharacter("TokenFrame")
+ end
+end)
+
+---------------------------------------------
+-- HONOR
+---------------------------------------------
+
+local honorFrame = CreateFrame("BUTTON",nil, currencyFrame)
+honorFrame:SetPoint("LEFT",rerollFrame,"RIGHT",2,0)
+honorFrame:SetSize(16, 16)
+honorFrame:EnableMouse(true)
+honorFrame:RegisterForClicks("AnyUp")
+
+local honorIcon = honorFrame:CreateTexture(nil,"OVERLAY",nil,7)
+honorIcon:SetSize(16, 16)
+honorIcon:SetPoint(iconPos)
+honorIcon:SetTexture(cfg.mediaFolder.."datatexts\\honor")
+honorIcon:SetVertexColor(unpack(cfg.color.inactive))
+
+local honorText = honorFrame:CreateFontString(nil, "OVERLAY")
+honorText:SetFont(cfg.text.font, cfg.text.normalFontSize)
+honorText:SetPoint(textPos)
+honorText:SetTextColor(unpack(cfg.color.inactive))
+
+honorFrame:SetScript("OnEnter", function()
+ if InCombatLockdown() then return end
+ honorIcon:SetVertexColor(unpack(cfg.color.hover))
+ if not cfg.currency.showTooltip then return end
+ GameTooltip:SetOwner(currencyFrame, cfg.tooltipPos)
+ GameTooltip:AddLine("[|cff6699FFHonor Level:|r"..UnitHonorLevel("player").."]")
+ GameTooltip:AddLine(" ")
+ GameTooltip:AddDoubleLine(concName,"|cffffff00Honor: |cffffffff"..UnitHonor("player").."|cffffff00/|cffffffff"..UnitHonorMax("player"))
+ GameTooltip:Show()
+end)
+
+honorFrame:SetScript("OnLeave", function()
+ if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end
+ honorIcon:SetVertexColor(unpack(cfg.color.inactive))
+end)
+
+honorFrame:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "LeftButton" then
+ ToggleCharacter("TokenFrame")
+ end
+end)
+
+---------------------------------------------
+-- GARRISON RECOURCES
+---------------------------------------------
+
+local garrisonFrame = CreateFrame("BUTTON",nil, currencyFrame)
+garrisonFrame:SetPoint("LEFT",honorFrame,"RIGHT",2,0)
+garrisonFrame:SetSize(16, 16)
+garrisonFrame:EnableMouse(true)
+garrisonFrame:RegisterForClicks("AnyUp")
+
+local garrisonIcon = garrisonFrame:CreateTexture(nil,"OVERLAY",nil,7)
+garrisonIcon:SetSize(16, 16)
+garrisonIcon:SetPoint(iconPos)
+garrisonIcon:SetTexture(cfg.mediaFolder.."datatexts\\garres")
+garrisonIcon:SetVertexColor(unpack(cfg.color.inactive))
+
+local garrisonText = garrisonFrame:CreateFontString(nil, "OVERLAY")
+garrisonText:SetFont(cfg.text.font, cfg.text.normalFontSize)
+garrisonText:SetPoint(textPos)
+garrisonText:SetTextColor(unpack(cfg.color.inactive))
+
+garrisonFrame:SetScript("OnEnter", function()
+ if InCombatLockdown() then return end
+ garrisonIcon:SetVertexColor(unpack(cfg.color.hover))
+ if not cfg.currency.showTooltip then return end
+ GameTooltip:SetOwner(currencyFrame, cfg.tooltipPos)
+ GameTooltip:AddLine("[|cff6699FFGarrison Recources|r]")
+ GameTooltip:AddLine(" ")
+ local grName, grAmount, _, _, _, grTotalMax = GetCurrencyInfo(824)
+ local oilName, oilAmount, _, _, _, oilTotalMax, oilIsDiscovered = GetCurrencyInfo(1101)
+ local apexisName, apexisAmount = GetCurrencyInfo(823)
+ local DICName, DICAmount, _, _, _, DICTotalMax = GetCurrencyInfo(980)
+
+ GameTooltip:AddDoubleLine(grName, "|cffffffff"..format(cfg.SVal(grAmount)).."|cffffff00/|cffffffff"..format(cfg.SVal(grTotalMax)))
+ if oilIsDiscovered then
+ GameTooltip:AddDoubleLine(oilName, "|cffffffff"..format(cfg.SVal(oilAmount)).."|cffffff00/|cffffffff"..format(cfg.SVal(oilTotalMax)))
+ end
+ GameTooltip:AddDoubleLine(apexisName, "|cffffffff"..format(cfg.SVal(apexisAmount)))
+ if DICAmount > 0 then
+ GameTooltip:AddDoubleLine(DICName, "|cffffffff"..format(cfg.SVal(DICAmount)).."|cffffff00/|cffffffff"..format(cfg.SVal(DICTotalMax)))
+ end
+ GameTooltip:Show()
+end)
+
+garrisonFrame:SetScript("OnLeave", function()
+ if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end
+ garrisonIcon:SetVertexColor(unpack(cfg.color.inactive))
+end)
+
+garrisonFrame:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "LeftButton" then
+ ToggleCharacter("TokenFrame")
+ end
+end)
+
+
+---------------------------------------------
+-- FUNCTIONS
+---------------------------------------------
+local function updateXP(xp, mxp)
+ if UnitLevel("player") == MAX_PLAYER_LEVEL or not cfg.currency.showXPbar then
+ xpFrame:Hide()
+ xpFrame:EnableMouse(false)
+ currencyFrame:Show()
+ else
+ currencyFrame:Hide()
+ xpFrame:Show()
+ xpFrame:EnableMouse(true)
+ xpStatusbar:SetMinMaxValues(0, mxp)
+ xpStatusbar:SetValue(xp)
+ xpText:SetText("LEVEL "..UnitLevel("player").." "..cfg.CLASS)
+ xpFrame:SetSize(xpText:GetStringWidth()+18, 16)
+ xpStatusbar:SetSize(xpText:GetStringWidth(),3)
+ xpStatusbarBG:SetSize(xpText:GetStringWidth(),3)
+ end
+end
+
+---------------------------------------------
+-- EVENT HANDELING
+---------------------------------------------
+
+local eventframe = CreateFrame("Frame")
+eventframe:RegisterEvent("PLAYER_ENTERING_WORLD")
+eventframe:RegisterEvent("PLAYER_XP_UPDATE")
+eventframe:RegisterEvent("PLAYER_LEVEL_UP")
+eventframe:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
+eventframe:RegisterEvent("CHAT_MSG_CURRENCY")
+eventframe:RegisterEvent("TRADE_CURRENCY_CHANGED")
+eventframe:RegisterEvent("MODIFIER_STATE_CHANGED")
+
+eventframe:SetScript("OnEvent", function(this, event, arg1, arg2, arg3, arg4, ...)
+ --if event == "PLAYER_ENTERING_WORLD" or event == "PLAYER_XP_UPDATE" or event == "PLAYER_LEVEL_UP" then
+ if UnitLevel("player") ~= MAX_PLAYER_LEVEL and cfg.currency.showXPbar then
+ mxp = UnitXPMax("player")
+ xp = UnitXP("player")
+ updateXP(xp, mxp)
+ currencyFrame:Hide()
+ else
+ xpFrame:Hide()
+ end
+
+ if event == "MODIFIER_STATE_CHANGED" then
+ if InCombatLockdown() then return end
+ if arg1 == "LSHIFT" or arg1 == "RSHIFT" then
+ if UnitLevel("player") == MAX_PLAYER_LEVEL or not cfg.currency.showXPbar then return end
+ if arg2 == 1 then
+ xpFrame:Hide()
+ xpFrame:EnableMouse(false)
+ currencyFrame:Show()
+ elseif arg2 == 0 then
+ currencyFrame:Hide()
+ xpFrame:EnableMouse(true)
+ xpFrame:Show()
+ end
+ end
+ end
+
+
+
+
+ -- reroll currency
+ local SoIFname, SoIFamount, _, _, _, SoIFtotalMax, SoIFisDiscovered = GetCurrencyInfo(1129)
+ if SoIFamount > 0 then
+ rerollText:SetText(SoIFamount)
+ else
+ local SoTFname, SoTFamount, _, _, _, SoTFtotalMax, SoTFisDiscovered = GetCurrencyInfo(994)
+ if SoTFamount > 0 then rerollText:SetText(SoTFamount) end
+ end
+ rerollFrame:SetSize(rerollText:GetStringWidth()+18, 16)
+
+ -- honor currency
+ honorText:SetText(UnitHonor("player"))
+ honorFrame:SetSize(honorText:GetStringWidth()+18, 16)
+
+ currencyFrame:SetSize(rerollFrame:GetWidth()+honorFrame:GetWidth()+6,16)
+
+ -- garrison currency
+ local grName, grAmount, _, grEarnedThisWeek, grWeeklyMax, grTotalMax, grIsDiscovered = GetCurrencyInfo(824)
+ garrisonText:SetText(grAmount)
+ garrisonFrame:SetSize(garrisonText:GetStringWidth()+18, 16)
+
+ currencyFrame:SetSize(rerollFrame:GetWidth()+honorFrame:GetWidth()+garrisonFrame:GetWidth()+6,16)
+end)
diff --git a/modules/old/social.lua b/modules/old/social.lua
new file mode 100644
index 0000000..0f70414
--- /dev/null
+++ b/modules/old/social.lua
@@ -0,0 +1,272 @@
+local addon, ns = ...
+local cfg = ns.cfg
+local unpack = unpack
+--------------------------------------------------------------
+if not cfg.micromenu.show then return end
+
+local chatFrame = CreateFrame("BUTTON",nil, cfg.SXframe)
+chatFrame:SetSize(32, 32)
+chatFrame:SetPoint("LEFT",52,0)
+chatFrame:EnableMouse(true)
+chatFrame:RegisterForClicks("AnyUp")
+local chatFrameIcon = chatFrame:CreateTexture(nil,"OVERLAY",nil,7)
+chatFrameIcon:SetSize(32,32)
+chatFrameIcon:SetPoint("CENTER")
+chatFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\chat")
+chatFrameIcon:SetVertexColor(unpack(cfg.color.normal))
+
+chatFrame:SetScript("OnEnter", function()
+ if InCombatLockdown() then return end
+ chatFrameIcon:SetVertexColor(unpack(cfg.color.hover))
+end)
+
+chatFrame:SetScript("OnLeave", function() chatFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end)
+
+chatFrame:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "LeftButton" then
+ ChatMenu:SetScale(cfg.core.scale)
+ ChatMenu:ClearAllPoints()
+ if not ChatMenu:IsShown() then
+ if cfg.core.position == "BOTTOM" then
+ ChatMenu:SetPoint("BOTTOMLEFT", chatFrame, "TOPLEFT")
+ else
+ ChatMenu:SetPoint("TOPLEFT", chatFrame, "BOTTOMLEFT")
+ end
+ ChatFrameMenuButton:Click()
+ else ChatMenu:Hide() end
+ end
+end)
+
+
+local guildFrame = CreateFrame("BUTTON",nil, cfg.SXframe)
+guildFrame:SetSize(32, 32)
+guildFrame:SetPoint("LEFT",chatFrame,36,0)
+guildFrame:EnableMouse(true)
+guildFrame:RegisterForClicks("AnyUp")
+
+local guildIcon = guildFrame:CreateTexture(nil,"OVERLAY",nil,7)
+guildIcon:SetPoint("CENTER")
+guildIcon:SetTexture(cfg.mediaFolder.."microbar\\guild")
+guildIcon:SetVertexColor(unpack(cfg.color.normal))
+
+local guildText = guildFrame:CreateFontString(nil, "OVERLAY")
+guildText:SetFont(cfg.text.font, cfg.text.smallFontSize)
+guildText:SetPoint("CENTER", guildFrame, "TOP")
+if cfg.core.position ~= "BOTTOM" then
+ guildText:SetPoint("CENTER", guildFrame, "BOTTOM")
+end
+
+local guildTextBG = guildFrame:CreateTexture(nil,"OVERLAY",nil,7)
+guildTextBG:SetPoint("CENTER",guildText)
+guildTextBG:SetColorTexture(unpack(cfg.color.barcolor))
+
+guildFrame:SetScript("OnEnter", function()
+ if InCombatLockdown() then return end
+ guildIcon:SetVertexColor(unpack(cfg.color.hover))
+ if not cfg.micromenu.showTooltip then return end
+if ( IsInGuild() ) then
+ GameTooltip:SetOwner(guildFrame, cfg.tooltipPos)
+ GameTooltip:AddLine("[|cff6699FFGuild|r]")
+ GameTooltip:AddLine(" ")
+ --------------------------
+
+ guildList = {}
+ guildName, guildRank, _ = GetGuildInfo("player")
+ guildMotto = GetGuildRosterMOTD()
+
+ GameTooltip:AddDoubleLine("Guild:", guildName, 1, 1, 0, 0, 1, 0)
+ for i = 0, select(1, GetNumGuildMembers()) do
+ local name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName, achievementPoints, achievementRank, isMobile, canSoR = GetGuildRosterInfo(i)
+ if ( online ) then
+ if status == 0 then status = "" elseif status == 1 then status = "AFK" elseif status == 2 then status = "DND" end
+ local cCol = string.format("%02X%02X%02X", RAID_CLASS_COLORS[classFileName].r*255, RAID_CLASS_COLORS[classFileName].g*255, RAID_CLASS_COLORS[classFileName].b*255)
+ local lineL = string.format("%s |cff%s%s|r %s %s", level, cCol, name, status, note)
+ local lineR = string.format("%s|cffffffff %s", isMobile and "|cffffff00[M]|r " or "", zone or "")
+ GameTooltip:AddDoubleLine(lineL,lineR)
+ end
+ end
+else
+ --GameTooltip:AddLine("No Guild")
+end
+GameTooltip:AddLine(" ")
+if ( IsInGuild() ) then GameTooltip:AddDoubleLine("<Left-click>", "Open Guild Page", 1, 1, 0, 1, 1, 1) end
+-----------------------
+GameTooltip:Show()
+end)
+
+guildFrame:SetScript("OnLeave", function() if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end guildIcon:SetVertexColor(unpack(cfg.color.normal)) end)
+
+guildFrame:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "LeftButton" then
+ if ( IsInGuild() ) then
+ ToggleGuildFrame()
+ GuildFrameTab2:Click()
+ else
+ print"|cff6699FFSXUI|r: You are not in a guild"
+ end
+ end
+end)
+
+local friendFrame = CreateFrame("BUTTON",nil, cfg.SXframe)
+friendFrame:SetSize(32, 32)
+friendFrame:SetPoint("LEFT",guildFrame,36,0)
+friendFrame:EnableMouse(true)
+friendFrame:RegisterForClicks("AnyUp")
+
+local friendIcon = friendFrame:CreateTexture(nil,"OVERLAY",nil,7)
+friendIcon:SetSize(32,32)
+friendIcon:SetPoint("CENTER")
+friendIcon:SetTexture(cfg.mediaFolder.."microbar\\social")
+friendIcon:SetVertexColor(unpack(cfg.color.normal))
+
+local friendText = guildFrame:CreateFontString(nil, "OVERLAY")
+friendText:SetFont(cfg.text.font, cfg.text.smallFontSize)
+friendText:SetPoint("CENTER", friendFrame, "TOP")
+if cfg.core.position ~= "BOTTOM" then
+ friendText:SetPoint("CENTER", friendFrame, "BOTTOM")
+end
+
+local friendTextBG = guildFrame:CreateTexture(nil,"OVERLAY",nil,7)
+friendTextBG:SetColorTexture(unpack(cfg.color.barcolor))
+
+
+friendFrame:SetScript("OnEnter", function()
+ if InCombatLockdown() then return end
+ friendIcon:SetVertexColor(unpack(cfg.color.hover))
+ if not cfg.micromenu.showTooltip then return end
+ local totalBNet, numBNetOnline = BNGetNumFriends()
+ if numBNetOnline then
+ GameTooltip:SetOwner(friendFrame, cfg.tooltipPos)
+ GameTooltip:AddLine("[|cff6699FFSocial|r]")
+ GameTooltip:AddLine(" ")
+ --------------------------
+ local onlineBnetFriends = false
+ for j = 1, BNGetNumFriends() do
+ local BNid, BNname, battleTag, _, toonname, toonid, client, online, lastonline, isafk, isdnd, broadcast, note = BNGetFriendInfo(j)
+ if ( online ) then
+
+ if (not battleTag) then battleTag = "[noTag]" end
+ local status = ""
+
+ local statusIcon = "Interface\\FriendsFrame\\StatusIcon-Online.blp"
+ if ( isafk ) then
+ statusIcon = "Interface\\FriendsFrame\\StatusIcon-Away.blp"
+ status = "(AFK)"
+ end
+ if ( isdnd ) == "D3" then
+ statusIcon = "Interface\\FriendsFrame\\StatusIcon-DnD.blp"
+ status = "(DND)"
+ end
+
+ local gameIcon = "Interface\\Icons\\INV_Misc_QuestionMark.blp"
+ if client == "App" then
+ gameIcon = "Interface\\FriendsFrame\\Battlenet-Battleneticon.blp"
+ client = "Bnet"
+ elseif client == "D3" then
+ gameIcon = "Interface\\FriendsFrame\\Battlenet-D3icon.blp"
+ client = "Diablo III"
+ elseif client == "Hero" then
+ gameIcon = "Interface\\FriendsFrame\\Battlenet-HotSicon.blp"
+ client = "Hero of the Storm"
+ elseif client == "S2" then
+ gameIcon = "Interface\\FriendsFrame\\Battlenet-Sc2icon.blp"
+ client = "Starcraft 2"
+ elseif client == "WoW" then
+ gameIcon = "Interface\\FriendsFrame\\Battlenet-WoWicon.blp"
+ elseif client == "WTCG" then
+ gameIcon = "Interface\\FriendsFrame\\Battlenet-WTCGicon.blp"
+ client = "Heartstone"
+ end
+ if client == "WoW" then
+ toonname = ("(|cffecd672"..toonname.."|r)")
+ else
+ toonname = ""
+ end
+
+ if not note then
+ note = ""
+ else
+ note = ("(|cffecd672"..note.."|r)")
+ end
+
+ local lineL = string.format("|T%s:16|t|cff82c5ff %s|r %s",statusIcon, BNname, note)
+ local lineR = string.format("%s %s |T%s:16|t",toonname, client or "", gameIcon)
+ GameTooltip:AddDoubleLine(lineL,lineR)
+ onlineBnetFriends = true
+ end
+ end
+
+if onlineBnetFriends then GameTooltip:AddLine(" ") end
+
+local onlineFriends = false
+ for i = 1, GetNumFriends() do
+ local name, lvl, class, area, online, status, note = GetFriendInfo(i)
+ if ( online ) then
+ local status = ""
+ local statusIcon = "Interface\\FriendsFrame\\StatusIcon-Online.blp"
+ if ( isafk ) then
+ statusIcon = "Interface\\FriendsFrame\\StatusIcon-Away.blp"
+ status = "(AFK)"
+ end
+ if ( isdnd ) == "D3" then
+ statusIcon = "Interface\\FriendsFrame\\StatusIcon-DnD.blp"
+ status = "(DND)"
+ end
+ local lineL = string.format("|T%s:16|t %s, lvl:%s %s", statusIcon, name, lvl, class)
+ local lineR = string.format("%s", area or "")
+ GameTooltip:AddDoubleLine(lineL,lineR)
+ onlineFriends = true
+ end
+ end
+if onlineFriends then GameTooltip:AddLine(" ") end
+GameTooltip:AddDoubleLine("<Left-click>", "Open Friends List", 1, 1, 0, 1, 1, 1)
+-----------------------
+GameTooltip:Show()
+end
+end)
+
+friendFrame:SetScript("OnLeave", function() if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end friendIcon:SetVertexColor(unpack(cfg.color.normal)) end)
+
+friendFrame:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "LeftButton" then
+ ToggleFriendsFrame()
+ end
+end)
+
+local eventframe = CreateFrame("Frame")
+eventframe:RegisterEvent("PLAYER_ENTERING_WORLD")
+
+eventframe:RegisterEvent("FRIENDLIST_UPDATE")
+eventframe:RegisterEvent("BN_FRIEND_ACCOUNT_ONLINE")
+eventframe:RegisterEvent("BN_FRIEND_ACCOUNT_OFFLINE")
+
+eventframe:RegisterEvent("GUILD_ROSTER_UPDATE")
+eventframe:RegisterEvent("GUILD_TRADESKILL_UPDATE")
+eventframe:RegisterEvent("GUILD_MOTD")
+eventframe:RegisterEvent("GUILD_NEWS_UPDATE")
+eventframe:RegisterEvent("PLAYER_GUILD_UPDATE")
+
+eventframe:SetScript("OnEvent", function(self,event, ...)
+ local numOnline = ""
+ if IsInGuild() then
+ _, numOnline, _ = GetNumGuildMembers()
+ end
+ guildText:SetText(numOnline)
+ guildTextBG:SetSize(guildText:GetWidth()+4,guildText:GetHeight()+2)
+ guildTextBG:SetPoint("CENTER",guildText)
+
+ local totalBNet, numBNetOnline = BNGetNumFriends()
+ friendText:SetText(numBNetOnline)
+
+ if numBNetOnline == 0 then
+ friendText:SetText("")
+ else
+
+ end
+ friendTextBG:SetSize(friendText:GetWidth()+4,friendText:GetHeight()+2)
+ friendTextBG:SetPoint("CENTER",friendText)
+
+end)
\ No newline at end of file
diff --git a/modules/social.lua b/modules/social.lua
deleted file mode 100644
index 0f70414..0000000
--- a/modules/social.lua
+++ /dev/null
@@ -1,272 +0,0 @@
-local addon, ns = ...
-local cfg = ns.cfg
-local unpack = unpack
---------------------------------------------------------------
-if not cfg.micromenu.show then return end
-
-local chatFrame = CreateFrame("BUTTON",nil, cfg.SXframe)
-chatFrame:SetSize(32, 32)
-chatFrame:SetPoint("LEFT",52,0)
-chatFrame:EnableMouse(true)
-chatFrame:RegisterForClicks("AnyUp")
-local chatFrameIcon = chatFrame:CreateTexture(nil,"OVERLAY",nil,7)
-chatFrameIcon:SetSize(32,32)
-chatFrameIcon:SetPoint("CENTER")
-chatFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\chat")
-chatFrameIcon:SetVertexColor(unpack(cfg.color.normal))
-
-chatFrame:SetScript("OnEnter", function()
- if InCombatLockdown() then return end
- chatFrameIcon:SetVertexColor(unpack(cfg.color.hover))
-end)
-
-chatFrame:SetScript("OnLeave", function() chatFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end)
-
-chatFrame:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "LeftButton" then
- ChatMenu:SetScale(cfg.core.scale)
- ChatMenu:ClearAllPoints()
- if not ChatMenu:IsShown() then
- if cfg.core.position == "BOTTOM" then
- ChatMenu:SetPoint("BOTTOMLEFT", chatFrame, "TOPLEFT")
- else
- ChatMenu:SetPoint("TOPLEFT", chatFrame, "BOTTOMLEFT")
- end
- ChatFrameMenuButton:Click()
- else ChatMenu:Hide() end
- end
-end)
-
-
-local guildFrame = CreateFrame("BUTTON",nil, cfg.SXframe)
-guildFrame:SetSize(32, 32)
-guildFrame:SetPoint("LEFT",chatFrame,36,0)
-guildFrame:EnableMouse(true)
-guildFrame:RegisterForClicks("AnyUp")
-
-local guildIcon = guildFrame:CreateTexture(nil,"OVERLAY",nil,7)
-guildIcon:SetPoint("CENTER")
-guildIcon:SetTexture(cfg.mediaFolder.."microbar\\guild")
-guildIcon:SetVertexColor(unpack(cfg.color.normal))
-
-local guildText = guildFrame:CreateFontString(nil, "OVERLAY")
-guildText:SetFont(cfg.text.font, cfg.text.smallFontSize)
-guildText:SetPoint("CENTER", guildFrame, "TOP")
-if cfg.core.position ~= "BOTTOM" then
- guildText:SetPoint("CENTER", guildFrame, "BOTTOM")
-end
-
-local guildTextBG = guildFrame:CreateTexture(nil,"OVERLAY",nil,7)
-guildTextBG:SetPoint("CENTER",guildText)
-guildTextBG:SetColorTexture(unpack(cfg.color.barcolor))
-
-guildFrame:SetScript("OnEnter", function()
- if InCombatLockdown() then return end
- guildIcon:SetVertexColor(unpack(cfg.color.hover))
- if not cfg.micromenu.showTooltip then return end
-if ( IsInGuild() ) then
- GameTooltip:SetOwner(guildFrame, cfg.tooltipPos)
- GameTooltip:AddLine("[|cff6699FFGuild|r]")
- GameTooltip:AddLine(" ")
- --------------------------
-
- guildList = {}
- guildName, guildRank, _ = GetGuildInfo("player")
- guildMotto = GetGuildRosterMOTD()
-
- GameTooltip:AddDoubleLine("Guild:", guildName, 1, 1, 0, 0, 1, 0)
- for i = 0, select(1, GetNumGuildMembers()) do
- local name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName, achievementPoints, achievementRank, isMobile, canSoR = GetGuildRosterInfo(i)
- if ( online ) then
- if status == 0 then status = "" elseif status == 1 then status = "AFK" elseif status == 2 then status = "DND" end
- local cCol = string.format("%02X%02X%02X", RAID_CLASS_COLORS[classFileName].r*255, RAID_CLASS_COLORS[classFileName].g*255, RAID_CLASS_COLORS[classFileName].b*255)
- local lineL = string.format("%s |cff%s%s|r %s %s", level, cCol, name, status, note)
- local lineR = string.format("%s|cffffffff %s", isMobile and "|cffffff00[M]|r " or "", zone or "")
- GameTooltip:AddDoubleLine(lineL,lineR)
- end
- end
-else
- --GameTooltip:AddLine("No Guild")
-end
-GameTooltip:AddLine(" ")
-if ( IsInGuild() ) then GameTooltip:AddDoubleLine("<Left-click>", "Open Guild Page", 1, 1, 0, 1, 1, 1) end
------------------------
-GameTooltip:Show()
-end)
-
-guildFrame:SetScript("OnLeave", function() if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end guildIcon:SetVertexColor(unpack(cfg.color.normal)) end)
-
-guildFrame:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "LeftButton" then
- if ( IsInGuild() ) then
- ToggleGuildFrame()
- GuildFrameTab2:Click()
- else
- print"|cff6699FFSXUI|r: You are not in a guild"
- end
- end
-end)
-
-local friendFrame = CreateFrame("BUTTON",nil, cfg.SXframe)
-friendFrame:SetSize(32, 32)
-friendFrame:SetPoint("LEFT",guildFrame,36,0)
-friendFrame:EnableMouse(true)
-friendFrame:RegisterForClicks("AnyUp")
-
-local friendIcon = friendFrame:CreateTexture(nil,"OVERLAY",nil,7)
-friendIcon:SetSize(32,32)
-friendIcon:SetPoint("CENTER")
-friendIcon:SetTexture(cfg.mediaFolder.."microbar\\social")
-friendIcon:SetVertexColor(unpack(cfg.color.normal))
-
-local friendText = guildFrame:CreateFontString(nil, "OVERLAY")
-friendText:SetFont(cfg.text.font, cfg.text.smallFontSize)
-friendText:SetPoint("CENTER", friendFrame, "TOP")
-if cfg.core.position ~= "BOTTOM" then
- friendText:SetPoint("CENTER", friendFrame, "BOTTOM")
-end
-
-local friendTextBG = guildFrame:CreateTexture(nil,"OVERLAY",nil,7)
-friendTextBG:SetColorTexture(unpack(cfg.color.barcolor))
-
-
-friendFrame:SetScript("OnEnter", function()
- if InCombatLockdown() then return end
- friendIcon:SetVertexColor(unpack(cfg.color.hover))
- if not cfg.micromenu.showTooltip then return end
- local totalBNet, numBNetOnline = BNGetNumFriends()
- if numBNetOnline then
- GameTooltip:SetOwner(friendFrame, cfg.tooltipPos)
- GameTooltip:AddLine("[|cff6699FFSocial|r]")
- GameTooltip:AddLine(" ")
- --------------------------
- local onlineBnetFriends = false
- for j = 1, BNGetNumFriends() do
- local BNid, BNname, battleTag, _, toonname, toonid, client, online, lastonline, isafk, isdnd, broadcast, note = BNGetFriendInfo(j)
- if ( online ) then
-
- if (not battleTag) then battleTag = "[noTag]" end
- local status = ""
-
- local statusIcon = "Interface\\FriendsFrame\\StatusIcon-Online.blp"
- if ( isafk ) then
- statusIcon = "Interface\\FriendsFrame\\StatusIcon-Away.blp"
- status = "(AFK)"
- end
- if ( isdnd ) == "D3" then
- statusIcon = "Interface\\FriendsFrame\\StatusIcon-DnD.blp"
- status = "(DND)"
- end
-
- local gameIcon = "Interface\\Icons\\INV_Misc_QuestionMark.blp"
- if client == "App" then
- gameIcon = "Interface\\FriendsFrame\\Battlenet-Battleneticon.blp"
- client = "Bnet"
- elseif client == "D3" then
- gameIcon = "Interface\\FriendsFrame\\Battlenet-D3icon.blp"
- client = "Diablo III"
- elseif client == "Hero" then
- gameIcon = "Interface\\FriendsFrame\\Battlenet-HotSicon.blp"
- client = "Hero of the Storm"
- elseif client == "S2" then
- gameIcon = "Interface\\FriendsFrame\\Battlenet-Sc2icon.blp"
- client = "Starcraft 2"
- elseif client == "WoW" then
- gameIcon = "Interface\\FriendsFrame\\Battlenet-WoWicon.blp"
- elseif client == "WTCG" then
- gameIcon = "Interface\\FriendsFrame\\Battlenet-WTCGicon.blp"
- client = "Heartstone"
- end
- if client == "WoW" then
- toonname = ("(|cffecd672"..toonname.."|r)")
- else
- toonname = ""
- end
-
- if not note then
- note = ""
- else
- note = ("(|cffecd672"..note.."|r)")
- end
-
- local lineL = string.format("|T%s:16|t|cff82c5ff %s|r %s",statusIcon, BNname, note)
- local lineR = string.format("%s %s |T%s:16|t",toonname, client or "", gameIcon)
- GameTooltip:AddDoubleLine(lineL,lineR)
- onlineBnetFriends = true
- end
- end
-
-if onlineBnetFriends then GameTooltip:AddLine(" ") end
-
-local onlineFriends = false
- for i = 1, GetNumFriends() do
- local name, lvl, class, area, online, status, note = GetFriendInfo(i)
- if ( online ) then
- local status = ""
- local statusIcon = "Interface\\FriendsFrame\\StatusIcon-Online.blp"
- if ( isafk ) then
- statusIcon = "Interface\\FriendsFrame\\StatusIcon-Away.blp"
- status = "(AFK)"
- end
- if ( isdnd ) == "D3" then
- statusIcon = "Interface\\FriendsFrame\\StatusIcon-DnD.blp"
- status = "(DND)"
- end
- local lineL = string.format("|T%s:16|t %s, lvl:%s %s", statusIcon, name, lvl, class)
- local lineR = string.format("%s", area or "")
- GameTooltip:AddDoubleLine(lineL,lineR)
- onlineFriends = true
- end
- end
-if onlineFriends then GameTooltip:AddLine(" ") end
-GameTooltip:AddDoubleLine("<Left-click>", "Open Friends List", 1, 1, 0, 1, 1, 1)
------------------------
-GameTooltip:Show()
-end
-end)
-
-friendFrame:SetScript("OnLeave", function() if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end friendIcon:SetVertexColor(unpack(cfg.color.normal)) end)
-
-friendFrame:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "LeftButton" then
- ToggleFriendsFrame()
- end
-end)
-
-local eventframe = CreateFrame("Frame")
-eventframe:RegisterEvent("PLAYER_ENTERING_WORLD")
-
-eventframe:RegisterEvent("FRIENDLIST_UPDATE")
-eventframe:RegisterEvent("BN_FRIEND_ACCOUNT_ONLINE")
-eventframe:RegisterEvent("BN_FRIEND_ACCOUNT_OFFLINE")
-
-eventframe:RegisterEvent("GUILD_ROSTER_UPDATE")
-eventframe:RegisterEvent("GUILD_TRADESKILL_UPDATE")
-eventframe:RegisterEvent("GUILD_MOTD")
-eventframe:RegisterEvent("GUILD_NEWS_UPDATE")
-eventframe:RegisterEvent("PLAYER_GUILD_UPDATE")
-
-eventframe:SetScript("OnEvent", function(self,event, ...)
- local numOnline = ""
- if IsInGuild() then
- _, numOnline, _ = GetNumGuildMembers()
- end
- guildText:SetText(numOnline)
- guildTextBG:SetSize(guildText:GetWidth()+4,guildText:GetHeight()+2)
- guildTextBG:SetPoint("CENTER",guildText)
-
- local totalBNet, numBNetOnline = BNGetNumFriends()
- friendText:SetText(numBNetOnline)
-
- if numBNetOnline == 0 then
- friendText:SetText("")
- else
-
- end
- friendTextBG:SetSize(friendText:GetWidth()+4,friendText:GetHeight()+2)
- friendTextBG:SetPoint("CENTER",friendText)
-
-end)
\ No newline at end of file
diff --git a/modules/travel.lua b/modules/travel.lua
index 9cc3399..db1f5c2 100644
--- a/modules/travel.lua
+++ b/modules/travel.lua
@@ -148,9 +148,11 @@ function TravelModule:SetHearthColor()
if (PlayerHasToy(v) or IsUsableItem(v)) then
if GetItemCooldown(v) == 0 then
hearthName, _ = GetItemInfo(v)
- hearthActive = true
- self.hearthButton:SetAttribute("macrotext", "/cast "..hearthName)
- break
+ if hearthName ~= nil then
+ hearthActive = true
+ self.hearthButton:SetAttribute("macrotext", "/cast "..hearthName)
+ break
+ end
end
end -- if toy/item
if IsPlayerSpell(v) then