diff --git a/modules/currency.lua b/modules/currency.lua index 13bbc53..06555fb 100644 --- a/modules/currency.lua +++ b/modules/currency.lua @@ -79,6 +79,67 @@ xpFrame:SetScript("OnLeave", function() end) --------------------------------------------- +-- Artifact BAR +--------------------------------------------- +local artiFrame = CreateFrame("BUTTON",nil, cfg.SXframe) +artiFrame:SetPoint("LEFT", cfg.SXframe, "CENTER", 200,0) +artiFrame:SetSize(16, 16) +artiFrame:EnableMouse(true) +artiFrame:RegisterForClicks("AnyUp") + +local artiIcon = artiFrame:CreateTexture(nil,"OVERLAY",nil,7) +artiIcon:SetSize(16, 16) +artiIcon:SetPoint("LEFT") +artiIcon:SetVertexColor(unpack(cfg.color.normal)) + +local artiText = artiFrame:CreateFontString(nil, "OVERLAY") +artiText:SetFont(cfg.text.font, cfg.text.normalFontSize) +artiText:SetPoint("RIGHT",artiFrame,2,0 ) +artiText:SetTextColor(unpack(cfg.color.normal)) + +local artiStatusbar = CreateFrame("StatusBar", nil, artiFrame) +artiStatusbar:SetStatusBarTexture(1,1,1) +artiStatusbar:SetStatusBarColor(unpack(cfg.color.normal)) +artiStatusbar:SetPoint("TOPLEFT", artiText, "BOTTOMLEFT",0,-2) + +local artiStatusbarBG = artiStatusbar:CreateTexture(nil,"BACKGROUND",nil,7) +artiStatusbarBG:SetPoint("TOPLEFT", artiText, "BOTTOMLEFT",0,-2) +artiStatusbarBG:SetColorTexture(unpack(cfg.color.inactive)) + +artiFrame:SetScript("OnEnter", function() + if InCombatLockdown() then return end + artiIcon:SetVertexColor(unpack(cfg.color.hover)) + artiStatusbar:SetStatusBarColor(unpack(cfg.color.hover)) + if not cfg.currency.showTooltip then return end + + local currentAP = select(5,C_ArtifactUI.GetEquippedArtifactInfo()) + local traitsSpent = select(6,C_ArtifactUI.GetEquippedArtifactInfo()) + local numLearnableTraits,currentAP,xpForNextTrait=GetNumArtifactTraitsPurchasableFromXP(traitsSpent,currentAP) + + if cfg.core.position ~= "BOTTOM" then + GameTooltip:SetOwner(artiStatusbar, cfg.tooltipPos) + else + GameTooltip:SetOwner(artiFrame, cfg.tooltipPos) + end + + GameTooltip:AddLine("[|cff6699FFArtifact Power Bar|r]") + GameTooltip:AddLine(" ") + GameTooltip:AddLine(format(ARTIFACTS_NUM_PURCHASED_RANKS,traitsSpent)) + GameTooltip:AddLine(format(ARTIFACT_POWER_BAR,currentAP,xpForNextTrait).." with "..numLearnableTraits.." learnable traits") + GameTooltip:Show() +end) + +artiFrame:SetScript("OnLeave", function() + artiIcon:SetVertexColor(unpack(cfg.color.normal)) + artiStatusbar:SetStatusBarColor(unpack(cfg.color.normal)) + if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end +end) + +artiFrame:SetScript("OnClick",function() + SocketInventoryItem(16) +end) + +--------------------------------------------- -- REROLL --------------------------------------------- local rerollFrame = CreateFrame("BUTTON",nil, currencyFrame) @@ -253,13 +314,36 @@ local function updateXP(xp, mxp) end end +function GetNumArtifactTraitsPurchasableFromXP(rkSpent, currAP) + artiIcon:SetTexture(GetItemIcon(select(1,C_ArtifactUI.GetEquippedArtifactInfo()))) + artiText:SetText("Artifact rank "..rkSpent) + artiFrame:SetSize(artiText:GetStringWidth()+18, 16) + artiStatusbar:SetSize(artiText:GetStringWidth(),3) + artiStatusbarBG:SetSize(artiText:GetStringWidth(),3) + local numRk = 0; + local xpForNextRk = C_ArtifactUI.GetCostForPointAtRank(rkSpent); + while currAP >= xpForNextRk and xpForNextRk > 0 do + currAP = currAP - xpForNextRk; + + rkSpent = rkSpent + 1; + numRk = numRk + 1; + + xpForNextRk = C_ArtifactUI.GetCostForPointAtRank(rkSpent); + end + artiStatusbar:SetMinMaxValues(0, xpForNextRk) + artiStatusbar:SetValue(currAP) + return numRk, currAP, xpForNextRk; +end + --------------------------------------------- -- EVENT HANDELING --------------------------------------------- local eventframe = CreateFrame("Frame") eventframe:RegisterEvent("PLAYER_ENTERING_WORLD") +eventframe:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") eventframe:RegisterEvent("PLAYER_XP_UPDATE") +eventframe:RegisterEvent("ARTIFACT_XP_UPDATE"); eventframe:RegisterEvent("PLAYER_LEVEL_UP") eventframe:RegisterEvent("CURRENCY_DISPLAY_UPDATE") eventframe:RegisterEvent("CHAT_MSG_CURRENCY") @@ -276,6 +360,16 @@ eventframe:SetScript("OnEvent", function(this, event, arg1, arg2, arg3, arg4, .. else xpFrame:Hide() end + + if HasArtifactEquipped() and cfg.currency.showAPbar then + local currentAP = select(5,C_ArtifactUI.GetEquippedArtifactInfo()) + local traitsSpent = select(6,C_ArtifactUI.GetEquippedArtifactInfo()) + GetNumArtifactTraitsPurchasableFromXP(traitsSpent,currentAP) + currencyFrame:Hide() + artiFrame:Show() + else + artiFrame:Hide() + end if event == "MODIFIER_STATE_CHANGED" then if InCombatLockdown() then return end diff --git a/modules/social.lua b/modules/social.lua index 0f70414..cb89212 100644 --- a/modules/social.lua +++ b/modules/social.lua @@ -178,7 +178,11 @@ friendFrame:SetScript("OnEnter", function() elseif client == "WTCG" then gameIcon = "Interface\\FriendsFrame\\Battlenet-WTCGicon.blp" client = "Heartstone" + elseif client == "Pro" then + gameIcon = "Interface\\FriendsFrame\\Battlenet-OVERWATCHicon.blp" + client = "Overwatch" end + if client == "WoW" then toonname = ("(|cffecd672"..toonname.."|r)") else diff --git a/settings.lua b/settings.lua index c0f25c2..fedbc1a 100644 --- a/settings.lua +++ b/settings.lua @@ -19,11 +19,18 @@ cfg.mediaFolder = "Interface\\AddOns\\"..addon.."\\media\\" cfg.color = { normal = {1,1,1,.75}, -- SETS THE SAME COLOR FOR THE TEXT - inactive = {1,1,1,.25}, -- SET THE COLOR FOR THE INACTICE ICONS + inactive = {1,1,1,.25}, -- SET THE COLOR FOR THE INACTIVE ICONS hover = {cfg.cc.r,cfg.cc.g,cfg.cc.b,.75}, -- DOES NOT CHANGE THE TEXTCOLOR barcolor = {.094,.094,.094,.75}, -- THE COLOR OF THE BAR - --barcolor = {.05,.05,.05,0}, -- THE COLOR OF THE BAR + classColor = false } + +if cfg.color.classColor then + local tmp=cfg.color.normal + cfg.color.normal=cfg.color.hover + cfg.color.hover=tmp +end + if cfg.CLASS == "PRIEST" then cfg.color.hover = {.5,.5,0,.75} end -- ADDED BEACUSE NORMALY THE PRIEST COLOR IS THE SAME AS THE NORMAL COLOR cfg.text = { @@ -67,6 +74,7 @@ cfg.tradeSkill = { cfg.currency = { show = true, -- USES THIS MODULE showXPbar = true, -- SHOW A XP-BAR ON YOUR CHARACTERS THAT HAS NOT REACHED MAX LVL + showAPbar= true, showTooltip = true, -- SHOWS YOUR RECOURCES ACCORING TO THE DESCRIPTION OR YOUR XP INFO textOnRight = true, }