diff --git a/ui/balance_druid/presets.ts b/ui/balance_druid/presets.ts index 6abf54cb4c..d36a428f2f 100644 --- a/ui/balance_druid/presets.ts +++ b/ui/balance_druid/presets.ts @@ -12,7 +12,7 @@ import { UnitReference, Spec, TristateEffect } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { BalanceDruid_Options as BalanceDruidOptions, @@ -25,9 +25,9 @@ import { DruidMinorGlyph, } from '../core/proto/druid.js'; +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; import { Player } from "../core/player"; -import { APLRotation } from '../core/proto/apl.js'; import BasicP3AplJson from './apls/basic_p3.apl.json'; @@ -273,11 +273,4 @@ export const P3_PRESET_ALLI = { ]}`), }; - -export const ROTATION_PRESET_P3_APL = { -name: 'Basic P3 APL', -rotation: SavedRotation.create({ - specRotationOptionsJson: BalanceDruidRotation.toJsonString(DefaultRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(BasicP3AplJson)), -}), -}; \ No newline at end of file +export const ROTATION_PRESET_P3_APL = PresetUtils.makePresetAPLRotation('P3', BasicP3AplJson); diff --git a/ui/core/individual_sim_ui.ts b/ui/core/individual_sim_ui.ts index eb1a5f58f8..7c2543be3e 100644 --- a/ui/core/individual_sim_ui.ts +++ b/ui/core/individual_sim_ui.ts @@ -35,10 +35,9 @@ import { Stat, } from './proto/common'; -import { IndividualSimSettings, SavedRotation, SavedTalents } from './proto/ui'; +import { IndividualSimSettings, SavedTalents } from './proto/ui'; import { StatWeightsResult } from './proto/api'; -import { Gear } from './proto_utils/gear'; import { getMetaGemConditionDescription } from './proto_utils/gems'; import { professionNames } from './proto_utils/names'; import { Stats } from './proto_utils/stats'; @@ -52,6 +51,8 @@ import { specToLocalStorageKey, } from './proto_utils/utils'; +import {PresetGear, PresetRotation} from './preset_utils'; + import * as Exporters from './components/exporters'; import * as Importers from './components/importers'; import * as IconInputs from './components/icon_inputs'; @@ -142,25 +143,6 @@ export interface IndividualSimUIConfig { simpleRotation?: SimpleRotationGenerator, } -export interface GearAndStats { - gear: Gear, - bonusStats?: Stats, -} - -export interface PresetGear { - name: string; - gear: EquipmentSpec; - tooltip?: string; - enableWhen?: (obj: Player) => boolean; -} - -export interface PresetRotation { - name: string; - rotation: SavedRotation; - tooltip?: string; - enableWhen?: (obj: Player) => boolean; -} - export interface Settings { raidBuffs: RaidBuffs, partyBuffs: PartyBuffs, diff --git a/ui/core/preset_utils.ts b/ui/core/preset_utils.ts new file mode 100644 index 0000000000..7c0cc036ad --- /dev/null +++ b/ui/core/preset_utils.ts @@ -0,0 +1,70 @@ +import { + APLRotation, + APLRotation_Type as APLRotationType, +} from './proto/apl'; +import { + EquipmentSpec, + Spec, +} from './proto/common'; +import { + SavedRotation, +} from './proto/ui'; + +import { Player } from './player'; +import { + SpecRotation, + specTypeFunctions, +} from './proto_utils/utils'; + +export interface PresetGear { + name: string; + gear: EquipmentSpec; + tooltip?: string; + enableWhen?: (obj: Player) => boolean; +} + +export interface PresetRotation { + name: string; + rotation: SavedRotation; + tooltip?: string; + enableWhen?: (obj: Player) => boolean; +} + +export interface PresetRotationOptions { + talentTree?: number, +} + +export function makePresetAPLRotation(name: string, rotationJson: any, options?: PresetRotationOptions): PresetRotation { + const rotation = SavedRotation.create({ + specRotationOptionsJson: '{}', + rotation: APLRotation.fromJsonString(JSON.stringify(rotationJson)), + }); + return makePresetRotationHelper(name, rotation, options); +} + +export function makePresetSimpleRotation(name: string, spec: SpecType, simpleRotation: SpecRotation, options?: PresetRotationOptions): PresetRotation { + const rotation = SavedRotation.create({ + rotation: { + type: APLRotationType.TypeSimple, + simple: { + specRotationJson: JSON.stringify(specTypeFunctions[spec].rotationToJson(simpleRotation)), + }, + }, + }); + return makePresetRotationHelper(name, rotation, options); +} + +export function makePresetLegacyRotation(name: string, spec: SpecType, simpleRotation: SpecRotation, options?: PresetRotationOptions): PresetRotation { + const rotation = SavedRotation.create({ + specRotationOptionsJson: JSON.stringify(specTypeFunctions[spec].rotationToJson(simpleRotation)), + }); + return makePresetRotationHelper(name, rotation, options); +} + +function makePresetRotationHelper(name: string, rotation: SavedRotation, options?: PresetRotationOptions): PresetRotation { + return { + name: name, + enableWhen: options?.talentTree == undefined ? undefined : (player: Player) => player.getTalentTree() == options.talentTree, + rotation: rotation, + }; +} \ No newline at end of file diff --git a/ui/deathknight/presets.ts b/ui/deathknight/presets.ts index a7acadf931..0ce2d79fbf 100644 --- a/ui/deathknight/presets.ts +++ b/ui/deathknight/presets.ts @@ -12,7 +12,7 @@ import { UnitReference, Spec } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { Player } from '../core/player.js'; import { @@ -29,8 +29,8 @@ import { Deathknight_Rotation_BloodSpell, } from '../core/proto/deathknight.js'; +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; -import { APLRotation } from '../core/proto/apl.js'; import BloodPestiApl from './apls/blood_pesti.apl.json'; import BloodPestiDDApl from './apls/blood_pesti_dd.apl.json'; @@ -259,101 +259,18 @@ export const DefaultConsumes = Consumes.create({ fillerExplosive: Explosive.ExplosiveSaroniteBomb, }); -export const BLOOD_ROTATION_PRESET_LEGACY_DEFAULT = { - name: 'Blood Legacy', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultBloodRotation), - }), -} - -export const FROST_ROTATION_PRESET_LEGACY_DEFAULT = { - name: 'Frost Legacy', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultFrostRotation), - }), -} - -export const UNHOLY_DW_ROTATION_PRESET_LEGACY_DEFAULT = { - name: 'Unholy DW Legacy', - enableWhen: (player: Player) => player.getTalentTree() == 2, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultUnholyRotation), - }), -} - -export const BLOOD_PESTI_ROTATION_PRESET_DEFAULT = { - name: 'Blood Pesti APL', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultBloodRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(BloodPestiApl)), - }), -} - -export const BLOOD_PESTI_DD_ROTATION_PRESET_DEFAULT = { - name: 'Blood Pesti DD APL', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultBloodRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(BloodPestiDDApl)), - }), -} - -export const BLOOD_PESTI_AOE_ROTATION_PRESET_DEFAULT = { - name: 'Blood Pesti AOE APL', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultBloodRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(BloodPestiAoeApl)), - }), -} - -export const FROST_BL_PESTI_ROTATION_PRESET_DEFAULT = { - name: 'Frost BL Pesti APL', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultFrostRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(FrostBlPestiApl)), - }), -} - -export const FROST_UH_PESTI_ROTATION_PRESET_DEFAULT = { - name: 'Frost UH Pesti APL', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultFrostRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(FrostUhPestiApl)), - }), -} - -export const UNHOLY_DW_ROTATION_PRESET_DEFAULT = { - name: 'Unholy DW SS APL', - enableWhen: (player: Player) => player.getTalentTree() == 2, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultUnholyRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(UhDwSsApl)), - }), -} - -export const UNHOLY_2H_ROTATION_PRESET_DEFAULT = { - name: 'Unholy 2H SS APL', - enableWhen: (player: Player) => player.getTalentTree() == 2, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultUnholyRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(Uh2hSsApl)), - }), -} - -export const UNHOLY_DND_AOE_ROTATION_PRESET_DEFAULT = { - name: 'Unholy DND AOE APL', - enableWhen: (player: Player) => player.getTalentTree() == 2, - rotation: SavedRotation.create({ - specRotationOptionsJson: DeathKnightRotation.toJsonString(DefaultUnholyRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(UhDndAoeApl)), - }), -} +export const BLOOD_ROTATION_PRESET_LEGACY_DEFAULT = PresetUtils.makePresetLegacyRotation('Blood Legacy', Spec.SpecDeathknight, DefaultBloodRotation, { talentTree: 0 }); +export const FROST_ROTATION_PRESET_LEGACY_DEFAULT = PresetUtils.makePresetLegacyRotation('Frost Legacy', Spec.SpecDeathknight, DefaultFrostRotation, { talentTree: 1 }); +export const UNHOLY_DW_ROTATION_PRESET_LEGACY_DEFAULT = PresetUtils.makePresetLegacyRotation('Unholy DW Legacy', Spec.SpecDeathknight, DefaultUnholyRotation, { talentTree: 2 }); + +export const BLOOD_PESTI_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Blood Pesti', BloodPestiApl, { talentTree: 0 }); +export const BLOOD_PESTI_DD_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Blood Pesti DD', BloodPestiDDApl, { talentTree: 0 }); +export const BLOOD_PESTI_AOE_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Blood Pesti AOE', BloodPestiAoeApl, { talentTree: 0 }); +export const FROST_BL_PESTI_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Frost BL Pesti', FrostBlPestiApl, { talentTree: 1 }); +export const FROST_UH_PESTI_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Frost UH Pesti', FrostUhPestiApl, { talentTree: 1 }); +export const UNHOLY_DW_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Unholy DW SS', UhDwSsApl, { talentTree: 2 }); +export const UNHOLY_2H_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Unholy 2H SS', Uh2hSsApl, { talentTree: 2 }); +export const UNHOLY_DND_AOE_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Unholy DND AOE', UhDndAoeApl, { talentTree: 2 }); export const P1_BLOOD_BIS_PRESET = { name: 'P1 Blood', diff --git a/ui/elemental_shaman/presets.ts b/ui/elemental_shaman/presets.ts index 89589ba3e2..b2709996ee 100644 --- a/ui/elemental_shaman/presets.ts +++ b/ui/elemental_shaman/presets.ts @@ -5,10 +5,9 @@ import { Flask } from '../core/proto/common.js'; import { Food } from '../core/proto/common.js'; import { Glyphs } from '../core/proto/common.js'; import { Potions } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { Spec } from '../core/proto/common.js'; import { Player } from '../core/player.js'; -import { APLRotation } from '../core/proto/apl.js'; import { ElementalShaman_Rotation as ElementalShamanRotation, ElementalShaman_Options as ElementalShamanOptions, ShamanShield, ShamanMajorGlyph, ShamanMinorGlyph } from '../core/proto/shaman.js'; import { ElementalShaman_Rotation_RotationType as RotationType } from '../core/proto/shaman.js'; @@ -21,7 +20,7 @@ import { ShamanTotems, } from '../core/proto/shaman.js'; - +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; import { Faction } from '../core/proto/common.js'; @@ -244,18 +243,6 @@ export const P4_PRESET = { ]}`), }; -export const ROTATION_PRESET_DEFAULT = { - name: 'Default', - rotation: SavedRotation.create({ - specRotationOptionsJson: ElementalShamanRotation.toJsonString(DefaultRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(DefaultApl)), - }), -}; - -export const ROTATION_PRESET_ADVANCED = { - name: 'Advanced APL', - rotation: SavedRotation.create({ - specRotationOptionsJson: ElementalShamanRotation.toJsonString(DefaultRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(AdvancedApl)), - }), -} \ No newline at end of file +export const ROTATION_PRESET_LEGACY = PresetUtils.makePresetLegacyRotation('Legacy', Spec.SpecElementalShaman, DefaultRotation); +export const ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Default', DefaultApl); +export const ROTATION_PRESET_ADVANCED = PresetUtils.makePresetAPLRotation('Advanced', AdvancedApl); \ No newline at end of file diff --git a/ui/elemental_shaman/sim.ts b/ui/elemental_shaman/sim.ts index bb93ec8154..52af6bd7a6 100644 --- a/ui/elemental_shaman/sim.ts +++ b/ui/elemental_shaman/sim.ts @@ -159,6 +159,7 @@ export class ElementalShamanSimUI extends IndividualSimUI) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: HunterRotation.toJsonString(HunterRotation.create({ - })), - rotation: APLRotation.fromJsonString(JSON.stringify(BmApl)), - }), -}; - -export const ROTATION_PRESET_MM = { - name: 'MM', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: HunterRotation.toJsonString(HunterRotation.create({ - })), - rotation: APLRotation.fromJsonString(JSON.stringify(MmApl)), - }), -}; - -export const ROTATION_PRESET_MM_ADVANCED = { - name: 'MM (Advanced)', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: HunterRotation.toJsonString(HunterRotation.create({ - })), - rotation: APLRotation.fromJsonString(JSON.stringify(MmAdvApl)), - }), -}; - -export const ROTATION_PRESET_SV = { - name: 'SV', - enableWhen: (player: Player) => player.getTalentTree() == 2, - rotation: SavedRotation.create({ - specRotationOptionsJson: HunterRotation.toJsonString(HunterRotation.create({ - })), - rotation: APLRotation.fromJsonString(JSON.stringify(SvApl)), - }), -}; - -export const ROTATION_PRESET_SV_ADVANCED = { - name: 'SV (Advanced)', - enableWhen: (player: Player) => player.getTalentTree() == 2, - rotation: SavedRotation.create({ - specRotationOptionsJson: HunterRotation.toJsonString(HunterRotation.create({ - })), - rotation: APLRotation.fromJsonString(JSON.stringify(SvAdvApl)), - }), -}; - -export const ROTATION_PRESET_AOE = { - name: 'AOE', - rotation: SavedRotation.create({ - specRotationOptionsJson: HunterRotation.toJsonString(HunterRotation.create({ - })), - rotation: APLRotation.fromJsonString(JSON.stringify(AoeApl)), - }), -}; +export const ROTATION_PRESET_SIMPLE_DEFAULT = PresetUtils.makePresetSimpleRotation('Simple Default', Spec.SpecHunter, DefaultRotation); +export const ROTATION_PRESET_BM = PresetUtils.makePresetAPLRotation('BM', BmApl, { talentTree: 0 }); +export const ROTATION_PRESET_MM = PresetUtils.makePresetAPLRotation('MM', MmApl, { talentTree: 1 }); +export const ROTATION_PRESET_MM_ADVANCED = PresetUtils.makePresetAPLRotation('MM (Advanced)', MmAdvApl, { talentTree: 1 }); +export const ROTATION_PRESET_SV = PresetUtils.makePresetAPLRotation('SV', SvApl, { talentTree: 2 }); +export const ROTATION_PRESET_SV_ADVANCED = PresetUtils.makePresetAPLRotation('SV (Advanced)', SvAdvApl, { talentTree: 2 }); +export const ROTATION_PRESET_AOE = PresetUtils.makePresetAPLRotation('AOE', AoeApl); export const DefaultOptions = HunterOptions.create({ ammo: Ammo.SaroniteRazorheads, diff --git a/ui/hunter/sim.ts b/ui/hunter/sim.ts index 52a69023b1..3e8837c459 100644 --- a/ui/hunter/sim.ts +++ b/ui/hunter/sim.ts @@ -252,7 +252,7 @@ export class HunterSimUI extends IndividualSimUI { ], // Preset rotations that the user can quickly select. rotations: [ - Presets.ROTATION_PRESET_LEGACY_DEFAULT, + Presets.ROTATION_PRESET_SIMPLE_DEFAULT, Presets.ROTATION_PRESET_BM, Presets.ROTATION_PRESET_MM, Presets.ROTATION_PRESET_MM_ADVANCED, diff --git a/ui/mage/presets.ts b/ui/mage/presets.ts index 70270967b7..5044b232f0 100644 --- a/ui/mage/presets.ts +++ b/ui/mage/presets.ts @@ -1,14 +1,17 @@ -import {Conjured, Profession} from '../core/proto/common.js'; -import { Consumes } from '../core/proto/common.js'; -import { EquipmentSpec } from '../core/proto/common.js'; -import { Flask } from '../core/proto/common.js'; -import { Food } from '../core/proto/common.js'; -import { Glyphs } from '../core/proto/common.js'; -import { Potions } from '../core/proto/common.js'; -import { Spec } from '../core/proto/common.js'; -import { Faction } from '../core/proto/common.js'; -import { UnitReference } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; +import { + Conjured, + Consumes, + EquipmentSpec, + Faction, + Flask, + Food, + Glyphs, + Potions, + Profession, + Spec, + UnitReference, +} from '../core/proto/common.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { Player } from '../core/player.js'; import { @@ -20,8 +23,8 @@ import { MageMinorGlyph, } from '../core/proto/mage.js'; +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; -import { APLRotation, APLRotation_Type } from '../core/proto/apl.js'; import ArcaneApl from './apls/arcane.apl.json'; import FireApl from './apls/fire.apl.json'; @@ -171,80 +174,14 @@ export const OtherDefaults = { profession2: Profession.Tailoring, }; -export const ROTATION_PRESET_SIMPLE = { - name: 'Simple Default', - rotation: SavedRotation.create({ - rotation: { - type: APLRotation_Type.TypeSimple, - simple: { - specRotationJson: MageRotation.toJsonString(DefaultSimpleRotation), - }, - }, - }), -} - -export const ARCANE_ROTATION_PRESET_DEFAULT = { - name: 'Arcane', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: MageRotation.toJsonString(MageRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(ArcaneApl)) - }), -} - -export const FIRE_ROTATION_PRESET_DEFAULT = { - name: 'Fire', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: MageRotation.toJsonString(MageRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(FireApl)), - }), -} - -export const FROSTFIRE_ROTATION_PRESET_DEFAULT = { - name: 'Frostfire', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: MageRotation.toJsonString(MageRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(FrostFireApl)), - }), -} - -export const FROST_ROTATION_PRESET_DEFAULT = { - name: 'Frost', - enableWhen: (player: Player) => player.getTalentTree() == 2, - rotation: SavedRotation.create({ - specRotationOptionsJson: MageRotation.toJsonString(MageRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(FrostApl)), - }), -} - -export const ARCANE_ROTATION_PRESET_AOE = { - name: 'Arcane AOE', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: MageRotation.toJsonString(MageRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(ArcaneAoeApl)), - }), -} - -export const FIRE_ROTATION_PRESET_AOE = { - name: 'Fire AOE', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: MageRotation.toJsonString(MageRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(FireAoeApl)), - }), -} - -export const FROST_ROTATION_PRESET_AOE = { - name: 'Frost AOE', - enableWhen: (player: Player) => player.getTalentTree() == 2, - rotation: SavedRotation.create({ - specRotationOptionsJson: MageRotation.toJsonString(MageRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(FrostAoeApl)), - }), -} +export const ROTATION_PRESET_SIMPLE = PresetUtils.makePresetSimpleRotation('Simple Default', Spec.SpecMage, DefaultSimpleRotation); +export const ARCANE_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Arcane', ArcaneApl, { talentTree: 0 }); +export const ARCANE_ROTATION_PRESET_AOE = PresetUtils.makePresetAPLRotation('Arcane AOE', ArcaneAoeApl, { talentTree: 0 }); +export const FIRE_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Fire', FireApl, { talentTree: 1 }); +export const FROSTFIRE_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Frostfire', FrostFireApl, { talentTree: 1 }); +export const FIRE_ROTATION_PRESET_AOE = PresetUtils.makePresetAPLRotation('Fire AOE', FireAoeApl, { talentTree: 1 }); +export const FROST_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Frost', FrostApl, { talentTree: 2 }); +export const FROST_ROTATION_PRESET_AOE = PresetUtils.makePresetAPLRotation('Frost AOE', FrostAoeApl, { talentTree: 2 }); export const ARCANE_PRERAID_PRESET = { name: "Arcane Preraid Preset", diff --git a/ui/protection_paladin/presets.ts b/ui/protection_paladin/presets.ts index a3ca394aa9..04ea73877d 100644 --- a/ui/protection_paladin/presets.ts +++ b/ui/protection_paladin/presets.ts @@ -1,13 +1,13 @@ -import { Consumes } from '../core/proto/common.js'; -import { CustomRotation, CustomSpell } from '../core/proto/common.js'; -import { EquipmentSpec } from '../core/proto/common.js'; -import { Flask } from '../core/proto/common.js'; -import { Food } from '../core/proto/common.js'; -import { Potions } from '../core/proto/common.js'; -import { Spec } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; -import { APLRotation } from '../core/proto/apl.js'; -import { Player } from '../core/player.js'; +import { + Consumes, + CustomRotation, + CustomSpell, + EquipmentSpec, + Flask, + Food, + Potions, +} from '../core/proto/common.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { PaladinAura as PaladinAura, @@ -19,6 +19,7 @@ import { ProtectionPaladin_Options as ProtectionPaladinOptions, } from '../core/proto/paladin.js'; +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; import DefaultApl from './apls/default.apl.json'; @@ -64,14 +65,7 @@ export const DefaultRotation = ProtectionPaladinRotation.create({ }), }); -export const ROTATION_DEFAULT = { - name: 'Default (969)', - rotation: SavedRotation.create({ - specRotationOptionsJson: ProtectionPaladinRotation.toJsonString(ProtectionPaladinRotation.create({ - })), - rotation: APLRotation.fromJsonString(JSON.stringify(DefaultApl)), - }), -}; +export const ROTATION_DEFAULT = PresetUtils.makePresetAPLRotation('Default (969)', DefaultApl); export const DefaultOptions = ProtectionPaladinOptions.create({ aura: PaladinAura.RetributionAura, @@ -88,7 +82,6 @@ export const DefaultConsumes = Consumes.create({ export const PRERAID_PRESET = { name: 'Preraid Preset', tooltip: Tooltips.BASIC_BIS_DISCLAIMER, - enableWhen: (player: Player) => true, gear: EquipmentSpec.fromJsonString(`{"items": [ {"id":42549,"enchant":3818,"gems":[41396,49110]}, {"id":40679}, @@ -113,7 +106,6 @@ export const PRERAID_PRESET = { export const P1_PRESET = { name: 'P1 Preset', tooltip: Tooltips.BASIC_BIS_DISCLAIMER, - enableWhen: (player: Player) => true, gear: EquipmentSpec.fromJsonString(`{"items": [ {"id":40581,"enchant":3818,"gems":[41380,36767]}, {"id":40387}, @@ -138,7 +130,6 @@ export const P1_PRESET = { export const P2_PRESET = { name: 'P2 Preset', tooltip: Tooltips.BASIC_BIS_DISCLAIMER, - enableWhen: (player: Player) => true, gear: EquipmentSpec.fromJsonString(`{ "items": [ {"id":46175,"enchant":3818,"gems":[41380,40088]}, diff --git a/ui/protection_warrior/presets.ts b/ui/protection_warrior/presets.ts index 7734715415..6a363fd213 100644 --- a/ui/protection_warrior/presets.ts +++ b/ui/protection_warrior/presets.ts @@ -1,11 +1,16 @@ -import { CustomRotation, CustomSpell } from '../core/proto/common.js'; -import { BattleElixir, Consumes, Explosive, GuardianElixir } from '../core/proto/common.js'; -import { EquipmentSpec } from '../core/proto/common.js'; -import { Food } from '../core/proto/common.js'; -import { Potions } from '../core/proto/common.js'; -import { Glyphs } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; -import { APLRotation } from '../core/proto/apl.js'; +import { + BattleElixir, + Consumes, + CustomRotation, + CustomSpell, + EquipmentSpec, + Explosive, + Food, + Glyphs, + GuardianElixir, + Potions, +} from '../core/proto/common.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { WarriorShout, @@ -18,6 +23,7 @@ import { WarriorMinorGlyph, } from '../core/proto/warrior.js'; +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; import DefaultApl from './apls/default.apl.json'; @@ -78,14 +84,7 @@ export const DefaultRotation = ProtectionWarriorRotation.create({ hsRageThreshold: 30, }); -export const ROTATION_DEFAULT = { - name: 'Default', - rotation: SavedRotation.create({ - specRotationOptionsJson: ProtectionWarriorRotation.toJsonString(ProtectionWarriorRotation.create({ - })), - rotation: APLRotation.fromJsonString(JSON.stringify(DefaultApl)), - }), -}; +export const ROTATION_DEFAULT = PresetUtils.makePresetAPLRotation('Default', DefaultApl); export const DefaultOptions = ProtectionWarriorOptions.create({ shout: WarriorShout.WarriorShoutCommanding, diff --git a/ui/restoration_shaman/presets.ts b/ui/restoration_shaman/presets.ts index 44693a9d88..11dc2e629a 100644 --- a/ui/restoration_shaman/presets.ts +++ b/ui/restoration_shaman/presets.ts @@ -1,10 +1,11 @@ -import { Consumes } from '../core/proto/common.js'; - -import { EquipmentSpec } from '../core/proto/common.js'; -import { Flask } from '../core/proto/common.js'; -import { Food } from '../core/proto/common.js'; -import { Glyphs } from '../core/proto/common.js'; -import { Potions } from '../core/proto/common.js'; +import { + Consumes, + EquipmentSpec, + Flask, + Food, + Glyphs, + Potions, +} from '../core/proto/common.js'; import { SavedTalents } from '../core/proto/ui.js'; import { @@ -13,7 +14,6 @@ import { ShamanShield, ShamanMajorGlyph, ShamanMinorGlyph, - ShamanHealSpell, } from '../core/proto/shaman.js'; import { diff --git a/ui/retribution_paladin/presets.ts b/ui/retribution_paladin/presets.ts index fcc2835e60..07fe7ecc63 100644 --- a/ui/retribution_paladin/presets.ts +++ b/ui/retribution_paladin/presets.ts @@ -1,14 +1,16 @@ -import { Conjured, Consumes } from '../core/proto/common.js'; -import { CustomRotation, CustomSpell } from '../core/proto/common.js'; -import { EquipmentSpec } from '../core/proto/common.js'; -import { Flask } from '../core/proto/common.js'; -import { Food } from '../core/proto/common.js'; -import { Glyphs } from '../core/proto/common.js'; -import { Potions } from '../core/proto/common.js'; -import { Spec } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; -import { Player } from '../core/player.js'; -import { APLRotation } from '../core/proto/apl.js'; +import { + Conjured, + Consumes, + CustomRotation, + CustomSpell, + EquipmentSpec, + Flask, + Food, + Glyphs, + Potions, + Spec, +} from '../core/proto/common.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { PaladinAura as PaladinAura, @@ -21,6 +23,7 @@ import { PaladinMinorGlyph, } from '../core/proto/paladin.js'; +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; import DefaultApl from './apls/default.apl.json'; @@ -116,7 +119,6 @@ export const DefaultConsumes = Consumes.create({ export const PRE_RAID_PRESET = { name: 'Pre-Raid Preset', tooltip: Tooltips.BASIC_BIS_DISCLAIMER, - enableWhen: (player: Player) => true, gear: EquipmentSpec.fromJsonString(`{"items": [ {"id":41386,"enchant":3817,"gems":[41398,40022]}, {"id":40678}, @@ -141,7 +143,6 @@ export const PRE_RAID_PRESET = { export const P1_PRESET = { name: 'P1 Preset', tooltip: Tooltips.BASIC_BIS_DISCLAIMER, - enableWhen: (player: Player) => true, gear: EquipmentSpec.fromJsonString(`{"items": [ {"id":44006,"enchant":3817,"gems":[41398,49110]}, {"id":44664,"gems":[42142]}, @@ -166,7 +167,6 @@ export const P1_PRESET = { export const P2_PRESET = { name: 'P2 Preset', tooltip: Tooltips.BASIC_BIS_DISCLAIMER, - enableWhen: (player: Player) => true, gear: EquipmentSpec.fromJsonString(`{"items": [ {"id":45472,"enchant":3817,"gems":[41398,42702]}, {"id":45517,"gems":[39996]}, @@ -191,7 +191,6 @@ export const P2_PRESET = { export const P3_PRESET = { name: 'P3 Mace Preset', tooltip: Tooltips.BASIC_BIS_DISCLAIMER, - enableWhen: (player: Player) => true, gear: EquipmentSpec.fromJsonString(`{"items": [ {"id":48614,"enchant":3817,"gems":[41398,40142]}, {"id":47110,"gems":[40142]}, @@ -216,7 +215,6 @@ export const P3_PRESET = { export const P4_PRESET = { name: 'P4 Preset', tooltip: Tooltips.BASIC_BIS_DISCLAIMER, - enableWhen: (player: Player) => true, gear: EquipmentSpec.fromJsonString(`{"items": [ {"id":51277,"enchant":3817,"gems":[41398,40118]}, {"id":50633,"gems":[40111]}, @@ -241,7 +239,6 @@ export const P4_PRESET = { export const P5_PRESET = { name: 'P5 Preset', tooltip: Tooltips.BASIC_BIS_DISCLAIMER, - enableWhen: (player: Player) => true, gear: EquipmentSpec.fromJsonString(`{"items": [ {"id":51277,"enchant":3817,"gems":[41398,40111]}, {"id":54581,"gems":[40146]}, @@ -263,10 +260,5 @@ export const P5_PRESET = { ]}`), }; -export const ROTATION_PRESET_DEFAULT = { - name: 'Default', - rotation: SavedRotation.create({ - specRotationOptionsJson: RetributionPaladinRotation.toJsonString(DefaultRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(DefaultApl)), - }), -}; \ No newline at end of file +export const ROTATION_PRESET_LEGACY_DEFAULT = PresetUtils.makePresetLegacyRotation('Legacy Default', Spec.SpecRetributionPaladin, DefaultRotation); +export const ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Default', DefaultApl); \ No newline at end of file diff --git a/ui/retribution_paladin/sim.ts b/ui/retribution_paladin/sim.ts index bcbf37d8a3..8539b54eca 100644 --- a/ui/retribution_paladin/sim.ts +++ b/ui/retribution_paladin/sim.ts @@ -203,6 +203,7 @@ export class RetributionPaladinSimUI extends IndividualSimUI) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: RogueRotation.toJsonString(RogueRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(MutilateApl)), - }), -}; - -export const ROTATION_PRESET_RUPTURE_MUTILATE = { - name: 'Rupture Mutilate', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: RogueRotation.toJsonString(RogueRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(RuptureMutilateApl)), - }), -}; - -export const ROTATION_PRESET_MUTILATE_EXPOSE = { - name: 'Mutilate w/ Expose', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: RogueRotation.toJsonString(RogueRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(MutilateExposeApl)), - }), -}; - -export const ROTATION_PRESET_RUPTURE_MUTILATE_EXPOSE = { - name: 'Rupture Mutilate w/ Expose', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: RogueRotation.toJsonString(RogueRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(RuptureMutilateExposeApl)), - }), -}; - -export const ROTATION_PRESET_COMBAT = { - name: 'Combat', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: RogueRotation.toJsonString(RogueRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(CombatApl)), - }), -}; - -export const ROTATION_PRESET_COMBAT_EXPOSE = { - name: 'Combat w/ Expose', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: RogueRotation.toJsonString(RogueRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(CombatExposeApl)), - }), -}; - -export const ROTATION_PRESET_COMBAT_CLEAVE_SND = { - name: 'Combat Cleave SND', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: RogueRotation.toJsonString(RogueRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(CombatCleaveSndApl)), - }), -}; - -export const ROTATION_PRESET_COMBAT_CLEAVE_SND_EXPOSE = { - name: 'Combat Cleave SND w/ Expose', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: RogueRotation.toJsonString(RogueRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(CombatCleaveSndExposeApl)), - }), -}; - -export const ROTATION_PRESET_AOE = { - name: 'Fan AOE', - rotation: SavedRotation.create({ - specRotationOptionsJson: RogueRotation.toJsonString(RogueRotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(FanAoeApl)), - }), -}; +export const ROTATION_PRESET_MUTILATE = PresetUtils.makePresetAPLRotation('Mutilate', MutilateApl, { talentTree: 0 }); +export const ROTATION_PRESET_RUPTURE_MUTILATE = PresetUtils.makePresetAPLRotation('Rupture Mutilate', RuptureMutilateApl, { talentTree: 0 }); +export const ROTATION_PRESET_MUTILATE_EXPOSE = PresetUtils.makePresetAPLRotation('Mutilate w/ Expose', MutilateExposeApl, { talentTree: 0 }); +export const ROTATION_PRESET_RUPTURE_MUTILATE_EXPOSE = PresetUtils.makePresetAPLRotation('Rupture Mutilate w/ Expose', RuptureMutilateExposeApl, { talentTree: 0 }); +export const ROTATION_PRESET_COMBAT = PresetUtils.makePresetAPLRotation('Combat', CombatApl, { talentTree: 1 }); +export const ROTATION_PRESET_COMBAT_EXPOSE = PresetUtils.makePresetAPLRotation('Combat w/ Expose', CombatExposeApl, { talentTree: 1 }); +export const ROTATION_PRESET_COMBAT_CLEAVE_SND = PresetUtils.makePresetAPLRotation('Combat Cleave SND', CombatCleaveSndApl, { talentTree: 1 }); +export const ROTATION_PRESET_COMBAT_CLEAVE_SND_EXPOSE = PresetUtils.makePresetAPLRotation('Combat Cleave SND w/ Expose', CombatCleaveSndExposeApl, { talentTree: 1 }); +export const ROTATION_PRESET_AOE = PresetUtils.makePresetAPLRotation('Fan AOE', FanAoeApl); export const DefaultRotation = RogueRotation.create({ exposeArmorFrequency: Rogue_Rotation_Frequency.Never, diff --git a/ui/shadow_priest/inputs.ts b/ui/shadow_priest/inputs.ts index 563819ecef..4bae63e95d 100644 --- a/ui/shadow_priest/inputs.ts +++ b/ui/shadow_priest/inputs.ts @@ -1,12 +1,9 @@ -import { IndividualSimUI } from '../core/individual_sim_ui.js'; -import { Player } from '../core/player.js'; import { Spec } from '../core/proto/common.js'; import { ShadowPriest_Options_Armor as Armor, ShadowPriest_Rotation_RotationType as RotationType, ShadowPriest_Rotation_PreCastOption as precastType } from '../core/proto/priest.js'; -import { EventID } from '../core/typed_event.js'; import { ActionId } from '../core/proto_utils/action_id.js'; import * as InputHelpers from '../core/components/input_helpers.js'; diff --git a/ui/shadow_priest/presets.ts b/ui/shadow_priest/presets.ts index 584541140e..574a543fb9 100644 --- a/ui/shadow_priest/presets.ts +++ b/ui/shadow_priest/presets.ts @@ -1,15 +1,16 @@ -import { Consumes } from '../core/proto/common.js'; -import { EquipmentSpec } from '../core/proto/common.js'; -import { Flask } from '../core/proto/common.js'; -import { Food } from '../core/proto/common.js'; -import { Glyphs } from '../core/proto/common.js'; -import { Potions } from '../core/proto/common.js'; -import { RaidBuffs } from '../core/proto/common.js'; -import { IndividualBuffs } from '../core/proto/common.js'; -import { Debuffs } from '../core/proto/common.js'; -import { TristateEffect } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; -import { APLRotation } from '../core/proto/apl.js'; +import { + Consumes, + Debuffs, + EquipmentSpec, + Flask, + Food, + Glyphs, + IndividualBuffs, + Potions, + RaidBuffs, + TristateEffect, +} from '../core/proto/common.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { ShadowPriest_Rotation as Rotation, @@ -19,7 +20,7 @@ import { PriestMinorGlyph as MinorGlyph, } from '../core/proto/priest.js'; - +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; import DefaultApl from './apls/default.apl.json' @@ -194,10 +195,4 @@ export const P3_PRESET = { }`), }; -export const ROTATION_PRESET_DEFAULT = { - name: 'Default', - rotation: SavedRotation.create({ - specRotationOptionsJson: Rotation.toJsonString(Rotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(DefaultApl)), - }), -}; +export const ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Default', DefaultApl); diff --git a/ui/smite_priest/presets.ts b/ui/smite_priest/presets.ts index de56dde1b8..af59a4184c 100644 --- a/ui/smite_priest/presets.ts +++ b/ui/smite_priest/presets.ts @@ -1,16 +1,18 @@ -import { Consumes } from '../core/proto/common.js'; -import { EquipmentSpec } from '../core/proto/common.js'; -import { Flask } from '../core/proto/common.js'; -import { Food } from '../core/proto/common.js'; -import { Glyphs } from '../core/proto/common.js'; -import { Potions } from '../core/proto/common.js'; -import { RaidBuffs } from '../core/proto/common.js'; -import { IndividualBuffs } from '../core/proto/common.js'; -import { Debuffs } from '../core/proto/common.js'; -import { UnitReference } from '../core/proto/common.js'; -import { TristateEffect } from '../core/proto/common.js'; -import { APLRotation } from '../core/proto/apl.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; +import { + Consumes, + Debuffs, + EquipmentSpec, + Flask, + Food, + Glyphs, + IndividualBuffs, + Potions, + RaidBuffs, + Spec, + TristateEffect, + UnitReference, +} from '../core/proto/common.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { SmitePriest_Rotation as Rotation, @@ -19,6 +21,7 @@ import { PriestMinorGlyph as MinorGlyph, } from '../core/proto/priest.js'; +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; import DefaultApl from './apls/default.apl.json' @@ -49,19 +52,8 @@ export const DefaultRotation = Rotation.create({ useShadowWordDeath: false, useMindBlast: false, }); -export const ROTATION_PRESET_LEGACY_DEFAULT = { - name: 'Legacy Default', - rotation: SavedRotation.create({ - specRotationOptionsJson: Rotation.toJsonString(DefaultRotation), - }), -} -export const ROTATION_PRESET_APL = { - name: 'APL', - rotation: SavedRotation.create({ - specRotationOptionsJson: Rotation.toJsonString(Rotation.create()), - rotation: APLRotation.fromJsonString(JSON.stringify(DefaultApl)), - }), -}; +export const ROTATION_PRESET_LEGACY_DEFAULT = PresetUtils.makePresetLegacyRotation('Legacy Default', Spec.SpecSmitePriest, DefaultRotation); +export const ROTATION_PRESET_APL = PresetUtils.makePresetAPLRotation('Default', DefaultApl); export const DefaultOptions = Options.create({ useInnerFire: true, diff --git a/ui/tank_deathknight/inputs.ts b/ui/tank_deathknight/inputs.ts index a1ada74739..53f98dd485 100644 --- a/ui/tank_deathknight/inputs.ts +++ b/ui/tank_deathknight/inputs.ts @@ -1,6 +1,5 @@ import { Spec } from '../core/proto/common.js'; - import { DeathknightTalents as DeathknightTalents, Deathknight_Rotation as DeathknightRotation, diff --git a/ui/tank_deathknight/presets.ts b/ui/tank_deathknight/presets.ts index 26cf29d060..2b0d0b95cc 100644 --- a/ui/tank_deathknight/presets.ts +++ b/ui/tank_deathknight/presets.ts @@ -1,12 +1,13 @@ -import { Consumes, Spec } from '../core/proto/common.js'; -import { EquipmentSpec } from '../core/proto/common.js'; -import { Flask } from '../core/proto/common.js'; -import { Food } from '../core/proto/common.js'; -import { Glyphs } from '../core/proto/common.js'; -import { Potions } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; -import { APLRotation } from '../core/proto/apl.js'; -import { Player } from '../core/player.js'; +import { + Consumes, + EquipmentSpec, + Flask, + Food, + Glyphs, + Potions, + Spec, +} from '../core/proto/common.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { TankDeathknight_Rotation as TankDeathKnightRotation, @@ -19,6 +20,7 @@ import { TankDeathknight_Rotation_Presence as Presence, } from '../core/proto/deathknight.js'; +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; import BloodAggroApl from './apls/blood_aggro.apl.json'; @@ -117,31 +119,9 @@ export const DefaultConsumes = Consumes.create({ prepopPotion: Potions.IndestructiblePotion, }); -export const BLOOD_LEGACY_PRESET_LEGACY_DEFAULT = { - name: 'Blood Legacy', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: TankDeathKnightRotation.toJsonString(DefaultRotation), - }), -} - -export const BLOOD_IT_SPAM_ROTATION_PRESET_DEFAULT = { - name: 'Blood Icy Touch', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: TankDeathKnightRotation.toJsonString(DefaultRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(BloodIcyTouchApl)), - }), -} - -export const BLOOD_AGGRO_ROTATION_PRESET_DEFAULT = { - name: 'Blood Aggro', - enableWhen: (player: Player) => player.getTalentTree() == 0, - rotation: SavedRotation.create({ - specRotationOptionsJson: TankDeathKnightRotation.toJsonString(DefaultRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(BloodAggroApl)), - }), -} +export const BLOOD_LEGACY_PRESET_LEGACY_DEFAULT = PresetUtils.makePresetLegacyRotation('Blood Legacy', Spec.SpecTankDeathknight, DefaultRotation); +export const BLOOD_IT_SPAM_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Blood Icy Touch', BloodIcyTouchApl); +export const BLOOD_AGGRO_ROTATION_PRESET_DEFAULT = PresetUtils.makePresetAPLRotation('Blood Aggro', BloodAggroApl); export const P1_BLOOD_PRESET = { name: 'P1 Blood', diff --git a/ui/warlock/presets.ts b/ui/warlock/presets.ts index 7237e7c6f8..d946e05eb9 100644 --- a/ui/warlock/presets.ts +++ b/ui/warlock/presets.ts @@ -13,7 +13,7 @@ import { Faction, Spec, Profession, } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { Player } from '../core/player.js'; import { @@ -29,7 +29,8 @@ import { WarlockMajorGlyph as MajorGlyph, WarlockMinorGlyph as MinorGlyph, } from '../core/proto/warlock.js'; -import { APLRotation } from '../core/proto/apl.js'; + +import * as PresetUtils from '../core/preset_utils.js'; import DemoApl from './apls/demo.apl.json'; import DestroApl from './apls/destro.apl.json'; @@ -526,16 +527,7 @@ export const P3_Preset_Destro_Alliance = { ]}`), } -export const APL_Demo_Default = { - name: 'Demo Default', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: WarlockRotation.toJsonString(DemonologyRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(DemoApl))})} - -export const APL_Destro_Default = { - name: 'Destro Default', - enableWhen: (player: Player) => player.getTalentTree() == 2, - rotation: SavedRotation.create({ - specRotationOptionsJson: WarlockRotation.toJsonString(DestructionRotation), - rotation: APLRotation.fromJsonString(JSON.stringify(DestroApl))})} +export const APL_Demo_Legacy = PresetUtils.makePresetLegacyRotation('Demo Legacy', Spec.SpecWarlock, DemonologyRotation); +export const APL_Demo_Default = PresetUtils.makePresetAPLRotation('Demo', DemoApl, { talentTree: 1 }); +export const APL_Destro_Legacy = PresetUtils.makePresetLegacyRotation('Destro Legacy', Spec.SpecWarlock, DestructionRotation); +export const APL_Destro_Default = PresetUtils.makePresetAPLRotation('Destro', DestroApl, { talentTree: 2 }); diff --git a/ui/warlock/sim.ts b/ui/warlock/sim.ts index 525eba3cac..6bcd58fd72 100644 --- a/ui/warlock/sim.ts +++ b/ui/warlock/sim.ts @@ -140,7 +140,9 @@ export class WarlockSimUI extends IndividualSimUI { ], // Preset rotations that the user can quickly select. rotations: [ + Presets.APL_Demo_Legacy, Presets.APL_Demo_Default, + Presets.APL_Destro_Legacy, Presets.APL_Destro_Default, ], diff --git a/ui/warrior/inputs.ts b/ui/warrior/inputs.ts index f5e7f75a05..a68d1b04bc 100644 --- a/ui/warrior/inputs.ts +++ b/ui/warrior/inputs.ts @@ -16,8 +16,6 @@ import { } from '../core/proto/warrior.js'; import * as InputHelpers from '../core/components/input_helpers.js'; -import * as Presets from './presets.js'; -import { CustomRotationPicker } from 'ui/core/components/individual_sim_ui/custom_rotation_picker.js'; // Configuration for spec-specific UI elements on the settings tab. // These don't need to be in a separate file but it keeps things cleaner. diff --git a/ui/warrior/presets.ts b/ui/warrior/presets.ts index f45e6321f3..2197a6eeef 100644 --- a/ui/warrior/presets.ts +++ b/ui/warrior/presets.ts @@ -1,12 +1,14 @@ -import { Consumes, Faction } from '../core/proto/common.js'; -import { EquipmentSpec } from '../core/proto/common.js'; -import { Flask } from '../core/proto/common.js'; -import { Food } from '../core/proto/common.js'; -import { Glyphs } from '../core/proto/common.js'; -import { Potions } from '../core/proto/common.js'; -import { Spec } from '../core/proto/common.js'; -import { SavedRotation, SavedTalents } from '../core/proto/ui.js'; -import { APLRotation } from '../core/proto/apl.js'; +import { + Consumes, + EquipmentSpec, + Faction, + Flask, + Food, + Glyphs, + Potions, + Spec, +} from '../core/proto/common.js'; +import { SavedTalents } from '../core/proto/ui.js'; import { Player } from '../core/player.js'; import { @@ -17,10 +19,10 @@ import { WarriorMajorGlyph, WarriorMinorGlyph, Warrior_Rotation_StanceOption as StanceOption, - ProtectionWarrior_Rotation_SpellOption as SpellOption, Warrior_Rotation_MainGcd as MainGcd, } from '../core/proto/warrior.js'; +import * as PresetUtils from '../core/preset_utils.js'; import * as Tooltips from '../core/constants/tooltips.js'; import FuryApl from './apls/fury.apl.json'; @@ -99,25 +101,8 @@ export const ArmsRotation = WarriorRotation.create({ stanceOption: StanceOption.DefaultStance, }); -export const ROTATION_FURY = { - name: 'Fury', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: WarriorRotation.toJsonString(WarriorRotation.create({ - })), - rotation: APLRotation.fromJsonString(JSON.stringify(FuryApl)), - }), -}; - -export const ROTATION_FURY_SUNDER = { - name: 'Fury + Sunder', - enableWhen: (player: Player) => player.getTalentTree() == 1, - rotation: SavedRotation.create({ - specRotationOptionsJson: WarriorRotation.toJsonString(WarriorRotation.create({ - })), - rotation: APLRotation.fromJsonString(JSON.stringify(FurySunderApl)), - }), -}; +export const ROTATION_FURY = PresetUtils.makePresetAPLRotation('Fury', FuryApl, { talentTree: 1 }); +export const ROTATION_FURY_SUNDER = PresetUtils.makePresetAPLRotation('Fury + Sunder', FurySunderApl, { talentTree: 1 }); export const DefaultOptions = WarriorOptions.create({ startingRage: 0,