Core/ChatLog: handle chatlog options with extended logging system
This commit is contained in:
1 parent
37e6a3e1d2
commit
8b8aaa06fc
4 files changed
+110
-213
No files matched your search
@@ -1177,17 +1177,6 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_int_configs[CONFIG_NUMTHREADS] = sConfigMgr->GetIntDefault("MapUpdate.Threads", 1);
|
||||
m_int_configs[CONFIG_MAX_RESULTS_LOOKUP_COMMANDS] = sConfigMgr->GetIntDefault("Command.LookupMaxResults", 0);
|
||||
|
||||
// chat logging
|
||||
m_bool_configs[CONFIG_CHATLOG_CHANNEL] = sConfigMgr->GetBoolDefault("ChatLogs.Channel", false);
|
||||
m_bool_configs[CONFIG_CHATLOG_WHISPER] = sConfigMgr->GetBoolDefault("ChatLogs.Whisper", false);
|
||||
m_bool_configs[CONFIG_CHATLOG_SYSCHAN] = sConfigMgr->GetBoolDefault("ChatLogs.SysChan", false);
|
||||
m_bool_configs[CONFIG_CHATLOG_PARTY] = sConfigMgr->GetBoolDefault("ChatLogs.Party", false);
|
||||
m_bool_configs[CONFIG_CHATLOG_RAID] = sConfigMgr->GetBoolDefault("ChatLogs.Raid", false);
|
||||
m_bool_configs[CONFIG_CHATLOG_GUILD] = sConfigMgr->GetBoolDefault("ChatLogs.Guild", false);
|
||||
m_bool_configs[CONFIG_CHATLOG_PUBLIC] = sConfigMgr->GetBoolDefault("ChatLogs.Public", false);
|
||||
m_bool_configs[CONFIG_CHATLOG_ADDON] = sConfigMgr->GetBoolDefault("ChatLogs.Addon", false);
|
||||
m_bool_configs[CONFIG_CHATLOG_BGROUND] = sConfigMgr->GetBoolDefault("ChatLogs.Battleground", false);
|
||||
|
||||
// Warden
|
||||
m_bool_configs[CONFIG_WARDEN_ENABLED] = sConfigMgr->GetBoolDefault("Warden.Enabled", false);
|
||||
m_int_configs[CONFIG_WARDEN_NUM_MEM_CHECKS] = sConfigMgr->GetIntDefault("Warden.NumMemChecks", 3);
|
||||
|
||||
@@ -139,15 +139,6 @@ enum WorldBoolConfigs
|
||||
CONFIG_SHOW_KICK_IN_WORLD,
|
||||
CONFIG_SHOW_MUTE_IN_WORLD,
|
||||
CONFIG_SHOW_BAN_IN_WORLD,
|
||||
CONFIG_CHATLOG_CHANNEL,
|
||||
CONFIG_CHATLOG_WHISPER,
|
||||
CONFIG_CHATLOG_SYSCHAN,
|
||||
CONFIG_CHATLOG_PARTY,
|
||||
CONFIG_CHATLOG_RAID,
|
||||
CONFIG_CHATLOG_GUILD,
|
||||
CONFIG_CHATLOG_PUBLIC,
|
||||
CONFIG_CHATLOG_ADDON,
|
||||
CONFIG_CHATLOG_BGROUND,
|
||||
CONFIG_AUTOBROADCAST,
|
||||
CONFIG_ALLOW_TICKETS,
|
||||
CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES,
|
||||
|
||||
@@ -22,144 +22,133 @@
|
||||
|
||||
class ChatLogScript : public PlayerScript
|
||||
{
|
||||
public:
|
||||
ChatLogScript() : PlayerScript("ChatLogScript") { }
|
||||
public:
|
||||
ChatLogScript() : PlayerScript("ChatLogScript") { }
|
||||
|
||||
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg)
|
||||
{
|
||||
switch (type)
|
||||
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg) OVERRIDE
|
||||
{
|
||||
case CHAT_MSG_ADDON:
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
|
||||
TC_LOG_DEBUG("chat.log", "[ADDON] Player %s sends: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_SAY:
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC))
|
||||
TC_LOG_DEBUG("chat.log", "[SAY] Player %s says (language %u): %s",
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_SAY:
|
||||
TC_LOG_DEBUG("chat.log.say", "Player %s says (language %u): %s",
|
||||
player->GetName().c_str(), lang, msg.c_str());
|
||||
break;
|
||||
break;
|
||||
|
||||
case CHAT_MSG_EMOTE:
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC))
|
||||
TC_LOG_DEBUG("chat.log", "[TEXTEMOTE] Player %s emotes: %s",
|
||||
case CHAT_MSG_EMOTE:
|
||||
TC_LOG_DEBUG("chat.log.emote", "Player %s emotes: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
break;
|
||||
break;
|
||||
|
||||
case CHAT_MSG_YELL:
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC))
|
||||
TC_LOG_DEBUG("chat.log", "[YELL] Player %s yells (language %u): %s",
|
||||
case CHAT_MSG_YELL:
|
||||
TC_LOG_DEBUG("chat.log.yell", "Player %s yells (language %u): %s",
|
||||
player->GetName().c_str(), lang, msg.c_str());
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver)
|
||||
{
|
||||
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_WHISPER))
|
||||
TC_LOG_DEBUG("chat.log", "[WHISPER] Player %s tells %s: %s",
|
||||
player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
|
||||
TC_LOG_DEBUG("chat.log", "[ADDON] Player %s tells %s: %s",
|
||||
player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
}
|
||||
|
||||
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group)
|
||||
{
|
||||
//! NOTE:
|
||||
//! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
|
||||
switch (type)
|
||||
void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver) OVERRIDE
|
||||
{
|
||||
case CHAT_MSG_PARTY:
|
||||
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY))
|
||||
TC_LOG_DEBUG("chat.log", "[PARTY] Player %s tells group with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
|
||||
TC_LOG_DEBUG("chat.log", "[ADDON] Player %s tells group with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_PARTY_LEADER:
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY))
|
||||
TC_LOG_DEBUG("chat.log", "[PARTY] Leader %s tells group: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID:
|
||||
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_RAID))
|
||||
TC_LOG_DEBUG("chat.log", "[RAID] Player %s tells raid with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
|
||||
TC_LOG_DEBUG("chat.log", "[ADDON] Player %s tells raid with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID_LEADER:
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID))
|
||||
TC_LOG_DEBUG("chat.log", "[RAID] Leader player %s tells raid: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID_WARNING:
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID))
|
||||
TC_LOG_DEBUG("chat.log", "[RAID] Leader player %s warns raid with: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_BATTLEGROUND:
|
||||
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND))
|
||||
TC_LOG_DEBUG("chat.log", "[BATTLEGROUND] Player %s tells battleground with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
|
||||
TC_LOG_DEBUG("chat.log", "[ADDON] Player %s tells battleground with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_BATTLEGROUND_LEADER:
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND))
|
||||
TC_LOG_DEBUG("chat.log", "[BATTLEGROUND] Leader player %s tells battleground: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
break;
|
||||
if (lang != LANG_ADDON)
|
||||
TC_LOG_DEBUG("chat.log.whisper", "Player %s tells %s: %s",
|
||||
player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
else
|
||||
TC_LOG_DEBUG("chat.log.addon.whisper", "Player %s tells %s: %s",
|
||||
player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild)
|
||||
{
|
||||
switch (type)
|
||||
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) OVERRIDE
|
||||
{
|
||||
case CHAT_MSG_GUILD:
|
||||
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD))
|
||||
TC_LOG_DEBUG("chat.log", "[GUILD] Player %s tells guild %s: %s",
|
||||
player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
|
||||
TC_LOG_DEBUG("chat.log", "[ADDON] Player %s sends to guild %s: %s",
|
||||
player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
break;
|
||||
//! NOTE:
|
||||
//! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_PARTY:
|
||||
if (lang != LANG_ADDON)
|
||||
TC_LOG_DEBUG("chat.log.party", "Player %s tells group with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
else
|
||||
TC_LOG_DEBUG("chat.log.addon.party", "Player %s tells group with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_OFFICER:
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD))
|
||||
TC_LOG_DEBUG("chat.log", "[OFFICER] Player %s tells guild %s officers: %s",
|
||||
player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
break;
|
||||
case CHAT_MSG_PARTY_LEADER:
|
||||
TC_LOG_DEBUG("chat.log.party", "Leader %s tells group: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID:
|
||||
if (lang != LANG_ADDON)
|
||||
TC_LOG_DEBUG("chat.log.raid", "Player %s tells raid with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
else
|
||||
TC_LOG_DEBUG("chat.log.addon.raid", "Player %s tells raid with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID_LEADER:
|
||||
TC_LOG_DEBUG("chat.log.raid", "Leader player %s tells raid: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID_WARNING:
|
||||
TC_LOG_DEBUG("chat.log.raid", "Leader player %s warns raid with: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_BATTLEGROUND:
|
||||
if (lang != LANG_ADDON)
|
||||
TC_LOG_DEBUG("chat.log.bg", "Player %s tells battleground with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
else
|
||||
TC_LOG_DEBUG("chat.log.addon.bg", "Player %s tells battleground with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
break;
|
||||
|
||||
case CHAT_MSG_BATTLEGROUND_LEADER:
|
||||
TC_LOG_DEBUG("chat.log.bg", "Leader player %s tells battleground: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnChat(Player* player, uint32 /*type*/, uint32 /*lang*/, std::string& msg, Channel* channel)
|
||||
{
|
||||
bool isSystem = channel &&
|
||||
(channel->HasFlag(CHANNEL_FLAG_TRADE) ||
|
||||
channel->HasFlag(CHANNEL_FLAG_GENERAL) ||
|
||||
channel->HasFlag(CHANNEL_FLAG_CITY) ||
|
||||
channel->HasFlag(CHANNEL_FLAG_LFG));
|
||||
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild) OVERRIDE
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_GUILD:
|
||||
if (lang != LANG_ADDON)
|
||||
TC_LOG_DEBUG("chat.log.guild", "Player %s tells guild %s: %s",
|
||||
player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
else
|
||||
TC_LOG_DEBUG("chat.log.addon.guild", "Player %s sends to guild %s: %s",
|
||||
player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
break;
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_SYSCHAN) && isSystem)
|
||||
TC_LOG_DEBUG("chat.log", "[SYSCHAN] Player %s tells channel %s: %s",
|
||||
player->GetName().c_str(), channel->GetName().c_str(), msg.c_str());
|
||||
else if (sWorld->getBoolConfig(CONFIG_CHATLOG_CHANNEL))
|
||||
TC_LOG_DEBUG("chat.log", "[CHANNEL] Player %s tells channel %s: %s",
|
||||
player->GetName().c_str(), channel ? channel->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
}
|
||||
case CHAT_MSG_OFFICER:
|
||||
TC_LOG_DEBUG("chat.log.guild.officer", "Player %s tells guild %s officers: %s",
|
||||
player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnChat(Player* player, uint32 /*type*/, uint32 /*lang*/, std::string& msg, Channel* channel) OVERRIDE
|
||||
{
|
||||
bool isSystem = channel &&
|
||||
(channel->HasFlag(CHANNEL_FLAG_TRADE) ||
|
||||
channel->HasFlag(CHANNEL_FLAG_GENERAL) ||
|
||||
channel->HasFlag(CHANNEL_FLAG_CITY) ||
|
||||
channel->HasFlag(CHANNEL_FLAG_LFG));
|
||||
|
||||
if (isSystem)
|
||||
TC_LOG_DEBUG("chat.log.system", "Player %s tells channel %s: %s",
|
||||
player->GetName().c_str(), channel->GetName().c_str(), msg.c_str());
|
||||
else
|
||||
{
|
||||
std::string channelName = channel ? channel->GetName() : "<unknown>";
|
||||
TC_LOG_DEBUG("chat.log.channel." + channelName, "Player %s tells channel %s: %s",
|
||||
player->GetName().c_str(), channelName.c_str(), msg.c_str());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_chat_log()
|
||||
|
||||
@@ -410,78 +410,6 @@ PidFile = ""
|
||||
|
||||
PacketLogFile = ""
|
||||
|
||||
#
|
||||
# ChatLogs.Channel
|
||||
# Description: Log custom channel chat.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ChatLogs.Channel = 0
|
||||
|
||||
#
|
||||
# ChatLogs.Whisper
|
||||
# Description: Log whispers between players.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ChatLogs.Whisper = 0
|
||||
|
||||
#
|
||||
# ChatLogs.SysChan
|
||||
# Description: Log system channel messages.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ChatLogs.SysChan = 0
|
||||
|
||||
#
|
||||
# ChatLogs.Party
|
||||
# Description: Log party chat.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ChatLogs.Party = 0
|
||||
|
||||
#
|
||||
# ChatLogs.Raid
|
||||
# Description: Log raid chat.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ChatLogs.Raid = 0
|
||||
|
||||
#
|
||||
# ChatLogs.Guild
|
||||
# Description: Log guild chat.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ChatLogs.Guild = 0
|
||||
|
||||
#
|
||||
# ChatLogs.Public
|
||||
# Description: Log public chat (say/yell/emote).
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ChatLogs.Public = 0
|
||||
|
||||
#
|
||||
# ChatLogs.Addon
|
||||
# Description: Log addon messages.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ChatLogs.Addon = 0
|
||||
|
||||
#
|
||||
# ChatLogs.BattleGround
|
||||
# Description: Log battleground chat.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ChatLogs.BattleGround = 0
|
||||
|
||||
# Extended Logging system configuration moved to end of file (on purpose)
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
Reference in new issue
Block a user