aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOsmium Sorcerer <os@sof.beauty>2026-03-22 17:35:58 +0000
committerOsmium Sorcerer <os@sof.beauty>2026-03-29 22:22:25 +0000
commit3f7e0a684a513ce4d6ba4f6f1533794c6d6cdc0d (patch)
tree45e7e4f0c68c7a6d246cf5ffe835bede573ca0e6
parent3b8bc386d316b6e177c814920f21f5ab5d798ee6 (diff)
Remove sending client ID and HDID in CC packet
The "select character" packet, CC, only needs one field: the character ID you're selecting. It uses two more: a client ID and an HDID. To select a character, you have to send your HDID every single time. This is ridiculous, you alredy send it to the server when you join. Remove it. I hoped to use empty strings in both unused fields to fully erase them without breaking the packet structure, but some servers *require* both to be present, so hardcode "0" instead. CC doesn't need anything beyond CID. Client ID _might_ be used for some spoofing protection, but even then it sounds far-fetched.
-rw-r--r--src/charselect.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/charselect.cpp b/src/charselect.cpp
index 2443393..5097814 100644
--- a/src/charselect.cpp
+++ b/src/charselect.cpp
@@ -201,7 +201,13 @@ void Courtroom::char_clicked(int n_char)
if (n_char != m_cid || n_char == -1)
{
ao_app->send_server_packet(AOPacket("PW", {ui_char_password->text()}));
- ao_app->send_server_packet(AOPacket("CC", {QString::number(ao_app->client_id), QString::number(n_char), get_hdid()}));
+ // The first field is unused; upstream sends the client ID for some reason.
+ // The second field is the actual character ID.
+ // The third field is HDID, which is absolutely ridiculous to send here.
+ // Because of ossification of AO protocol, three fields are required.
+ // Tsuserver annoyingly enforces that the first field is an integer, and the
+ // last field is a string. Hardcode dumb "0" in both places and move on.
+ ao_app->send_server_packet(AOPacket("CC", {"0", QString::number(n_char), "0"}));
}
if (n_char == m_cid || n_char == -1)
{