This commit is contained in:
Discover-
2014-01-17 18:44:01 +01:00
9 changed files with 103 additions and 30 deletions

View File

@@ -0,0 +1,8 @@
DELETE FROM trinity_string where entry in (11002, 11003, 11004, 11005, 11006, 11007);
INSERT INTO `trinity_string` VALUES
('11002', 'Server: %s has kicked %s, reason: %s', '', '', '', '', '', '', '', ''),
('11003', 'Server: %s has muted %s for %u minutes, reason: %s', '', '', '', '', '', '', '', ''),
('11004', 'Server: %s has banned character %s for %s, reason: %s', '', '', '', '', '', '', '', ''),
('11005', 'Server: %s has banned character %s permanetly, reason: %s', '', '', '', '', '', '', '', ''),
('11006', 'Server: %s has banned %s for %s, reason: %s', '', '', '', '', '', '', '', ''),
('11007', 'Server: %s has banned %s permanetly, reason: %s', '', '', '', '', '', '', '', '');

View File

@@ -701,7 +701,7 @@ bool Guild::Member::CheckStats() const
return true;
}
void Guild::Member::WritePacket(WorldPacket& data) const
void Guild::Member::WritePacket(WorldPacket& data, bool sendOfficerNote) const
{
data << uint64(m_guid)
<< uint8(m_flags)
@@ -715,8 +715,12 @@ void Guild::Member::WritePacket(WorldPacket& data) const
if (!m_flags)
data << float(float(::time(NULL) - m_logoutTime) / DAY);
data << m_publicNote
<< m_officerNote;
data << m_publicNote;
if (sendOfficerNote)
data << m_officerNote;
else
data << "";
}
// Decreases amount of money/slots left for today.
@@ -1299,7 +1303,7 @@ bool Guild::SetName(std::string const& name)
return true;
}
void Guild::HandleRoster(WorldSession* session /*= NULL*/)
void Guild::HandleRoster(WorldSession* session)
{
// Guess size
WorldPacket data(SMSG_GUILD_ROSTER, (4 + m_motd.length() + 1 + m_info.length() + 1 + 4 + _GetRanksSize() * (4 + 4 + GUILD_BANK_MAX_TABS * (4 + 4)) + m_members.size() * 50));
@@ -1312,18 +1316,10 @@ void Guild::HandleRoster(WorldSession* session /*= NULL*/)
ritr->WritePacket(data);
for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
itr->second->WritePacket(data);
itr->second->WritePacket(data, _HasRankRight(session->GetPlayer(), GR_RIGHT_VIEWOFFNOTE));
if (session)
{
TC_LOG_DEBUG("guild", "SMSG_GUILD_ROSTER [%s]", session->GetPlayerInfo().c_str());
session->SendPacket(&data);
}
else
{
TC_LOG_DEBUG("guild", "SMSG_GUILD_ROSTER [Broadcast]");
BroadcastPacket(&data);
}
TC_LOG_DEBUG("guild", "SMSG_GUILD_ROSTER [%s]", session->GetPlayerInfo().c_str());
session->SendPacket(&data);
}
void Guild::HandleQuery(WorldSession* session)

View File

@@ -315,7 +315,7 @@ private:
bool LoadFromDB(Field* fields);
void SaveToDB(SQLTransaction& trans) const;
void WritePacket(WorldPacket& data) const;
void WritePacket(WorldPacket& data, bool sendOfficerNote) const;
uint64 GetGUID() const { return m_guid; }
std::string const& GetName() const { return m_name; }
@@ -661,7 +661,7 @@ public:
bool SetName(std::string const& name);
// Handle client commands
void HandleRoster(WorldSession* session = NULL); // NULL = broadcast
void HandleRoster(WorldSession* session);
void HandleQuery(WorldSession* session);
void HandleSetMOTD(WorldSession* session, std::string const& motd);
void HandleSetInfo(WorldSession* session, std::string const& info);

View File

@@ -1215,6 +1215,18 @@ enum TrinityStrings
LANG_AUTO_BROADCAST = 11000,
LANG_INVALID_REALMID = 11001,
// Show Kick in world
LANG_COMMAND_KICKMESSAGE_WORLD = 11002,
// Show Mute in world
LANG_COMMAND_MUTEMESSAGE_WORLD = 11003,
// Show Ban in world
LANG_BAN_CHARACTER_YOUBANNEDMESSAGE_WORLD = 11004,
LANG_BAN_CHARACTER_YOUPERMBANNEDMESSAGE_WORLD = 11005,
LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD = 11006,
LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD = 11007,
// NOT RESERVED IDS 12000-1999999999
// `db_script_string` table index 2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID)
// For other tables maybe 2000010000-2147483647 (max index)

View File

@@ -1173,6 +1173,8 @@ 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);
m_int_configs[CONFIG_NUMTHREADS] = sConfigMgr->GetIntDefault("MapUpdate.Threads", 1);

View File

@@ -137,6 +137,8 @@ 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,
CONFIG_CHATLOG_SYSCHAN,

View File

@@ -114,9 +114,19 @@ public:
case BAN_SUCCESS:
{
if (atoi(durationStr) > 0)
handler->PSendSysMessage(LANG_BAN_YOUBANNED, name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
{
if (sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
sWorld->SendWorldText(LANG_BAN_CHARACTER_YOUBANNEDMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
else
handler->PSendSysMessage(LANG_BAN_YOUBANNED, name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
}
else
handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, name.c_str(), reasonStr);
{
if (sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
sWorld->SendWorldText(LANG_BAN_CHARACTER_YOUPERMBANNEDMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), name.c_str(), reasonStr);
else
handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, name.c_str(), reasonStr);
}
break;
}
case BAN_NOTFOUND:
@@ -189,9 +199,19 @@ public:
{
case BAN_SUCCESS:
if (atoi(durationStr) > 0)
handler->PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
else
handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reasonStr);
{
if (sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
else
handler->PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
}
else
{
if (sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), nameOrIP.c_str(), reasonStr);
else
handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reasonStr);
}
break;
case BAN_SYNTAX_ERROR:
return false;

View File

@@ -808,12 +808,16 @@ public:
if (handler->HasLowerSecurity(target, 0))
return false;
if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
else
handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
char const* kickReason = strtok(NULL, "\r");
std::string kickReasonStr = "No reason";
if (kickReason != NULL)
kickReasonStr = kickReason;
target->GetSession()->KickPlayer();
if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), playerName.c_str(), kickReasonStr.c_str());
else
handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
target->GetSession()->KickPlayer();
return true;
}
@@ -1835,7 +1839,17 @@ public:
int64 muteTime = time(NULL) + notSpeakTime * MINUTE;
target->GetSession()->m_muteTime = muteTime;
stmt->setInt64(0, muteTime);
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
std::string nameLink = handler->playerLink(targetName);
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD))
{
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
}
else
{
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
}
}
else
{
@@ -1850,8 +1864,10 @@ public:
LoginDatabase.Execute(stmt);
std::string nameLink = handler->playerLink(targetName);
handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD) && !target)
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, handler->GetSession()->GetPlayerName().c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
else
handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
return true;
}

View File

@@ -2560,6 +2560,23 @@ Guild.AllowMultipleGuildMaster = 0
ShowKickInWorld = 0
# ShowMuteInWorld
# Description: Determines whether a message is broadcasted to the entire server when a
# player gets muted.
# Default: 0 - (Disabled)
# 1 - (Enabled)
ShowMuteInWorld = 0
#
# ShowBanInWorld
# Description: Determines whether a message is broadcasted to the entire server when a
# player gets banned.
# Default: 0 - (Disabled)
# 1 - (Enabled)
ShowBanInWorld = 0
#
# RecordUpdateTimeDiffInterval
# Description: Time (in milliseconds) update time diff is written to the log file.