/trunk
if IsControlKeyDown() then |
Anti_AddException() |
else |
if UnitIsDND("player") or (_.db.profile.modednd and not UnitIsAFK("player")) then |
SendChatMessage("", "DND") |
else |
SendChatMessage("", "AFK") |
end |
_.AutoSwitch(nil, true) |
end |
else |
ToggleDewdrop(self) |
set = function() |
_.db.profile.toggleNafk = not _.db.profile.toggleNafk |
_.SetEvents() |
_.SetAutoToggleNames() |
end, |
order = 36, |
}, |
set = function() |
_.db.profile.toggleNdnd = not _.db.profile.toggleNdnd |
_.SetEvents() |
_.SetAutoToggleNames() |
end, |
order = 37, |
}, |
local function RemoveGuildInviteSoundFix() |
-- workaround a guild invite sound client behaviour, this sound is not triggered by an available API |
-- so we cannot catch it, this workaround shutdown SFX for just 50 ms so you won't notice something ingame |
-- so we cannot catch it, this workaround shutdown SFX for just 10 ms so you won't notice something ingame |
-- if by chance you find a better method to catch that sound contact me. |
local delay, fake = 0, CreateFrame("Frame", nil, UIParent) |
fake:SetScript("OnUpdate", function(self, elapsed) |
delay = delay + elapsed |
if delay > 0.05 then |
if delay > 0.01 then |
SetCVar("Sound_EnableSFX", 1) |
fake:SetScript("OnUpdate",nil) |
fake = nil |
local _ = EasyDND |
if type(name) == "string" and name ~= UnitName("player") and not IsFriend(name) and not IsGuild(name) and not HasException(L["Guild"], name) then |
-- workaround a guild invite sound client behaviour, this sound is not triggered by an available API |
-- so we cannot catch it, this workaround shutdown SFX for just 50 ms so you won't notice something ingame |
-- so we cannot catch it, this workaround shutdown SFX for just 10 ms so you won't notice something ingame |
-- if by chance you find a better method to catch that sound contact me. |
SetVar(L["Guild"], name) |
_.LDB.UpdateLDB() |
return false |
end |
local function AutoSwitch(msg) |
local function AutoSwitch(msg, broker) |
-- with a few safe checks to make sure we never use afk in BG/Arenas |
local _, send = EasyDND, SendChatMessage |
local db = _.db.profile |
elseif IsIn() ~= "BG" then |
if not UnitIsAFK("player") then send(db.sig..msg, "AFK") end |
end |
elseif broker then |
-- Here aswell this is very important to never use /AFK in BG/Arenas sorry for omitting this for a long time heh ;p |
if UnitIsDND("player") or (db.modednd and not UnitIsAFK("player")) or IsIn() == "BG" then |
send("", "DND") |
else |
if IsIn() ~= "BG" then send("", "AFK") end |
end |
else |
if db.v or db.w or db.u or db.t then |
if UnitIsDND("player") then send("", "DND") end |
end |
end |
end |
-- secured to not go AFK in jcj area |
local function __hooked_BG() |
local _ = EasyDND |
end |
end) |
else |
if UnitIsDND("player") or UnitIsAFK("player") then flag = true else flag = false end |
__hooked_Instance() |
__hooked_BG() |
end |
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 |
-- 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, ...) |
--if you want to use this option just think to not display your name before you are going afk/dnd. |
local _ = EasyDND |
local db = _.db.profile |
if db.activated then |
if db.toggleNafk or db.toggleNdnd then |
local flag = _.LDB.CheckLDBFlag() |
local orig = GetCVar("UnitNameOwn") |
if ( strfind(flag, "["..L["DND"].."]", 1, true) and db.toggleNdnd ) or ( strfind(flag, "["..L["AFK"].."]", 1, true) and db.toggleNafk ) then |
if db.save or ( orig == "0" and not db.save ) then |
db.save = true |
SetCVar("UnitNameOwn", 1) |
end |
elseif db.save then |
SetCVar("UnitNameOwn", 0) |
db.save = false |
if db.activated and ( db.toggleNafk or db.toggleNdnd ) then |
local flag = _.LDB.CheckLDBFlag() |
local orig = GetCVar("UnitNameOwn") |
if ( strfind(flag, "["..L["DND"].."]", 1, true) and db.toggleNdnd ) or ( strfind(flag, "["..L["AFK"].."]", 1, true) and db.toggleNafk ) then |
if db.save or ( orig == "0" and not db.save ) then |
db.save = true |
SetCVar("UnitNameOwn", 1) |
end |
elseif db.save then |
SetCVar("UnitNameOwn", 0) |
db.save = false |
end |
elseif db.save then |
SetCVar("UnitNameOwn", 0) |
del(a, "DUEL_REQUESTED", __hooked_StaticPopup_Show_Duel_Request) |
_.f = false |
end |
if not _.db.profile.anti_blockparty and not _.db.profile.anti_blockguildinvite and not _.db.profile.anti_blockduel then |
if not ( _.db.profile.anti_blockparty and _.db.profile.anti_blockguildinvite and _.db.profile.anti_blockduel ) then |
if _.__orig_PlaySound then PlaySound = _.__orig_PlaySound end |
end |
end |
_.ToggleActive = ToggleActive |
_.SetAutoToggleNames = SetAutoToggleNames |
_.Stub = Stub |
_.AutoSwitch = AutoSwitch |
end |
function EasyDND:OnInitialize() |