From 02d6f215e9b942a2aaac731b47cc9bf1ba5ab7bc Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Thu, 18 Feb 2010 20:23:45 -0600 Subject: [PATCH] Added patterns for "all stats" and "all resistances" added above to the invalid stat ignore list Preliminary support for properly scoring said patterns --- Regexps.lua | 12 ++++++++++++ WeightsWatcher.lua | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) 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 -- 1.7.9.5