From da300b358ef26895d5157c1bab798240644fe640 Mon Sep 17 00:00:00 2001 From: gor_down Date: Mon, 11 Aug 2025 02:47:06 -0300 Subject: [PATCH] FIRST PERSON SHOOTER --- src/packet/packet_ms.cpp | 121 +++++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 56 deletions(-) diff --git a/src/packet/packet_ms.cpp b/src/packet/packet_ms.cpp index c65999a..34976db 100755 --- a/src/packet/packet_ms.cpp +++ b/src/packet/packet_ms.cpp @@ -111,6 +111,9 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const } client.m_spoke = true; if(client.hide_desk) l_incoming_deskmod = "0"; + else if(client.m_first_person){ + l_incoming_deskmod = area->lastICMessage()[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 @@ -198,14 +201,17 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const // side // this is validated clientside so w/e + + QString l_incoming_side = client.m_first_person ? area->lastICMessage()[5] : l_incoming_args[5].toString(); QString side = area->side(); if (side.isEmpty()) { - side = l_incoming_args[5].toString(); + side = l_incoming_side; } + l_args.append(side); - if (client.m_pos != l_incoming_args[5].toString()) { - client.m_pos = l_incoming_args[5].toString(); + if (client.m_pos != l_incoming_side) { + client.m_pos = l_incoming_side; client.m_pos.replace("../", "").replace("..\\", ""); client.updateEvidenceList(client.getServer()->getAreaById(client.areaId())); } @@ -317,69 +323,72 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const QString l_other_offset = "0"; QString l_other_flip = "0"; QString new_offset = l_incoming_args[17].toString(); - if (client.m_pairing_with != -1) { - for (int l_client_id : area->joinedIDs()) { - AOClient *l_client = client.getServer()->getClientByID(l_client_id); - if (l_client->m_pairing_with == client.m_char_id && l_other_charid != client.m_char_id && l_client->m_char_id == client.m_pairing_with && l_client->m_pos == client.m_pos) { - l_pairing = true; - l_other_name = l_client->m_current_iniswap; - l_other_emote = l_client->m_emote; - l_other_offset = l_client->m_offset; - l_other_flip = l_client->m_flipping; - } - } - } - if (!l_pairing) { - 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) { - pair_index = i; - } - } - if (pair_index == -1) { - int not_last_spoke_pair_index = 1; - for (int i = 0; i < 2; ++i) { - if (area->m_autopair[i] != area->m_lastWitChar) { - not_last_spoke_pair_index = i; - } - } - area->m_autopair[not_last_spoke_pair_index] = client.m_char_id; - pair_index = not_last_spoke_pair_index; - - } - int other_index = pair_index == 0 ? 1 : 0; - l_other_charid = area->m_autopair[other_index]; - - bool client_found = false; + if(!client.m_first_person) + { + if (client.m_pairing_with != -1) { for (int l_client_id : area->joinedIDs()) { - if(l_client_id == client.clientId()) { - continue; - } AOClient *l_client = client.getServer()->getClientByID(l_client_id); - if (l_client->m_char_id == l_other_charid && l_client->autopair && l_client->m_pos == client.m_pos) { - client_found = true; + if (!l_client->m_first_person && l_client->m_pairing_with == client.m_char_id && l_other_charid != client.m_char_id && l_client->m_char_id == client.m_pairing_with && l_client->m_pos == client.m_pos) { + l_pairing = true; l_other_name = l_client->m_current_iniswap; l_other_emote = l_client->m_emote; + l_other_offset = l_client->m_offset; l_other_flip = l_client->m_flipping; - int offset = pair_index == 0 ? -25 : 25; - if(l_client->hide_desk || client.hide_desk) l_args[0] = "0"; - if(new_offset == "0&0" || new_offset == "") new_offset = QString::number(offset); - if(l_client->m_offset == "0&0" || l_client->m_offset == "") l_other_offset = QString::number(offset * -1); - else l_other_offset = l_client->m_offset; - l_front_back = l_front_back == "" ? "^0" : l_front_back; } } - if (!client_found) { + } + if (!l_pairing) { + 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) { + pair_index = i; + } + } + if (pair_index == -1) { + int not_last_spoke_pair_index = 1; + for (int i = 0; i < 2; ++i) { + if (area->m_autopair[i] != area->m_lastWitChar) { + not_last_spoke_pair_index = i; + } + } + area->m_autopair[not_last_spoke_pair_index] = client.m_char_id; + pair_index = not_last_spoke_pair_index; + + } + int other_index = pair_index == 0 ? 1 : 0; + l_other_charid = area->m_autopair[other_index]; + + bool client_found = false; + for (int l_client_id : area->joinedIDs()) { + if(l_client_id == client.clientId()) { + continue; + } + AOClient *l_client = client.getServer()->getClientByID(l_client_id); + if (!l_client->m_first_person && l_client->m_char_id == l_other_charid && l_client->autopair && l_client->m_pos == client.m_pos) { + client_found = true; + l_other_name = l_client->m_current_iniswap; + l_other_emote = l_client->m_emote; + l_other_flip = l_client->m_flipping; + int offset = pair_index == 0 ? -25 : 25; + if(l_client->hide_desk || client.hide_desk) l_args[0] = "0"; + if(new_offset == "0&0" || new_offset == "") new_offset = QString::number(offset); + if(l_client->m_offset == "0&0" || l_client->m_offset == "") l_other_offset = QString::number(offset * -1); + else l_other_offset = l_client->m_offset; + l_front_back = l_front_back == "" ? "^0" : l_front_back; + } + } + if (!client_found) { + l_other_charid = -1; + l_front_back = ""; + area->m_autopair[other_index] = -1; + area->m_autopair[1] = client.m_char_id; + } + area->m_lastWitChar = client.m_char_id; + }else{ l_other_charid = -1; l_front_back = ""; - area->m_autopair[other_index] = -1; - area->m_autopair[1] = client.m_char_id; } - area->m_lastWitChar = client.m_char_id; - }else{ - l_other_charid = -1; - l_front_back = ""; } } l_args.append(QString::number(l_other_charid) + l_front_back);