check for helpful before harmful

This commit is contained in:
Hendrik Leppkes
2008-06-01 15:33:08 +00:00
parent d864f2b219
commit c77eebfe00
+8 -10
View File
@@ -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