diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/database/Database/Implementation/CharacterDatabase.cpp | 5 | ||||
-rw-r--r-- | src/server/database/Database/Implementation/CharacterDatabase.h | 1 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 21 | ||||
-rw-r--r-- | src/server/game/Tickets/TicketMgr.cpp | 14 | ||||
-rw-r--r-- | src/server/game/Tickets/TicketMgr.h | 16 | ||||
-rw-r--r-- | src/server/game/World/World.cpp | 1 | ||||
-rw-r--r-- | src/server/game/World/World.h | 1 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_ticket.cpp | 4 | ||||
-rw-r--r-- | src/server/worldserver/worldserver.conf.dist | 10 |
9 files changed, 56 insertions, 17 deletions
diff --git a/src/server/database/Database/Implementation/CharacterDatabase.cpp b/src/server/database/Database/Implementation/CharacterDatabase.cpp index 3e0d684a1fd..45bfee5d596 100644 --- a/src/server/database/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/database/Database/Implementation/CharacterDatabase.cpp @@ -335,10 +335,11 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_DEL_GO_RESPAWN_BY_INSTANCE, "DELETE FROM gameobject_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_ASYNC); // GM Tickets - PrepareStatement(CHAR_SEL_GM_TICKETS, "SELECT id, playerGuid, name, description, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, needMoreHelp FROM gm_ticket", CONNECTION_SYNCH); - PrepareStatement(CHAR_REP_GM_TICKET, "REPLACE INTO gm_ticket (id, playerGuid, name, description, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, needMoreHelp, resolvedBy) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PrepareStatement(CHAR_SEL_GM_TICKETS, "SELECT id, type, playerGuid, name, description, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, needMoreHelp FROM gm_ticket", CONNECTION_SYNCH); + PrepareStatement(CHAR_REP_GM_TICKET, "REPLACE INTO gm_ticket (id, type, playerGuid, name, description, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, needMoreHelp, resolvedBy) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_GM_TICKET, "DELETE FROM gm_ticket WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_PLAYER_GM_TICKETS, "DELETE FROM gm_ticket WHERE playerGuid = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_UPD_PLAYER_GM_TICKETS_ON_CHAR_DELETION, "UPDATE gm_ticket SET type = 2 WHERE playerGuid = ?", CONNECTION_ASYNC); // GM Survey/subsurvey/lag report PrepareStatement(CHAR_INS_GM_SURVEY, "INSERT INTO gm_survey (guid, surveyId, mainSurvey, comment, createTime) VALUES (?, ?, ?, ?, UNIX_TIMESTAMP(NOW()))", CONNECTION_ASYNC); diff --git a/src/server/database/Database/Implementation/CharacterDatabase.h b/src/server/database/Database/Implementation/CharacterDatabase.h index 3382430d695..7a463c73df2 100644 --- a/src/server/database/Database/Implementation/CharacterDatabase.h +++ b/src/server/database/Database/Implementation/CharacterDatabase.h @@ -286,6 +286,7 @@ enum CharacterDatabaseStatements CHAR_DEL_GM_TICKET, CHAR_DEL_ALL_GM_TICKETS, CHAR_DEL_PLAYER_GM_TICKETS, + CHAR_UPD_PLAYER_GM_TICKETS_ON_CHAR_DELETION, CHAR_INS_GM_SURVEY, CHAR_INS_GM_SUBSURVEY, diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2f78280a409..64263823caa 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -69,6 +69,7 @@ #include "SpellMgr.h" #include "SpellHistory.h" #include "Transport.h" +#include "TicketMgr.h" #include "UpdateData.h" #include "UpdateFieldFlags.h" #include "UpdateMask.h" @@ -4546,6 +4547,11 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe if (Guild* guild = sGuildMgr->GetGuildById(guildId)) guild->DeleteMember(playerguid, false, false, true); + // close player ticket if any + GmTicket* ticket = sTicketMgr->GetTicketByPlayer(playerguid); + if (ticket) + ticket->SetClosedBy(playerguid); + // remove from arena teams LeaveAllArenaTeams(playerguid); @@ -4757,9 +4763,18 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe stmt->setUInt32(0, guid); trans->Append(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_GM_TICKETS); - stmt->setUInt32(0, guid); - trans->Append(stmt); + if (sWorld->getBoolConfig(CONFIG_DELETE_CHARACTER_TICKET_TRACE)) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_GM_TICKETS_ON_CHAR_DELETION); + stmt->setUInt32(0, guid); + trans->Append(stmt); + } + else + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_GM_TICKETS); + stmt->setUInt32(0, guid); + trans->Append(stmt); + } stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_BY_OWNER); stmt->setUInt32(0, guid); diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index dbf66c6bd71..b4b3b8267c6 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -32,11 +32,11 @@ inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; } /////////////////////////////////////////////////////////////////////////////////////////////////// // GM ticket -GmTicket::GmTicket() : _id(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0), +GmTicket::GmTicket() : _id(0), _type(TICKET_TYPE_OPEN), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needResponse(false), _needMoreHelp(false) { } -GmTicket::GmTicket(Player* player) : _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(time(NULL)), _lastModifiedTime(time(NULL)), +GmTicket::GmTicket(Player* player) : _type(TICKET_TYPE_OPEN), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(time(NULL)), _lastModifiedTime(time(NULL)), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needResponse(false), _needMoreHelp(false) { @@ -49,10 +49,11 @@ GmTicket::~GmTicket() { } bool GmTicket::LoadFromDB(Field* fields) { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - // ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, haveTicket + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 + // id, type, playerGuid, name, description, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, needMoreHelp uint8 index = 0; _id = fields[ index].GetUInt32(); + _type = TicketType(fields[++index].GetUInt8()); _playerGuid = ObjectGuid(HighGuid::Player, fields[++index].GetUInt32()); _playerName = fields[++index].GetString(); _message = fields[++index].GetString(); @@ -75,11 +76,12 @@ bool GmTicket::LoadFromDB(Field* fields) void GmTicket::SaveToDB(SQLTransaction& trans) const { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 - // id, playerGuid, name, description, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, needMoreHelp, resolvedBy + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 + // id, type, playerGuid, name, description, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, needMoreHelp, resolvedBy uint8 index = 0; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET); stmt->setUInt32( index, _id); + stmt->setUInt8 (++index, uint8(_type)); stmt->setUInt32(++index, _playerGuid.GetCounter()); stmt->setString(++index, _playerName); stmt->setString(++index, _message); diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h index f7d3178978f..a90a1ec0206 100644 --- a/src/server/game/Tickets/TicketMgr.h +++ b/src/server/game/Tickets/TicketMgr.h @@ -77,6 +77,13 @@ enum LagReportType LAG_REPORT_TYPE_SPELL = 6 }; +enum TicketType +{ + TICKET_TYPE_OPEN = 0, + TICKET_TYPE_CLOSED = 1, + TICKET_TYPE_CHARACTER_DELETED = 2, +}; + class GmTicket { public: @@ -84,7 +91,7 @@ public: GmTicket(Player* player); ~GmTicket(); - bool IsClosed() const { return !_closedBy.IsEmpty(); } + bool IsClosed() const { return _type != TICKET_TYPE_OPEN; } bool IsCompleted() const { return _completed; } bool IsFromPlayer(ObjectGuid guid) const { return guid == _playerGuid; } bool IsAssigned() const { return !_assignedTo.IsEmpty(); } @@ -118,7 +125,7 @@ public: else if (_escalatedStatus == TICKET_UNASSIGNED) _escalatedStatus = TICKET_ASSIGNED; } - void SetClosedBy(ObjectGuid value) { _closedBy = value; } + void SetClosedBy(ObjectGuid value) { _closedBy = value; _type = TICKET_TYPE_CLOSED; } void SetResolvedBy(ObjectGuid value) { _resolvedBy = value; } void SetCompleted() { _completed = true; } void SetMessage(std::string const& message) @@ -150,6 +157,7 @@ public: private: uint32 _id; + TicketType _type; // 0 = Open, 1 = Closed, 2 = Character deleted ObjectGuid _playerGuid; std::string _playerName; float _posX; @@ -159,8 +167,8 @@ private: std::string _message; uint64 _createTime; uint64 _lastModifiedTime; - ObjectGuid _closedBy; // 0 = Open, -1 = Console, playerGuid = player abandoned ticket or read the GM response message, other = GM who closed it. - ObjectGuid _resolvedBy; // 0 = Open, -1 = Resolved by Console, GM who resolved it by closing or completing the ticket. + ObjectGuid _closedBy; // 0 = Open or Closed by Console (if type = 1), playerGuid = GM who closed it or player abandoned ticket or read the GM response message. + ObjectGuid _resolvedBy; // 0 = Open or Resolved by Console (if type = 1), playerGuid = GM who resolved it by closing or completing the ticket. ObjectGuid _assignedTo; std::string _comment; bool _completed; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index a0dd889876c..bb4de29ad56 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -395,6 +395,7 @@ void World::LoadConfigSettings(bool reload) ///- Read ticket system setting from the config file m_bool_configs[CONFIG_ALLOW_TICKETS] = sConfigMgr->GetBoolDefault("AllowTickets", true); + m_bool_configs[CONFIG_DELETE_CHARACTER_TICKET_TRACE] = sConfigMgr->GetBoolDefault("DeletedCharacterTicketTrace", false); ///- Get string for new logins (newly created characters) SetNewCharString(sConfigMgr->GetStringDefault("PlayerStart.String", "")); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index b8ffc946615..e3dc3b55681 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -144,6 +144,7 @@ enum WorldBoolConfigs CONFIG_SHOW_BAN_IN_WORLD, CONFIG_AUTOBROADCAST, CONFIG_ALLOW_TICKETS, + CONFIG_DELETE_CHARACTER_TICKET_TRACE, CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES, CONFIG_PRESERVE_CUSTOM_CHANNELS, CONFIG_PDUMP_NO_PATHS, diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index 9b771f734be..a9baa45f344 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -150,7 +150,7 @@ public: return true; } - sTicketMgr->ResolveAndCloseTicket(ticket->GetId(), player ? player->GetGUID() : ObjectGuid(uint64(-1))); + sTicketMgr->ResolveAndCloseTicket(ticket->GetId(), player ? player->GetGUID() : ObjectGuid(uint64(0))); sTicketMgr->UpdateLastChange(); std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL, NULL); @@ -248,7 +248,7 @@ public: Player* gm = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; SQLTransaction trans = SQLTransaction(NULL); - ticket->SetResolvedBy(gm ? gm->GetGUID() : ObjectGuid(uint64(-1))); + ticket->SetResolvedBy(gm ? gm->GetGUID() : ObjectGuid(uint64(0))); ticket->SetCompleted(); ticket->SaveToDB(trans); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 13b6b22bed4..df2b2e73c1c 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1074,6 +1074,16 @@ Command.LookupMaxResults = 0 AllowTickets = 1 # +# DeletedCharacterTicketTrace +# Description: Keep trace of tickets opened by deleted characters +# gm_ticket.playerGuid will be 0, old GUID and character name +# will be included in gm_ticket.comment +# Default: 0 - (Disabled) +# 1 - (Enabled) + +DeletedCharacterTicketTrace = 0 + +# # DungeonFinder.OptionsMask # Description: Dungeon and raid finder system. # Value is a bitmask consisting of: |