Ejemplo n.º 1
0
void WorldSession::HandleRequestRatedBgInfo(WorldPacket& recvData)
{
    TC_LOG_DEBUG("network", "WORLD: CMSG_REQUEST_RATED_BG_INFO");

    uint8 type;
    recvData >> type;

    TC_LOG_DEBUG("bg.battleground", "WorldSession::HandleRequestRatedBgInfo: unk = %u", type);

    WorldPacket packet1(SMSG_BATTLEFIELD_RATED_INFO);
    packet1 << uint32(sWorld->getIntConfig(CONFIG_ARENA_CONQUEST_POINTS_REWARD)); // Reward
    packet1 << uint8(0); // for arena
    packet1 << uint32(0); // Raiting
    packet1 << uint32(0); // Unk UInt32 3
    packet1 << uint32(0); // Conquest Points Weekly Cap
    packet1 << uint32(0); // Unk UInt32 5
    packet1 << uint32(0); // Unk UInt32 6
    packet1 << uint32(0); // Current Conquest Points
    SendPacket(&packet1);

    WorldPacket packet2(SMSG_BATTLEFIELD_RATED_INFO);
    packet2 << uint32(sWorld->getIntConfig(CONFIG_RBG_CONQUEST_POINTS_REWARD)); // Reward
    packet2 << uint8(3); // for rbg
    packet2 << uint32(_player->GetRatedBGRating()); // Raiting
    packet2 << uint32(0); // Unk UInt32 3
    packet2 << uint32(0); // Conquest Points Weekly Cap
    packet2 << uint32(0); // Unk UInt32 5
    packet2 << uint32(0); // Unk UInt32 6
    packet2 << uint32(0); // Current Conquest Points
    SendPacket(&packet2);
}
Ejemplo n.º 2
0
void DEFAULTPACKETSTREAMERTF::testEncode() {
    MyPacketFactory *factory =  new MyPacketFactory();
    DefaultPacketStreamer *streamer
        = new DefaultPacketStreamer(factory);
    MyPacket packet(16);
    DataBuffer buffer;
    PacketHeader *header = new PacketHeader;
    packet.setPacketHeader(header);
    delete header;
    header = packet.getPacketHeader();
    header->_chid = 1111;
    header->_pcode = 2222;
    CPPUNIT_ASSERT(streamer->encode(&packet, &buffer));
    CPPUNIT_ASSERT_EQUAL(32, (int)buffer.getDataLen());
    buffer.drainData(4);
    CPPUNIT_ASSERT_EQUAL(1111, (int)buffer.readInt32());
    CPPUNIT_ASSERT_EQUAL(2222, (int)buffer.readInt32());
    CPPUNIT_ASSERT_EQUAL(16, (int)buffer.readInt32());


    MyPacket packet1(100, false);
    CPPUNIT_ASSERT(!streamer->encode(&packet1, &buffer));
    CPPUNIT_ASSERT_EQUAL(16, (int)buffer.getDataLen());
    delete streamer;
    delete factory;
}
Ejemplo n.º 3
0
TEST(Packets, PacketParameterWriteTest)
{
    DigitalOutputPacket packet1(13, true);
    std::ostringstream outputStream;
    std::string expectedOutput;
    std::string actualOutput;

    expectedOutput = "\xFF\x02\x0D\x02\xFF";
    packet1.write(outputStream);
    actualOutput = outputStream.str();

    CHECK_EQUAL(expectedOutput, actualOutput);

    outputStream.str("");
    DigitalOutputPacket packet2(5, false);

    expectedOutput = "\xFF\x02\x05\x01\xFF";
    packet2.write(outputStream);
    actualOutput = outputStream.str();

    CHECK_EQUAL(expectedOutput, actualOutput);
}