AP displays not correctly
Yasinahh opened this issue · 3 comments
Hi, iam using Experiencer for my artifct weapon but it dont displays all artifact powers in my bag.
and then it displays "wrong".... when i have 4,1 million AP in my bag it shows only "41"
what can i do?
This is a known error due to new wording on the AP tokens. Previously they only had the number but now they say number + "millions" and the way the addon parses the number from tooltip text causes it to trip up.
I have no estimate when I can get around to fixing this since I do not have an active subscription at the moment.
you can use follow ElvUI Snippet:
artifact.lua under modules folder
change to part after local ExperiencerAPScannerTooltip to:
local apStringValueMillion = {
["enUS"] = "(%d*[%p%s]?%d+) million",
["enGB"] = "(%d*[%p%s]?%d+) million",
["ptBR"] = "(%d*[%p%s]?%d+) [[milhão][milhões]]?",
["esMX"] = "(%d*[%p%s]?%d+) [[millón][millones]]?",
["deDE"] = "(%d*[%p%s]?%d+) [[Million][Millionen]]?",
["esES"] = "(%d*[%p%s]?%d+) [[millón][millones]]?",
["frFR"] = "(%d*[%p%s]?%d+) [[million][millions]]?",
["itIT"] = "(%d*[%p%s]?%d+) [[milione][milioni]]?",
["ruRU"] = "(%d*[%p%s]?%d+) млн",
["koKR"] = "(%d*[%p%s]?%d+)만",
["zhTW"] = "(%d*[%p%s]?%d+)萬",
["zhCN"] = "(%d*[%p%s]?%d+) 万",
}
local apValueMultiplier = {
["koKR"] = 1e4,
["zhTW"] = 1e4,
["zhCN"] = 1e4,
}
local apStringValueMillionLocal = apStringValueMillion[GetLocale()]
local apValueMultiplierLocal = (apValueMultiplier[GetLocale()] or 1e6) --Fallback to 1e6 which is used by all non-asian clients
function module:FindPowerItemsInInventory()
local powers = {};
local totalPower = 0;
local spellName = GetSpellInfo(EMPOWERING_SPELL_ID);
for container = 0, NUM_BAG_SLOTS do
local numSlots = GetContainerNumSlots(container);
for slot = 1, numSlots do
local link = GetContainerItemLink(container, slot);
if(link and GetItemSpell(link) == spellName) then
ExperiencerAPScannerTooltip:SetOwner(UIParent, "ANCHOR_NONE");
ExperiencerAPScannerTooltip:SetHyperlink(link);
local tooltipText = ExperiencerAPScannerTooltipTextLeft4:GetText();
if(tooltipText) then
local digit1, digit2, digit3, power
local value = strmatch(tooltipText, apStringValueMillionLocal)
if (value) then
digit1, digit2 = strmatch(value, "(%d+)[%p%s](%d+)")
if (digit1 and digit2) then
power = tonumber(format("%s.%s", digit1, digit2)) * apValueMultiplierLocal --Multiply by 1 million (or 10.000 for asian clients)
else
power = tonumber(value) * apValueMultiplierLocal --Multiply by 1 million (or 10.000 for asian clients)
end
else
digit1, digit2, digit3 = strmatch(tooltipText,"(%d+)[%p%s]?(%d+)[%p%s]?(%d*)")
power = tonumber(format("%s%s%s", digit1 or "", digit2 or "", (digit2 and digit3) and digit3 or ""))
end
if(power) then
totalPower = totalPower + power;
tinsert(powers, {
link = link,
power = power,
});
end
end
end
end
end
return totalPower, powers;
end
function module:GetItemArtifactPower(link)
if(not link) then return nil end
ExperiencerAPScannerTooltip:SetOwner(UIParent, "ANCHOR_NONE");
ExperiencerAPScannerTooltip:SetHyperlink(link);
local tooltipText = ExperiencerAPScannerTooltipTextLeft4:GetText();
if(not tooltipText) then return nil end
local digit1, digit2, digit3, power
local value = strmatch(tooltipText, apStringValueMillionLocal)
if (value) then
digit1, digit2 = strmatch(value, "(%d+)[%p%s](%d+)")
if (digit1 and digit2) then
power = tonumber(format("%s.%s", digit1, digit2)) * apValueMultiplierLocal --Multiply by 1 million (or 10.000 for asian clients)
else
power = tonumber(value) * apValueMultiplierLocal --Multiply by 1 million (or 10.000 for asian clients)
end
else
digit1, digit2, digit3 = strmatch(tooltipText,"(%d+)[%p%s]?(%d+)[%p%s]?(%d*)")
power = tonumber(format("%s%s%s", digit1 or "", digit2 or "", (digit2 and digit3) and digit3 or ""))
end
if(power) then
return power;
end
return nil;
end