libpredict.lua: align and optimize the way the hooked functions "CastSpell", "CastSpellByName" and "UseAction" set the unit-name on spell_queue[3] #1283
(optimization) Places where we use UnitName("player") can be replaced by simply 'player'
(bug-fix) We only take into account the pfui uf-mouseover-unit in 'CastSpellByName' post-hook but we could take it into account in the other two post-hooks as well to have all 3 implementations aligned
(optimization) We could intelligently cache the pfUI.uf.mouseover object the first time we have to consult it in any of the hooks, so as to save ourselves some time in subsequent invocations
(optimization) If pfUI.uf.mouseover.unit == "player" we can simply return the 'player' variable
(optimization) In the hook of 'CastSpellByName' we can avoid calculating the 'default' value every time unless it's absolutely necessary
Will make a PR about this soon. Appreciate this awesome addon btw ;)
(optimization) Places where we use UnitName("player") can be replaced by simply 'player'
(bug-fix) We only take into account the pfui uf-mouseover-unit in 'CastSpellByName' post-hook but we could take it into account in the other two post-hooks as well to have all 3 implementations aligned
(optimization) We could intelligently cache the pfUI.uf.mouseover object the first time we have to consult it in any of the hooks, so as to save ourselves some time in subsequent invocations
(optimization) If pfUI.uf.mouseover.unit == "player" we can simply return the 'player' variable
(optimization) In the hook of 'CastSpellByName' we can avoid calculating the 'default' value every time unless it's absolutely necessary
Will make a PR about this soon. Appreciate this awesome addon btw ;)