Advertisement
Guest User

Untitled

a guest
May 24th, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.20 KB | None | 0 0
  1. void ProtocolGame::sendOutfitWindow()
  2. {
  3.     const auto& outfits = Outfits::getInstance().getOutfits(player->getSex());
  4.     if (outfits.size() == 0) {
  5.         return;
  6.     }
  7.  
  8.     NetworkMessage msg;
  9.     msg.addByte(0xC8);
  10.  
  11.     Outfit_t currentOutfit = player->getDefaultOutfit();
  12.     if (currentOutfit.lookType == 0) {
  13.         Outfit_t newOutfit;
  14.         newOutfit.lookType = outfits.front().lookType;
  15.         currentOutfit = newOutfit;
  16.     }
  17.  
  18.     /*Mount* currentMount = g_game.mounts.getMountByID(player->getCurrentMount());
  19.     if (currentMount) {
  20.         currentOutfit.lookMount = currentMount->clientId;
  21.     }*/
  22.  
  23.     AddOutfit(msg, currentOutfit);
  24.  
  25.     std::vector<ProtocolOutfit> protocolOutfits;
  26.     if (player->isAccessPlayer()) {
  27.         static const std::string gamemasterOutfitName = "Gamemaster";
  28.         protocolOutfits.emplace_back(gamemasterOutfitName, 75, 0);
  29.     }
  30.  
  31.     protocolOutfits.reserve(outfits.size());
  32.     for (const Outfit& outfit : outfits) {
  33.         uint8_t addons;
  34.         if (!player->getOutfitAddons(outfit, addons)) {
  35.             continue;
  36.         }
  37.  
  38.         protocolOutfits.emplace_back(outfit.name, outfit.lookType, addons);
  39.         if (protocolOutfits.size() == std::numeric_limits<uint8_t>::max()) { // Game client currently doesn't allow more than 255 outfits
  40.             break;
  41.         }
  42.     }
  43.  
  44.     msg.addByte(protocolOutfits.size());
  45.     for (const ProtocolOutfit& outfit : protocolOutfits) {
  46.         msg.add<uint16_t>(outfit.lookType);
  47.         msg.addString(outfit.name);
  48.         msg.addByte(outfit.addons);
  49.     }
  50.     /*
  51.     std::vector<const Mount*> mounts;
  52.     for (const Mount& mount : g_game.mounts.getMounts()) {
  53.         if (player->hasMount(&mount)) {
  54.             mounts.push_back(&mount);
  55.         }
  56.     }
  57.  
  58.     msg.addByte(mounts.size());
  59.     for (const Mount* mount : mounts) {
  60.         msg.add<uint16_t>(mount->clientId);
  61.         msg.addString(mount->name);
  62.     }*/
  63.  
  64.     switch (player->getSex()) {
  65.         case PLAYERSEX_FEMALE: {
  66.             msg.add<uint16_t>(136);
  67.             if (player->isPremium()) {
  68.                 msg.add<uint16_t>(142);
  69.             } else {
  70.                 msg.add<uint16_t>(139);
  71.             }
  72.  
  73.             break;
  74.         }
  75.  
  76.         case PLAYERSEX_MALE: {
  77.             msg.add<uint16_t>(128);
  78.             if (player->isPremium()) {
  79.                 msg.add<uint16_t>(134);
  80.             } else {
  81.                 msg.add<uint16_t>(131);
  82.             }
  83.  
  84.             break;
  85.         }
  86.  
  87.         default: {
  88.             msg.add<uint16_t>(128);
  89.             msg.add<uint16_t>(134);
  90.         }
  91.     }
  92.  
  93.     writeToOutputBuffer(msg);
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement