void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) { /// Catergories are marked with int in database /// Category 0 - Item /// Category 1 - Behaviour/Harassment /// Category 2 - Guild /// Category 3 - Character /// Category 4 - Non-Quest/Creep /// Category 5 - Stuck /// Category 6 - Environmental /// Category 7 - Quest/Quest-NPC /// Category 8 - Account/Billing WorldPacket data; uint64 guid; guid = GetPlayer()->GetGUID(); std::string ticketText = ""; char * p, p1[512]; uint8 buf[516]; int cat[] = { 0,5,1,2,0,6,4,7,0,8,3 }; memcpy( buf, recv_data.contents(), sizeof buf < recv_data.size() ? sizeof buf : recv_data.size() ); buf[272] = 0; p = (char *)buf + 17; my_esc( p1, (const char *)buf + 17 ); std::stringstream ss; ticketText = p1; ss << "INSERT INTO `gmtickets` VALUES ('','" << guid << "', '" << ticketText << "', '" << cat[buf[0]] << "')"; sDatabase.Execute( ss.str( ).c_str( ) ); data.Initialize( SMSG_GMTICKET_CREATE ); data << uint32(2); SendPacket( &data ); }
void my_game(t_game *game) { struct termios termios; t_term *term; game->x = 0; game->y = 0; term = malloc(sizeof(*term)); init_term(term); set_getattr(term->fo, &termios); my_refresh(game, term); while ((game->fileread = read(0, game->buffer, 6))) { if (game->player1 == 1) my_keys(game, &termios, term); else if (game->player2 == 1) my_keys(game, &termios, term); if (game->buffer[0] == 10) my_enter(game); if (game->buffer[0] == 27 && game->fileread == 1) my_esc(term, &termios); my_refresh(game, term); } termios.c_lflag |= (ICANON | ECHO); tcsetattr(term->fo, TCSADRAIN, &termios); }
void WorldSession::HandleGMTicketUpdateTextOpcode( WorldPacket & recv_data ) { WorldPacket data; uint64 guid = GetPlayer()->GetGUID(); std::string ticketText = ""; char * p, p1[512]; uint8 buf[516]; memcpy( buf, recv_data.contents(), sizeof buf <recv_data.size() ? sizeof buf : recv_data.size() ); p = (char *)buf + 1; my_esc( p1, (const char *)buf + 1 ); std::stringstream ss; ticketText = p1; ss << "UPDATE `gmtickets` set ticket_text = '" << ticketText << "' WHERE guid = '" << guid << "'"; sDatabase.Execute( ss.str( ).c_str( ) ); }