예제 #1
0
void WorldSession::HandleQueryTimeOpcode(WorldPacket & /*recvData*/)
{
    SendQueryTimeResponse();
}
void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data)
{
    // 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(GetDarkmoonCoreString(LANG_TICKET_REQ), sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ));
        return;
    }

    if (sTicketMgr->GetGMTicketByPlayer(GetPlayer()->GetGUID()))
    {
        WorldPacket data(SMSG_GMTICKET_CREATE, 4);
        data << uint32(GMTICKET_RESPONSE_FAILURE); // You already have GM ticket
        SendPacket(&data);
        return;
    }

    uint32 map, unk, unk1, unk2;
    uint8 needResponse; // ignored
    float x, y, z;
    std::string ticketText, ticketText2;

    SendQueryTimeResponse();

    recv_data >> map;
    recv_data >> x;
    recv_data >> y;
    recv_data >> z;
    recv_data >> ticketText;
    recv_data >> unk;          // not sure what this is... replyTo?
    recv_data >> needResponse; // always 1/0 -- not sure what retail does with this
    recv_data >> unk1;
    recv_data >> unk2;

    GM_Ticket *ticket = new GM_Ticket;
    ticket->name = GetPlayer()->GetName();
    ticket->guid = sTicketMgr->GenerateGMTicketId();
    ticket->playerGuid = GetPlayer()->GetGUID();
    ticket->message = ticketText;
    ticket->createtime = time(NULL);
    ticket->map = map;
    ticket->pos_x = x;
    ticket->pos_y = y;
    ticket->pos_z = z;
    ticket->timestamp = time(NULL);
    ticket->closed = 0;
    ticket->assignedToGM = 0;
    ticket->comment = "";
    ticket->completed = false;
    ticket->escalated = TICKET_UNASSIGNED;
    ticket->response = "";

    sTicketMgr->AddOrUpdateGMTicket(*ticket, true);

    WorldPacket data(SMSG_GMTICKET_CREATE, 4);
    data << uint32(GMTICKET_RESPONSE_SUCCESS);
    SendPacket(&data);

    sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName(), ticket->guid);
}