From 21a324d184e67f80b68dd58c787a04906bf7f0df Mon Sep 17 00:00:00 2001 From: Darth Predator Date: Sun, 7 May 2017 16:43:27 +0300 Subject: [PATCH] Fix the fix for the fix :D AP calculation updated --- .../Armory/CharacterArmory/CharacterArmory.lua | 19 ++++++--------- ElvUI_SLE/modules/bags/artifactpower.lua | 25 +++++++++----------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua b/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua index 612fe76..a7fdf06 100644 --- a/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua +++ b/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua @@ -34,6 +34,7 @@ local C_TransmogCollection_GetIllusionSourceInfo = C_TransmogCollection.GetIllus local AnimatedNumericFontStringMixin = AnimatedNumericFontStringMixin local format = format +local AP_NAME = format("%s|r", ARTIFACT_POWER) -------------------------------------------------------------------------------- --<< KnightFrame : Upgrade Character Frame's Item Info like Wow-Armory >>-- @@ -769,7 +770,7 @@ function CA:Update_Gear() if Prof2 and Info.Armory_Constants.ProfessionList[Prof2] then self.PlayerProfession[(Info.Armory_Constants.ProfessionList[Prof2].Key)] = Prof2_Level end ]] local ErrorDetected, NeedUpdate, NeedUpdateList, R, G, B - local Slot, ItemLink, ItemData, BasicItemLevel, TrueItemLevel, ItemUpgradeID, CurrentUpgrade, MaxUpgrade, ItemType, UsableEffect, CurrentLineText, GemID, GemLink, GemTexture, GemCount_Default, GemCount_Now, GemCount, IsTransmogrified + local Slot, ItemLink, ItemData, BasicItemLevel, TrueItemLevel, ItemUpgradeID, CurrentUpgrade, MaxUpgrade, ItemType, UsableEffect, CurrentLineText, GemID, GemLink, GemTexture, GemCount_Default, GemCount_Now, GemCount, ItemTexture, IsTransmogrified Artifact_ItemID, _, _, _, Artifact_Power, Artifact_Rank = C_ArtifactUI.GetEquippedArtifactInfo() if self.ArtifactMonitor and not self.ArtifactMonitor.Socket1 then CA:ConstructArtSockets() end @@ -1152,15 +1153,9 @@ do --<< Artifact Monitor >> ["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, + ["zhCN"] = "(%d*[%p%s]?%d+)万", } local apStringValueMillionLocal = apStringValueMillion[GetLocale()] - local apValueMultiplierLocal = (apValueMultiplier[GetLocale()] or 1e6) --Fallback to 1e6 which is used by all non-asian clients local empoweringSpellName = GetSpellInfo(227907) function CA:LegionArtifactMonitor_UpdateLayout() @@ -1350,17 +1345,17 @@ do --<< Artifact Monitor >> local success = pcall(self.ArtifactMonitor.ScanTT.SetHyperlink, self.ArtifactMonitor.ScanTT, PowerItemLink) if success then local apFound - for i = 5, 1, -1 do + for i = 3, 7 do local tooltipText = _G["Knight_CharacterArmory_ArtifactScanTTTextLeft"..i]:GetText() - if tooltipText then + if (tooltipText and not T.match(tooltipText, AP_NAME)) then local digit1, digit2, digit3, ap local value = T.match(tooltipText, apStringValueMillionLocal) if value then digit1, digit2 = T.match(value, "(%d+)[%p%s](%d+)") if digit1 and digit2 then - ap = T.tonumber(T.format("%s.%s", digit1, digit2)) * apValueMultiplierLocal --Multiply by 1 million (or 10.000 for asian clients) + ap = T.tonumber(T.format("%s.%s", digit1, digit2)) * 1e6 --Multiply by one million else - ap = T.tonumber(value) * apValueMultiplierLocal --Multiply by 1 million (or 10.000 for asian clients) + ap = T.tonumber(value) * 1e6 --Multiply by one million end else digit1, digit2, digit3 = T.match(tooltipText,"(%d+)[%p%s]?(%d+)[%p%s]?(%d+)") diff --git a/ElvUI_SLE/modules/bags/artifactpower.lua b/ElvUI_SLE/modules/bags/artifactpower.lua index 0a67127..48d6b46 100644 --- a/ElvUI_SLE/modules/bags/artifactpower.lua +++ b/ElvUI_SLE/modules/bags/artifactpower.lua @@ -1,14 +1,17 @@ local SLE, T, E, L, V, P, G = unpack(select(2, ...)) local AP = SLE:NewModule("ArtifactPowerBags", 'AceHook-3.0', 'AceEvent-3.0') local B = E:GetModule('Bags') + +--GLOBALS: CreateFrame, hooksecurefunc local _G = _G local tooltipScanner local tooltipName = "SLE_ArtifactPowerTooltipScanner" local EMPOWERING_SPELL_ID = 227907 local empoweringSpellName local arcanePower -local AP_NAME = T.format("|cFFE6CC80%s|r", ARTIFACT_POWER) +local AP_NAME = format("%s|r", ARTIFACT_POWER) local pcall = pcall +local GetItemSpell = GetItemSpell -- local apLineIndex local apItemCache = {} @@ -26,13 +29,7 @@ local apStringValueMillion = { ["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 local function GetItemLinkArtifactPower(slotLink) local apValue if not slotLink then return nil end @@ -45,18 +42,18 @@ local function GetItemLinkArtifactPower(slotLink) end local apFound - for i = 5, 1, -1 do + for i = 3, 7 do local tooltipText = _G[tooltipName.."TextLeft"..i]:GetText() - if tooltipText then + if (tooltipText and not T.match(tooltipText, AP_NAME)) then local digit1, digit2, digit3, ap local value = T.match(tooltipText, apStringValueMillionLocal) if value then digit1, digit2 = T.match(value, "(%d+)[%p%s](%d+)") if digit1 and digit2 then - ap = T.tonumber(T.format("%s.%s", digit1, digit2)) * apValueMultiplierLocal --Multiply by 1 million (or 10.000 for asian clients) + ap = T.tonumber(T.format("%s.%s", digit1, digit2)) * 1e6 --Multiply by one million else - ap = T.tonumber(value) * apValueMultiplierLocal --Multiply by 1 million (or 10.000 for asian clients) + ap = T.tonumber(value) * 1e6 --Multiply by one million end else digit1, digit2, digit3 = T.match(tooltipText,"(%d+)[%p%s]?(%d+)[%p%s]?(%d+)") @@ -102,7 +99,7 @@ local function SlotUpdate(self, bagID, slotID) frame.artifactpowerinfo:SetTextColor(r, g, b) if (frame.artifactpowerinfo) then - local ID = select(10, T.GetContainerItemInfo(bagID, slotID)) + local ID = T.select(10, T.GetContainerItemInfo(bagID, slotID)) local slotLink = T.GetContainerItemLink(bagID,slotID) if (ID and slotLink) then local arcanePower @@ -128,10 +125,10 @@ function AP:Initialize() tooltipScanner = CreateFrame("GameTooltip", tooltipName, nil, "GameTooltipTemplate") tooltipScanner:SetOwner(E.UIParent, "ANCHOR_NONE") - empoweringSpellName = GetSpellInfo(EMPOWERING_SPELL_ID) + empoweringSpellName = T.GetSpellInfo(EMPOWERING_SPELL_ID) hooksecurefunc(B,"UpdateSlot", SlotUpdate) - hooksecurefunc(ElvUI_ContainerFrame,"UpdateSlot", SlotUpdate) + hooksecurefunc(_G["ElvUI_ContainerFrame"],"UpdateSlot", SlotUpdate) self:RegisterEvent("BANKFRAME_OPENED", function() AP:UnregisterEvent("BANKFRAME_OPENED") B:Layout() -- 1.7.9.5