first of all thanks for sharing folks;
myself ive been experimenting for a while and found that lua with few custom registered function is most suitable for the task.
i'm using an idea of action priority lists utilized by simcraft (and actually quite an amount of conditionals i take from there)
see: Simulationcraft Results open any class's "Action Priority List"
basically i have lua table starting with an action followed by conditions to check
Code:
local s = {} -- state
...
Mco:runApl({
{"C", "Buff Name1", function() return s.autoCD end},
{"G", "Buff Name2", function() return s.autoCD and (s.buffBL > 0 or s.buffFF > 0 or s.hpTargetPrc < 3) end},
{"I", "Spell Name 1", function() return aoe > 0 end},
{"J", "Spell Name 2", function() return s.buffFFcharges > 0 and s.buffFF == 0 and (s.cdBW < 1 or s.buffST > 0 ) end},
{"K", "Spell Name 3", function() return s.focus > 30 and s.buffBW == 0 end},
....
....
})
function Mco:runApl(apl, canCastCheck)
for _, entry in pairs(apl) do
local id, spell, checkCallback, target, actionCallback, continue = unpack(entry)
--print(id, spell, checkCallback, target, actionCallback, continue)
local check = true
if checkCallback then
check, checkTarget, checkSpell = checkCallback(spell, target)
spell = checkSpell or spell
target = checkTarget or target
end
if check then
if actionCallback then
--print(id, "action", spell, target)
local result = actionCallback(spell, target)
if not continue then return result end
else
if (Mco:canCast(spell, target) and Mco:canIntChan()) then
print(id, spell, target)
Mco:castSpellByName(spell, target)
if not continue then return true end
end
end
end
end
return false
end