mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 22:26:22 +00:00
feat(Core/commands): Display reason for muting player (#2780)
This commit is contained in:
committed by
GitHub
parent
f4e1155302
commit
fd4b35be8c
@@ -1289,6 +1289,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
|
||||
m_bool_configs[CONFIG_NO_RESET_TALENT_COST] = sConfigMgr->GetBoolDefault("NoResetTalentsCost", false);
|
||||
m_bool_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowKickInWorld", false);
|
||||
m_bool_configs[CONFIG_SHOW_MUTE_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowMuteInWorld", false);
|
||||
m_bool_configs[CONFIG_SHOW_BAN_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowBanInWorld", false);
|
||||
m_int_configs[CONFIG_INTERVAL_LOG_UPDATE] = sConfigMgr->GetIntDefault("RecordUpdateTimeDiffInterval", 60000);
|
||||
m_int_configs[CONFIG_MIN_LOG_UPDATE] = sConfigMgr->GetIntDefault("MinRecordUpdateTimeDiff", 100);
|
||||
|
||||
@@ -135,6 +135,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_PVP_TOKEN_ENABLE,
|
||||
CONFIG_NO_RESET_TALENT_COST,
|
||||
CONFIG_SHOW_KICK_IN_WORLD,
|
||||
CONFIG_SHOW_MUTE_IN_WORLD,
|
||||
CONFIG_SHOW_BAN_IN_WORLD,
|
||||
CONFIG_CHATLOG_CHANNEL,
|
||||
CONFIG_CHATLOG_WHISPER,
|
||||
@@ -806,7 +807,7 @@ class World
|
||||
char const* GetDBVersion() const { return m_DBVersion.c_str(); }
|
||||
|
||||
void LoadAutobroadcasts();
|
||||
|
||||
|
||||
void UpdateAreaDependentAuras();
|
||||
|
||||
uint32 GetCleaningFlags() const { return m_CleaningFlags; }
|
||||
@@ -924,7 +925,7 @@ class World
|
||||
|
||||
std::string m_configFileList;
|
||||
};
|
||||
|
||||
|
||||
#define sWorld World::instance()
|
||||
#endif
|
||||
/// @}
|
||||
|
||||
@@ -2210,7 +2210,7 @@ public:
|
||||
return false;
|
||||
|
||||
char const* muteReason = strtok(nullptr, "\r");
|
||||
std::string muteReasonStr = "No reason";
|
||||
std::string muteReasonStr = handler->GetAcoreString(LANG_NO_REASON);
|
||||
if (muteReason != nullptr)
|
||||
muteReasonStr = muteReason;
|
||||
|
||||
@@ -2238,7 +2238,7 @@ public:
|
||||
if (handler->GetSession())
|
||||
muteBy = handler->GetSession()->GetPlayerName();
|
||||
else
|
||||
muteBy = "Console";
|
||||
muteBy = handler->GetAcoreString(LANG_CONSOLE);
|
||||
|
||||
if (target)
|
||||
{
|
||||
@@ -2246,6 +2246,11 @@ public:
|
||||
int64 muteTime = time(nullptr) + notSpeakTime * MINUTE;
|
||||
target->GetSession()->m_muteTime = muteTime;
|
||||
stmt->setInt64(0, muteTime);
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD))
|
||||
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy.c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
|
||||
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
|
||||
}
|
||||
else
|
||||
@@ -2255,25 +2260,29 @@ public:
|
||||
stmt->setInt64(0, muteTime);
|
||||
}
|
||||
|
||||
stmt->setString(1, muteReasonStr.c_str());
|
||||
stmt->setString(2, muteBy.c_str());
|
||||
stmt->setString(1, muteReasonStr);
|
||||
stmt->setString(2, muteBy);
|
||||
stmt->setUInt32(3, accountId);
|
||||
LoginDatabase.Execute(stmt);
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_MUTE);
|
||||
stmt->setUInt32(0, accountId);
|
||||
stmt->setUInt32(1, notSpeakTime);
|
||||
stmt->setString(2, muteBy.c_str());
|
||||
stmt->setString(3, muteReasonStr.c_str());
|
||||
stmt->setString(2, muteBy);
|
||||
stmt->setString(3, muteReasonStr);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
|
||||
// pussywizard: notify all online GMs
|
||||
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->second->GetSession()->GetSecurity())
|
||||
ChatHandler(itr->second->GetSession()).PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Console"), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD) && !target)
|
||||
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy.c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
else
|
||||
{
|
||||
// pussywizard: notify all online GMs
|
||||
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->second->GetSession()->GetSecurity())
|
||||
ChatHandler(itr->second->GetSession()).PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : handler->GetAcoreString(LANG_CONSOLE)), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ CleanCharacterDB = 0
|
||||
# Before use this feature, make a backup of your database.
|
||||
#
|
||||
# Example: 14 - (CLEANING_FLAG_SKILLS + CLEANING_FLAG_SPELLS + CLEANING_FLAG_TALENTS
|
||||
# 2+4+8 => 14. This will clean up skills, talents and spells will
|
||||
# 2+4+8 => 14. This will clean up skills, talents and spells will
|
||||
# remain enabled after the next cleanup)
|
||||
# Default: 0 - (All cleanup methods will be disabled after the next cleanup)
|
||||
|
||||
@@ -3206,6 +3206,15 @@ Guild.AllowMultipleGuildMaster = 0
|
||||
|
||||
ShowKickInWorld = 0
|
||||
|
||||
#
|
||||
# ShowMuteInWorld
|
||||
# Description: Determines whether a message is broadcast to the entire server when a
|
||||
# player gets muted.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ShowMuteInWorld = 0
|
||||
|
||||
#
|
||||
# ShowBanInWorld
|
||||
# Description: Determines whether a message is broadcast to the entire server when a
|
||||
@@ -3224,6 +3233,7 @@ ShowBanInWorld = 0
|
||||
# 0 - (Disabled)
|
||||
|
||||
RecordUpdateTimeDiffInterval = 60000
|
||||
|
||||
#
|
||||
# MinRecordUpdateTimeDiff
|
||||
# Description: Only record update time diff which is greater than this value.
|
||||
|
||||
Reference in New Issue
Block a user