From c77eebfe00f207cb5413fa6e3333a6b9bd57b0c0 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sun, 1 Jun 2008 15:33:08 +0000 Subject: [PATCH] check for helpful before harmful --- Button.lua | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Button.lua b/Button.lua index 4c2fb6b..3d2f70d 100644 --- a/Button.lua +++ b/Button.lua @@ -182,19 +182,19 @@ function onUpdate(self, elapsed) end function Button:SetStateAction(state, action) - local isAction = true + + self:SetAttribute(("*type-S%d"):format(state), "action") + self:SetAttribute(("*type-S%dRight"):format(state), "action") + if self.parent.config.autoassist then local type, id, subtype = GetActionInfo(action) if type == "spell" then local spellName, spellRank = GetSpellInfo(id, subtype) - isAction = false self:SetAttribute(("*type-S%d"):format(state), "macro") self:SetAttribute(("*type-S%dRight"):format(state), "macro") local macroText - if IsHarmfulSpell(id, subtype) then - macroText = "/cast [harm] [target=targettarget, harm] [target=none]" - else + if IsHelpfulSpell(id, subtype) then macroText = "/cast %s[help] [target=targettarget, help] [target=none]" -- Hack to get Selfcast working with macrotext syntax @@ -206,7 +206,10 @@ function Button:SetStateAction(state, action) selfcast = selfcast .. "[modifier:".. GetModifiedClick("SELFCAST").. ", target=player]" end macroText = macroText:format(selfcast) + else + macroText = "/cast [harm] [target=targettarget, harm] [target=none]" end + macroText = ("%s%s(%s)"):format(macroText, spellName, spellRank) self:SetAttribute(("*macrotext-S%d"):format(state), macroText) @@ -214,11 +217,6 @@ function Button:SetStateAction(state, action) end end - if isAction then - self:SetAttribute(("*type-S%d"):format(state), "action") - self:SetAttribute(("*type-S%dRight"):format(state), "action") - end - self:SetAttribute(("*action-S%d"):format(state), action) self:SetAttribute(("*action-S%dRight"):format(state), action) end