After my "epiphany" yesterday when going to bed, I got to think that Lombra was most probably right when saying the best way in this case would be to just do those 1 or 2 lines again since it was just that pretty much.
I did this before I saw your post.
Lua Code:
local akMulti = {
25, 50, 90, 140, 200,
275, 375, 500, 650, 850,
1100, 1400, 1775, 2250, 2850,
3600, 4550, 5700, 7200, 9000,
11300, 14200, 17800, 22300, 24900
};
local frame = CreateFrame("Frame", "m4xArtifactFrame", UIParent);
local text = frame:CreateFontString(nil, "ARTWORK");
text:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE");
text:SetJustifyH("LEFT");
text:SetTextColor(1, 0.82, 0);
text:SetPoint("TOPLEFT", UIParent, "TOPLEFT");
text:SetText("Initializing...");
frame:SetAllPoints(text);
frame:RegisterEvent("PLAYER_ENTERING_WORLD");
frame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED");
frame:RegisterEvent("ARTIFACT_CLOSE");
frame:RegisterEvent("ARTIFACT_RESPEC_PROMPT");
frame:RegisterEvent("ARTIFACT_XP_UPDATE");
frame:SetScript("OnEvent", function(self, event, ...)
local itemID, _, _, _, totalXP, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo()
if itemID then
local pointsFree, xpToNextPoint = 0, C_ArtifactUI.GetCostForPointAtRank(pointsSpent);
while totalXP >= xpToNextPoint do
totalXP, pointsSpent, pointsFree, xpToNextPoint = totalXP - xpToNextPoint, pointsSpent + 1, pointsFree + 1, C_ArtifactUI.GetCostForPointAtRank(pointsSpent + 1);
end
text:SetFormattedText("AP |cff00ff00%d/%d (%.1f%%)|r" .. (pointsFree > 0 and " (+%d)" or ""), totalXP, xpToNextPoint, 100 * totalXP / xpToNextPoint, pointsFree);
end
frame:SetShown(itemID and true or false);
end);
local function OnEnter(self)
local _, akLevel = GetCurrencyInfo(1171);
local _, _, itemName, itemIcon, _, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo()
local _, effectiveStat = UnitStat("player", 3);
GameTooltip:SetOwner(self, "ANCHOR_BOTTOM");
GameTooltip:SetText(itemName);
GameTooltip:AddLine(" ");
GameTooltip:AddLine(string.format("Artifact Knowledge Level: |cff00ff00%d (+%d%%)|r", akLevel, akMulti[akLevel] or 0));
GameTooltip:AddLine(string.format("Next Artifact Knowledge: |cff00ff00%d (+%d%%)|r", akLevel + 1, akMulti[akLevel + 1]));
GameTooltip:AddLine(" ");
GameTooltip:AddLine(string.format("Stamina from points: |cff00ff00+%g%% (+%d)|r", pointsSpent * 0.75, effectiveStat - (effectiveStat / ((pointsSpent * 0.75 / 100) + 1))));
GameTooltip:Show();
end
local function OnLeave(self)
GameTooltip:Hide();
end
frame:SetScript("OnEnter", OnEnter);
frame:SetScript("OnLeave", OnLeave);
You think it's not as "correct" as your example?
It's working perfectly as it is.
This is with mouseover obviously, mouse just doesn't show on the screenshot.
Don't have that
frame:EnableMouse(true), you think it's just enabled by default now or something?