Tailor stat comparison and scoring to each spec

Replace the flat per-spec key list with SPEC_STAT_PROFILES: an ordered
{ stat, weight } table for every class/spec. The panel now shows what
matters to the selected spec instead of falling back to spell stats for
physical specs: casters get spell damage/hit/crit/haste, melee get
strength/AP/hit/expertise/armor pen, tanks get stamina/armor/defense/
dodge/parry/block, healers get healing/spirit/MP5.

The same weights drive upgrade ranking, the completion ratio, and which
two gains are shown in the top-upgrades line, so e.g. spell damage
outweighs spirit for Shadow while stamina outweighs expertise for a
Protection tank.

Add GetItemStats mappings for physical stats (attack power, ranged/feral
AP, strength, agility, hit, expertise, armor pen, defense, dodge, parry,
block, block value, armor). TBC per-school hit/crit/haste keys fold into
one stat. Drop the unused spellPower row from TBC profiles.

Tests: weighted scoring expectations, physical/tank mappings, profile
coverage and 8-row panel limit, weighted ratios. 104 passing.
This commit is contained in:
dfj committed 2026-10-24 01:00:24 +02:00
1 parent e08e288f73
commit b66491c5be
7 files changed
+300 -60

No files matched your search

+40 -1
View File
@@ -249,9 +249,25 @@ local STAT_LABELS = {
spellPower = "+Spell Power",
intellect = "Intellect",
spirit = "Spirit",
stamina = "Stamina",
mp5 = "MP5",
haste = "Haste",
crit = "Crit",
hit = "Hit",
attackPower = "Attack Power",
rangedAttackPower = "Ranged AP",
feralAttackPower = "Feral AP",
strength = "Strength",
agility = "Agility",
expertise = "Expertise",
armorPen = "Armor Pen",
defense = "Defense",
dodge = "Dodge",
parry = "Parry",
block = "Block",
blockValue = "Block Value",
armor = "Armor",
resilience = "Resilience",
}
local STAT_DISPLAY_NAME = {
@@ -260,9 +276,25 @@ local STAT_DISPLAY_NAME = {
spellPower = "spell power",
intellect = "intellect",
spirit = "spirit",
stamina = "stamina",
mp5 = "mp5",
haste = "haste",
crit = "crit",
hit = "hit",
attackPower = "attack power",
rangedAttackPower = "ranged AP",
feralAttackPower = "feral AP",
strength = "strength",
agility = "agility",
expertise = "expertise",
armorPen = "armor pen",
defense = "defense",
dodge = "dodge",
parry = "parry",
block = "block",
blockValue = "block value",
armor = "armor",
resilience = "resilience",
}
local STATS_COL_W = 60
@@ -291,7 +323,14 @@ local function FormatUpgradeEntry(idx, upgrade)
for statKey, diff in pairs(upgrade.statDiffs) do
table.insert(sorted, { key = statKey, diff = diff })
end
table.sort(sorted, function(a, b) return a.diff > b.diff end)
-- Show the gains this spec cares about most, not just the biggest number.
table.sort(sorted, function(a, b)
local aWeight = (upgrade.statWeights and upgrade.statWeights[a.key]) or 1
local bWeight = (upgrade.statWeights and upgrade.statWeights[b.key]) or 1
local aValue, bValue = a.diff * aWeight, b.diff * bWeight
if aValue ~= bValue then return aValue > bValue end
return a.diff > b.diff
end)
local parts = {}
local maxShow = math.min(2, #sorted)