Files
ForeverCore/tests/game/PetitionBuyLayout.cpp
T
Karrz1 26ae994422 Guild charters keep the whole guild name
The classic client sends the charter title with an 8 bit length, as the
server's own charter query reply does. The server read 7 bits, dropped the
last bit and so kept only half the name: "Knights of Valor" (16) became the
guild "Knights " (8). Reported in #bot-feedback.

New test PetitionBuyLayout (needs a cmake reconfigure for the new file).

(cherry picked from commit 6bef18515d5e4af999c1f512e37fe85ae3117e27)
2026-11-13 02:17:45 +00:00

26 lines
974 B
C++

#include "tc_catch2.h"
#include "PetitionPackets.h"
// CMSG_PETITION_BUY from the classic 1.60 client: an 8 bit title length, the petitioner, a uint32 and the title (player report
// 2026-11-13: read with a 7 bit length, "Knights of Valor" became the guild "Knights "). The title length has 8 bits in
// SMSG_QUERY_PETITION_RESPONSE too.
TEST_CASE("PETITION_BUY reads the whole guild name", "[PetitionBuyLayout]")
{
std::string const title = "Knights of Valor";
ObjectGuid const petitioner = ObjectGuid::Create<HighGuid::Creature>(0, 4974, UI64LIT(30001234));
WorldPacket raw(CMSG_PETITION_BUY);
raw.WriteBits(title.size(), 8);
raw.FlushBits();
raw << petitioner;
raw << uint32(0);
raw.WriteString(title);
WorldPackets::Petition::PetitionBuy packet(std::move(raw));
packet.Read();
CHECK(packet.Title == title);
CHECK(packet.Unit == petitioner);
CHECK(packet.GetRawPacket()->rpos() == packet.GetRawPacket()->size());
}