Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function(allstates, event, unit, ...)
- if event == "RAID_TARGET_UPDATE" and aura_env.config["enableIcon"] then
- for i = 1,40 do
- local u = "nameplate"..i
- if UnitExists(u) then
- local guid = UnitGUID(u)
- if guid and not allstates[guid] and aura_env.config.npcID == select(6,strsplit("-", guid)) then
- if aura_env.config["specifiedIcon"][GetRaidTargetIndex(u)] then
- allstates[guid] = {
- show = true,
- changed = true,
- name = aura_env.counter[guid] or 1,
- PassUnit = u,
- }
- --sound only fired if nameplate is visible the moment that icon is applied, only relevant for VERY first interrupt.
- if aura_env.config.enableSound and allstates[guid].name == aura_env.config["enableSpecified"] then
- PlaySoundFile(aura_env.sound[aura_env.config["specifiedSound"]], "MASTER")
- end
- end
- end
- end
- end
- end
- if event == "COMBAT_LOG_EVENT_UNFILTERED" then
- local subEvent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellID, spellName, spellschool, extraspellID, extraspellName = ...
- if subEvent == "SPELL_CAST_SUCCESS" and aura_env.config.spellID == spellID then
- local state = allstates[sourceGUID]
- --cancels text aura if counter matches your specified value
- if aura_env.config["showText"] and aura_env.caststart[sourceGUID] and aura_env.caststart[sourceGUID] == aura_env.config["enableSpecified"] then
- WeakAuras.ScanEvents("HIDE_TEXTAURA", "nilcheck")
- end
- --count & print failed interrupts in chat (if option is actived)
- if aura_env.counter[sourceGUID] then
- aura_env.counter[sourceGUID] = aura_env.counter[sourceGUID] + 1
- if aura_env.config.printfails and sourceRaidFlags and sourceRaidFlags > 0 then
- print((aura_env.counter[sourceGUID]-1)..". interrupt failed on "..aura_env.sendemote[sourceRaidFlags])
- end
- else aura_env.counter[sourceGUID] = 2
- if aura_env.config.printfails and sourceRaidFlags and sourceRaidFlags > 0 then
- print((aura_env.counter[sourceGUID]-1)..". interrupt failed on "..aura_env.sendemote[sourceRaidFlags])
- end
- end
- --update state
- if state then
- state.changed = true
- state.name = aura_env.counter[sourceGUID]
- end
- --check if current count == limit and reset to 1 & update TSU
- if aura_env.counter[sourceGUID] == (aura_env.config["limit"]+1) and aura_env.config["limit"] > 0 then
- aura_env.counter[sourceGUID] = 1
- if state then
- state.changed = true
- state.name = aura_env.counter[sourceGUID]
- end
- end
- --fire sound if it matches your specified value
- if aura_env.config["enableSound"] and aura_env.counter[sourceGUID] then
- if aura_env.counter[sourceGUID] == aura_env.config["enableSpecified"] then
- PlaySoundFile(aura_env.sound[aura_env.config["specifiedSound"]], "MASTER")
- end
- end
- end
- if subEvent == "SPELL_INTERRUPT" and aura_env.config.spellID == extraspellID then
- local state = allstates[destGUID]
- --cancels text aura if counter matches your specified value
- if aura_env.config["showText"] and aura_env.caststart[destGUID] and aura_env.caststart[destGUID] == aura_env.config["enableSpecified"] then
- WeakAuras.ScanEvents("HIDE_TEXTAURA", "nilcheck")
- end
- --increase count
- if aura_env.counter[destGUID] then
- aura_env.counter[destGUID] = aura_env.counter[destGUID] + 1
- else aura_env.counter[destGUID] = 2
- end
- --update state with new count
- if state then
- state.changed = true
- state.name = aura_env.counter[destGUID]
- end
- --check if current count == limit and reset to 1 & update TSU
- if aura_env.counter[destGUID] == (aura_env.config["limit"]+1) and aura_env.config["limit"] > 0 then
- aura_env.counter[destGUID] = 1
- if state then
- state.changed = true
- state.name = aura_env.counter[destGUID]
- end
- end
- -- fire sound if it matches your specified value
- if aura_env.config["enableSound"] and aura_env.counter[destGUID] then
- if aura_env.counter[destGUID] == aura_env.config["enableSpecified"] then
- PlaySoundFile(aura_env.sound[aura_env.config["specifiedSound"]], "MASTER")
- end
- end
- end
- if subEvent == "SPELL_CAST_START" and aura_env.config.spellID == spellID then
- if (aura_env.config.specifiedIcon
- and aura_env.config.enableIcon
- and sourceRaidFlags
- and (aura_env.config.specifiedIcon[aura_env.translate[sourceRaidFlags]]
- or sourceRaidFlags == 0 and not aura_env.caststart[sourceGUID]))
- or not aura_env.config.enableIcon then
- if aura_env.caststart[sourceGUID] then
- aura_env.caststart[sourceGUID] = aura_env.caststart[sourceGUID] + 1
- else
- aura_env.caststart[sourceGUID] = 1
- end
- --reset cast start counter if counter = limit
- if aura_env.caststart[sourceGUID] == (aura_env.config["limit"]+1) and aura_env.config["limit"] > 0 then
- aura_env.caststart[sourceGUID] = 1
- end
- --fire cast start sound if it matches your specified value + raidicon
- if aura_env.config["enableCastSound"] and aura_env.caststart[sourceGUID] then
- if (aura_env.caststart[sourceGUID] == aura_env.config["enableSpecified"]) then
- PlaySoundFile(aura_env.castsound[aura_env.config["specifiedCastSound"]], "MASTER")
- end
- end
- --starts text aura if it matches your specified value
- if aura_env.config["showText"] and aura_env.caststart[sourceGUID] and aura_env.caststart[sourceGUID] == aura_env.config["enableSpecified"] then
- WeakAuras.ScanEvents("SHOW_TEXTAURA", "nilcheck")
- end
- end
- end
- --hide anchor-to-nameplate when npc dies
- if subEvent == "UNIT_DIED" then
- local state = allstates[destGUID]
- if state then
- state.show = false
- state.changed = true
- end
- end
- end
- if event == "NAME_PLATE_UNIT_ADDED" then
- if unit then
- local guid = UnitGUID(unit)
- if guid then
- local state = allstates[guid]
- --update state with current count when nameplate shows
- if state then
- state.changed = true
- state.PassUnit = unit
- state.name = aura_env.counter[guid] or 1
- end
- --create state when nameplate shows
- if not state and aura_env.config.npcID == select(6,strsplit("-", guid)) then
- if aura_env.config["enableIcon"] and aura_env.config["specifiedIcon"][GetRaidTargetIndex(unit)] or not aura_env.config["enableIcon"] then
- allstates[guid] = {
- PassUnit = unit,
- show = true,
- name = aura_env.counter[guid] or 1,
- changed = true,
- }
- end
- end
- end
- end
- end
- if event == "NAME_PLATE_UNIT_REMOVED" then
- if unit then
- local guid = UnitGUID(unit)
- if guid then
- local state = allstates[guid]
- if state then
- state.changed = true
- state.PassUnit = "none"
- end
- end
- end
- end
- if event == "ENCOUNTER_START" then
- aura_env.counter = {}
- aura_env.caststart = {}
- if IsAddOnLoaded("ExRT")
- and _G.VExRT.Note.Text1
- and aura_env.config.overrideSettings then
- local text = _G.VExRT.Note.Text1
- aura_env.count = 0
- --counts lines except gaps
- for line in string.gmatch(text,'[^\r\n]+') do
- aura_env.count = aura_env.count + 1
- --searches for "startLine" in Note
- if string.match(line, "startLine") then
- aura_env.startCount = aura_env.count
- end
- --searches for "endLine" in Note
- if string.match(line, "endLine") then
- aura_env.endCount = aura_env.count
- end
- --checks if your name is found inbetween startLine and endLine
- if aura_env.startCount and (aura_env.count or aura_env.myCount and aura_env.myCount) > aura_env.startCount then
- if (string.match(line, UnitName("player")) or aura_env.myCount) then
- if not aura_env.myCount then
- aura_env.myCount = aura_env.count
- aura_env.line = line
- aura_env.myMark = string.match(line, "%{%a+%}")
- elseif aura_env.myCount and aura_env.endCount and aura_env.endCount > aura_env.myCount then
- aura_env.resetAfter = 0
- for name in string.gmatch(aura_env.line, "|c%x%x%x%x%x%x%x%x([%w-]+)|") do
- aura_env.resetAfter = aura_env.resetAfter + 1
- if name == UnitName("player") then
- aura_env.config.enableSpecified = aura_env.resetAfter
- end
- end
- end
- end
- end
- end
- if aura_env.resetAfter then
- --set limit to amount of playerNames in your interruptorder
- aura_env.config.limit = aura_env.resetAfter
- end
- if aura_env.myMark then
- --disable all currently selected raidicons & enable raidicon from note
- for i = 1,8 do
- aura_env.config["specifiedIcon"][i] = false
- end
- aura_env.config["enableIcon"] = true
- aura_env.config["specifiedIcon"][aura_env.translateERT[aura_env.myMark]] = true
- --aura_env.config.enableSound = true --forces people to use a sound (disabled by default)
- end
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement