aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShinDarth <borzifrancesco@gmail.com>2015-09-14 23:08:33 +0200
committerShinDarth <borzifrancesco@gmail.com>2015-09-14 23:27:25 +0200
commitbbaa7f0d7341d692b58930ebb96b7b46b391c75c (patch)
treeeaf491b221f5c07ca8497f2d2edbc6e2e054af84 /src
parent2138726e61f83eea76634372e8cb1b4452e0f84d (diff)
Scripts/Commands enhance .ticket complete command
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Commands/cs_ticket.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp
index 5fc3cc618e5..b609dfe18dd 100644
--- a/src/server/scripts/Commands/cs_ticket.cpp
+++ b/src/server/scripts/Commands/cs_ticket.cpp
@@ -113,7 +113,7 @@ public:
// If assigned to different player other than current, leave
//! Console can override though
- Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str());
@@ -146,7 +146,7 @@ public:
// Ticket should be assigned to the player who tries to close it.
// Console can override though
- Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
@@ -190,7 +190,7 @@ public:
// Cannot comment ticket assigned to someone else
//! Console excluded
- Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
@@ -220,7 +220,9 @@ public:
if (!*args)
return false;
- uint32 ticketId = atoi(args);
+ char* ticketIdStr = strtok((char*)args, " ");
+ uint32 ticketId = atoi(ticketIdStr);
+
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
{
@@ -228,6 +230,21 @@ public:
return true;
}
+ char* response = strtok(NULL, "\n");
+ if (response)
+ {
+ // Cannot add response to ticket, assigned to someone else
+ //! Console excluded
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
+ if (player && ticket->IsAssignedNotTo(player->GetGUID()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
+ return true;
+ }
+
+ ticket->AppendResponse(response);
+ }
+
if (Player* player = ticket->GetPlayer())
ticket->SendResponse(player->GetSession());
@@ -476,7 +493,7 @@ public:
// Cannot add response to ticket, assigned to someone else
//! Console excluded
- Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());