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

Added Registration of ItemSwapCallback to Black Bruise #4068

Merged
merged 1 commit into from
Nov 29, 2023
Merged
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
4 changes: 2 additions & 2 deletions sim/common/wotlk/enchant_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func init() {
},
})

character.ItemSwap.RegisterOnSwapItemForEffect(3748, aura)
character.ItemSwap.RegisterOnSwapItemForEnchantEffect(3748, aura)
})

core.NewEnchantEffect(3247, func(agent core.Agent) {
Expand Down Expand Up @@ -259,7 +259,7 @@ func init() {
},
})

character.ItemSwap.RegisterOnSwapItemForEffect(3790, aura)
character.ItemSwap.RegisterOnSwapItemForEnchantEffect(3790, aura)
})

core.AddWeaponEffect(3843, func(agent core.Agent, _ proto.ItemSlot) {
Expand Down
4 changes: 3 additions & 1 deletion sim/common/wotlk/other_effects.go
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ func init() {
},
})

core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{
aura := core.MakeProcTriggerAura(&character.Unit, core.ProcTrigger{
Name: name + " Trigger",
Callback: core.CallbackOnSpellHitDealt,
ProcMask: core.ProcMaskMelee,
Expand All @@ -998,6 +998,8 @@ func init() {
procAura.Activate(sim)
},
})

character.ItemSwap.RegisterOnSwapItemForItemEffect(itemID, aura)
})
})

Expand Down
16 changes: 15 additions & 1 deletion sim/core/item_swaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,22 @@ func (swap *ItemSwap) RegisterOnSwapItemForEffectWithPPMManager(effectID int32,

}

// Helper for handling Effects that use the itemID to toggle the aura on and off
func (swap *ItemSwap) RegisterOnSwapItemForItemEffect(itemID int32, aura *Aura) {
character := swap.character
character.RegisterOnItemSwap(func(sim *Simulation) {
procMask := character.GetProcMaskForItem(itemID)

if procMask == ProcMaskUnknown {
aura.Deactivate(sim)
} else {
aura.Activate(sim)
}
})
}

// Helper for handling Effects that use the effectID to toggle the aura on and off
func (swap *ItemSwap) RegisterOnSwapItemForEffect(effectID int32, aura *Aura) {
func (swap *ItemSwap) RegisterOnSwapItemForEnchantEffect(effectID int32, aura *Aura) {
character := swap.character
character.RegisterOnItemSwap(func(sim *Simulation) {
procMask := character.GetProcMaskForEnchant(effectID)
Expand Down
Loading