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_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_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_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_INTERVAL_LOG_UPDATE] = sConfigMgr->GetIntDefault("RecordUpdateTimeDiffInterval", 60000);
|
||||||
m_int_configs[CONFIG_MIN_LOG_UPDATE] = sConfigMgr->GetIntDefault("MinRecordUpdateTimeDiff", 100);
|
m_int_configs[CONFIG_MIN_LOG_UPDATE] = sConfigMgr->GetIntDefault("MinRecordUpdateTimeDiff", 100);
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ enum WorldBoolConfigs
|
|||||||
CONFIG_PVP_TOKEN_ENABLE,
|
CONFIG_PVP_TOKEN_ENABLE,
|
||||||
CONFIG_NO_RESET_TALENT_COST,
|
CONFIG_NO_RESET_TALENT_COST,
|
||||||
CONFIG_SHOW_KICK_IN_WORLD,
|
CONFIG_SHOW_KICK_IN_WORLD,
|
||||||
|
CONFIG_SHOW_MUTE_IN_WORLD,
|
||||||
CONFIG_SHOW_BAN_IN_WORLD,
|
CONFIG_SHOW_BAN_IN_WORLD,
|
||||||
CONFIG_CHATLOG_CHANNEL,
|
CONFIG_CHATLOG_CHANNEL,
|
||||||
CONFIG_CHATLOG_WHISPER,
|
CONFIG_CHATLOG_WHISPER,
|
||||||
|
|||||||
@@ -2210,7 +2210,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
char const* muteReason = strtok(nullptr, "\r");
|
char const* muteReason = strtok(nullptr, "\r");
|
||||||
std::string muteReasonStr = "No reason";
|
std::string muteReasonStr = handler->GetAcoreString(LANG_NO_REASON);
|
||||||
if (muteReason != nullptr)
|
if (muteReason != nullptr)
|
||||||
muteReasonStr = muteReason;
|
muteReasonStr = muteReason;
|
||||||
|
|
||||||
@@ -2238,7 +2238,7 @@ public:
|
|||||||
if (handler->GetSession())
|
if (handler->GetSession())
|
||||||
muteBy = handler->GetSession()->GetPlayerName();
|
muteBy = handler->GetSession()->GetPlayerName();
|
||||||
else
|
else
|
||||||
muteBy = "Console";
|
muteBy = handler->GetAcoreString(LANG_CONSOLE);
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
@@ -2246,6 +2246,11 @@ public:
|
|||||||
int64 muteTime = time(nullptr) + notSpeakTime * MINUTE;
|
int64 muteTime = time(nullptr) + notSpeakTime * MINUTE;
|
||||||
target->GetSession()->m_muteTime = muteTime;
|
target->GetSession()->m_muteTime = muteTime;
|
||||||
stmt->setInt64(0, 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());
|
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2255,25 +2260,29 @@ public:
|
|||||||
stmt->setInt64(0, muteTime);
|
stmt->setInt64(0, muteTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt->setString(1, muteReasonStr.c_str());
|
stmt->setString(1, muteReasonStr);
|
||||||
stmt->setString(2, muteBy.c_str());
|
stmt->setString(2, muteBy);
|
||||||
stmt->setUInt32(3, accountId);
|
stmt->setUInt32(3, accountId);
|
||||||
LoginDatabase.Execute(stmt);
|
LoginDatabase.Execute(stmt);
|
||||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_MUTE);
|
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_MUTE);
|
||||||
stmt->setUInt32(0, accountId);
|
stmt->setUInt32(0, accountId);
|
||||||
stmt->setUInt32(1, notSpeakTime);
|
stmt->setUInt32(1, notSpeakTime);
|
||||||
stmt->setString(2, muteBy.c_str());
|
stmt->setString(2, muteBy);
|
||||||
stmt->setString(3, muteReasonStr.c_str());
|
stmt->setString(3, muteReasonStr);
|
||||||
LoginDatabase.Execute(stmt);
|
LoginDatabase.Execute(stmt);
|
||||||
|
|
||||||
std::string nameLink = handler->playerLink(targetName);
|
std::string nameLink = handler->playerLink(targetName);
|
||||||
|
|
||||||
// pussywizard: notify all online GMs
|
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD) && !target)
|
||||||
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy.c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||||
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
|
else
|
||||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
{
|
||||||
if (itr->second->GetSession()->GetSecurity())
|
// pussywizard: notify all online GMs
|
||||||
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());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3206,6 +3206,15 @@ Guild.AllowMultipleGuildMaster = 0
|
|||||||
|
|
||||||
ShowKickInWorld = 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
|
# ShowBanInWorld
|
||||||
# Description: Determines whether a message is broadcast to the entire server when a
|
# Description: Determines whether a message is broadcast to the entire server when a
|
||||||
@@ -3224,6 +3233,7 @@ ShowBanInWorld = 0
|
|||||||
# 0 - (Disabled)
|
# 0 - (Disabled)
|
||||||
|
|
||||||
RecordUpdateTimeDiffInterval = 60000
|
RecordUpdateTimeDiffInterval = 60000
|
||||||
|
|
||||||
#
|
#
|
||||||
# MinRecordUpdateTimeDiff
|
# MinRecordUpdateTimeDiff
|
||||||
# Description: Only record update time diff which is greater than this value.
|
# Description: Only record update time diff which is greater than this value.
|
||||||
|
|||||||
Reference in New Issue
Block a user