Core/Tickets

* Fixed .ticket complete command not marking tickets as completed
* Fixed "Need more help" button functionality after ticket has been answered by a GM

Closes #9383
This commit is contained in:
illusion
2013-05-11 11:19:57 +02:00
committed by Shauren
parent 77d4acc776
commit f4b83273ec
4 changed files with 22 additions and 6 deletions

View File

@@ -41,10 +41,15 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
}
GMTicketResponse response = GMTICKET_RESPONSE_CREATE_ERROR;
GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID());
if (ticket && ticket->IsCompleted())
sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID());;
// Player must not have ticket
if (!sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
if (!ticket || ticket->IsClosed())
{
GmTicket* ticket = new GmTicket(GetPlayer(), recvData);
ticket = new GmTicket(GetPlayer(), recvData);
uint32 count;
std::list<uint32> times;

View File

@@ -239,7 +239,10 @@ void GmTicket::SetChatLog(std::list<uint32> time, std::string const& log)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Ticket manager
TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0), _lastChange(time(NULL)) { }
TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0),
_lastChange(time(NULL))
{
}
TicketMgr::~TicketMgr()
{
@@ -247,7 +250,10 @@ TicketMgr::~TicketMgr()
delete itr->second;
}
void TicketMgr::Initialize() { SetStatus(sWorld->getBoolConfig(CONFIG_ALLOW_TICKETS)); }
void TicketMgr::Initialize()
{
SetStatus(sWorld->getBoolConfig(CONFIG_ALLOW_TICKETS));
}
void TicketMgr::ResetTickets()
{

View File

@@ -82,7 +82,7 @@ class GmTicket
{
public:
GmTicket();
explicit GmTicket(Player* player, WorldPacket& recvData);
GmTicket(Player* player, WorldPacket& recvData);
~GmTicket();
bool IsClosed() const { return _closedBy; }
@@ -119,7 +119,8 @@ public:
else if (_escalatedStatus == TICKET_UNASSIGNED)
_escalatedStatus = TICKET_ASSIGNED;
}
void SetClosedBy(const int64& value) { _closedBy = value; }
void SetClosedBy(int64 value) { _closedBy = value; }
void SetCompleted() { _completed = true; }
void SetMessage(std::string const& message)
{
_message = message;

View File

@@ -235,6 +235,10 @@ public:
if (player->IsInWorld())
ticket->SendResponse(player->GetSession());
SQLTransaction trans = SQLTransaction(NULL);
ticket->SetCompleted();
ticket->SaveToDB(trans);
sTicketMgr->UpdateLastChange();
return true;
}