Quantcast

Several parser updates

Kevin Lyles [01-09-11 - 14:33]
Several parser updates
Added melee critical strike rating
Updated version to 1.4r1
Filename
Locales/enUS/gems.lua
Locales/enUS/patterns-cooldown-use-effects.lua
Locales/enUS/patterns-elixirs.lua
Locales/enUS/patterns-enchants.lua
Locales/enUS/patterns-fishing.lua
Locales/enUS/patterns-stacking-equip-effects.lua
Locales/enUS/patterns.lua
Locales/enUS/stats.lua
Upgrade.lua
WeightsWatcher.toc
defaults.lua
diff --git a/Locales/enUS/gems.lua b/Locales/enUS/gems.lua
index 9025524..e7bd088 100644
--- a/Locales/enUS/gems.lua
+++ b/Locales/enUS/gems.lua
@@ -590,6 +590,7 @@ ww_gemColorDisplayNames = {

 ww_localizedSocketColors = {
 	["blue"] = "blue",
+	["cogwheel"] = "cogwheel",
 	["meta"] = "meta",
 	["prismatic"] = "prismatic",
 	["red"] = "red",
@@ -603,6 +604,7 @@ end

 ww_socketColorDisplayNames = {
 	[ww_localizedSocketColors["blue"]] = "Blue",
+	[ww_localizedSocketColors["cogwheel"]] = "Cogwheel",
 	[ww_localizedSocketColors["meta"]] = "Meta",
 	[ww_localizedSocketColors["prismatic"]] = "Prismatic",
 	[ww_localizedSocketColors["red"]] = "Red",
diff --git a/Locales/enUS/patterns-cooldown-use-effects.lua b/Locales/enUS/patterns-cooldown-use-effects.lua
index 2f22302..a327341 100644
--- a/Locales/enUS/patterns-cooldown-use-effects.lua
+++ b/Locales/enUS/patterns-cooldown-use-effects.lua
@@ -36,6 +36,8 @@ local CooldownUsePreprocessLines = {
 	{" melee and ranged attack power ", " attack power "},
 	-- item 12450
 	{" spell, ranged,? and melee haste rating ", " haste rating "},
+	-- item 66879
+	{" crit rating ", " critical strike rating "},
 }

 local CooldownUseAffixes = {
diff --git a/Locales/enUS/patterns-elixirs.lua b/Locales/enUS/patterns-elixirs.lua
index fb94b14..3fabfdc 100644
--- a/Locales/enUS/patterns-elixirs.lua
+++ b/Locales/enUS/patterns-elixirs.lua
@@ -21,6 +21,7 @@ local ElixirPreprocessLines = {
 	{" the chance that the player will reflect hostile spells cast on them by (%d+)%% for %d+ hrs%. +will automatically reflect the first offensive spell cast against the user", " %1%% spell reflect"},
 	{" goes up by ", " by "},
 	{" resistance to all schools of magic ", " all resistances "},
+	{" resistance to magic ", " all resistances "},
 }

 local ElixirAffixes = {
diff --git a/Locales/enUS/patterns-enchants.lua b/Locales/enUS/patterns-enchants.lua
index a006b4f..2ff3758 100644
--- a/Locales/enUS/patterns-enchants.lua
+++ b/Locales/enUS/patterns-enchants.lua
@@ -7,6 +7,7 @@ local EnchantMatchLines = {
 	"^use: teaches you how to permanently enchant ",
 	"^use: attaches ",
 	"^use: enchants? ",
+	"^use: removes the safety mechanism from +",
 }

 local EnchantUnweightedLines = {
@@ -52,10 +53,13 @@ local EnchantPreprocessLines = {
 	{" reduce threat slightly ", " 2%% reduced threat "},
 	{" a minor movement speed ", " minor run speed "},
 	{" reducing the duration of disarm effects by ", " disarm duration reduced by "},
+	-- items 62368 and 62422
+	{" mastery strike rating ", " mastery rating "},
 }

 local EnchantAffixes = {
 	"^use: +",
+	"^removes the safety mechanism from a bow or gun, +",
 	"^teaches you how to +",
 	"^permanently +",
 	"^enchants? +",
@@ -81,6 +85,7 @@ local EnchantAffixes = {
 	"^staff +",
 	"^ring +",
 	"^shoulder slot item +",
+	"^or held item +",

 	"^%a+ l?e?g? ?armor onto pants +",
 	"^embroiders spellthread into pants, +",
@@ -122,6 +127,7 @@ local EnchantAffixes = {
 	-- TODO: flag this somehow and handle it in scoring
 	" +does not stack with other similar effects%.",
 	" +does not stack with other enchantments for the selected equipment slot%.",
+	"[\r\n]+wearer must be level %d+ or higher to receive the benefits of this armor kit%.$",

 	"^eternal belt buckle onto a belt, adding a +",
 	" +to the belt%.$",
diff --git a/Locales/enUS/patterns-fishing.lua b/Locales/enUS/patterns-fishing.lua
index 0212338..cf7b3cc 100644
--- a/Locales/enUS/patterns-fishing.lua
+++ b/Locales/enUS/patterns-fishing.lua
@@ -21,7 +21,7 @@ local FishingAffixes = {
 	"^attach a lure to your equipped fishing pole, increasing +",
 	"%.$",
 	"utes$",
-	" +3 min",
+	" +[35] min",
 	" +10 min$",
 	" +1 hour$",
 	" +for$",
diff --git a/Locales/enUS/patterns-stacking-equip-effects.lua b/Locales/enUS/patterns-stacking-equip-effects.lua
index f7957a2..a9568be 100644
--- a/Locales/enUS/patterns-stacking-equip-effects.lua
+++ b/Locales/enUS/patterns-stacking-equip-effects.lua
@@ -22,17 +22,25 @@ local triggerGroups = {

 local StackingEquipMatchLines = {
 	"^equip: each .* stack",
-	"^equip: your spells grant .* stack",
+	"^equip: your %a* ?spells grant .* stack",
+	"^equip: your .*attacks grant .* stack",
 }

 local stackingEquipPreprocessLines = {
 	{"%. +each time you ", " SPLIT "},
+	{"%. +lasts ", " for "},
 	{"%. +stacks ", ", stacking "},
-	{" your spells grant ", " each time you cast a spell you gain "},
+	{" and stacking ", ", stacking "},
+	{" grant heart's revelation, increasing ", " grant "},
+	{" grant inner eye, increasing ", " grant "},
+	{" your (%a* ?)spells grant ", " each time you cast a %1spell you gain "},
+	{" damage spell ", " damaging spell "},
 }

 local StackingEquipAffixes = {
-	"^equip: each time you +",
+	"^equip: +",
+	"^each time +",
+	"^your? +",
 	" t?on? an opponent,",
 	" the next",
 	"[%.,]",
@@ -42,7 +50,8 @@ local function parseStackingEquipEffectTriggers(trigger)
 	local triggerPatterns = {
 		{"^cast a ?(.*) spell$", "SpellCast"},
 		{"^deal ?(.*) damage$", "DamageDealt"},
-		{"^land a (.*) spell$", "SpellHit"},
+		{"^land a ?(.*) spell$", "SpellHit"},
+		{"^(.+) attacks$", "DamageDealt"},
 	}

 	for _, regex in ipairs(triggerPatterns) do
@@ -53,7 +62,7 @@ local function parseStackingEquipEffectTriggers(trigger)
 			if not triggerSubTypes then
 				triggerSubTypes = ""
 			end
-			triggerSubTypes = triggerSubTypes:gsub(" or ", " OR ")
+			triggerSubTypes = triggerSubTypes:gsub(" or ", " OR "):gsub(" and ", " OR ")
 			local start, finish, left = string.find(triggerSubTypes, "^([^A-Z]*) OR ")
 			while start do
 				table.insert(subTypes, left)
@@ -80,7 +89,10 @@ end
 local function parseStackingEquipEffect(text, section)
 	local start, _, trigger, stat, duration, numStacks = string.find(text, "^(.*) you gain (.*) for (.*) stacking up to (%d+) times$")
 	if not start then
-		return
+		start, _, trigger, stat, duration, numStacks = string.find(text, "^(.*) grant (.*) for (.*) stacking up to (%d+) times$")
+		if not start then
+			return
+		end
 	end

 	local triggers = parseStackingEquipEffectTriggers(trigger)
@@ -92,6 +104,7 @@ local function parseStackingEquipEffect(text, section)
 	if not stat or not stat.stats then
 		return
 	end
+	-- TODO: figure out/fix this?
 	local amount
 	for name, value in pairs(stat.stats) do
 		stat = name
diff --git a/Locales/enUS/patterns.lua b/Locales/enUS/patterns.lua
index 85c2b71..00bd5d5 100644
--- a/Locales/enUS/patterns.lua
+++ b/Locales/enUS/patterns.lua
@@ -110,6 +110,7 @@ ww_IgnoredLines = {
 	"^blade's edge mountains$",
 	"^dire maul$",
 	"^drak'tharon keep$",
+	"^ebon hold$",
 	"^grizzly hills$",
 	"^icecrown citadel$",
 	"^icecrown$",
@@ -366,10 +367,10 @@ ww_SingleStatLines = {
 	{"^([+-]?%d+) (%a[%a ]+ rating)$", WeightsWatcher.statNumFirst, {"cooldownUseEffect", "elixir", "enchant", "equipEffect", "food", "generic", "socketBonus", "useEffect"}},
 	{"^([+-]?%d+) (armor)$", WeightsWatcher.statNumFirst, {"cooldownUseEffect", "elixir", "enchant", "equipEffect", "generic", "useEffect"}},
 	{"^([+-]?%d+) (stamina)$", WeightsWatcher.statNumFirst, {"elixir", "enchant", "food", "generic", "socketBonus", "useEffect"}},
-	{"^([+-]?%d+) (intellect)$", WeightsWatcher.statNumFirst, {"elixir", "enchant", "food", "generic", "socketBonus", "useEffect"}},
+	{"^([+-]?%d+) (intellect)$", WeightsWatcher.statNumFirst, {"cooldownUseEffect", "elixir", "enchant", "food", "generic", "socketBonus", "useEffect"}},
 	{"^([+-]?%d+) (spell power)$", WeightsWatcher.statNumFirst, {"cooldownUseEffect", "elixir", "enchant", "equipEffect", "food", "generic", "socketBonus", "stackingEquipEffect", "useEffect"}},
-	{"^([+-]?%d+) (agility)$", WeightsWatcher.statNumFirst, {"cooldownUseEffect", "elixir", "enchant", "food", "generic", "socketBonus", "useEffect"}},
-	{"^([+-]?%d+) (strength)$", WeightsWatcher.statNumFirst, {"cooldownUseEffect", "elixir", "enchant", "food", "generic", "socketBonus", "useEffect"}},
+	{"^([+-]?%d+) (agility)$", WeightsWatcher.statNumFirst, {"cooldownUseEffect", "elixir", "enchant", "food", "generic", "socketBonus", "stackingEquipEffect", "useEffect"}},
+	{"^([+-]?%d+) (strength)$", WeightsWatcher.statNumFirst, {"cooldownUseEffect", "elixir", "enchant", "food", "generic", "socketBonus", "stackingEquipEffect", "useEffect"}},
 	{"^%(?(%d+%.?%d*) damage per second%)?$",
 		function(text, pattern)
 			return WeightsWatcher.singleStatValueOnly(text, pattern, "melee dps")
@@ -492,7 +493,7 @@ ww_SingleStatLines = {
 				end
 			end
 		end,
-		{"cooldownUseEffect", "elixir", "enchant", "equipEffect", "food", "useEffect"},
+		{"cooldownUseEffect", "elixir", "enchant", "equipEffect", "food", "stackingEquipEffect", "useEffect"},
 	},

 	-- meta/enchant effects
diff --git a/Locales/enUS/stats.lua b/Locales/enUS/stats.lua
index a45296a..b17acd5 100644
--- a/Locales/enUS/stats.lua
+++ b/Locales/enUS/stats.lua
@@ -54,6 +54,7 @@ ww_localizedStats = {
 	["mastery rating"] = "mastery rating",
 	["maximum melee weapon damage"] = "maximum melee weapon damage",
 	["maximum ranged weapon damage"] = "maximum ranged weapon damage",
+	["melee critical strike rating"] = "melee critical strike rating",
 	["melee dps"] = "melee dps",
 	["melee weapon speed"] = "melee weapon speed",
 	["mining"] = "mining",
@@ -150,6 +151,7 @@ ww_statDisplayNames = {
 	[ww_localizedStats["mastery rating"]] = "Mastery Rating",
 	[ww_localizedStats["maximum melee weapon damage"]] = "Maximum Melee Weapon Damage",
 	[ww_localizedStats["maximum ranged weapon damage"]] = "Maximum Ranged Weapon Damage",
+	[ww_localizedStats["melee critical strike rating"]] = "Melee Critical Strike Rating",
 	[ww_localizedStats["melee dps"]] = "Melee DPS",
 	[ww_localizedStats["melee weapon speed"]] = "Melee Weapon Speed",
 	[ww_localizedStats["mining"]] = "Mining",
diff --git a/Upgrade.lua b/Upgrade.lua
index afd9cd7..2b860d3 100644
--- a/Upgrade.lua
+++ b/Upgrade.lua
@@ -55,6 +55,21 @@ local function noop_major_up(vars)
 	return vars
 end

+local function upgradeAccountToMeleeCrit(vars)
+	for _, class in ipairs(vars.weightsList) do
+		for _, weight in ipairs(vars.weightsList[class]) do
+			if vars.weightsList[class][weight]["melee dps"] or vars.weightsList[class][weight]["feral attack power"] or vars.weightsList[class][weight]["expertise rating"] then
+				if vars.weightsList[class][weight]["melee critical strike rating"] == nil then
+					vars.weightsList[class][weight]["melee critical strike rating"] = vars.weightsList[class][weight]["critical strike rating"]
+				end
+			end
+		end
+	end
+
+	vars.dataMinorVersion = 23
+	return vars
+end
+
 local function upgradeAccountToMastery(vars)
 	for _, class in ipairs(vars.weightsList) do
 		for _, weight in ipairs(vars.weightsList[class]) do
@@ -1023,6 +1038,7 @@ local upgradeAccountFunctions = {
 		[19] = upgradeAccountToRangedCritHasteAndHit,
 		[20] = upgradeAccountToNewClassNameDisplayOptions,
 		[21] = upgradeAccountToMastery,
+		[22] = upgradeAccountToMeleeCrit,
 	},
 }

@@ -1062,6 +1078,7 @@ local downgradeAccountFunctions = {
 		[20] = noop_down,
 		[21] = downgradeAccountFromNewClassNameDisplayOptions,
 		[22] = noop_down,
+		[23] = noop_down,
 	},
 }

diff --git a/WeightsWatcher.toc b/WeightsWatcher.toc
index 7a6f382..1a296cb 100644
--- a/WeightsWatcher.toc
+++ b/WeightsWatcher.toc
@@ -2,7 +2,7 @@
 ## Title: Weights Watcher
 ## Notes: Ranks gear according to customizable stat weights
 ## Author: The Flying Squirrels
-## Version: 1.3r5
+## Version: 1.4r1
 ## OptionalDeps: AtlasLoot
 ## SavedVariables: ww_vars
 ## SavedVariablesPerCharacter: ww_charVars
diff --git a/defaults.lua b/defaults.lua
index 3649768..bda38d6 100644
--- a/defaults.lua
+++ b/defaults.lua
@@ -32,6 +32,7 @@ ww_trackedStats = {
 		[ww_statCategories["Melee DPS"]] = {
 			"feral attack power",
 			"expertise rating",
+			"melee critical strike rating",
 			"melee dps",
 			"average melee weapon damage",
 			"maximum melee weapon damage",
@@ -191,7 +192,7 @@ ww_classNameOptions = {

 ww_defaultVars = {
 	dataMajorVersion = 1,
-	dataMinorVersion = 22,
+	dataMinorVersion = 23,
 	weightsList = {
 		"DEATHKNIGHT",
 		"DRUID",
@@ -218,6 +219,7 @@ ww_defaultVars = {
 				["expertise rating"] = 38,
 				["strength"] = 31,
 				["critical strike rating"] = 22,
+				["melee critical strike rating"] = 22,
 				["armor"] = 18,
 				["haste rating"] = 16,
 				["hit rating"] = 16,
@@ -234,6 +236,7 @@ ww_defaultVars = {
 				["mastery rating"] = 35,
 				["attack power"] = 32,
 				["critical strike rating"] = 26,
+				["melee critical strike rating"] = 26,
 				triggers = {
 					meleeDamage = true,
 				}
@@ -246,6 +249,7 @@ ww_defaultVars = {
 				["attack power"] = 23,
 				["expertise rating"] = 21,
 				["critical strike rating"] = 20,
+				["melee critical strike rating"] = 20,
 				["mastery rating"] = 8,
 				triggers = {
 					meleeDamage = true,
@@ -282,6 +286,7 @@ ww_defaultVars = {
 				["expertise rating"] = 29,
 				["hit rating"] = 28,
 				["critical strike rating"] = 28,
+				["melee critical strike rating"] = 28,
 				triggers = {
 					meleeDamage = true,
 				}
@@ -293,6 +298,7 @@ ww_defaultVars = {
 				["dodge rating"] = 41,
 				["mastery rating"] = 16,
 				["critical strike rating"] = 13,
+				["melee critical strike rating"] = 13,
 				["strength"] = 10,
 				["expertise rating"] = 10,
 				["health"] = 7,
@@ -457,6 +463,7 @@ ww_defaultVars = {
 				["strength"] = 80,
 				["expertise rating"] = 66,
 				["critical strike rating"] = 40,
+				["melee critical strike rating"] = 40,
 				["agility"] = 32,
 				["haste rating"] = 30,
 				["spell power"] = 9,
@@ -522,6 +529,7 @@ ww_defaultVars = {
 				["haste rating"] = 46,
 				["expertise rating"] = 42,
 				["critical strike rating"] = 35,
+				["melee critical strike rating"] = 35,
 				triggers = {
 					meleeDamage = true,
 				}
@@ -533,6 +541,7 @@ ww_defaultVars = {
 				["expertise rating"] = 59,
 				["haste rating"] = 56,
 				["critical strike rating"] = 35,
+				["melee critical strike rating"] = 35,
 				["mastery rating"] = 33,
 				triggers = {
 					meleeDamage = true,
@@ -545,6 +554,7 @@ ww_defaultVars = {
 				["haste rating"] = 37,
 				["expertise rating"] = 33,
 				["critical strike rating"] = 31,
+				["melee critical strike rating"] = 31,
 				["mastery rating"] = 20,
 				triggers = {
 					meleeDamage = true,
@@ -579,6 +589,7 @@ ww_defaultVars = {
 				["intellect"] = 36,
 				["spell power"] = 36,
 				["critical strike rating"] = 28,
+				["melee critical strike rating"] = 28,
 				["haste rating"] = 16,
 				triggers = {
 					harmfulSpell = true,
@@ -662,6 +673,7 @@ ww_defaultVars = {
 				["hit rating"] = 90,
 				["expertise rating"] = 85,
 				["critical strike rating"] = 80,
+				["melee critical strike rating"] = 80,
 				["agility"] = 65,
 				["haste rating"] = 50,
 				["armor"] = 1,
@@ -674,6 +686,7 @@ ww_defaultVars = {
 				["mastery rating"] = 100,
 				["strength"] = 82,
 				["critical strike rating"] = 66,
+				["melee critical strike rating"] = 66,
 				["agility"] = 53,
 				["hit rating"] = 48,
 				["haste rating"] = 36,
@@ -691,6 +704,7 @@ ww_defaultVars = {
 				["expertise rating"] = 19,
 				["hit rating"] = 10,
 				["critical strike rating"] = 7,
+				["melee critical strike rating"] = 7,
 				["armor"] = 6,
 				["haste rating"] = 1,
 				triggers = {