当前位置: 首页>>代码示例>>C++>>正文


C++ OutputMessage::addString方法代码示例

本文整理汇总了C++中OutputMessage::addString方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputMessage::addString方法的具体用法?C++ OutputMessage::addString怎么用?C++ OutputMessage::addString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OutputMessage的用法示例。


在下文中一共展示了OutputMessage::addString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
}
开发者ID:Cayan,项目名称:otclient,代码行数:25,代码来源:protocolgamesend.cpp

示例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();
}
开发者ID:AndreFaramir,项目名称:otclient,代码行数:32,代码来源:protocollogin.cpp

示例3: 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);
}
开发者ID:AndreFaramir,项目名称:otclient,代码行数:25,代码来源:protocolgamesend.cpp

示例4: 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();
}
开发者ID:AndreFaramir,项目名称:otclient,代码行数:35,代码来源:protocolgamesend.cpp

示例5: sendDebugReport

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);
}
开发者ID:Cayan,项目名称:otclient,代码行数:10,代码来源:protocolgamesend.cpp

示例6: sendRuleVilation

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);
}
开发者ID:Cayan,项目名称:otclient,代码行数:13,代码来源:protocolgamesend.cpp

示例7: sendBugReport

void ProtocolGame::sendBugReport(const std::string& comment)
{
    OutputMessage msg;
    msg.addU8(Proto::ClientBugReport);
    msg.addString(comment);
    send(msg);
}
开发者ID:Cayan,项目名称:otclient,代码行数:7,代码来源:protocolgamesend.cpp

示例8: sendAddVip

void ProtocolGame::sendAddVip(const std::string& name)
{
    OutputMessage msg;
    msg.addU8(Proto::ClientAddVip);
    msg.addString(name);
    send(msg);
}
开发者ID:Cayan,项目名称:otclient,代码行数:7,代码来源:protocolgamesend.cpp

示例9: sendExcludeFromOwnChannel

void ProtocolGame::sendExcludeFromOwnChannel(const std::string& name)
{
    OutputMessage msg;
    msg.addU8(Proto::ClientExcludeFromOwnChannel);
    msg.addString(name);
    send(msg);
}
开发者ID:Cayan,项目名称:otclient,代码行数:7,代码来源:protocolgamesend.cpp

示例10: sendInviteToOwnChannel

void ProtocolGame::sendInviteToOwnChannel(const std::string& name)
{
    OutputMessage msg;
    msg.addU8(Proto::ClientInviteToOwnChannel);
    msg.addString(name);
    send(msg);
}
开发者ID:Cayan,项目名称:otclient,代码行数:7,代码来源:protocolgamesend.cpp

示例11: sendOpenPrivateChannel

void ProtocolGame::sendOpenPrivateChannel(const std::string& receiver)
{
    OutputMessage msg;
    msg.addU8(Proto::ClientOpenPrivateChannel);
    msg.addString(receiver);
    send(msg);
}
开发者ID:Cayan,项目名称:otclient,代码行数:7,代码来源:protocolgamesend.cpp

示例12: sendAddVip

void ProtocolGame::sendAddVip(const std::string& name)
{
    OutputMessage oMsg;
    oMsg.addU8(Proto::ClientAddBuddy);
    oMsg.addString(name);
    send(oMsg);
}
开发者ID:AndreFaramir,项目名称:otclient,代码行数:7,代码来源:protocolgamesend.cpp

示例13: sendPrivateChannel

void ProtocolGame::sendPrivateChannel(const std::string& receiver)
{
    OutputMessage oMsg;
    oMsg.addU8(Proto::ClientPrivateChannel);
    oMsg.addString(receiver);
    send(oMsg);
}
开发者ID:AndreFaramir,项目名称:otclient,代码行数:7,代码来源:protocolgamesend.cpp

示例14: sendEditText

void ProtocolGame::sendEditText(uint id, const std::string& text)
{
    OutputMessage msg;
    msg.addU8(Proto::ClientEditText);
    msg.addU32(id);
    msg.addString(text);
    send(msg);
}
开发者ID:Cayan,项目名称:otclient,代码行数:8,代码来源:protocolgamesend.cpp

示例15: sendTextWindow

void ProtocolGame::sendTextWindow(uint windowTextId, const std::string& text)
{
    OutputMessage oMsg;
    oMsg.addU8(Proto::ClientEditText);
    oMsg.addU32(windowTextId);
    oMsg.addString(text);
    send(oMsg);
}
开发者ID:AndreFaramir,项目名称:otclient,代码行数:8,代码来源:protocolgamesend.cpp


注:本文中的OutputMessage::addString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。