diff --git a/Regexps.lua b/Regexps.lua index 91cd8fc..fea9594 100644 --- a/Regexps.lua +++ b/Regexps.lua @@ -627,8 +627,8 @@ function WeightsWatcher.damageRange(textL, textR) local start, _, minimum, maximum = string.find(textL, "^(%d+) %- (%d+) damage$") if start then stats = WeightsWatcher.newStatTable() - stats["minimum weapon damage"] = tonumber(minimum) - stats["maximum weapon damage"] = tonumber(maximum) + stats["minimum melee weapon damage"] = tonumber(minimum) + stats["maximum melee weapon damage"] = tonumber(maximum) else local start, _, minimum, maximum, school = string.find(textL, "^(%d+) %- (%d+) (%a+) damage$") if start then @@ -645,8 +645,8 @@ function WeightsWatcher.damageRange(textL, textR) local start, _, damage = string.find(textL, "^(%d+) damage$") if start then stats = WeightsWatcher.newStatTable() - stats["minimum weapon damage"] = tonumber(damage) - stats["maximum weapon damage"] = tonumber(damage) + stats["minimum melee weapon damage"] = tonumber(damage) + stats["maximum melee weapon damage"] = tonumber(damage) end end end @@ -1165,7 +1165,7 @@ ww_SingleStatLines = { {"^%((%d+%.?%d*) damage per second%)$", function(text, pattern) - return WeightsWatcher.singleStatValueOnly(text, pattern, "dps") + return WeightsWatcher.singleStatValueOnly(text, pattern, "melee dps") end, {"generic"}, }, @@ -1208,7 +1208,7 @@ ww_SingleStatLines = { {"^([+-]?%d+) (spell penetration)$", WeightsWatcher.statNumFirst, {"enchant", "equipEffect", "generic"}}, {"^adds (%d[%d%.]*) damage per second$", function(text, pattern) - return WeightsWatcher.singleStatValueOnly(text, pattern, "dps") + return WeightsWatcher.singleStatValueOnly(text, pattern, "melee dps") end, {"generic"}, }, diff --git a/Upgrade.lua b/Upgrade.lua index 63f37b5..a87cec1 100644 --- a/Upgrade.lua +++ b/Upgrade.lua @@ -53,6 +53,65 @@ local function noop_major_up(vars) return vars end +local function upgradeAccountToMeleeStatsAndRangedWeaponDamage(vars) + for _, class in ipairs(vars.weightsList) do + for _, weight in ipairs(vars.weightsList[class]) do + if vars.weightsList[class][weight]["ranged attack power"] ~= nil or vars.weightsList[class][weight]["ranged dps"] ~= nil then + if vars.weightsList[class][weight]["maximum ranged weapon damage"] == nil then + vars.weightsList[class][weight]["maximum ranged weapon damage"] = vars.weightsList[class][weight]["maximum weapon damage"] + end + vars.weightsList[class][weight]["maximum weapon damage"] = nil + if vars.weightsList[class][weight]["minimum ranged weapon damage"] == nil then + vars.weightsList[class][weight]["minimum ranged weapon damage"] = vars.weightsList[class][weight]["minimum weapon damage"] + end + vars.weightsList[class][weight]["minimum weapon damage"] = nil + end + if vars.weightsList[class][weight]["melee dps"] == nil then + vars.weightsList[class][weight]["melee dps"] = vars.weightsList[class][weight]["dps"] + end + vars.weightsList[class][weight]["dps"] = nil + if vars.weightsList[class][weight]["minimum melee weapon damage"] == nil then + vars.weightsList[class][weight]["minimum melee weapon damage"] = vars.weightsList[class][weight]["minimum weapon damage"] + end + vars.weightsList[class][weight]["minimum weapon damage"] = nil + if vars.weightsList[class][weight]["maximum melee weapon damage"] == nil then + vars.weightsList[class][weight]["maximum melee weapon damage"] = vars.weightsList[class][weight]["maximum weapon damage"] + end + vars.weightsList[class][weight]["maximum weapon damage"] = nil + end + end + + vars.dataMinorVersion = 16 + return vars +end + +local downgradeAccountFromMeleeStatsAndRangedWeaponDamage = [[ + return function(vars) + for _, class in ipairs(vars.weightsList) do + for _, weight in ipairs(vars.weightsList[class]) do + if vars.weightsList[class][weight]["maximum weapon damage"] == nil then + vars.weightsList[class][weight]["maximum weapon damage"] = vars.weightsList[class][weight]["maximum ranged weapon damage"] + end + if vars.weightsList[class][weight]["minimum weapon damage"] == nil then + vars.weightsList[class][weight]["minimum weapon damage"] = vars.weightsList[class][weight]["minimum ranged weapon damage"] + end + if vars.weightsList[class][weight]["dps"] == nil then + vars.weightsList[class][weight]["dps"] = vars.weightsList[class][weight]["melee dps"] + end + if vars.weightsList[class][weight]["minimum weapon damage"] == nil then + vars.weightsList[class][weight]["minimum weapon damage"] = vars.weightsList[class][weight]["minimum melee weapon damage"] + end + if vars.weightsList[class][weight]["maximum weapon damage"] == nil then + vars.weightsList[class][weight]["maximum weapon damage"] = vars.weightsList[class][weight]["maximum melee weapon damage"] + end + end + end + + vars.dataMinorVersion = 15 + return vars + end +]] + local function upgradeAccountToFixStunResistChance(vars) for _, class in ipairs(vars.weightsList) do for _, weight in ipairs(vars.weightsList[class]) do @@ -826,6 +885,7 @@ local upgradeAccountFunctions = { [12] = upgradeAccountToDebugKey, [13] = upgradeAccountToFixStunResistChance, [14] = FixStunResistChance, + [15] = upgradeAccountToMeleeStatsAndRangedWeaponDamage, }, } @@ -858,6 +918,7 @@ local downgradeAccountFunctions = { [13] = noop_down, [14] = downgradeAccountFromFixStunResistChance, [15] = noop_down, + [16] = downgradeAccountFromMeleeStatsAndRangedWeaponDamage, }, } diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua index d2d8347..f4b73ec 100644 --- a/WeightsWatcher.lua +++ b/WeightsWatcher.lua @@ -1031,6 +1031,12 @@ function WeightsWatcher.parseLine(textL, textR, link) ww_unparsed_lines[textL][link] = true end +local rangedConversions = { + ["melee dps"] = "ranged dps", + ["maximum melee weapon damage"] = "maximum ranged weapon damage", + ["minimum melee weapon damage"] = "minimum ranged weapon damage", +} + function WeightsWatcher.getItemStats(link) local textL, textR, pattern, func, start local normalStats, nonStats, socketList, socketBonusStat, useEffects, stackingEquipEffects = WeightsWatcher.newStatTable(), {}, {}, WeightsWatcher.newStatTable(), {}, {} @@ -1081,8 +1087,10 @@ function WeightsWatcher.getItemStats(link) end if nonStats["slot"] == "ranged" or nonStats["slot"] == "thrown" or nonStats["slot"] == "projectile" then - normalStats["ranged dps"] = rawget(normalStats, "dps") - normalStats["dps"] = nil + for k, v in pairs(rangedConversions) do + normalStats[v] = rawget(normalStats, k) + normalStats[k] = nil + end end return { diff --git a/defaults.lua b/defaults.lua index 36b1c7b..f4a011f 100644 --- a/defaults.lua +++ b/defaults.lua @@ -3,6 +3,7 @@ ww_trackedStats = { "Tanking", "Melee", "Caster", + "Ranged", "Meta Gem Stats", "Resistances", "Triggers", @@ -27,14 +28,12 @@ ww_trackedStats = { "Agility", "Attack Power", "Feral Attack Power", - "Ranged Attack Power", "Strength", "Armor Penetration Rating", "Expertise Rating", - "DPS", - "Ranged DPS", - "Minimum Weapon Damage", - "Maximum Weapon Damage", + "Melee DPS", + "Minimum Melee Weapon Damage", + "Maximum Melee Weapon Damage", }, ["Caster"] = { "Intellect", @@ -50,6 +49,12 @@ ww_trackedStats = { "Nature Spell Damage", "Shadow Spell Damage", }, + ["Ranged"] = { + "Ranged Attack Power", + "Ranged DPS", + "Minimum Ranged Weapon Damage", + "Maximum Ranged Weapon Damage", + }, ["Meta Gem Stats"] = { "Armor from Items (Percent)", "Block Value (Percent)", @@ -232,7 +237,7 @@ ww_classNameOptions = { ww_defaultVars = { dataMajorVersion = 1, - dataMinorVersion = 15, + dataMinorVersion = 16, weightsList = { "DEATHKNIGHT", "DRUID", @@ -250,7 +255,7 @@ ww_defaultVars = { "Unholy DPS", "Tank", ["Blood DPS"] = { - ["dps"] = 360, + ["melee dps"] = 360, ["armor penetration rating"] = 100, ["strength"] = 99, ["hit rating"] = 91, @@ -264,7 +269,7 @@ ww_defaultVars = { } }, ["Frost DPS"] = { - ["dps"] = 337, + ["melee dps"] = 337, ["hit rating"] = 100, ["strength"] = 97, ["expertise rating"] = 81, @@ -278,7 +283,7 @@ ww_defaultVars = { } }, ["Unholy DPS"] = { - ["dps"] = 209, + ["melee dps"] = 209, ["strength"] = 100, ["hit rating"] = 66, ["expertise rating"] = 51, @@ -292,7 +297,7 @@ ww_defaultVars = { } }, ["Tank"] = { - ["dps"] = 419, + ["melee dps"] = 419, ["parry rating"] = 100, ["hit rating"] = 97, ["strength"] = 96, @@ -496,7 +501,7 @@ ww_defaultVars = { } }, ["Retribution"] = { - ["dps"] = 470, + ["melee dps"] = 470, ["hit rating"] = 100, ["strength"] = 80, ["expertise rating"] = 66, @@ -556,7 +561,7 @@ ww_defaultVars = { "Combat", "Subtlety", ["Assassination"] = { - ["dps"] = 170, + ["melee dps"] = 170, ["agility"] = 100, ["expertise rating"] = 87, ["hit rating"] = 83, @@ -570,7 +575,7 @@ ww_defaultVars = { } }, ["Combat"] = { - ["dps"] = 220, + ["melee dps"] = 220, ["armor penetration rating"] = 100, ["agility"] = 100, ["expertise rating"] = 82, @@ -584,7 +589,7 @@ ww_defaultVars = { } }, ["Subtlety"] = { - ["dps"] = 228, + ["melee dps"] = 228, ["expertise rating"] = 100, ["agility"] = 100, ["hit rating"] = 80, @@ -613,7 +618,7 @@ ww_defaultVars = { } }, ["Enhancement"] = { - ["dps"] = 135, + ["melee dps"] = 135, ["hit rating"] = 100, ["expertise rating"] = 84, ["agility"] = 55,