MilleXIV / XIV_Databar

19 stars 19 forks source link

2.05 Artifact Tooltip Error #54

Open Vegeir opened 7 years ago

Vegeir commented 7 years ago

Something is wrong with the Artifact Knowledge tooltip. I looked through the LibArtifactData-1.0 GitHub as well but I am not sure whether it is his code or yours.

Here are two examples. The first with my Hunter at AK Rank 1 (25% boost) and the second with him at AK Rank 2 (50% boost):

arti_xp_question1 arti_xp_question2

I reviewed the LAD documentation:

:GetArtifactKnowledge()

Returns the artifact knowledge level and multiplier. Those are shared among all artifacts.

knowledgeLevel (number) knowledgeMultiplier (number) - use (knowledgeMultiplier) - 1 * 100 for a percent value

The issue is either with the logic starting at line 471 of your talent.lua or with the LAD function itself.

if self.curArtifactId > 0 then
    GameTooltip:AddLine(" ")
    local _, artifactData = self.LAD:GetArtifactInfo(self.curArtifactId)
    local knowLevel, knowMult = self.LAD:GetArtifactKnowledge()
    if knowLevel > 0 then
      GameTooltip:AddDoubleLine(L['Artifact Knowledge']..':', string.format('%d (x%d)', knowLevel, ((knowMult) - 1 * 100)), 1, 1, 0, 1, 1, 1)
      GameTooltip:AddLine(" ")
    end
    GameTooltip:AddDoubleLine(ARTIFACT_POWER..':', string.format('%d / %d (%d%%)', artifactData.power, artifactData.maxPower, floor((artifactData.power / artifactData.maxPower) * 100)), 1, 1, 0, 1, 1, 1)
    GameTooltip:AddDoubleLine(L['Remaining']..':', string.format('%d (%d%%)', artifactData.powerForNextRank, floor((artifactData.powerForNextRank / artifactData.maxPower) * 100)), 1, 1, 0, 1, 1, 1)
    if artifactData.numRanksPurchasable > 0 then
      GameTooltip:AddDoubleLine(L['Available Ranks']..':', string.format('%d', artifactData.numRanksPurchasable), 1, 1, 0, 1, 1, 1)
    end
  end

The math calling the percentage boost still didn't look right but I tested by changing line 476 to read:

GameTooltip:AddDoubleLine(L['Artifact Knowledge']..':', string.format('%d (%d%%)', knowLevel, ((knowMult) - 1 * 100)), 1, 1, 0, 1, 1, 1)

This fixed the (x-98) to display a percentage, but as I suspected the "-98" value was what the function was returning:

arti_xp_question3

Here is a link to a table published with the proper values (FYI only):

[http://www.wowhead.com/guides/legion/artifact-weapons#knowledge]

I am very new to Lua programming but I don't understand how you are getting the knowLevel and knowMult values from the LAD function call when the author's values are locally defined (in his Lua file) as lvl and mult respecitvely.

At any rate, sorry for the long post but I wanted you to see what I was looking at. I have to run for a bit but I'll check in later.

Thanks in advance!

lucasvienna commented 7 years ago

I was looking at the same exact thing, and I can't seem to get the KnowMult from anywhere. The blizz function appears to be hidden, and the LAD guy catches things when the artifact updates.

If you look at the ((knowMult) - 1 * 100)) part of the code, you can see where the -98 comes from. What I don't get then, is why knowMult AND knowLevel are booth returning as 2.

EDIT: Looking at the blizz ArtifactUI.lua, here is their thingie for the Knowledge Multiplier:

local knowledgeLevel = C_ArtifactUI.GetArtifactKnowledgeLevel();
  if knowledgeLevel and knowledgeLevel > 0 then
    local knowledgeMultiplier = C_ArtifactUI.GetArtifactKnowledgeMultiplier();
    local percentIncrease = math.floor(((knowledgeMultiplier - 1.0) * 100) + .5);
    if percentIncrease > 0.0 then
      if addedAnyMetaPowers then
        GameTooltip:AddLine(" ");
      end

      GameTooltip:AddLine(ARTIFACTS_KNOWLEDGE_TOOLTIP_LEVEL:format(knowledgeLevel), HIGHLIGHT_FONT_COLOR:GetRGB());
      GameTooltip:AddLine(ARTIFACTS_KNOWLEDGE_TOOLTIP_DESC:format(BreakUpLargeNumbers(percentIncrease)), NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true);
    end
  end

Calling C_ArtifactUI.GetArtifactKnowledgeLevel() results in a nill return. Which is what the library guy mentioned and said he uses the UPDATE call to get the knowMult