local _,ns = ...
ns.ADDUIEVENT("PLAYER_LOGIN", function()
if AddUIDB.stop ==  false  then return end

-------------------------------------
-- 打斷提示 
-------------------------------------
local frame = CreateFrame("Frame", nil, UIParent)
frame:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
frame:SetScript("OnEvent", function(self, event, ...)
    local _, subevent, _, _, sourceName, sourceFlag, _, _, destName, _, destRaidFlags, _, _, _, extraSpellID = CombatLogGetCurrentEventInfo()
    if (subevent ~= 'SPELL_INTERRUPT') then return end
    if (bit.band(sourceFlag, COMBATLOG_OBJECT_AFFILIATION_MINE) == 0) then return end
    if (not sourceName) then return end
	if (destName == UnitName("Player")) then return end
	local iconnumber = (math.log(destRaidFlags) / math.log(2) + 1)
	local icon = tonumber(destRaidFlags)>0 and "{rt"..iconnumber.."}" or ""
    local msg = format("%s>%s<的%s",  "已打断", icon..destName or "", C_Spell.GetSpellLink(extraSpellID))
	SendChatMessage(msg, "EMOTE")
end)
--驱散
local frame = CreateFrame("Frame", nil, UIParent)
frame:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
frame:SetScript("OnEvent", function(self, event, ...)
    local _, subevent, _, _, sourceName, sourceFlag, RaidFlags, _, destName, _, _, _, _, _, extraSpellID = CombatLogGetCurrentEventInfo()
	if (subevent ~= 'SPELL_DISPEL') then return end
	if sourceName==UnitName("player") or sourceName==UnitName("pet") then
		PlaySoundFile("Interface\\AddOns\\AddUI\\Func\\call\\驱散成功音效.mp3","Master")
	end
end)

end)