Add: Show money on radar
This commit is contained in:
37
src/comms.rs
37
src/comms.rs
@@ -23,11 +23,40 @@ pub struct PlayerData {
|
||||
|
||||
#[serde(rename = "weaponId")]
|
||||
weapon_id: i16,
|
||||
|
||||
#[serde(rename = "money", default)]
|
||||
money: i32,
|
||||
}
|
||||
|
||||
impl PlayerData {
|
||||
pub fn new(pos: Vec3, yaw: f32, player_type: PlayerType, has_bomb: bool, has_awp: bool, is_scoped: bool, player_name: String, weapon_id: i16) -> PlayerData {
|
||||
PlayerData { pos, yaw, player_type, has_bomb, has_awp, is_scoped, player_name, weapon_id }
|
||||
pub fn new(pos: Vec3, yaw: f32, player_type: PlayerType, has_bomb: bool, has_awp: bool,
|
||||
is_scoped: bool, player_name: String, weapon_id: i16) -> PlayerData {
|
||||
PlayerData {
|
||||
pos,
|
||||
yaw,
|
||||
player_type,
|
||||
has_bomb,
|
||||
has_awp,
|
||||
is_scoped,
|
||||
player_name,
|
||||
weapon_id,
|
||||
money: 0
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_with_money(pos: Vec3, yaw: f32, player_type: PlayerType, has_bomb: bool, has_awp: bool,
|
||||
is_scoped: bool, player_name: String, weapon_id: i16, money: i32) -> PlayerData {
|
||||
PlayerData {
|
||||
pos,
|
||||
yaw,
|
||||
player_type,
|
||||
has_bomb,
|
||||
has_awp,
|
||||
is_scoped,
|
||||
player_name,
|
||||
weapon_id,
|
||||
money
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,12 +84,16 @@ pub enum EntityData {
|
||||
pub struct CheatOptions {
|
||||
#[serde(rename = "revealMoney")]
|
||||
pub reveal_money: bool,
|
||||
|
||||
#[serde(rename = "displayMoney")]
|
||||
pub display_money: bool,
|
||||
}
|
||||
|
||||
impl Default for CheatOptions {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
reveal_money: false,
|
||||
display_money: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,8 @@ impl DmaCtx {
|
||||
let mut clipping_weapon = 0u64;
|
||||
let mut is_scoped = 0u8;
|
||||
let mut player_name_ptr = 0u64;
|
||||
let mut money = 0i32;
|
||||
let mut money_services_ptr = 0u64;
|
||||
|
||||
{
|
||||
let mut batcher = MemoryViewBatcher::new(&mut self.process);
|
||||
@@ -108,6 +110,15 @@ impl DmaCtx {
|
||||
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(controller + cs2dumper::client::CCSPlayerController::m_sSanitizedPlayerName, &mut player_name_ptr);
|
||||
|
||||
batcher.read_into(controller + cs2dumper::client::CCSPlayerController::m_pInGameMoneyServices, &mut money_services_ptr);
|
||||
}
|
||||
|
||||
if money_services_ptr != 0 {
|
||||
let money_addr: Address = money_services_ptr.into();
|
||||
money = self.process.read(money_addr + cs2dumper::client::CCSPlayerController_InGameMoneyServices::m_iAccount)?;
|
||||
|
||||
log::debug!("Read money value: {} for player", money);
|
||||
}
|
||||
|
||||
let player_name = if player_name_ptr != 0 {
|
||||
@@ -145,6 +156,7 @@ impl DmaCtx {
|
||||
is_scoped: is_scoped != 0,
|
||||
player_name,
|
||||
weapon_id,
|
||||
money,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -273,4 +285,5 @@ pub struct BatchedPlayerData {
|
||||
pub is_scoped: bool,
|
||||
pub player_name: String,
|
||||
pub weapon_id: i16,
|
||||
pub money: i32,
|
||||
}
|
||||
@@ -196,7 +196,7 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
||||
|
||||
entity_data.push(
|
||||
EntityData::Player(
|
||||
PlayerData::new(
|
||||
PlayerData::new_with_money(
|
||||
local_data.pos,
|
||||
local_data.yaw,
|
||||
PlayerType::Local,
|
||||
@@ -204,10 +204,12 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
||||
local_data.has_awp,
|
||||
local_data.is_scoped,
|
||||
local_data.player_name,
|
||||
local_data.weapon_id
|
||||
local_data.weapon_id,
|
||||
local_data.money
|
||||
)
|
||||
)
|
||||
);
|
||||
log::debug!("Added local player with money: {}", local_data.money);
|
||||
}
|
||||
|
||||
// Other players
|
||||
@@ -235,7 +237,7 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
||||
|
||||
entity_data.push(
|
||||
EntityData::Player(
|
||||
PlayerData::new(
|
||||
PlayerData::new_with_money(
|
||||
player_data.pos,
|
||||
player_data.yaw,
|
||||
player_type,
|
||||
@@ -243,7 +245,8 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
||||
player_data.has_awp,
|
||||
player_data.is_scoped,
|
||||
player_data.player_name,
|
||||
player_data.weapon_id
|
||||
player_data.weapon_id,
|
||||
player_data.money
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user