feat(Core/Scripts): Add ChatLog.Enable config to chat_log.cpp (#25795)
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -621,6 +621,15 @@ Allow.IP.Based.Action.Logging = 0
|
|||||||
|
|
||||||
LogSpamReports = 1
|
LogSpamReports = 1
|
||||||
|
|
||||||
|
#
|
||||||
|
# ChatLog.Enable
|
||||||
|
# Description: Enable or disable chat logging (chat_log.cpp).
|
||||||
|
# Default: 0 - (Disabled)
|
||||||
|
# 1 - (Enabled)
|
||||||
|
#
|
||||||
|
|
||||||
|
ChatLog.Enable = 0
|
||||||
|
|
||||||
#
|
#
|
||||||
# Appender config values: Given an appender "name"
|
# Appender config values: Given an appender "name"
|
||||||
# Appender.name
|
# Appender.name
|
||||||
|
|||||||
@@ -604,6 +604,8 @@ void WorldConfig::BuildConfigCache()
|
|||||||
|
|
||||||
SetConfigValue<bool>(CONFIG_LOGSPAMREPORTS, "LogSpamReports", true);
|
SetConfigValue<bool>(CONFIG_LOGSPAMREPORTS, "LogSpamReports", true);
|
||||||
|
|
||||||
|
SetConfigValue<bool>(CONFIG_CHATLOG_ENABLED, "ChatLog.Enable", false);
|
||||||
|
|
||||||
// Whether to use LoS from game objects
|
// Whether to use LoS from game objects
|
||||||
SetConfigValue<bool>(CONFIG_CHECK_GOBJECT_LOS, "CheckGameObjectLoS", true);
|
SetConfigValue<bool>(CONFIG_CHECK_GOBJECT_LOS, "CheckGameObjectLoS", true);
|
||||||
|
|
||||||
|
|||||||
@@ -492,6 +492,7 @@ enum ServerConfigs
|
|||||||
CONFIG_NEW_CHAR_STRING,
|
CONFIG_NEW_CHAR_STRING,
|
||||||
CONFIG_VALIDATE_SKILL_LEARNED_BY_SPELLS,
|
CONFIG_VALIDATE_SKILL_LEARNED_BY_SPELLS,
|
||||||
CONFIG_ACHIEVEMENT_REALM_FIRST_KILL_WINDOW,
|
CONFIG_ACHIEVEMENT_REALM_FIRST_KILL_WINDOW,
|
||||||
|
CONFIG_CHATLOG_ENABLED,
|
||||||
|
|
||||||
MAX_NUM_SERVER_CONFIGS
|
MAX_NUM_SERVER_CONFIGS
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "Guild.h"
|
#include "Guild.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "PlayerScript.h"
|
#include "PlayerScript.h"
|
||||||
|
#include "World.h"
|
||||||
|
|
||||||
class ChatLogScript : public PlayerScript
|
class ChatLogScript : public PlayerScript
|
||||||
{
|
{
|
||||||
@@ -38,6 +39,9 @@ public:
|
|||||||
|
|
||||||
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg) override
|
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg) override
|
||||||
{
|
{
|
||||||
|
if (!sWorld->getBoolConfig(CONFIG_CHATLOG_ENABLED))
|
||||||
|
return true;
|
||||||
|
|
||||||
std::string logType = "";
|
std::string logType = "";
|
||||||
std::string chatType = "";
|
std::string chatType = "";
|
||||||
|
|
||||||
@@ -67,6 +71,9 @@ public:
|
|||||||
|
|
||||||
bool OnPlayerCanUseChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver) override
|
bool OnPlayerCanUseChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver) override
|
||||||
{
|
{
|
||||||
|
if (!sWorld->getBoolConfig(CONFIG_CHATLOG_ENABLED))
|
||||||
|
return true;
|
||||||
|
|
||||||
//! NOTE:
|
//! NOTE:
|
||||||
//! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
|
//! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
|
||||||
std::string logType = (lang != LANG_ADDON) ? "chat." : "chat.addon.";
|
std::string logType = (lang != LANG_ADDON) ? "chat." : "chat.addon.";
|
||||||
@@ -80,6 +87,9 @@ public:
|
|||||||
|
|
||||||
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override
|
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override
|
||||||
{
|
{
|
||||||
|
if (!sWorld->getBoolConfig(CONFIG_CHATLOG_ENABLED))
|
||||||
|
return true;
|
||||||
|
|
||||||
//! NOTE:
|
//! NOTE:
|
||||||
//! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
|
//! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
|
||||||
std::string logType = (lang != LANG_ADDON) ? "chat." : "chat.addon.";
|
std::string logType = (lang != LANG_ADDON) ? "chat." : "chat.addon.";
|
||||||
@@ -116,6 +126,9 @@ public:
|
|||||||
|
|
||||||
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild) override
|
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild) override
|
||||||
{
|
{
|
||||||
|
if (!sWorld->getBoolConfig(CONFIG_CHATLOG_ENABLED))
|
||||||
|
return true;
|
||||||
|
|
||||||
//! NOTE:
|
//! NOTE:
|
||||||
//! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
|
//! LANG_ADDON can only be sent by client in "PARTY", "RAID", "GUILD", "BATTLEGROUND", "WHISPER"
|
||||||
std::string logType = (lang != LANG_ADDON) ? "chat." : "chat.addon.";
|
std::string logType = (lang != LANG_ADDON) ? "chat." : "chat.addon.";
|
||||||
@@ -141,6 +154,9 @@ public:
|
|||||||
|
|
||||||
bool OnPlayerCanUseChat(Player* player, uint32 /*type*/, uint32 /*lang*/, std::string& msg, Channel* channel) override
|
bool OnPlayerCanUseChat(Player* player, uint32 /*type*/, uint32 /*lang*/, std::string& msg, Channel* channel) override
|
||||||
{
|
{
|
||||||
|
if (!sWorld->getBoolConfig(CONFIG_CHATLOG_ENABLED))
|
||||||
|
return true;
|
||||||
|
|
||||||
bool isSystem = channel &&
|
bool isSystem = channel &&
|
||||||
(channel->HasFlag(CHANNEL_FLAG_TRADE) ||
|
(channel->HasFlag(CHANNEL_FLAG_TRADE) ||
|
||||||
channel->HasFlag(CHANNEL_FLAG_GENERAL) ||
|
channel->HasFlag(CHANNEL_FLAG_GENERAL) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user