From e3f1ea1dba9d1a7a214fc9744612dbc031c2f39e Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Mon, 2 Jun 2008 21:17:50 +0000 Subject: [PATCH] fix a bug in auto-assist logic --- Button.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Button.lua b/Button.lua index 3d2f70d..ceb1770 100644 --- a/Button.lua +++ b/Button.lua @@ -190,8 +190,6 @@ function Button:SetStateAction(state, action) local type, id, subtype = GetActionInfo(action) if type == "spell" then local spellName, spellRank = GetSpellInfo(id, subtype) - self:SetAttribute(("*type-S%d"):format(state), "macro") - self:SetAttribute(("*type-S%dRight"):format(state), "macro") local macroText if IsHelpfulSpell(id, subtype) then @@ -206,14 +204,18 @@ function Button:SetStateAction(state, action) selfcast = selfcast .. "[modifier:".. GetModifiedClick("SELFCAST").. ", target=player]" end macroText = macroText:format(selfcast) - else + elseif IsHarmfulSpell(id, subtype) then macroText = "/cast [harm] [target=targettarget, harm] [target=none]" end - macroText = ("%s%s(%s)"):format(macroText, spellName, spellRank) + if macroText then + self:SetAttribute(("*type-S%d"):format(state), "macro") + self:SetAttribute(("*type-S%dRight"):format(state), "macro") + macroText = ("%s%s(%s)"):format(macroText, spellName, spellRank) - self:SetAttribute(("*macrotext-S%d"):format(state), macroText) - self:SetAttribute(("*macrotext-S%dRight"):format(state), macroText) + self:SetAttribute(("*macrotext-S%d"):format(state), macroText) + self:SetAttribute(("*macrotext-S%dRight"):format(state), macroText) + end end end