Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void WorldSession::SendAddonMessage(Player* player, std::string message, uint32 packet)
- {
- uint32 splitLength = 240;
- uint32 splits = ceil((float)message.length() / (float)splitLength);
- uint32 counter = 1;
- for (uint32 i = 0; i < message.length(); i += splitLength)
- {
- std::stringstream send;
- send << std::setfill('0') << std::setw(3) << packet;
- send << std::setw(2) << counter;
- send << std::setw(2) << splits;
- send << message.substr(i, std::min(splitLength, message.length() - i));
- counter = counter + 1;
- WorldPacket* data = new WorldPacket();
- uint32 messageLength = send.str().length() + 1;
- data->Initialize(SMSG_MESSAGECHAT, 100);
- *data << (uint8)CHAT_MSG_SYSTEM;
- *data << LANG_ADDON;
- *data << player->GetGUID();
- *data << uint32(0);
- *data << player->GetGUID();
- *data << messageLength;
- *data << send.str().c_str();
- *data << uint8(0);
- player->GetSession()->SendPacket(data);
- TC_LOG_INFO("server.debug", "[DEBUG] Sent: %s", send.str().c_str());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment