From 2de7793c331eee7f3b9fccb85d6994381257ffac Mon Sep 17 00:00:00 2001 From: gor_down Date: Sun, 30 Mar 2025 18:21:10 -0300 Subject: [PATCH] disable autopair and desk fix --- src/aoclient.cpp | 1 + src/aoclient.h | 2 ++ src/commands/messaging.cpp | 12 ++++++++++++ src/packet/packet_ms.cpp | 5 +++-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/aoclient.cpp b/src/aoclient.cpp index ebe8faf..d774715 100644 --- a/src/aoclient.cpp +++ b/src/aoclient.cpp @@ -152,6 +152,7 @@ const QMap AOClient::COMMANDS{ {"kick_other", {{ACLRole::NONE}, 0, &AOClient::cmdKickOther}}, {"jukebox_skip", {{ACLRole::CM}, 0, &AOClient::cmdJukeboxSkip}}, {"desk", {{ACLRole::NONE}, 0, &AOClient::cmdDesk}}, + {"autopair", {{ACLRole::NONE}, 0, &AOClient::cmdAutopair}}, {"play_ambience", {{ACLRole::NONE}, 1, &AOClient::cmdPlayAmbience}}}; void AOClient::clientDisconnected() diff --git a/src/aoclient.h b/src/aoclient.h index 607a3e7..3d36207 100644 --- a/src/aoclient.h +++ b/src/aoclient.h @@ -103,6 +103,7 @@ class AOClient : public QObject QString getIpid() const; bool hide_desk = false; + bool autopair = true; /** * @brief Getter for the client's HWID. @@ -700,6 +701,7 @@ class AOClient : public QObject */ void cmdLogin(int argc, QStringList argv); void cmdDesk(int argc, QStringList argv); + void cmdAutopair(int argc, QStringList argv); /** * @brief Starts the authorisation type change from `"simple"` to `"advanced"`. diff --git a/src/commands/messaging.cpp b/src/commands/messaging.cpp index a6f9e7f..8023816 100644 --- a/src/commands/messaging.cpp +++ b/src/commands/messaging.cpp @@ -553,4 +553,16 @@ void AOClient::cmdDesk(int argc, QStringList argv) }else{ sendServerMessage("Mostrando escritorio."); } +} + +void AOClient::cmdAutopair(int argc, QStringList argv) +{ + Q_UNUSED(argc); + Q_UNUSED(argv); + autopair = !autopair; + if(autopair){ + sendServerMessage("Emparejando automaticamente en wit."); + }else{ + sendServerMessage("Dejando de emparejar automaticamente en wit."); + } } \ No newline at end of file diff --git a/src/packet/packet_ms.cpp b/src/packet/packet_ms.cpp index 742a886..ce962a4 100644 --- a/src/packet/packet_ms.cpp +++ b/src/packet/packet_ms.cpp @@ -84,6 +84,7 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const << "5"; QString l_incoming_deskmod = l_incoming_args[0].toString(); client.hide_desk = l_incoming_deskmod == "0" || client.hide_desk; + if(client.hide_desk) l_incoming_deskmod = "0"; if (allowed_desk_mods.contains(l_incoming_deskmod)) { // **WARNING : THIS IS A HACK!** // A proper solution would be to deprecate chat as an argument on the clientside @@ -304,7 +305,7 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const } bool autopaired = false; if (!l_pairing) { - if (client.m_pos == "wit" && area->status() != AreaData::Status::CASING) { + if (client.autopair && client.m_pos == "wit" && area->status() != AreaData::Status::CASING) { int pair_index = -1; for (int i = 0; i < 2; ++i) { if (area->m_autopair[i] == client.m_char_id) { @@ -331,7 +332,7 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const continue; } AOClient *l_client = client.getServer()->getClientByID(l_client_id); - if (l_client->m_char_id == l_other_charid && l_client->m_pos == client.m_pos) { + if (l_client->m_char_id == l_other_charid && l_client->autopair && l_client->m_pos == client.m_pos) { client_found = true; autopaired = true; l_other_name = l_client->m_current_iniswap;