added expiremental auto-assist feature

- automatically trys to target your target's target if your current spell cannot be cast on your target (useful for healers targeting a boss and healing the current MT, etc)
This commit is contained in:
Hendrik Leppkes
2008-06-01 15:18:29 +00:00
parent e3f007b5ae
commit d864f2b219
3 changed files with 60 additions and 0 deletions
+22
View File
@@ -28,6 +28,7 @@ do
states = "StateOption",
actionbar = "StateOption",
possess = "StateOption",
autoassist = "ConfigAutoAssist",
}
-- retrieves a valid bar object from the modules actionbars table
function getBar(id)
@@ -127,6 +128,16 @@ function module:GetStateOptionsTable()
desc = "Switch this bar to the Possess Bar when possessing a npc (eg. Mind Control)",
get = optGetter,
set = optSetter,
width = "half",
},
autoassist = {
order = 6,
type = "toggle",
name = "Auto-Assist",
desc = "Enable Auto-Assist for this bar.\n Auto-Assist will automatically try to cast on your target's target if your target is no valid target for the selected spell.",
get = optGetter,
set = optSetter,
width = "half",
},
def_desc = {
order = 10,
@@ -392,3 +403,14 @@ function ActionBar:SetDefaultState(_, value)
self.config.states.default = value
self:UpdateStates()
end
function ActionBar:GetConfigAutoAssist()
return self.config.autoassist
end
function ActionBar:SetConfigAutoAssist(_, value)
if value ~= nil then
self.config.autoassist = value
end
self:UpdateStates()
end
+1
View File
@@ -11,6 +11,7 @@ local abdefaults = {
hidemacrotext = false,
hidehotkey = false,
showgrid = false,
autoassist = false,
states = {
enabled = false,
possess = false,
+37
View File
@@ -182,6 +182,43 @@ function onUpdate(self, elapsed)
end
function Button:SetStateAction(state, action)
local isAction = true
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
macroText = "/cast %s[help] [target=targettarget, help] [target=none]"
-- Hack to get Selfcast working with macrotext syntax
local selfcast = ""
if Bartender4.db.profile.selfcastrightclick then
selfcast = selfcast .. "[button:2, target=player]"
end
if Bartender4.db.profile.selfcastmodifier then
selfcast = selfcast .. "[modifier:".. GetModifiedClick("SELFCAST").. ", target=player]"
end
macroText = macroText:format(selfcast)
end
macroText = ("%s%s(%s)"):format(macroText, spellName, spellRank)
self:SetAttribute(("*macrotext-S%d"):format(state), macroText)
self:SetAttribute(("*macrotext-S%dRight"):format(state), macroText)
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