-- MoP Classic mash lists. Every spec 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 MoP Classic rotation pages + Wowhead.
-- Each spec owns its buttons (same rule as Era Hunter BM/MM/Surv).
-- Not Era vanilla. 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 "MoP Classic 5.5"
  rec.source = rec.source or "MoP Classic (Icy Veins / Wowhead)"
  ORDERS[className .. "|" .. spec] = rec
end

---------------------------------------------------------------------------
-- DEATH KNIGHT
---------------------------------------------------------------------------
Put("Death Knight", "Blood", {
  name = "Blood ST",
  description = "MoP Blood tank: Death Strike, Heart Strike, Blood Boil / Death and Decay. Bone Shield, Vampiric Blood, Dancing Rune Weapon. Frost/Unholy DPS buttons stay off this list.",
  steps = {
    S("Blood Presence", "once"),
    S("Horn of Winter", "once"),
    S("Bone Shield", "sequential"),
    S("Vampiric Blood", "sequential"),
    S("Dancing Rune Weapon", "sequential"),
    S("Icebound Fortitude", "sequential"),
    S("Anti-Magic Shell", "sequential"),
    S("Outbreak", "priority"),
    S("Death Strike", "priority"),
    S("Heart Strike", "priority"),
    S("Rune Strike", "priority"),
    S("Blood Boil", "priority"),
    S("Blood Tap", "priority"),
    S("Rune Tap", "priority"),
    S("Death Grip", "priority"),
    S("Dark Command", "priority"),
  },
  aoeSteps = {
    S("Blood Presence", "once"),
    S("Bone Shield", "sequential"),
    S("Dancing Rune Weapon", "sequential"),
    S("Death and Decay", "priority", { cursor = true }),
    S("Blood Boil", "priority"),
    S("Pestilence", "priority"),
    S("Death Strike", "priority"),
    S("Heart Strike", "priority"),
    S("Outbreak", "priority"),
    S("Gorefiend's Grasp", "priority"),
    S("Blood Tap", "priority"),
  },
})

Put("Death Knight", "Frost", {
  name = "Frost ST",
  description = "MoP Frost (IV Master Frost DW): Frost Presence, Pillar of Frost, Howling Blast / Obliterate / Frost Strike, Soul Reaper <35%. Killing Machine / Rime are procs (not buttons).",
  steps = {
    S("Frost Presence", "once"),
    S("Horn of Winter", "once"),
    S("Pillar of Frost", "sequential"),
    S("Raise Dead", "sequential"),
    S("Army of the Dead", "sequential"),
    S("Empower Rune Weapon", "sequential"),
    S("Outbreak", "priority"),
    S("Soul Reaper", "priority"),
    S("Frost Strike", "priority"),
    S("Obliterate", "priority"),
    S("Howling Blast", "priority"),
    S("Plague Strike", "priority"),
    S("Plague Leech", "priority"),
    S("Blood Tap", "priority"),
    S("Icebound Fortitude", "priority"),
    S("Anti-Magic Shell", "priority"),
  },
  aoeSteps = {
    S("Frost Presence", "once"),
    S("Pillar of Frost", "sequential"),
    S("Howling Blast", "priority"),
    S("Death and Decay", "priority", { cursor = true }),
    S("Plague Strike", "priority"),
    S("Pestilence", "priority"),
    S("Frost Strike", "priority"),
    S("Obliterate", "priority"),
    S("Outbreak", "priority"),
    S("Blood Tap", "priority"),
    S("Remorseless Winter", "priority"),
  },
})

Put("Death Knight", "Unholy", {
  name = "Unholy ST",
  description = "MoP Unholy: Unholy Presence, Dark Transformation, Scourge Strike / Festering Strike / Death Coil, Gargoyle. Frost DW buttons stay on Frost.",
  steps = {
    S("Unholy Presence", "once"),
    S("Horn of Winter", "once"),
    S("Raise Dead", "once"),
    S("Unholy Frenzy", "sequential"),
    S("Summon Gargoyle", "sequential"),
    S("Dark Transformation", "sequential"),
    S("Outbreak", "priority"),
    S("Soul Reaper", "priority"),
    S("Death Coil", "priority"),
    S("Scourge Strike", "priority"),
    S("Festering Strike", "priority"),
    S("Icy Touch", "priority"),
    S("Plague Strike", "priority"),
    S("Blood Tap", "priority"),
    S("Empower Rune Weapon", "priority"),
  },
  aoeSteps = {
    S("Unholy Presence", "once"),
    S("Dark Transformation", "sequential"),
    S("Death and Decay", "priority", { cursor = true }),
    S("Blood Boil", "priority"),
    S("Pestilence", "priority"),
    S("Death Coil", "priority"),
    S("Scourge Strike", "priority"),
    S("Outbreak", "priority"),
    S("Icy Touch", "priority"),
    S("Plague Strike", "priority"),
    S("Summon Gargoyle", "priority"),
  },
})

---------------------------------------------------------------------------
-- DRUID
---------------------------------------------------------------------------
Put("Druid", "Balance", {
  name = "Balance ST",
  description = "MoP Balance: Moonkin, Moonfire / Sunfire, Starsurge, Starfire / Wrath, Celestial Alignment / Incarnation. Hurricane / Starfall on packs. Guardian tank buttons stay off.",
  steps = {
    S("Moonkin Form", "once"),
    S("Mark of the Wild", "once"),
    S("Celestial Alignment", "sequential"),
    S("Incarnation: Chosen of Elune", "sequential"),
    S("Nature's Vigil", "sequential"),
    S("Moonfire", "once"),
    S("Sunfire", "once"),
    S("Starsurge", "priority"),
    S("Starfire", "priority"),
    S("Wrath", "priority"),
    S("Wild Mushroom", "priority"),
    S("Force of Nature", "priority"),
    S("Barkskin", "priority"),
  },
  aoeSteps = {
    S("Moonkin Form", "once"),
    S("Starfall", "sequential"),
    S("Hurricane", "priority", { cursor = true }),
    S("Wild Mushroom", "priority"),
    S("Moonfire", "priority"),
    S("Sunfire", "priority"),
    S("Starsurge", "priority"),
    S("Celestial Alignment", "priority"),
    S("Barkskin", "priority"),
  },
})

Put("Druid", "Feral", {
  name = "Feral ST",
  description = "MoP Feral cat: Savage Roar, Rip, Rake, Shred, Ferocious Bite, Tiger's Fury / Berserk. Guardian Savage Defense stays on Guardian.",
  steps = {
    S("Cat Form", "once"),
    S("Mark of the Wild", "once"),
    S("Prowl", "once"),
    S("Tiger's Fury", "sequential"),
    S("Berserk", "sequential"),
    S("Incarnation: King of the Jungle", "sequential"),
    S("Savage Roar", "priority"),
    S("Rip", "priority"),
    S("Rake", "priority"),
    S("Ferocious Bite", "priority"),
    S("Shred", "priority"),
    S("Mangle", "priority"),
    S("Faerie Fire", "priority"),
    S("Survival Instincts", "priority"),
  },
  aoeSteps = {
    S("Cat Form", "once"),
    S("Tiger's Fury", "sequential"),
    S("Berserk", "sequential"),
    S("Thrash", "priority"),
    S("Swipe", "priority"),
    S("Savage Roar", "priority"),
    S("Rip", "priority"),
    S("Rake", "priority"),
    S("Ferocious Bite", "priority"),
    S("Faerie Fire", "priority"),
  },
})

Put("Druid", "Guardian", {
  name = "Guardian ST",
  description = "MoP Guardian bear (own spec): Mangle, Thrash, Lacerate, Maul, Savage Defense, Frenzied Regeneration. Feral cat finishers stay on Feral.",
  steps = {
    S("Bear Form", "once"),
    S("Mark of the Wild", "once"),
    S("Enrage", "sequential"),
    S("Survival Instincts", "sequential"),
    S("Barkskin", "sequential"),
    S("Might of Ursoc", "sequential"),
    S("Savage Defense", "priority"),
    S("Mangle", "priority"),
    S("Thrash", "priority"),
    S("Lacerate", "priority"),
    S("Maul", "priority"),
    S("Faerie Fire", "priority"),
    S("Frenzied Regeneration", "priority"),
    S("Growl", "priority"),
  },
  aoeSteps = {
    S("Bear Form", "once"),
    S("Enrage", "sequential"),
    S("Thrash", "priority"),
    S("Swipe", "priority"),
    S("Mangle", "priority"),
    S("Lacerate", "priority"),
    S("Savage Defense", "priority"),
    S("Faerie Fire", "priority"),
    S("Challenging Roar", "priority"),
    S("Growl", "priority"),
    S("Frenzied Regeneration", "priority"),
  },
})

Put("Druid", "Restoration", {
  name = "Restoration ST",
  description = "MoP Resto: Lifebloom, Rejuv, Swiftmend, Regrowth, Wild Growth, Nature's Swiftness / Ironbark. Tranquility / Genesis on packs.",
  steps = {
    S("Mark of the Wild", "once"),
    S("Lifebloom", "once"),
    S("Nature's Swiftness", "sequential"),
    S("Ironbark", "sequential"),
    S("Innervate", "sequential"),
    S("Incarnation: Tree of Life", "sequential"),
    S("Swiftmend", "priority"),
    S("Regrowth", "priority"),
    S("Rejuvenation", "priority"),
    S("Healing Touch", "priority"),
    S("Wild Growth", "priority"),
    S("Nourish", "priority"),
    S("Barkskin", "priority"),
  },
  aoeSteps = {
    S("Wild Growth", "priority"),
    S("Tranquility", "priority"),
    S("Genesis", "priority"),
    S("Rejuvenation", "priority"),
    S("Swiftmend", "priority"),
    S("Lifebloom", "priority"),
    S("Innervate", "priority"),
    S("Barkskin", "priority"),
  },
})

---------------------------------------------------------------------------
-- HUNTER
---------------------------------------------------------------------------
Put("Hunter", "Beast Mastery", {
  name = "Beast Mastery ST",
  description = "MoP BM: Kill Command, Focus Fire, Bestial Wrath, Dire Beast / Stampede, Cobra Shot. Aimed Shot is MM. Explosive Shot is Survival.",
  steps = {
    S("Hunter's Mark", "once"),
    S("Aspect of the Hawk", "once"),
    S("Bestial Wrath", "sequential"),
    S("Focus Fire", "sequential"),
    S("Rapid Fire", "sequential"),
    S("Stampede", "sequential"),
    S("Kill Command", "priority"),
    S("Kill Shot", "priority"),
    S("Serpent Sting", "priority"),
    S("A Murder of Crows", "priority"),
    S("Glaive Toss", "priority"),
    S("Dire Beast", "priority"),
    S("Focus Fire", "priority"),
    S("Arcane Shot", "priority"),
    S("Cobra Shot", "priority"),
    S("Fervor", "priority"),
    S("Mend Pet", "priority"),
    S("Feign Death", "priority"),
  },
  aoeSteps = {
    S("Bestial Wrath", "sequential"),
    S("Focus Fire", "sequential"),
    S("Multi-Shot", "priority"),
    S("Kill Command", "priority"),
    S("Glaive Toss", "priority"),
    S("Barrage", "priority"),
    S("Explosive Trap", "priority", { cursor = true }),
    S("Cobra Shot", "priority"),
    S("Dire Beast", "priority"),
  },
})

Put("Hunter", "Marksmanship", {
  name = "Marksmanship ST",
  description = "MoP MM: Chimera Shot, Aimed Shot, Steady Shot, Kill Shot, Rapid Fire. Bestial Wrath is BM. Black Arrow is Survival.",
  steps = {
    S("Hunter's Mark", "once"),
    S("Aspect of the Hawk", "once"),
    S("Rapid Fire", "sequential"),
    S("Stampede", "sequential"),
    S("Chimera Shot", "priority"),
    S("Aimed Shot", "priority"),
    S("Steady Shot", "priority"),
    S("Kill Shot", "priority"),
    S("A Murder of Crows", "priority"),
    S("Arcane Shot", "priority"),
    S("Serpent Sting", "priority"),
    S("Glaive Toss", "priority"),
    S("Binding Shot", "priority"),
    S("Feign Death", "priority"),
  },
  aoeSteps = {
    S("Rapid Fire", "sequential"),
    S("Multi-Shot", "priority"),
    S("Chimera Shot", "priority"),
    S("Aimed Shot", "priority"),
    S("Barrage", "priority"),
    S("Glaive Toss", "priority"),
    S("Explosive Trap", "priority", { cursor = true }),
    S("Steady Shot", "priority"),
  },
})

Put("Hunter", "Survival", {
  name = "Survival ST",
  description = "MoP Survival: Explosive Shot, Black Arrow, Lock and Load, Serpent Sting, Cobra Shot. Kill Command is BM. Chimera Shot is MM.",
  steps = {
    S("Hunter's Mark", "once"),
    S("Aspect of the Hawk", "once"),
    S("Rapid Fire", "sequential"),
    S("Stampede", "sequential"),
    S("Explosive Shot", "priority"),
    S("Black Arrow", "priority"),
    S("Serpent Sting", "priority"),
    S("Kill Shot", "priority"),
    S("A Murder of Crows", "priority"),
    S("Arcane Shot", "priority"),
    S("Serpent Sting", "priority"),
    S("Glaive Toss", "priority"),
    S("Cobra Shot", "priority"),
    S("Explosive Trap", "priority", { cursor = true }),
    S("Feign Death", "priority"),
  },
  aoeSteps = {
    S("Rapid Fire", "sequential"),
    S("Explosive Shot", "priority"),
    S("Black Arrow", "priority"),
    S("Multi-Shot", "priority"),
    S("Explosive Trap", "priority", { cursor = true }),
    S("Barrage", "priority"),
    S("Glaive Toss", "priority"),
    S("Cobra Shot", "priority"),
    S("Serpent Sting", "priority"),
  },
})

---------------------------------------------------------------------------
-- MAGE
---------------------------------------------------------------------------
Put("Mage", "Arcane", {
  name = "Arcane ST",
  description = "MoP Arcane: Arcane Blast stacks, Arcane Missiles, Arcane Barrage, Arcane Power / Alter Time / Presence of Mind. Combustion is Fire.",
  steps = {
    S("Arcane Brilliance", "once"),
    S("Mage Armor", "once"),
    S("Arcane Power", "sequential"),
    S("Alter Time", "sequential"),
    S("Presence of Mind", "sequential"),
    S("Evocation", "sequential"),
    S("Nether Tempest", "once"),
    S("Arcane Missiles", "priority"),
    S("Arcane Blast", "priority"),
    S("Arcane Barrage", "priority"),
    S("Living Bomb", "priority"),
    S("Ice Block", "priority"),
    S("Counterspell", "priority"),
  },
  aoeSteps = {
    S("Arcane Power", "sequential"),
    S("Arcane Explosion", "priority"),
    S("Nether Tempest", "priority"),
    S("Arcane Barrage", "priority"),
    S("Arcane Missiles", "priority"),
    S("Flamestrike", "priority", { cursor = true }),
    S("Arcane Blast", "priority"),
    S("Evocation", "priority"),
  },
})

Put("Mage", "Fire", {
  name = "Fire ST",
  description = "MoP Fire: Pyroblast, Fireball, Inferno Blast, Combustion, Living Bomb. Frozen Orb is Frost. Arcane Missiles is Arcane.",
  steps = {
    S("Arcane Brilliance", "once"),
    S("Molten Armor", "once"),
    S("Combustion", "sequential"),
    S("Alter Time", "sequential"),
    S("Presence of Mind", "sequential"),
    S("Living Bomb", "once"),
    S("Pyroblast", "priority"),
    S("Inferno Blast", "priority"),
    S("Fireball", "priority"),
    S("Scorch", "priority"),
    S("Fire Blast", "priority"),
    S("Ice Block", "priority"),
    S("Counterspell", "priority"),
  },
  aoeSteps = {
    S("Combustion", "sequential"),
    S("Flamestrike", "priority", { cursor = true }),
    S("Living Bomb", "priority"),
    S("Dragon's Breath", "priority"),
    S("Inferno Blast", "priority"),
    S("Pyroblast", "priority"),
    S("Fireball", "priority"),
    S("Blast Wave", "priority"),
  },
})

Put("Mage", "Frost", {
  name = "Frost ST",
  description = "MoP Frost: Frostbolt, Ice Lance, Frozen Orb, Frostfire Bolt, Icy Veins / Frozen Orb. Combustion is Fire.",
  steps = {
    S("Arcane Brilliance", "once"),
    S("Frost Armor", "once"),
    S("Icy Veins", "sequential"),
    S("Alter Time", "sequential"),
    S("Frozen Orb", "sequential"),
    S("Mirror Image", "sequential"),
    S("Frost Bomb", "once"),
    S("Ice Lance", "priority"),
    S("Frostfire Bolt", "priority"),
    S("Frostbolt", "priority"),
    S("Deep Freeze", "priority"),
    S("Frozen Orb", "priority"),
    S("Ice Block", "priority"),
    S("Counterspell", "priority"),
  },
  aoeSteps = {
    S("Icy Veins", "sequential"),
    S("Frozen Orb", "sequential"),
    S("Blizzard", "priority", { cursor = true }),
    S("Cone of Cold", "priority"),
    S("Ice Lance", "priority"),
    S("Frost Bomb", "priority"),
    S("Frostbolt", "priority"),
    S("Frozen Orb", "priority"),
  },
})

---------------------------------------------------------------------------
-- MONK
---------------------------------------------------------------------------
Put("Monk", "Brewmaster", {
  name = "Brewmaster ST",
  description = "MoP Brewmaster tank: Keg Smash, Blackout Kick, Tiger Palm, Jab, Breath of Fire, Guard / Elusive Brew / Purifying Brew. Rising Sun Kick is Windwalker.",
  steps = {
    S("Stance of the Sturdy Ox", "once"),
    S("Legacy of the Emperor", "once"),
    S("Guard", "sequential"),
    S("Elusive Brew", "sequential"),
    S("Fortifying Brew", "sequential"),
    S("Touch of Death", "sequential"),
    S("Keg Smash", "priority"),
    S("Blackout Kick", "priority"),
    S("Tiger Palm", "priority"),
    S("Jab", "priority"),
    S("Breath of Fire", "priority"),
    S("Purifying Brew", "priority"),
    S("Expel Harm", "priority"),
    S("Chi Wave", "priority"),
    S("Provoke", "priority"),
  },
  aoeSteps = {
    S("Stance of the Sturdy Ox", "once"),
    S("Keg Smash", "priority"),
    S("Breath of Fire", "priority"),
    S("Spinning Crane Kick", "priority"),
    S("Dizzying Haze", "priority", { cursor = true }),
    S("Blackout Kick", "priority"),
    S("Tiger Palm", "priority"),
    S("Jab", "priority"),
    S("Rushing Jade Wind", "priority"),
    S("Purifying Brew", "priority"),
    S("Guard", "priority"),
  },
})

Put("Monk", "Mistweaver", {
  name = "Mistweaver ST",
  description = "MoP Mistweaver: Surging / Enveloping / Soothing Mist, Renewing Mist, Uplift, Thunder Focus Tea / Revival. Keg Smash is Brewmaster.",
  steps = {
    S("Stance of the Wise Serpent", "once"),
    S("Legacy of the Emperor", "once"),
    S("Thunder Focus Tea", "sequential"),
    S("Revival", "sequential"),
    S("Life Cocoon", "sequential"),
    S("Renewing Mist", "priority"),
    S("Surging Mist", "priority"),
    S("Enveloping Mist", "priority"),
    S("Soothing Mist", "priority"),
    S("Uplift", "priority"),
    S("Chi Wave", "priority"),
    S("Mana Tea", "priority"),
    S("Jab", "priority"),
    S("Blackout Kick", "priority"),
    S("Tiger Palm", "priority"),
  },
  aoeSteps = {
    S("Stance of the Wise Serpent", "once"),
    S("Revival", "sequential"),
    S("Thunder Focus Tea", "sequential"),
    S("Renewing Mist", "priority"),
    S("Uplift", "priority"),
    S("Spinning Crane Kick", "priority"),
    S("Chi Burst", "priority"),
    S("Surging Mist", "priority"),
    S("Mana Tea", "priority"),
    S("Chi Wave", "priority"),
  },
})

Put("Monk", "Windwalker", {
  name = "Windwalker ST",
  description = "MoP Windwalker (IV): Fierce Tiger, Rising Sun Kick, Fists of Fury, Tiger Palm / Blackout Kick, Jab, Energizing Brew / Tigereye Brew / Touch of Death. Keg Smash is Brewmaster.",
  steps = {
    S("Stance of the Fierce Tiger", "once"),
    S("Legacy of the White Tiger", "once"),
    S("Energizing Brew", "sequential"),
    S("Tigereye Brew", "sequential"),
    S("Invoke Xuen, the White Tiger", "sequential"),
    S("Touch of Death", "sequential"),
    S("Chi Brew", "sequential"),
    S("Rising Sun Kick", "priority"),
    S("Fists of Fury", "priority"),
    S("Blackout Kick", "priority"),
    S("Tiger Palm", "priority"),
    S("Chi Wave", "priority"),
    S("Jab", "priority"),
    S("Expel Harm", "priority"),
    S("Flying Serpent Kick", "priority"),
    S("Touch of Karma", "priority"),
    S("Fortifying Brew", "priority"),
  },
  aoeSteps = {
    S("Stance of the Fierce Tiger", "once"),
    S("Tigereye Brew", "sequential"),
    S("Storm, Earth, and Fire", "sequential"),
    S("Rushing Jade Wind", "priority"),
    S("Spinning Crane Kick", "priority"),
    S("Chi Burst", "priority"),
    S("Rising Sun Kick", "priority"),
    S("Fists of Fury", "priority"),
    S("Blackout Kick", "priority"),
    S("Tiger Palm", "priority"),
    S("Jab", "priority"),
    S("Invoke Xuen, the White Tiger", "priority"),
  },
})

---------------------------------------------------------------------------
-- PALADIN
---------------------------------------------------------------------------
Put("Paladin", "Holy", {
  name = "Holy ST",
  description = "MoP Holy: Holy Shock, Holy Light / Divine Light / Flash, Holy Radiance, Light of Dawn, Word of Glory. Shield of the Righteous is Prot. Templar's Verdict is Ret.",
  steps = {
    S("Seal of Insight", "once"),
    S("Blessing of Kings", "once"),
    S("Beacon of Light", "once"),
    S("Divine Favor", "sequential"),
    S("Avenging Wrath", "sequential"),
    S("Guardian of Ancient Kings", "sequential"),
    S("Holy Shock", "priority"),
    S("Word of Glory", "priority"),
    S("Holy Radiance", "priority"),
    S("Divine Light", "priority"),
    S("Holy Light", "priority"),
    S("Flash of Light", "priority"),
    S("Holy Prism", "priority"),
    S("Divine Protection", "priority"),
  },
  aoeSteps = {
    S("Light of Dawn", "priority"),
    S("Holy Radiance", "priority"),
    S("Holy Shock", "priority"),
    S("Holy Prism", "priority"),
    S("Light's Hammer", "priority", { cursor = true }),
    S("Word of Glory", "priority"),
    S("Avenging Wrath", "priority"),
    S("Divine Protection", "priority"),
  },
})

Put("Paladin", "Protection", {
  name = "Protection ST",
  description = "MoP Prot: Shield of the Righteous, Crusader Strike, Judgment, Avenger's Shield, Consecration, Word of Glory. Inquisition is Ret.",
  steps = {
    S("Righteous Fury", "once"),
    S("Seal of Insight", "once"),
    S("Blessing of Kings", "once"),
    S("Ardent Defender", "sequential"),
    S("Guardian of Ancient Kings", "sequential"),
    S("Divine Protection", "sequential"),
    S("Shield of the Righteous", "priority"),
    S("Crusader Strike", "priority"),
    S("Judgment", "priority"),
    S("Avenger's Shield", "priority"),
    S("Consecration", "priority", { player = true }),
    S("Holy Wrath", "priority"),
    S("Hammer of the Righteous", "priority"),
    S("Word of Glory", "priority"),
    S("Hammer of Wrath", "priority"),
    S("Reckoning", "priority"),
  },
  aoeSteps = {
    S("Hammer of the Righteous", "priority"),
    S("Avenger's Shield", "priority"),
    S("Consecration", "priority", { player = true }),
    S("Holy Wrath", "priority"),
    S("Judgment", "priority"),
    S("Shield of the Righteous", "priority"),
    S("Crusader Strike", "priority"),
    S("Hammer of Wrath", "priority"),
    S("Word of Glory", "priority"),
  },
})

Put("Paladin", "Retribution", {
  name = "Retribution ST",
  description = "MoP Ret: Inquisition, Templar's Verdict, Crusader Strike, Exorcism, Judgment, Hammer of Wrath, Avenging Wrath. Avenger's Shield is Prot.",
  steps = {
    S("Seal of Truth", "once"),
    S("Blessing of Kings", "once"),
    S("Inquisition", "once"),
    S("Avenging Wrath", "sequential"),
    S("Guardian of Ancient Kings", "sequential"),
    S("Holy Avenger", "sequential"),
    S("Templar's Verdict", "priority"),
    S("Crusader Strike", "priority"),
    S("Exorcism", "priority"),
    S("Judgment", "priority"),
    S("Hammer of Wrath", "priority"),
    S("Inquisition", "priority"),
    S("Execution Sentence", "priority"),
    S("Rebuke", "priority"),
    S("Divine Protection", "priority"),
  },
  aoeSteps = {
    S("Inquisition", "once"),
    S("Avenging Wrath", "sequential"),
    S("Divine Storm", "priority"),
    S("Hammer of the Righteous", "priority"),
    S("Exorcism", "priority"),
    S("Consecration", "priority", { player = true }),
    S("Holy Wrath", "priority"),
    S("Judgment", "priority"),
    S("Hammer of Wrath", "priority"),
    S("Inquisition", "priority"),
  },
})

---------------------------------------------------------------------------
-- PRIEST
---------------------------------------------------------------------------
Put("Priest", "Discipline", {
  name = "Discipline ST",
  description = "MoP Disc: Penance, Prayer of Mending, PW:Shield, Flash / Greater Heal, Archangel / Pain Suppression. Mind Flay is Shadow. Circle of Healing is Holy.",
  steps = {
    S("Inner Fire", "once"),
    S("Power Word: Fortitude", "once"),
    S("Pain Suppression", "sequential"),
    S("Power Infusion", "sequential"),
    S("Archangel", "sequential"),
    S("Spirit Shell", "sequential"),
    S("Penance", "priority"),
    S("Prayer of Mending", "priority"),
    S("Power Word: Shield", "priority"),
    S("Flash Heal", "priority"),
    S("Greater Heal", "priority"),
    S("Holy Fire", "priority"),
    S("Smite", "priority"),
    S("Cascade", "priority"),
  },
  aoeSteps = {
    S("Power Word: Barrier", "priority"),
    S("Prayer of Healing", "priority"),
    S("Prayer of Mending", "priority"),
    S("Cascade", "priority"),
    S("Divine Star", "priority"),
    S("Halo", "priority"),
    S("Archangel", "priority"),
    S("Penance", "priority"),
    S("Power Word: Shield", "priority"),
  },
})

Put("Priest", "Holy", {
  name = "Holy ST",
  description = "MoP Holy: Heal / Flash / Greater Heal, Prayer of Mending, Circle of Healing, Holy Word, Guardian Spirit / Lightwell. Penance is Disc.",
  steps = {
    S("Inner Fire", "once"),
    S("Power Word: Fortitude", "once"),
    S("Chakra: Serenity", "once"),
    S("Guardian Spirit", "sequential"),
    S("Divine Hymn", "sequential"),
    S("Lightwell", "sequential"),
    S("Holy Word: Serenity", "priority"),
    S("Prayer of Mending", "priority"),
    S("Circle of Healing", "priority"),
    S("Flash Heal", "priority"),
    S("Greater Heal", "priority"),
    S("Heal", "priority"),
    S("Renew", "priority"),
    S("Cascade", "priority"),
  },
  aoeSteps = {
    S("Chakra: Sanctuary", "once"),
    S("Divine Hymn", "sequential"),
    S("Holy Word: Sanctuary", "priority", { cursor = true }),
    S("Circle of Healing", "priority"),
    S("Prayer of Healing", "priority"),
    S("Prayer of Mending", "priority"),
    S("Cascade", "priority"),
    S("Halo", "priority"),
    S("Renew", "priority"),
  },
})

Put("Priest", "Shadow", {
  name = "Shadow ST",
  description = "MoP Shadow: Shadowform, SW:P / VT / Devouring Plague, Mind Blast, Mind Flay, Shadowfiend. Penance is Disc.",
  steps = {
    S("Shadowform", "once"),
    S("Inner Fire", "once"),
    S("Power Word: Fortitude", "once"),
    S("Mind Spike", "once"),
    S("Vampiric Touch", "once"),
    S("Shadow Word: Pain", "once"),
    S("Devouring Plague", "priority"),
    S("Mind Blast", "priority"),
    S("Shadow Word: Death", "priority"),
    S("Mind Flay", "priority"),
    S("Shadowfiend", "sequential"),
    S("Vampiric Embrace", "sequential"),
    S("Void Shift", "sequential"),
    S("Dispersion", "sequential"),
    S("Power Infusion", "sequential"),
    S("Cascade", "priority"),
    S("Silence", "priority"),
  },
  aoeSteps = {
    S("Shadowform", "once"),
    S("Mind Sear", "priority"),
    S("Cascade", "priority"),
    S("Halo", "priority"),
    S("Divine Star", "priority"),
    S("Shadow Word: Pain", "priority"),
    S("Vampiric Touch", "priority"),
    S("Devouring Plague", "priority"),
    S("Mind Blast", "priority"),
    S("Shadowfiend", "priority"),
  },
})

---------------------------------------------------------------------------
-- ROGUE
---------------------------------------------------------------------------
Put("Rogue", "Assassination", {
  name = "Assassination ST",
  description = "MoP Assassination: Mutilate / Dispatch, Envenom, Rupture, Slice and Dice, Vendetta / Shadow Blades. Revealing Strike / Killing Spree are Combat.",
  steps = {
    S("Deadly Poison", "once"),
    S("Leeching Poison", "once"),
    S("Stealth", "once"),
    S("Vendetta", "sequential"),
    S("Shadow Blades", "sequential"),
    S("Vanish", "sequential"),
    S("Slice and Dice", "priority"),
    S("Rupture", "priority"),
    S("Envenom", "priority"),
    S("Dispatch", "priority"),
    S("Mutilate", "priority"),
    S("Ambush", "priority"),
    S("Recuperate", "priority"),
    S("Kick", "priority"),
    S("Evasion", "priority"),
  },
  aoeSteps = {
    S("Deadly Poison", "once"),
    S("Vendetta", "sequential"),
    S("Crimson Tempest", "priority"),
    S("Fan of Knives", "priority"),
    S("Slice and Dice", "priority"),
    S("Envenom", "priority"),
    S("Mutilate", "priority"),
    S("Dispatch", "priority"),
    S("Shadow Blades", "priority"),
  },
})

Put("Rogue", "Combat", {
  name = "Combat ST",
  description = "MoP Combat (IV): Revealing Strike, Sinister Strike, Eviscerate, Slice and Dice, Rupture, Killing Spree / Adrenaline Rush / Shadow Blades. Blade Flurry on packs. Mutilate is Assassination.",
  steps = {
    S("Deadly Poison", "once"),
    S("Leeching Poison", "once"),
    S("Stealth", "once"),
    S("Killing Spree", "sequential"),
    S("Adrenaline Rush", "sequential"),
    S("Shadow Blades", "sequential"),
    S("Vanish", "sequential"),
    S("Slice and Dice", "priority"),
    S("Revealing Strike", "priority"),
    S("Rupture", "priority"),
    S("Eviscerate", "priority"),
    S("Sinister Strike", "priority"),
    S("Ambush", "priority"),
    S("Kick", "priority"),
    S("Evasion", "priority"),
    S("Cloak of Shadows", "priority"),
  },
  aoeSteps = {
    S("Deadly Poison", "once"),
    S("Blade Flurry", "once"),
    S("Killing Spree", "sequential"),
    S("Adrenaline Rush", "sequential"),
    S("Slice and Dice", "priority"),
    S("Revealing Strike", "priority"),
    S("Crimson Tempest", "priority"),
    S("Eviscerate", "priority"),
    S("Fan of Knives", "priority"),
    S("Sinister Strike", "priority"),
    S("Shadow Blades", "priority"),
  },
})

Put("Rogue", "Subtlety", {
  name = "Subtlety ST",
  description = "MoP Subtlety: Hemorrhage / Backstab, Ambush, Eviscerate, Rupture, Slice and Dice, Shadow Dance / Premeditation / Shadow Blades. Killing Spree is Combat.",
  steps = {
    S("Deadly Poison", "once"),
    S("Leeching Poison", "once"),
    S("Stealth", "once"),
    S("Premeditation", "once"),
    S("Shadow Dance", "sequential"),
    S("Shadow Blades", "sequential"),
    S("Vanish", "sequential"),
    S("Slice and Dice", "priority"),
    S("Rupture", "priority"),
    S("Eviscerate", "priority"),
    S("Hemorrhage", "priority"),
    S("Backstab", "priority"),
    S("Ambush", "priority"),
    S("Kick", "priority"),
    S("Evasion", "priority"),
    S("Cloak of Shadows", "priority"),
  },
  aoeSteps = {
    S("Deadly Poison", "once"),
    S("Shadow Dance", "sequential"),
    S("Crimson Tempest", "priority"),
    S("Fan of Knives", "priority"),
    S("Slice and Dice", "priority"),
    S("Hemorrhage", "priority"),
    S("Eviscerate", "priority"),
    S("Shadow Blades", "priority"),
    S("Ambush", "priority"),
  },
})

---------------------------------------------------------------------------
-- SHAMAN
---------------------------------------------------------------------------
Put("Shaman", "Elemental", {
  name = "Elemental ST",
  description = "MoP Elemental: Flame Shock, Lava Burst, Lightning Bolt, Earth Shock, Fire Elemental / Ascendance. Stormstrike is Enhancement.",
  steps = {
    S("Lightning Shield", "once"),
    S("Flametongue Weapon", "once"),
    S("Searing Totem", "once"),
    S("Fire Elemental Totem", "sequential"),
    S("Ascendance", "sequential"),
    S("Elemental Mastery", "sequential"),
    S("Spiritwalker's Grace", "sequential"),
    S("Flame Shock", "once"),
    S("Lava Burst", "priority"),
    S("Earth Shock", "priority"),
    S("Unleash Elements", "priority"),
    S("Lightning Bolt", "priority"),
    S("Thunderstorm", "priority"),
    S("Wind Shear", "priority"),
  },
  aoeSteps = {
    S("Fire Elemental Totem", "sequential"),
    S("Earthquake", "priority", { cursor = true }),
    S("Chain Lightning", "priority"),
    S("Thunderstorm", "priority"),
    S("Flame Shock", "priority"),
    S("Lava Burst", "priority"),
    S("Searing Totem", "priority"),
    S("Magma Totem", "priority"),
    S("Ascendance", "priority"),
  },
})

Put("Shaman", "Enhancement", {
  name = "Enhancement ST",
  description = "MoP Enhancement: Stormstrike, Lava Lash, Unleash Elements, Lightning Bolt, Flame Shock, Feral Spirit. Lava Burst is Elemental.",
  steps = {
    S("Lightning Shield", "once"),
    S("Windfury Weapon", "once"),
    S("Flametongue Weapon", "once"),
    S("Searing Totem", "once"),
    S("Feral Spirit", "sequential"),
    S("Fire Elemental Totem", "sequential"),
    S("Ascendance", "sequential"),
    S("Stormstrike", "priority"),
    S("Lava Lash", "priority"),
    S("Unleash Elements", "priority"),
    S("Flame Shock", "priority"),
    S("Lightning Bolt", "priority"),
    S("Earth Shock", "priority"),
    S("Wind Shear", "priority"),
    S("Stormlash Totem", "priority"),
    S("Shamanistic Rage", "priority"),
    S("Astral Shift", "priority"),
  },
  aoeSteps = {
    S("Feral Spirit", "sequential"),
    S("Fire Nova", "priority"),
    S("Chain Lightning", "priority"),
    S("Magma Totem", "priority"),
    S("Lava Lash", "priority"),
    S("Stormstrike", "priority"),
    S("Unleash Elements", "priority"),
    S("Flame Shock", "priority"),
    S("Ascendance", "priority"),
  },
})

Put("Shaman", "Restoration", {
  name = "Restoration ST",
  description = "MoP Resto: Riptide, Healing Wave / Greater / Surge, Chain Heal, Healing Rain, Earth Shield, Spirit Link / Mana Tide / Ascendance.",
  steps = {
    S("Water Shield", "once"),
    S("Earthliving Weapon", "once"),
    S("Earth Shield", "once"),
    S("Spirit Link Totem", "sequential"),
    S("Mana Tide Totem", "sequential"),
    S("Ascendance", "sequential"),
    S("Healing Tide Totem", "sequential"),
    S("Riptide", "priority"),
    S("Unleash Life", "priority"),
    S("Greater Healing Wave", "priority"),
    S("Healing Wave", "priority"),
    S("Healing Surge", "priority"),
    S("Chain Heal", "priority"),
    S("Healing Stream Totem", "priority"),
  },
  aoeSteps = {
    S("Healing Rain", "priority", { cursor = true }),
    S("Chain Heal", "priority"),
    S("Healing Tide Totem", "priority"),
    S("Healing Stream Totem", "priority"),
    S("Riptide", "priority"),
    S("Spirit Link Totem", "priority"),
    S("Ascendance", "priority"),
    S("Mana Tide Totem", "priority"),
    S("Unleash Life", "priority"),
  },
})

---------------------------------------------------------------------------
-- WARLOCK
---------------------------------------------------------------------------
Put("Warlock", "Affliction", {
  name = "Affliction ST",
  description = "MoP Affliction: Agony, Corruption, Unstable Affliction, Haunt, Malefic Grasp, Dark Soul: Misery. Chaos Bolt is Destro. Metamorphosis is Demo.",
  steps = {
    S("Dark Intent", "once"),
    S("Curse of the Elements", "once"),
    S("Dark Soul: Misery", "sequential"),
    S("Summon Doomguard", "sequential"),
    S("Soulburn", "sequential"),
    S("Agony", "once"),
    S("Corruption", "once"),
    S("Unstable Affliction", "once"),
    S("Haunt", "priority"),
    S("Malefic Grasp", "priority"),
    S("Drain Soul", "priority"),
    S("Soul Swap", "priority"),
    S("Unending Resolve", "priority"),
  },
  aoeSteps = {
    S("Dark Soul: Misery", "sequential"),
    S("Seed of Corruption", "priority"),
    S("Soulburn", "priority"),
    S("Agony", "priority"),
    S("Corruption", "priority"),
    S("Unstable Affliction", "priority"),
    S("Haunt", "priority"),
    S("Malefic Grasp", "priority"),
  },
})

Put("Warlock", "Demonology", {
  name = "Demonology ST",
  description = "MoP Demonology: Hand of Gul'dan, Shadow Bolt / Soul Fire, Metamorphosis (Doom / Touch of Chaos / Chaos Wave). Haunt is Aff. Chaos Bolt is Destro.",
  steps = {
    S("Dark Intent", "once"),
    S("Curse of the Elements", "once"),
    S("Dark Soul: Knowledge", "sequential"),
    S("Summon Doomguard", "sequential"),
    S("Corruption", "once"),
    S("Hand of Gul'dan", "priority"),
    S("Soul Fire", "priority"),
    S("Shadow Bolt", "priority"),
    S("Metamorphosis", "priority"),
    S("Doom", "priority"),
    S("Touch of Chaos", "priority"),
    S("Void Ray", "priority"),
    S("Carrion Swarm", "priority"),
    S("Unending Resolve", "priority"),
  },
  aoeSteps = {
    S("Dark Soul: Knowledge", "sequential"),
    S("Metamorphosis", "priority"),
    S("Immolation Aura", "priority"),
    S("Chaos Wave", "priority"),
    S("Void Ray", "priority"),
    S("Hellfire", "priority"),
    S("Hand of Gul'dan", "priority"),
    S("Corruption", "priority"),
    S("Carrion Swarm", "priority"),
  },
})

Put("Warlock", "Destruction", {
  name = "Destruction ST",
  description = "MoP Destro: Immolate, Conflagrate, Incinerate, Chaos Bolt, Rain of Fire, Havoc / Dark Soul: Instability. Haunt is Aff. Hand of Gul'dan is Demo.",
  steps = {
    S("Dark Intent", "once"),
    S("Curse of the Elements", "once"),
    S("Dark Soul: Instability", "sequential"),
    S("Summon Doomguard", "sequential"),
    S("Immolate", "once"),
    S("Conflagrate", "priority"),
    S("Chaos Bolt", "priority"),
    S("Incinerate", "priority"),
    S("Shadowburn", "priority"),
    S("Havoc", "priority"),
    S("Ember Tap", "priority"),
    S("Unending Resolve", "priority"),
  },
  aoeSteps = {
    S("Dark Soul: Instability", "sequential"),
    S("Rain of Fire", "priority", { cursor = true }),
    S("Fire and Brimstone", "priority"),
    S("Havoc", "priority"),
    S("Conflagrate", "priority"),
    S("Incinerate", "priority"),
    S("Immolate", "priority"),
    S("Chaos Bolt", "priority"),
  },
})

---------------------------------------------------------------------------
-- WARRIOR
---------------------------------------------------------------------------
Put("Warrior", "Arms", {
  name = "Arms ST",
  description = "MoP Arms: Colossus Smash, Mortal Strike, Overpower, Slam / Execute, Sweeping Strikes. Bloodthirst / Raging Blow are Fury.",
  steps = {
    S("Battle Stance", "once"),
    S("Battle Shout", "once"),
    S("Recklessness", "sequential"),
    S("Skull Banner", "sequential"),
    S("Avatar", "sequential"),
    S("Bloodbath", "sequential"),
    S("Colossus Smash", "priority"),
    S("Mortal Strike", "priority"),
    S("Overpower", "priority"),
    S("Execute", "priority"),
    S("Slam", "priority"),
    S("Heroic Strike", "priority"),
    S("Heroic Leap", "priority"),
    S("Die by the Sword", "priority"),
    S("Pummel", "priority"),
  },
  aoeSteps = {
    S("Battle Stance", "once"),
    S("Sweeping Strikes", "sequential"),
    S("Recklessness", "sequential"),
    S("Thunder Clap", "priority"),
    S("Bladestorm", "priority"),
    S("Dragon Roar", "priority"),
    S("Whirlwind", "priority"),
    S("Colossus Smash", "priority"),
    S("Mortal Strike", "priority"),
    S("Cleave", "priority"),
    S("Heroic Leap", "priority"),
  },
})

Put("Warrior", "Fury", {
  name = "Fury ST",
  description = "MoP Fury (IV): Colossus Smash, Bloodthirst, Raging Blow, Wild Strike, Execute, Recklessness / Skull Banner / Berserker Rage. Mortal Strike is Arms.",
  steps = {
    S("Battle Stance", "once"),
    S("Battle Shout", "once"),
    S("Recklessness", "sequential"),
    S("Skull Banner", "sequential"),
    S("Berserker Rage", "sequential"),
    S("Bloodbath", "sequential"),
    S("Colossus Smash", "priority"),
    S("Bloodthirst", "priority"),
    S("Raging Blow", "priority"),
    S("Wild Strike", "priority"),
    S("Execute", "priority"),
    S("Heroic Strike", "priority"),
    S("Dragon Roar", "priority"),
    S("Die by the Sword", "priority"),
    S("Pummel", "priority"),
    S("Enraged Regeneration", "priority"),
  },
  aoeSteps = {
    S("Battle Stance", "once"),
    S("Recklessness", "sequential"),
    S("Bloodthirst", "priority"),
    S("Whirlwind", "priority"),
    S("Raging Blow", "priority"),
    S("Dragon Roar", "priority"),
    S("Bladestorm", "priority"),
    S("Cleave", "priority"),
    S("Heroic Leap", "priority"),
    S("Colossus Smash", "priority"),
    S("Wild Strike", "priority"),
  },
})

Put("Warrior", "Protection", {
  name = "Protection ST",
  description = "MoP Prot: Shield Slam, Revenge, Devastate, Thunder Clap, Shield Block / Shield Barrier. Mortal Strike is Arms. Bloodthirst is Fury.",
  steps = {
    S("Defensive Stance", "once"),
    S("Commanding Shout", "once"),
    S("Shield Block", "sequential"),
    S("Last Stand", "sequential"),
    S("Shield Wall", "sequential"),
    S("Demoralizing Banner", "sequential"),
    S("Shield Slam", "priority"),
    S("Revenge", "priority"),
    S("Devastate", "priority"),
    S("Thunder Clap", "priority"),
    S("Shield Barrier", "priority"),
    S("Heroic Strike", "priority"),
    S("Heroic Leap", "priority"),
    S("Taunt", "priority"),
    S("Pummel", "priority"),
  },
  aoeSteps = {
    S("Defensive Stance", "once"),
    S("Thunder Clap", "priority"),
    S("Revenge", "priority"),
    S("Shockwave", "priority"),
    S("Dragon Roar", "priority"),
    S("Cleave", "priority"),
    S("Shield Slam", "priority"),
    S("Devastate", "priority"),
    S("Shield Block", "priority"),
    S("Demoralizing Shout", "priority"),
    S("Challenging Shout", "priority"),
  },
})

---------------------------------------------------------------------------
-- Lookup
---------------------------------------------------------------------------
local ALIAS = {
  Outlaw = "Combat",
}

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 = "MoP Classic 5.5"
SpellSmasherMopMethodOrders = M
