-------------------------------------------
---------------- Rez Check ----------------
-------------------------------------------
function FirstToUpper(str)
return (str:gsub("^%l", string.upper))
end
local function RezCheck ()
if mq.TLO.Plugin('mq2dannet')() ~= nil and saved_settings.dannet_load then
local maxdistance = 100
local corpse_count = mq.TLO.SpawnCount('pccorpse radius '..maxdistance)()
local peer_list = split(mq.TLO.DanNet.Peers(), '|')
if mq.TLO.Me.Class.ShortName() == 'CLR' or mq.TLO.Me.Class.ShortName() == 'DRU' or mq.TLO.Me.Class.ShortName() == 'SHM' or mq.TLO.Me.Class.ShortName() == 'PAL' and not mq.TLO.Me.Hovering() and not mq.TLO.Me.Invis() then
if corpse_count ~= nil then
for c = 1, corpse_count do
for x = 1, #peer_list do
local corpse_name = mq.TLO.NearestSpawn(c..',pccorpse radius '..maxdistance).Name()
local corpse_name_id = mq.TLO.NearestSpawn(c..',pccorpse radius '..maxdistance).ID()
local dannet_member = mq.TLO.DanNet.Peers(x)()
local corpseadd = "'s corpse0"
if corpse_name_id == nil or dannet_member == nil then
break
end
local fellow_match = FirstToUpper(string.format("%s%s", dannet_member, corpseadd))
local fellow_match_strip = fellow_match:gsub('orpse.*','')
if not mq.TLO.Me.Hovering() and not mq.TLO.Me.Moving() and mq.TLO.Spawn(''..corpse_name_id..'').Distance() <= 100 and fellow_match == corpse_name and corpse_name_id ~= nil then
mq.cmdf('/target %s', fellow_match_strip)
mq.cmd('/dex '..dannet_member..' /consent '..mq.TLO.Me.CleanName()..'')
print('\ar[\aoEasy\ar] \atRezzing '..dannet_member..'')
mq.delay('1s')
mq.cmd('/corpse')
mq.delay('1s')
--Blessing of Resurrection CLR
if mq.TLO.Me.AltAbilityReady('3800')() then mq.cmd('/alt activate 3800') end
--Rejuvenation of Spirit DRU SHM
if mq.TLO.Me.AltAbilityReady('2051')() then mq.cmd('/alt activate 2051') end
--Gift of Resurrection PAL
if mq.TLO.Me.AltAbilityReady('3711')() then mq.cmd('/alt activate 3711') end
while mq.TLO.Me.Casting() do mq.delay('1s') end
end
end
end
end
end
end
end