2022-11-19 01:49:36 +00:00
|
|
|
#include "packet.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
|
2022-11-19 01:49:36 +00:00
|
|
|
#include "gta_util.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
|
2022-11-19 01:49:36 +00:00
|
|
|
#include <network/Network.hpp>
|
2023-07-23 16:47:25 +00:00
|
|
|
#include <network/netConnection.hpp>
|
2022-11-19 01:49:36 +00:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
packet::packet() :
|
2023-11-19 22:20:15 +00:00
|
|
|
m_buffer(m_data, sizeof(m_data))
|
2022-11-19 01:49:36 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-09-26 20:23:54 +02:00
|
|
|
void packet::send(uint32_t msg_id, bool unk_flag)
|
2022-11-19 01:49:36 +00:00
|
|
|
{
|
2024-09-26 20:23:54 +02:00
|
|
|
g_pointers->m_gta.m_queue_packet(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, msg_id, m_data, (m_buffer.m_curBit + 7) >> 3, unk_flag ? 0x4000001 : 1, nullptr);
|
2022-11-19 01:49:36 +00:00
|
|
|
}
|
2023-01-03 16:48:32 +00:00
|
|
|
|
|
|
|
void packet::send(player_ptr player, int connection_id)
|
|
|
|
{
|
2024-09-26 20:23:54 +02:00
|
|
|
send_direct(player->get_session_player()->m_player_data.m_peer_id_2, connection_id);
|
2023-01-03 16:48:32 +00:00
|
|
|
}
|
|
|
|
|
2024-09-26 20:23:54 +02:00
|
|
|
void packet::send_direct(int peer_id, int connection_id)
|
2023-01-03 16:48:32 +00:00
|
|
|
{
|
2023-03-01 21:27:15 +00:00
|
|
|
auto mgr = gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr;
|
2023-07-23 16:47:25 +00:00
|
|
|
auto peer = g_pointers->m_gta.m_get_connection_peer(mgr, peer_id);
|
|
|
|
g_pointers->m_gta.m_send_packet(mgr, &peer->m_peer_address, connection_id, m_data, (m_buffer.m_curBit + 7) >> 3, 0x1000000);
|
2023-01-03 16:48:32 +00:00
|
|
|
}
|
2022-11-19 01:49:36 +00:00
|
|
|
}
|