Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Talents apl #115

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion proto/apl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ message APLAction {
}
}

// NextIndex: 68
// NextIndex: 69
message APLValue {
oneof value {
// Operators
Expand Down Expand Up @@ -141,6 +141,9 @@ message APLValue {
APLValueSpellChanneledTicks spell_channeled_ticks = 57;
APLValueSpellCurrentCost spell_current_cost = 62;

// Talent Values
APLValueTalentIsKnown talent_is_known = 68;

// Aura values
APLValueAuraIsActive aura_is_active = 22;
APLValueAuraIsActiveWithReactionTime aura_is_active_with_reaction_time = 50;
Expand Down Expand Up @@ -458,6 +461,10 @@ message APLValueSpellCurrentCost {
ActionID spell_id = 1;
}

message APLValueTalentIsKnown {
ActionID talent_id = 1;
}

message APLValueAuraIsActive {
UnitReference source_unit = 2;
ActionID aura_id = 1;
Expand Down
8 changes: 8 additions & 0 deletions proto/ui.proto
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ message UIGem {
Profession required_profession = 9;
}

message UITalent {
int32 id = 1;
string baseName = 2;
string name = 3;
string spec = 4;
int32 maxPoints = 5;
}

message IconData {
int32 id = 1;
string name = 2;
Expand Down
4 changes: 4 additions & 0 deletions sim/core/apl_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func (rot *APLRotation) newAPLValue(config *proto.APLValue) APLValue {
case *proto.APLValue_SpellChanneledTicks:
return rot.newValueSpellChanneledTicks(config.GetSpellChanneledTicks())

// Talents
case *proto.APLValue_TalentIsKnown:
return rot.newValueTalentIsKnown(config.GetTalentIsKnown())

// Auras
case *proto.APLValue_AuraIsActive:
return rot.newValueAuraIsActive(config.GetAuraIsActive())
Expand Down
42 changes: 42 additions & 0 deletions sim/core/apl_values_talent.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package core

import (
"fmt"

"github.com/wowsims/cata/sim/core/proto"
)

type APLTalent struct {
id int32
known bool
}

type APLValueTalentKnown struct {
DefaultAPLValueImpl
talent APLTalent
}

func (rot *APLRotation) newValueTalentIsKnown(config *proto.APLValueTalentIsKnown) APLValue {
character := rot.unit.Env.Raid.GetPlayerFromUnit(rot.unit).GetCharacter()
talents := character.talents
if talents == nil {
rot.ValidationWarning("%s does not have talent data created", rot.unit.Label)
return nil
}
spellId := config.GetTalentId().GetSpellId()
return &APLValueTalentKnown{
talent: APLTalent{
id: spellId,
known: talents.IsKnown(spellId),
},
}
}
func (value *APLValueTalentKnown) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeBool
}
func (value *APLValueTalentKnown) GetBool(sim *Simulation) bool {
return value.talent.known
}
func (value *APLValueTalentKnown) String() string {
return fmt.Sprintf("Talent Known(%d)", value.talent.id)
}
2 changes: 2 additions & 0 deletions sim/core/character.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ type Character struct {
conjuredCD *Timer

Pets []*Pet // cached in AddPet, for advance()

talents *Talents
}

func NewCharacter(party *Party, partyIndex int, player *proto.Player) Character {
Expand Down
Loading
Loading