Quantcast

Added patterns for "all stats" and "all resistances"

Kevin Lyles [02-19-10 - 02:23]
Added patterns for "all stats" and "all resistances"
added above to the invalid stat ignore list
Preliminary support for properly scoring said patterns
Filename
Regexps.lua
WeightsWatcher.lua
diff --git a/Regexps.lua b/Regexps.lua
index c5427af..5955ec9 100644
--- a/Regexps.lua
+++ b/Regexps.lua
@@ -96,6 +96,8 @@ Preprocess = {
 ignoredInvalidStats = {
 	"item level",
 	"requires level",
+	"all stats",
+	"all resistances",
 }

 IgnoredLines = {
@@ -201,6 +203,16 @@ SingleStatLines = {
 			return WeightsWatcher.singleStatValueOnly(text, pattern, "dps")
 		end
 	},
+	{"^([+-]?%d+) resist all$",
+		function(text, pattern)
+			return WeightsWatcher.singleStatValueOnly(text, pattern, "all resistances")
+		end},
+	{"^([+-]?%d+) resistance to all schools of magic$",
+		function(text, pattern)
+			return WeightsWatcher.singleStatValueOnly(text, pattern, "all resistances")
+		end},
+	{"^([+-]?%d+) (all stats)$", WeightsWatcher.statNumFirst},
+	{"^([+-]?%d+) to (all stats)$", WeightsWatcher.statNumFirst},
 }

 ItemInfoLines = {
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index f3d321d..ffe8f40 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -848,6 +848,16 @@ function WeightsWatcher.calculateWeight(normalStats, socketBonusActive, socketBo
 	for stat, value in pairs(normalStats) do
 		weight = weight + WeightsWatcher.getWeight(stat, value, weightsScale)
 	end
+	if normalStats["all stats"] and not weightsScale["all stats"] then
+		for _, stat in pairs({"agility", "intellect", "spirit", "stamina", "strength"}) do
+			weight = weight + WeightsWatcher.getWeight(stat, normalStats["all stats"], weightsScale)
+		end
+	end
+	if normalStats["all resistances"] and not weightsScale["all resistances"] then
+		for _, school in pairs({"arcane", "fire", "frost", "nature", "shadow"}) do
+			weight = weight + WeightsWatcher.getWeight(school .. " resistance", normalStats["all resistances"], weightsScale)
+		end
+	end
 	if socketBonusActive and socketBonusStat then
 		for stat, value in pairs(socketBonusStat) do
 			weight = weight + WeightsWatcher.getWeight(stat, value, weightsScale)
@@ -860,6 +870,16 @@ function WeightsWatcher.calculateWeight(normalStats, socketBonusActive, socketBo
 			for stat, value in pairs(gemInfo[3]) do
 				weight = weight + WeightsWatcher.getWeight(stat, value, weightsScale)
 			end
+			if gemInfo[3]["all stats"] and not weightsScale["all stats"] then
+				for _, stat in pairs({"agility", "intellect", "spirit", "stamina", "strength"}) do
+					weight = weight + WeightsWatcher.getWeight(stat, gemInfo[3]["all stats"], weightsScale)
+				end
+			end
+			if gemInfo[3]["all resistances"] and not weightsScale["all resistances"] then
+				for _, school in pairs({"arcane", "fire", "frost", "nature", "shadow"}) do
+					weight = weight + WeightsWatcher.getWeight(school .. " resistance", gemInfo[3]["all resistances"], weightsScale)
+				end
+			end
 			if weight > maxWeight then
 				maxWeight = weight
 			end