Quantcast

Split non-stats (slot, uniqe, bingding info, etc) into separate storage

Kevin Lyles [12-19-09 - 08:29]
Split non-stats (slot, uniqe, bingding info, etc) into separate storage
Filename
Regexps.lua
WeightsWatcher.lua
diff --git a/Regexps.lua b/Regexps.lua
index b62664d..03afdc1 100644
--- a/Regexps.lua
+++ b/Regexps.lua
@@ -21,11 +21,6 @@ Preprocess = {
 }

 IgnoredLines = {
-	"^Soulbound$",
-	"^Binds when equipped$",
-	"^Binds when picked up$",
-	"^Binds when used$",
-	"^Binds to account$",
 	"^Durability %d+ / %d+$",
 	"^<.+>$",
 	"^\".+\"$",
@@ -119,6 +114,12 @@ SingleStatLines = {
 	"^(Requires %a[%a ]+) %((%d+)%)",
 }

+ItemInfoLines = {
+	"^Unique",
+	"^Binds ",
+	"^Soulbound$",
+}
+
 DoubleSlotLines = {
 	"^Head$",
 	"^Shoulder$",
@@ -139,7 +140,6 @@ DoubleSlotLines = {
 }

 SingleSlotLines = {
-	"^Unique$",
 	"^Neck$",
 	"^Back$",
 	"^Shirt$",
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index 3c1d7cb..4160d14 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -612,9 +612,9 @@ function WeightsWatcher.displayItemStats(tooltip, ttname)

 		if ttname == "GameTooltip" and ww_vars.options.tooltip.showDifferences then
 			local currentSlot, compareSlot, compareSlot2, currentSubslot, compareSubslot, compareSubslot2
-			currentSlot = ww_bareItemCache[bareLink].normalStats["Slot"]
+			currentSlot = ww_bareItemCache[bareLink].nonStats["Slot"]
 			if currentSlot and currentSlot ~= 0 then
-				currentSubslot = ww_bareItemCache[bareLink].normalStats["Subslot"]
+				currentSubslot = ww_bareItemCache[bareLink].nonStats["Subslot"]
 				local compareSlots = slotConversion[currentSlot]
 				if type(compareSlots) == "string" then
 					compareLink = GetInventoryItemLink("player", WeightsWatcher.slotList[compareSlots])
@@ -624,13 +624,13 @@ function WeightsWatcher.displayItemStats(tooltip, ttname)
 				end
 				if compareLink then
 					compareBareLink = splitItemLink(compareLink)
-					compareSlot = ww_bareItemCache[compareBareLink].normalStats["Slot"]
-					compareSubslot = ww_bareItemCache[compareBareLink].normalStats["Subslot"]
+					compareSlot = ww_bareItemCache[compareBareLink].nonStats["Slot"]
+					compareSubslot = ww_bareItemCache[compareBareLink].nonStats["Subslot"]
 				end
 				if compareLink2 then
 					compareBareLink2 = splitItemLink(compareLink2)
-					compareSlot2 = ww_bareItemCache[compareBareLink2].normalStats["Slot"]
-					compareSubslot2 = ww_bareItemCache[compareBareLink2].normalStats["Subslot"]
+					compareSlot2 = ww_bareItemCache[compareBareLink2].nonStats["Slot"]
+					compareSubslot2 = ww_bareItemCache[compareBareLink2].nonStats["Subslot"]
 				end
 				compareMethod = determineCompareMethod(currentSlot, compareSlot, compareSlot2, currentSubslot, compareSubslot, compareSubslot2)
 			end
@@ -896,7 +896,7 @@ end

 function WeightsWatcher.getItemStats(link)
 	local ttleft, ttright, origTextL, textL, textR, pattern, func, start
-	local normalStats, socketList, socketBonusStat = WeightsWatcher.newStatTable(), {}
+	local normalStats, nonStats, socketList, socketBonusStat = WeightsWatcher.newStatTable(), {}, {}
 	local ranged = false

 	-- Populate hidden tooltip
@@ -940,41 +940,50 @@ function WeightsWatcher.getItemStats(link)
 					end
 				end
 				if not matched then
-					for _, regex in ipairs(DoubleSlotLines) do
+					for _, regex in ipairs(ItemInfoLines) do
 						if string.find(textL, regex) then
 							matched = true
-							normalStats["Slot"] =  textL
-							normalStats["Subslot"] = textR
-							if textL == "Ranged" or textL == "Projectile" then
-								ranged = true
-							end
+							nonStats[textL] =  true
 							break
 						end
 					end
 					if not matched then
-						for _, regex in ipairs(SingleSlotLines) do
+						for _, regex in ipairs(DoubleSlotLines) do
 							if string.find(textL, regex) then
 								matched = true
-								normalStats["Slot"] =  textL
+								nonStats["Slot"] =  textL
+								nonStats["Subslot"] = textR
+								if textL == "Ranged" or textL == "Projectile" then
+									ranged = true
+								end
 								break
 							end
 						end
 						if not matched then
-							for _, regex in ipairs(MultipleStatLines) do
-								pattern, func = unpack(regex)
-								if string.find(textL, pattern) then
-									statsList = func(textL, textR)
-									if statsList then
-										normalStats = normalStats + statsList
-										matched = true
-										break
-									end
+							for _, regex in ipairs(SingleSlotLines) do
+								if string.find(textL, regex) then
+									matched = true
+									nonStats["Slot"] =  textL
+									break
 								end
 							end
 							if not matched then
-								stat = WeightsWatcher.singleStat(textL)
-								if stat then
-									normalStats = normalStats + stat
+								for _, regex in ipairs(MultipleStatLines) do
+									pattern, func = unpack(regex)
+									if string.find(textL, pattern) then
+										statsList = func(textL, textR)
+										if statsList then
+											normalStats = normalStats + statsList
+											matched = true
+											break
+										end
+									end
+								end
+								if not matched then
+									stat = WeightsWatcher.singleStat(textL)
+									if stat then
+										normalStats = normalStats + stat
+									end
 								end
 							end
 						end