Advertisement
Guest User

Untitled

a guest
Aug 30th, 2014
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.84 KB | None | 0 0
  1. local Shamans, Warriors = {}, {}    -- tables that will house the names, ordered by raid index, of Shamans and Warriors in the party/raid respectively.
  2. local s, w, lastwhisper, lastwhisper2, groupchanged --s and w are variables that we will use as counters for positions in our table to ensure they are overwritten instead of a perpetually increasing table
  3. local NumberGroupMembers
  4.  
  5. local RCC = CreateFrame('FRAME', 'RaidCooldownCoordinationFrame', UIParent)
  6.     RCC:RegisterEvent('PLAYER_ENTERING_WORLD')
  7.     RCC:RegisterEvent('GROUP_ROSTER_UPDATE')
  8.     RCC:RegisterEvent('READY_CHECK')
  9.    
  10.     RCC:SetScript('OnEvent', function(self, event, timeStamp, eventcl, _, _, sourceName, _, _, sourceGUID, destName, _, _, spellId)
  11.         if (event == 'PLAYER_ENTERING_WORLD' and GetNumGroupMembers() == 0) then --dont listen to CLEU if not in a group
  12.             RCC:UnregisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
  13.         elseif (event == 'GROUP_ROSTER_UPDATE' and GetNumGroupMembers() == 0) then --stop listening to CLEU if group disbands
  14.             RCC:UnregisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
  15.         elseif ((event == 'GROUP_ROSTER_UPDATE' or event == 'PLAYER_ENTERING_WORLD') and GetNumGroupMembers() > 0) then --if group changes (possibly causing a change in player index, thereby changing the order of our name tables
  16.                                                                                                                         --or if we get dc'd midfight and load back into an encounter we want to ensure we're listening to CLEU
  17.                                                                                                                         --we also want to set our counters to 1, to rewrite the table values, and signal that the group changed
  18.             s, w, groupchanged = 1, 1, 1
  19.             RCC:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
  20.             NumberGroupMembers = GetNumGroupMembers()
  21.             for i = 1, NumberGroupMembers do
  22.                 if select(5, GetRaidRosterInfo(i)) == 'Shaman' then
  23.                     Shamans[s] = select(1, GetRaidRosterInfo(i)) --set name of Shaman to Shamans[s]
  24.                     s = s+1
  25.                 elseif select(5, GetRaidRosterInfo(i)) == 'Warrior' then
  26.                     Warriors[w] = select(1, GetRaidRosterInfo(i)) --set name of Warrior to Warriors[w]
  27.                     w = w+1
  28.                 end
  29.             end
  30.         elseif event == ('COMBAT_LOG_EVENT_UNFILTERED') then
  31.        
  32.             if (eventcl == 'SPELL_SUMMON' and spellId == 120668) then --stormlash totem drop event
  33.                 for i = 1, #Shamans do
  34.                     if (sourceName == Shamans[i] and i ~= #Shamans) then --sourceName is arg5, we check to ensure i ~= #Shamans, because it's a) pointless to whisper the first guy on the list as he still has a long cd, and b) i+1
  35.                                                                          -- wouldnt be associated with a value in the table
  36.                         SendChatMessage(sourceName..' just dropped their Stormlash Totem.  Drop yours in 10 seconds!', 'WHISPER', nil, Shamans[i+1])
  37.                         lastwhisper = Shamans[i+1] --set our last whisper name so we can use it as a variable to send our whisper to the next shaman in line once the previous shaman's buff fades
  38.                         break --if we the source matched, no point continuing the for loop
  39.                     end
  40.                 end
  41.                
  42.             elseif (eventcl == 'UNIT_DESTROYED' and destName == 'Stormlash Totem' and select(6, GetPlayerInfoByGUID(sourceGUID)) ~= Shamans[#Shamans]) then --THIS IS THE LINE THAT IS CAUSING ME ISSUE!
  43.                 SendChatMessage('Drop your Stormlash Totem now!', 'WHISPER', nil, lastwhisper)
  44.    
  45.             elseif (eventcl == 'SPELL_SUMMON' and spellId == 114207) then --skullbanner drop event
  46.                 for i = 1, #Warriors do
  47.                     if (sourceName == Warriors[i] and i ~= #Warriors) then
  48.                         SendChatMessage(sourceName..' just dropped their Skull Banner.  Drop yours in 10 seconds!', 'WHISPER', nil, Warriors[i+1])
  49.                         lastwhisper2 = Warriors[i+1]
  50.                         break
  51.                     end
  52.                 end
  53.                
  54.             elseif (eventcl == 'UNIT_DESTROYED' and destName == 'Skull Banner' and select(6, GetPlayerInfoByGUID(sourceGUID)) ~= Warriors[#Warriors]) then ----THIS IS THE (other) LINE THAT IS CAUSING ME ISSUE!
  55.                 SendChatMessage('Drop your Skull Banner now!', 'WHISPER', nil, lastwhisper2)
  56.             end
  57.            
  58.         elseif (event == 'READY_CHECK' and groupchanged) then
  59.        
  60.             for i = 1, #Shamans do
  61.                 if i == 1 then
  62.                     SendChatMessage('You will be dropping your Stormlash Totem first, do it when you think best.', 'WHISPER', nil, Shamans[1])
  63.                 else
  64.                     SendChatMessage('The Stormlash order is: ' .. table.concat(Shamans, ', ') .. '.  You will get a 10s warning whisper, followed by a "Drop it now!" whisper when you are to drop Stormlash.', 'WHISPER', nil, Shamans[i])
  65.                 end
  66.             end
  67.            
  68.             for i = 1, #Warriors do
  69.                 if i == 1 then
  70.                     SendChatMessage('You will be dropping your Skull Banner first, do it when you think best.', 'WHISPER', nil, Warriors[1])
  71.                 else
  72.                     SendChatMessage('The Skull Banner order is: ' .. table.concat(Warriors, ', ') .. '.  You will get a 10s warning whisper, followed by a "Drop it now!" whisper when you are to drop Skull Banner.', 'WHISPER', nil, Warriors[i])
  73.                 end
  74.             end
  75.            
  76.             groupchanged = nil --don't whisper these people every time someone does a ready check if the order doesnt change
  77.         end
  78.     end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement