Duels: winner message in the Classic layout, with surnames

Live 70938 (sniff 5, 2026-11-16) sends both names of the duel winner
message as zero-terminated strings with 24 bit lengths, then the Fled
bit, both realms and the names. We sent the retail 6 bit lengths, so
the client read our lengths and realms as one 24 bit length, so the
names in the duel result line could not be read right. Live also sends each name with
its surname ("Name Surname"); ours now does the same.
This commit is contained in:
Karrz1
2026-11-16 12:56:22 +00:00
parent 40408a59c5
commit 0191ae1aa7
2 changed files with 20 additions and 6 deletions
+12 -2
View File
@@ -8452,9 +8452,19 @@ void Player::DuelComplete(DuelCompleteType type)
if (type != DUEL_INTERRUPTED)
{
// Classic 1.60: live sends each name with its surname ("Name Surname"), the client prints the strings as they come
auto nameWithSurname = [](Player const* player)
{
std::string name = player->GetName();
std::string const surname = sCharacterCache->GetCharacterSurnameByGuid(player->GetGUID());
if (!surname.empty())
name += " " + surname;
return name;
};
WorldPackets::Duel::DuelWinner duelWinner;
duelWinner.BeatenName = (type == DUEL_WON ? opponent : this)->GetName();
duelWinner.WinnerName = (type == DUEL_WON ? this : opponent)->GetName();
duelWinner.BeatenName = nameWithSurname(type == DUEL_WON ? opponent : this);
duelWinner.WinnerName = nameWithSurname(type == DUEL_WON ? this : opponent);
duelWinner.BeatenVirtualRealmAddress = (type == DUEL_WON ? opponent : this)->m_playerData->VirtualPlayerRealm;
duelWinner.WinnerVirtualRealmAddress = (type == DUEL_WON ? this : opponent)->m_playerData->VirtualPlayerRealm;
duelWinner.Fled = type != DUEL_WON;
@@ -70,13 +70,17 @@ void DuelResponse::Read()
WorldPacket const* DuelWinner::Write()
{
_worldPacket << SizedString::BitsSize<6>(BeatenName);
_worldPacket << SizedString::BitsSize<6>(WinnerName);
// Classic 1.60 (live 70938 sniff, 2026-11-16): both names are zero-terminated strings with a 24 bit length that counts the
// terminator, then the Fled bit, flush, both realms and the names. Retail sends 6 bit lengths without terminators, which this
// client reads as part of a 24 bit length. The names are shown as written, so the caller passes "Name Surname".
_worldPacket << SizedCString::BitsSize<24>(BeatenName);
_worldPacket << SizedCString::BitsSize<24>(WinnerName);
_worldPacket << Bits<1>(Fled);
_worldPacket.FlushBits();
_worldPacket << uint32(BeatenVirtualRealmAddress);
_worldPacket << uint32(WinnerVirtualRealmAddress);
_worldPacket << SizedString::Data(BeatenName);
_worldPacket << SizedString::Data(WinnerName);
_worldPacket << SizedCString::Data(BeatenName);
_worldPacket << SizedCString::Data(WinnerName);
return &_worldPacket;
}