void ProtocolGame::sendTalk(Otc::SpeakType speakType, int channelId, const std::string& receiver, const std::string& message) { if(message.length() > 255 || message.length() <= 0) return; int serverSpeakType = Proto::translateSpeakTypeToServer(speakType); OutputMessage msg; msg.addU8(Proto::ClientTalk); msg.addU8(serverSpeakType); switch(serverSpeakType) { case Proto::ServerSpeakPrivate: case Proto::ServerSpeakPrivateRed: msg.addString(receiver); break; case Proto::ServerSpeakChannelYellow: case Proto::ServerSpeakChannelRed: msg.addU16(channelId); break; } msg.addString(message); send(msg); }
void ProtocolLogin::sendLoginPacket() { OutputMessage oMsg; oMsg.addU8(Proto::ClientEnterAccount); oMsg.addU16(Proto::OsLinux); oMsg.addU16(Proto::ClientVersion); oMsg.addU32(g_thingsType.getSignature()); // data signature oMsg.addU32(g_sprites.getSignature()); // sprite signature oMsg.addU32(Proto::PicSignature); // pic signature oMsg.addU8(0); // first RSA byte must be 0 // xtea key generateXteaKey(); oMsg.addU32(m_xteaKey[0]); oMsg.addU32(m_xteaKey[1]); oMsg.addU32(m_xteaKey[2]); oMsg.addU32(m_xteaKey[3]); oMsg.addString(m_accountName); oMsg.addString(m_accountPassword); // complete the 128 bytes for rsa encryption with zeros oMsg.addPaddingBytes(128 - (21 + m_accountName.length() + m_accountPassword.length())); Rsa::encrypt((char*)oMsg.getBuffer() + InputMessage::DATA_POS + oMsg.getMessageSize() - 128, 128, Proto::RSA); send(oMsg); enableXteaEncryption(); recv(); }
void ProtocolGame::sendTalk(const std::string& speakTypeDesc, int channelId, const std::string& receiver, const std::string& message) { if(message.length() > 255 || message.length() <= 0) return; int speakType = Proto::translateSpeakTypeDesc(speakTypeDesc); OutputMessage oMsg; oMsg.addU8(Proto::ClientTalk); oMsg.addU8(speakType); switch(speakType) { case Proto::SpeakPrivate: case Proto::SpeakPrivateRed: oMsg.addString(receiver); break; case Proto::SpeakChannelYellow: case Proto::SpeakChannelRed: oMsg.addU16(channelId); break; } oMsg.addString(message); send(oMsg); }
void ProtocolGame::sendLoginPacket(uint timestamp, uint8 unknown) { OutputMessage oMsg; oMsg.addU8(Proto::ClientEnterGame); oMsg.addU16(Proto::OsLinux); oMsg.addU16(Proto::ClientVersion); oMsg.addU8(0); // first RSA byte must be 0 // xtea key generateXteaKey(); oMsg.addU32(m_xteaKey[0]); oMsg.addU32(m_xteaKey[1]); oMsg.addU32(m_xteaKey[2]); oMsg.addU32(m_xteaKey[3]); oMsg.addU8(0); // is gm set? oMsg.addString(m_accountName); oMsg.addString(m_characterName); oMsg.addString(m_accountPassword); oMsg.addU32(timestamp); oMsg.addU8(unknown); // complete the 128 bytes for rsa encryption with zeros oMsg.addPaddingBytes(128 - (29 + m_accountName.length() + m_characterName.length() + m_accountPassword.length())); // encrypt with RSA Rsa::encrypt((char*)oMsg.getBuffer() + 6 + oMsg.getMessageSize() - 128, 128, Proto::RSA); send(oMsg); enableXteaEncryption(); }
void ProtocolGame::sendDebugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d) { OutputMessage msg; msg.addU8(Proto::ClientDebugReport); msg.addString(a); msg.addString(b); msg.addString(c); msg.addString(d); send(msg); }
void ProtocolGame::sendRuleVilation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment) { OutputMessage msg; msg.addU8(Proto::ClientRuleViolation); msg.addString(target); msg.addU8(reason); msg.addU8(action); msg.addString(comment); msg.addString(statement); msg.addU16(statementId); msg.addU8(ipBanishment); send(msg); }
void ProtocolGame::sendBugReport(const std::string& comment) { OutputMessage msg; msg.addU8(Proto::ClientBugReport); msg.addString(comment); send(msg); }
void ProtocolGame::sendAddVip(const std::string& name) { OutputMessage msg; msg.addU8(Proto::ClientAddVip); msg.addString(name); send(msg); }
void ProtocolGame::sendExcludeFromOwnChannel(const std::string& name) { OutputMessage msg; msg.addU8(Proto::ClientExcludeFromOwnChannel); msg.addString(name); send(msg); }
void ProtocolGame::sendInviteToOwnChannel(const std::string& name) { OutputMessage msg; msg.addU8(Proto::ClientInviteToOwnChannel); msg.addString(name); send(msg); }
void ProtocolGame::sendOpenPrivateChannel(const std::string& receiver) { OutputMessage msg; msg.addU8(Proto::ClientOpenPrivateChannel); msg.addString(receiver); send(msg); }
void ProtocolGame::sendAddVip(const std::string& name) { OutputMessage oMsg; oMsg.addU8(Proto::ClientAddBuddy); oMsg.addString(name); send(oMsg); }
void ProtocolGame::sendPrivateChannel(const std::string& receiver) { OutputMessage oMsg; oMsg.addU8(Proto::ClientPrivateChannel); oMsg.addString(receiver); send(oMsg); }
void ProtocolGame::sendEditText(uint id, const std::string& text) { OutputMessage msg; msg.addU8(Proto::ClientEditText); msg.addU32(id); msg.addString(text); send(msg); }
void ProtocolGame::sendTextWindow(uint windowTextId, const std::string& text) { OutputMessage oMsg; oMsg.addU8(Proto::ClientEditText); oMsg.addU32(windowTextId); oMsg.addString(text); send(oMsg); }
void ProtocolGame::sendHouseWindow(int doorId, uint id, const std::string& text) { OutputMessage oMsg; oMsg.addU8(Proto::ClientEditList); oMsg.addU8(doorId); oMsg.addU32(id); oMsg.addString(text); send(oMsg); }
void ProtocolGame::onConnect() { OutputMessage out; out.addByte(NET_GAME_WELCOME); out.addString("Welcome to the game server"); send(out); recv(); }