Skip to content

Commit

Permalink
Merge pull request #4077 from wowsims/apl
Browse files Browse the repository at this point in the history
Merge raid sim preset configs into individual sim configs so they're …
  • Loading branch information
jimmyt857 committed Dec 5, 2023
2 parents d28c22f + abf449a commit 2401bc6
Show file tree
Hide file tree
Showing 26 changed files with 1,248 additions and 1,116 deletions.
44 changes: 42 additions & 2 deletions ui/balance_druid/sim.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { Spec } from '../core/proto/common.js';
import { Stat } from '../core/proto/common.js';
import {
Class,
Faction,
Race,
Spec,
Stat,
} from '../core/proto/common.js';
import {
APLRotation,
} from '../core/proto/apl.js';
import { Stats } from '../core/proto_utils/stats.js';
import { getSpecIcon, specNames } from '../core/proto_utils/utils.js';
import { Player } from '../core/player.js';
import { IndividualSimUI, registerSpecConfig } from '../core/individual_sim_ui.js';

Expand Down Expand Up @@ -134,6 +140,40 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecBalanceDruid, {
autoRotation: (_player: Player<Spec.SpecBalanceDruid>): APLRotation => {
return Presets.ROTATION_PRESET_P3_APL.rotation.rotation!;
},

raidSimPresets: [
{
spec: Spec.SpecBalanceDruid,
tooltip: specNames[Spec.SpecBalanceDruid],
defaultName: 'Balance',
iconUrl: getSpecIcon(Class.ClassDruid, 0),

talents: Presets.Phase2Talents.data,
specOptions: Presets.DefaultOptions,
consumes: Presets.DefaultConsumes,
otherDefaults: Presets.OtherDefaults,
defaultFactionRaces: {
[Faction.Unknown]: Race.RaceUnknown,
[Faction.Alliance]: Race.RaceNightElf,
[Faction.Horde]: Race.RaceTauren,
},
defaultGear: {
[Faction.Unknown]: {},
[Faction.Alliance]: {
1: Presets.P1_PRESET.gear,
2: Presets.P2_PRESET.gear,
3: Presets.P3_PRESET_ALLI.gear,
4: Presets.P4_PRESET_ALLI.gear,
},
[Faction.Horde]: {
1: Presets.P1_PRESET.gear,
2: Presets.P2_PRESET.gear,
3: Presets.P3_PRESET_HORDE.gear,
4: Presets.P4_PRESET_HORDE.gear,
},
},
},
],
});

export class BalanceDruidSimUI extends IndividualSimUI<Spec.SpecBalanceDruid> {
Expand Down
18 changes: 18 additions & 0 deletions ui/core/individual_sim_ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
Debuffs,
Encounter as EncounterProto,
EquipmentSpec,
Faction,
Glyphs,
HandType,
IndividualBuffs,
Expand Down Expand Up @@ -88,6 +89,21 @@ export interface OtherDefaults {
nibelungAverageCasts?: number,
}

export interface RaidSimPreset<SpecType extends Spec> {
spec: Spec,
talents: SavedTalents,
specOptions: SpecOptions<SpecType>,
consumes: Consumes,

defaultName: string,
defaultFactionRaces: Record<Faction, Race>,
defaultGear: Record<Faction, Record<number, EquipmentSpec>>,
otherDefaults?: OtherDefaults,

tooltip: string,
iconUrl: string,
}

export interface IndividualSimUIConfig<SpecType extends Spec> extends PlayerConfig<SpecType> {
// Additional css class to add to the root element.
cssClass: string,
Expand Down Expand Up @@ -139,6 +155,8 @@ export interface IndividualSimUIConfig<SpecType extends Spec> extends PlayerConf
talents: Array<SavedDataConfig<Player<any>, SavedTalents>>,
rotations: Array<PresetRotation>,
},

raidSimPresets: Array<RaidSimPreset<SpecType>>,
}

export function registerSpecConfig<SpecType extends Spec>(spec: SpecType, config: IndividualSimUIConfig<SpecType>): IndividualSimUIConfig<SpecType> {
Expand Down
10 changes: 9 additions & 1 deletion ui/core/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ export function registerSpecConfig(spec: Spec, config: PlayerConfig<any>) {
SPEC_CONFIGS[spec] = config;
}

export function getSpecConfig<SpecType extends Spec>(spec: SpecType): PlayerConfig<SpecType> {
const config = SPEC_CONFIGS[spec] as PlayerConfig<SpecType>;
if (!config) {
throw new Error('No config registered for Spec: ' + spec);
}
return config;
}

// Manages all the gear / consumes / other settings for a single Player.
export class Player<SpecType extends Spec> {
readonly sim: Sim;
Expand Down Expand Up @@ -702,7 +710,7 @@ export class Player<SpecType extends Spec> {
const meleeCrit = (this.currentStats.finalStats?.stats[Stat.StatMeleeCrit] || 0.0) / Mechanics.MELEE_CRIT_RATING_PER_CRIT_CHANCE;
const meleeHit = (this.currentStats.finalStats?.stats[Stat.StatMeleeHit] || 0.0) / Mechanics.MELEE_HIT_RATING_PER_HIT_CHANCE;
const expertise = (this.currentStats.finalStats?.stats[Stat.StatExpertise] || 0.0) / Mechanics.EXPERTISE_PER_QUARTER_PERCENT_REDUCTION / 4;
const agility = (this.currentStats.finalStats?.stats[Stat.StatAgility] || 0.0) / this.getClass();
//const agility = (this.currentStats.finalStats?.stats[Stat.StatAgility] || 0.0) / this.getClass();
const suppression = 4.8;
const glancing = 24.0;

Expand Down
1 change: 0 additions & 1 deletion ui/core/proto_utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export type ClassSpecs<T extends Class> =
export const NUM_SPECS = getEnumValues(Spec).length;

// The order in which specs should be presented, when it matters.
// Currently this is only used for the order of the paladin blessings UI.
export const naturalSpecOrder: Array<Spec> = [
Spec.SpecBalanceDruid,
Spec.SpecFeralDruid,
Expand Down
89 changes: 81 additions & 8 deletions ui/deathknight/sim.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import {
Class,
Debuffs,
Faction,
HandType,
IndividualBuffs,
ItemSlot,
PartyBuffs,
PseudoStat,
Race,
RaidBuffs,
Spec,
Stat,
TristateEffect,
} from '../core/proto/common.js';
import { APLRotation } from '../core/proto/apl.js';
import { HandType, RaidBuffs } from '../core/proto/common.js';
import { PartyBuffs } from '../core/proto/common.js';
import { IndividualBuffs } from '../core/proto/common.js';
import { Debuffs } from '../core/proto/common.js';
import { ItemSlot } from '../core/proto/common.js';
import { Spec } from '../core/proto/common.js';
import { Stat, PseudoStat } from '../core/proto/common.js';
import { TristateEffect } from '../core/proto/common.js'
import { Player } from '../core/player.js';
import { Stats } from '../core/proto_utils/stats.js';
import { getSpecIcon } from '../core/proto_utils/utils.js';
import { IndividualSimUI, registerSpecConfig } from '../core/individual_sim_ui.js';

import * as IconInputs from '../core/components/icon_inputs.js';
Expand Down Expand Up @@ -244,6 +252,71 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecDeathknight, {
//Presets.P1_UNHOLY_2H_PRESET,
],
},

raidSimPresets: [
{
spec: Spec.SpecDeathknight,
tooltip: 'Frost Death Knight',
defaultName: 'Frost',
iconUrl: getSpecIcon(Class.ClassDeathknight, 1),

talents: Presets.FrostTalents.data,
specOptions: Presets.DefaultFrostOptions,
consumes: Presets.DefaultConsumes,
defaultFactionRaces: {
[Faction.Unknown]: Race.RaceUnknown,
[Faction.Alliance]: Race.RaceHuman,
[Faction.Horde]: Race.RaceTroll,
},
defaultGear: {
[Faction.Unknown]: {},
[Faction.Alliance]: {
1: Presets.P1_FROST_PRESET.gear,
2: Presets.P2_FROST_PRESET.gear,
3: Presets.P3_FROST_PRESET.gear,
4: Presets.P4_FROST_PRESET.gear,
},
[Faction.Horde]: {
1: Presets.P1_FROST_PRESET.gear,
2: Presets.P2_FROST_PRESET.gear,
3: Presets.P3_FROST_PRESET.gear,
4: Presets.P4_FROST_PRESET.gear,
},
},
otherDefaults: Presets.OtherDefaults,
},
{
spec: Spec.SpecDeathknight,
tooltip: 'Dual-Wield Unholy DK',
defaultName: 'Unholy',
iconUrl: getSpecIcon(Class.ClassDeathknight, 2),

talents: Presets.UnholyDualWieldTalents.data,
specOptions: Presets.DefaultUnholyOptions,
consumes: Presets.DefaultConsumes,
defaultFactionRaces: {
[Faction.Unknown]: Race.RaceUnknown,
[Faction.Alliance]: Race.RaceHuman,
[Faction.Horde]: Race.RaceTroll,
},
defaultGear: {
[Faction.Unknown]: {},
[Faction.Alliance]: {
1: Presets.P1_UNHOLY_DW_PRESET.gear,
2: Presets.P2_UNHOLY_DW_PRESET.gear,
3: Presets.P3_UNHOLY_DW_PRESET.gear,
4: Presets.P4_UNHOLY_DW_PRESET.gear,
},
[Faction.Horde]: {
1: Presets.P1_UNHOLY_DW_PRESET.gear,
2: Presets.P2_UNHOLY_DW_PRESET.gear,
3: Presets.P3_UNHOLY_DW_PRESET.gear,
4: Presets.P4_UNHOLY_DW_PRESET.gear,
},
},
otherDefaults: Presets.OtherDefaults,
},
],
});

export class DeathknightSimUI extends IndividualSimUI<Spec.SpecDeathknight> {
Expand Down
53 changes: 46 additions & 7 deletions ui/elemental_shaman/sim.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { RaidBuffs } from '../core/proto/common.js';
import { PartyBuffs } from '../core/proto/common.js';
import { IndividualBuffs } from '../core/proto/common.js';
import { Debuffs } from '../core/proto/common.js';
import { Spec } from '../core/proto/common.js';
import { Stat } from '../core/proto/common.js';
import { TristateEffect } from '../core/proto/common.js'
import {
Class,
Debuffs,
Faction,
IndividualBuffs,
PartyBuffs,
Race,
RaidBuffs,
Spec,
Stat,
TristateEffect,
} from '../core/proto/common.js';
import {
APLRotation,
} from '../core/proto/apl.js';
import { Player } from '../core/player.js';
import { Stats } from '../core/proto_utils/stats.js';
import { getSpecIcon, specNames } from '../core/proto_utils/utils.js';
import { IndividualSimUI, registerSpecConfig } from '../core/individual_sim_ui.js';
import { TypedEvent } from '../core/typed_event.js';
import { TotemsSection } from '../core/components/totem_inputs.js';
Expand Down Expand Up @@ -174,6 +180,39 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecElementalShaman, {
autoRotation: (_player: Player<Spec.SpecElementalShaman>): APLRotation => {
return Presets.ROTATION_PRESET_DEFAULT.rotation.rotation!;
},

raidSimPresets: [
{
spec: Spec.SpecElementalShaman,
tooltip: specNames[Spec.SpecElementalShaman],
defaultName: 'Elemental',
iconUrl: getSpecIcon(Class.ClassShaman, 0),

talents: Presets.StandardTalents.data,
specOptions: Presets.DefaultOptions,
consumes: Presets.DefaultConsumes,
defaultFactionRaces: {
[Faction.Unknown]: Race.RaceUnknown,
[Faction.Alliance]: Race.RaceDraenei,
[Faction.Horde]: Race.RaceOrc,
},
defaultGear: {
[Faction.Unknown]: {},
[Faction.Alliance]: {
1: Presets.P1_PRESET.gear,
2: Presets.P2_PRESET.gear,
3: Presets.P3_PRESET_ALLI.gear,
4: Presets.P4_PRESET.gear,
},
[Faction.Horde]: {
1: Presets.P1_PRESET.gear,
2: Presets.P2_PRESET.gear,
3: Presets.P3_PRESET_HORDE.gear,
4: Presets.P4_PRESET.gear,
},
},
},
],
});

export class ElementalShamanSimUI extends IndividualSimUI<Spec.SpecElementalShaman> {
Expand Down
50 changes: 45 additions & 5 deletions ui/enhancement_shaman/sim.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import { PartyBuffs } from '../core/proto/common.js';
import { IndividualBuffs } from '../core/proto/common.js';
import { Spec } from '../core/proto/common.js';
import { Stat, PseudoStat } from '../core/proto/common.js';
import { TristateEffect } from '../core/proto/common.js'
import {
Class,
Faction,
IndividualBuffs,
PartyBuffs,
PseudoStat,
Race,
Spec,
Stat,
TristateEffect,
} from '../core/proto/common.js';
import {
APLRotation,
} from '../core/proto/apl.js';
import { ShamanImbue } from '../core/proto/shaman.js';
import { Player } from '../core/player.js';
import { Stats } from '../core/proto_utils/stats.js';
import { getSpecIcon, specNames } from '../core/proto_utils/utils.js';
import { IndividualSimUI, registerSpecConfig } from '../core/individual_sim_ui.js';
import { TotemsSection } from '../core/components/totem_inputs.js';
import * as IconInputs from '../core/components/icon_inputs.js';
Expand Down Expand Up @@ -185,6 +192,39 @@ const SPEC_CONFIG = registerSpecConfig(Spec.SpecEnhancementShaman, {
return Presets.ROTATION_WF_DEFAULT.rotation.rotation!;
}
},

raidSimPresets: [
{
spec: Spec.SpecEnhancementShaman,
tooltip: specNames[Spec.SpecEnhancementShaman],
defaultName: 'Enhancement',
iconUrl: getSpecIcon(Class.ClassShaman, 1),

talents: Presets.StandardTalents.data,
specOptions: Presets.DefaultOptions,
consumes: Presets.DefaultConsumes,
defaultFactionRaces: {
[Faction.Unknown]: Race.RaceUnknown,
[Faction.Alliance]: Race.RaceDraenei,
[Faction.Horde]: Race.RaceOrc,
},
defaultGear: {
[Faction.Unknown]: {},
[Faction.Alliance]: {
1: Presets.P1_PRESET.gear,
2: Presets.P2_PRESET_FT.gear,
3: Presets.P3_PRESET_ALLIANCE.gear,
4: Presets.P4_PRESET_FT.gear,
},
[Faction.Horde]: {
1: Presets.P1_PRESET.gear,
2: Presets.P2_PRESET_FT.gear,
3: Presets.P3_PRESET_HORDE.gear,
4: Presets.P4_PRESET_FT.gear,
},
},
},
],
});

export class EnhancementShamanSimUI extends IndividualSimUI<Spec.SpecEnhancementShaman> {
Expand Down
Loading

0 comments on commit 2401bc6

Please sign in to comment.