Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Shamans, Warriors = {}, {} -- tables that will house the names, ordered by raid index, of Shamans and Warriors in the party/raid respectively.
- 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
- local NumberGroupMembers
- local RCC = CreateFrame('FRAME', 'RaidCooldownCoordinationFrame', UIParent)
- RCC:RegisterEvent('PLAYER_ENTERING_WORLD')
- RCC:RegisterEvent('GROUP_ROSTER_UPDATE')
- RCC:RegisterEvent('READY_CHECK')
- RCC:SetScript('OnEvent', function(self, event, timeStamp, eventcl, _, _, sourceName, _, _, sourceGUID, destName, _, _, spellId)
- if (event == 'PLAYER_ENTERING_WORLD' and GetNumGroupMembers() == 0) then --dont listen to CLEU if not in a group
- RCC:UnregisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
- elseif (event == 'GROUP_ROSTER_UPDATE' and GetNumGroupMembers() == 0) then --stop listening to CLEU if group disbands
- RCC:UnregisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
- 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
- --or if we get dc'd midfight and load back into an encounter we want to ensure we're listening to CLEU
- --we also want to set our counters to 1, to rewrite the table values, and signal that the group changed
- s, w, groupchanged = 1, 1, 1
- RCC:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
- NumberGroupMembers = GetNumGroupMembers()
- for i = 1, NumberGroupMembers do
- if select(5, GetRaidRosterInfo(i)) == 'Shaman' then
- Shamans[s] = select(1, GetRaidRosterInfo(i)) --set name of Shaman to Shamans[s]
- s = s+1
- elseif select(5, GetRaidRosterInfo(i)) == 'Warrior' then
- Warriors[w] = select(1, GetRaidRosterInfo(i)) --set name of Warrior to Warriors[w]
- w = w+1
- end
- end
- elseif event == ('COMBAT_LOG_EVENT_UNFILTERED') then
- if (eventcl == 'SPELL_SUMMON' and spellId == 120668) then --stormlash totem drop event
- for i = 1, #Shamans do
- 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
- -- wouldnt be associated with a value in the table
- SendChatMessage(sourceName..' just dropped their Stormlash Totem. Drop yours in 10 seconds!', 'WHISPER', nil, Shamans[i+1])
- 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
- break --if we the source matched, no point continuing the for loop
- end
- end
- 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!
- SendChatMessage('Drop your Stormlash Totem now!', 'WHISPER', nil, lastwhisper)
- elseif (eventcl == 'SPELL_SUMMON' and spellId == 114207) then --skullbanner drop event
- for i = 1, #Warriors do
- if (sourceName == Warriors[i] and i ~= #Warriors) then
- SendChatMessage(sourceName..' just dropped their Skull Banner. Drop yours in 10 seconds!', 'WHISPER', nil, Warriors[i+1])
- lastwhisper2 = Warriors[i+1]
- break
- end
- end
- 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!
- SendChatMessage('Drop your Skull Banner now!', 'WHISPER', nil, lastwhisper2)
- end
- elseif (event == 'READY_CHECK' and groupchanged) then
- for i = 1, #Shamans do
- if i == 1 then
- SendChatMessage('You will be dropping your Stormlash Totem first, do it when you think best.', 'WHISPER', nil, Shamans[1])
- else
- 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])
- end
- end
- for i = 1, #Warriors do
- if i == 1 then
- SendChatMessage('You will be dropping your Skull Banner first, do it when you think best.', 'WHISPER', nil, Warriors[1])
- else
- 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])
- end
- end
- groupchanged = nil --don't whisper these people every time someone does a ready check if the order doesnt change
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement