PHP Code:
local ctrl = IsControlKeyDown()
local leftctrl = IsLeftControlKeyDown()
local rightctrl = IsRightControlKeyDown()
local shift = IsShiftKeyDown()
local leftshift = IsLeftShiftKeyDown()
local rightshift = IsRightShiftKeyDown()
hrkey = leftctrl or 0 -- healing rain keybind
lbspam = leftshift or 0 -- in combat lighting bolt spam keybind
oochealing = leftshift or 0 -- out of combat healing keybind
rthealth = 95 -- riptide
hwhealth = 95 -- healing wave
ghwhealth = 70 -- greater healing wave
hshealth = 30 -- healing surge
uehealth = 90 -- unleash elements
inttrinket = 70 -- use int trinkets when target health below this
nshealth= 15 -- nature's swiftness + GHW
targethealth = 90 -- chain heal first target
hophealth = 95 -- chain heal secondary targets
hops = 2 -- chain heals jumps, doesn't count the first target so if set to 3 will heal 4 people
onyacvars = {2894,2825,79206,2062,98008,36936,66842} -- spells to create macros for
if PQR_RotationStarted == true then
PQR_RotationStarted = false
---PQR_ObjMgrPulseTimer = 100
if GetPrimaryTalentTree() ==1 then PQR_SwapRotation("Elemental (ONYA elemental)") end
if GetPrimaryTalentTree() ==2 then
PQR_WriteToChat("enhance spec not supported")
PQR_StopRotation()
return true
end
if GetCVar("synchronizeMacros") ~=0 then SetCVar("synchronizeMacros",0) end
for k, val in pairs(onyacvars) do
local aval = "onya_"..tostring(val)
if GetCVarBool(aval) then SetCVar(aval,nil) end
local name = GetSpellInfo(val)
if GetMacroInfo(name) ~= name then
local mac = "#showtooltip "..name.."\\n/run if GetCVar\\(\\""..aval.."\\"\\) == nil then RegisterCVar\\(\\""..aval.."\\"\\,nil) end;SetCVar\\(\\""..aval.."\\"\\,1)"
CreateMacro(name,"INV_MISC_QUESTIONMARK",mac, 1)
end
end
spelltocast = {}
function DistanceBetweenUnits(unit1,unit2)
if unit2 == unit1 then return 0 end
local r = PQR_UnitDistance(unit1,unit2)
return r
end
cursesfromevent = { }
Decurse = {
--- Hour of Twilight
---102582, --- chains of frost
102848, -- tentacle smash
43415, -- freezing trap
103363, -- Twilight Shear
103151, -- Righteous Shear
--- End Time
102057, -- Scorched
101840, -- Molten Blast
101412, -- Shriek of the Highborne
--- Dragon Soul
105289, -- Shattered Ice
108567, -- Shattered Ice
--- 103434, --- disrupting shadows
--- 104599, --- disrupting shadows
109333, -- Frost Corruption
--- 107629, --- boulder smash
109423-- Shackles of Ice
}
function EventHandler(self, event, ...)
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
if (select(2, ...) == "SPELL_CAST_SUCCESS" ) and
bit.band(select(6, ...), COMBATLOG_OBJECT_AFFILIATION_MINE) == 1
then
local castspell = select(12, ...)
for k,v in ipairs(spelltocast) do
if castspell == v then table.remove(spelltocast,k) end
end
end
if select(2, ...) == "SPELL_AURA_APPLIED" and
select(15, ...) == "DEBUFF" and
bit.band(select(10, ...), COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) ~= 8
then
local target = select(8, ...)
local spell = select(12, ...)
local spellname = select(13, ...)
for k, val in pairs(Decurse) do
if val == spell then
table.insert(cursesfromevent ,target)
table.insert(cursesfromevent ,spell)
end
end
end
end
end
frame = CreateFrame("FRAME", "OurFrame")
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
frame:SetScript("OnEvent", EventHandler)
function GetDamageTarget()
if UnitExists("focus") and IsSpellInRange("Lightning Bolt", "focus") and not UnitIsDead("focus") then return ("focus") end
if IsSpellInRange("Lightning Bolt", "target") and not UnitIsDead("target")then return ("target") end
for k,v in ipairs(tanks) do
if IsSpellInRange("Lightning Bolt", member[v].name.."target")
and not UnitIsDead(member[v].name.."target")
then return (member[v].name.."target") end
end
end
function isvalidhealtarget(vtarget)
if UnitInRange(vtarget)
and UnitIsDeadOrGhost(vtarget) == nil
and UnitIsVisible(vtarget) == 1
and UnitHealth(vtarget) ~=0
and UnitExists(vtarget)== 1
and not PQR_IsOutOfSight(vtarget,1)
and UnitIsConnected(vtarget) == 1
and PQR_IsOutOfSight(vtarget) == false
and UnitIsCharmed(vtarget) == nil
and UnitCanCooperate("player",vtarget)
then
return true
else
return false
end
end
function SilentCast(scspell,sctarget)
local SFX = GetCVar("Sound_EnableSFX")
SetCVar("Sound_EnableSFX", 0)
if sctarget ~= nil then
CastSpellByID(scspell,sctarget)
end
if sctarget == nil then
CastSpellByID(scspell)
end
SetCVar("Sound_EnableSFX", SFX)
end
end -- everything above here run once
manapercent = 100 * UnitPower("player") / UnitPowerMax("player")
mana = UnitPower("player") or 0
Spell, _, _, _, _, endTime = UnitCastingInfo("player")
member = {}
tanks = {}
myesbuff = nil
lowest = 1
rttarget = 1
chtargets = {}
chhops = {}
gooey = {}
local SwG = UnitBuffID("player", 79206)
local mf = UnitBuffID("player", 98734)
local plucked = UnitDebuffID("player", 97318)
if ((SwG ~= nil ) or not(PQR_IsMoving (0.5)) or (mf ~= nil ) or (plucked ~= nil )) then
moving = 0
else
moving = 1
end
group = "party"
members = GetNumPartyMembers()+1
if GetNumRaidMembers() > 0 then
group = "raid"
members = GetNumRaidMembers()
end
if UnitIsDeadOrGhost("player") then return true end
for i = 1, members, 1 do
member[i] = {}
member[i].name = group..tostring(i)
if group == "party" and i == members then member[i].name = "player" end
gooey[UnitGUID(member[i].name)] = member[i].name
local myIncomingHeal = UnitGetIncomingHeals(member[i].name, "player") or 0
local allIncomingHeal = UnitGetIncomingHeals(member[i].name) or 0
local otherin = 0
if myIncomingHeal < allIncomingHeal then otherin = allIncomingHeal - myIncomingHeal end
-- if myIncomingHeal ~= allIncomingHeal and myIncomingHeal ~= 0 then
local memberin = UnitGetIncomingHeals(member[i].name) or 0
member[i].health= 100 * (UnitHealth(member[i].name)+ memberin ) / UnitHealthMax(member[i].name)
member[i].healthothers = 100 * (UnitHealth(member[i].name)+ otherin ) / UnitHealthMax(member[i].name)
member[i].healthreal= 100 * UnitHealth(member[i].name) / UnitHealthMax(member[i].name)
if isvalidhealtarget(member[i].name) then
if member[i].health < member[lowest].health then lowest = i end
if UnitGroupRolesAssigned(member[i].name) == "TANK" then table.insert(tanks,i) end
local hasES ,_,_,_,_,_,_,uc = UnitBuffID(member[i].name, 974)
if hasES then if uc == "player" then myesbuff = i end end
if member[i].health < targethealth and isvalidhealtarget(member[i].name) then table.insert(chtargets,i) end
if member[i].health < hophealth then table.insert(chhops,i) end
local hasrt ,_,_,_,_,_,_, unitCaster = UnitBuffID(member[i].name, 61295)
local hasmyrt = 0
if hasrt then if unitCaster == "player" then hasmyrt = 1 end end
if member[i].health < member[rttarget].health and
isvalidhealtarget(member[i].name)
and hasmyrt == 0
then rttarget = i end
end
end