Fix "crash" by ".ticket accept" (unable to handled no args) (#165)
* Fix "crash" by ".ticket accept" (unable to handled no args) Fix .ticket info (ticket req Gamemaster+, info req Moderator+) * Added comment on ".ticket accept" * Added comment on ".ticket accept"
This commit is contained in:
parent
76afe71610
commit
fc3f83c334
@ -2433,18 +2433,24 @@ bool ChatHandler::HandleTicketAcceptCommand(char* args)
|
||||
{
|
||||
char* px = ExtractLiteralArg(&args);
|
||||
|
||||
// ticket<end>
|
||||
if (!px)
|
||||
{ return false; }
|
||||
|
||||
// ticket accept on
|
||||
if (strncmp(px, "on", 3) == 0)
|
||||
{
|
||||
sTicketMgr.SetAcceptTickets(true);
|
||||
SendSysMessage(LANG_COMMAND_TICKETS_SYSTEM_ON);
|
||||
}
|
||||
// ticket accept off
|
||||
else if (strncmp(px, "off", 4) == 0)
|
||||
{
|
||||
sTicketMgr.SetAcceptTickets(false);
|
||||
SendSysMessage(LANG_COMMAND_TICKETS_SYSTEM_OFF);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2457,7 +2463,7 @@ bool ChatHandler::HandleTicketCloseCommand(char* args)
|
||||
if (ExtractUInt32(&args, num))
|
||||
{
|
||||
if (num == 0)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
ticket = sTicketMgr.GetGMTicket(num);
|
||||
|
||||
@ -2473,7 +2479,7 @@ bool ChatHandler::HandleTicketCloseCommand(char* args)
|
||||
ObjectGuid target_guid;
|
||||
std::string target_name;
|
||||
if (!ExtractPlayerTarget(&args, NULL, &target_guid, &target_name))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// ticket respond $char_name
|
||||
ticket = sTicketMgr.GetGMTicket(target_guid);
|
||||
@ -2504,11 +2510,12 @@ bool ChatHandler::HandleTicketCloseCommand(char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
// del tickets
|
||||
bool ChatHandler::HandleTicketDeleteCommand(char* args)
|
||||
{
|
||||
char* px = ExtractLiteralArg(&args);
|
||||
if (!px)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// ticket delete all
|
||||
if (strncmp(px, "all", 4) == 0)
|
||||
@ -2520,11 +2527,11 @@ bool ChatHandler::HandleTicketDeleteCommand(char* args)
|
||||
|
||||
uint32 num;
|
||||
|
||||
// ticket delete #id
|
||||
// ticket delete #num
|
||||
if (ExtractUInt32(&px, num))
|
||||
{
|
||||
if (num == 0)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// mgr numbering tickets start from 0
|
||||
GMTicket* ticket = sTicketMgr.GetGMTicket(num);
|
||||
@ -2557,13 +2564,14 @@ bool ChatHandler::HandleTicketDeleteCommand(char* args)
|
||||
ObjectGuid target_guid;
|
||||
std::string target_name;
|
||||
if (!ExtractPlayerTarget(&px, &target, &target_guid, &target_name))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// ticket delete $charName
|
||||
sTicketMgr.Delete(target_guid);
|
||||
|
||||
// notify players about ticket deleting
|
||||
if (target)
|
||||
target->GetSession()->SendGMTicketGetTicket(0x0A);
|
||||
{ target->GetSession()->SendGMTicketGetTicket(0x0A); }
|
||||
|
||||
std::string nameLink = playerLink(target_name);
|
||||
|
||||
@ -2578,9 +2586,9 @@ bool ChatHandler::HandleTicketInfoCommand(char *args)
|
||||
size_t count = sTicketMgr.GetTicketCount();
|
||||
|
||||
if (m_session)
|
||||
PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, GetOnOffStr(m_session->GetPlayer()->isAcceptTickets()));
|
||||
{ PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, GetOnOffStr(m_session->GetPlayer()->isAcceptTickets())); }
|
||||
else
|
||||
PSendSysMessage(LANG_COMMAND_TICKETCOUNT_CONSOLE, count);
|
||||
{ PSendSysMessage(LANG_COMMAND_TICKETCOUNT_CONSOLE, count); }
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2649,7 +2657,7 @@ bool ChatHandler::HandleTicketMeAcceptCommand(char* args)
|
||||
SendSysMessage(LANG_COMMAND_TICKETOFF);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2663,7 +2671,7 @@ bool ChatHandler::HandleTicketRespondCommand(char* args)
|
||||
if (ExtractUInt32(&args, num))
|
||||
{
|
||||
if (num == 0)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// mgr numbering tickets start from 0
|
||||
ticket = sTicketMgr.GetGMTicket(num);
|
||||
@ -2680,7 +2688,7 @@ bool ChatHandler::HandleTicketRespondCommand(char* args)
|
||||
ObjectGuid target_guid;
|
||||
std::string target_name;
|
||||
if (!ExtractPlayerTarget(&args, NULL, &target_guid, &target_name))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// ticket respond $char_name
|
||||
ticket = sTicketMgr.GetGMTicket(target_guid);
|
||||
@ -2695,7 +2703,7 @@ bool ChatHandler::HandleTicketRespondCommand(char* args)
|
||||
|
||||
// no response text?
|
||||
if (!*args)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
ticket->SetResponseText(args);
|
||||
|
||||
@ -2715,13 +2723,13 @@ bool ChatHandler::HandleTicketShowCommand(char *args)
|
||||
// ticket #num
|
||||
char* px = ExtractLiteralArg(&args);
|
||||
if (!px)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
uint32 num;
|
||||
if (ExtractUInt32(&px, num))
|
||||
{
|
||||
if (num == 0)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// mgr numbering tickets start from 0
|
||||
GMTicket* ticket = sTicketMgr.GetGMTicket(num);
|
||||
@ -2739,7 +2747,7 @@ bool ChatHandler::HandleTicketShowCommand(char *args)
|
||||
ObjectGuid target_guid;
|
||||
std::string target_name;
|
||||
if (!ExtractPlayerTarget(&px, NULL, &target_guid, &target_name))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// ticket $char_name
|
||||
GMTicket* ticket = sTicketMgr.GetGMTicket(target_guid);
|
||||
@ -2763,7 +2771,7 @@ bool ChatHandler::HandleTickerSurveyClose(char *args)
|
||||
if (ExtractUInt32(&args, num))
|
||||
{
|
||||
if (num == 0)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
ticket = sTicketMgr.GetGMTicket(num);
|
||||
|
||||
@ -2779,7 +2787,7 @@ bool ChatHandler::HandleTickerSurveyClose(char *args)
|
||||
ObjectGuid target_guid;
|
||||
std::string target_name;
|
||||
if (!ExtractPlayerTarget(&args, NULL, &target_guid, &target_name))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// ticket respond $char_name
|
||||
ticket = sTicketMgr.GetGMTicket(target_guid);
|
||||
|
@ -666,7 +666,7 @@ ChatCommand* ChatHandler::getCommandTable()
|
||||
{ "accept", SEC_ADMINISTRATOR, true, &ChatHandler::HandleTicketAcceptCommand, "", NULL },
|
||||
{ "close", SEC_GAMEMASTER, true, &ChatHandler::HandleTicketCloseCommand, "", NULL },
|
||||
{ "delete", SEC_ADMINISTRATOR, true, &ChatHandler::HandleTicketDeleteCommand, "", NULL },
|
||||
{ "info", SEC_MODERATOR, true, &ChatHandler::HandleTicketInfoCommand, "", NULL },
|
||||
{ "info", SEC_GAMEMASTER, true, &ChatHandler::HandleTicketInfoCommand, "", NULL },
|
||||
{ "list", SEC_GAMEMASTER, true, &ChatHandler::HandleTicketListCommand, "", NULL },
|
||||
{ "meaccept", SEC_GAMEMASTER, true, &ChatHandler::HandleTicketMeAcceptCommand, "", NULL },
|
||||
{ "onlinelist", SEC_GAMEMASTER, true, &ChatHandler::HandleTicketOnlineListCommand, "", NULL },
|
||||
@ -770,7 +770,7 @@ ChatCommand* ChatHandler::getCommandTable()
|
||||
{ "additemset", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAddItemSetCommand, "", NULL },
|
||||
{ "bank", SEC_ADMINISTRATOR, false, &ChatHandler::HandleBankCommand, "", NULL },
|
||||
{ "wchange", SEC_ADMINISTRATOR, false, &ChatHandler::HandleChangeWeatherCommand, "", NULL },
|
||||
{ "ticket", SEC_GAMEMASTER, true, NULL, "", ticketCommandTable },
|
||||
{ "ticket", SEC_GAMEMASTER, false, NULL, "", ticketCommandTable },
|
||||
{ "maxskill", SEC_ADMINISTRATOR, false, &ChatHandler::HandleMaxSkillCommand, "", NULL },
|
||||
{ "setskill", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSetSkillCommand, "", NULL },
|
||||
{ "whispers", SEC_MODERATOR, false, &ChatHandler::HandleWhispersCommand, "", NULL },
|
||||
|
Loading…
x
Reference in New Issue
Block a user