本文整理汇总了C++中OutputMessage::addU16方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputMessage::addU16方法的具体用法?C++ OutputMessage::addU16怎么用?C++ OutputMessage::addU16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputMessage
的用法示例。
在下文中一共展示了OutputMessage::addU16方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendLoginPacket
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();
}
示例2: sendLoginPacket
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();
}
示例3: sendUseItemEx
void ProtocolGame::sendUseItemEx(const Position& fromPos, int fromThingId, int fromStackpos, const Position& toPos, int toThingId, int toStackpos)
{
OutputMessage oMsg;
oMsg.addU8(Proto::ClientUseTwoObjects);
addPosition(oMsg, fromPos);
oMsg.addU16(fromThingId);
oMsg.addU8(fromStackpos);
addPosition(oMsg, toPos);
oMsg.addU16(toThingId);
oMsg.addU8(toStackpos);
send(oMsg);
}
示例4: sendUseItemWith
void ProtocolGame::sendUseItemWith(const Position& fromPos, int itemId, int fromStackpos, const Position& toPos, int toThingId, int toStackpos)
{
OutputMessage msg;
msg.addU8(Proto::ClientUseItemWith);
addPosition(msg, fromPos);
msg.addU16(itemId);
msg.addU8(fromStackpos);
addPosition(msg, toPos);
msg.addU16(toThingId);
msg.addU8(toStackpos);
send(msg);
}
示例5: sendTalk
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);
}
示例6: sendOpenChannel
void ProtocolGame::sendOpenChannel(int channelId)
{
OutputMessage oMsg;
oMsg.addU8(Proto::ClientOpenChannel);
oMsg.addU16(channelId);
send(oMsg);
}
示例7: sendTalk
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);
}
示例8: sendRequestQuestLine
void ProtocolGame::sendRequestQuestLine(int questId)
{
OutputMessage msg;
msg.addU8(Proto::ClientRequestQuestLine);
msg.addU16(questId);
send(msg);
}
示例9: sendLeaveChannel
void ProtocolGame::sendLeaveChannel(int channelId)
{
OutputMessage msg;
msg.addU8(Proto::ClientLeaveChannel);
msg.addU16(channelId);
send(msg);
}
示例10: sendGetQuestLine
void ProtocolGame::sendGetQuestLine(int questId)
{
OutputMessage oMsg;
oMsg.addU8(Proto::ClientGetQuestLine);
oMsg.addU16(questId);
send(oMsg);
}
示例11: sendInspectNpcTrade
void ProtocolGame::sendInspectNpcTrade(int itemId, int count)
{
OutputMessage msg;
msg.addU8(Proto::ClientInspectNpcTrade);
msg.addU16(itemId);
msg.addU8(count);
send(msg);
}
示例12: sendLookInShop
void ProtocolGame::sendLookInShop(int thingId, int count)
{
OutputMessage oMsg;
oMsg.addU8(Proto::ClientInspectNpcTrade);
oMsg.addU16(thingId);
oMsg.addU8(count);
send(oMsg);
}
示例13: sendLook
void ProtocolGame::sendLook(const Position& position, int thingId, int stackpos)
{
OutputMessage msg;
msg.addU8(Proto::ClientLook);
addPosition(msg, position);
msg.addU16(thingId);
msg.addU8(stackpos);
send(msg);
}
示例14: sendRotateItem
void ProtocolGame::sendRotateItem(const Position& pos, int thingId, int stackpos)
{
OutputMessage msg;
msg.addU8(Proto::ClientRotateItem);
addPosition(msg, pos);
msg.addU16(thingId);
msg.addU8(stackpos);
send(msg);
}
示例15: sendRotateItem
void ProtocolGame::sendRotateItem(const Position& pos, int thingId, int stackpos)
{
OutputMessage oMsg;
oMsg.addU8(Proto::ClientTurnObject);
addPosition(oMsg, pos);
oMsg.addU16(thingId);
oMsg.addU8(stackpos);
send(oMsg);
}