Hekili Priority Helper

Hekili Priority Helper

44M Downloads

[REC] "spend" hooks within class files behavior possibly erratic

Wyste opened this issue ยท 2 comments

commented

Before You Begin

  • I confirm that I have downloaded the latest version of the addon.
  • I am not playing on a private server.
  • I checked for an existing, open ticket for this issue and was not able to find one.
  • I edited the title of this issue (above) so that it describes the issue I am reporting.
  • I am reporting an issue with the default priority included with the specialization (imported or edited priorities are not supported).

Describe the Issue

"spend" hooks within class files fire irregularly.

I've detailed more for Protection warrior in the How to Reproduce section, but I have also tested Warlock(Destruction) and found the spend hook fires when OOC and flying on a mount as well.

Destro Warlock (ooc - flying around):
image

Protection Warrior, very quick combat (some melee, 2 abilities used and then the mob was dead:
image

How to Reproduce

(Using v9.2.7-1.0.0b release freshly installed except the following changes:)

  1. Change TOC version field to @Project-Version@ to enable print functions to work
  2. Add whatever debugging prints you feel are necessary within class file within spec:RegisterHook( "spend", function( amt, resource )
  3. Observe behavior in-game.

In my case for Prot Warrior:
During a fight, just after a fight, during rage decay, or even when at 0 rage flying around with 0 interaction with anything, have seen the spend hook fire for a multitude of reasons.

  1. "spend" hook is fired repeatedly, sometimes multiple times per query_time
  2. depending on the incoming values for the recommended action, this potentially will run code further down and falsely deflate/inflate various cooldowns, in protection warrior's case, the Anger Management cooldown will be potentially see several new CD reductions on Shield Wall that don't actually occur in-game.

Note FYI for the below pictures - "charge" was the recommended action here, which would net me +20 rage.
image
(code used to reproduce)
image

Snapshot (Link)

https://pastebin.com/pctDU9U6

Raidbots Sim Report (Link)

No response

Additional Information

No response

Contact Information

Wyste#8631

commented

Spend hooks are for virtual/emulated behavior, not real spend. I.e., it fires when the addon recommends an ability and needs to spend resources before generating the next recommendation.

commented

For reference, compare the spend hook here: https://github.com/Hekili/hekili/blob/dragonflight/Classes/WarriorArms.lua#L331

To the UNIT_POWER_FREQUENT handler here: https://github.com/Hekili/hekili/blob/dragonflight/Classes/WarriorArms.lua#L369

The spend hook is what the addon does virtually when it is generating multiple recommendations in one moment (i.e., use Bladestorm then Mortal Strike then whatever).

The UNIT_POWER_FREQUENT handler is where real expenditures are caught. Actual Rage expenditures are counted here (https://github.com/Hekili/hekili/blob/dragonflight/Classes/WarriorArms.lua#L323) in the rageSpent variable, while the "state" environment creates rage_spent for the same data. rage_spent defaults to rageSpent, but can be updated moving step to step and then reset again (https://github.com/Hekili/hekili/blob/dragonflight/Classes/WarriorArms.lua#L398) for the next set of recommendations.

One of the most challenging things to keep track of, when coding for the addon, is keeping track of what is "real" vs. what is a projection out into the future.