krazyito65

Weak Aura battle res monitor code. v3.1

Jan 20th, 2015
2,757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.42 KB | None | 0 0
  1. ----------Timer and Stack count.-----------
  2. --Display code: This is what actually displays the aura information
  3. function()
  4.    
  5.     if WA_RES_MONITOR_Timer ~= nil then
  6.        
  7.         local timeToCountUpFrom = GetTime() - WA_RES_MONITOR_Timer  -- Timer is current time when we started, which then is subtracted by Gettime. Result is this timer counts up.
  8.         local countDownTimer = WA_RES_MONITOR_Res_CD - timeToCountUpFrom --Subtract time since last 0 from the CD of the battle resurrections. Results in a countdown timer.
  9.        
  10.         local resCharges = GetSpellCharges(20484) -- Get the charges of 'Rebirth'
  11.        
  12.         if resCharges == nil then -- if rebirth has 'nil' charges, then we are not in a boss encounter. Set it to 0 to avoid errors.
  13.             resCharges = 0
  14.         end
  15.        
  16.        
  17.         if countDownTimer < 0 then -- When the timer reaches 0.
  18.             WA_RES_MONITOR_Timer = GetTime() -- Resets the timer to the currect time, so it counts up from 0.
  19.         end
  20.        
  21.         if resCharges == 0 then -- Aesthetics changes (a red 0, white otherwise)
  22.             resCharges = "|cFFFF0001" .. resCharges .. "|r"
  23.         else
  24.             resCharges ="|cFFFFFFFF" .. resCharges .. "|r"
  25.         end
  26.        
  27.        
  28.         return resCharges .. "       " .. ("%02d:%02d"):format(countDownTimer/60, countDownTimer%60) .. "\n"  -- Output the information.
  29.     else
  30.         return "1     Test Text!" -- This is here to avoid errors.
  31.     end
  32.    
  33. end
  34.  
  35. --EVENTS: that trigger - ENCOUNTER_START, ENCOUNTER_END, COMBAT_LOG_EVENT_UNFILTERED
  36. --Custom Trigger Code: This is how the aura is triggered.
  37. function(event, ...)
  38.    
  39.     local  _, _, _, raidSize = ...
  40.    
  41.    
  42.     if event == "ENCOUNTER_START" and raidSize >= 10 then
  43.        
  44.         local numGroup = GetNumGroupMembers()
  45.        
  46.         if GetNumGroupMembers() == 0 then -- check for 0 to avoid divide by 0 case
  47.             numGroup = 1
  48.         end
  49.        
  50.         -- if the encounter has started, we're going to display the aura and reset all values
  51.         WA_RES_MONITOR_Res_CD = ((90/numGroup)*60) -- 90/RaidSize multipied by 60 seconds.
  52.         WA_RES_MONITOR_Timer = GetTime() -- This will get our current time in seconds to count up from
  53.         WA_RES_MONITOR_Res_List = ""
  54.         return true
  55.        
  56.        
  57.     elseif event == "ENCOUNTER_END" then -- When an encounter ends, stop the timer and untrigger the aura.
  58.        
  59.         WA_RES_MONITOR_Timer = nil -- set the timer to nil so there is no counting in the background.
  60.         return false
  61.        
  62.     end
  63.    
  64. end
  65.  
  66. --Custom Untrigger: This makes the aura untrigger
  67. function(event)
  68.    
  69.     --Triggers when a raid encounter ends (from Custom Trigger)
  70.     return  WA_RES_MONITOR_Timer == nil
  71. end
  72.  
  73.  
  74. -----------------------RESURRECTION LIST: This displays a list of people who used a res spell and on who (reincarnation unsupported atm--------------------------
  75.  
  76.  
  77. --Display Code: This is the code that is actually displayed
  78. function()
  79.    
  80.     if WA_RES_MONITOR_Res_List ~= nil then
  81.         --WA_RES_MONITOR_Timer  ~= nil ? -- Use this if the above check does not work.
  82.        
  83.         return WA_RES_MONITOR_Res_List -- Output the information.
  84.     else
  85.         return "|cFFFF7D0AKrazyito|r -> SomeBad-Gnomeregan\n" -- This is here to avoid errors.
  86.     end
  87.    
  88. end
  89.  
  90. --Events that trigger: ENCOUNTER_START, ENCOUNTER_END, COMBAT_LOG_EVENT_UNFILTERED
  91. --Custom Trigger: this code triggers the aura
  92. function(event, ...)
  93.    
  94.     --@Author: Krazyito-Mal'ganis, US
  95.     --@Version: v3.1
  96.    
  97.     local  _, _, _, raidSize = ...
  98.    
  99.     local _, subevent, _, _, sourceName, _, _, _, destName, _, _, _, spellName= ... -- Stores the variables passed in from the event
  100.    
  101.     local setClassColor = function(playerName) -- local function to determine the player class and color it
  102.         local  _, playerClass = UnitClass(playerName) -- Determines the player class
  103.         if playerClass == "DEATHKNIGHT" then
  104.             return "|cFFC41F3B" .. playerName .. "|r" -- Place color tags based on class colors on http://www.wowwiki.com/Class_colors
  105.         elseif playerClass == "DRUID" then
  106.             return "|cFFFF7D0A" .. playerName .. "|r"
  107.         elseif playerClass == "HUNTER" then
  108.             return "|cFFABD473" .. playerName .. "|r"
  109.         elseif playerClass == "MAGE" then
  110.             return "|cFF69CCF0" .. playerName .. "|r"
  111.         elseif playerClass == "MONK" then
  112.             return "|cFF00FF96" .. playerName .. "|r"
  113.         elseif playerClass == "PALADIN" then
  114.             return "|cFFF58CBA" .. playerName .. "|r"
  115.         elseif playerClass == "PRIEST" then
  116.             return "|cFFFFFFFF" .. playerName .. "|r"
  117.         elseif playerClass == "ROGUE" then
  118.             return "|cFFFFF569" .. playerName .. "|r"
  119.         elseif playerClass == "SHAMAN" then
  120.             return "|cFF0070DE" .. playerName .. "|r"
  121.         elseif playerClass == "WARLOCK" then
  122.             return "|cFF9482C9" .. playerName .. "|r"
  123.         elseif playerClass == "WARRIOR" then
  124.             return "|cFFC79C6E" .. playerName .. "|r"
  125.         else
  126.             return "|cFFF900FF" .. playerName .. "|r"
  127.         end
  128.     end
  129.    
  130.     if event == "ENCOUNTER_START" and raidSize >= 10 then
  131.        
  132.         -- if the encounter has started, we're going to display the aura and reset all values
  133.         WA_RES_MONITOR_Res_List = ""
  134.         return true
  135.        
  136.     elseif event == "COMBAT_LOG_EVENT_UNFILTERED" and subevent == "SPELL_RESURRECT" and spellName ~= "Mass Resurrection" then
  137.        
  138.         --Take the current Resurrection list and append the new line under it.
  139.         WA_RES_MONITOR_Res_List = WA_RES_MONITOR_Res_List .. setClassColor(sourceName) .. " -> " .. setClassColor(destName) .. "\n"
  140.        
  141.     elseif event == "COMBAT_LOG_EVENT_UNFILTERED" and subevent == "SPELL_CAST_SUCESS" and spellName == "Reincarnation"  then
  142.        
  143.         --Take the current Resurrection list and append reincarnation as a new line.
  144.         WA_RES_MONITOR_Res_List = WA_RES_MONITOR_Res_List  .. "Reincarnation -> " .. setClassColor(sourceName) .. "\n"
  145.        
  146.     end
  147.    
  148.    
  149. end
  150.  
  151. --custom untrigger
  152. function(event)
  153.    
  154.     --Triggers when a raid encounter ends
  155.    
  156.     --if event == "ENCOUNTER_END" then return true end  -- When an encounter ends, untrigger the aura
  157.     return false -- Switch this with the above code to have the display go away when combat ends.
  158. end
Advertisement
Add Comment
Please, Sign In to add comment