From a84676f5c8b6af6528656b728137e9782664d823 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Sat, 19 Sep 2009 03:55:32 -0500 Subject: [PATCH] Parses a hidden tooltip for the stats instead of reading GameTooltip directly Removed marking of unrecognized lines (we'd be marking a hidden tooltip) --- HiddenTooltip.xml | 10 ++++++++++ WeightsWatcher.lua | 18 ++++++++++-------- WeightsWatcher.toc | 1 + 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 HiddenTooltip.xml diff --git a/HiddenTooltip.xml b/HiddenTooltip.xml new file mode 100644 index 0000000..9c3018f --- /dev/null +++ b/HiddenTooltip.xml @@ -0,0 +1,10 @@ + + + + + self:SetOwner(WorldFrame, "ANCHOR_NONE"); + + + + diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua index 58551af..7b19d85 100644 --- a/WeightsWatcher.lua +++ b/WeightsWatcher.lua @@ -77,7 +77,7 @@ function WeightsWatcher:displayItemStats(tooltip, ttname) _, _, _, _, _, itemType, _, stackSize = GetItemInfo(link) if (IsEquippableItem(link) and itemType ~= "Container" and itemType ~= "Quiver") or (itemType == "Gem" and stackSize == 1) or (itemType == "Consumable") or (itemType == "Recipe") then - normalStats, socketBonusStat = WeightsWatcher:getItemStats(link, tooltip, ttname) + normalStats, socketBonusStat = WeightsWatcher:getItemStats(link) for _, stat in pairs(normalStats) do tooltip:AddDoubleLine(unpack(stat)) end @@ -97,20 +97,24 @@ function WeightsWatcher:displayItemStats(tooltip, ttname) end end -function WeightsWatcher:getItemStats(link, tooltip, ttname) +function WeightsWatcher:getItemStats(link) local ttleft, ttright, origTextL, textL, textR, pattern, func, start local normalStats, socketBonusStat = {} + -- Populate hidden tooltip + WeightsWatcherHiddenTooltip:ClearLines() + WeightsWatcherHiddenTooltip:SetHyperlink(link) + -- Skip item name and "currently equipped" - if getglobal(ttname .. "TextLeft1"):GetText() == CURRENTLY_EQUIPPED then + if WeightsWatcherHiddenTooltipTextLeft1:GetText() == CURRENTLY_EQUIPPED then start = 3 else start = 2 end - for i = start, tooltip:NumLines() do - ttleft = getglobal(ttname .. "TextLeft" .. i) - ttright = getglobal(ttname .. "TextRight" .. i) + for i = start, WeightsWatcherHiddenTooltip:NumLines() do + ttleft = getglobal("WeightsWatcherHiddenTooltipTextLeft" .. i) + ttright = getglobal("WeightsWatcherHiddenTooltipTextRight" .. i) origTextL = ttleft:GetText() textR = ttright:GetText() textL = WeightsWatcher:preprocess(origTextL) @@ -163,8 +167,6 @@ function WeightsWatcher:getItemStats(link, tooltip, ttname) stat = WeightsWatcher:singleStat(textL) if stat then table.insert(normalStats, stat) - else - ttleft:SetText(origTextL .. " *") end end end diff --git a/WeightsWatcher.toc b/WeightsWatcher.toc index ae29aa9..fddfbde 100644 --- a/WeightsWatcher.toc +++ b/WeightsWatcher.toc @@ -15,5 +15,6 @@ Libs\AceEvent-2.0\AceEvent-2.0.lua Libs\AceHook-2.1\AceHook-2.1.lua Regexps.lua +HiddenTooltip.xml WeightsWatcher.lua WeightsWatcher.xml -- 1.7.9.5