Advertisement
Guest User

Untitled

a guest
Sep 4th, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.35 KB | None | 0 0
  1. void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recvData*/)
  2. {
  3.     if(++protectedPacketsCounter[PACKET_CMSG_CHAR_ENUM] >= 3)
  4.     {
  5.         std::ostringstream ss;
  6.             if(protectedPacketsCounter[PACKET_CMSG_CHAR_ENUM] < 5 || protectedPacketsCounter[PACKET_CMSG_CHAR_ENUM] % 25 == 0)
  7.             {
  8.                 ss << "[Overflood Protection] : Session with ";
  9.                 ss << "IP address ";
  10.                 ss << GetRemoteAddress();
  11.                 ss << " triggered OverFlood Protection for packet CMSG_CHAR_ENUM. info : ";
  12.                 ss << "Account ID : ";
  13.                 ss << GetAccountId();
  14.                 ss << " Account Name : ";
  15.                 std::string accountName;
  16.                 sAccountMgr->GetName(GetAccountId(), accountName);
  17.                 ss << accountName;
  18.                 ss << " Player Name : ";
  19.                 if(GetPlayer() && GetPlayer()->IsInWorld())
  20.                     ss << GetPlayer()->GetName();
  21.                 else
  22.                     ss << " No Name ( not logged in )";
  23.                 ss << " current packet count : ";
  24.                 ss << (uint32)protectedPacketsCounter[PACKET_CMSG_CHAR_ENUM];
  25.                 ss << ", ignoring.";
  26.                 sLog->outError(LOG_FILTER_GENERAL, ss.str().c_str());
  27.             }
  28.         return;
  29.     }
  30.     // remove expired bans
  31.     PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS);
  32.     CharacterDatabase.Execute(stmt);
  33.  
  34.     /// get all the data necessary for loading all characters (along with their pets) on the account
  35.  
  36.     if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED))
  37.         stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ENUM_DECLINED_NAME);
  38.     else
  39.         stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ENUM);
  40.  
  41.     stmt->setUInt8(0, PET_SAVE_AS_CURRENT);
  42.     stmt->setUInt32(1, GetAccountId());
  43.  
  44.     _charEnumCallback = CharacterDatabase.AsyncQuery(stmt);
  45. }
  46. {
  47.     AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, false);
  48.  
  49.     // remove expired bans
  50.     PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS);
  51.     CharacterDatabase.Execute(stmt);
  52.  
  53.     /// get all the data necessary for loading all characters (along with their pets) on the account
  54.  
  55.     if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED))
  56.         stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ENUM_DECLINED_NAME);
  57.     else
  58.         stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ENUM);
  59.  
  60.     stmt->setUInt8(0, PET_SAVE_AS_CURRENT);
  61.     stmt->setUInt32(1, GetAccountId());
  62.  
  63.     _charEnumCallback = CharacterDatabase.AsyncQuery(stmt);
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement