本文整理汇总了C++中GmTicket::GetId方法的典型用法代码示例。如果您正苦于以下问题:C++ GmTicket::GetId方法的具体用法?C++ GmTicket::GetId怎么用?C++ GmTicket::GetId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GmTicket
的用法示例。
在下文中一共展示了GmTicket::GetId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleGMTicketCloseByIdCommand
bool ChatHandler::HandleGMTicketCloseByIdCommand(const char* args)
{
if (!*args)
return false;
uint32 ticketId = atoi(args);
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
{
SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
// Ticket must be assigned to player, who tries to close it.
uint64 guid = m_session->GetPlayer()->GetGUID();
if (ticket->IsAssignedNotTo(guid))
{
PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
return true;
}
sTicketMgr->CloseTicket(ticket->GetId(), guid);
sTicketMgr->UpdateLastChange();
std::string msg = ticket->FormatMessageString(*this, m_session->GetPlayer()->GetName(), NULL, NULL, NULL);
SendGlobalGMSysMessage(msg.c_str());
// Inform player, who submitted this ticket, that it is closed
if (Player* player = ticket->GetPlayer())
if (player->IsInWorld())
{
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
player->GetSession()->SendPacket(&data);
}
return true;
}
示例2: HandleGMTicketAssignToCommand
static bool HandleGMTicketAssignToCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
char* ticketIdStr = strtok((char*)args, " ");
uint32 ticketId = atoi(ticketIdStr);
char* targetStr = strtok(NULL, " ");
if (!targetStr)
return false;
std::string target(targetStr);
if (!normalizePlayerName(target))
return false;
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
if (!ticket || ticket->IsClosed())
{
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target);
uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
uint32 targetGmLevel = AccountMgr::GetSecurity(accountId, realmID);
// Target must exist and have administrative rights
if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel))
{
handler->SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
return true;
}
// If already assigned, leave
if (ticket->IsAssignedTo(targetGuid))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->GetId());
return true;
}
// If assigned to different player other than current, leave
//! Console can override though
Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str());
return true;
}
// Assign ticket
SQLTransaction trans = SQLTransaction(NULL);
ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(AccountMgr::GetSecurity(accountId, realmID)));
ticket->SaveToDB(trans);
sTicketMgr->UpdateLastChange();
std::string msg = ticket->FormatMessageString(*handler, NULL, target.c_str(), NULL, NULL);
handler->SendGlobalGMSysMessage(msg.c_str());
return true;
}
示例3: HandleGMTicketCreateOpcode
void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
{
// Don't accept tickets if the ticket queue is disabled. (Ticket UI is greyed out but not fully dependable)
if (sTicketMgr->GetStatus() == GMTICKET_QUEUE_STATUS_DISABLED)
return;
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 (!ticket || ticket->IsClosed())
{
std::string message;
std::string chatLog;
uint8 ticketType;
uint32 mapId;
float x, y, z;
std::string ticketText = "";
std::string reservedForFutureUse = "";
recvData >> ticketType >> mapId >> x >> y >> z; // last check 2.4.3
recvData >> ticketText;
recvData >> reservedForFutureUse;
if (GetPlayer()->getLevel() < sWorld.getConfig(CONFIG_UINT32_GMTICKETS_MINLEVEL))
{
ChatHandler(this).PSendSysMessage("You can't use the ticket system before level %u", sWorld.getConfig(CONFIG_UINT32_GMTICKETS_MINLEVEL));
return;
}
if (ticketType >= GMTICKET_MAX)
return;
if (ticketType != GMTICKET_BEHAVIOR_HARASSMENT && ticketType != GMTICKET_STUCK)
{
ChatHandler(this).SendSysMessage("Game Masters do not handle bug reports.");
ChatHandler(this).SendSysMessage("Please use our bugtracker and provide sources if possible.");
ChatHandler(this).SendSysMessage("https://elysium-project.org/bugtracker");
return;
}
ticket = new GmTicket(GetPlayer());
ticket->SetPosition(mapId, x, y, z);
ticket->SetMessage(ticketText);
ticket->SetTicketType(TicketType(ticketType));
sTicketMgr->AddTicket(ticket);
sTicketMgr->UpdateLastChange();
sWorld.SendGMTicketText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName(), ticket->GetId());
response = GMTICKET_RESPONSE_CREATE_SUCCESS;
}
示例4: HandleGMTicketAssignToCommand
bool ChatHandler::HandleGMTicketAssignToCommand(const char* args)
{
if(!*args)
return false;
char* sTicketId = strtok((char*)args, " ");
uint32 ticketId = atoi(sTicketId);
char* sTarget = strtok(NULL, " ");
if(!sTarget)
return false;
std::string target(sTarget);
if(!normalizePlayerName(target))
return false;
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
if(!ticket || ticket->IsClosed())
{
SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
// Get target information
uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str());
uint64 targetAccId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
uint32 targetGmLevel = sAccountMgr->GetSecurity(targetAccId, realmID);
// Target must exist and have administrative rights
if(!targetGuid || targetGmLevel == SEC_PLAYER)
{
SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
return true;
}
// If already assigned, leave
if(ticket->IsAssignedTo(targetGuid))
{
PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->GetId());
return true;
}
// If assigned to different player other than current, leave
Player* player = m_session->GetPlayer();
if(ticket->IsAssignedNotTo(player->GetGUID()))
{
PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str());
return true;
}
// Assign ticket
SQLTransaction trans = SQLTransaction(NULL);
ticket->SetAssignedTo(targetGuid, targetGmLevel == SEC_ADMINISTRATOR);
ticket->SaveToDB(trans);
sTicketMgr->UpdateLastChange();
std::string msg = ticket->FormatMessageString(*this, NULL, target.c_str(), NULL, NULL);
SendGlobalGMSysMessage(msg.c_str());
return true;
}
示例5: HandleGMTicketCloseByIdCommand
static bool HandleGMTicketCloseByIdCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
uint32 ticketId = atoi(args);
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
{
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
// Ticket should be assigned to the player who tries to close it.
// Console can override though
Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
return true;
}
sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : ObjectGuid(uint64(-1)));
sTicketMgr->UpdateLastChange();
std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL, NULL);
handler->SendGlobalGMSysMessage(msg.c_str());
if ((sIRC->TICMASK & 16) != 0 && (sIRC->BOTMASK & 1024) != 0 && sIRC->ticann.size() > 0)
{
std::string ircchan = "#";
std::ostringstream smsg;
std::string assignedto;
// If closed from console,there is no player,so we assign to Console.
if (player)
assignedto = player->GetName().c_str();
else assignedto = "Console";
ircchan += sIRC->ticann;
smsg << "[\00304Ticket Closed\003][By:\00304 " << ticket->GetPlayerName().c_str() << " \003][ID: \00304" << ticket->GetId() << " \003][Closed By: \00304" << assignedto << " \003]";
sIRC->Send_IRC_Channel(ircchan, smsg.str().c_str() , true);
}
// Inform player, who submitted this ticket, that it is closed
if (Player* submitter = ticket->GetPlayer())
{
if (submitter->IsInWorld())
{
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
submitter->GetSession()->SendPacket(&data);
}
}
return true;
}
示例6: HandleGMTicketDeleteByIdCommand
static bool HandleGMTicketDeleteByIdCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
uint32 ticketId = atoi(args);
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
if (!ticket)
{
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
if (!ticket->IsClosed())
{
handler->SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST);
return true;
}
std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL);
handler->SendGlobalGMSysMessage(msg.c_str());
sTicketMgr->RemoveTicket(ticket->GetId());
sTicketMgr->UpdateLastChange();
if (Player* player = ticket->GetPlayer())
{
// Force abandon ticket
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
player->GetSession()->SendPacket(&data);
}
return true;
}
示例7: _HandleGMTicketResponseAppendCommand
inline bool ChatHandler::_HandleGMTicketResponseAppendCommand(const char* args, bool newLine)
{
if (!*args)
return false;
char* sTicketId = strtok((char*)args, " ");
uint32 ticketId = atoi(sTicketId);
char* response = strtok(NULL, "\n");
if (!response)
return false;
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
if (!ticket || !ticket->IsClosed())
{
PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
// Cannot add response to ticket, assigned to someone else
Player* player = m_session->GetPlayer();
if (ticket->IsAssignedNotTo(player->GetGUID()))
{
PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
return true;
}
SQLTransaction trans = SQLTransaction(NULL);
ticket->AppendResponse(response);
if (newLine)
ticket->AppendResponse("\n");
ticket->SaveToDB(trans);
return true;
}
示例8: HandleGMTicketCreateOpcode
void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
{
// Don't accept tickets if the ticket queue is disabled. (Ticket UI is greyed out but not fully dependable)
if (sTicketMgr->GetStatus() == GMTICKET_QUEUE_STATUS_DISABLED)
return;
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ))
{
SendNotification(GetTrinityString(LANG_TICKET_REQ), sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ));
return;
}
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 (!ticket || ticket->IsClosed())
{
uint32 mapId;
float x, y, z;
std::string message;
uint32 needResponse;
bool needMoreHelp;
uint32 count;
std::list<uint32> times;
uint32 decompressedSize;
std::string chatLog;
recvData >> mapId;
recvData >> x >> y >> z;
recvData >> message;
recvData >> needResponse;
recvData >> needMoreHelp;
recvData >> count;
for (uint32 i = 0; i < count; i++)
{
uint32 time;
recvData >> time;
times.push_back(time);
}
recvData >> decompressedSize;
if (count && decompressedSize && decompressedSize < 0xFFFF)
{
uint32 pos = recvData.rpos();
ByteBuffer dest;
dest.resize(decompressedSize);
uLongf realSize = decompressedSize;
if (uncompress(dest.contents(), &realSize, recvData.contents() + pos, recvData.size() - pos) == Z_OK)
{
dest >> chatLog;
}
示例9: HandleGMTicketCreateOpcode
void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recvData)
{
// Don't accept tickets if the ticket queue is disabled. (Ticket UI is greyed out but not fully dependable)
if (sTicketMgr->GetStatus() == GMTICKET_QUEUE_STATUS_DISABLED)
return;
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ))
{
SendNotification(GetTrinityString(LANG_TICKET_REQ), sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ));
return;
}
GMTicketResponse response = GMTICKET_RESPONSE_CREATE_ERROR;
// Player must not have ticket
if (!sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
{
GmTicket* ticket = new GmTicket(GetPlayer(), recvData);
sTicketMgr->AddTicket(ticket);
sTicketMgr->UpdateLastChange();
sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName(), ticket->GetId());
response = GMTICKET_RESPONSE_CREATE_SUCCESS;
}
WorldPacket data(SMSG_GM_TICKET_CREATE, 4);
data << uint32(response);
SendPacket(&data);
}
示例10: HandleGMTicketCreateOpcode
void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
{
// Don't accept tickets if the ticket queue is disabled. (Ticket UI is greyed out but not fully dependable)
if (sTicketMgr->GetStatus() == GMTICKET_QUEUE_STATUS_DISABLED)
return;
if(!GetPlayer()->CanSpeak())
{
std::string timeStr = secsToTimeString(m_muteTime - time(NULL));
SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
return;
}
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ))
{
SendNotification(GetTrinityString(LANG_TICKET_REQ), sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ));
return;
}
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 (!ticket || ticket->IsClosed())
{
ticket = new GmTicket(GetPlayer(), recvData);
uint32 count;
std::list<uint32> times;
uint32 decompressedSize;
std::string chatLog;
recvData >> count;
for (uint32 i = 0; i < count; i++)
{
uint32 time;
recvData >> time;
times.push_back(time);
}
recvData >> decompressedSize;
if (count && decompressedSize && decompressedSize < 0xFFFF)
{
uint32 pos = recvData.rpos();
ByteBuffer dest;
dest.resize(decompressedSize);
uLongf realSize = decompressedSize;
if (uncompress(dest.contents(), &realSize, recvData.contents() + pos, recvData.size() - pos) == Z_OK)
{
dest >> chatLog;
ticket->SetChatLog(times, chatLog);
}
示例11: HandleGMTicketUnAssignCommand
static bool HandleGMTicketUnAssignCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
uint32 ticketId = atoi(args);
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
// Ticket must exist and not be closed.
if (!ticket || ticket->IsClosed())
{
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
// Ticket must be assigned.
if (!ticket->IsAssigned())
{
handler->PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->GetId());
return true;
}
// Get security level of player, whom this ticket is assigned to
uint32 security = SEC_PLAYER;
Player* assignedPlayer = ticket->GetAssignedPlayer();
if (assignedPlayer && assignedPlayer->IsInWorld())
security = assignedPlayer->GetSession()->GetSecurity();
else
{
uint64 guid = ticket->GetAssignedToGUID();
uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid);
security = AccountMgr::GetSecurity(accountId, realmID);
}
// Check security. If no m_session present it means we're issuing this command from the console.
uint32 mySecurity = handler->GetSession() ? handler->GetSession()->GetSecurity() : SEC_CONSOLE;
if (security > mySecurity)
{
handler->SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY);
return true;
}
// Set the ticket as unassigned and the text and save it.
SQLTransaction trans = SQLTransaction(NULL);
ticket->SetUnassigned();
ticket->SetResponse("Your ticket will be serviced shortly.");
ticket->SaveToDB(trans);
// Update the last change time.
sTicketMgr->UpdateLastChange();
std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(),
handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName() : "Console", NULL);
handler->SendGlobalGMSysMessage(msg.c_str());
return true;
}
示例12: HandleGMTicketCloseByIdCommand
static bool HandleGMTicketCloseByIdCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
uint32 ticketId = atoi(args);
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
{
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
// Ticket should be assigned to the player who tries to close it.
// Console can override though
Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
return true;
}
ObjectGuid closedByGuid;
if (player)
closedByGuid = player->GetGUID();
else
closedByGuid.SetRawValue(0, uint64(-1));
sTicketMgr->CloseTicket(ticket->GetId(), closedByGuid);
sTicketMgr->UpdateLastChange();
std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL, NULL);
handler->SendGlobalGMSysMessage(msg.c_str());
// Inform player, who submitted this ticket, that it is closed
if (Player* submitter = ticket->GetPlayer())
{
WorldPacket data(SMSG_GM_TICKET_UPDATE, 4);
data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
submitter->GetSession()->SendPacket(&data);
}
return true;
}
示例13: HandleGMTicketCreateOpcode
void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
{
// Don't accept tickets if the ticket queue is disabled. (Ticket UI is greyed out but not fully dependable)
if (sTicketMgr->GetStatus() == GMTICKET_QUEUE_STATUS_DISABLED)
return;
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ))
{
SendNotification(GetTrinityString(LANG_TICKET_REQ), sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ));
return;
}
GMTicketResponse response = GMTICKET_RESPONSE_CREATE_ERROR;
// Player must not have opened ticket
if (GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
{
if (ticket->IsCompleted())
{
sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID());
sTicketMgr->SendTicket(this, NULL);
WorldPacket data(SMSG_GM_RESPONSE_STATUS_UPDATE, 4);
data << uint8(GMTICKET_RESPONSE_TICKET_DELETED);
SendPacket(&data);
GmTicket* newTicket = new GmTicket(GetPlayer(), recvData);
sTicketMgr->AddTicket(newTicket);
sTicketMgr->UpdateLastChange();
sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName().c_str(), newTicket->GetId());
sTicketMgr->SendTicket(this, newTicket);
response = GMTICKET_RESPONSE_CREATE_SUCCESS;
}
else
response = GMTICKET_RESPONSE_ALREADY_EXIST;
}
else
{
GmTicket* newTicket = new GmTicket(GetPlayer(), recvData);
sTicketMgr->AddTicket(newTicket);
sTicketMgr->UpdateLastChange();
sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName().c_str(), newTicket->GetId());
sTicketMgr->SendTicket(this, newTicket);
response = GMTICKET_RESPONSE_CREATE_SUCCESS;
}
WorldPacket data(SMSG_GM_RESPONSE_STATUS_UPDATE, 1);
data << uint8(response);
SendPacket(&data);
}
示例14: HandleGMTicketCloseByIdCommand
static bool HandleGMTicketCloseByIdCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
uint32 ticketId = atoi(args);
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
// Ticket must exist and not be closed.
if (!ticket || ticket->IsClosed())
{
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
// Ticket should be assigned to the player who tries to close it. Console can override though.
Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
if (player && ticket->IsAssignedNotTo(player->GetGUID()))
{
handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
return true;
}
sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1);
sTicketMgr->UpdateLastChange();
std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName() : "Console", NULL, NULL, NULL);
handler->SendGlobalGMSysMessage(msg.c_str());
// Inform the player that the ticket is closed (remove it).
if (Player* submitter = ticket->GetPlayer())
{
if (submitter->IsInWorld())
{
sTicketMgr->SendTicketStatusUpdate(submitter->GetSession(), GMTICKET_RESPONSE_TICKET_DELETED);
sTicketMgr->SendTicket(submitter->GetSession(), NULL);
}
}
return true;
}
示例15: HandleGMTicketDeleteByIdCommand
static bool HandleGMTicketDeleteByIdCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
uint32 ticketId = atoi(args);
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
if (!ticket)
{
handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
return true;
}
if (!ticket->IsClosed())
{
handler->SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST);
return true;
}
std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL);
handler->SendGlobalGMSysMessage(msg.c_str());
if ((sIRC->TICMASK & 16) != 0 && (sIRC->BOTMASK & 1024) != 0 && sIRC->ticann.size() > 0)
{
std::string ircchan = "#";
std::ostringstream smsg;
std::string deletedby;
// If deleted from console,there is no player,so we assign to Console.
Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
if (player)
deletedby = player->GetName().c_str();
else deletedby = "Console";
ircchan += sIRC->ticann;
smsg << "[\00304Ticket Deleted\003][By:\00304 " << ticket->GetPlayerName().c_str() << " \003][ID: \00304" << ticket->GetId() << " \003][Deleted By: \00304" << deletedby << " \003]";
sIRC->Send_IRC_Channel(ircchan, smsg.str().c_str() , true);
}
sTicketMgr->RemoveTicket(ticket->GetId());
sTicketMgr->UpdateLastChange();
if (Player* player = ticket->GetPlayer())
{
if (player->IsInWorld())
{
// Force abandon ticket
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
player->GetSession()->SendPacket(&data);
}
}
return true;
}