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

Fix several crash reports #1690

Merged
merged 1 commit into from
Nov 13, 2022
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
14 changes: 10 additions & 4 deletions sim/core/major_cooldown.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,17 @@ func newMajorCooldownManager(cooldowns *proto.Cooldowns) majorCooldownManager {
return majorCooldownManager{}
}

cooldownConfigs := cooldownConfigs{
HpPercentForDefensives: cooldowns.HpPercentForDefensives,
}
for _, cooldownConfig := range cooldowns.Cooldowns {
if cooldownConfig.Id != nil {
cooldownConfigs.Cooldowns = append(cooldownConfigs.Cooldowns, cooldownConfig)
}
}

return majorCooldownManager{
cooldownConfigs: cooldownConfigs{
Cooldowns: cooldowns.Cooldowns,
HpPercentForDefensives: cooldowns.HpPercentForDefensives,
},
cooldownConfigs: cooldownConfigs,
}
}

Expand Down
22 changes: 14 additions & 8 deletions sim/deathknight/runespell.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type RuneSpell struct {
ConvertType RuneType
dk *Deathknight

CanCast RuneSpellCanCast
canCast RuneSpellCanCast
onCast RuneSpellOnCast
}

Expand Down Expand Up @@ -86,15 +86,21 @@ func (rs *RuneSpell) castInternal(sim *core.Simulation, target *core.Unit) bool
return result
}

func (rs *RuneSpell) CanCast(sim *core.Simulation) bool {
if rs == nil {
return false
} else if rs.canCast == nil {
return true
} else {
return rs.canCast(sim)
}
}

func (rs *RuneSpell) Cast(sim *core.Simulation, target *core.Unit) bool {
if rs.CanCast == nil {
if rs.CanCast(sim) {
return rs.castInternal(sim, target)
} else {
if rs.CanCast(sim) {
return rs.castInternal(sim, target)
}
return false
}
return false
}

// RegisterSpell will connect the underlying spell to the given RuneSpell.
Expand All @@ -105,7 +111,7 @@ func (dk *Deathknight) RegisterSpell(rs *RuneSpell, spellConfig core.SpellConfig
rs = &RuneSpell{}
}
rs.dk = dk
rs.CanCast = canCast
rs.canCast = canCast
rs.onCast = onCast
rs.Spell = dk.Character.RegisterSpell(spellConfig)
return rs
Expand Down
6 changes: 3 additions & 3 deletions sim/druid/talents.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (druid *Druid) registerNaturesSwiftnessCD() {
}
actionID := core.ActionID{SpellID: 17116}

spell := druid.RegisterSpell(core.SpellConfig{
nsSpell := druid.RegisterSpell(core.SpellConfig{
ActionID: actionID,
Flags: core.SpellFlagNoOnCastComplete,
Cast: core.CastConfig{
Expand All @@ -157,13 +157,13 @@ func (druid *Druid) registerNaturesSwiftnessCD() {

// Remove the buff and put skill on CD
aura.Deactivate(sim)
spell.CD.Use(sim)
nsSpell.CD.Use(sim)
druid.UpdateMajorCooldowns()
},
})

druid.AddMajorCooldown(core.MajorCooldown{
Spell: spell,
Spell: nsSpell,
Type: core.CooldownTypeDPS,
ShouldActivate: func(sim *core.Simulation, character *core.Character) bool {
// Don't use NS unless we're casting a full-length starfire or wrath.
Expand Down
6 changes: 5 additions & 1 deletion sim/priest/shadow/rotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,11 @@ func (spriest *ShadowPriest) tryUseGCD(sim *core.Simulation) {
wait2 = core.MinDuration(dpidx, wait1)
wait3 = core.MinDuration(vtidx, swpidx)
wait = core.MinDuration(wait3, wait2)
spriest.WaitUntil(sim, sim.CurrentTime+wait)
if wait <= 0 {
spriest.WaitUntil(sim, sim.CurrentTime+time.Millisecond*500)
} else {
spriest.WaitUntil(sim, sim.CurrentTime+wait)
}
return
}
if success := spell.Cast(sim, spriest.CurrentTarget); !success {
Expand Down
2 changes: 1 addition & 1 deletion ui/index_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</body>
<!-- Load wowhead scripts after done loading everything else -->
<script>const whTooltips = {colorLinks: true};</script>
<script src="https://wow.zamimg.com/widgets/power.js"></script>
<script src="https://wow.zamimg.com/js/tooltips.js"></script>
<!--<script>const aowow_tooltips = {colorlinks: true}</script>
<script type="text/javascript" src="https://wotlk.evowow.com/static/widgets/power.js"></script>-->
</html>