Quantcast

Added ignore/unparsed instrumentation

Kevin Lyles [01-26-10 - 18:48]
Added ignore/unparsed instrumentation
Filename
Regexps.lua
WeightsWatcher.lua
diff --git a/Regexps.lua b/Regexps.lua
index c2d43da..6c27f9e 100644
--- a/Regexps.lua
+++ b/Regexps.lua
@@ -20,28 +20,39 @@ Preprocess = {
 	["block$"] = "block value",
 }

+ignoredInvalidStats = {
+	"item level",
+	"requires level",
+}
+
 IgnoredLines = {
 	"^durability %d+ / %d+$",
 	"^<.+>$",
 	"^\".+\"$",
+	"^you may trade this item with players that were also eligible to loot this item for the next ",
+	"^ $",
+	"^requires %a[%a ]+ %- neutral$",
+	"^requires %a[%a ]+ %- friendly$",
+	"^requires %a[%a ]+ %- honored$",
+	"^requires %a[%a ]+ %- revered$",
+	"^requires %a[%a ]+ %- exalted$",
+	"^use: teaches you how to ",
+}
+
+TempIgnoredLines = {
 	"^use: restores %d+ %a[%a ]+ over %d+ sec%.  must remain seated while %a+ing%.",
 	"^use: restores %d+%% of your %a[%a ]+ per second for %d+ sec%.  must remain seated while %a+ing%.",
 	"^use: heals %d+ damage over %d+ sec%.$",
 	"^use: restores %d+ to %d+ %a+",
+}
+
+UnweightedLines = {
 	-- Some relics that boost stats for certain abilities only
 	"^equip: increases the %a[%a ]+ of your %a[%a ]+ by ",
 	-- Use effects that have a cooldown
 	"cooldown",
 	-- "Chance on hit" and "have a chance"
 	"chance ",
-	"^you may trade this item with players that were also eligible to loot this item for the next ",
-	"^ $",
-	"^requires %a[%a ]+ %- neutral$",
-	"^requires %a[%a ]+ %- friendly$",
-	"^requires %a[%a ]+ %- honored$",
-	"^requires %a[%a ]+ %- revered$",
-	"^requires %a[%a ]+ %- exalted$",
-	"^use: teaches you how to ",
 }

 socketBonus = "^socket bonus: (.*)"
@@ -149,9 +160,10 @@ SingleSlotLines = {
 	"^held in off%-hand$",
 }

-function WeightsWatcher.multipleStats(text, link)
+function WeightsWatcher.multipleStats(text)
 	local stat, stringTable
 	local stats = WeightsWatcher.newStatTable()
+	local origText = text

 	start, _, value = string.find(text, " and %a[%a ]+ by (%d+)%.")
 	if start then
@@ -167,6 +179,8 @@ function WeightsWatcher.multipleStats(text, link)
 		stat = WeightsWatcher.singleStat(statString)
 		if stat then
 			stats = stats + stat
+		else
+			ww_unparsed_lines[origText] = true
 		end
 	end
 	-- Don't return an empty table
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index 5c1d0ea..54679f4 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -906,6 +906,13 @@ function WeightsWatcher.parseLine(textL, textR, link)
 	end
 	for _, regex in ipairs(IgnoredLines) do
 		if string.find(textL, regex) then
+			ww_ignored_lines[textL][regex] = true
+			return
+		end
+	end
+	for _, regex in ipairs(TempIgnoredLines) do
+		if string.find(textL, regex) then
+			ww_temp_ignored_lines[textL][regex] = true
 			return
 		end
 	end
@@ -940,6 +947,13 @@ function WeightsWatcher.parseLine(textL, textR, link)
 	if stat then
 		return stat
 	end
+	for _, regex in ipairs(UnweightedLines) do
+		if string.find(textL, regex) then
+			ww_unweighted_lines[textL][regex] = true
+			return
+		end
+	end
+	ww_unparsed_lines[textL] = true
 end

 function WeightsWatcher.getItemStats(link)