Undefeated
Well-known member
- Joined
- Jul 27, 2020
- RedCents
- 169¢
This is a_moss_snake Lua that he gave me and I kinda of edited some parts specifically the spelll names and took out class I dont use. Can someone plz tell me if this loook like it will work. Thank you.
Lua:
---@type Mq
---@type ImGui
local mq = require('mq')
-- does kinda also work on raid...
local required_zone = {
['akhevatwo_mission'] = true,
['akhevatwo_raid'] = true,
}
local bane_mob_name = 'datiar xi tavuelim'
local banes = {
CLR={
{name='Blessed Chains',type='aa', order='1'},
{name='Shackle',type='spell', order='2'}
},
BRD={
{name='Slumber of the Diabo',type='spell',order='1'}
},
ENC={
{name='Beguiler\'s Banishment',type='aa',order='1'},
{name='Beam of Slumber',type='aa',order='2'},
{name='Chaotic Puzzlement',type='spell',order='3'}
},
SHM={
{name='Spiritual Rebuke',type='aa',order='1'},
{name='Virulent Paralysis',type='aa',order='2'},
{name='Shackle',type='spell',order='3'}
},
DRU={
{name='Paralytic Spores',type='aa',order='1'},
{name='Paralytic Spray',type='aa',order='2'},
{name='Vinelash Assault',type='spell',order='3'}
}
}
local unbreakable = {
['CLR'] = true,
['DRU'] = true,
['SHM'] = true,
-- adapt to your healing setup
}
local function StopDPS()
mq.cmd('/squelch /mqp on')
mq.delay(10)
if mq.TLO.Me.Class.ShortName() == 'BRD' then
mq.cmd('/squelch /twist off')
mq.delay(10)
mq.cmd('/squelch /stopsong')
mq.delay(10)
end
mq.cmd('/squelch /boxr pause')
mq.delay(10)
if (mq.TLO.Me.Casting.ID()) and (not unbreakable[mq.TLO.Me.Class.ShortName()]) then
mq.cmd('/squelch /stopcast')
mq.delay(100)
end
end
local function ResumeDPS()
mq.cmd('/squelch /mqp off')
mq.delay(10)
if mq.TLO.Me.Class.ShortName() == 'BRD' then
mq.cmd('/squelch /twist on')
mq.delay(10)
end
mq.cmd('/squelch /boxr unpause')
mq.delay(10)
end
local function on_load()
if not required_zone[mq.TLO.Zone.ShortName()] then return end
math.randomseed(os.time()*mq.TLO.Me.ID())
local bane = banes[mq.TLO.Me.Class.ShortName()]
if not bane then
print('Sadly I will be of no help here')
return end
for _, data in ipairs(bane) do
if data.type == 'spell' then
local Spellname = mq.TLO.Spell(data.name).RankName()
if mq.TLO.Me.Gem(Spellname)() and mq.TLO.Me.Gem(Spellname)() > 0 then
print('Spell ', data.name,' memmed, good boy')
else
print('Spell ', data.name,' not memmed, you suck')
end
end
end
end
local function isBaneableMob(spawn)
-- 200 should be enough
return ((spawn.Type() == 'NPC') and (spawn.CleanName() == bane_mob_name) and (spawn.LineOfSight()) and (spawn.Distance() < 200))
end
---@return boolean @Returns true if the action should fire, otherwise false.
local function condition()
local bane_mob_spawn = mq.getFilteredSpawns(isBaneableMob)
return required_zone[mq.TLO.Zone.ShortName()] and #bane_mob_spawn > 0
end
local function target_bane_mob()
local bane_mob_spawn = mq.getFilteredSpawns(isBaneableMob)
local bane_mob_count = #bane_mob_spawn
if bane_mob_count > 1 then
--random defeates distance sorting, might weight it
--table.sort(bane_mob_spawn, function(a, b) return a['Distance'] > b['Distance'] end )
Index = math.random(bane_mob_count)
else Index = 1
end
if #bane_mob_spawn > 0 then
mq.cmdf('/mqtar ${Spawn[%s]}', bane_mob_spawn[Index]['ID'])
mq.delay(50)
mq.cmd('/face fast')
end
end
local function cast(spell)
if mq.TLO.Target.CleanName() == bane_mob_name then
mq.cmdf('/cast %s', spell.RankName())
mq.cmdf('/dgtell all used %s for bane on [%s] -- [%s]', spell.RankName(), mq.TLO.Target.CleanName(), mq.TLO.Target.ID())
mq.delay(50+spell.MyCastTime())
end
end
local function use_aa(aa)
if mq.TLO.Target.CleanName() == bane_mob_name then
mq.cmdf('/alt activate %s', aa.ID())
mq.cmdf('/dgtell all used %s for bane on [%s] -- [%s]', aa.Spell.Name(), mq.TLO.Target.CleanName(), mq.TLO.Target.ID())
mq.delay(50+aa.Spell.CastTime())
end
end
local function bane_ready(data)
if not unbreakable[mq.TLO.Me.Class.ShortName()] then
if data.type == 'spell' then
return mq.TLO.Me.SpellReady(data.name)()
elseif data.type == 'aa' then
return mq.TLO.Me.AltAbilityReady(data.name)()
end
else
if data.type == 'spell' then
return (mq.TLO.Me.SpellReady(data.name)() and not mq.TLO.Me.Casting())
elseif data.type == 'aa' then
return (mq.TLO.Me.AltAbilityReady(data.name)() and not mq.TLO.Me.Casting())
end
end
end
local function action()
print('Action!')
local bane = banes[mq.TLO.Me.Class.ShortName()]
-- if not a bane class, return
if not bane then return end
local breakcond = false
while breakcond == false do
local bane_mob_spawn = mq.getFilteredSpawns(isBaneableMob)
if #bane_mob_spawn > 0 then
table.sort(bane, function(a, b) return a['order'] < b['order'] end )
for _, data in ipairs(bane) do
if bane_ready(data) then
StopDPS()
target_bane_mob()
if data.type == 'spell' then
cast(mq.TLO.Spell(data.name))
else
use_aa(mq.TLO.Me.AltAbility(data.name))
end
while mq.TLO.Me.Casting() do
mq.delay(50)
end
break
end
end
else
breakcond = true
ResumeDPS()
end
mq.doevents()
mq.delay(50)
end
end
return {onload=on_load, condfunc=condition, actionfunc=action}
Last edited by a moderator:



