/trunk
end |
local function StopSound(event, rem) |
-- we should delay some sounds for 50 ms because they are played before the event is executed |
-- we should delay some sounds for 10 ms because they are played before the event is executed |
-- so we need to check our flag first to ensure the sound source is not from a parasite ;) |
local delay, _ = 0, EasyDND |
local fake = CreateFrame("Frame", nil, UIParent) |
if event ~= "PLAYER_ENTERING_WORLD" then |
fake:SetScript("OnUpdate", function(self, elapsed) |
delay = delay + elapsed |
if UnitIsDND("player") or UnitIsAFK("player") then flag = true else flag = false end |
if delay > 0.000005 then -- Don't modify |
if event == "MAIL_SHOW" or event == "MAIL_CLOSED" then __hooked_Mail(nil, flag) |
elseif event == "BANKFRAME_OPENED" or event == "BANKFRAME_CLOSED" or event == "GUILDBANKFRAME_OPENED" or event == "GUILDBANKFRAME_CLOSED" then __hooked_Bank(nil, flag) |
if db.modebg or db.modeinst then Stub("PLAYER_ENTERING_WORLD") end |
end |
-- Like PlaySound, we should check our trade flag prior allowing this function to Hide the current BankFrame to ensure |
-- the trade isn't a blocked one and force the closure of our bank and/or guildbank. |
-- Like PlaySound, we should check our trade flag prior allowing this function to Hide the current |
-- BankFrame/GuildBankFrame to ensure the trade isn't a blocked one and will force the closure of our |
-- bank and/or guildbank frames. |
local function __hooked_Bank_OnEvent(self, event, ...) |
local delay, _, args, frame = 0, EasyDND, ..., nil |
if self then frame = self:GetName() or "none" end |
_:RegisterChatCommand("easydnd", ToggleConfig) |
_:RegisterChatCommand("ezdnd", ToggleConfig) |
InitGlobalFunctions() |
StoreOriginalFunctions() |
_.LDB.InitLDB() |
_.LDB.ICO:Register("EasyDND", _.LDB, _.db.profile) |
end |
local db = _.db.profile |
if not db.activated then ToggleActive() else |
InitGlobalVariables() |
StoreOriginalFunctions() |
SetEvents() |
SetChatFilters() |
SetUIParentHooks() |
if _.__orig_TradeFrame_OnEvent then TradeFrame:SetScript("OnEvent", _.__orig_TradeFrame_OnEvent) end |
if _.__orig_InitiateTrade then InitiateTrade = _.__orig_InitiateTrade end |
if _.__orig_PlaySound then PlaySound = _.__orig_PlaySound end |
if _.__orig_BankFrame_OnEvent then BankFrame_OnEvent = _.__orig_BankFrame_OnEvent end |
if _.__orig_HideUIPanel then HideUIPanel = _.__orig_HideUIPanel end |
if _.m then del("CHAT_MSG_SYSTEM", OnSysFilter) end |
if _.n then del("CHAT_MSG_SYSTEM", OnSysAntiFilter) end |
if _.o then del("CHAT_MSG_WHISPER_INFORM", OnWhispAntiFilter) end |