-- Classic Era 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 Classic raid rotations + Wowhead talent buttons.
-- Each tree owns its talent-only spells (same rule as Hunter BM/MM/Surv).
-- 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 "Classic Era 1.15"
  rec.source = rec.source or "Classic (Icy Veins / Wowhead talent trees)"
  ORDERS[className .. "|" .. spec] = rec
end

---------------------------------------------------------------------------
-- DRUID
---------------------------------------------------------------------------
Put("Druid", "Balance", {
  name = "Balance ST",
  description = "Era Balance: Moonkin form is a stance (manual). Starfire filler, Moonfire / Insect Swarm (talent) / Faerie Fire. Hurricane on packs.",
  steps = {
    S("Moonkin Form", "once"),
    S("Faerie Fire", "once"),
    S("Moonfire", "once"),
    S("Insect Swarm", "once"),
    S("Nature's Grasp", "sequential"),
    S("Barkskin", "sequential"),
    S("Innervate", "sequential"),
    S("Starfire", "priority"),
    S("Wrath", "priority"),
    S("Moonfire", "priority"),
    S("Insect Swarm", "priority"),
    S("Faerie Fire", "priority"),
    S("Entangling Roots", "priority"),
  },
  aoeSteps = {
    S("Hurricane", "priority", { cursor = true }),
    S("Moonfire", "priority"),
    S("Insect Swarm", "priority"),
    S("Faerie Fire", "priority"),
    S("Barkskin", "priority"),
    S("Starfire", "priority"),
    S("Wrath", "priority"),
  },
})

Put("Druid", "Feral", {
  name = "Feral ST",
  description = "Era Feral cat ST: Faerie Fire (Feral), Tiger's Fury, Shred/Claw, Rip / Ferocious Bite. Prowl opener. AoE list is bear threat (Swipe/Maul).",
  steps = {
    S("Prowl", "once"),
    S("Faerie Fire (Feral)", "once"),
    S("Tiger's Fury", "sequential"),
    S("Dash", "sequential"),
    S("Rip", "priority"),
    S("Ferocious Bite", "priority"),
    S("Shred", "priority"),
    S("Claw", "priority"),
    S("Rake", "priority"),
    S("Faerie Fire (Feral)", "priority"),
    S("Cower", "priority"),
  },
  aoeSteps = {
    S("Bear Form", "once"),
    S("Enrage", "sequential"),
    S("Swipe", "priority"),
    S("Maul", "priority"),
    S("Demoralizing Roar", "priority"),
    S("Faerie Fire (Feral)", "priority"),
    S("Growl", "priority"),
    S("Challenging Roar", "priority"),
    S("Bash", "priority"),
    S("Frenzied Regeneration", "priority"),
  },
})

Put("Druid", "Restoration", {
  name = "Restoration ST",
  description = "Era Resto: Rejuvenation / Regrowth, Healing Touch, Nature's Swiftness, Innervate, Swiftmend if talented. Tranquility on packs.",
  steps = {
    S("Rejuvenation", "once"),
    S("Regrowth", "sequential"),
    S("Nature's Swiftness", "sequential"),
    S("Innervate", "sequential"),
    S("Healing Touch", "priority"),
    S("Regrowth", "priority"),
    S("Rejuvenation", "priority"),
    S("Abolish Poison", "priority"),
    S("Remove Curse", "priority"),
    S("Barkskin", "priority"),
  },
  aoeSteps = {
    S("Tranquility", "priority"),
    S("Rejuvenation", "priority"),
    S("Regrowth", "priority"),
    S("Healing Touch", "priority"),
    S("Innervate", "priority"),
    S("Barkskin", "priority"),
  },
})

---------------------------------------------------------------------------
-- HUNTER  (BM / MM / Surv are NOT the same list)
-- BM talent buttons: Bestial Wrath, Intimidation
-- MM talent buttons: Aimed Shot, Scatter Shot, Trueshot Aura
-- Surv talent buttons: Counterattack, Wyvern Sting, Deterrence
---------------------------------------------------------------------------
Put("Hunter", "Beast Mastery", {
  name = "Beast Mastery ST",
  description = "Era BM: Intimidation / Bestial Wrath (BM tree). Arcane Shot + Multi-Shot + stings while leveling. Aimed Shot is MM — not on this list.",
  steps = {
    S("Hunter's Mark", "once"),
    S("Aspect of the Hawk", "once"),
    S("Intimidation", "sequential"),
    S("Bestial Wrath", "sequential"),
    S("Rapid Fire", "sequential"),
    S("Arcane Shot", "priority"),
    S("Multi-Shot", "priority"),
    S("Serpent Sting", "priority"),
    S("Concussive Shot", "priority"),
    S("Raptor Strike", "priority"),
    S("Tranquilizing Shot", "priority"),
    S("Mend Pet", "priority"),
    S("Auto Shot", "priority"),
    S("Feign Death", "priority"),
  },
  aoeSteps = {
    S("Hunter's Mark", "once"),
    S("Bestial Wrath", "sequential"),
    S("Rapid Fire", "sequential"),
    S("Intimidation", "sequential"),
    S("Multi-Shot", "priority"),
    S("Volley", "priority", { cursor = true }),
    S("Explosive Trap", "priority", { cursor = true }),
    S("Tranquilizing Shot", "priority"),
    S("Arcane Shot", "priority"),
    S("Scare Beast", "priority"),
  },
})

Put("Hunter", "Marksmanship", {
  name = "Marksmanship ST",
  description = "Era MM (IV raid): Aimed Shot + Multi-Shot between Auto Shots. Scatter Shot / Trueshot Aura are MM. Bestial Wrath is BM — not on this list.",
  steps = {
    S("Hunter's Mark", "once"),
    S("Aspect of the Hawk", "once"),
    S("Trueshot Aura", "once"),
    S("Rapid Fire", "sequential"),
    S("Aimed Shot", "priority"),
    S("Multi-Shot", "priority"),
    S("Scatter Shot", "priority"),
    S("Tranquilizing Shot", "priority"),
    S("Raptor Strike", "priority"),
    S("Auto Shot", "priority"),
    S("Feign Death", "priority"),
    S("Arcane Shot", "priority"),
    S("Serpent Sting", "priority"),
  },
  aoeSteps = {
    S("Hunter's Mark", "once"),
    S("Rapid Fire", "sequential"),
    S("Multi-Shot", "priority"),
    S("Aimed Shot", "priority"),
    S("Volley", "priority", { cursor = true }),
    S("Tranquilizing Shot", "priority"),
    S("Scatter Shot", "priority"),
    S("Explosive Trap", "priority", { cursor = true }),
    S("Arcane Shot", "priority"),
  },
})

Put("Hunter", "Survival", {
  name = "Survival ST",
  description = "Era Survival: Deterrence, Counterattack, Wyvern Sting, traps. Ranged fillers shared. No Bestial Wrath / Aimed Shot on this list.",
  steps = {
    S("Hunter's Mark", "once"),
    S("Aspect of the Hawk", "once"),
    S("Deterrence", "sequential"),
    S("Rapid Fire", "sequential"),
    S("Wyvern Sting", "priority"),
    S("Counterattack", "priority"),
    S("Arcane Shot", "priority"),
    S("Multi-Shot", "priority"),
    S("Serpent Sting", "priority"),
    S("Concussive Shot", "priority"),
    S("Wing Clip", "priority"),
    S("Mongoose Bite", "priority"),
    S("Raptor Strike", "priority"),
    S("Tranquilizing Shot", "priority"),
    S("Auto Shot", "priority"),
    S("Feign Death", "priority"),
  },
  aoeSteps = {
    S("Hunter's Mark", "once"),
    S("Deterrence", "sequential"),
    S("Multi-Shot", "priority"),
    S("Volley", "priority", { cursor = true }),
    S("Explosive Trap", "priority", { cursor = true }),
    S("Immolation Trap", "priority", { cursor = true }),
    S("Frost Trap", "priority", { cursor = true }),
    S("Wyvern Sting", "priority"),
    S("Counterattack", "priority"),
    S("Wing Clip", "priority"),
    S("Mongoose Bite", "priority"),
    S("Raptor Strike", "priority"),
    S("Arcane Shot", "priority"),
  },
})

---------------------------------------------------------------------------
-- MAGE
-- Arcane: AP / PoM / Evocation. Fire: Combustion / Blast Wave / Pyroblast.
-- Frost: Ice Barrier / Ice Block / Cold Snap / Blizzard.
---------------------------------------------------------------------------
Put("Mage", "Arcane", {
  name = "Arcane ST",
  description = "Era Arcane is a cooldown tree: Arcane Power + Presence of Mind, then Fireball filler (standard raid hybrid). No Combustion / Blast Wave.",
  steps = {
    S("Arcane Intellect", "once"),
    S("Mage Armor", "once"),
    S("Arcane Power", "sequential"),
    S("Presence of Mind", "sequential"),
    S("Evocation", "sequential"),
    S("Fireball", "priority"),
    S("Arcane Missiles", "priority"),
    S("Fire Blast", "priority"),
    S("Counterspell", "priority"),
    S("Mana Shield", "priority"),
  },
  aoeSteps = {
    S("Arcane Power", "sequential"),
    S("Arcane Explosion", "priority"),
    S("Flamestrike", "priority", { cursor = true }),
    S("Cone of Cold", "priority"),
    S("Frost Nova", "priority"),
    S("Blink", "priority"),
    S("Fire Blast", "priority"),
  },
})

Put("Mage", "Fire", {
  name = "Fire ST",
  description = "Era Fire: Combustion, Improved Scorch stacks, Fireball, Pyroblast, Fire Blast. Blast Wave on packs. No Ice Barrier.",
  steps = {
    S("Arcane Intellect", "once"),
    S("Combustion", "sequential"),
    S("Presence of Mind", "sequential"),
    S("Pyroblast", "sequential"),
    S("Scorch", "once"),
    S("Fireball", "priority"),
    S("Scorch", "priority"),
    S("Fire Blast", "priority"),
    S("Pyroblast", "priority"),
    S("Counterspell", "priority"),
  },
  aoeSteps = {
    S("Combustion", "sequential"),
    S("Blast Wave", "priority"),
    S("Flamestrike", "priority", { cursor = true }),
    S("Arcane Explosion", "priority"),
    S("Fire Blast", "priority"),
    S("Frost Nova", "priority"),
  },
})

Put("Mage", "Frost", {
  name = "Frost ST",
  description = "Era Frost: Frostbolt filler, Ice Barrier / Ice Block / Cold Snap, Nova + Cone. Blizzard for packs. No Combustion.",
  steps = {
    S("Arcane Intellect", "once"),
    S("Ice Barrier", "once"),
    S("Frostbolt", "priority"),
    S("Fire Blast", "priority"),
    S("Cone of Cold", "priority"),
    S("Frost Nova", "priority"),
    S("Ice Barrier", "priority"),
    S("Ice Block", "priority"),
    S("Cold Snap", "priority"),
    S("Counterspell", "priority"),
    S("Evocation", "priority"),
  },
  aoeSteps = {
    S("Frost Nova", "sequential"),
    S("Blizzard", "priority", { cursor = true }),
    S("Cone of Cold", "priority"),
    S("Arcane Explosion", "priority"),
    S("Cold Snap", "priority"),
    S("Ice Barrier", "priority"),
    S("Blink", "priority"),
    S("Frostbolt", "priority"),
  },
})

---------------------------------------------------------------------------
-- PALADIN
-- Holy: Holy Shock, Divine Favor. Prot: Holy Shield. Ret: Seal of Command.
---------------------------------------------------------------------------
Put("Paladin", "Holy", {
  name = "Holy ST",
  description = "Era Holy: Holy Shock + Divine Favor (Holy tree), Flash of Light filler, Holy Light big. Consecration on packs.",
  steps = {
    S("Blessing of Wisdom", "once"),
    S("Divine Favor", "sequential"),
    S("Holy Shock", "priority"),
    S("Flash of Light", "priority"),
    S("Holy Light", "priority"),
    S("Lay on Hands", "priority"),
    S("Cleanse", "priority"),
    S("Divine Shield", "priority"),
    S("Blessing of Protection", "priority"),
    S("Blessing of Freedom", "priority"),
  },
  aoeSteps = {
    S("Consecration", "priority", { player = true }),
    S("Holy Shock", "priority"),
    S("Flash of Light", "priority"),
    S("Holy Light", "priority"),
    S("Divine Favor", "priority"),
  },
})

Put("Paladin", "Protection", {
  name = "Protection ST",
  description = "Era Prot: Holy Shield (Prot tree), Seal of Righteousness + Judgement, Consecration. No taunt in Era.",
  steps = {
    S("Righteous Fury", "once"),
    S("Seal of Righteousness", "once"),
    S("Devotion Aura", "once"),
    S("Holy Shield", "sequential"),
    S("Judgement", "priority"),
    S("Consecration", "priority", { player = true }),
    S("Holy Shield", "priority"),
    S("Hammer of Justice", "priority"),
    S("Exorcism", "priority"),
    S("Blessing of Sanctuary", "priority"),
    S("Divine Shield", "priority"),
  },
  aoeSteps = {
    S("Consecration", "priority", { player = true }),
    S("Holy Shield", "priority"),
    S("Holy Wrath", "priority"),
    S("Judgement", "priority"),
    S("Exorcism", "priority"),
    S("Hammer of Justice", "priority"),
  },
})

Put("Paladin", "Retribution", {
  name = "Retribution ST",
  description = "Era Ret (IV): Seal of Command, Judgement on CD, Consecration, Hammer of Wrath execute. Sanctity Aura. No Holy Shock.",
  steps = {
    S("Seal of Command", "once"),
    S("Sanctity Aura", "once"),
    S("Blessing of Might", "once"),
    S("Judgement", "priority"),
    S("Hammer of Wrath", "priority"),
    S("Consecration", "priority", { player = true }),
    S("Exorcism", "priority"),
    S("Seal of Command", "priority"),
    S("Hammer of Justice", "priority"),
    S("Repentance", "priority"),
  },
  aoeSteps = {
    S("Seal of Command", "once"),
    S("Consecration", "priority", { player = true }),
    S("Holy Wrath", "priority"),
    S("Judgement", "priority"),
    S("Exorcism", "priority"),
    S("Hammer of Wrath", "priority"),
  },
})

---------------------------------------------------------------------------
-- PRIEST
-- Disc: Inner Focus, Power Infusion. Holy: Lightwell, Holy Nova.
-- Shadow: Shadowform, Mind Flay, Silence, VE.
---------------------------------------------------------------------------
Put("Priest", "Discipline", {
  name = "Discipline ST",
  description = "Era Disc: Inner Focus + Power Infusion (Disc tree), PW:Shield, Flash / Greater Heal, Renew.",
  steps = {
    S("Inner Fire", "once"),
    S("Power Word: Fortitude", "once"),
    S("Inner Focus", "sequential"),
    S("Power Infusion", "sequential"),
    S("Power Word: Shield", "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("Power Word: Shield", "priority"),
    S("Renew", "priority"),
    S("Flash Heal", "priority"),
    S("Inner Focus", "priority"),
  },
})

Put("Priest", "Holy", {
  name = "Holy ST",
  description = "Era Holy: Lightwell + Holy Nova (Holy tree), Flash Heal filler, Greater Heal, Renew. Spirit of Redemption is passive.",
  steps = {
    S("Inner Fire", "once"),
    S("Inner Focus", "sequential"),
    S("Lightwell", "sequential"),
    S("Flash Heal", "priority"),
    S("Greater Heal", "priority"),
    S("Heal", "priority"),
    S("Renew", "priority"),
    S("Power Word: Shield", "priority"),
    S("Dispel Magic", "priority"),
  },
  aoeSteps = {
    S("Prayer of Healing", "priority"),
    S("Holy Nova", "priority"),
    S("Lightwell", "priority"),
    S("Renew", "priority"),
    S("Flash Heal", "priority"),
  },
})

Put("Priest", "Shadow", {
  name = "Shadow ST",
  description = "Era Shadow: Shadowform, Mind Flay + Mind Blast (Shadow tree), SW:P / VE, Silence. Smite is leveling filler.",
  steps = {
    S("Shadowform", "once"),
    S("Inner Fire", "once"),
    S("Vampiric Embrace", "once"),
    S("Shadow Word: Pain", "once"),
    S("Mind Blast", "priority"),
    S("Mind Flay", "priority"),
    S("Shadow Word: Pain", "priority"),
    S("Silence", "priority"),
    S("Psychic Scream", "priority"),
    S("Fade", "priority"),
  },
  aoeSteps = {
    S("Shadowform", "once"),
    S("Mind Flay", "priority"),
    S("Mind Blast", "priority"),
    S("Shadow Word: Pain", "priority"),
    S("Psychic Scream", "priority"),
    S("Vampiric Embrace", "priority"),
  },
})

---------------------------------------------------------------------------
-- ROGUE  (Combat CDs do NOT leak onto Assassination / Subtlety)
-- Combat: Blade Flurry, Adrenaline Rush, Riposte
-- Assassination: Cold Blood
-- Subtlety: Hemorrhage, Ghostly Strike, Preparation, Premeditation
---------------------------------------------------------------------------
Put("Rogue", "Assassination", {
  name = "Assassination ST",
  description = "Era Assassination: Cold Blood, Ambush/Garrote open, Sinister Strike, Eviscerate / Rupture, Slice and Dice. No Blade Flurry / Adrenaline Rush (Combat tree).",
  steps = {
    S("Stealth", "once"),
    S("Slice and Dice", "once"),
    S("Cold Blood", "sequential"),
    S("Ambush", "once"),
    S("Garrote", "once"),
    S("Cheap Shot", "once"),
    S("Eviscerate", "priority"),
    S("Rupture", "priority"),
    S("Slice and Dice", "priority"),
    S("Backstab", "priority"),
    S("Sinister Strike", "priority"),
    S("Kick", "priority"),
    S("Kidney Shot", "priority"),
    S("Evasion", "priority"),
    S("Vanish", "priority"),
  },
  aoeSteps = {
    S("Cold Blood", "sequential"),
    S("Eviscerate", "priority"),
    S("Sinister Strike", "priority"),
    S("Kick", "priority"),
    S("Evasion", "priority"),
  },
})

Put("Rogue", "Combat", {
  name = "Combat ST",
  description = "Era Combat (raid): Blade Flurry + Adrenaline Rush + Riposte (Combat tree), Sinister Strike, Eviscerate, Slice and Dice.",
  steps = {
    S("Stealth", "once"),
    S("Slice and Dice", "once"),
    S("Blade Flurry", "sequential"),
    S("Adrenaline Rush", "sequential"),
    S("Eviscerate", "priority"),
    S("Slice and Dice", "priority"),
    S("Riposte", "priority"),
    S("Sinister Strike", "priority"),
    S("Kick", "priority"),
    S("Kidney Shot", "priority"),
    S("Evasion", "priority"),
    S("Sprint", "priority"),
    S("Vanish", "priority"),
  },
  aoeSteps = {
    S("Blade Flurry", "sequential"),
    S("Adrenaline Rush", "sequential"),
    S("Eviscerate", "priority"),
    S("Sinister Strike", "priority"),
    S("Kick", "priority"),
    S("Evasion", "priority"),
  },
})

Put("Rogue", "Subtlety", {
  name = "Subtlety ST",
  description = "Era Subtlety: Hemorrhage / Ghostly Strike / Preparation / Premeditation (Sub tree), Backstab, Eviscerate. No Blade Flurry.",
  steps = {
    S("Stealth", "once"),
    S("Premeditation", "once"),
    S("Slice and Dice", "once"),
    S("Preparation", "sequential"),
    S("Ghostly Strike", "priority"),
    S("Eviscerate", "priority"),
    S("Slice and Dice", "priority"),
    S("Hemorrhage", "priority"),
    S("Backstab", "priority"),
    S("Cheap Shot", "priority"),
    S("Kick", "priority"),
    S("Blind", "priority"),
    S("Vanish", "priority"),
  },
  aoeSteps = {
    S("Preparation", "sequential"),
    S("Eviscerate", "priority"),
    S("Hemorrhage", "priority"),
    S("Ghostly Strike", "priority"),
    S("Backstab", "priority"),
    S("Blind", "priority"),
  },
})

---------------------------------------------------------------------------
-- SHAMAN
-- Ele: Elemental Mastery. Enh: Stormstrike. Resto: Nature's Swiftness, Mana Tide.
---------------------------------------------------------------------------
Put("Shaman", "Elemental", {
  name = "Elemental ST",
  description = "Era Ele: Elemental Mastery (Ele tree), Lightning Bolt, Flame Shock, Earth Shock. Chain Lightning / Fire Nova on packs.",
  steps = {
    S("Lightning Shield", "once"),
    S("Elemental Mastery", "sequential"),
    S("Flame Shock", "once"),
    S("Lightning Bolt", "priority"),
    S("Earth Shock", "priority"),
    S("Flame Shock", "priority"),
    S("Frost Shock", "priority"),
    S("Purge", "priority"),
  },
  aoeSteps = {
    S("Elemental Mastery", "sequential"),
    S("Chain Lightning", "priority"),
    S("Fire Nova Totem", "priority"),
    S("Magma Totem", "priority"),
    S("Searing Totem", "priority"),
    S("Lightning Bolt", "priority"),
    S("Earth Shock", "priority"),
  },
})

Put("Shaman", "Enhancement", {
  name = "Enhancement ST",
  description = "Era Enh: Stormstrike (Enh tree), shocks, Lightning Shield. Lightning Bolt for Nightfall proc (can't detect — it stays on the list).",
  steps = {
    S("Lightning Shield", "once"),
    S("Stormstrike", "priority"),
    S("Earth Shock", "priority"),
    S("Flame Shock", "priority"),
    S("Frost Shock", "priority"),
    S("Lightning Bolt", "priority"),
    S("Purge", "priority"),
    S("Windfury Totem", "priority"),
    S("Strength of Earth Totem", "priority"),
  },
  aoeSteps = {
    S("Fire Nova Totem", "priority"),
    S("Magma Totem", "priority"),
    S("Stormstrike", "priority"),
    S("Earth Shock", "priority"),
    S("Chain Lightning", "priority"),
    S("Flame Shock", "priority"),
  },
})

Put("Shaman", "Restoration", {
  name = "Restoration ST",
  description = "Era Resto: Nature's Swiftness + Mana Tide Totem (Resto tree), Chain Heal, Healing Wave, Lesser Healing Wave.",
  steps = {
    S("Lightning Shield", "once"),
    S("Nature's Swiftness", "sequential"),
    S("Mana Tide Totem", "sequential"),
    S("Lesser Healing Wave", "priority"),
    S("Healing Wave", "priority"),
    S("Chain Heal", "priority"),
    S("Cure Poison", "priority"),
    S("Cure Disease", "priority"),
    S("Purge", "priority"),
  },
  aoeSteps = {
    S("Chain Heal", "priority"),
    S("Mana Tide Totem", "priority"),
    S("Healing Stream Totem", "priority"),
    S("Healing Wave", "priority"),
    S("Lesser Healing Wave", "priority"),
    S("Nature's Swiftness", "priority"),
  },
})

---------------------------------------------------------------------------
-- WARLOCK
-- Aff: Siphon Life, Dark Pact, Amplify Curse. Demo: Fel Domination, Soul Link.
-- Destro: Conflagrate, Shadowburn.
---------------------------------------------------------------------------
Put("Warlock", "Affliction", {
  name = "Affliction ST",
  description = "Era Aff: Corruption, CoA, Siphon Life, Amplify Curse, Dark Pact, then Shadow Bolt. Drain Life as sustain.",
  steps = {
    S("Demon Armor", "once"),
    S("Amplify Curse", "sequential"),
    S("Corruption", "once"),
    S("Curse of Agony", "once"),
    S("Siphon Life", "once"),
    S("Immolate", "once"),
    S("Shadow Bolt", "priority"),
    S("Corruption", "priority"),
    S("Curse of Agony", "priority"),
    S("Siphon Life", "priority"),
    S("Dark Pact", "priority"),
    S("Drain Life", "priority"),
    S("Death Coil", "priority"),
    S("Fear", "priority"),
  },
  aoeSteps = {
    S("Rain of Fire", "priority", { cursor = true }),
    S("Hellfire", "priority"),
    S("Corruption", "priority"),
    S("Curse of Agony", "priority"),
    S("Siphon Life", "priority"),
    S("Shadow Bolt", "priority"),
  },
})

Put("Warlock", "Demonology", {
  name = "Demonology ST",
  description = "Era Demo: Fel Domination / Soul Link (Demo tree). Demonic Sacrifice is a pre-pull (manual). Then curse + Corruption + Shadow Bolt.",
  steps = {
    S("Demon Armor", "once"),
    S("Soul Link", "once"),
    S("Demonic Sacrifice", "sequential"),
    S("Fel Domination", "sequential"),
    S("Corruption", "once"),
    S("Curse of Shadow", "once"),
    S("Immolate", "once"),
    S("Shadow Bolt", "priority"),
    S("Corruption", "priority"),
    S("Searing Pain", "priority"),
    S("Death Coil", "priority"),
    S("Howl of Terror", "priority"),
    S("Fear", "priority"),
    S("Life Tap", "priority"),
  },
  aoeSteps = {
    S("Fel Domination", "sequential"),
    S("Hellfire", "priority"),
    S("Rain of Fire", "priority", { cursor = true }),
    S("Howl of Terror", "priority"),
    S("Corruption", "priority"),
    S("Shadow Bolt", "priority"),
  },
})

Put("Warlock", "Destruction", {
  name = "Destruction ST",
  description = "Era Destro: Immolate + Conflagrate + Shadowburn (Destro tree), Shadow Bolt / Soul Fire. No Siphon Life.",
  steps = {
    S("Demon Armor", "once"),
    S("Immolate", "once"),
    S("Conflagrate", "priority"),
    S("Shadow Bolt", "priority"),
    S("Soul Fire", "priority"),
    S("Immolate", "priority"),
    S("Searing Pain", "priority"),
    S("Shadowburn", "priority"),
    S("Death Coil", "priority"),
    S("Fear", "priority"),
  },
  aoeSteps = {
    S("Rain of Fire", "priority", { cursor = true }),
    S("Hellfire", "priority"),
    S("Immolate", "priority"),
    S("Conflagrate", "priority"),
    S("Shadowburn", "priority"),
    S("Shadow Bolt", "priority"),
  },
})

---------------------------------------------------------------------------
-- WARRIOR
-- Arms: Mortal Strike, Sweeping Strikes. Fury: Bloodthirst, Death Wish.
-- Prot: Shield Slam, Last Stand, Concussion Blow.
---------------------------------------------------------------------------
Put("Warrior", "Arms", {
  name = "Arms ST",
  description = "Era Arms: Mortal Strike + Sweeping Strikes + Overpower (Arms tree). Execute, Heroic Strike dump, Charge.",
  steps = {
    S("Charge", "once"),
    S("Battle Shout", "once"),
    S("Sweeping Strikes", "sequential"),
    S("Bloodrage", "sequential"),
    S("Execute", "priority"),
    S("Mortal Strike", "priority"),
    S("Overpower", "priority"),
    S("Slam", "priority"),
    S("Sunder Armor", "priority"),
    S("Whirlwind", "priority"),
    S("Heroic Strike", "priority"),
    S("Hamstring", "priority"),
    S("Bloodrage", "priority"),
    S("Intimidating Shout", "priority"),
    S("Retaliation", "priority"),
  },
  aoeSteps = {
    S("Sweeping Strikes", "sequential"),
    S("Whirlwind", "priority"),
    S("Cleave", "priority"),
    S("Mortal Strike", "priority"),
    S("Thunder Clap", "priority"),
    S("Demoralizing Shout", "priority"),
    S("Intimidating Shout", "priority"),
  },
})

Put("Warrior", "Fury", {
  name = "Fury ST",
  description = "Era Fury (IV): Bloodthirst + Death Wish (Fury tree), Whirlwind, Execute, Recklessness, Heroic Strike dump. No Mortal Strike.",
  steps = {
    S("Charge", "once"),
    S("Battle Shout", "once"),
    S("Death Wish", "sequential"),
    S("Recklessness", "sequential"),
    S("Bloodrage", "sequential"),
    S("Berserker Rage", "sequential"),
    S("Execute", "priority"),
    S("Bloodthirst", "priority"),
    S("Whirlwind", "priority"),
    S("Sunder Armor", "priority"),
    S("Pummel", "priority"),
    S("Intercept", "priority"),
    S("Heroic Strike", "priority"),
    S("Hamstring", "priority"),
    S("Bloodrage", "priority"),
  },
  aoeSteps = {
    S("Death Wish", "sequential"),
    S("Whirlwind", "priority"),
    S("Cleave", "priority"),
    S("Bloodthirst", "priority"),
    S("Demoralizing Shout", "priority"),
    S("Thunder Clap", "priority"),
    S("Intimidating Shout", "priority"),
  },
})

Put("Warrior", "Protection", {
  name = "Protection ST",
  description = "Era Prot: Shield Slam + Last Stand + Concussion Blow (Prot tree), Revenge, Sunder, Shield Block, Taunt, Shield Wall.",
  steps = {
    S("Battle Shout", "once"),
    S("Defensive Stance", "once"),
    S("Shield Block", "sequential"),
    S("Last Stand", "sequential"),
    S("Shield Slam", "priority"),
    S("Revenge", "priority"),
    S("Sunder Armor", "priority"),
    S("Concussion Blow", "priority"),
    S("Heroic Strike", "priority"),
    S("Shield Block", "priority"),
    S("Taunt", "priority"),
    S("Mocking Blow", "priority"),
    S("Shield Bash", "priority"),
    S("Shield Wall", "priority"),
  },
  aoeSteps = {
    S("Cleave", "priority"),
    S("Thunder Clap", "priority"),
    S("Demoralizing Shout", "priority"),
    S("Revenge", "priority"),
    S("Sunder Armor", "priority"),
    S("Challenging Shout", "priority"),
    S("Concussion Blow", "priority"),
    S("Shield Block", "priority"),
    S("Last Stand", "priority"),
  },
})

---------------------------------------------------------------------------
-- Lookup
---------------------------------------------------------------------------
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 = "Classic Era 1.15"
SpellSmasherClassicMethodOrders = M
