Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void WorldSession::SendAddonMessage(Player* player, std::string message, uint32 packet)
- {
- // Debug
- TC_LOG_INFO("server.debug", "[DEBUG] Sending : %s", message);
- uint32 splitLength = 240;
- uint32 splits = ceil(message.length() / 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 << splits;
- send << message.substr(splitLength * counter);
- counter = counter + 1;
- TC_LOG_INFO("server.debug", "[DEBUG] Sending Formatted:\n\t%s", send.str().c_str());
- WorldPacket* data = new WorldPacket();
- uint32 messageLength = message.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);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement