From dce6f3e24481226e2f94e091a1818612bdf31064 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Thu, 17 Sep 2009 02:36:19 -0500 Subject: [PATCH] Handle socket bonuses separately from the rest of the stats --- Regexps.lua | 2 ++ WeightsWatcher.lua | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Regexps.lua b/Regexps.lua index bb90a8e..97ea7cf 100644 --- a/Regexps.lua +++ b/Regexps.lua @@ -40,6 +40,8 @@ IgnoredLines = { "^Requires %a[%a ]+ %- Exalted$", } +socketBonus = "^Socket Bonus: (.*)" + MultipleStatLines = { {" and ", function(text) diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua index 78530bd..e694f43 100644 --- a/WeightsWatcher.lua +++ b/WeightsWatcher.lua @@ -68,7 +68,7 @@ end function WeightsWatcher:displayItemStats(tooltip, ttname) local itemType, ttleft, ttright, origTextL, textL, textR, pattern, func, stat, start -- Stats tables: normal stats, socket bonus, gem-given stats, current stat table - local normalStats, gemStats, statTable = {}, {} + local normalStats, socketBonusStat, gemStats, statTable = {}, {}, {} local _, link = tooltip:GetItem() if link == nil then @@ -90,7 +90,15 @@ function WeightsWatcher:displayItemStats(tooltip, ttname) textR = ttright:GetText() textL = WeightsWatcher:preprocess(origTextL) - statTable = normalStats + -- Determine which table this line of stats should go in + -- TODO: add the other two types + start, _, value = string.find(textL, socketBonus) + if start then + textL = value + statTable = socketBonusStat + else + statTable = normalStats + end matched = false for _, regex in pairs(IgnoredLines) do @@ -145,6 +153,13 @@ function WeightsWatcher:displayItemStats(tooltip, ttname) for _, stat in pairs(normalStats) do tooltip:AddDoubleLine(unpack(stat)) end + if #(socketBonusStat) > 0 then + tooltip:AddLine("Socket Bonus:") + for _, stat in pairs(socketBonusStat) do + name, value = unpack(stat) + tooltip:AddDoubleLine(" " .. name, value) + end + end if #(gemStats) > 0 then tooltip:AddLine("Gem Stats:") for _, stat in pairs(gemStats) do -- 1.7.9.5