Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ProtocolGame::sendOutfitWindow()
- {
- const auto& outfits = Outfits::getInstance().getOutfits(player->getSex());
- if (outfits.size() == 0) {
- return;
- }
- NetworkMessage msg;
- msg.addByte(0xC8);
- Outfit_t currentOutfit = player->getDefaultOutfit();
- if (currentOutfit.lookType == 0) {
- Outfit_t newOutfit;
- newOutfit.lookType = outfits.front().lookType;
- currentOutfit = newOutfit;
- }
- /*Mount* currentMount = g_game.mounts.getMountByID(player->getCurrentMount());
- if (currentMount) {
- currentOutfit.lookMount = currentMount->clientId;
- }*/
- AddOutfit(msg, currentOutfit);
- std::vector<ProtocolOutfit> protocolOutfits;
- if (player->isAccessPlayer()) {
- static const std::string gamemasterOutfitName = "Gamemaster";
- protocolOutfits.emplace_back(gamemasterOutfitName, 75, 0);
- }
- protocolOutfits.reserve(outfits.size());
- for (const Outfit& outfit : outfits) {
- uint8_t addons;
- if (!player->getOutfitAddons(outfit, addons)) {
- continue;
- }
- protocolOutfits.emplace_back(outfit.name, outfit.lookType, addons);
- if (protocolOutfits.size() == std::numeric_limits<uint8_t>::max()) { // Game client currently doesn't allow more than 255 outfits
- break;
- }
- }
- msg.addByte(protocolOutfits.size());
- for (const ProtocolOutfit& outfit : protocolOutfits) {
- msg.add<uint16_t>(outfit.lookType);
- msg.addString(outfit.name);
- msg.addByte(outfit.addons);
- }
- /*
- std::vector<const Mount*> mounts;
- for (const Mount& mount : g_game.mounts.getMounts()) {
- if (player->hasMount(&mount)) {
- mounts.push_back(&mount);
- }
- }
- msg.addByte(mounts.size());
- for (const Mount* mount : mounts) {
- msg.add<uint16_t>(mount->clientId);
- msg.addString(mount->name);
- }*/
- switch (player->getSex()) {
- case PLAYERSEX_FEMALE: {
- msg.add<uint16_t>(136);
- if (player->isPremium()) {
- msg.add<uint16_t>(142);
- } else {
- msg.add<uint16_t>(139);
- }
- break;
- }
- case PLAYERSEX_MALE: {
- msg.add<uint16_t>(128);
- if (player->isPremium()) {
- msg.add<uint16_t>(134);
- } else {
- msg.add<uint16_t>(131);
- }
- break;
- }
- default: {
- msg.add<uint16_t>(128);
- msg.add<uint16_t>(134);
- }
- }
- writeToOutputBuffer(msg);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement