Skip to content

Commit

Permalink
Raid sim uses auto rotation by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyt857 committed Dec 2, 2023
1 parent 1cd9577 commit fd8a961
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 80 deletions.
15 changes: 5 additions & 10 deletions ui/core/individual_sim_ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export interface IndividualSimUIConfig<SpecType extends Spec> {
rotations?: Array<PresetRotation>,
},

autoRotation?: AutoRotationGenerator<SpecType>,
autoRotation: AutoRotationGenerator<SpecType>,
simpleRotation?: SimpleRotationGenerator<SpecType>,
}

Expand Down Expand Up @@ -184,12 +184,7 @@ export abstract class IndividualSimUI<SpecType extends Spec> extends SimUI {
this.prevEpIterations = 0;
this.prevEpSimResult = null;

if (aplLaunchStatuses[player.spec] >= LaunchStatus.Beta) {
if (!config.autoRotation) {
throw new Error('autoRotation is required for APL beta');
}
player.setAutoRotationGenerator(config.autoRotation);
}
player.setAutoRotationGenerator(config.autoRotation);
if (aplLaunchStatuses[player.spec] == LaunchStatus.Launched && config.simpleRotation) {
player.setSimpleRotationGenerator(config.simpleRotation);
}
Expand Down Expand Up @@ -330,7 +325,7 @@ export abstract class IndividualSimUI<SpecType extends Spec> extends SimUI {
this.player.setName(initEventID, 'Player');

// This needs to go last so it doesn't re-store things as they are initialized.
this.changeEmitter.on(eventID => {
this.changeEmitter.on(_eventID => {
const jsonStr = IndividualSimSettings.toJsonString(this.toProto());
window.localStorage.setItem(this.getSettingsStorageKey(), jsonStr);
});
Expand All @@ -341,7 +336,7 @@ export abstract class IndividualSimUI<SpecType extends Spec> extends SimUI {
this.raidSimResultsManager = addRaidSimAction(this);
addStatWeightsAction(this, this.individualConfig.epStats, this.individualConfig.epPseudoStats, this.individualConfig.epReferenceStat);

const characterStats = new CharacterStats(
const _characterStats = new CharacterStats(
this.rootElem.getElementsByClassName('sim-sidebar-footer')[0] as HTMLElement,
this.player,
this.individualConfig.displayStats,
Expand Down Expand Up @@ -380,7 +375,7 @@ export abstract class IndividualSimUI<SpecType extends Spec> extends SimUI {
</div>
`);

const detailedResults = new EmbeddedDetailedResults(this.rootElem.getElementsByClassName('detailed-results')[0] as HTMLElement, this, this.raidSimResultsManager!);
const _detailedResults = new EmbeddedDetailedResults(this.rootElem.getElementsByClassName('detailed-results')[0] as HTMLElement, this, this.raidSimResultsManager!);
}

private addTopbarComponents() {
Expand Down
8 changes: 3 additions & 5 deletions ui/core/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1546,11 +1546,9 @@ export class Player<SpecType extends Spec> {
}));
this.setBonusStats(eventID, new Stats());

if (aplLaunchStatuses[this.spec] >= LaunchStatus.Beta) {
this.setAplRotation(eventID, APLRotation.create({
type: APLRotationType.TypeAuto,
}))
}
this.setAplRotation(eventID, APLRotation.create({
type: APLRotationType.TypeAuto,
}))
});
}
}
19 changes: 6 additions & 13 deletions ui/raid/import_export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { professionNames, raceNames } from '../core/proto_utils/names';
import {
DruidSpecs,
DeathknightSpecs,
MageSpecs,
PriestSpecs,
RogueSpecs,
SpecOptions,
Expand All @@ -33,7 +32,7 @@ import {
import { MAX_NUM_PARTIES } from '../core/raid';
import { Player } from '../core/player';
import { Encounter } from '../core/encounter';
import { bucket, distinct, sortByProperty } from '../core/utils';
import { bucket, distinct } from '../core/utils';

import { playerPresets, PresetSpecSettings } from './presets';
import { RaidSimUI } from './raid_sim_ui';
Expand Down Expand Up @@ -237,7 +236,7 @@ export class RaidWCLImporter extends Importer {
}

const urlData = await this.parseURL(importLink);
const rateLimit = await this.getRateLimit();
const _rateLimit = await this.getRateLimit();

// Schema for WCL API here: https://www.warcraftlogs.com/v2-api-docs/warcraft/
// WCL charges us 1 'point' for each subquery we issue within the request. So
Expand Down Expand Up @@ -405,7 +404,7 @@ export class RaidWCLImporter extends Importer {
otherPartyHealingSpells.forEach(spell => {
const spellEvents: Array<wclHealEvent> = healEventsBySpellId[spell.id] || [];
const spellEventsByTimestamp = bucket(spellEvents, event => String(event.timestamp) + String(event.sourceID));
for (const [timestamp, eventsAtTime] of Object.entries(spellEventsByTimestamp)) {
for (const [_timestamp, eventsAtTime] of Object.entries(spellEventsByTimestamp)) {
const spellTargets = eventsAtTime.map(event => wclPlayers.find(player => player.id == event.targetID));
for (let i = 0; i < spellTargets.length; i++) {
for (let j = 0; j < spellTargets.length; j++) {
Expand Down Expand Up @@ -492,8 +491,8 @@ export class RaidWCLImporter extends Importer {

private getRaidProto(wclPlayers: WCLSimPlayer[]): RaidProto {
const raid = RaidProto.create({
parties: [...new Array(MAX_NUM_PARTIES).keys()].map(p => PartyProto.create({
players: [...new Array(5).keys()].map(p => PlayerProto.create()),
parties: [...new Array(MAX_NUM_PARTIES).keys()].map(_party => PartyProto.create({
players: [...new Array(5).keys()].map(_player => PlayerProto.create()),
})),
});

Expand Down Expand Up @@ -564,7 +563,6 @@ class WCLSimPlayer {
this.player.setTalentsString(eventID, this.preset.talents.talentsString);
this.player.setGlyphs(eventID, this.preset.talents.glyphs!);
this.player.setConsumes(eventID, this.preset.consumes);
this.player.setRotation(eventID, this.preset.rotation);
this.player.setSpecOptions(eventID, this.preset.specOptions);
this.player.setProfessions(eventID, [Profession.Engineering, Profession.Jewelcrafting]);

Expand Down Expand Up @@ -660,11 +658,6 @@ const fullTypeToSpec: Record<string, Spec> = {
'WarriorProtection': Spec.SpecProtectionWarrior,
};

interface QuerySpell {
id: number,
name: string,
}

// Spells which imply a specific Race.
const racialSpells: Array<{ id: number, name: string, race: Race }> = [
{ id: 25046, name: 'Arcane Torrent (Energy)', race: Race.RaceBloodElf },
Expand Down Expand Up @@ -818,7 +811,7 @@ interface wclPlayer {
gear: wclGear[];
}

interface wclAura {
interface _wclAura {
name: string;
id: number;
guid: number;
Expand Down
Loading

0 comments on commit fd8a961

Please sign in to comment.