add data for triggerbot

This commit is contained in:
Janek 2024-05-03 23:19:37 +02:00
parent 831d232d23
commit ae10303376
3 changed files with 15 additions and 6 deletions

@ -77,13 +77,16 @@ pub struct RadarData {
#[serde(rename(serialize = "entityData"))] #[serde(rename(serialize = "entityData"))]
player_data: Vec<EntityData>, player_data: Vec<EntityData>,
#[serde(rename = "triggerbot_shoot")]
triggerbot_shoot: bool,
//#[serde(rename(serialize = "localYaw"))] //#[serde(rename(serialize = "localYaw"))]
//local_yaw: f32, //local_yaw: f32,
} }
impl RadarData { impl RadarData {
pub fn new(ingame: bool, map_name: String, player_data: Vec<EntityData>, freq: usize, bomb_planted: bool, bomb_cannot_defuse: bool, bomb_defuse_timeleft: f32, bomb_exploded: bool, bomb_being_defused: bool, bomb_defuse_length: f32, bomb_defuse_end: f32) -> RadarData { pub fn new(ingame: bool, map_name: String, player_data: Vec<EntityData>, freq: usize, bomb_planted: bool, bomb_cannot_defuse: bool, bomb_defuse_timeleft: f32, bomb_exploded: bool, bomb_being_defused: bool, bomb_defuse_length: f32, bomb_defuse_end: f32, triggerbot_shoot: bool,) -> RadarData {
RadarData { ingame, map_name, player_data, freq, bomb_planted, bomb_can_defuse: bomb_cannot_defuse, bomb_defuse_timeleft, bomb_exploded, bomb_being_defused, bomb_defuse_length, bomb_defuse_end } RadarData { ingame, map_name, player_data, freq, bomb_planted, bomb_can_defuse: bomb_cannot_defuse, bomb_defuse_timeleft, bomb_exploded, bomb_being_defused, bomb_defuse_length, bomb_defuse_end, triggerbot_shoot }
} }
/// Returns empty RadarData, it's also the same data that gets sent to clients when not ingame /// Returns empty RadarData, it's also the same data that gets sent to clients when not ingame
@ -99,7 +102,8 @@ impl RadarData {
bomb_exploded: false, bomb_exploded: false,
bomb_being_defused: false, bomb_being_defused: false,
bomb_defuse_length: 0.0, bomb_defuse_length: 0.0,
bomb_defuse_end: 0.0 bomb_defuse_end: 0.0,
triggerbot_shoot: false,
} }
} }
} }

@ -97,6 +97,7 @@ impl DmaCtx {
let mut team = 0i32; let mut team = 0i32;
let mut clipping_weapon = 0u64; let mut clipping_weapon = 0u64;
let mut is_scoped = 0u8; let mut is_scoped = 0u8;
let mut crosshair_id = 0u8;
{ {
let mut batcher = MemoryViewBatcher::new(&mut self.process); let mut batcher = MemoryViewBatcher::new(&mut self.process);
@ -105,7 +106,8 @@ impl DmaCtx {
batcher.read_into(pawn + cs2dumper::client::C_BaseEntity::m_iHealth, &mut health); batcher.read_into(pawn + cs2dumper::client::C_BaseEntity::m_iHealth, &mut health);
batcher.read_into(controller + cs2dumper::client::C_BaseEntity::m_iTeamNum, &mut team); batcher.read_into(controller + cs2dumper::client::C_BaseEntity::m_iTeamNum, &mut team);
batcher.read_into(pawn + cs2dumper::client::C_CSPlayerPawnBase::m_pClippingWeapon, &mut clipping_weapon); batcher.read_into(pawn + cs2dumper::client::C_CSPlayerPawnBase::m_pClippingWeapon, &mut clipping_weapon);
batcher.read_into(pawn + cs2dumper::client::C_CSPlayerPawn::m_bIsScoped, &mut is_scoped); batcher.read_into(pawn + cs2dumper::client::C_CSPlayerPawnBase::m_bIsScoped, &mut is_scoped);
batcher.read_into(pawn + cs2dumper::client::C_CSPlayerPawnBase::m_iIDEntIndex, &mut crosshair_id);
} }
let team = TeamID::from_i32(team); let team = TeamID::from_i32(team);
@ -126,7 +128,8 @@ impl DmaCtx {
team, team,
health, health,
has_awp, has_awp,
is_scoped: is_scoped != 0 is_scoped: is_scoped != 0,
crosshair_id
}) })
} }
@ -252,4 +255,5 @@ pub struct BatchedPlayerData {
pub health: u32, pub health: u32,
pub has_awp: bool, pub has_awp: bool,
pub is_scoped: bool, pub is_scoped: bool,
pub crosshair_id: u8,
} }

@ -220,7 +220,8 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
data.bomb_exploded, data.bomb_exploded,
data.bomb_being_defused, data.bomb_being_defused,
data.bomb_defuse_length, data.bomb_defuse_length,
bomb_defuse_end bomb_defuse_end,
local_data.crosshair_id != 0
); );
} else { } else {
let mut radar = radar_data.write().await; let mut radar = radar_data.write().await;