Core/Support:

* Ticket status (viewed by GM, escalated) is now displayed correctly
* Fixed packet structure of CMSG_GM_TICKET_CREATE
* Use proper enum values (from client)
This commit is contained in:
Carbenium
2015-04-19 23:28:25 +02:00
parent 7e5df6d504
commit dab8e12413
4 changed files with 49 additions and 44 deletions

View File

@@ -104,8 +104,8 @@ void WorldPackets::Ticket::GMTicketCreate::Read()
Description = _worldPacket.ReadString(descLength);
_worldPacket.ResetBitPos();
NeedMoreHelp = _worldPacket.ReadBit();
NeedResponse = _worldPacket.ReadBit();
NeedMoreHelp = _worldPacket.ReadBit();
_worldPacket >> DataLength;
if (DataLength > 0)

View File

@@ -50,36 +50,29 @@ std::string Ticket::FormatViewMessageString(ChatHandler& handler, char const* cl
return ss.str();
}
GmTicket::GmTicket() : _lastModifiedTime(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needResponse(false), _needMoreHelp(false) { }
GmTicket::GmTicket() : _lastModifiedTime(0), _completed(false), _assignedToStatus(GMTICKET_ASSIGNEDTOGM_STATUS_NOT_ASSIGNED),
_openedByGmStatus(GMTICKET_OPENEDBYGM_STATUS_NOT_OPENED), _needResponse(false), _needMoreHelp(false) { }
GmTicket::GmTicket(Player* player) : Ticket(player), _lastModifiedTime(time(nullptr)), _completed(false), _escalatedStatus(TICKET_UNASSIGNED),
_viewed(false), _needResponse(false), _needMoreHelp(false)
GmTicket::GmTicket(Player* player) : Ticket(player), _lastModifiedTime(time(nullptr)), _completed(false), _assignedToStatus(GMTICKET_ASSIGNEDTOGM_STATUS_NOT_ASSIGNED),
_openedByGmStatus(GMTICKET_OPENEDBYGM_STATUS_NOT_OPENED), _needResponse(false), _needMoreHelp(false)
{
_id = sSupportMgr->GenerateGmTicketId();
}
GmTicket::~GmTicket() { }
void GmTicket::SetGmAction(uint32 needResponse, bool needMoreHelp)
void GmTicket::SetGmAction(bool needResponse, bool needMoreHelp)
{
_needResponse = (needResponse == 17); // Requires GM response. 17 = true, 1 = false (17 is default)
_needResponse = needResponse; // Requires GM response. 17 = true, 1 = false (17 is default)
_needMoreHelp = needMoreHelp; // Requests further GM interaction on a ticket to which a GM has already responded. Basically means "has a new ticket"
}
void GmTicket::SetUnassigned()
{
if (_assignedToStatus != GMTICKET_ASSIGNEDTOGM_STATUS_ESCALATED)
_assignedToStatus = GMTICKET_ASSIGNEDTOGM_STATUS_NOT_ASSIGNED;
_assignedTo.Clear();
switch (_escalatedStatus)
{
case TICKET_ASSIGNED: _escalatedStatus = TICKET_UNASSIGNED;
break;
case TICKET_ESCALATED_ASSIGNED: _escalatedStatus = TICKET_IN_ESCALATION_QUEUE;
break;
case TICKET_UNASSIGNED:
case TICKET_IN_ESCALATION_QUEUE:
default:
break;
}
}
void GmTicket::SetChatLog(std::list<uint32> time, std::string const& log)
@@ -137,8 +130,8 @@ void GmTicket::LoadFromDB(Field* fields)
_comment = fields[++idx].GetString();
_response = fields[++idx].GetString();
_completed = fields[++idx].GetBool();
_escalatedStatus = GMTicketEscalationStatus(fields[++idx].GetUInt8());
_viewed = fields[++idx].GetBool();
_assignedToStatus = GMTicketAssignedToGMStatus(fields[++idx].GetUInt8());
_openedByGmStatus = GMTicketOpenedByGMStatus(fields[++idx].GetUInt8());
_needMoreHelp = fields[++idx].GetBool();
}
@@ -160,8 +153,8 @@ void GmTicket::SaveToDB(SQLTransaction& trans) const
stmt->setString(++idx, _comment);
stmt->setString(++idx, _response);
stmt->setBool(++idx, _completed);
stmt->setUInt8(++idx, uint8(_escalatedStatus));
stmt->setBool(++idx, _viewed);
stmt->setUInt8(++idx, uint8(_assignedToStatus));
stmt->setUInt8(++idx, _openedByGmStatus);
stmt->setBool(++idx, _needMoreHelp);
CharacterDatabase.ExecuteOrAppend(trans, stmt);
@@ -1052,7 +1045,7 @@ void SupportMgr::ShowGmEscalatedList(ChatHandler& handler) const
{
handler.SendSysMessage(LANG_COMMAND_TICKETSHOWESCALATEDLIST);
for (GmTicketList::const_iterator itr = _gmTicketList.begin(); itr != _gmTicketList.end(); ++itr)
if (!itr->second->IsClosed() && itr->second->GetEscalatedStatus() == TICKET_IN_ESCALATION_QUEUE)
if (!itr->second->IsClosed() && itr->second->GetAssigendToStatus() == GMTICKET_ASSIGNEDTOGM_STATUS_ESCALATED)
handler.SendSysMessage(itr->second->FormatViewMessageString(handler).c_str());
}
@@ -1067,12 +1060,12 @@ void SupportMgr::SendGmTicket(WorldSession* session, GmTicket* ticket) const
response.Info.Value.TicketID = ticket->GetId();
response.Info.Value.TicketDescription = ticket->GetDescription();
response.Info.Value.Category = ticket->GetEscalatedStatus();
response.Info.Value.Category = 1;
response.Info.Value.TicketOpenTime = GetAge(ticket->GetLastModifiedTime());
response.Info.Value.OldestTicketTime = sSupportMgr->GetOldestOpenTicket() ? GetAge(sSupportMgr->GetOldestOpenTicket()->GetLastModifiedTime()) : float(0);
response.Info.Value.UpdateTime = GetAge(sSupportMgr->GetLastChange());
response.Info.Value.AssignedToGM = ticket->IsAssigned();
response.Info.Value.OpenedByGM = ticket->IsViewed();
response.Info.Value.AssignedToGM = ticket->GetAssigendToStatus();
response.Info.Value.OpenedByGM = ticket->GetOpenedByGmStatus();
response.Info.Value.WaitTimeOverrideMessage = "";
response.Info.Value.WaitTimeOverrideMinutes = 0;
}

View File

@@ -59,12 +59,11 @@ enum GMTicketOpenedByGMStatus
// GMTICKET_ASSIGNEDTOGM_STATUS_ASSIGNED = 1; -- ticket is assigned to a normal gm
// GMTICKET_ASSIGNEDTOGM_STATUS_ESCALATED = 2; -- ticket is in the escalation queue
// 3 is a custom value and should never actually be sent
enum GMTicketEscalationStatus
enum GMTicketAssignedToGMStatus
{
TICKET_UNASSIGNED = 0,
TICKET_ASSIGNED = 1,
TICKET_IN_ESCALATION_QUEUE = 2,
TICKET_ESCALATED_ASSIGNED = 3
GMTICKET_ASSIGNEDTOGM_STATUS_NOT_ASSIGNED = 0,
GMTICKET_ASSIGNEDTOGM_STATUS_ASSIGNED = 1,
GMTICKET_ASSIGNEDTOGM_STATUS_ESCALATED = 2
};
enum GMSupportComplaintType
@@ -146,31 +145,32 @@ public:
~GmTicket();
bool IsCompleted() const { return _completed; }
bool IsViewed() const { return _viewed; }
GMTicketOpenedByGMStatus GetOpenedByGmStatus() const { return _openedByGmStatus; }
bool GetNeedMoreHelp() const { return _needMoreHelp; }
std::string const& GetDescription() const { return _description; }
uint64 GetLastModifiedTime() const { return _lastModifiedTime; }
GMTicketEscalationStatus GetEscalatedStatus() const { return _escalatedStatus; }
uint8 GetCategory() const { return _category; }
GMTicketAssignedToGMStatus GetAssigendToStatus() const { return _assignedToStatus; }
std::string const& GetResponse() const { return _response; }
void SetAssignedTo(ObjectGuid guid, bool isAdmin = false) override
{
_assignedTo = guid;
if (isAdmin && _escalatedStatus == TICKET_IN_ESCALATION_QUEUE)
_escalatedStatus = TICKET_ESCALATED_ASSIGNED;
else if (_escalatedStatus == TICKET_UNASSIGNED)
_escalatedStatus = TICKET_ASSIGNED;
if (isAdmin)
_assignedToStatus = GMTICKET_ASSIGNEDTOGM_STATUS_ESCALATED;
else if (_assignedToStatus == GMTICKET_ASSIGNEDTOGM_STATUS_NOT_ASSIGNED)
_assignedToStatus = GMTICKET_ASSIGNEDTOGM_STATUS_ASSIGNED;
}
void SetEscalatedStatus(GMTicketEscalationStatus escalatedStatus) { _escalatedStatus = escalatedStatus; }
void SetAssignedToStatus(GMTicketAssignedToGMStatus assignedToStatus) { _assignedToStatus = assignedToStatus; }
void SetCompleted() { _completed = true; }
void SetDescription(std::string const& description)
{
_description = description;
_lastModifiedTime = uint64(time(NULL));
}
void SetViewed() { _viewed = true; }
void SetGmAction(uint32 needResponse, bool needMoreHelp);
void SetViewed() { _openedByGmStatus = GMTICKET_OPENEDBYGM_STATUS_OPENED; }
void SetGmAction(bool needResponse, bool needMoreHelp);
void SetUnassigned() override;
void AppendResponse(std::string const& response) { _response += response; }
@@ -191,9 +191,10 @@ private:
std::string _description;
uint64 _lastModifiedTime;
bool _completed;
GMTicketEscalationStatus _escalatedStatus;
bool _viewed;
bool _needResponse; /// @todo find out the use of this, and then store it in DB
uint8 _category;
GMTicketAssignedToGMStatus _assignedToStatus;
GMTicketOpenedByGMStatus _openedByGmStatus;
bool _needResponse; ///< true if we want a GM to contact us when we open a new ticket (Note: This flag is always true right now)
bool _needMoreHelp;
std::string _response;
std::string _chatLog; // No need to store in db, will be refreshed every session client side

View File

@@ -97,13 +97,15 @@ public:
uint32 ticketId = atoi(args);
GmTicket* ticket = sSupportMgr->GetTicket<GmTicket>(ticketId);
if (!ticket || ticket->IsClosed() || ticket->IsCompleted() || ticket->GetEscalatedStatus() != TICKET_UNASSIGNED)
if (!ticket || ticket->IsClosed() || ticket->IsCompleted() || ticket->GetAssigendToStatus() != GMTICKET_ASSIGNEDTOGM_STATUS_NOT_ASSIGNED)
{
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
ticket->SetEscalatedStatus(TICKET_IN_ESCALATION_QUEUE);
SQLTransaction trans = SQLTransaction(NULL);
ticket->SetAssignedToStatus(GMTICKET_ASSIGNEDTOGM_STATUS_ESCALATED);
ticket->SaveToDB(trans);
if (Player* player = ticket->GetPlayer())
sSupportMgr->SendGmTicket(player->GetSession(), ticket);
@@ -192,6 +194,9 @@ public:
ticket->SetViewed();
ticket->SaveToDB(trans);
if (Player* player = ticket->GetPlayer())
sSupportMgr->SendGmTicket(player->GetSession(), ticket);
handler->SendSysMessage(ticket->FormatViewMessageString(*handler, true).c_str());
return true;
}
@@ -677,6 +682,9 @@ bool ticket_commandscript::HandleTicketUnAssignCommand<GmTicket>(ChatHandler* ha
ticket->SaveToDB(trans);
sSupportMgr->UpdateLastChange();
if (Player* player = ticket->GetPlayer())
sSupportMgr->SendGmTicket(player->GetSession(), ticket);
std::string msg = ticket->FormatViewMessageString(*handler, NULL, assignedTo.c_str(), handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL, NULL);
handler->SendGlobalGMSysMessage(msg.c_str());
@@ -719,6 +727,9 @@ bool ticket_commandscript::HandleTicketGetByIdCommand<GmTicket>(ChatHandler* han
ticket->SetViewed();
ticket->SaveToDB(trans);
if (Player* player = ticket->GetPlayer())
sSupportMgr->SendGmTicket(player->GetSession(), ticket);
handler->SendSysMessage(ticket->FormatViewMessageString(*handler, true).c_str());
return true;
}