if not PQR_LoadedDataFile then PQR_LoadedDateFile = 1 print("|cffFF6EB4--CuteOne Data File--|cffffffff") elseif PQR_LoadedDataFile then print("|cffFF6EB4--Reloading Data--|cffffffff") end --- Global Shorthand Commands function shcom() t = "target" p = "player" foc = "focus" gsi = GetSpellInfo giid = GetInventoryItemID cast = CastSpellByName cd = GetSpellCooldown cp = GetComboPoints(p) ub = UnitBuff ubid = UnitBuffID ua = UnitAura udb = UnitDebuff udbid = UnitDebuffID pow = UnitPower(p) plvl = UnitLevel(p) hastar = UnitExists(t) canattack = UnitCanAttack(p,t) sir = IsSpellInRange incom = UnitAffectingCombat(p)==1 outcom = UnitAffectingCombat(p)~=1 php = 100*(UnitHealth(p)/UnitHealthMax(p)) thp = 100*(UnitHealth(t)/UnitHealthMax(t)) tthp = UnitHealthMax(t) pchannel = select(8,UnitChannelInfo(p)) pcasting = (UnitCastingInfo(p) and select(9,UnitCastingInfo(p))) tchannel = select(8,UnitChannelInfo(t)) tcasting = (UnitCastingInfo(t) and select(9,UnitCastingInfo(t))) if select(6,UnitCastingInfo(t))~=nil then tcasttime = (select(6,UnitCastingInfo(t))/1000)-GetTime() else tcasttime = 0 end end ---Spell Check check = nil function check(sp,unit) unit = unit or t; spell = string.format("%s",GetSpellInfo(sp)) if UnitExists(unit) and UnitCanAttack("player", unit) == 1 and not UnitIsDeadOrGhost(unit) and not PQR_IsOutOfSight(unit, 1) and IsUsableSpell(spell) and PQR_SpellAvailable(spell) and GetSpellCooldown(spell)==0 then if SpellHasRange(spell)==1 then if IsSpellInRange(spell,unit)~=1 then return false end else return true end else return false end return true end --- Round function round2(num, idp) mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult end --- Time to Die function ttd(unit) unit = unit or "target"; if UnitExists(unit) and not UnitIsDeadOrGhost(unit) then if currtar ~= UnitGUID(unit) then priortar = currtar currtar = UnitGUID(unit) end if thpstart==0 and timestart==0 then thpstart = UnitHealth(unit) timestart = GetTime() else thpcurr = UnitHealth(unit) timecurr = GetTime() if thpcurr >= thpstart then thpstart = thpcurr timeToDie = 999 else timeToDie = round2(thpcurr/((thpstart - thpcurr) / (timecurr - timestart)),2) end end elseif not UnitExists(unit) or currtar ~= UnitGUID(unit) then currtar = 0 priortar = 0 thpstart = 0 timestart = 0 timeToDie = 0 end if timeToDie==nil then return 999 else return timeToDie end end ------Interrupt------ Interruptable = nil function Interruptable(unit, spell) if UnitExists(unit) and PQR_SpellAvailable(spell) and UnitCanAttack("player", unit) == 1 and not UnitIsDeadOrGhost(unit) and not PQR_IsOutOfSight(unit, 1) and IsSpellInRange(GetSpellInfo(spell), unit) == 1 then if select(6,UnitCastingInfo(unit))~=nil or select(6,UnitChannelInfo(unit))~=nil then if (((UnitCastingInfo(unit) and select(9,UnitCastingInfo(unit)))==false and ((select(6,UnitCastingInfo(unit))/1000)-GetTime()) < 5) or ((UnitChannelInfo(unit) and select(8,UnitChannelInfo(unit)))==false)) then return true else return false end end end end ---Buff Check function HaveBuff(UnitID,SpellID,TimeLeft,Filter) if not TimeLeft then TimeLeft = 0 end if type(SpellID) == "number" then SpellID = { SpellID } end for i=1,#SpellID do local spell, rank = GetSpellInfo(SpellID[i]) if spell then local buff = select(7,UnitBuff(UnitID,spell,rank,Filter)) if buff and ( buff == 0 or buff - GetTime() > TimeLeft ) then return true end end end end --- Glyph Check GlyphCheck = nil function GlyphCheck(glyphid) for i=1, 6 do if select(4, GetGlyphSocketInfo(i)) == glyphid then return true end end return false end -- Behind Check function BehindFunc() if behindTimer == nil then behindTimer = 0 end local BehindCheck = PQR_CheckUIError(SPELL_FAILED_NOT_BEHIND) Timer = GetTime() - behindTimer if BehindCheck and behindTimer == 0 then behindTimer = GetTime() behind = false end if not BehindCheck and Timer > 0 then behindTimer = 0 behind = true end if Timer > 3 and Timer < 10 then behindTimer = 0 behind = false end end ------Member Check------ function CalculateHP(t) incomingheals = UnitGetIncomingHeals(t) or 0 return 100 * ( UnitHealth(t) + incomingheals ) / UnitHealthMax(t) end function CanHeal(t) if UnitInRange(t) and UnitCanCooperate("player",t) and not UnitIsEnemy("player",t) and not UnitIsCharmed(t) and not UnitIsDeadOrGhost(t) and not PQR_IsOutOfSight(t) then return true end end function GroupInfo() members, group = { { Unit = "player", HP = CalculateHP("player") } }, { low = 0, tanks = { } } group.type = IsInGroup() and "raid" or "party" group.number = GetNumGroupMembers() for i=1,group.number do if CanHeal(group.type..i) then local unit, hp = group.type..i, CalculateHP(group.type..i) table.insert( members,{ Unit = unit, HP = hp } ) if hp < 90 then group.low = group.low + 1 end if UnitGroupRolesAssigned(unit) == "TANK" then table.insert(group.tanks,unit) end end end if group.type == "raid" or "party" and #members > 1 then table.remove(members,1) end table.sort(members, function(x,y) return x.HP < y.HP end) local customtarget = CanHeal("target") and "target" -- or CanHeal("mouseover") and GetMouseFocus() ~= WorldFrame and "mouseover" if customtarget then table.sort(members, function(x) return UnitIsUnit(customtarget,x.Unit) end) end end -- Trick of the Trade function TricksInfo() tmembers, tgroup = { }, { } tgroup.type = IsInGroup() and "raid" or "party" tgroup.number = GetNumGroupMembers() for i=1,tgroup.number do if UnitGroupRolesAssigned(tgroup.type..i)~="HEALER" and UnitGroupRolesAssigned(tgroup.type..i)~="NONE" then local tunit, gr = tgroup.type..i, UnitGroupRolesAssigned(tgroup.type..i) table.insert( tmembers,{ Unit = tunit, Role = gr } ) end end if tgroup.type == "raid" or "party" and #tmembers > 1 then table.remove(tmembers,1) end end --Symbiosis Priority Cast function classPrio(t) local class = select(3,UnitClass(t)) if class == 1 then --Warrior return 1 elseif class == 2 then --Paladin return 5 elseif class == 3 then --Hunter return 8 elseif class == 4 then --Rogue return 4 elseif class == 5 then --Priest return 6 elseif class == 6 then --Deathknight return 7 elseif class == 7 then --Shaman return 2 elseif class == 8 then --Mage return 9 elseif class == 9 then --Warlock return 3 elseif class == 10 then --Monk return 10 elseif class == 11 then --Druid return 11 end end local symIDs = { 110478, --DK 110479, --Hunter 110482, --Made 110483, --Monk 110484, --Paladin 110485, --Priest 110486, --Rogue 110488, --Shaman 110490, --Warlock 110491 --Warrior } function HasSymb( t ) for i=1, #symIDs do local hasSym = select(15,UnitBuffID(t,symIDs[i])) local class = select(3,UnitClass( t )) if hasSym or class == 11 then return true else return false end end end function SymMem() symmem, symgroup = { }, { } symgroup.type = IsInGroup() and "raid" or "party" symgroup.number = GetNumGroupMembers() for i=1,symgroup.number do if not HasSymb(symgroup.type..i) then local unit, prio, class, classID = symgroup.type..i, classPrio(symgroup.type..i), select(2, UnitClass(symgroup.type..i)), select(3,UnitClass(symgroup.type..i)) table.insert( symmem,{ Unit = unit, Prio = prio, Class = class, ClassID = classID } ) end end if symgroup.type == "raid" or "party" and #symmem > 1 then table.remove(symmem,1) end table.sort(symmem, function(x,y) return x.Prio < y.Prio end) end --Tabled Cast Time Checking for When you Last Cast Something. CheckCastTime = {} Nova_CheckLastCast = nil function Nova_CheckLastCast(spellid, ytime) -- SpellID of Spell To Check, How long of a gap are you looking for? if ytime > 0 then if #CheckCastTime > 0 then for i=1, #CheckCastTime do if CheckCastTime[i].SpellID == spellid then if GetTime() - CheckCastTime[i].CastTime > ytime then CheckCastTime[i].CastTime = GetTime() return true else return false end end end end table.insert(CheckCastTime, { SpellID = spellid, CastTime = GetTime() } ) return true elseif ytime <= 0 then return true end return false end --Totem Range Check local Blacklist = { 120668, 2062, 2894 } function totemDistance() if not (totemX and totemY) then totemX,totemY = 0,0 end for i=1, #Blacklist do local totemName = select(2,GetTotemInfo(1)) or select(2,GetTotemInfo(2)) local blackList = GetSpellInfo(Blacklist[i]) if totemX ~= (0 or nil) and totemY ~= (0 or nil) and totemName ~= blackList then local a,b,c,d,e,f,g,h,i,j = GetAreaMapInfo(GetCurrentMapAreaID()) local a1 , b1 = GetPlayerMapPosition("Player") local x1 , y1 = a1 * 1000, b1 * 1000 local a2 , b2 = totemX, totemY local x2 , y2 = a2 * 1000, b2 * 1000 local w = (d - e) local h = (f - g) local distance = sqrt(min(x1 - x2, w - (x1 - x2))^2 + min(y1 - y2, h - (y1-y2))^2) return distance else return 0 end end end -- Dispel Check function ValidDispel(t) local HasValidDispel = false local i = 1 local debuff = UnitDebuff(t, i) while debuff do local debuffType = select(5, UnitDebuff(t, i)) local debuffid = select(11, UnitDebuff(t, i)) local PQ_Class = select(2, UnitClass(t)) local ValidDebuffType = false if PQ_Class == "DRUID" then if debuffType == "Poison" or debuffType == "Curse" then ValidDebuffType = true --elseif PQR_SpellAvailable(122288) and debuffType == "Disease" then --Cleanse from Paladin Symbiosis --ValidDebuffType = true end end if ValidDebuffType and debuffid ~= 138732 --Ionization from Jin'rokh the Breaker - ptr and debuffid ~= 138733 --Ionization from Jin'rokh the Breaker - live then HasValidDispel = true end i = i + 1 debuff = UnitDebuff(t, i) end return HasValidDispel end --Line of Sight Check if not tLOS then tLOS={} end if not fLOS then fLOS=CreateFrame("Frame") end function LineOfSight(target) local updateRate=3 --local x1, y1 = PQR_UnitInfo(target) fLOS:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") function fLOSOnEvent(self,event,...) if event=="COMBAT_LOG_EVENT_UNFILTERED" then local cLOG={...} if cLOG and cLOG[2] and cLOG[2]=="SPELL_CAST_FAILED" then local player=UnitGUID("player") or "" if cLOG[4] and cLOG[4]==player then if cLOG[15] then if cLOG[15]==SPELL_FAILED_LINE_OF_SIGHT or cLOG[15]==SPELL_FAILED_NOT_INFRONT or cLOG[15]==SPELL_FAILED_OUT_OF_RANGE or cLOG[15]==SPELL_FAILED_UNIT_NOT_INFRONT or cLOG[15]==SPELL_FAILED_UNIT_NOT_BEHIND or cLOG[15]==SPELL_FAILED_NOT_BEHIND or cLOG[15]==SPELL_FAILED_MOVING or cLOG[15]==SPELL_FAILED_IMMUNE or cLOG[15]==SPELL_FAILED_FLEEING or cLOG[15]==SPELL_FAILED_BAD_TARGETS --or cLOG[15]==SPELL_FAILED_NO_MOUNTS_ALLOWED or cLOG[15]==SPELL_FAILED_STUNNED or cLOG[15]==SPELL_FAILED_SILENCED or cLOG[15]==SPELL_FAILED_NOT_IN_CONTROL --or cLOG[15]==Your vision of the target is obscured? then --tinsert(tLOS,{unit=target,time=GetTime(),x=x1,y=y1}) tinsert(tLOS,{unit=target,time=GetTime()}) end end end else if #tLOS > 0 then table.sort(tLOS,function(x,y) return x.time>y.time end) for i=1,#tLOS do local time=tLOS[i].time or GetTime() if GetTime()>time+updateRate then tremove(tLOS,i) end end end end end end fLOS:SetScript("OnEvent",fLOSOnEvent) if #tLOS > 0 then for i=1,#tLOS do if tLOS and tLOS[i] and tLOS[i].unit==target --and (tLOS[i].x - 5) <= x1 and (tLOS[i].x + 5) >= x1 and (tLOS[i].y - 5) <= y1 and (tLOS[i].y + 5) >= y1 then --PQR_WriteToChat("\124cFFFF55FFLoS Name: "..UnitName(target)) return true end end end end ------Boss Check------ PQ_BossUnits = { -- Cataclysm Dungeons -- -- Abyssal Maw: Throne of the Tides 40586, -- Lady Naz'jar 40765, -- Commander Ulthok 40825, -- Erunak Stonespeaker 40788, -- Mindbender Ghur'sha 42172, -- Ozumat -- Blackrock Caverns 39665, -- Rom'ogg Bonecrusher 39679, -- Corla, Herald of Twilight 39698, -- Karsh Steelbender 39700, -- Beauty 39705, -- Ascendant Lord Obsidius -- The Stonecore 43438, -- Corborus 43214, -- Slabhide 42188, -- Ozruk 42333, -- High Priestess Azil -- The Vortex Pinnacle 43878, -- Grand Vizier Ertan 43873, -- Altairus 43875, -- Asaad -- Grim Batol 39625, -- General Umbriss 40177, -- Forgemaster Throngus 40319, -- Drahga Shadowburner 40484, -- Erudax -- Halls of Origination 39425, -- Temple Guardian Anhuur 39428, -- Earthrager Ptah 39788, -- Anraphet 39587, -- Isiset 39731, -- Ammunae 39732, -- Setesh 39378, -- Rajh -- Lost City of the Tol'vir 44577, -- General Husam 43612, -- High Prophet Barim 43614, -- Lockmaw 49045, -- Augh 44819, -- Siamat -- Zul'Aman 23574, -- Akil'zon 23576, -- Nalorakk 23578, -- Jan'alai 23577, -- Halazzi 24239, -- Hex Lord Malacrass 23863, -- Daakara -- Zul'Gurub 52155, -- High Priest Venoxis 52151, -- Bloodlord Mandokir 52271, -- Edge of Madness 52059, -- High Priestess Kilnara 52053, -- Zanzil 52148, -- Jin'do the Godbreaker -- End Time 54431, -- Echo of Baine 54445, -- Echo of Jaina 54123, -- Echo of Sylvanas 54544, -- Echo of Tyrande 54432, -- Murozond -- Hour of Twilight 54590, -- Arcurion 54968, -- Asira Dawnslayer 54938, -- Archbishop Benedictus -- Well of Eternity 55085, -- Peroth'arn 54853, -- Queen Azshara 54969, -- Mannoroth 55419, -- Captain Varo'then -- Mists of Pandaria Dungeons -- -- Scarlet Halls 59303, -- Houndmaster Braun 58632, -- Armsmaster Harlan 59150, -- Flameweaver Koegler -- Scarlet Monastery 59789, -- Thalnos the Soulrender 59223, -- Brother Korloff 3977, -- High Inquisitor Whitemane 60040, -- Commander Durand -- Scholomance 58633, -- Instructor Chillheart 59184, -- Jandice Barov 59153, -- Rattlegore 58722, -- Lilian Voss 58791, -- Lilian's Soul 59080, -- Darkmaster Gandling -- Stormstout Brewery 56637, -- Ook-Ook 56717, -- Hoptallus 59479, -- Yan-Zhu the Uncasked -- Tempe of the Jade Serpent 56448, -- Wise Mari 56843, -- Lorewalker Stonestep 59051, -- Strife 59726, -- Peril 58826, -- Zao Sunseeker 56732, -- Liu Flameheart 56762, -- Yu'lon 56439, -- Sha of Doubt -- Mogu'shan Palace 61444, -- Ming the Cunning 61442, -- Kuai the Brute 61445, -- Haiyan the Unstoppable 61243, -- Gekkan 61398, -- Xin the Weaponmaster -- Shado-Pan Monastery 56747, -- Gu Cloudstrike 56541, -- Master Snowdrift 56719, -- Sha of Violence 56884, -- Taran Zhu -- Gate of the Setting Sun 56906, -- Saboteur Kip'tilak 56589, -- Striker Ga'dok 56636, -- Commander Ri'mok 56877, -- Raigonn -- Siege of Niuzao Temple 61567, -- Vizier Jin'bak 61634, -- Commander Vo'jak 61485, -- General Pa'valak 62205, -- Wing Leader Ner'onok -- Training Dummies -- 46647, -- Level 85 Training Dummy 67127 -- Level 90 Training Dummy } SpecialUnit = nil function SpecialUnit() local PQ_BossUnits = PQ_BossUnits if UnitExists("target") then local npcID = tonumber(UnitGUID("target"):sub(6,10), 16) if UnitLevel("target") == -1 then return true else for i=1,#PQ_BossUnits do if PQ_BossUnits[i] == npcID then return true end end return false end else return false end end -- Switch CD_BossOnly = 1 CD_Auto = 2 PQ_CD = CD_BossOnly PQ_CDTimer = 0 PP_Auto = 1 PP_Only = 2 PQ_PP = PP_Auto PQ_PPTimer = 0 PQ_AOE = false PQ_AOETimer = 0 PQ_Sym = false PQ_SymTimer = 0 custTars = {"target","focus"}