Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function()
- -- Essence Font target counter
- -- Original code by Clebane. Modified by Garg & Raysere
- -- Revision 6
- -- Last modified 18 Jan 2017 by Raysere
- -- Number of injured targets in range before aura will show
- aura_env.target_threshold = 3
- --When the number of injured targets drops below this number, the aura will hide
- aura_env.untrigger_threshold = 3
- --Amount of HP below maximum a unit must be before being counted
- aura_env.hp_threshold_mod = 0
- aura_env.rangecheck = aura_env.rangecheck or GetTime()
- --Only run if it's been > 1 second since the last time we ran
- if GetTime() - aura_env.rangecheck > 1 then
- aura_env.rangecheck = GetTime()
- if IsInGroup() then
- aura_env.rangecheckcount = 0
- local grouptype = (IsInRaid() and 'raid') or (IsInGroup() and 'party')
- --Check if player should be counted as viable target
- --Doing this separately because of awkward difference between party and raid UIDs
- if UnitHealth('player') < (UnitHealthMax('player') - aura_env.hp_threshold_mod) then
- aura_env.rangecheckcount = aura_env.rangecheckcount +1
- end
- --Iterate over group members, check their range, make sure they are not the player, then check if injured and increment count if so.
- for i = 1,GetNumGroupMembers() do
- --Workaround for 7.1 kneecapping of UnitDistanceSquared
- local inRange = IsItemInRange(31463,grouptype..i)
- if not UnitIsUnit(grouptype..i, 'player') and inRange then
- if UnitHealth(grouptype..i) < (UnitHealthMax(grouptype..i) - aura_env.hp_threshold_mod) then
- aura_env.rangecheckcount = aura_env.rangecheckcount + 1
- end
- end
- end
- if aura_env.rangecheckcount >= aura_env.target_threshold then
- return true
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement