aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAscathor <Break_the_Chain@web.de>2013-05-26 01:52:28 +0200
committerAscathor <Break_the_Chain@web.de>2013-05-26 14:21:39 +0200
commitfb52e9ea035f6174e6925e97ed8eaf15f9867d6a (patch)
tree6ad1dd57f5dbf9fcc02f02a20fffb2f693f6a04a
parentb688fc0ed56f4787516df89c6c62f90c47ee1a5a (diff)
Core/Command: Optimized .pinfo more
* Moved some checks around * Added RBAC Permission for Email, last login and last ip (group 3 and 4) -- If missing RBAC permission, then it displays "Unauthorized (RBAC)" * Changed totalmail output from uint64 to uint32 * Level either puts Max level, or a list of information necessary * Only queries guild if the current xp query also detects guild membership * Incorporated recent changes into code * Commander requires higher than target to get sensitive data beside RBAC permission.
-rw-r--r--sql/base/auth_database.sql8
-rw-r--r--sql/updates/auth/2013_05_26_00_auth_rbac.sql14
-rw-r--r--sql/updates/world/2013_05_26_00_world_trinity_string.sql9
-rw-r--r--src/server/game/Accounts/RBAC.h1
-rw-r--r--src/server/game/Miscellaneous/Language.h6
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp112
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp2
7 files changed, 100 insertions, 52 deletions
diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql
index 05e680f94eb..4dc5cb2e7b6 100644
--- a/sql/base/auth_database.sql
+++ b/sql/base/auth_database.sql
@@ -292,7 +292,7 @@ CREATE TABLE `rbac_group_roles` (
LOCK TABLES `rbac_group_roles` WRITE;
/*!40000 ALTER TABLE `rbac_group_roles` DISABLE KEYS */;
-INSERT INTO `rbac_group_roles` VALUES (1,1),(2,2),(3,3),(4,4),(2,5),(1,6),(1,7),(2,8),(3,8),(4,8),(2,9),(3,9),(4,9),(2,10),(3,10),(4,10),(2,11),(3,11),(4,11),(2,12),(3,12),(4,12),(2,13),(3,13),(4,13),(2,14),(3,14),(4,14),(2,15),(3,15),(4,15),(2,16),(3,16),(4,16),(2,17),(3,17),(4,17),(4,18),(2,19),(3,19),(4,19),(2,20),(3,20),(4,20),(2,21),(3,21),(4,21),(2,22),(3,22),(4,22),(4,23),(2,24),(3,24),(4,24),(2,25),(3,25),(4,25),(2,26),(3,26),(4,26),(2,27),(3,27),(4,27),(2,28),(3,28),(4,28),(2,29),(3,29),(4,29),(2,30),(3,30),(4,30),(2,32),(3,32),(4,32),(2,33),(3,33),(4,33),(1,34),(2,35),(3,35),(4,35),(2,36),(3,36),(4,36),(2,37),(3,37),(4,37),(2,38),(3,38),(4,38);
+INSERT INTO `rbac_group_roles` VALUES (1,1),(2,2),(3,3),(4,4),(2,5),(1,6),(1,7),(2,8),(3,8),(4,8),(2,9),(3,9),(4,9),(2,10),(3,10),(4,10),(2,11),(3,11),(4,11),(2,12),(3,12),(4,12),(2,13),(3,13),(4,13),(2,14),(3,14),(4,14),(2,15),(3,15),(4,15),(2,16),(3,16),(4,16),(2,17),(3,17),(4,17),(4,18),(2,19),(3,19),(4,19),(2,20),(3,20),(4,20),(2,21),(3,21),(4,21),(2,22),(3,22),(4,22),(4,23),(2,24),(3,24),(4,24),(2,25),(3,25),(4,25),(2,26),(3,26),(4,26),(2,27),(3,27),(4,27),(2,28),(3,28),(4,28),(2,29),(3,29),(4,29),(2,30),(3,30),(4,30),(2,32),(3,32),(4,32),(2,33),(3,33),(4,33),(1,34),(2,35),(3,35),(4,35),(2,36),(3,36),(4,36),(2,37),(3,37),(4,37),(2,38),(3,38),(4,38),(3,39),(4,39);
/*!40000 ALTER TABLE `rbac_group_roles` ENABLE KEYS */;
UNLOCK TABLES;
@@ -340,7 +340,7 @@ CREATE TABLE `rbac_permissions` (
LOCK TABLES `rbac_permissions` WRITE;
/*!40000 ALTER TABLE `rbac_permissions` DISABLE KEYS */;
-INSERT INTO `rbac_permissions` VALUES (1,'Instant logout'),(2,'Skip Queue'),(3,'Join Normal Battleground'),(4,'Join Random Battleground'),(5,'Join Arenas'),(6,'Join Dungeon Finder'),(7,'Player Commands (Temporal till commands moved to rbac)'),(8,'Moderator Commands (Temporal till commands moved to rbac)'),(9,'GameMaster Commands (Temporal till commands moved to rbac)'),(10,'Administrator Commands (Temporal till commands moved to rbac)'),(11,'Log GM trades'),(13,'Skip Instance required bosses check'),(14,'Skip character creation team mask check'),(15,'Skip character creation class mask check'),(16,'Skip character creation race mask check'),(17,'Skip character creation reserved name check'),(18,'Skip character creation heroic min level check'),(19,'Skip needed requirements to use channel check'),(20,'Skip disable map check'),(21,'Skip reset talents when used more than allowed check'),(22,'Skip spam chat check'),(23,'Skip over-speed ping check'),(24,'Two side faction characters on the same account'),(25,'Allow say chat between factions'),(26,'Allow channel chat between factions'),(27,'Two side mail interaction'),(28,'See two side who list'),(29,'Add friends of other faction'),(30,'Save character without delay with .save command'),(31,'Use params with .unstuck command'),(32,'Can be assigned tickets with .assign ticket command'),(33,'Notify if a command was not found'),(34,'Check if should appear in list using .gm ingame command'),(35,'See all security levels with who command'),(36,'Filter whispers'),(37,'Use staff badge in chat'),(38,'Resurrect with full Health Points'),(39,'Restore saved gm setting states'),(40,'Allows to add a gm to friend list'),(41,'Use Config option START_GM_LEVEL to assign new character level'),(42,'Allows to use CMSG_WORLD_TELEPORT opcode'),(43,'Allows to use CMSG_WHOIS opcode'),(44,'Receive global GM messages/texts'),(45,'Join channels without announce'),(46,'Change channel settings without being channel moderator'),(47,'Enables lower security than target check');
+INSERT INTO `rbac_permissions` VALUES (1,'Instant logout'),(2,'Skip Queue'),(3,'Join Normal Battleground'),(4,'Join Random Battleground'),(5,'Join Arenas'),(6,'Join Dungeon Finder'),(7,'Player Commands (Temporal till commands moved to rbac)'),(8,'Moderator Commands (Temporal till commands moved to rbac)'),(9,'GameMaster Commands (Temporal till commands moved to rbac)'),(10,'Administrator Commands (Temporal till commands moved to rbac)'),(11,'Log GM trades'),(13,'Skip Instance required bosses check'),(14,'Skip character creation team mask check'),(15,'Skip character creation class mask check'),(16,'Skip character creation race mask check'),(17,'Skip character creation reserved name check'),(18,'Skip character creation heroic min level check'),(19,'Skip needed requirements to use channel check'),(20,'Skip disable map check'),(21,'Skip reset talents when used more than allowed check'),(22,'Skip spam chat check'),(23,'Skip over-speed ping check'),(24,'Two side faction characters on the same account'),(25,'Allow say chat between factions'),(26,'Allow channel chat between factions'),(27,'Two side mail interaction'),(28,'See two side who list'),(29,'Add friends of other faction'),(30,'Save character without delay with .save command'),(31,'Use params with .unstuck command'),(32,'Can be assigned tickets with .assign ticket command'),(33,'Notify if a command was not found'),(34,'Check if should appear in list using .gm ingame command'),(35,'See all security levels with who command'),(36,'Filter whispers'),(37,'Use staff badge in chat'),(38,'Resurrect with full Health Points'),(39,'Restore saved gm setting states'),(40,'Allows to add a gm to friend list'),(41,'Use Config option START_GM_LEVEL to assign new character level'),(42,'Allows to use CMSG_WORLD_TELEPORT opcode'),(43,'Allows to use CMSG_WHOIS opcode'),(44,'Receive global GM messages/texts'),(45,'Join channels without announce'),(46,'Change channel settings without being channel moderator'),(47,'Enables lower security than target check'),(48,'Enable IP, Last Login and EMail output in pinfo');
/*!40000 ALTER TABLE `rbac_permissions` ENABLE KEYS */;
UNLOCK TABLES;
@@ -367,7 +367,7 @@ CREATE TABLE `rbac_role_permissions` (
LOCK TABLES `rbac_role_permissions` WRITE;
/*!40000 ALTER TABLE `rbac_role_permissions` DISABLE KEYS */;
-INSERT INTO `rbac_role_permissions` VALUES (5,1),(5,2),(6,3),(6,4),(6,5),(7,6),(1,7),(2,8),(3,9),(4,10),(8,11),(9,13),(33,14),(33,15),(33,16),(33,17),(33,18),(27,19),(22,20),(23,21),(24,22),(17,23),(34,24),(28,25),(30,26),(19,27),(35,28),(36,29),(11,30),(12,31),(10,32),(20,33),(14,34),(37,35),(29,36),(15,37),(13,38),(25,39),(38,40),(26,41),(18,42),(18,43),(16,44),(31,45),(32,46),(21,47);
+INSERT INTO `rbac_role_permissions` VALUES (5,1),(5,2),(6,3),(6,4),(6,5),(7,6),(1,7),(2,8),(3,9),(4,10),(8,11),(9,13),(33,14),(33,15),(33,16),(33,17),(33,18),(27,19),(22,20),(23,21),(24,22),(17,23),(34,24),(28,25),(30,26),(19,27),(35,28),(36,29),(11,30),(12,31),(10,32),(20,33),(14,34),(37,35),(29,36),(15,37),(13,38),(25,39),(38,40),(26,41),(18,42),(18,43),(16,44),(31,45),(32,46),(21,47),(39,48);
/*!40000 ALTER TABLE `rbac_role_permissions` ENABLE KEYS */;
UNLOCK TABLES;
@@ -391,7 +391,7 @@ CREATE TABLE `rbac_roles` (
LOCK TABLES `rbac_roles` WRITE;
/*!40000 ALTER TABLE `rbac_roles` DISABLE KEYS */;
-INSERT INTO `rbac_roles` VALUES (1,'Player Commands'),(2,'Moderator Commands'),(3,'GameMaster Commands'),(4,'Administrator Commands'),(5,'Quick Login/Logout'),(6,'Use Battleground/Arenas'),(7,'Use Dungeon Finder'),(8,'Log GM trades'),(9,'Skip Instance required bosses check'),(10,'Ticket management'),(11,'Instant .save'),(12,'Allow params with .unstuck'),(13,'Full HP after resurrect'),(14,'Appear in GM ingame list'),(15,'Use staff badge in chat'),(16,'Receive global GM messages/texts'),(17,'Skip over-speed ping check'),(18,'Allows Admin Opcodes'),(19,'Two side mail interaction'),(20,'Notify if a command was not found'),(21,'Enables lower security than target check'),(22,'Skip disable map check'),(23,'Skip reset talents when used more than allowed check'),(24,'Skip spam chat check'),(25,'Restore saved gm setting states'),(26,'Use Config option START_GM_LEVEL to assign new character level'),(27,'Skip needed requirements to use channel check'),(28,'Allow say chat between factions'),(29,'Filter whispers'),(30,'Allow channel chat between factions'),(31,'Join channels without announce'),(32,'Change channel settings without being channel moderator'),(33,'Skip character creation checks'),(34,'Two side faction characters on the same account'),(35,'See two side who list'),(36,'Add friends of other faction'),(37,'See all security levels with who command'),(38,'Allows to add a gm to friend list');
+INSERT INTO `rbac_roles` VALUES (1,'Player Commands'),(2,'Moderator Commands'),(3,'GameMaster Commands'),(4,'Administrator Commands'),(5,'Quick Login/Logout'),(6,'Use Battleground/Arenas'),(7,'Use Dungeon Finder'),(8,'Log GM trades'),(9,'Skip Instance required bosses check'),(10,'Ticket management'),(11,'Instant .save'),(12,'Allow params with .unstuck'),(13,'Full HP after resurrect'),(14,'Appear in GM ingame list'),(15,'Use staff badge in chat'),(16,'Receive global GM messages/texts'),(17,'Skip over-speed ping check'),(18,'Allows Admin Opcodes'),(19,'Two side mail interaction'),(20,'Notify if a command was not found'),(21,'Enables lower security than target check'),(22,'Skip disable map check'),(23,'Skip reset talents when used more than allowed check'),(24,'Skip spam chat check'),(25,'Restore saved gm setting states'),(26,'Use Config option START_GM_LEVEL to assign new character level'),(27,'Skip needed requirements to use channel check'),(28,'Allow say chat between factions'),(29,'Filter whispers'),(30,'Allow channel chat between factions'),(31,'Join channels without announce'),(32,'Change channel settings without being channel moderator'),(33,'Skip character creation checks'),(34,'Two side faction characters on the same account'),(35,'See two side who list'),(36,'Add friends of other faction'),(37,'See all security levels with who command'),(38,'Allows to add a gm to friend list'),(39,'Enable IP, Last Login and EMail output in pinfo');
/*!40000 ALTER TABLE `rbac_roles` ENABLE KEYS */;
UNLOCK TABLES;
diff --git a/sql/updates/auth/2013_05_26_00_auth_rbac.sql b/sql/updates/auth/2013_05_26_00_auth_rbac.sql
new file mode 100644
index 00000000000..aa05c842932
--- /dev/null
+++ b/sql/updates/auth/2013_05_26_00_auth_rbac.sql
@@ -0,0 +1,14 @@
+DELETE FROM `rbac_permissions` WHERE `id` = 48;
+INSERT INTO `rbac_permissions` (`id`, `name`) VALUES (48, 'Enable IP, Last Login and EMail output in pinfo');
+
+DELETE FROM `rbac_roles` WHERE `id` = 39;
+INSERT INTO `rbac_roles` (`id`, `name`) VALUES (39, 'Enable IP, Last Login and EMail output in pinfo');
+
+DELETE FROM `rbac_role_permissions` WHERE `roleId` = 39 AND `permissionId` = 48;
+INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES (39, 48);
+
+DELETE FROM `rbac_group_roles` WHERE `groupId` = 3 AND `roleId` = 39;
+INSERT INTO `rbac_group_roles` (`groupId`, `roleId`) VALUES (3, 39);
+
+DELETE FROM `rbac_group_roles` WHERE `groupId` = 4 AND `roleId` = 39;
+INSERT INTO `rbac_group_roles` (`groupId`, `roleId`) VALUES (4, 39);
diff --git a/sql/updates/world/2013_05_26_00_world_trinity_string.sql b/sql/updates/world/2013_05_26_00_world_trinity_string.sql
new file mode 100644
index 00000000000..591021a5f84
--- /dev/null
+++ b/sql/updates/world/2013_05_26_00_world_trinity_string.sql
@@ -0,0 +1,9 @@
+DELETE FROM `trinity_string` WHERE `entry`=854 LIMIT 1;
+INSERT INTO `trinity_string` (`entry`, `content_default`, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8) VALUES
+(854, '└ Mails: %d Read/%u Total', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+
+DELETE FROM `trinity_string` WHERE `entry`=871 LIMIT 1;
+INSERT INTO `trinity_string` (`entry`, `content_default`, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8) VALUES
+(871, '│ Level: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+
+UPDATE `trinity_string` SET `content_default`='│ Level: %u (%u/%u XP (%u XP left))' WHERE `entry`=843 LIMIT 1;
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h
index 5a6514e5356..35024fc4152 100644
--- a/src/server/game/Accounts/RBAC.h
+++ b/src/server/game/Accounts/RBAC.h
@@ -95,6 +95,7 @@ enum RBACPermissions
RBAC_PERM_SILENTLY_JOIN_CHANNEL = 45,
RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR = 46,
RBAC_PERM_CHECK_FOR_LOWER_SECURITY = 47,
+ RBAC_PERM_COMMANDS_PINFO_CHECK_PERSONAL_DATA = 48,
RBAC_PERM_MAX
};
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index 15673ffd0c5..0da63a61b43 100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -812,7 +812,7 @@ enum TrinityStrings
LANG_PINFO_ACC_LASTLOGIN = 716,
LANG_PINFO_ACC_OS = 749,
LANG_PINFO_ACC_IP = 752,
- LANG_PINFO_CHR_LEVEL = 843,
+ LANG_PINFO_CHR_LEVEL_LOW = 843,
LANG_PINFO_CHR_RACE = 844,
LANG_PINFO_CHR_ALIVE = 845,
LANG_PINFO_CHR_PHASE = 846,
@@ -824,6 +824,7 @@ enum TrinityStrings
LANG_PINFO_CHR_GUILD_ONOTE = 852,
LANG_PINFO_CHR_PLAYEDTIME = 853,
LANG_PINFO_CHR_MAILS = 854,
+ LANG_PINFO_CHR_LEVEL_HIGH = 871,
LANG_CHARACTER_GENDER_MALE = 855,
LANG_CHARACTER_GENDER_FEMALE = 856,
@@ -842,7 +843,8 @@ enum TrinityStrings
LANG_ARENA_INFO_HEADER = 868,
LANG_ARENA_INFO_MEMBERS = 869,
LANG_ARENA_LOOKUP = 870,
- // Room for in-game strings 870-999 not used
+ // = 871, see LANG_PINFO_CHR_LEVEL_HIGH
+ // Room for in-game strings 872-999 not used
// Level 4 (CLI only commands)
LANG_COMMAND_EXIT = 1000,
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 3051580a933..c49514cacc4 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1587,7 +1587,12 @@ public:
std::string areaName = "<unknown>";
std::string zoneName = "<unknown>";
- // Guild data print is only defined if part of Guild
+ // Guild data print variables defined so that they exist, but are not necessarily used
+ uint32 guildId = 0;
+ std::string guildName;
+ std::string guildRank;
+ std::string note;
+ std::string officeNote;
// Mail data print is only defined if you have a mail
@@ -1626,18 +1631,19 @@ public:
if (!result)
return false;
- Field* fields = result->Fetch();
- totalPlayerTime = fields[0].GetUInt32();
- level = fields[1].GetUInt8();
- money = fields[2].GetUInt32();
- accId = fields[3].GetUInt32();
- raceid = fields[4].GetUInt8();
- classid = fields[5].GetUInt8();
- mapId = fields[6].GetUInt16();
- areaId = fields[7].GetUInt16();
- gender = fields[8].GetUInt8();
- uint32 health = fields[9].GetUInt32();
+ Field* fields = result->Fetch();
+ totalPlayerTime = fields[0].GetUInt32();
+ level = fields[1].GetUInt8();
+ money = fields[2].GetUInt32();
+ accId = fields[3].GetUInt32();
+ raceid = fields[4].GetUInt8();
+ classid = fields[5].GetUInt8();
+ mapId = fields[6].GetUInt16();
+ areaId = fields[7].GetUInt16();
+ gender = fields[8].GetUInt8();
+ uint32 health = fields[9].GetUInt32();
uint32 playerFlags = fields[10].GetUInt32();
+
if (!health || playerFlags & PLAYER_FLAGS_GHOST)
alive = "No";
else
@@ -1655,13 +1661,13 @@ public:
Field* fields = result->Fetch();
userName = fields[0].GetString();
security = fields[1].GetUInt8();
- eMail = fields[2].GetString();
- // Only fetch these fields if commander has sufficient rights AND is online (prevent cheating)
- /// @TODO: Add RBAC for "Can query ip and login data"
- if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security))
+ // Only fetch these fields if commander has sufficient rights)
+ if (handler->HasPermission(RBAC_PERM_COMMANDS_PINFO_CHECK_PERSONAL_DATA) && // RBAC Perm. 48, Role 39
+ (!handler->GetSession() || handler->GetSession()->GetSecurity() >= security))
{
- lastIp = fields[3].GetString();
+ eMail = fields[2].GetString();
+ lastIp = fields[3].GetString();
lastLogin = fields[4].GetString();
uint32 ip = inet_addr(lastIp.c_str());
@@ -1678,6 +1684,12 @@ public:
lastIp.append(")");
}
}
+ else
+ {
+ eMail = "Unauthorized";
+ lastIp = "Unauthorized";
+ lastLogin = "Unauthorized";
+ }
muteTime = fields[5].GetUInt64();
muteReason = fields[6].GetString();
muteBy = fields[7].GetString();
@@ -1728,7 +1740,25 @@ public:
if (result4)
{
Field* fields = result4->Fetch();
- xp = fields[0].GetUInt32();
+ xp = fields[0].GetUInt32(); // Used for "current xp" output and "%u XP Left" calculation
+ uint32 gguid = fields[1].GetUInt32(); // We check if have a guild for the person, so we might not require to query it at all
+
+ if (gguid != 0)
+ {
+ // Guild Data - an own query, because it may not happen.
+ PreparedStatement* stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED);
+ stmt3->setUInt32(0, lowguid);
+ PreparedQueryResult result5 = CharacterDatabase.Query(stmt3);
+ if (result5)
+ {
+ Field* fields = result5->Fetch();
+ guildId = fields[0].GetUInt32();
+ guildName = fields[1].GetString();
+ guildRank = fields[2].GetString();
+ note = fields[3].GetString();
+ officeNote = fields[4].GetString();
+ }
+ }
}
// Initiate output
@@ -1760,7 +1790,10 @@ public:
handler->PSendSysMessage(LANG_PINFO_ACC_IP, lastIp.c_str(), locked ? "Yes" : "No");
// Output X. LANG_PINFO_CHR_LEVEL
- handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL, level, xp, xptotal, (xptotal - xp));
+ if (level != sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
+ handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_LOW, level, xp, xptotal, (xptotal - xp));
+ else
+ handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_HIGH, level);
// Output XI. LANG_PINFO_CHR_RACE
raceStr = GetRaceName(raceid, locale);
@@ -1795,27 +1828,15 @@ public:
if (target)
handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale], (!zoneName.empty() ? zoneName.c_str() : "<Unknown>"), (!areaName.empty() ? areaName.c_str() : "<Unknown>"));
- // Guild Data - an own query, because it may not happen.
- PreparedStatement* stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED);
- stmt3->setUInt32(0, lowguid);
- PreparedQueryResult result5 = CharacterDatabase.Query(stmt3);
- if (result5)
- {
- Field* fields = result5->Fetch();
- uint32 guildId = fields[0].GetUInt32();
- std::string guildName = fields[1].GetString();
- std::string guildRank = fields[2].GetString();
- std::string note = fields[3].GetString();
- std::string officeNote = fields[4].GetString();
-
- // Output XVII. - XX.
- handler->PSendSysMessage(LANG_PINFO_CHR_GUILD, guildName.c_str(), guildId);
- handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_RANK, guildRank.c_str());
- // Only output XIX and XX if they are not empty
- if (!note.empty())
- handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_NOTE, note.c_str());
- if (!officeNote.empty())
- handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_ONOTE, officeNote.c_str());
+ // Output XVII. - XX. if they are not empty
+ if (!guildName.empty())
+ {
+ handler->PSendSysMessage(LANG_PINFO_CHR_GUILD, guildName.c_str(), guildId);
+ handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_RANK, guildRank.c_str());
+ if (!note.empty())
+ handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_NOTE, note.c_str());
+ if (!officeNote.empty())
+ handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_ONOTE, officeNote.c_str());
}
// Output XXI. LANG_PINFO_CHR_PLAYEDTIME
@@ -1823,23 +1844,24 @@ public:
// Mail Data - an own query, because it may or may not be useful.
// SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?"
- stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
- stmt3->setUInt32(0, lowguid);
- PreparedQueryResult result6 = CharacterDatabase.Query(stmt3);
+ PreparedStatement* stmt4 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
+ stmt4->setUInt32(0, lowguid);
+ PreparedQueryResult result6 = CharacterDatabase.Query(stmt4);
if (result6)
{
// Define the variables, so the compiler knows they exist
uint32 rmailint = 0;
// Fetch the fields - readmail is a SUM(x) and given out as char! Thus...
+ // ... while totalmail is a COUNT(x), which is given out as INt64, which we just convert on fetch...
Field* fields = result6->Fetch();
std::string readmail = fields[0].GetString();
- uint64 totalmail = fields[1].GetUInt64();
+ uint32 totalmail = uint32(fields[1].GetUInt64());
// ... we have to convert it from Char to int. We can use totalmail as it is
rmailint = atol(readmail.c_str());
- // Output XXII. LANG_INFO_CHR_MAILS if at least one mails is given
+ // Output XXII. LANG_INFO_CHR_MAILS if at least one mail is given
if (totalmail >= 1)
handler->PSendSysMessage(LANG_PINFO_CHR_MAILS, rmailint, totalmail);
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 069f2127a72..fce78638414 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -427,7 +427,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
//0: lowGUID
PrepareStatement(CHAR_SEL_PINFO_MAILS, "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?", CONNECTION_SYNCH);
//0: lowGUID
- PrepareStatement(CHAR_SEL_PINFO_XP, "SELECT xp FROM characters WHERE guid = ?", CONNECTION_SYNCH);
+ PrepareStatement(CHAR_SEL_PINFO_XP, "SELECT a.xp, b.guid FROM characters a LEFT JOIN guild_member b ON a.guid = b.guid WHERE a.guid = ?", CONNECTION_SYNCH);
PrepareStatement(CHAR_SEL_CHAR_HOMEBIND, "SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = ?", CONNECTION_SYNCH);
PrepareStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC, "SELECT guid, name FROM characters WHERE account = ?", CONNECTION_SYNCH);
PrepareStatement(CHAR_SEL_POOL_QUEST_SAVE, "SELECT quest_id FROM pool_quest_save WHERE pool_id = ?", CONNECTION_SYNCH);