daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  // remove expired bans
  2.     PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS);
  3.     CharacterDatabase.Execute(stmt);
  4.  
  5.     /// get all the data necessary for loading all characters (along with their pets) on the account
  6.  
  7.     if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED))
  8.         stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ENUM_DECLINED_NAME);
  9.     else
  10.         stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ENUM);
  11.  
  12.     stmt->setUInt8(0, PET_SAVE_AS_CURRENT);
  13.     stmt->setUInt32(1, GetAccountId());
  14.  
  15.     _charEnumCallback = CharacterDatabase.AsyncQuery(stmt);
  16. }
  17.  
  18. void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
  19. {
  20.     CharacterCreateInfo createInfo;
  21.  
  22.     recvData >> createInfo.Name
  23.              >> createInfo.Race
  24.              >> createInfo.Class
  25.              >> createInfo.Gender
  26.              >> createInfo.Skin
  27.              >> createInfo.Face
  28.              >> createInfo.HairStyle
  29.              >> createInfo.HairColor
  30.              >> createInfo.FacialHair
  31.              >> createInfo.OutfitId;
  32.  
  33.     if (!HasPermission(rbac::RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_TEAMMASK))
  34.     {
  35.         if (uint32 mask = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED))
  36.         {
  37.             bool disabled = false;
  38.  
  39.             switch (Player::TeamForRace(createInfo.Race))
  40.             {
  41.                 case ALLIANCE:
  42.                     disabled = (mask & (1 << 0)) != 0;
  43.                     break;
  44.                 case HORDE:
  45.                     disabled = (mask & (1 << 1)) != 0;
  46.                     break;
  47.             }
  48.  
  49.             if (disabled)
  50.             {
  51.                 SendCharCreate(CHAR_CREATE_DISABLED);
  52.                 return;
  53.             }
  54.         }
  55.     }
  56.  
  57.     ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(createInfo.Class);
  58.     if (!classEntry)
  59.     {
  60.         TC_LOG_ERROR("network", "Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", createInfo.Class, GetAccountId());
  61.         SendCharCreate(CHAR_CREATE_FAILED);
  62.         return;
  63.     }
  64.  
  65.     ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(createInfo.Race);
  66.     if (!raceEntry)
  67.     {
  68.         TC_LOG_ERROR("network", "Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", createInfo.Race, GetAccountId());
  69.         SendCharCreate(CHAR_CREATE_FAILED);
  70.         return;
  71.     }
  72.  
  73.     // prevent character creating Expansion race without Expansion account
  74.     if (raceEntry->expansion > Expansion())
  75.     {
  76.         TC_LOG_ERROR("network", "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, createInfo.Race);
  77.         SendCharCreate(CHAR_CREATE_EXPANSION);
  78.         return;
  79.     }
  80.  
  81.     // prevent character creating Expansion class without Expansion account
  82.     if (classEntry->expansion > Expansion())
  83.     {
  84.         TC_LOG_ERROR("network", "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, createInfo.Class);
  85.         SendCharCreate(CHAR_CREATE_EXPANSION_CLASS);
  86.         return;
  87.     }
  88.  
  89.     if (!HasPermission(rbac::RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RACEMASK))
  90.     {
  91.         uint32 raceMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK);
  92.         if ((1 << (createInfo.Race - 1)) & raceMaskDisabled)
  93.         {
  94.             SendCharCreate(CHAR_CREATE_DISABLED);
  95.             return;
  96.         }
  97.     }
  98.  
  99.     if (!HasPermission(rbac::RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_CLASSMASK))
  100.     {
  101.         uint32 classMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK);
  102.         if ((1 << (createInfo.Class - 1)) & classMaskDisabled)
  103.         {
  104.             SendCharCreate(CHAR_CREATE_DISABLED);
  105.             return;
  106.         }
  107.     }
RAW Paste Data
Top