Core/Commands: Include mute/ban info in .pinfo command

This commit is contained in:
Shocker
2011-05-09 18:00:42 +03:00
parent 3fa651ce19
commit 2703c6a38b
4 changed files with 23 additions and 3 deletions
+1 -1
View File
@@ -27356,7 +27356,7 @@ INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_
(547, 'InstanceID: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (547, 'InstanceID: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(548, 'Player%s %s (guid: %u) Account: %s (id: %u) Email: %s GMLevel: %u Last IP: %s Last login: %s Latency: %ums', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (548, 'Player%s %s (guid: %u) Account: %s (id: %u) Email: %s GMLevel: %u Last IP: %s Last login: %s Latency: %ums', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(549, 'Race: %s Class: %s Played time: %s Level: %u Money: %ug%us%uc', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (549, 'Race: %s Class: %s Played time: %s Level: %u Money: %ug%us%uc', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(550, 'Command .pinfo doesn''t support ''rep'' option for offline players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (550, 'Mute time remaining: %s, Ban time remaining: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(551, '%s has explored all zones now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (551, '%s has explored all zones now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(552, '%s has no more explored zones.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (552, '%s has no more explored zones.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(553, '%s has explored all zones for you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (553, '%s has explored all zones for you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
@@ -0,0 +1 @@
UPDATE `trinity_string` SET `content_default` = 'Mute time remaining: %s, Ban time remaining: %s' WHERE `entry` = 550;
+20 -1
View File
@@ -246,6 +246,8 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
uint32 latency = 0; uint32 latency = 0;
uint8 race; uint8 race;
uint8 Class; uint8 Class;
int64 muteTime = 0;
int64 banTime = -1;
// get additional information from Player object // get additional information from Player object
if (target) if (target)
@@ -261,6 +263,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
latency = target->GetSession()->GetLatency(); latency = target->GetSession()->GetLatency();
race = target->getRace(); race = target->getRace();
Class = target->getClass(); Class = target->getClass();
muteTime = target->GetSession()->m_muteTime;
} }
// get additional information from DB // get additional information from DB
else else
@@ -289,7 +292,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
uint32 security = 0; uint32 security = 0;
std::string last_login = GetTrinityString(LANG_ERROR); std::string last_login = GetTrinityString(LANG_ERROR);
QueryResult result = LoginDatabase.PQuery("SELECT a.username, aa.gmlevel, a.email, a.last_ip, a.last_login " QueryResult result = LoginDatabase.PQuery("SELECT a.username, aa.gmlevel, a.email, a.last_ip, a.last_login, a.mutetime "
"FROM account a " "FROM account a "
"LEFT JOIN account_access aa " "LEFT JOIN account_access aa "
"ON (a.id = aa.id) " "ON (a.id = aa.id) "
@@ -300,6 +303,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
username = fields[0].GetString(); username = fields[0].GetString();
security = fields[1].GetUInt32(); security = fields[1].GetUInt32();
email = fields[2].GetString(); email = fields[2].GetString();
muteTime = fields[5].GetUInt64();
if (email.empty()) if (email.empty())
email = "-"; email = "-";
@@ -320,6 +324,21 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(target_guid), username.c_str(), accId, email.c_str(), security, last_ip.c_str(), last_login.c_str(), latency); PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(target_guid), username.c_str(), accId, email.c_str(), security, last_ip.c_str(), last_login.c_str(), latency);
if (QueryResult result = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate FROM account_banned WHERE id = '%u' AND active ORDER BY bandate ASC LIMIT 1", accId))
{
Field * fields = result->Fetch();
banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64();
}
else if (QueryResult result = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate FROM character_banned WHERE guid = '%u' AND active ORDER BY bandate ASC LIMIT 1", GUID_LOPART(target_guid)))
{
Field * fields = result->Fetch();
banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64();
}
muteTime = muteTime - time(NULL);
if (muteTime > 0 || banTime >= 0)
PSendSysMessage(LANG_PINFO_MUTE_BAN, muteTime > 0 ? secsToTimeString(muteTime, true).c_str() : "---", !banTime ? "perm." : (banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "---"));
std::string race_s, Class_s; std::string race_s, Class_s;
switch(race) switch(race)
{ {
+1 -1
View File
@@ -512,7 +512,7 @@ enum TrinityStrings
LANG_PINFO_ACCOUNT = 548, LANG_PINFO_ACCOUNT = 548,
LANG_PINFO_LEVEL = 549, LANG_PINFO_LEVEL = 549,
LANG_PINFO_NO_REP = 550, LANG_PINFO_MUTE_BAN = 550,
LANG_YOU_SET_EXPLORE_ALL = 551, LANG_YOU_SET_EXPLORE_ALL = 551,
LANG_YOU_SET_EXPLORE_NOTHING = 552, LANG_YOU_SET_EXPLORE_NOTHING = 552,