From 014adaa0fd14a3f316588b0829ceea1960af12d5 Mon Sep 17 00:00:00 2001 From: Nyeriah Date: Wed, 3 Sep 2014 17:25:36 -0300 Subject: Core/Tickets: Send global GM system messages on ticket complete --- src/server/scripts/Commands/cs_ticket.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index a2f1c75106b..364b698743a 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -126,7 +126,7 @@ public: ticket->SaveToDB(trans); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*handler, NULL, target.c_str(), NULL, NULL); + std::string msg = ticket->FormatMessageString(*handler, NULL, target.c_str(), NULL, NULL, NULL); handler->SendGlobalGMSysMessage(msg.c_str()); return true; } @@ -156,7 +156,7 @@ public: sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL); + std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL, NULL); handler->SendGlobalGMSysMessage(msg.c_str()); // Inform player, who submitted this ticket, that it is closed @@ -205,7 +205,7 @@ public: ticket->SaveToDB(trans); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL); + std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL, NULL); msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName().c_str() : "Console", comment); handler->SendGlobalGMSysMessage(msg.c_str()); @@ -239,6 +239,9 @@ public: ticket->SetCompleted(); ticket->SaveToDB(trans); + std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, + NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console"); + handler->SendGlobalGMSysMessage(msg.c_str()); sTicketMgr->UpdateLastChange(); return true; } @@ -262,7 +265,7 @@ public: return true; } - std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console"); + std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL); handler->SendGlobalGMSysMessage(msg.c_str()); sTicketMgr->RemoveTicket(ticket->GetId()); @@ -394,7 +397,7 @@ public: sTicketMgr->UpdateLastChange(); std::string msg = ticket->FormatMessageString(*handler, NULL, assignedTo.c_str(), - handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL); + handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL, NULL); handler->SendGlobalGMSysMessage(msg.c_str()); return true; -- cgit v1.2.3 From 5efd2579e5666a5330dd1f58028f3c30695746a8 Mon Sep 17 00:00:00 2001 From: Odyssey Date: Fri, 5 Sep 2014 12:38:31 +0200 Subject: Scripts/Commands: Move cs_misc command output hardcoded strings to DB so they can be localized too --- .../world/2014_XX_XX_XX_world_trinity_string.sql | 11 +++++ src/server/game/Miscellaneous/Language.h | 16 ++++-- src/server/scripts/Commands/cs_ban.cpp | 4 +- src/server/scripts/Commands/cs_misc.cpp | 57 +++++++++++----------- 4 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 sql/updates/world/2014_XX_XX_XX_world_trinity_string.sql (limited to 'src/server/scripts/Commands') diff --git a/sql/updates/world/2014_XX_XX_XX_world_trinity_string.sql b/sql/updates/world/2014_XX_XX_XX_world_trinity_string.sql new file mode 100644 index 00000000000..172a4bdc381 --- /dev/null +++ b/sql/updates/world/2014_XX_XX_XX_world_trinity_string.sql @@ -0,0 +1,11 @@ +-- Move cs_misc command output hardcoded strings to DB so they can be localized too +DELETE FROM `trinity_string` WHERE `entry` IN (5030,5035,5039,5040,5041,5042,5043,5044); +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(5030, ''), +(5035, 'No reason'), +(5039, 'Console'), +(5040, 'Character'), +(5041, 'Permanently'), +(5042, 'You are outdoors'), +(5043, 'You are indoors'), +(5044, 'no VMAP available for area info'); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 66cae69cb33..cb26e63f6fe 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -404,8 +404,8 @@ enum TrinityStrings LANG_BANINFO_HISTORYENTRY = 418, LANG_BANINFO_INFINITE = 419, LANG_BANINFO_NEVER = 420, - LANG_BANINFO_YES = 421, - LANG_BANINFO_NO = 422, + LANG_YES = 421, + LANG_NO = 422, LANG_BANINFO_IPENTRY = 423, LANG_BANLIST_NOIP = 424, @@ -1078,16 +1078,22 @@ enum TrinityStrings LANG_GOINFO_NAME = 5027, LANG_GOINFO_LOOTID = 5028, LANG_COMMAND_LOOKUP_MAX_RESULTS = 5029, - // unused = 5030, + LANG_UNAUTHORIZED = 5030, LANG_NPCINFO_AIINFO = 5031, LANG_COMMAND_NO_BATTLEGROUND_FOUND = 5032, LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND = 5033, LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034, - // unused = 5035, + LANG_NO_REASON = 5035, LANG_NPCINFO_EQUIPMENT = 5036, LANG_NPCINFO_MECHANIC_IMMUNE = 5037, LANG_NPCINFO_UNIT_FIELD_FLAGS = 5038, - // Room for more Trinity strings 5039-9999 + LANG_CONSOLE = 5039, + LANG_CHARACTER = 5040, + LANG_PERMANENTLY = 5041, + LANG_GPS_POSITION_OUTDOORS = 5042, + LANG_GPS_POSITION_INDOORS = 5043, + LANG_GPS_NO_VMAP = 5044, + // Room for more Trinity strings 5045-9999 // Level requirement notifications LANG_SAY_REQ = 6604, diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp index a90bbd69e24..6143a4ca344 100644 --- a/src/server/scripts/Commands/cs_ban.cpp +++ b/src/server/scripts/Commands/cs_ban.cpp @@ -287,7 +287,7 @@ public: bool permanent = (fields[1].GetUInt64() == uint64(0)); std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true); handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY, - fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_BANINFO_YES) : handler->GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString()); + fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO), fields[4].GetCString(), fields[5].GetCString()); } while (result->NextRow()); @@ -340,7 +340,7 @@ public: bool permanent = (fields[1].GetUInt32() == uint32(0)); std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true); handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY, - fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_BANINFO_YES) : handler->GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString()); + fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO), fields[4].GetCString(), fields[5].GetCString()); } while (result->NextRow()); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 9cb7173556a..80b7710cd21 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -192,17 +192,17 @@ public: if (haveVMap) { if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ())) - handler->PSendSysMessage("You are outdoors"); + handler->PSendSysMessage(LANG_GPS_POSITION_OUTDOORS); else - handler->PSendSysMessage("You are indoors"); + handler->PSendSysMessage(LANG_GPS_POSITION_INDOORS); } else - handler->PSendSysMessage("no VMAP available for area info"); + handler->PSendSysMessage(LANG_GPS_NO_VMAP); handler->PSendSysMessage(LANG_MAP_POSITION, - mapId, (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : ""), - zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : ""), - areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : ""), + mapId, (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : handler->GetTrinityString(LANG_UNKNOWN)), + zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : handler->GetTrinityString(LANG_UNKNOWN)), + areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : handler->GetTrinityString(LANG_UNKNOWN)), object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), @@ -808,7 +808,7 @@ public: if (handler->HasLowerSecurity(target, 0)) return false; - std::string kickReasonStr = "No reason"; + std::string kickReasonStr = handler->GetTrinityString(LANG_NO_REASON); if (*args != '\0') { char const* kickReason = strtok(NULL, "\r"); @@ -1441,22 +1441,22 @@ public: std::string lastLogin = handler->GetTrinityString(LANG_ERROR); uint32 failedLogins = 0; uint32 latency = 0; - std::string OS = "None"; + std::string OS = handler->GetTrinityString(LANG_UNKNOWN); // Mute data print variables int64 muteTime = -1; - std::string muteReason = "unknown"; - std::string muteBy = "unknown"; + std::string muteReason = handler->GetTrinityString(LANG_NO_REASON); + std::string muteBy = handler->GetTrinityString(LANG_UNKNOWN); // Ban data print variables int64 banTime = -1; - std::string banType = "None"; - std::string banReason = "Unknown"; - std::string bannedBy = "Unknown"; + std::string banType = handler->GetTrinityString(LANG_UNKNOWN); + std::string banReason = handler->GetTrinityString(LANG_NO_REASON); + std::string bannedBy = handler->GetTrinityString(LANG_UNKNOWN); // Character data print variables uint8 raceid, classid = 0; //RACE_NONE, CLASS_NONE - std::string raceStr, classStr = "None"; + std::string raceStr, classStr = handler->GetTrinityString(LANG_UNKNOWN); uint8 gender = 0; int8 locale = handler->GetSessionDbcLocale(); uint32 totalPlayerTime = 0; @@ -1470,8 +1470,8 @@ public: uint32 mapId; uint32 areaId; uint32 phase = 0; - std::string areaName = ""; - std::string zoneName = ""; + std::string areaName = handler->GetTrinityString(LANG_UNKNOWN); + std::string zoneName = handler->GetTrinityString(LANG_UNKNOWN); // Guild data print variables defined so that they exist, but are not necessarily used uint32 guildId = 0; @@ -1499,7 +1499,7 @@ public: muteTime = target->GetSession()->m_muteTime; mapId = target->GetMapId(); areaId = target->GetAreaId(); - alive = target->IsAlive() ? "Yes" : "No"; + alive = target->IsAlive() ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO); gender = target->getGender(); phase = target->GetPhaseMask(); } @@ -1532,9 +1532,9 @@ public: uint32 playerFlags = fields[10].GetUInt32(); if (!health || playerFlags & PLAYER_FLAGS_GHOST) - alive = "No"; + alive = handler->GetTrinityString(LANG_NO); else - alive = "Yes"; + alive = handler->GetTrinityString(LANG_YES); } // Query the prepared statement for login data @@ -1574,9 +1574,10 @@ public: } else { - eMail = "Unauthorized"; - lastIp = "Unauthorized"; - lastLogin = "Unauthorized"; + eMail = handler->GetTrinityString(LANG_UNAUTHORIZED); + regMail = handler->GetTrinityString(LANG_UNAUTHORIZED); + lastIp = handler->GetTrinityString(LANG_UNAUTHORIZED); + lastLogin = handler->GetTrinityString(LANG_UNAUTHORIZED); } muteTime = fields[6].GetUInt64(); muteReason = fields[7].GetString(); @@ -1595,7 +1596,7 @@ public: PreparedQueryResult result2 = LoginDatabase.Query(stmt2); if (!result2) { - banType = "Character"; + banType = handler->GetTrinityString(LANG_CHARACTER); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS); stmt->setUInt32(0, lowguid); result2 = CharacterDatabase.Query(stmt); @@ -1652,7 +1653,7 @@ public: // Output III. LANG_PINFO_BANNED if ban exists and is applied if (banTime >= 0) - handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedBy.c_str()); + handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : handler->GetTrinityString(LANG_PERMANENTLY), bannedBy.c_str()); // Output IV. LANG_PINFO_MUTED if mute is applied if (muteTime > 0) @@ -1671,7 +1672,7 @@ public: handler->PSendSysMessage(LANG_PINFO_ACC_REGMAILS, regMail.c_str(), eMail.c_str()); // Output IX. LANG_PINFO_ACC_IP - handler->PSendSysMessage(LANG_PINFO_ACC_IP, lastIp.c_str(), locked ? "Yes" : "No"); + handler->PSendSysMessage(LANG_PINFO_ACC_IP, lastIp.c_str(), locked ? handler->GetTrinityString(LANG_YES) : handler->GetTrinityString(LANG_NO)); // Output X. LANG_PINFO_CHR_LEVEL if (level != sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) @@ -1710,7 +1711,7 @@ public: } if (target) - handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale], (!zoneName.empty() ? zoneName.c_str() : ""), (!areaName.empty() ? areaName.c_str() : "")); + handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale], (!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)), (!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN))); // Output XVII. - XVIX. if they are not empty if (!guildName.empty()) @@ -1790,7 +1791,7 @@ public: return false; char const* muteReason = strtok(NULL, "\r"); - std::string muteReasonStr = "No reason"; + std::string muteReasonStr = handler->GetTrinityString(LANG_NO_REASON); if (muteReason != NULL) muteReasonStr = muteReason; @@ -1818,7 +1819,7 @@ public: if (handler->GetSession()) muteBy = handler->GetSession()->GetPlayerName(); else - muteBy = "Console"; + muteBy = handler->GetTrinityString(LANG_CONSOLE); if (target) { -- cgit v1.2.3