ISSUE: SecureActionButtonTemplate’s helpbutton and harmbutton attributes do not cover all reasonable macro-like cases for changing a secure button’s behaviour.
AIM: Improve SecureTemplates.lua beginning at line 591 to take a different action when the target is dead.
DISCUSSION:
- Macros may be written to cast a different spell when a target is dead, versus a target who is alive and friendly or alive and harmful.
- Addons commonly use the “macrotext” attribute to do something like
/cast [dead] Ressurection; [harm] Magic Missile; At Darkness - If there were a deadbutton attribute, addons could use the normal type attributes to just cast clever spells directly, without coding it as a macro.
SAMPLE SOLUTION:
if ( UnitCanAttack("player", unit) )then
button = SecureButton_GetModifiedAttribute(self, "harmbutton", button) or button;
elseif ( UnitCanAssist("player", unit) )then
button = SecureButton_GetModifiedAttribute(self, "helpbutton", button) or button;
elseif ( UnitIsDeadOrGhost(unit) )then
button = SecureButton_GetModifiedAttribute(self, "deadbutton", button) or button;
end