View Single Post
11-16-16, 04:47 AM   #31
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,324
You can try this. Be sure to add frame:EnableMouse(true) up where the frame is being set up to have it respond to mouse events.

Lua Code:
  1. frame:SetScript("OnEvent", function(self, event, ...)
  2.     local itemID, _, itemName, itemIcon, totalXP, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo()
  3.  
  4.     if itemID then
  5.         local pointsFree, xpToNextPoint = 0, C_ArtifactUI.GetCostForPointAtRank(pointsSpent);
  6.  
  7.         while totalXP >= xpToNextPoint do
  8.             totalXP, pointsSpent, pointsFree, xpToNextPoint = totalXP - xpToNextPoint, pointsSpent + 1, pointsFree + 1, C_ArtifactUI.GetCostForPointAtRank(pointsSpent + 1);
  9.         end
  10.         text:SetFormattedText("AP |cff00ff00%d/%d (%.1f%%)|r" .. (pointsFree > 0 and " (+%d)" or ""), totalXP, xpToNextPoint, 100 * totalXP / xpToNextPoint, pointsFree);
  11.     end
  12.  
  13.     frame:SetShown(itemID and true or false);
  14. end);
  15.  
  16. frame:SetScript("OnEnter", function(self)
  17.     local _, _, itemName = C_ArtifactUI.GetEquippedArtifactInfo()
  18.     local _, akLevel = GetCurrencyInfo(1171);
  19.  
  20.     GameTooltip:SetOwner(self, "ANCHOR_BOTTOM");
  21.     GameTooltip:SetText(itemName);
  22.     if akLevel > 0 then
  23.         GameTooltip:AddLine(string.format("Artifact Knowledge |cff00ff00%d (+%d%%)|r",akLevel,akMulti[akLevel] or 0));
  24.     end
  25.     GameTooltip:Show();
  26. end);
  27.  
  28. frame:SetScript("OnLeave", function(self) GameTooltip:Hide(); end);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote