2022-07-03 00:26:25 +02:00
|
|
|
#pragma once
|
|
|
|
#include "player_service.hpp"
|
2022-11-21 15:42:12 +00:00
|
|
|
#include "rate_limiter.hpp"
|
2022-07-03 00:26:25 +02:00
|
|
|
|
2022-12-06 16:12:02 +00:00
|
|
|
class CVehicle;
|
2023-01-03 16:48:32 +00:00
|
|
|
class CPed;
|
|
|
|
class CNetGamePlayer;
|
|
|
|
class CPlayerInfo;
|
2022-12-06 16:12:02 +00:00
|
|
|
|
|
|
|
namespace rage
|
|
|
|
{
|
|
|
|
class snPlayer;
|
|
|
|
class snPeer;
|
2023-01-03 16:48:32 +00:00
|
|
|
class rlGamerInfo;
|
2022-12-06 16:12:02 +00:00
|
|
|
}
|
|
|
|
|
2022-07-03 00:26:25 +02:00
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
class player final
|
|
|
|
{
|
|
|
|
friend class player_service;
|
|
|
|
|
|
|
|
CNetGamePlayer* m_net_game_player = nullptr;
|
|
|
|
std::string m_identifier;
|
|
|
|
bool m_is_friend;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit player(CNetGamePlayer* net_game_player);
|
|
|
|
~player() = default;
|
|
|
|
|
|
|
|
player(const player&) = default;
|
|
|
|
player(player&&) noexcept = default;
|
|
|
|
player& operator=(const player&) = default;
|
|
|
|
player& operator=(player&&) noexcept = default;
|
|
|
|
|
|
|
|
float screen_position_x = -1.f;
|
|
|
|
float screen_position_y = -1.f;
|
|
|
|
|
2022-09-12 18:44:47 +00:00
|
|
|
[[nodiscard]] CVehicle* get_current_vehicle() const;
|
2022-07-03 00:26:25 +02:00
|
|
|
[[nodiscard]] const char* get_name() const;
|
2022-09-12 18:44:47 +00:00
|
|
|
[[nodiscard]] rage::rlGamerInfo* get_net_data() const;
|
2022-07-03 00:26:25 +02:00
|
|
|
[[nodiscard]] CNetGamePlayer* get_net_game_player() const;
|
|
|
|
[[nodiscard]] CPed* get_ped() const;
|
|
|
|
[[nodiscard]] CPlayerInfo* get_player_info() const;
|
2022-09-12 18:44:47 +00:00
|
|
|
[[nodiscard]] class rage::snPlayer* get_session_player();
|
|
|
|
[[nodiscard]] class rage::snPeer* get_session_peer();
|
2022-11-21 15:42:12 +00:00
|
|
|
|
2022-07-03 00:26:25 +02:00
|
|
|
[[nodiscard]] uint8_t id() const;
|
|
|
|
|
|
|
|
[[nodiscard]] bool is_friend() const;
|
|
|
|
[[nodiscard]] bool is_host() const;
|
|
|
|
[[nodiscard]] bool is_valid() const;
|
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
std::optional<CommandAccessLevel> command_access_level = std::nullopt;
|
|
|
|
|
2022-11-21 15:42:12 +00:00
|
|
|
bool off_radar = false;
|
2022-07-05 22:35:32 +02:00
|
|
|
bool never_wanted = false;
|
2022-11-21 15:42:12 +00:00
|
|
|
bool semi_godmode = false;
|
2022-07-05 22:35:32 +02:00
|
|
|
|
2023-01-03 16:48:32 +00:00
|
|
|
bool kill_loop = false;
|
|
|
|
bool explosion_loop = false;
|
|
|
|
bool freeze_loop = false;
|
|
|
|
bool ragdoll_loop = false;
|
|
|
|
bool rotate_cam_loop = false;
|
|
|
|
|
2022-11-21 15:42:12 +00:00
|
|
|
rate_limiter m_host_migration_rate_limit{ 1s, 20 };
|
|
|
|
rate_limiter m_play_sound_rate_limit{ 1s, 10 };
|
2023-01-03 16:48:32 +00:00
|
|
|
rate_limiter m_invites_rate_limit{ 10s, 2 };
|
2022-08-29 10:26:18 +00:00
|
|
|
|
2022-11-21 15:42:12 +00:00
|
|
|
bool exposed_desync_protection = false;
|
2022-11-19 01:49:36 +00:00
|
|
|
bool is_modder = false;
|
|
|
|
bool block_join = false;
|
|
|
|
int block_join_reason = 0;
|
2022-11-21 15:42:12 +00:00
|
|
|
bool is_spammer = false;
|
2022-11-19 01:49:36 +00:00
|
|
|
|
2022-12-19 17:39:06 +00:00
|
|
|
std::optional<std::uint32_t> player_time_value;
|
|
|
|
std::optional<std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds>> player_time_value_received_time;
|
|
|
|
std::optional<std::uint32_t> time_difference;
|
|
|
|
std::uint32_t num_time_syncs_sent = 9999;
|
|
|
|
|
2022-07-03 00:26:25 +02:00
|
|
|
protected:
|
|
|
|
bool equals(const CNetGamePlayer* net_game_player) const;
|
|
|
|
|
|
|
|
[[nodiscard]] std::string to_lowercase_identifier() const;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|