Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/wowsims/wotlk
Browse files Browse the repository at this point in the history
  • Loading branch information
NerdEgghead committed Jul 30, 2023
2 parents d8a4cf5 + e81e711 commit 92dc4da
Show file tree
Hide file tree
Showing 23 changed files with 167 additions and 154 deletions.
7 changes: 5 additions & 2 deletions proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ message APLRotation {

message APLPrepullAction {
APLAction action = 1;
string do_at = 2; // Should be a negative value. Uses the same syntax as APLValueConst.
bool hide = 3; // Causes this item to be ignored.
APLValue do_at_value = 4; // When to perform this prepull action. Should be a negative value.
bool hide = 3; // Causes this item to be ignored.

// TODO: Remove after 1 month (on or after 8/30/2023).
string do_at = 2 [deprecated = true];
}

message APLListItem {
Expand Down
26 changes: 13 additions & 13 deletions sim/core/apl.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ func (unit *Unit) newAPLRotation(config *proto.APLRotation) *APLRotation {
rotation.parsingPrepull = true
for _, prepullItem := range config.PrepullActions {
if !prepullItem.Hide {
doAt := time.Duration(1)
if durVal, err := time.ParseDuration(prepullItem.DoAt); err == nil {
doAt = durVal
}
if doAt > 0 {
rotation.validationWarning("Invalid time for 'Do At', ignoring this Prepull Action")
} else {
action := rotation.newAPLAction(prepullItem.Action)
if action != nil {
rotation.prepullActions = append(rotation.prepullActions, action)
unit.RegisterPrepullAction(doAt, func(sim *Simulation) {
action.Execute(sim)
})
doAtVal := rotation.newAPLValue(prepullItem.DoAtValue)
if doAtVal != nil {
doAt := doAtVal.GetDuration(nil)
if doAt > 0 {
rotation.validationWarning("Invalid time for 'Do At', ignoring this Prepull Action")
} else {
action := rotation.newAPLAction(prepullItem.Action)
if action != nil {
rotation.prepullActions = append(rotation.prepullActions, action)
unit.RegisterPrepullAction(doAt, func(sim *Simulation) {
action.Execute(sim)
})
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion sim/core/character.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ func (character *Character) AddPartyBuffs(partyBuffs *proto.PartyBuffs) {

func (character *Character) initialize(agent Agent) {
character.majorCooldownManager.initialize(character)
character.DesyncTrinketProcs()
if !character.IsUsingAPL {
character.DesyncTrinketProcs()
}

character.gcdAction = &PendingAction{
Priority: ActionPriorityGCD,
Expand Down
1 change: 1 addition & 0 deletions sim/priest/holy_fire.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func (priest *Priest) RegisterHolyFireSpell(memeDream bool) {
ActionID: core.ActionID{SpellID: 48135},
SpellSchool: core.SpellSchoolHoly,
ProcMask: core.ProcMaskSpellDamage,
Flags: core.SpellFlagAPL,

ManaCost: core.ManaCostOptions{
BaseCost: 0.11,
Expand Down
2 changes: 1 addition & 1 deletion sim/priest/penance.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (priest *Priest) makePenanceSpell(isHeal bool) *core.Spell {
}

var procMask core.ProcMask
flags := core.SpellFlagChanneled
flags := core.SpellFlagChanneled | core.SpellFlagAPL
if isHeal {
flags |= core.SpellFlagHelpful
procMask = core.ProcMaskSpellHealing
Expand Down
2 changes: 0 additions & 2 deletions sim/priest/priest.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ type Priest struct {
ShadowWordDeath *core.Spell
Shadowfiend *core.Spell
Smite *core.Spell
Starshards *core.Spell
VampiricTouch *core.Spell
Dispersion *core.Spell

Expand Down Expand Up @@ -130,7 +129,6 @@ func (priest *Priest) Initialize() {
priest.registerMindBlastSpell()
priest.registerShadowWordDeathSpell()
priest.registerShadowfiendSpell()
priest.registerStarshardsSpell()
priest.registerVampiricTouchSpell()
priest.registerDispersionSpell()

Expand Down
1 change: 1 addition & 0 deletions sim/priest/smite.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ func (priest *Priest) RegisterSmiteSpell(memeDream bool) {
ActionID: core.ActionID{SpellID: 48123},
SpellSchool: core.SpellSchoolHoly,
ProcMask: core.ProcMaskSpellDamage,
Flags: core.SpellFlagAPL,

ManaCost: core.ManaCostOptions{
BaseCost: 0.15,
Expand Down
52 changes: 0 additions & 52 deletions sim/priest/starshards.go

This file was deleted.

4 changes: 2 additions & 2 deletions ui/balance_druid/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ rotation: SavedRotation.create({
rotation: APLRotation.fromJsonString(`{
"enabled": true,
"prepullActions": [
{"action":{"castSpell":{"spellId":{"otherId":"OtherActionPotion"}}},"doAt":"-1.5s"},
{"action":{"castSpell":{"spellId":{"spellId":48461}}},"doAt":"-1.5s"}
{"action":{"castSpell":{"spellId":{"otherId":"OtherActionPotion"}}},"doAtValue":{"const":{"val":"-1.5s"}}},
{"action":{"castSpell":{"spellId":{"spellId":48461}}},"doAtValue":{"const":{"val":"-1.5s"}}}
],
"priorityList": [
{"action":{"condition":{"cmp":{"op":"OpGt","lhs":{"currentTime":{}},"rhs":{"const":{"val":"5"}}}},"castSpell":{"spellId":{"tag":-1,"spellId":2825}}}},
Expand Down
6 changes: 5 additions & 1 deletion ui/core/components/individual_sim_ui/apl_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ export class APLActionPicker extends Input<Player<any>, APLAction> {
}
}
}
this.setSourceValue(eventID, newSourceValue);
if (sourceValue) {
sourceValue.action = newSourceValue.action;
} else {
this.setSourceValue(eventID, newSourceValue);
}
} else {
sourceValue.action = {
oneofKind: newKind,
Expand Down
35 changes: 30 additions & 5 deletions ui/core/components/individual_sim_ui/apl_rotation_picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
APLListItem,
APLAction,
APLPrepullAction,
APLValue,
APLValueConst,
} from '../../proto/apl.js';

import { Component } from '../component.js';
Expand All @@ -17,6 +19,7 @@ import { ActionId } from '../../proto_utils/action_id.js';
import { SimUI } from '../../sim_ui.js';

import { APLActionPicker } from './apl_actions.js';
import { APLValuePicker, APLValueImplStruct } from './apl_values.js';

export class APLRotationPicker extends Component {
constructor(parent: HTMLElement, simUI: SimUI, modPlayer: Player<any>) {
Expand All @@ -35,7 +38,9 @@ export class APLRotationPicker extends Component {
},
newItem: () => APLPrepullAction.create({
action: {},
doAt: '-1s',
doAtValue: {
value: {oneofKind: 'const', const: { val: '-1s' }}
},
}),
copyItem: (oldItem: APLPrepullAction) => APLPrepullAction.clone(oldItem),
newItemPicker: (parent: HTMLElement, listPicker: ListPicker<Player<any>, APLPrepullAction>, index: number, config: ListItemPickerConfig<Player<any>, APLPrepullAction>) => new APLPrepullActionPicker(parent, modPlayer, config, index),
Expand Down Expand Up @@ -100,13 +105,31 @@ class APLPrepullActionPicker extends Input<Player<any>, APLPrepullAction> {
labelTooltip: 'Time before pull to do the action. Should be negative, and formatted like, \'-1s\' or \'-2500ms\'.',
extraCssClasses: ['apl-prepull-actions-doat'],
changedEvent: () => this.player.rotationChangeEmitter,
getValue: () => this.getItem().doAt,
getValue: () => (this.getItem().doAtValue?.value as APLValueImplStruct<'const'>|undefined)?.const.val || '',
setValue: (eventID: EventID, player: Player<any>, newValue: string) => {
this.getItem().doAt = newValue;
if (newValue) {
this.getItem().doAtValue = APLValue.create({
value: {oneofKind: 'const', const: { val: newValue }}
});
} else {
this.getItem().doAtValue = undefined;
}
this.player.rotationChangeEmitter.emit(eventID);
},
inline: true,
});
//this.doAtPicker = new APLValuePicker(this.rootElem, this.player, {
// label: 'Do At',
// labelTooltip: 'Time before pull to do the action. Should be negative, and formatted like, \'-1s\' or \'-2500ms\'.',
// extraCssClasses: ['apl-prepull-actions-doat'],
// changedEvent: () => this.player.rotationChangeEmitter,
// getValue: () => this.getItem().doAtValue,
// setValue: (eventID: EventID, player: Player<any>, newValue: APLValue | undefined) => {
// this.getItem().doAtValue = newValue;
// this.player.rotationChangeEmitter.emit(eventID);
// },
// inline: true,
//});

this.actionPicker = new APLActionPicker(this.rootElem, this.player, {
changedEvent: () => this.player.rotationChangeEmitter,
Expand All @@ -126,7 +149,9 @@ class APLPrepullActionPicker extends Input<Player<any>, APLPrepullAction> {
getInputValue(): APLPrepullAction {
const item = APLPrepullAction.create({
hide: this.hidePicker.getInputValue(),
doAt: this.doAtPicker.getInputValue(),
doAtValue: {
value: {oneofKind: 'const', const: { val: this.doAtPicker.getInputValue() }},
},
action: this.actionPicker.getInputValue(),
});
return item;
Expand All @@ -137,7 +162,7 @@ class APLPrepullActionPicker extends Input<Player<any>, APLPrepullAction> {
return;
}
this.hidePicker.setInputValue(newValue.hide);
this.doAtPicker.setInputValue(newValue.doAt);
this.doAtPicker.setInputValue((newValue.doAtValue?.value as APLValueImplStruct<'const'>|undefined)?.const.val || '');
this.actionPicker.setInputValue(newValue.action || APLAction.create());
}
}
Expand Down
8 changes: 6 additions & 2 deletions ui/core/components/individual_sim_ui/apl_values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface APLValuePickerConfig extends InputConfig<Player<any>, APLValue
}

export type APLValueKind = APLValue['value']['oneofKind'];
type APLValueImplStruct<F extends APLValueKind> = Extract<APLValue['value'], {oneofKind: F}>;
export type APLValueImplStruct<F extends APLValueKind> = Extract<APLValue['value'], {oneofKind: F}>;
type APLValueImplTypesUnion = {
[f in NonNullable<APLValueKind>]: f extends keyof APLValueImplStruct<f> ? APLValueImplStruct<f>[f] : never;
};
Expand Down Expand Up @@ -128,7 +128,11 @@ export class APLValuePicker extends Input<Player<any>, APLValue | undefined> {
}
}
}
this.setSourceValue(eventID, newSourceValue);
if (sourceValue) {
sourceValue.value = newSourceValue.value;
} else {
this.setSourceValue(eventID, newSourceValue);
}
} else {
this.setSourceValue(eventID, undefined);
}
Expand Down
2 changes: 1 addition & 1 deletion ui/core/launched_sims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const aplLaunchStatuses: Record<Spec, LaunchStatus> = {
[Spec.SpecRetributionPaladin]: LaunchStatus.Alpha,
[Spec.SpecHealingPriest]: LaunchStatus.Unlaunched,
[Spec.SpecShadowPriest]: LaunchStatus.Alpha,
[Spec.SpecSmitePriest]: LaunchStatus.Unlaunched,
[Spec.SpecSmitePriest]: LaunchStatus.Alpha,
[Spec.SpecWarlock]: LaunchStatus.Alpha,
[Spec.SpecWarrior]: LaunchStatus.Unlaunched,
[Spec.SpecProtectionWarrior]: LaunchStatus.Unlaunched,
Expand Down
14 changes: 14 additions & 0 deletions ui/core/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
} from './proto/api.js';
import {
APLRotation,
APLValue,
} from './proto/apl.js';
import {
DungeonDifficulty,
Expand Down Expand Up @@ -1111,6 +1112,17 @@ export class Player<SpecType extends Spec> {
}

fromProto(eventID: EventID, proto: PlayerProto) {
if (proto.rotation) {
proto.rotation.prepullActions.forEach(ppa => {
if (ppa.doAt) {
ppa.doAtValue = APLValue.create({
value: {oneofKind: 'const', const: { val: ppa.doAt }}
});
ppa.doAt = '';
}
});
}

TypedEvent.freezeAllAndDo(() => {
this.setName(eventID, proto.name);
this.setRace(eventID, proto.race);
Expand Down Expand Up @@ -1154,6 +1166,8 @@ export class Player<SpecType extends Spec> {
const options = this.getSpecOptions() as SpecOptions<Spec.SpecHunter>;
options.timeToTrapWeaveMs = rot.timeToTrapWeaveMs;
this.setSpecOptions(eventID, options as SpecOptions<SpecType>);
rot.timeToTrapWeaveMs = 0;
this.setRotation(eventID, rot as SpecRotation<SpecType>);
}
}
});
Expand Down
36 changes: 18 additions & 18 deletions ui/deathknight/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@ export const BLOOD_PESTI_ROTATION_PRESET_DEFAULT = {
rotation: APLRotation.fromJsonString(`{
"enabled": true,
"prepullActions": [
{"action":{"castSpell":{"spellId":{"spellId":48265}}},"doAt":"-20s"},
{"action":{"castSpell":{"spellId":{"spellId":42650}}},"doAt":"-10s"},
{"action":{"castSpell":{"spellId":{"spellId":50689}}},"doAt":"-6s"},
{"action":{"castSpell":{"spellId":{"itemId":40211}}},"doAt":"-1s"},
{"action":{"castSpell":{"spellId":{"spellId":49016}}},"doAt":"0s"},
{"action":{"castSpell":{"spellId":{"spellId":54758}}},"doAt":"0s"},
{"action":{"castSpell":{"spellId":{"spellId":26297}}},"doAt":"0s"}
{"action":{"castSpell":{"spellId":{"spellId":48265}}},"doAtValue":{"const":{"val":"-20s"}}},
{"action":{"castSpell":{"spellId":{"spellId":42650}}},"doAtValue":{"const":{"val":"-10s"}}},
{"action":{"castSpell":{"spellId":{"spellId":50689}}},"doAtValue":{"const":{"val":"-6s"}}},
{"action":{"castSpell":{"spellId":{"itemId":40211}}},"doAtValue":{"const":{"val":"-1s"}}},
{"action":{"castSpell":{"spellId":{"spellId":49016}}},"doAtValue":{"const":{"val":"0s"}}},
{"action":{"castSpell":{"spellId":{"spellId":54758}}},"doAtValue":{"const":{"val":"0s"}}},
{"action":{"castSpell":{"spellId":{"spellId":26297}}},"doAtValue":{"const":{"val":"0s"}}}
],
"priorityList": [
{"action":{"autocastOtherCooldowns":{}}},
Expand Down Expand Up @@ -302,10 +302,10 @@ export const FROST_BL_PESTI_ROTATION_PRESET_DEFAULT = {
rotation: APLRotation.fromJsonString(`{
"enabled": true,
"prepullActions": [
{"action":{"castSpell":{"spellId":{"spellId":48265}}},"doAt":"-20s"},
{"action":{"castSpell":{"spellId":{"spellId":42650}}},"doAt":"-10s"},
{"action":{"castSpell":{"spellId":{"spellId":50689}}},"doAt":"-6s"},
{"action":{"castSpell":{"spellId":{"itemId":40211}}},"doAt":"-1s"}
{"action":{"castSpell":{"spellId":{"spellId":48265}}},"doAtValue":{"const":{"val":"-20s"}}},
{"action":{"castSpell":{"spellId":{"spellId":42650}}},"doAtValue":{"const":{"val":"-10s"}}},
{"action":{"castSpell":{"spellId":{"spellId":50689}}},"doAtValue":{"const":{"val":"-6s"}}},
{"action":{"castSpell":{"spellId":{"itemId":40211}}},"doAtValue":{"const":{"val":"-1s"}}}
],
"priorityList": [
{"action":{"autocastOtherCooldowns":{}}},
Expand Down Expand Up @@ -336,10 +336,10 @@ export const FROST_UH_PESTI_ROTATION_PRESET_DEFAULT = {
rotation: APLRotation.fromJsonString(`{
"enabled": true,
"prepullActions": [
{"action":{"castSpell":{"spellId":{"spellId":48265}}},"doAt":"-20s"},
{"action":{"castSpell":{"spellId":{"spellId":42650}}},"doAt":"-10s"},
{"action":{"castSpell":{"spellId":{"spellId":50689}}},"doAt":"-6s"},
{"action":{"castSpell":{"spellId":{"itemId":40211}}},"doAt":"-1s"}
{"action":{"castSpell":{"spellId":{"spellId":48265}}},"doAtValue":{"const":{"val":"-20s"}}},
{"action":{"castSpell":{"spellId":{"spellId":42650}}},"doAtValue":{"const":{"val":"-10s"}}},
{"action":{"castSpell":{"spellId":{"spellId":50689}}},"doAtValue":{"const":{"val":"-6s"}}},
{"action":{"castSpell":{"spellId":{"itemId":40211}}},"doAtValue":{"const":{"val":"-1s"}}}
],
"priorityList": [
{"action":{"autocastOtherCooldowns":{}}},
Expand Down Expand Up @@ -370,9 +370,9 @@ export const UNHOLY_DW_ROTATION_PRESET_DEFAULT = {
rotation: APLRotation.fromJsonString(`{
"enabled": true,
"prepullActions": [
{"action":{"castSpell":{"spellId":{"spellId":48265}}},"doAt":"-10s"},
{"action":{"castSpell":{"spellId":{"spellId":63560}}},"doAt":"-8s"},
{"action":{"castSpell":{"spellId":{"itemId":40211}}},"doAt":"-1s"}
{"action":{"castSpell":{"spellId":{"spellId":48265}}},"doAtValue":{"const":{"val":"-10s"}}},
{"action":{"castSpell":{"spellId":{"spellId":63560}}},"doAtValue":{"const":{"val":"-8s"}}},
{"action":{"castSpell":{"spellId":{"itemId":40211}}},"doAtValue":{"const":{"val":"-1s"}}}
],
"priorityList": [
{"action":{"autocastOtherCooldowns":{}}},
Expand Down
Loading

0 comments on commit 92dc4da

Please sign in to comment.