View Single Post
12-16-16, 06:37 AM   #4
Lolzen
An Aku'mai Servant
 
Lolzen's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 36
I'm just doing it like this.

Code:
-- get artifact power data
function afbar:ARTIFACT_XP_UPDATE()
	local hasArtifact = HasArtifactEquipped("player")
	if hasArtifact then
		local _, _, _, _, totalXP, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo()
		local numPoints, artifactXP, xpForNextPoint = MainMenuBar_GetNumArtifactTraitsPurchasableFromXP(pointsSpent, totalXP)
		afbar:SetMinMaxValues(0, xpForNextPoint)
		afbar:SetValue(artifactXP)
		afbar:SetAlpha(0.4)
		xptext:SetFormattedText("%d / %d (%.0f%%)", artifactXP, xpForNextPoint, artifactXP/xpForNextPoint*100)
	else
		afbar:SetAlpha(0)
	end
end
afbar.PLAYER_ENTERING_WORLD = afbar.ARTIFACT_XP_UPDATE
afbar.UNIT_INVENTORY_CHANGED = afbar.ARTIFACT_XP_UPDATE
So whenever you change the artifact or login/at loading screen ARTIFACT_XP_UPDATE is called regardless.

take a look here
  Reply With Quote