I'm Trying to make an addon that can return to me values of how much total artifact power I have across all my weapons on a given character, however I want to use the LibArtifact addon information in order to return these values (since from what I gather without using anything else you can only return information on one weapon at a time). If anyone can help me with this i'd be very appreciative. I am fairly new to this stuff and this is the first time I've really ever tried. If I need to put some code snippets up for what I have so far, just let me know and I can.
Thanks ahead of time!
Main.lua
Code:
local PaenitetTotalArtifactPower = CreateFrame("frame","PaenitetTotalArtifactPowerFrame",UIParent)
PaenitetTotalArtifactPower:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end)
local multiplier = {100, 400, 725, 1075, 1450, 1850, 2275, 2725, 3250, 3875, 4625, 5500, 6500, 13340, 22170, 33450, 47850, 66470, 90470, 121070, 160590, 211470, 276270, 358770, 464050, 602700, 785480, 1026350, 1341870, 1759430, 2305430, 3023630, 3970290, 5216130, 6851330, 8766330, 10776330, 12886330, 15101330, 17426330, 19866330, 22426330, 25116330, 27941330, 30906330, 34021330, 37291330, 40726330, 44331330, 48116330, 52091330, 56266330, 60651330, 65256330}
local function GetArtifactPower()
local total = 0
if HasArtifactEquipped() then
powerAvailable = select(5, C_ArtifactUI.GetEquippedArtifactInfo())
ranksPurchased = select(6, C_ArtifactUI.GetEquippedArtifactInfo())
total = powerAvailable + multiplier[ranksPurchased]
DEFAULT_CHAT_FRAME:AddMessage("|cffFF6EB4PaenitetTotalArtifactPower|r")
DEFAULT_CHAT_FRAME:AddMessage("|cff00ccffRanks Purchased:|r "..tostring(ranksPurchased).." |cff3587ff(does not include relics)|r")
DEFAULT_CHAT_FRAME:AddMessage("|cff00ccffPower Available:|r "..tostring(powerAvailable))
DEFAULT_CHAT_FRAME:AddMessage("|cff00ccffPower Spent On Ranks:|r "..tostring(multiplier[ranksPurchased]))
DEFAULT_CHAT_FRAME:AddMessage("|cffFF6EB4Total Power On Artifact:|r "..tostring(total))
else
DEFAULT_CHAT_FRAME:AddMessage("|cFF99CC33PaenitetTotalArtifactPower:|r No artifact equipped")
end
end
function PaenitetTotalArtifactPower:PLAYER_LOGIN()
SLASH_PAENITETTOTALARTIFACTPOWER1 = "/ptap"
SlashCmdList["PAENITETTOTALARTIFACTPOWER"] = function(msg)
GetArtifactPower()
end
local ver = GetAddOnMetadata("PaenitetTotalArtifactPower","Version") or '1.0'
DEFAULT_CHAT_FRAME:AddMessage(string.format("|cFF99CC33%s|r [v|cFFDF2B2B%s|r] Loaded /ptap", "PaenitetTotalArtifactPower", ver or "1.0"))
end
if IsLoggedIn() then PaenitetTotalArtifactPower:PLAYER_LOGIN() else PaenitetTotalArtifactPower:RegisterEvent("PLAYER_LOGIN") end