Advertisement
bambinamonk

essencefont 2

Apr 30th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. function()
  2. -- Essence Font target counter
  3. -- Original code by Clebane. Modified by Garg & Raysere
  4. -- Revision 6
  5. -- Last modified 18 Jan 2017 by Raysere
  6.  
  7. -- Number of injured targets in range before aura will show
  8. aura_env.target_threshold = 3
  9.  
  10. --When the number of injured targets drops below this number, the aura will hide
  11. aura_env.untrigger_threshold = 3
  12.  
  13. --Amount of HP below maximum a unit must be before being counted
  14. aura_env.hp_threshold_mod = 0
  15.  
  16. aura_env.rangecheck = aura_env.rangecheck or GetTime()
  17.  
  18. --Only run if it's been > 1 second since the last time we ran
  19. if GetTime() - aura_env.rangecheck > 1 then
  20.  
  21. aura_env.rangecheck = GetTime()
  22.  
  23. if IsInGroup() then
  24.  
  25. aura_env.rangecheckcount = 0
  26.  
  27. local grouptype = (IsInRaid() and 'raid') or (IsInGroup() and 'party')
  28.  
  29. --Check if player should be counted as viable target
  30. --Doing this separately because of awkward difference between party and raid UIDs
  31. if UnitHealth('player') < (UnitHealthMax('player') - aura_env.hp_threshold_mod) then
  32. aura_env.rangecheckcount = aura_env.rangecheckcount +1
  33. end
  34.  
  35. --Iterate over group members, check their range, make sure they are not the player, then check if injured and increment count if so.
  36. for i = 1,GetNumGroupMembers() do
  37.  
  38. --Workaround for 7.1 kneecapping of UnitDistanceSquared
  39. local inRange = IsItemInRange(31463,grouptype..i)
  40.  
  41. if not UnitIsUnit(grouptype..i, 'player') and inRange then
  42.  
  43. if UnitHealth(grouptype..i) < (UnitHealthMax(grouptype..i) - aura_env.hp_threshold_mod) then
  44.  
  45. aura_env.rangecheckcount = aura_env.rangecheckcount + 1
  46.  
  47.  
  48. end
  49. end
  50. end
  51.  
  52. if aura_env.rangecheckcount >= aura_env.target_threshold then
  53. return true
  54. end
  55. end
  56. end
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement