function DBM.SendHiddenWhisper(msg, target) if not msg or not target then return; end if msg == "" or target == "" then return; end DBM.HiddenWhisperMessages[string.gsub(msg, "%%", "")] = DBM.HiddenWhisperMessages[string.gsub(msg, "%%", "")] or {["targets"] = {}}; DBM.HiddenWhisperMessages[string.gsub(msg, "%%", "")]["targets"][target] = 1; DBM.HideDNDAFKMessages[target] = 1; SendChatMessage(msg, "WHISPER", nil, target); end function DBM.InterceptWhisper(msg, player) if not DBM.InCombat or not DBM.HideWhispers or not DBM.Options.AutoRespond or string.sub(msg, 1, 18) == "" or string.sub(msg, 1, 20) == "" or string.sub(msg, 1, 4) == "GA\\t" then return "SHOW"; end if string.lower(msg) == "status" and DBM.Options.EnableStatusCommand then if (GetTime() - (DBM.StatusSpamProtection[player] or 0)) > 1 then DBM.StatusSpamProtection[player] = GetTime(); local message = DBM_RAID_STATUS_WHISPER; message = string.gsub(message, "%%P", UnitName("player")); message = string.gsub(message, "%%B", tostring((DBM.Bosses[GetRealZoneText()][DBM.InCombat].realName or DBM.Bosses[GetRealZoneText()][DBM.InCombat].name))); message = string.gsub(message, "%%HP", DBM.GetBossHP(DBM.Bosses[GetRealZoneText()][DBM.InCombat].name)); message = string.gsub(message, "%%ALIVE", DBM.GetNumRaidMembersAlive()); message = string.gsub(message, "%%RAID", tostring(GetNumRaidMembers())); DBM.SendHiddenWhisper(" "..message, player); end return "FORCE_HIDE"; end if not DBM.Raid[player] then if DBM.WhisperSpamProtection[player] and (GetTime() - DBM.WhisperSpamProtection[player]) < 60 then DBM.WhisperSpamProtection[player] = GetTime(); if not DBM.WhispersDuringCombat[table.getn(DBM.WhispersDuringCombat)] or not (DBM.WhispersDuringCombat[table.getn(DBM.WhispersDuringCombat)].name == player and DBM.WhispersDuringCombat[table.getn(DBM.WhispersDuringCombat)].msg == msg and (time() - DBM.WhispersDuringCombat[table.getn(DBM.WhispersDuringCombat)].time) <= 2) then table.insert(DBM.WhispersDuringCombat, {["name"] = player, ["msg"] = msg, ["time"] = time(), ["hidden"] = not DBM.Options.ShowWhispersDuringCombat}) end return "HIDE"; end if DBM.Bosses[GetRealZoneText()] and DBM.Bosses[GetRealZoneText()][DBM.InCombat] then DBM.WhisperSpamProtection[player] = GetTime(); local message = DBM.Options.BusyMessage; message = string.gsub(message, "%%P", UnitName("player")); message = string.gsub(message, "%%B", tostring((DBM.Bosses[GetRealZoneText()][DBM.InCombat].realName or DBM.Bosses[GetRealZoneText()][DBM.InCombat].name))); message = string.gsub(message, "%%HP", DBM.GetBossHP(DBM.Bosses[GetRealZoneText()][DBM.InCombat].name)); message = string.gsub(message, "%%ALIVE", DBM.GetNumRaidMembersAlive()); message = string.gsub(message, "%%RAID", tostring(GetNumRaidMembers())); if DBM.Options.EnableStatusCommand then message = message; end if DBM.Options.HideOutgoingInfoWhisper then DBM.SendHiddenWhisper(" "..message, player); else SendChatMessage(" "..message, "WHISPER", nil, player); end table.insert(DBM.WhispersDuringCombat, {["name"] = player, ["msg"] = msg, ["time"] = time(), ["hidden"] = not DBM.Options.ShowWhispersDuringCombat}) return "AUTO_RESPONDED"; else return "SHOW"; end else return "SHOW"; end end function DBM.EndHideWhispers(bossName) if not DBM.HideWhispers then return; end local playersToInform = {}; local infoString = ""; local missedWhispersInfoShown = false; if table.getn(DBM.WhispersDuringCombat) >= 1 then end for index, value in pairs(DBM.WhispersDuringCombat) do if value.name and not playersToInform[value.name] then playersToInform[value.name] = true; end if value.hidden then if not missedWhispersInfoShown then DBM.AddMsg(DBM_MISSED_WHISPERS); missedWhispersInfoShown = true; end DBM.AddMsg(string.format(DBM_SHOW_MISSED_WHISPER, value.name, value.msg), date("%H:%M:%S", value.time)); end end if DBM.InCombat and not bossName and DBM.Options.ShowCombatInformations and DBM.SecondsToTime(GetTime() - DBM.CombatStartTime) and DBM.SecondsToTime(GetTime() - DBM.CombatStartTime) ~= "" then DBM.AddMsg(string.format(DBM_COMBAT_ENDED, DBM.SecondsToTime((GetTime() - DBM.CombatStartTime), true))); end if bossName then infoString = string.format(DBM_BOSS_DOWN, bossName, DBM.SecondsToTime((GetTime() - DBM.CombatStartTime), true)) else infoString = string.format(DBM_COMBAT_ENDED, DBM.SecondsToTime((GetTime() - DBM.CombatStartTime), true)); end for index, value in pairs(playersToInform) do DBM.SendHiddenWhisper(" "..infoString, index); end DBM.WhispersDuringCombat = {}; DBM.HideWhispers = false; end