Fix .ticket surveyclose (#125)

This commit is contained in:
Elmsroth 2020-12-30 17:54:00 +01:00 committed by GitHub
parent 99cc20629e
commit e242f1b7cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -545,7 +545,8 @@ bool ChatHandler::HandleTicketShowCommand(char* args)
bool ChatHandler::HandleTickerSurveyClose(char* args) bool ChatHandler::HandleTickerSurveyClose(char* args)
{ {
GMTicket* ticket = NULL; GMTicket* ticket = NULL;
std::string target_name;
ObjectGuid target_guid;
uint32 num; uint32 num;
if (ExtractUInt32(&args, num)) if (ExtractUInt32(&args, num))
{ {
@ -565,8 +566,7 @@ bool ChatHandler::HandleTickerSurveyClose(char* args)
} }
else else
{ {
ObjectGuid target_guid;
std::string target_name;
if (!ExtractPlayerTarget(&args, NULL, &target_guid, &target_name)) if (!ExtractPlayerTarget(&args, NULL, &target_guid, &target_name))
{ {
return false; return false;
@ -583,6 +583,7 @@ bool ChatHandler::HandleTickerSurveyClose(char* args)
} }
} }
uint32 ticketId = ticket->GetId();
ticket->CloseWithSurvey(); ticket->CloseWithSurvey();
//This needs to be before we delete the ticket //This needs to be before we delete the ticket
@ -599,7 +600,9 @@ bool ChatHandler::HandleTickerSurveyClose(char* args)
sTicketMgr.Delete(ticket->GetPlayerGuid()); sTicketMgr.Delete(ticket->GetPlayerGuid());
ticket = NULL; ticket = NULL;
PSendSysMessage(LANG_COMMAND_TICKETCLOSED_NAME, pPlayer->GetName()); const char* gmNameReplacementWhenUsingCLI = "ADMIN";
PSendSysMessage(LANG_COMMAND_TICKETCLOSED_NAME, ticketId, target_name.c_str(), m_session ? m_session->GetPlayer()->GetName() : gmNameReplacementWhenUsingCLI);
return true; return true;
} }