Hello just saw your changes and watched some of your video about it. Looking forward to trying it out.
After hearing you being interested in Code for Summoning
I cleaned up my summoning code a little bit and adjusted it to be more closer to your rezz-function.
At the moment i am just missing some way to close the popup after accepting the summon...
getglobal("StaticPopup1Button1"):Click() would work, but if the popup isn't up... i get an error, which is way more annoying.
SummonOutOfRangeToggle = false
SummonTargetId = ""
function SummonOutOfRange()
local outofrangelist = {}
local outofrangelist_summoners = {}
local summonerlist = {}
local myname,realm=UnitName("player")
local myclass=UnitClass("player")
local summoner
if SummonTargetId ~= "" then TargetUnit(SummonTargetId) end
if SummonOutOfRangeToggle then
SummonOutOfRangeToggle = false
ConfirmSummon()
else
SummonOutOfRangeToggle = true
if ManaDown()>0 and buffed("Drink","player") then return end
if myclass ~= "Warlock" or InCombat() or UnitIsDead("player") or UnitIsGhost("player") then smartdrink() return end
if UnitMana("player") < 300 then smartdrink() return end
if ImBusy() then return end
if UnitInRaid("player") then
for i=1,GetNumRaidMembers() do
local name,rank,subgroup,level,class,fileName,zone,online,isdead=GetRaidRosterInfo(i)
if UnitIsConnected("raid"..i) and not UnitIsDead("raid"..i) and not UnitIsGhost("raid"..i) and not (UnitHealth("raid"..i) == 1) then
if class=="Warlock" then summoner=1 else summoner=0 end
if not CheckInteractDistance("raid"..i,4) then
if summoner==1 then table.insert(outofrangelist_summoners,name) end
if summoner==0 then table.insert(outofrangelist,name) end
else
local manaleft=UnitMana(MBID[name])
if summoner==1 and not buffed("Drink","raid"..i) and (UnitClass("raid"..i)=="Warlock" and UnitMana("raid"..i)>300) or name==myname then table.insert(summonerlist,name) end
end
end
end
table.sort(outofrangelist_summoners)
table.sort(outofrangelist)
table.sort(summonerlist)
myorder=FindInTable(summonerlist,myname)
Print("Summoning order is "..myorder)
Printt(outofrangelist_summoners)
numwltosummon=TableLength(outofrangelist_summoners)
numtosummon=TableLength(outofrangelist_summoners)+TableLength(outofrangelist)
if numwltosummon>=myorder then
MB_msg("Summoning "..outofrangelist_summoners[myorder])
TargetUnit(MBID[outofrangelist_summoners[myorder]])
SummonTargetId = MBID[outofrangelist_summoners[myorder]]
CastSpellByName("Ritual of Summoning")
return
end
Print("My summoning order is "..myorder-numwltosummon)
Printt(outofrangelist)
if numtosummon>=myorder then
MB_msg("Summoning "..outofrangelist[myorder-numwltosummon])
TargetUnit(MBID[outofrangelist[myorder-numwltosummon]])
SummonTargetId = MBID[outofrangelist[myorder-numwltosummon]]
CastSpellByName("Ritual of Summoning")
return
end
elseif GetNumPartyMembers() > 0 then
for i=1, GetNumPartyMembers() do
if (not CheckInteractDistance("party"..i,4)) then
TargetUnit("party"..i)
cast("Ritual of Summoning")
break
end
end
end
end
end
Thanks, my friend! Seems to work...put it in the latest...Don't forget to join discord!