Skip to content

Commit

Permalink
fix sim UIs + other components
Browse files Browse the repository at this point in the history
  • Loading branch information
kayla-glick committed Mar 11, 2024
1 parent f2d0417 commit 6316522
Show file tree
Hide file tree
Showing 47 changed files with 1,510 additions and 2,883 deletions.
21 changes: 18 additions & 3 deletions proto/mage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ message MageOptions {
}

message ArcaneMage {
message Rotation {}
message Rotation {
double missile_barrage_below_mana_percent = 1;
double blast_without_missile_barrage_above_mana_percent = 2;
double only_3_arcane_blast_stacks_below_mana_percent = 3;
bool use_arcane_barrage = 4;
}

message Options {
MageOptions mage_options = 1;
Expand All @@ -167,7 +172,15 @@ message ArcaneMage {
}

message FireMage {
message Rotation {}
message Rotation {
enum PrimaryFireSpell {
Fireball = 0;
FrostfireBolt = 1;
Scorch = 2;
}
PrimaryFireSpell primary_fire_spell = 1;
bool maintain_improved_scorch = 2;
}

message Options {
MageOptions mage_options = 1;
Expand All @@ -176,7 +189,9 @@ message FireMage {
}

message FrostMage {
message Rotation {}
message Rotation {
bool use_ice_lance = 1;
}

message Options {
MageOptions mage_options = 1;
Expand Down
81 changes: 42 additions & 39 deletions ui/core/components/fire_elemental_inputs.ts
Original file line number Diff line number Diff line change
@@ -1,82 +1,85 @@
import { IndividualSimUI } from "../individual_sim_ui";
import { Player } from "../player";
import { ShamanTotems } from "../proto/shaman";
import { ShamanSpecs } from "../proto_utils/utils";
import { EventID } from "../typed_event";
import { ContentBlock } from "./content_block";
import { IconPicker } from "./icon_picker";
import * as InputHelpers from '../components/input_helpers.js';
import { IndividualSimUI } from '../individual_sim_ui';
import { Player } from '../player';
import { ShamanTotems } from '../proto/shaman';
import { ActionId } from '../proto_utils/action_id.js';
import { Input } from "./input";
import { NumberPicker } from "./number_picker";
import { BooleanPicker } from "./boolean_picker";
import { ShamanSpecs } from '../proto_utils/utils';
import { EventID } from '../typed_event';
import { BooleanPicker } from './boolean_picker';
import { ContentBlock } from './content_block';
import { IconPicker } from './icon_picker';
import { Input } from './input';
import { NumberPicker } from './number_picker';

export function FireElementalSection(parentElem: HTMLElement, simUI: IndividualSimUI<ShamanSpecs>): ContentBlock {
let contentBlock = new ContentBlock(parentElem, 'fire-elemental-settings', {
header: { title: 'Fire Elemental' }
export function FireElementalSection(parentElem: HTMLElement, simUI: IndividualSimUI<any>): ContentBlock {
const contentBlock = new ContentBlock(parentElem, 'fire-elemental-settings', {
header: { title: 'Fire Elemental' },
});

let fireElementalIconContainer = Input.newGroupContainer();
const fireElementalIconContainer = Input.newGroupContainer();
fireElementalIconContainer.classList.add('fire-elemental-icon-container');

contentBlock.bodyElement.appendChild(fireElementalIconContainer);

const fireElementalBooleanIconInput = InputHelpers.makeBooleanIconInput<ShamanSpecs, ShamanTotems, Player<ShamanSpecs>>({
getModObject: (player: Player<ShamanSpecs>) => player,
getValue: (player: Player<ShamanSpecs>) => player.getSpecOptions().totems || ShamanTotems.create(),
setValue: (eventID: EventID, player: Player<ShamanSpecs>, newVal: ShamanTotems) => {
const newOptions = player.getSpecOptions();
newOptions.totems = newVal;
player.setSpecOptions(eventID, newOptions);
const fireElementalBooleanIconInput = InputHelpers.makeBooleanIconInput<ShamanSpecs, ShamanTotems, Player<ShamanSpecs>>(
{
getModObject: (player: Player<ShamanSpecs>) => player,
getValue: (player: Player<ShamanSpecs>) => player.getSpecOptions().totems || ShamanTotems.create(),
setValue: (eventID: EventID, player: Player<ShamanSpecs>, newVal: ShamanTotems) => {
const newOptions = player.getSpecOptions();
newOptions.totems = newVal;
player.setSpecOptions(eventID, newOptions);

// Hacky fix ItemSwapping is in the Rotation proto, this will let the Rotation know to update showWhen
// TODO move the ItemSwap enabled to a spec option and have the ItemSwap proto be apart of player.
player.rotationChangeEmitter.emit(eventID)
// Hacky fix ItemSwapping is in the Rotation proto, this will let the Rotation know to update showWhen
// TODO move the ItemSwap enabled to a spec option and have the ItemSwap proto be apart of player.
player.rotationChangeEmitter.emit(eventID);
},
changeEmitter: (player: Player<ShamanSpecs>) => player.specOptionsChangeEmitter,
},
changeEmitter: (player: Player<ShamanSpecs>) => player.specOptionsChangeEmitter,
}, ActionId.fromSpellId(2894), "useFireElemental");
ActionId.fromSpellId(2894),
'useFireElemental',
);

new IconPicker(fireElementalIconContainer, simUI.player, fireElementalBooleanIconInput);

new NumberPicker(contentBlock.bodyElement, simUI.player, {
positive: true,
label: "Bonus spell power",
labelTooltip: "Bonus spell power to snapshot Fire Elemental with. Will prioritize dropping Fire Elemental if greater then 0",
label: 'Bonus spell power',
labelTooltip: 'Bonus spell power to snapshot Fire Elemental with. Will prioritize dropping Fire Elemental if greater then 0',
inline: true,
getValue: (player: Player<ShamanSpecs>) => player.getSpecOptions().totems?.bonusSpellpower || 0,
setValue: (eventID: EventID, player: Player<ShamanSpecs>, newVal: number) => {
const newOptions = player.getSpecOptions();

if (newOptions.totems) {
newOptions.totems.bonusSpellpower = newVal
newOptions.totems.bonusSpellpower = newVal;
}

player.setSpecOptions(eventID, newOptions);
},
changedEvent: (player: Player<ShamanSpecs>) => player.specOptionsChangeEmitter,
})
});

new BooleanPicker(contentBlock.bodyElement, simUI.player, {
label: "Use Tier 10 (4pc)",
labelTooltip: "Will use Tier 10 (4pc) to snapshot Fire Elemental.",
label: 'Use Tier 10 (4pc)',
labelTooltip: 'Will use Tier 10 (4pc) to snapshot Fire Elemental.',
inline: true,
getValue: (player: Player<ShamanSpecs>) => player.getSpecOptions().totems?.enhTierTenBonus || false,
setValue: (eventID: EventID, player: Player<ShamanSpecs>, newVal: boolean) => {
const newOptions = player.getSpecOptions();

if (newOptions.totems) {
newOptions.totems.enhTierTenBonus = newVal
newOptions.totems.enhTierTenBonus = newVal;
}

player.setSpecOptions(eventID, newOptions);
},
changedEvent: (player: Player<ShamanSpecs>) => player.currentStatsEmitter,
showWhen: (player: Player<ShamanSpecs>) => {
const hasBonus = player.getCurrentStats().sets.includes('Frost Witch\'s Battlegear (4pc)');
return hasBonus
}
})

const hasBonus = player.getCurrentStats().sets.includes("Frost Witch's Battlegear (4pc)");
return hasBonus;
},
});

return contentBlock;
}
}
Loading

0 comments on commit 6316522

Please sign in to comment.