Quantcast

Added rules for the base stats

Kevin Lyles [02-19-10 - 02:05]
Added rules for the base stats
Filename
Regexps.lua
diff --git a/Regexps.lua b/Regexps.lua
index 70c8820..08af0a4 100644
--- a/Regexps.lua
+++ b/Regexps.lua
@@ -95,6 +95,13 @@ function WeightsWatcher.singleStatValueOnly(text, pattern, name)
 	end
 end

+function WeightsWatcher.statNumFirst(text, pattern)
+	local start, _, value, name = string.find(text, pattern)
+	if start then
+		return WeightsWatcher.newStatTable({[name] = tonumber(value)})
+	end
+end
+
 function WeightsWatcher.newStatTable(tbl)
 	return setmetatable(tbl or {}, ww_normalStatsMetatable)
 end
@@ -197,6 +204,11 @@ MultipleStatLines = {
 }

 SingleStatLines = {
+	{"^([+-]?%d+) (agility)$", WeightsWatcher.statNumFirst},
+	{"^([+-]?%d+) (intellect)$", WeightsWatcher.statNumFirst},
+	{"^([+-]?%d+) (spirit)$", WeightsWatcher.statNumFirst},
+	{"^([+-]?%d+) (stamina)$", WeightsWatcher.statNumFirst},
+	{"^([+-]?%d+) (strength)$", WeightsWatcher.statNumFirst},
 	{"^%((%d+%.?%d*) damage per second%)$",
 		function(text, pattern)
 			return WeightsWatcher.singleStatValueOnly(text, pattern, "dps")