-- TBC Anniversary mash lists. Every talent tree has its OWN ST + AoE (no shared tables).
-- Talent-only buttons sit on that spec's list; known-filter drops them until trained.
-- Gold 2026-08-15: Icy Veins TBC Classic Anniversary rotation pages + Wowhead.
-- Each tree owns its buttons (same rule as Era / MoP Hunter BM/MM/Surv).
-- Not Era vanilla. Not MoP. Not Midnight Method.gg. No CUk. Ground AoE = @cursor.

local M = {}
local ORDERS = {}

local function S(name, mode, extra)
  local t = { name = name, mode = mode or "priority" }
  if type(extra) == "table" then
    for k, v in pairs(extra) do
      t[k] = v
    end
  end
  return t
end

local function Put(className, spec, rec)
  rec.isPrimary = true
  rec.patch = rec.patch or "TBC Anniversary 2.5"
  rec.source = rec.source or "TBC Anniversary (Icy Veins / Wowhead)"
  ORDERS[className .. "|" .. spec] = rec
end

---------------------------------------------------------------------------
-- DRUID
---------------------------------------------------------------------------
Put("Druid", "Balance", {
  name = "Balance ST",
  description = "TBC Balance: Moonkin, Insect Swarm / Moonfire, Starfire filler, Force of Nature. Hurricane on packs. Feral / Tree buttons stay off.",
  steps = {
    S("Moonkin Form", "once"),
    S("Mark of the Wild", "once"),
    S("Faerie Fire", "once"),
    S("Insect Swarm", "once"),
    S("Moonfire", "once"),
    S("Force of Nature", "sequential"),
    S("Innervate", "sequential"),
    S("Barkskin", "sequential"),
    S("Nature's Grasp", "sequential"),
    S("Starfire", "priority"),
    S("Wrath", "priority"),
    S("Insect Swarm", "priority"),
    S("Moonfire", "priority"),
    S("Faerie Fire", "priority"),
  },
  aoeSteps = {
    S("Moonkin Form", "once"),
    S("Hurricane", "priority", { cursor = true }),
    S("Insect Swarm", "priority"),
    S("Moonfire", "priority"),
    S("Faerie Fire", "priority"),
    S("Barkskin", "priority"),
    S("Starfire", "priority"),
    S("Wrath", "priority"),
  },
})

Put("Druid", "Feral", {
  name = "Feral ST",
  description = "TBC Feral cat (IV): keep Mangle (Cat) up, Shred builders, Rip at 4+ / Ferocious Bite if the target dies first. Powershift Cat Form for Energy. IV has no cat AoE — pack list is bear Swipe / Mangle (Bear).",
  steps = {
    S("Cat Form", "once"),
    S("Prowl", "once"),
    S("Faerie Fire (Feral)", "once"),
    S("Tiger's Fury", "sequential"),
    S("Rip", "priority"),
    S("Ferocious Bite", "priority"),
    S("Mangle (Cat)", "priority"),
    S("Shred", "priority"),
    S("Rake", "priority"),
    S("Faerie Fire (Feral)", "priority"),
    S("Cat Form", "priority"),
  },
  aoeSteps = {
    S("Bear Form", "once"),
    S("Enrage", "sequential"),
    S("Feral Charge", "sequential"),
    S("Demoralizing Roar", "once"),
    S("Faerie Fire (Feral)", "once"),
    S("Mangle (Bear)", "priority"),
    S("Lacerate", "priority"),
    S("Swipe", "priority"),
    S("Maul", "priority"),
    S("Frenzied Regeneration", "priority"),
    S("Barkskin", "priority"),
  },
})

Put("Druid", "Restoration", {
  name = "Restoration ST",
  description = "TBC Resto: Tree of Life, Lifebloom stacks, Swiftmend, Rejuvenation / Regrowth, Healing Touch. Nature's Swiftness + Innervate. Hurricane is Balance — not on this list.",
  steps = {
    S("Tree of Life", "once"),
    S("Mark of the Wild", "once"),
    S("Innervate", "sequential"),
    S("Nature's Swiftness", "sequential"),
    S("Lifebloom", "priority"),
    S("Swiftmend", "priority"),
    S("Rejuvenation", "priority"),
    S("Regrowth", "priority"),
    S("Healing Touch", "priority"),
    S("Abolish Poison", "priority"),
    S("Remove Curse", "priority"),
  },
  aoeSteps = {
    S("Tree of Life", "once"),
    S("Tranquility", "priority"),
    S("Lifebloom", "priority"),
    S("Rejuvenation", "priority"),
    S("Regrowth", "priority"),
    S("Swiftmend", "priority"),
    S("Healing Touch", "priority"),
    S("Innervate", "priority"),
  },
})

---------------------------------------------------------------------------
-- HUNTER
---------------------------------------------------------------------------
Put("Hunter", "Beast Mastery", {
  name = "Beast Mastery ST",
  description = "TBC BM (IV): weave Steady Shot between Auto Shots. Kill Command on CD (off GCD). Multi-Shot instead of a Steady when up. Bestial Wrath / Intimidation are BM. Aimed Shot is opener-only.",
  steps = {
    S("Hunter's Mark", "once"),
    S("Aspect of the Hawk", "once"),
    S("Misdirection", "sequential"),
    S("Aimed Shot", "sequential"),
    S("Bestial Wrath", "sequential"),
    S("Intimidation", "sequential"),
    S("Rapid Fire", "sequential"),
    S("Aspect of the Viper", "sequential"),
    S("Kill Command", "priority"),
    S("Multi-Shot", "priority"),
    S("Steady Shot", "priority"),
    S("Arcane Shot", "priority"),
    S("Serpent Sting", "priority"),
    S("Auto Shot", "priority"),
    S("Mend Pet", "priority"),
    S("Feign Death", "priority"),
  },
  aoeSteps = {
    S("Hunter's Mark", "once"),
    S("Bestial Wrath", "sequential"),
    S("Rapid Fire", "sequential"),
    S("Kill Command", "priority"),
    S("Multi-Shot", "priority"),
    S("Explosive Trap", "priority", { cursor = true }),
    S("Volley", "priority", { cursor = true }),
    S("Steady Shot", "priority"),
    S("Arcane Shot", "priority"),
    S("Feign Death", "priority"),
  },
})

Put("Hunter", "Marksmanship", {
  name = "Marksmanship ST",
  description = "TBC MM (IV): same Steady / Auto weave + Kill Command + Multi-Shot. Trueshot Aura / Scatter Shot / Silencing Shot are MM. Bestial Wrath stays on BM.",
  steps = {
    S("Hunter's Mark", "once"),
    S("Aspect of the Hawk", "once"),
    S("Trueshot Aura", "once"),
    S("Misdirection", "sequential"),
    S("Aimed Shot", "sequential"),
    S("Rapid Fire", "sequential"),
    S("Aspect of the Viper", "sequential"),
    S("Kill Command", "priority"),
    S("Multi-Shot", "priority"),
    S("Steady Shot", "priority"),
    S("Silencing Shot", "priority"),
    S("Scatter Shot", "priority"),
    S("Arcane Shot", "priority"),
    S("Serpent Sting", "priority"),
    S("Auto Shot", "priority"),
    S("Feign Death", "priority"),
  },
  aoeSteps = {
    S("Hunter's Mark", "once"),
    S("Rapid Fire", "sequential"),
    S("Kill Command", "priority"),
    S("Multi-Shot", "priority"),
    S("Explosive Trap", "priority", { cursor = true }),
    S("Volley", "priority", { cursor = true }),
    S("Steady Shot", "priority"),
    S("Silencing Shot", "priority"),
    S("Scatter Shot", "priority"),
    S("Aimed Shot", "priority"),
  },
})

Put("Hunter", "Survival", {
  name = "Survival ST",
  description = "TBC Survival: same Steady / Kill Command / Multi-Shot core. Wyvern Sting, Counterattack, Readiness, Deterrence are Surv. No Bestial Wrath / Trueshot on this list.",
  steps = {
    S("Hunter's Mark", "once"),
    S("Aspect of the Hawk", "once"),
    S("Misdirection", "sequential"),
    S("Aimed Shot", "sequential"),
    S("Rapid Fire", "sequential"),
    S("Deterrence", "sequential"),
    S("Readiness", "sequential"),
    S("Aspect of the Viper", "sequential"),
    S("Kill Command", "priority"),
    S("Wyvern Sting", "priority"),
    S("Multi-Shot", "priority"),
    S("Steady Shot", "priority"),
    S("Counterattack", "priority"),
    S("Arcane Shot", "priority"),
    S("Serpent Sting", "priority"),
    S("Auto Shot", "priority"),
    S("Feign Death", "priority"),
  },
  aoeSteps = {
    S("Hunter's Mark", "once"),
    S("Rapid Fire", "sequential"),
    S("Kill Command", "priority"),
    S("Multi-Shot", "priority"),
    S("Explosive Trap", "priority", { cursor = true }),
    S("Volley", "priority", { cursor = true }),
    S("Wyvern Sting", "priority"),
    S("Steady Shot", "priority"),
    S("Counterattack", "priority"),
    S("Readiness", "priority"),
  },
})

---------------------------------------------------------------------------
-- MAGE
---------------------------------------------------------------------------
Put("Mage", "Arcane", {
  name = "Arcane ST",
  description = "TBC Arcane: Arcane Blast stacks, Arcane Missiles dump, Arcane Power / Presence of Mind. Evocation. Slow is Arcane. Fireball / Frostbolt stay off.",
  steps = {
    S("Mage Armor", "once"),
    S("Arcane Intellect", "once"),
    S("Arcane Power", "sequential"),
    S("Presence of Mind", "sequential"),
    S("Icy Veins", "sequential"),
    S("Evocation", "sequential"),
    S("Slow", "once"),
    S("Arcane Blast", "priority"),
    S("Arcane Missiles", "priority"),
    S("Counterspell", "priority"),
  },
  aoeSteps = {
    S("Arcane Explosion", "priority"),
    S("Blizzard", "priority", { cursor = true }),
    S("Arcane Blast", "priority"),
    S("Arcane Missiles", "priority"),
    S("Arcane Power", "sequential"),
    S("Counterspell", "priority"),
  },
})

Put("Mage", "Fire", {
  name = "Fire ST",
  description = "TBC Fire: Fireball filler, Scorch for Improved Scorch stacks, Combustion, Fire Blast. Pyroblast is a big hit, not a filler. Dragon's Breath / Blast Wave / Flamestrike on packs.",
  steps = {
    S("Molten Armor", "once"),
    S("Arcane Intellect", "once"),
    S("Combustion", "sequential"),
    S("Pyroblast", "sequential"),
    S("Scorch", "once"),
    S("Fireball", "priority"),
    S("Fire Blast", "priority"),
    S("Scorch", "priority"),
    S("Counterspell", "priority"),
  },
  aoeSteps = {
    S("Flamestrike", "priority", { cursor = true }),
    S("Blast Wave", "priority"),
    S("Dragon's Breath", "priority"),
    S("Arcane Explosion", "priority"),
    S("Fire Blast", "priority"),
    S("Combustion", "sequential"),
    S("Fireball", "priority"),
  },
})

Put("Mage", "Frost", {
  name = "Frost ST",
  description = "TBC Frost: Frostbolt filler, Water Elemental, Icy Veins, Ice Barrier, Cold Snap. Blizzard / Cone of Cold on packs. Combustion stays on Fire.",
  steps = {
    S("Ice Armor", "once"),
    S("Arcane Intellect", "once"),
    S("Summon Water Elemental", "sequential"),
    S("Icy Veins", "sequential"),
    S("Cold Snap", "sequential"),
    S("Ice Barrier", "sequential"),
    S("Frostbolt", "priority"),
    S("Fire Blast", "priority"),
    S("Cone of Cold", "priority"),
    S("Counterspell", "priority"),
    S("Frost Nova", "priority"),
  },
  aoeSteps = {
    S("Blizzard", "priority", { cursor = true }),
    S("Cone of Cold", "priority"),
    S("Frost Nova", "priority"),
    S("Arcane Explosion", "priority"),
    S("Summon Water Elemental", "sequential"),
    S("Icy Veins", "sequential"),
    S("Frostbolt", "priority"),
  },
})

---------------------------------------------------------------------------
-- PALADIN
---------------------------------------------------------------------------
Put("Paladin", "Holy", {
  name = "Holy ST",
  description = "TBC Holy: Holy Light / Flash of Light, Holy Shock, Divine Illumination / Divine Favor. Beacon is WotLK — not here. Crusader Strike stays on Ret.",
  steps = {
    S("Seal of Light", "once"),
    S("Seal of Wisdom", "once"),
    S("Divine Illumination", "sequential"),
    S("Divine Favor", "sequential"),
    S("Lay on Hands", "sequential"),
    S("Holy Shock", "priority"),
    S("Flash of Light", "priority"),
    S("Holy Light", "priority"),
    S("Judgement", "priority"),
    S("Cleanse", "priority"),
    S("Divine Shield", "priority"),
  },
  aoeSteps = {
    S("Consecration", "priority"),
    S("Holy Light", "priority"),
    S("Flash of Light", "priority"),
    S("Holy Shock", "priority"),
    S("Divine Illumination", "sequential"),
    S("Cleanse", "priority"),
  },
})

Put("Paladin", "Protection", {
  name = "Protection ST",
  description = "TBC Prot: Righteous Fury, Holy Shield, Avenger's Shield, Consecration, Judgement, Seal of Vengeance / Corruption. Crusader Strike stays on Ret.",
  steps = {
    S("Righteous Fury", "once"),
    S("Seal of Vengeance", "once"),
    S("Seal of Corruption", "once"),
    S("Devotion Aura", "once"),
    S("Holy Shield", "sequential"),
    S("Avenger's Shield", "priority"),
    S("Consecration", "priority"),
    S("Judgement", "priority"),
    S("Holy Shield", "priority"),
    S("Hammer of Wrath", "priority"),
    S("Exorcism", "priority"),
    S("Hammer of Justice", "priority"),
    S("Divine Shield", "priority"),
    S("Blessing of Sanctuary", "priority"),
  },
  aoeSteps = {
    S("Righteous Fury", "once"),
    S("Consecration", "priority"),
    S("Avenger's Shield", "priority"),
    S("Holy Shield", "priority"),
    S("Judgement", "priority"),
    S("Hammer of Justice", "priority"),
    S("Exorcism", "priority"),
  },
})

Put("Paladin", "Retribution", {
  name = "Retribution ST",
  description = "TBC Ret (IV): Crusader Strike on CD, Judgement, keep Seal of Blood / Martyr up, Hammer of Wrath under 20%. Consecration / Exorcism are low priority. Avenging Wrath. Holy Shock stays on Holy.",
  steps = {
    S("Seal of the Crusader", "once"),
    S("Seal of Blood", "once"),
    S("Seal of the Martyr", "once"),
    S("Seal of Command", "once"),
    S("Avenging Wrath", "sequential"),
    S("Crusader Strike", "priority"),
    S("Judgement", "priority"),
    S("Hammer of Wrath", "priority"),
    S("Consecration", "priority"),
    S("Exorcism", "priority"),
    S("Repentance", "priority"),
    S("Hammer of Justice", "priority"),
  },
  aoeSteps = {
    S("Avenging Wrath", "sequential"),
    S("Consecration", "priority"),
    S("Crusader Strike", "priority"),
    S("Judgement", "priority"),
    S("Exorcism", "priority"),
    S("Hammer of Wrath", "priority"),
    S("Seal of Blood", "priority"),
    S("Seal of the Martyr", "priority"),
  },
})

---------------------------------------------------------------------------
-- PRIEST
---------------------------------------------------------------------------
Put("Priest", "Discipline", {
  name = "Discipline ST",
  description = "TBC Disc: Power Word: Shield, Pain Suppression, Power Infusion, Flash / Greater Heal, Prayer of Mending. Penance is Cata — not here. Circle of Healing stays on Holy.",
  steps = {
    S("Inner Fire", "once"),
    S("Power Word: Fortitude", "once"),
    S("Power Infusion", "sequential"),
    S("Pain Suppression", "sequential"),
    S("Power Word: Shield", "priority"),
    S("Prayer of Mending", "priority"),
    S("Flash Heal", "priority"),
    S("Greater Heal", "priority"),
    S("Renew", "priority"),
    S("Dispel Magic", "priority"),
    S("Abolish Disease", "priority"),
  },
  aoeSteps = {
    S("Prayer of Healing", "priority"),
    S("Prayer of Mending", "priority"),
    S("Power Word: Shield", "priority"),
    S("Renew", "priority"),
    S("Flash Heal", "priority"),
    S("Pain Suppression", "sequential"),
  },
})

Put("Priest", "Holy", {
  name = "Holy ST",
  description = "TBC Holy: Circle of Healing, Prayer of Healing / Mending, Greater Heal / Flash Heal / Renew. Guardian Spirit is WotLK. Shadowform stays on Shadow.",
  steps = {
    S("Inner Fire", "once"),
    S("Power Word: Fortitude", "once"),
    S("Circle of Healing", "priority"),
    S("Prayer of Mending", "priority"),
    S("Flash Heal", "priority"),
    S("Greater Heal", "priority"),
    S("Renew", "priority"),
    S("Binding Heal", "priority"),
    S("Dispel Magic", "priority"),
    S("Abolish Disease", "priority"),
  },
  aoeSteps = {
    S("Circle of Healing", "priority"),
    S("Prayer of Healing", "priority"),
    S("Prayer of Mending", "priority"),
    S("Renew", "priority"),
    S("Flash Heal", "priority"),
    S("Holy Nova", "priority"),
  },
})

Put("Priest", "Shadow", {
  name = "Shadow ST",
  description = "TBC Shadow (IV): Shadowform, Vampiric Embrace, keep Vampiric Touch + SW:P, Mind Blast on CD, Shadow Word: Death, Mind Flay filler. No Mind Sear in TBC — AoE is multi-DoT.",
  steps = {
    S("Shadowform", "once"),
    S("Inner Fire", "once"),
    S("Vampiric Embrace", "once"),
    S("Shadowfiend", "sequential"),
    S("Vampiric Touch", "once"),
    S("Shadow Word: Pain", "once"),
    S("Mind Blast", "priority"),
    S("Shadow Word: Death", "priority"),
    S("Mind Flay", "priority"),
    S("Vampiric Touch", "priority"),
    S("Shadow Word: Pain", "priority"),
    S("Silence", "priority"),
    S("Devouring Plague", "priority"),
  },
  aoeSteps = {
    S("Shadowform", "once"),
    S("Vampiric Touch", "priority"),
    S("Shadow Word: Pain", "priority"),
    S("Mind Blast", "priority"),
    S("Shadow Word: Death", "priority"),
    S("Mind Flay", "priority"),
    S("Shadowfiend", "sequential"),
    S("Devouring Plague", "priority"),
  },
})

---------------------------------------------------------------------------
-- ROGUE
---------------------------------------------------------------------------
Put("Rogue", "Assassination", {
  name = "Assassination ST",
  description = "TBC Assassination: Mutilate builders, Envenom / Rupture finishes, Slice and Dice, Cold Blood. Blade Flurry / Adrenaline Rush stay on Combat.",
  steps = {
    S("Slice and Dice", "once"),
    S("Cold Blood", "sequential"),
    S("Vanish", "sequential"),
    S("Mutilate", "priority"),
    S("Envenom", "priority"),
    S("Rupture", "priority"),
    S("Slice and Dice", "priority"),
    S("Backstab", "priority"),
    S("Eviscerate", "priority"),
    S("Kick", "priority"),
    S("Evasion", "priority"),
  },
  aoeSteps = {
    S("Slice and Dice", "once"),
    S("Mutilate", "priority"),
    S("Envenom", "priority"),
    S("Rupture", "priority"),
    S("Kick", "priority"),
    S("Evasion", "priority"),
  },
})

Put("Rogue", "Combat", {
  name = "Combat ST",
  description = "TBC Combat (IV raid spec): Sinister Strike, Slice and Dice, Eviscerate, Blade Flurry, Adrenaline Rush, Riposte. Mutilate stays on Assassination.",
  steps = {
    S("Slice and Dice", "once"),
    S("Blade Flurry", "sequential"),
    S("Adrenaline Rush", "sequential"),
    S("Blade Twisting", "sequential"),
    S("Sinister Strike", "priority"),
    S("Eviscerate", "priority"),
    S("Slice and Dice", "priority"),
    S("Rupture", "priority"),
    S("Riposte", "priority"),
    S("Kick", "priority"),
    S("Evasion", "priority"),
    S("Gouge", "priority"),
  },
  aoeSteps = {
    S("Blade Flurry", "sequential"),
    S("Adrenaline Rush", "sequential"),
    S("Sinister Strike", "priority"),
    S("Eviscerate", "priority"),
    S("Slice and Dice", "priority"),
    S("Kick", "priority"),
    S("Evasion", "priority"),
  },
})

Put("Rogue", "Subtlety", {
  name = "Subtlety ST",
  description = "TBC Subtlety: Backstab / Hemorrhage, Premeditation, Shadowstep, Ghostly Strike, Preparation. Blade Flurry stays on Combat.",
  steps = {
    S("Premeditation", "once"),
    S("Slice and Dice", "once"),
    S("Shadowstep", "sequential"),
    S("Preparation", "sequential"),
    S("Vanish", "sequential"),
    S("Hemorrhage", "priority"),
    S("Backstab", "priority"),
    S("Ghostly Strike", "priority"),
    S("Eviscerate", "priority"),
    S("Rupture", "priority"),
    S("Slice and Dice", "priority"),
    S("Kick", "priority"),
    S("Evasion", "priority"),
  },
  aoeSteps = {
    S("Premeditation", "once"),
    S("Shadowstep", "sequential"),
    S("Hemorrhage", "priority"),
    S("Backstab", "priority"),
    S("Eviscerate", "priority"),
    S("Slice and Dice", "priority"),
    S("Kick", "priority"),
  },
})

---------------------------------------------------------------------------
-- SHAMAN
---------------------------------------------------------------------------
Put("Shaman", "Elemental", {
  name = "Elemental ST",
  description = "TBC Elemental: Lightning Bolt filler, Flame Shock, Chain Lightning on 3+, Elemental Mastery, Totem of Wrath. Thunderstorm is WotLK. Stormstrike stays on Enh.",
  steps = {
    S("Lightning Shield", "once"),
    S("Totem of Wrath", "once"),
    S("Flametongue Weapon", "once"),
    S("Elemental Mastery", "sequential"),
    S("Bloodlust", "sequential"),
    S("Heroism", "sequential"),
    S("Flame Shock", "once"),
    S("Lightning Bolt", "priority"),
    S("Chain Lightning", "priority"),
    S("Earth Shock", "priority"),
    S("Flame Shock", "priority"),
    S("Purge", "priority"),
  },
  aoeSteps = {
    S("Chain Lightning", "priority"),
    S("Fire Nova Totem", "priority"),
    S("Magma Totem", "priority"),
    S("Flame Shock", "priority"),
    S("Lightning Bolt", "priority"),
    S("Elemental Mastery", "sequential"),
    S("Bloodlust", "sequential"),
    S("Heroism", "sequential"),
  },
})

Put("Shaman", "Enhancement", {
  name = "Enhancement ST",
  description = "TBC Enh (IV): Stormstrike then Earth Shock, rotate Flame Shock / Earth Shock. Windfury Weapon. AoE is Fire Nova Totem / Magma Totem. No Maelstrom / Lava Lash (WotLK).",
  steps = {
    S("Lightning Shield", "once"),
    S("Windfury Weapon", "once"),
    S("Strength of Earth Totem", "once"),
    S("Shamanistic Rage", "sequential"),
    S("Bloodlust", "sequential"),
    S("Heroism", "sequential"),
    S("Stormstrike", "priority"),
    S("Earth Shock", "priority"),
    S("Flame Shock", "priority"),
    S("Windfury Totem", "priority"),
    S("Grace of Air Totem", "priority"),
    S("Purge", "priority"),
  },
  aoeSteps = {
    S("Fire Nova Totem", "priority"),
    S("Magma Totem", "priority"),
    S("Flame Shock", "priority"),
    S("Stormstrike", "priority"),
    S("Earth Shock", "priority"),
    S("Bloodlust", "sequential"),
    S("Heroism", "sequential"),
    S("Shamanistic Rage", "sequential"),
  },
})

Put("Shaman", "Restoration", {
  name = "Restoration ST",
  description = "TBC Resto: Chain Heal, Lesser Healing Wave / Healing Wave, Earth Shield, Nature's Swiftness, Mana Tide Totem. Riptide is WotLK. Stormstrike stays on Enh.",
  steps = {
    S("Water Shield", "once"),
    S("Earth Shield", "once"),
    S("Mana Tide Totem", "sequential"),
    S("Nature's Swiftness", "sequential"),
    S("Bloodlust", "sequential"),
    S("Heroism", "sequential"),
    S("Chain Heal", "priority"),
    S("Lesser Healing Wave", "priority"),
    S("Healing Wave", "priority"),
    S("Earth Shield", "priority"),
    S("Cure Poison", "priority"),
    S("Cure Disease", "priority"),
  },
  aoeSteps = {
    S("Chain Heal", "priority"),
    S("Healing Stream Totem", "priority"),
    S("Mana Tide Totem", "sequential"),
    S("Lesser Healing Wave", "priority"),
    S("Healing Wave", "priority"),
    S("Earth Shield", "priority"),
    S("Bloodlust", "sequential"),
    S("Heroism", "sequential"),
  },
})

---------------------------------------------------------------------------
-- WARLOCK
---------------------------------------------------------------------------
Put("Warlock", "Affliction", {
  name = "Affliction ST",
  description = "TBC Aff: Unstable Affliction, Corruption, Siphon Life, Curse of Agony, Shadow Bolt filler. Seed of Corruption on packs. Haunt is WotLK. Conflagrate stays on Destro.",
  steps = {
    S("Fel Armor", "once"),
    S("Soul Link", "once"),
    S("Dark Pact", "sequential"),
    S("Unstable Affliction", "once"),
    S("Corruption", "once"),
    S("Siphon Life", "once"),
    S("Curse of Agony", "once"),
    S("Shadow Bolt", "priority"),
    S("Unstable Affliction", "priority"),
    S("Corruption", "priority"),
    S("Siphon Life", "priority"),
    S("Curse of Agony", "priority"),
    S("Life Tap", "priority"),
    S("Death Coil", "priority"),
  },
  aoeSteps = {
    S("Seed of Corruption", "priority"),
    S("Corruption", "priority"),
    S("Unstable Affliction", "priority"),
    S("Curse of Agony", "priority"),
    S("Shadow Bolt", "priority"),
    S("Hellfire", "priority"),
    S("Rain of Fire", "priority", { cursor = true }),
  },
})

Put("Warlock", "Demonology", {
  name = "Demonology ST",
  description = "TBC Demo: Felguard, Soul Link, Shadow Bolt, Corruption / Immolate, Incinerate. Demonic Sacrifice if you run that build. Unstable Affliction stays on Aff.",
  steps = {
    S("Fel Armor", "once"),
    S("Summon Felguard", "once"),
    S("Soul Link", "once"),
    S("Demonic Sacrifice", "sequential"),
    S("Corruption", "once"),
    S("Immolate", "once"),
    S("Shadow Bolt", "priority"),
    S("Incinerate", "priority"),
    S("Corruption", "priority"),
    S("Immolate", "priority"),
    S("Curse of the Elements", "priority"),
    S("Life Tap", "priority"),
    S("Death Coil", "priority"),
  },
  aoeSteps = {
    S("Hellfire", "priority"),
    S("Rain of Fire", "priority", { cursor = true }),
    S("Seed of Corruption", "priority"),
    S("Shadow Bolt", "priority"),
    S("Incinerate", "priority"),
    S("Immolate", "priority"),
  },
})

Put("Warlock", "Destruction", {
  name = "Destruction ST",
  description = "TBC Destro: Immolate, Incinerate, Conflagrate, Shadowburn, Soul Fire. Chaos Bolt is WotLK. Unstable Affliction stays on Aff.",
  steps = {
    S("Fel Armor", "once"),
    S("Immolate", "once"),
    S("Conflagrate", "priority"),
    S("Incinerate", "priority"),
    S("Shadowburn", "priority"),
    S("Soul Fire", "priority"),
    S("Shadow Bolt", "priority"),
    S("Immolate", "priority"),
    S("Curse of the Elements", "priority"),
    S("Life Tap", "priority"),
    S("Death Coil", "priority"),
  },
  aoeSteps = {
    S("Rain of Fire", "priority", { cursor = true }),
    S("Hellfire", "priority"),
    S("Immolate", "priority"),
    S("Incinerate", "priority"),
    S("Conflagrate", "priority"),
    S("Shadowburn", "priority"),
  },
})

---------------------------------------------------------------------------
-- WARRIOR
---------------------------------------------------------------------------
Put("Warrior", "Arms", {
  name = "Arms ST",
  description = "TBC Arms: Mortal Strike, Slam, Rend, Overpower, Execute, Sweeping Strikes on packs. Bloodthirst stays on Fury. Devastate stays on Prot.",
  steps = {
    S("Battle Stance", "once"),
    S("Battle Shout", "once"),
    S("Sweeping Strikes", "sequential"),
    S("Recklessness", "sequential"),
    S("Mortal Strike", "priority"),
    S("Slam", "priority"),
    S("Overpower", "priority"),
    S("Execute", "priority"),
    S("Rend", "priority"),
    S("Heroic Strike", "priority"),
    S("Hamstring", "priority"),
    S("Intimidating Shout", "priority"),
  },
  aoeSteps = {
    S("Battle Stance", "once"),
    S("Sweeping Strikes", "sequential"),
    S("Cleave", "priority"),
    S("Mortal Strike", "priority"),
    S("Whirlwind", "priority"),
    S("Slam", "priority"),
    S("Thunder Clap", "priority"),
    S("Demoralizing Shout", "priority"),
    S("Execute", "priority"),
  },
})

Put("Warrior", "Fury", {
  name = "Fury ST",
  description = "TBC Fury: Bloodthirst, Whirlwind, Rampage, Execute, Death Wish / Recklessness, Heroic Strike. Mortal Strike stays on Arms.",
  steps = {
    S("Berserker Stance", "once"),
    S("Battle Shout", "once"),
    S("Death Wish", "sequential"),
    S("Recklessness", "sequential"),
    S("Rampage", "sequential"),
    S("Bloodthirst", "priority"),
    S("Whirlwind", "priority"),
    S("Execute", "priority"),
    S("Heroic Strike", "priority"),
    S("Hamstring", "priority"),
    S("Intimidating Shout", "priority"),
    S("Berserker Rage", "priority"),
  },
  aoeSteps = {
    S("Berserker Stance", "once"),
    S("Death Wish", "sequential"),
    S("Whirlwind", "priority"),
    S("Cleave", "priority"),
    S("Bloodthirst", "priority"),
    S("Rampage", "sequential"),
    S("Thunder Clap", "priority"),
    S("Demoralizing Shout", "priority"),
    S("Execute", "priority"),
  },
})

Put("Warrior", "Protection", {
  name = "Protection ST",
  description = "TBC Prot: Shield Slam, Revenge, Devastate, Sunder Armor, Shield Block, Thunder Clap / Demo Shout. Bloodthirst / Mortal Strike stay off this list.",
  steps = {
    S("Defensive Stance", "once"),
    S("Battle Shout", "once"),
    S("Shield Block", "sequential"),
    S("Last Stand", "sequential"),
    S("Shield Wall", "sequential"),
    S("Shield Slam", "priority"),
    S("Revenge", "priority"),
    S("Devastate", "priority"),
    S("Sunder Armor", "priority"),
    S("Thunder Clap", "priority"),
    S("Demoralizing Shout", "priority"),
    S("Concussion Blow", "priority"),
    S("Shield Bash", "priority"),
    S("Taunt", "priority"),
    S("Mocking Blow", "priority"),
  },
  aoeSteps = {
    S("Defensive Stance", "once"),
    S("Thunder Clap", "priority"),
    S("Cleave", "priority"),
    S("Demoralizing Shout", "priority"),
    S("Shield Slam", "priority"),
    S("Revenge", "priority"),
    S("Devastate", "priority"),
    S("Shield Block", "priority"),
    S("Concussion Blow", "priority"),
    S("Challenging Shout", "priority"),
  },
})

local ALIAS = {
  Outlaw = "Combat",
  Guardian = "Feral",
}

local function key2(className, spec)
  spec = ALIAS[spec] or spec
  return tostring(className or "") .. "|" .. tostring(spec or "")
end

function M.GetOrder(className, spec, _hero)
  local k = key2(className, spec)
  local o = ORDERS[k]
  if o then
    return o
  end
  local want = string.lower(k)
  for kk, vv in pairs(ORDERS) do
    if string.lower(kk) == want then
      return vv
    end
  end
  return nil
end

function M.ListHeroes(_className, _spec)
  return {}
end

function M.ListSpecs(className)
  local t = {}
  local prefix = tostring(className or "") .. "|"
  for k in pairs(ORDERS) do
    if k:sub(1, #prefix) == prefix then
      t[#t + 1] = k:sub(#prefix + 1)
    end
  end
  table.sort(t)
  return t
end

function M.Count()
  local n = 0
  for _ in pairs(ORDERS) do
    n = n + 1
  end
  return n
end

M.patch = "TBC Anniversary 2.5"
SpellSmasherTbcMethodOrders = M
