Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.82 KB | None | 0 0
  1. function(e, time, event, ...)
  2.     if not LEECH then LEECH = {} end
  3.     if not LEECH_SOURCES then LEECH_SOURCES = {} end
  4.     if e == "ENCOUNTER_START" or e == "XPLAYER_REGEN_DISABLED" then
  5.         wipe(LEECH)
  6.     elseif e == "ENCOUNTER_END" or e == "XPLAYER_REGEN_ENABLED" then
  7.         for healer, amount in pairs(LEECH) do
  8.             if amount ~= 0 then
  9.                 SendChatMessage("Leech from Unstable Felshadow Emulsion by Healer:", "RAID")
  10.                 break
  11.             end
  12.         end
  13.         for healer, amount in pairs(LEECH) do
  14.             local left,num,right = string.match(math.floor(amount),'^([^%d]*%d)(%d*)(.-)$')
  15.             formatted_amount = left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
  16.             SendChatMessage(healer .. ": " .. formatted_amount .. " healing", "RAID")
  17.             print(healer, ":", amount)
  18.         end
  19.     elseif event == "SPELL_HEAL" then
  20.         local target, _, _, spell, name, _, amount, overhealing = select(7, ...)
  21.         if spell ~= 143924 then return end
  22.         local effective = amount - overhealing
  23.         if effective < 10  then return end
  24.         wipe(LEECH_SOURCES)
  25.         local LEECH_TOTAL = 0
  26.         for i=1, 40 do
  27.             local name, _, _, _, _, _, _, source, _, _, aura, _, _, _, leech = UnitAura(target, i)
  28.             if not name then
  29.                 break
  30.             end
  31.             if aura == 184671 then
  32.                 LEECH_SOURCES[UnitName(source)] = leech
  33.                 LEECH_TOTAL = LEECH_TOTAL + leech
  34.             end
  35.         end
  36.         if LEECH_TOTAL == 0 then return end
  37.         for source, score in pairs(LEECH_SOURCES) do
  38.             if not LEECH[source] then
  39.                 LEECH[source] = 0
  40.             end
  41.             LEECH[source] = LEECH[source] + (effective * (score / LEECH_TOTAL))
  42.         end
  43.     end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement