Compare commits
1 Commits
ba28f01247
...
offset-fix
| Author | SHA1 | Date | |
|---|---|---|---|
| 7af8d821f8 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,3 @@
|
|||||||
/src/dma/cs2dumper/offsets_mod.rs
|
/src/dma/cs2dumper/offsets_mod.rs
|
||||||
/src/dma/cs2dumper/client_mod.rs
|
/src/dma/cs2dumper/client_mod.rs
|
||||||
/src/dma/cs2dumper/engine2_mod.rs
|
/src/dma/cs2dumper/engine2_mod.rs
|
||||||
dump.sh
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Before you begin, install the necessary memflow plugins using memflowup from the
|
|||||||
The needed Plugins are `memflow-qemu` and `memflow-win32`
|
The needed Plugins are `memflow-qemu` and `memflow-win32`
|
||||||
|
|
||||||
Clone the repo on your vm host:
|
Clone the repo on your vm host:
|
||||||
`git clone https://git.deadzone.lol/Wizzard/radarflow2-kvm.git`
|
`git clone https://github.com/superyu1337/radarflow2.git`
|
||||||
|
|
||||||
Run radarflow:
|
Run radarflow:
|
||||||
`cargo run --release`
|
`cargo run --release`
|
||||||
@@ -38,7 +38,7 @@ Check the dlopen documentation for all possible import paths.
|
|||||||
```
|
```
|
||||||
|
|
||||||
Clone the repo on your attacking pc:
|
Clone the repo on your attacking pc:
|
||||||
`git clone https://git.deadzone.lol/Wizzard/radarflow2-kvm.git`
|
`git clone https://github.com/superyu1337/radarflow2.git`
|
||||||
|
|
||||||
Run radarflow:
|
Run radarflow:
|
||||||
`cargo run --release -- --connector pcileech`
|
`cargo run --release -- --connector pcileech`
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use memflow::plugins::Inventory;
|
|||||||
use crate::dma::Connector;
|
use crate::dma::Connector;
|
||||||
const PORT_RANGE: std::ops::RangeInclusive<usize> = 8000..=65535;
|
const PORT_RANGE: std::ops::RangeInclusive<usize> = 8000..=65535;
|
||||||
|
|
||||||
#[derive(Parser, Clone)]
|
#[derive(Parser)]
|
||||||
#[command(author, version = version(), about, long_about = None)]
|
#[command(author, version = version(), about, long_about = None)]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
/// Specifies the connector type for DMA
|
/// Specifies the connector type for DMA
|
||||||
|
|||||||
53
src/comms.rs
53
src/comms.rs
@@ -16,18 +16,12 @@ pub struct PlayerData {
|
|||||||
has_awp: bool,
|
has_awp: bool,
|
||||||
|
|
||||||
#[serde(rename = "isScoped")]
|
#[serde(rename = "isScoped")]
|
||||||
is_scoped: bool,
|
is_scoped: bool
|
||||||
|
|
||||||
#[serde(rename = "playerName")]
|
|
||||||
player_name: String,
|
|
||||||
|
|
||||||
#[serde(rename = "weaponId")]
|
|
||||||
weapon_id: i16,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PlayerData {
|
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 {
|
pub fn new(pos: Vec3, yaw: f32, player_type: PlayerType, has_bomb: bool, has_awp: bool, is_scoped: bool) -> PlayerData {
|
||||||
PlayerData { pos, yaw, player_type, has_bomb, has_awp, is_scoped, player_name, weapon_id }
|
PlayerData { pos, yaw, player_type, has_bomb, has_awp, is_scoped }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,20 +45,6 @@ pub enum EntityData {
|
|||||||
Bomb(BombData)
|
Bomb(BombData)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
||||||
pub struct CheatOptions {
|
|
||||||
#[serde(rename = "revealMoney")]
|
|
||||||
pub reveal_money: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for CheatOptions {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
reveal_money: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct RadarData {
|
pub struct RadarData {
|
||||||
freq: usize,
|
freq: usize,
|
||||||
@@ -97,30 +77,13 @@ pub struct RadarData {
|
|||||||
#[serde(rename(serialize = "entityData"))]
|
#[serde(rename(serialize = "entityData"))]
|
||||||
player_data: Vec<EntityData>,
|
player_data: Vec<EntityData>,
|
||||||
|
|
||||||
#[serde(rename = "options")]
|
//#[serde(rename(serialize = "localYaw"))]
|
||||||
options: CheatOptions,
|
//local_yaw: f32,
|
||||||
|
|
||||||
#[serde(skip)]
|
|
||||||
pub money_reveal_enabled: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) -> RadarData {
|
||||||
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 }
|
||||||
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,
|
|
||||||
options: CheatOptions::default(),
|
|
||||||
money_reveal_enabled: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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
|
||||||
@@ -136,9 +99,7 @@ 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
|
||||||
options: CheatOptions::default(),
|
|
||||||
money_reveal_enabled: false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ 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 player_name_ptr = 0u64;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut batcher = MemoryViewBatcher::new(&mut self.process);
|
let mut batcher = MemoryViewBatcher::new(&mut self.process);
|
||||||
@@ -107,33 +106,18 @@ impl DmaCtx {
|
|||||||
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_CSPlayerPawn::m_bIsScoped, &mut is_scoped);
|
||||||
batcher.read_into(controller + cs2dumper::client::CCSPlayerController::m_sSanitizedPlayerName, &mut player_name_ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let player_name = if player_name_ptr != 0 {
|
|
||||||
let mut name_buffer = [0u8; 32];
|
|
||||||
self.process.read_raw_into(player_name_ptr.into(), &mut name_buffer)?;
|
|
||||||
|
|
||||||
let name_len = name_buffer.iter().position(|&c| c == 0).unwrap_or(name_buffer.len());
|
|
||||||
String::from_utf8_lossy(&name_buffer[..name_len]).to_string()
|
|
||||||
} else {
|
|
||||||
match team {
|
|
||||||
2 => format!("T Player"),
|
|
||||||
3 => format!("CT Player"),
|
|
||||||
_ => format!("Unknown Player"),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let team = TeamID::from_i32(team);
|
let team = TeamID::from_i32(team);
|
||||||
|
|
||||||
let (has_awp, weapon_id) = {
|
let has_awp = {
|
||||||
let clipping_weapon: Address = clipping_weapon.into();
|
let clipping_weapon: Address = clipping_weapon.into();
|
||||||
let items_def_idx_addr = clipping_weapon + cs2dumper::client::C_EconEntity::m_AttributeManager
|
let items_def_idx_addr = clipping_weapon + cs2dumper::client::C_EconEntity::m_AttributeManager
|
||||||
+ cs2dumper::client::C_AttributeContainer::m_Item + cs2dumper::client::C_EconItemView::m_iItemDefinitionIndex;
|
+ cs2dumper::client::C_AttributeContainer::m_Item + cs2dumper::client::C_EconItemView::m_iItemDefinitionIndex;
|
||||||
|
|
||||||
let items_def_idx: i16 = self.process.read(items_def_idx_addr)?;
|
let items_def_idx: i16 = self.process.read(items_def_idx_addr)?;
|
||||||
|
|
||||||
(items_def_idx == 9, items_def_idx)
|
items_def_idx == 9
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(BatchedPlayerData {
|
Ok(BatchedPlayerData {
|
||||||
@@ -142,9 +126,7 @@ impl DmaCtx {
|
|||||||
team,
|
team,
|
||||||
health,
|
health,
|
||||||
has_awp,
|
has_awp,
|
||||||
is_scoped: is_scoped != 0,
|
is_scoped: is_scoped != 0
|
||||||
player_name,
|
|
||||||
weapon_id,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,8 +178,7 @@ impl DmaCtx {
|
|||||||
let mut data_vec: Vec<(Address, u64, Vec<(u64, i32)>)> = data_vec
|
let mut data_vec: Vec<(Address, u64, Vec<(u64, i32)>)> = data_vec
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(pawn, _, wep_count, wep_base)| {
|
.map(|(pawn, _, wep_count, wep_base)| {
|
||||||
let safe_count = if wep_count < 0 || wep_count > 32 { 0 } else { wep_count };
|
let weps = (0..wep_count).into_iter().map(|idx| (0u64, idx)).collect();
|
||||||
let weps = (0..safe_count).into_iter().map(|idx| (0u64, idx)).collect();
|
|
||||||
(pawn, wep_base, weps)
|
(pawn, wep_base, weps)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
@@ -207,7 +188,7 @@ impl DmaCtx {
|
|||||||
data_vec.iter_mut().for_each(|(_, wep_base, wep_data_vec)| {
|
data_vec.iter_mut().for_each(|(_, wep_base, wep_data_vec)| {
|
||||||
wep_data_vec.iter_mut().for_each(|(_, idx)| {
|
wep_data_vec.iter_mut().for_each(|(_, idx)| {
|
||||||
let b: Address = (*wep_base).into();
|
let b: Address = (*wep_base).into();
|
||||||
batcher.read_into(b + u64::saturating_mul(*idx as u64, 0x4), idx);
|
batcher.read_into(b + * idx * 0x4, idx);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
drop(batcher);
|
drop(batcher);
|
||||||
@@ -271,6 +252,4 @@ 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 player_name: String,
|
|
||||||
pub weapon_id: i16,
|
|
||||||
}
|
}
|
||||||
@@ -4,28 +4,17 @@ use memflow::{mem::MemoryView, os::Process, types::Address};
|
|||||||
|
|
||||||
use crate::{enums::PlayerType, comms::{EntityData, PlayerData, RadarData, ArcRwlockRadarData, BombData}};
|
use crate::{enums::PlayerType, comms::{EntityData, PlayerData, RadarData, ArcRwlockRadarData, BombData}};
|
||||||
|
|
||||||
use crate::money_reveal::MoneyReveal;
|
|
||||||
|
|
||||||
use self::{context::DmaCtx, threaddata::CsData};
|
use self::{context::DmaCtx, threaddata::CsData};
|
||||||
|
|
||||||
pub mod context;
|
mod context;
|
||||||
pub mod threaddata;
|
mod threaddata;
|
||||||
mod cs2dumper;
|
mod cs2dumper;
|
||||||
|
|
||||||
pub use context::Connector;
|
pub use context::Connector;
|
||||||
|
|
||||||
pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_device: String, skip_version: bool) -> anyhow::Result<()> {
|
pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_device: String, skip_version: bool) -> anyhow::Result<()> {
|
||||||
let mut ctx = DmaCtx::setup(connector, pcileech_device, skip_version)?;
|
let mut ctx = DmaCtx::setup(connector, pcileech_device, skip_version)?;
|
||||||
let mut data = CsData {
|
let mut data = CsData { recheck_bomb_holder: true, ..Default::default() };
|
||||||
recheck_bomb_holder: true,
|
|
||||||
money_reveal_enabled: false,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut money_reveal = MoneyReveal::new();
|
|
||||||
if let Err(e) = money_reveal.init(&mut ctx.process, &ctx.client_module) {
|
|
||||||
log::warn!("Failed to initialize money reveal: {}", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// For read timing
|
// For read timing
|
||||||
let mut last_bomb_dropped = false;
|
let mut last_bomb_dropped = false;
|
||||||
@@ -58,17 +47,6 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
|||||||
|
|
||||||
data.update_common(&mut ctx);
|
data.update_common(&mut ctx);
|
||||||
|
|
||||||
{
|
|
||||||
let radar = radar_data.read().await;
|
|
||||||
if radar.money_reveal_enabled != data.money_reveal_enabled {
|
|
||||||
data.money_reveal_enabled = radar.money_reveal_enabled;
|
|
||||||
|
|
||||||
if let Err(e) = money_reveal.toggle(&mut ctx.process) {
|
|
||||||
log::warn!("Failed to toggle money reveal: {}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bomb update
|
// Bomb update
|
||||||
if (data.bomb_dropped && !last_bomb_dropped) || (data.bomb_planted && !last_bomb_planted) {
|
if (data.bomb_dropped && !last_bomb_dropped) || (data.bomb_planted && !last_bomb_planted) {
|
||||||
data.update_bomb(&mut ctx);
|
data.update_bomb(&mut ctx);
|
||||||
@@ -101,15 +79,7 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
|||||||
|
|
||||||
pawns.push(data.local_pawn.into());
|
pawns.push(data.local_pawn.into());
|
||||||
|
|
||||||
let prev_holder = data.bomb_holder;
|
|
||||||
|
|
||||||
data.bomb_holder = ctx.get_c4_holder(pawns, data.entity_list.into(), &data);
|
data.bomb_holder = ctx.get_c4_holder(pawns, data.entity_list.into(), &data);
|
||||||
|
|
||||||
if data.bomb_holder.is_some() && prev_holder.is_none() {
|
|
||||||
log::debug!("Bomb picked up by player");
|
|
||||||
data.bomb_dropped = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
data.recheck_bomb_holder = false;
|
data.recheck_bomb_holder = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,25 +138,18 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
|||||||
|
|
||||||
// Bomb
|
// Bomb
|
||||||
if data.bomb_dropped || data.bomb_planted {
|
if data.bomb_dropped || data.bomb_planted {
|
||||||
if let Ok(node) = ctx.process.read_addr64(
|
let node = ctx.process.read_addr64(
|
||||||
data.bomb + cs2dumper::client::C_BaseEntity::m_pGameSceneNode as u64
|
data.bomb + cs2dumper::client::C_BaseEntity::m_pGameSceneNode as u64
|
||||||
) {
|
).unwrap();
|
||||||
if let Ok(pos) = ctx.process.read(node + cs2dumper::client::CGameSceneNode::m_vecAbsOrigin) {
|
let pos = ctx.process.read(node + cs2dumper::client::CGameSceneNode::m_vecAbsOrigin).unwrap();
|
||||||
|
|
||||||
entity_data.push(EntityData::Bomb(BombData::new(pos, data.bomb_planted)));
|
entity_data.push(EntityData::Bomb(BombData::new(pos, data.bomb_planted)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Local player
|
// Local player
|
||||||
let local_data = match ctx.batched_player_read(
|
let local_data = ctx.batched_player_read(
|
||||||
data.local.into(), data.local_pawn.into()
|
data.local.into(), data.local_pawn.into()
|
||||||
) {
|
).unwrap();
|
||||||
Ok(data) => data,
|
|
||||||
Err(e) => {
|
|
||||||
log::warn!("Failed to read local player data: {}", e);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if local_data.health > 0 {
|
if local_data.health > 0 {
|
||||||
let has_bomb = match data.bomb_holder {
|
let has_bomb = match data.bomb_holder {
|
||||||
@@ -202,9 +165,7 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
|||||||
PlayerType::Local,
|
PlayerType::Local,
|
||||||
has_bomb,
|
has_bomb,
|
||||||
local_data.has_awp,
|
local_data.has_awp,
|
||||||
local_data.is_scoped,
|
local_data.is_scoped
|
||||||
local_data.player_name,
|
|
||||||
local_data.weapon_id
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -212,8 +173,8 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
|||||||
|
|
||||||
// Other players
|
// Other players
|
||||||
for (controller, pawn) in &data.players {
|
for (controller, pawn) in &data.players {
|
||||||
match ctx.batched_player_read(*controller, *pawn) {
|
let player_data = ctx.batched_player_read(*controller, *pawn).unwrap();
|
||||||
Ok(player_data) => {
|
|
||||||
if player_data.health < 1 {
|
if player_data.health < 1 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -241,18 +202,10 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
|||||||
player_type,
|
player_type,
|
||||||
has_bomb,
|
has_bomb,
|
||||||
player_data.has_awp,
|
player_data.has_awp,
|
||||||
player_data.is_scoped,
|
player_data.is_scoped
|
||||||
player_data.player_name,
|
|
||||||
player_data.weapon_id
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
},
|
|
||||||
Err(e) => {
|
|
||||||
log::warn!("Failed to read player data: {}", e);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut radar = radar_data.write().await;
|
let mut radar = radar_data.write().await;
|
||||||
@@ -269,12 +222,9 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
|||||||
data.bomb_defuse_length,
|
data.bomb_defuse_length,
|
||||||
bomb_defuse_end
|
bomb_defuse_end
|
||||||
);
|
);
|
||||||
|
|
||||||
radar.money_reveal_enabled = data.money_reveal_enabled;
|
|
||||||
} else {
|
} else {
|
||||||
let mut radar = radar_data.write().await;
|
let mut radar = radar_data.write().await;
|
||||||
*radar = RadarData::empty(freq);
|
*radar = RadarData::empty(freq);
|
||||||
radar.money_reveal_enabled = data.money_reveal_enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
last_tick_count = data.tick_count;
|
last_tick_count = data.tick_count;
|
||||||
@@ -289,10 +239,5 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
|
|||||||
thread::sleep(Duration::from_millis(1));
|
thread::sleep(Duration::from_millis(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
let cleanup_result = money_reveal.ensure_disabled(&mut ctx.process);
|
|
||||||
if let Err(e) = cleanup_result {
|
|
||||||
log::warn!("Failed to cleanup money reveal: {}", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,6 @@ pub struct CsData {
|
|||||||
pub bomb_defuse_length: f32,
|
pub bomb_defuse_length: f32,
|
||||||
pub bomb_exploded: bool,
|
pub bomb_exploded: bool,
|
||||||
pub bomb_defused: bool,
|
pub bomb_defused: bool,
|
||||||
pub money_reveal_enabled: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -105,12 +104,10 @@ impl CsData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if self.bomb_planted {
|
} else if self.bomb_planted {
|
||||||
match ctx.get_plantedc4() {
|
let bomb = ctx.get_plantedc4()
|
||||||
Ok(bomb) => self.bomb = bomb,
|
.expect("Failed to get planted bomb");
|
||||||
Err(e) => {
|
|
||||||
log::warn!("Failed to get planted bomb: {}", e);
|
self.bomb = bomb;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
src/main.rs
13
src/main.rs
@@ -13,9 +13,6 @@ mod comms;
|
|||||||
mod dma;
|
mod dma;
|
||||||
mod websocket;
|
mod websocket;
|
||||||
|
|
||||||
mod pattern;
|
|
||||||
mod money_reveal;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
let cli: Cli = Cli::parse();
|
let cli: Cli = Cli::parse();
|
||||||
@@ -32,7 +29,6 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let radar_clone = radar_data.clone();
|
let radar_clone = radar_data.clone();
|
||||||
|
|
||||||
let dma_handle = tokio::spawn(async move {
|
let dma_handle = tokio::spawn(async move {
|
||||||
if let Err(err) = dma::run(radar_clone, cli.connector, cli.pcileech_device, cli.skip_version).await {
|
if let Err(err) = dma::run(radar_clone, cli.connector, cli.pcileech_device, cli.skip_version).await {
|
||||||
log::error!("Error in dma thread: [{}]", err.to_string());
|
log::error!("Error in dma thread: [{}]", err.to_string());
|
||||||
@@ -41,19 +37,16 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let web_path = cli.web_path.clone();
|
|
||||||
let port = cli.port;
|
|
||||||
|
|
||||||
let _websocket_handle = tokio::spawn(async move {
|
let _websocket_handle = tokio::spawn(async move {
|
||||||
if let Ok(my_local_ip) = local_ip_address::local_ip() {
|
if let Ok(my_local_ip) = local_ip_address::local_ip() {
|
||||||
let address = format!("http://{}:{}", my_local_ip, port);
|
let address = format!("http://{}:{}", my_local_ip, cli.port);
|
||||||
println!("Launched webserver at {}", address);
|
println!("Launched webserver at {}", address);
|
||||||
} else {
|
} else {
|
||||||
let address = format!("http://0.0.0.0:{}", port);
|
let address = format!("http://0.0.0.0:{}", cli.port);
|
||||||
println!("launched webserver at {}", address);
|
println!("launched webserver at {}", address);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(err) = websocket::run(web_path, port, radar_data).await {
|
if let Err(err) = websocket::run(cli.web_path, cli.port, radar_data).await {
|
||||||
log::error!("Error in ws server: [{}]", err.to_string());
|
log::error!("Error in ws server: [{}]", err.to_string());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
use memflow::{mem::MemoryView, types::Address, os::ModuleInfo};
|
|
||||||
use crate::pattern::pattern_scan;
|
|
||||||
|
|
||||||
const BUF_SIZE: usize = 3;
|
|
||||||
|
|
||||||
pub struct MoneyReveal {
|
|
||||||
pub is_enabled: bool,
|
|
||||||
pub address: Option<Address>,
|
|
||||||
original_bytes: Option<[u8; BUF_SIZE]>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl MoneyReveal {
|
|
||||||
pub fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
is_enabled: false,
|
|
||||||
address: None,
|
|
||||||
original_bytes: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn init(&mut self, mem: &mut impl MemoryView, client_module: &ModuleInfo) -> anyhow::Result<()> {
|
|
||||||
self.address = self.find_function(mem, client_module)?;
|
|
||||||
log::info!("Money reveal function found at: {:?}", self.address);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn toggle(&mut self, mem: &mut impl MemoryView) -> anyhow::Result<bool> {
|
|
||||||
if let Some(addr) = self.address {
|
|
||||||
if self.is_enabled {
|
|
||||||
if let Some(original) = self.original_bytes {
|
|
||||||
self.restore(mem, addr, original)?;
|
|
||||||
self.original_bytes = None;
|
|
||||||
self.is_enabled = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let original = self.patch(mem, addr)?;
|
|
||||||
self.original_bytes = Some(original);
|
|
||||||
self.is_enabled = true;
|
|
||||||
}
|
|
||||||
Ok(self.is_enabled)
|
|
||||||
} else {
|
|
||||||
Err(anyhow::anyhow!("Money reveal not initialized"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn ensure_disabled(&mut self, mem: &mut impl MemoryView) -> anyhow::Result<()> {
|
|
||||||
if self.is_enabled {
|
|
||||||
if let Some(addr) = self.address {
|
|
||||||
if let Some(original) = self.original_bytes {
|
|
||||||
self.restore(mem, addr, original)?;
|
|
||||||
self.is_enabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn find_function(&self, mem: &mut impl MemoryView, module: &ModuleInfo) -> anyhow::Result<Option<Address>> {
|
|
||||||
let is_hltv = pattern_scan(
|
|
||||||
mem,
|
|
||||||
module,
|
|
||||||
"48 83 EC 28 48 8B 0D ?? ?? ?? ?? 48 8B 01 FF 90 ?? ?? ?? ?? 84 C0 75 0D"
|
|
||||||
)?;
|
|
||||||
|
|
||||||
if is_hltv.is_none() {
|
|
||||||
Ok(pattern_scan(
|
|
||||||
mem,
|
|
||||||
module,
|
|
||||||
"B0 01 C3 28 48 8B 0D ?? ?? ?? ?? 48 8B 01 FF 90 ?? ?? ?? ?? 84 C0 75 0D"
|
|
||||||
)?)
|
|
||||||
} else {
|
|
||||||
Ok(is_hltv)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn patch(&self, mem: &mut impl MemoryView, location: Address) -> anyhow::Result<[u8; BUF_SIZE]> {
|
|
||||||
let mut original_buf = [0u8; BUF_SIZE];
|
|
||||||
mem.read_into(location, &mut original_buf)?;
|
|
||||||
|
|
||||||
let new_buf: [u8; BUF_SIZE] = [
|
|
||||||
0xB0, 0x01, // MOV AL,1
|
|
||||||
0xC3 // RET
|
|
||||||
];
|
|
||||||
|
|
||||||
log::debug!("Patching memory for money reveal");
|
|
||||||
mem.write(location, &new_buf)?;
|
|
||||||
|
|
||||||
Ok(original_buf)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn restore(&self, mem: &mut impl MemoryView, location: Address, original: [u8; BUF_SIZE]) -> anyhow::Result<()> {
|
|
||||||
log::debug!("Restoring memory for money reveal");
|
|
||||||
mem.write(location, &original)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
use std::io::Read;
|
|
||||||
use log::warn;
|
|
||||||
use memflow::{os::ModuleInfo, mem::MemoryView, types::Address};
|
|
||||||
|
|
||||||
fn pattern_to_bytes(pattern: String) -> Vec<Option<u8>> {
|
|
||||||
pattern.split(' ')
|
|
||||||
.fold(Vec::new(), |mut accum, str| {
|
|
||||||
if str == "??" {
|
|
||||||
accum.push(None);
|
|
||||||
} else {
|
|
||||||
let byte = u8::from_str_radix(str, 16).unwrap();
|
|
||||||
accum.push(Some(byte));
|
|
||||||
}
|
|
||||||
|
|
||||||
accum
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn pattern_scan(mem: &mut impl MemoryView, module: &ModuleInfo, sig: &str) -> anyhow::Result<Option<Address>> {
|
|
||||||
let pattern_bytes = pattern_to_bytes(sig.to_owned());
|
|
||||||
let mut cursor = mem.cursor();
|
|
||||||
|
|
||||||
log::debug!("Searching \"{}\" for pattern: \"{}\"", module.name, sig);
|
|
||||||
|
|
||||||
for i in 0..module.size {
|
|
||||||
let mut found = true;
|
|
||||||
cursor.set_address(module.base + i);
|
|
||||||
|
|
||||||
let mut buf = vec![0u8; pattern_bytes.len()];
|
|
||||||
|
|
||||||
if let Err(_) = cursor.read(&mut buf) {
|
|
||||||
warn!("Encountered read error while scanning for pattern");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (idx, byte) in buf.iter().enumerate() {
|
|
||||||
if let Some(pat_byte) = pattern_bytes[idx] {
|
|
||||||
if *byte != pat_byte {
|
|
||||||
found = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if found {
|
|
||||||
return Ok(Some(module.base + i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
@@ -25,8 +25,7 @@ async fn ws_handler(ws: WebSocketUpgrade, State(state): State<AppState>) -> Resp
|
|||||||
async fn handle_socket(mut socket: WebSocket, state: AppState) {
|
async fn handle_socket(mut socket: WebSocket, state: AppState) {
|
||||||
while let Some(msg) = socket.recv().await {
|
while let Some(msg) = socket.recv().await {
|
||||||
if let Ok(msg) = msg {
|
if let Ok(msg) = msg {
|
||||||
if let Ok(text) = msg.to_text() {
|
if msg == Message::Text("requestInfo".to_string()) {
|
||||||
if text == "requestInfo" {
|
|
||||||
let str = {
|
let str = {
|
||||||
let data = state.data_lock.read().await;
|
let data = state.data_lock.read().await;
|
||||||
|
|
||||||
@@ -40,28 +39,15 @@ async fn handle_socket(mut socket: WebSocket, state: AppState) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//println!("{str}");
|
||||||
|
|
||||||
if socket.send(Message::Text(str)).await.is_err() {
|
if socket.send(Message::Text(str)).await.is_err() {
|
||||||
|
// client disconnected
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if text == "toggleMoneyReveal" {
|
|
||||||
let new_value = {
|
|
||||||
let mut data = state.data_lock.write().await;
|
|
||||||
data.money_reveal_enabled = !data.money_reveal_enabled;
|
|
||||||
data.money_reveal_enabled
|
|
||||||
};
|
|
||||||
|
|
||||||
let response = serde_json::json!({
|
|
||||||
"action": "toggleMoneyReveal",
|
|
||||||
"status": "success",
|
|
||||||
"enabled": new_value
|
|
||||||
});
|
|
||||||
|
|
||||||
if socket.send(Message::Text(response.to_string())).await.is_err() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// client disconnected
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.7 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 126 KiB |
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"pos_x": -2308.0,
|
|
||||||
"pos_y": 2078.0,
|
|
||||||
"scale": 4.082077,
|
|
||||||
"rotate": 0,
|
|
||||||
"zoom": 0.0
|
|
||||||
}
|
|
||||||
@@ -1,70 +1,27 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>radarflow</title>
|
<title>radarflow</title>
|
||||||
<link href="styles.css" rel="stylesheet" type="text/css" />
|
<link href="styles.css" rel="stylesheet" type="text/css"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="canvasContainer">
|
<div id="canvasContainer">
|
||||||
<div id="settingsHolder">
|
<div id="settingsHolder">
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" onclick="toggleZoom()" id="zoomCheck" name="zoom" />
|
<input type="checkbox" onclick="toggleZoom()" id="zoomCheck" name="zoom"/>
|
||||||
<label for="zoomCheck">Zoom</label>
|
<label for="zoomCheck">Zoom</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" onclick="toggleStats()" id="statsCheck" name="stats" />
|
<input type="checkbox" onclick="toggleStats()" id="statsCheck" name="stats"/>
|
||||||
<label for="statsCheck">Stats</label>
|
<label for="statsCheck">Stats</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<input type="checkbox" onclick="toggleNames()" id="namesCheck" name="names" />
|
|
||||||
<label for="namesCheck">Player Names</label>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<input type="checkbox" onclick="toggleGuns()" id="gunsCheck" name="guns" />
|
|
||||||
<label for="gunsCheck">Weapons</label>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<input type="checkbox" onclick="toggleRotate()" id="rotateCheck" name="rotate" checked />
|
|
||||||
<label for="rotateCheck">Rotate Map</label>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<input type="checkbox" onclick="toggleCentered()" id="centerCheck" name="center" checked />
|
|
||||||
<label for="centerCheck">Player Centered</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button id="showDangerousBtn" onclick="toggleDangerousOptions()">Show Dangerous Options</button>
|
|
||||||
|
|
||||||
<div class="dangerous-options" id="dangerousOptions">
|
|
||||||
<div>
|
|
||||||
<input type="checkbox" onclick="toggleMoneyReveal()" id="moneyReveal" name="money" />
|
|
||||||
<label for="moneyReveal">Money Reveal (Write Memory)</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<canvas id="canvas"></canvas>
|
<canvas id="canvas"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
|
|
||||||
<script>
|
|
||||||
function toggleDangerousOptions() {
|
|
||||||
const dangerousSection = document.getElementById('dangerousOptions');
|
|
||||||
const button = document.getElementById('showDangerousBtn');
|
|
||||||
|
|
||||||
if (dangerousSection.classList.contains('revealed')) {
|
|
||||||
dangerousSection.classList.remove('revealed');
|
|
||||||
button.textContent = 'Show Dangerous Options';
|
|
||||||
} else {
|
|
||||||
dangerousSection.classList.add('revealed');
|
|
||||||
button.textContent = 'Hide Dangerous Options';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -6,13 +6,8 @@ const bombColor = "#eda338"
|
|||||||
const textColor = "#d1d1d1"
|
const textColor = "#d1d1d1"
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
shouldZoom = false
|
shouldZoom = true
|
||||||
rotateMap = true
|
drawStats = false
|
||||||
playerCentered = true
|
|
||||||
|
|
||||||
drawStats = true
|
|
||||||
drawNames = true
|
|
||||||
drawGuns = true
|
|
||||||
|
|
||||||
// Common
|
// Common
|
||||||
canvas = null
|
canvas = null
|
||||||
@@ -27,61 +22,12 @@ mapName = null
|
|||||||
loaded = false
|
loaded = false
|
||||||
entityData = null
|
entityData = null
|
||||||
update = false
|
update = false
|
||||||
localYaw = 0
|
|
||||||
localPlayerPos = null
|
|
||||||
|
|
||||||
/// Radarflow zoom in
|
/// Radarflow zoom in
|
||||||
zoomSet = false
|
zoomSet = false
|
||||||
safetyBound = 50
|
safetyBound = 50
|
||||||
boundingRect = null
|
boundingRect = null
|
||||||
|
|
||||||
// Weapon IDs
|
|
||||||
const weaponIdMap = {
|
|
||||||
1: "DEAGLE",
|
|
||||||
2: "DUALIES",
|
|
||||||
3: "FIVE-SEVEN",
|
|
||||||
4: "GLOCK",
|
|
||||||
7: "AK-47",
|
|
||||||
8: "AUG",
|
|
||||||
9: "AWP",
|
|
||||||
10: "FAMAS",
|
|
||||||
11: "G3SG1",
|
|
||||||
13: "GALIL",
|
|
||||||
14: "M249",
|
|
||||||
16: "M4A4",
|
|
||||||
17: "MAC-10",
|
|
||||||
19: "P90",
|
|
||||||
23: "MP5",
|
|
||||||
24: "UMP",
|
|
||||||
25: "XM1014",
|
|
||||||
26: "BIZON",
|
|
||||||
27: "MAG-7",
|
|
||||||
28: "NEGEV",
|
|
||||||
29: "SAWED-OFF",
|
|
||||||
30: "TEC-9",
|
|
||||||
31: "ZEUS",
|
|
||||||
32: "P2000",
|
|
||||||
33: "MP7",
|
|
||||||
34: "MP9",
|
|
||||||
35: "NOVA",
|
|
||||||
36: "P250",
|
|
||||||
38: "SCAR-20",
|
|
||||||
39: "SG 553",
|
|
||||||
40: "SCOUT",
|
|
||||||
60: "M4A1-S",
|
|
||||||
61: "USP-S",
|
|
||||||
63: "CZ75",
|
|
||||||
64: "REVOLVER",
|
|
||||||
43: "FLASH",
|
|
||||||
44: "HE",
|
|
||||||
45: "SMOKE",
|
|
||||||
46: "MOLOTOV",
|
|
||||||
47: "DECOY",
|
|
||||||
48: "INCENDIARY",
|
|
||||||
49: "C4",
|
|
||||||
0: "KNIFE"
|
|
||||||
};
|
|
||||||
|
|
||||||
// networking
|
// networking
|
||||||
websocket = null
|
websocket = null
|
||||||
if (location.protocol == 'https:') {
|
if (location.protocol == 'https:') {
|
||||||
@@ -93,50 +39,7 @@ if (location.protocol == 'https:') {
|
|||||||
|
|
||||||
// Util functions
|
// Util functions
|
||||||
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
||||||
const degreesToRadians = (degrees) => degrees * (Math.PI / 180);
|
const degreesToRadians = (degrees) => degrees * (Math.PI/180);
|
||||||
|
|
||||||
function mapCoordinates(coordinates) {
|
|
||||||
let offset_x = coordinates.x - map.pos_x;
|
|
||||||
let offset_y = coordinates.y - map.pos_y;
|
|
||||||
|
|
||||||
offset_x /= map.scale;
|
|
||||||
offset_y /= -map.scale;
|
|
||||||
|
|
||||||
return { x: offset_x, y: offset_y };
|
|
||||||
}
|
|
||||||
|
|
||||||
function boundingCoordinates(coordinates, boundingRect) {
|
|
||||||
const xScale = boundingRect.width / image.width;
|
|
||||||
const yScale = boundingRect.height / image.height;
|
|
||||||
|
|
||||||
const newX = (coordinates.x - boundingRect.x) / xScale;
|
|
||||||
const newY = (coordinates.y - boundingRect.y) / yScale;
|
|
||||||
|
|
||||||
return { x: newX, y: newY };
|
|
||||||
}
|
|
||||||
|
|
||||||
function boundingScale(value, boundingRect) {
|
|
||||||
const scale = image.width / boundingRect.width;
|
|
||||||
return value * scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
function rotatePoint(cx, cy, x, y, angle) {
|
|
||||||
const radians = degreesToRadians(angle);
|
|
||||||
const cos = Math.cos(radians);
|
|
||||||
const sin = Math.sin(radians);
|
|
||||||
|
|
||||||
const nx = x - cx;
|
|
||||||
const ny = y - cy;
|
|
||||||
|
|
||||||
const rx = nx * cos - ny * sin;
|
|
||||||
const ry = nx * sin + ny * cos;
|
|
||||||
|
|
||||||
return {
|
|
||||||
x: rx + cx,
|
|
||||||
y: ry + cy
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function makeBoundingRect(x1, y1, x2, y2, aspectRatio) {
|
function makeBoundingRect(x1, y1, x2, y2, aspectRatio) {
|
||||||
const topLeftX = x1;
|
const topLeftX = x1;
|
||||||
const topLeftY = y1;
|
const topLeftY = y1;
|
||||||
@@ -165,43 +68,69 @@ function makeBoundingRect(x1, y1, x2, y2, aspectRatio) {
|
|||||||
const rectMinY = centerY - newHeight / 2;
|
const rectMinY = centerY - newHeight / 2;
|
||||||
const rectMaxY = centerY + newHeight / 2;
|
const rectMaxY = centerY + newHeight / 2;
|
||||||
|
|
||||||
return {
|
const boundingRectangle = {
|
||||||
x: rectMinX,
|
x: rectMinX,
|
||||||
y: rectMinY,
|
y: rectMinY,
|
||||||
width: rectMaxX - rectMinX,
|
width: rectMaxX - rectMinX,
|
||||||
height: rectMaxY - rectMinY,
|
height: rectMaxY - rectMinY,
|
||||||
};
|
}
|
||||||
|
|
||||||
|
const boundingRectangle2 = {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width: image.width / 1.2,
|
||||||
|
height: image.width / 1.2,
|
||||||
|
}
|
||||||
|
|
||||||
|
return boundingRectangle;
|
||||||
|
}
|
||||||
|
|
||||||
|
function boundingCoordinates(coordinates, boundingRect) {
|
||||||
|
const xScale = boundingRect.width / image.width;
|
||||||
|
const yScale = boundingRect.height / image.height;
|
||||||
|
|
||||||
|
const newX = (coordinates.x - boundingRect.x) / xScale;
|
||||||
|
const newY = (coordinates.y - boundingRect.y) / yScale;
|
||||||
|
|
||||||
|
return {x: newX, y: newY};
|
||||||
|
}
|
||||||
|
|
||||||
|
function boundingScale(value, boundingRect) {
|
||||||
|
const scale = image.width / boundingRect.width;
|
||||||
|
return value * scale
|
||||||
|
}
|
||||||
|
|
||||||
|
function mapCoordinates(coordinates) {
|
||||||
|
let offset_x = coordinates.x - map.pos_x;
|
||||||
|
let offset_y = coordinates.y - map.pos_y;
|
||||||
|
|
||||||
|
offset_x /= map.scale;
|
||||||
|
offset_y /= -map.scale;
|
||||||
|
|
||||||
|
return {x: offset_x, y: offset_y}
|
||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
if (update) {
|
if (update) {
|
||||||
fillCanvas();
|
fillCanvas()
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
update = false;
|
update = false
|
||||||
|
|
||||||
localPlayerPos = null;
|
// Iterate through the array and update the min/max values
|
||||||
if (entityData != null) {
|
if (entityData != null && map != null && image != null && shouldZoom) {
|
||||||
entityData.forEach((data) => {
|
|
||||||
if (data.Player !== undefined && data.Player.playerType === "Local") {
|
|
||||||
localYaw = data.Player.yaw;
|
|
||||||
localPlayerPos = data.Player.pos;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entityData != null && map != null && image != null && shouldZoom && !playerCentered) {
|
let minX = Infinity
|
||||||
let minX = Infinity;
|
let minY = Infinity
|
||||||
let minY = Infinity;
|
let maxX = -Infinity
|
||||||
let maxX = -Infinity;
|
let maxY = -Infinity
|
||||||
let maxY = -Infinity;
|
|
||||||
|
|
||||||
entityData.forEach((data) => {
|
entityData.forEach((data) => {
|
||||||
let mapCords = null;
|
let mapCords = null
|
||||||
|
|
||||||
if (data.Bomb !== undefined) {
|
if (data.Bomb !== undefined) {
|
||||||
mapCords = mapCoordinates(data.Bomb.pos);
|
mapCords = mapCoordinates(data.Bomb.pos)
|
||||||
} else {
|
} else {
|
||||||
mapCords = mapCoordinates(data.Player.pos);
|
mapCords = mapCoordinates(data.Player.pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
minX = Math.min(minX, mapCords.x);
|
minX = Math.min(minX, mapCords.x);
|
||||||
@@ -210,28 +139,30 @@ function render() {
|
|||||||
maxY = Math.max(maxY, mapCords.y);
|
maxY = Math.max(maxY, mapCords.y);
|
||||||
});
|
});
|
||||||
|
|
||||||
boundingRect = makeBoundingRect(minX - safetyBound, minY - safetyBound, maxX + safetyBound, maxY + safetyBound, image.width / image.height);
|
|
||||||
zoomSet = true;
|
boundingRect = makeBoundingRect(minX-safetyBound, minY-safetyBound, maxX+safetyBound, maxY+safetyBound, image.width/image.height)
|
||||||
} else if (zoomSet && !playerCentered) {
|
|
||||||
zoomSet = false;
|
zoomSet = true
|
||||||
|
} else if (zoomSet) {
|
||||||
|
zoomSet = false
|
||||||
}
|
}
|
||||||
|
|
||||||
drawImage();
|
drawImage()
|
||||||
|
|
||||||
if (entityData != null) {
|
if (entityData != null) {
|
||||||
entityData.forEach((data) => {
|
entityData.forEach((data) => {
|
||||||
if (data.Bomb !== undefined) {
|
if (data.Bomb !== undefined) {
|
||||||
drawBomb(data.Bomb.pos, data.Bomb.isPlanted);
|
drawBomb(data.Bomb.pos, data.Bomb.isPlanted)
|
||||||
} else {
|
} else {
|
||||||
let fillStyle = localColor;
|
let fillStyle = localColor
|
||||||
|
|
||||||
switch (data.Player.playerType) {
|
switch (data.Player.playerType) {
|
||||||
case "Team":
|
case "Team":
|
||||||
fillStyle = teamColor;
|
fillStyle = teamColor
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Enemy":
|
case "Enemy":
|
||||||
fillStyle = enemyColor;
|
fillStyle = enemyColor
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,118 +174,92 @@ function render() {
|
|||||||
data.Player.yaw,
|
data.Player.yaw,
|
||||||
data.Player.hasAwp,
|
data.Player.hasAwp,
|
||||||
data.Player.playerType,
|
data.Player.playerType,
|
||||||
data.Player.isScoped,
|
|
||||||
data.Player.playerName,
|
|
||||||
false,
|
|
||||||
data.Player.weaponId
|
|
||||||
);
|
|
||||||
|
|
||||||
if (drawNames && !data.Player.isDormant) {
|
|
||||||
drawPlayerName(
|
|
||||||
data.Player.pos,
|
|
||||||
data.Player.playerName,
|
|
||||||
data.Player.playerType,
|
|
||||||
data.Player.hasAwp,
|
|
||||||
data.Player.hasBomb,
|
|
||||||
data.Player.isScoped
|
data.Player.isScoped
|
||||||
);
|
)
|
||||||
}
|
|
||||||
|
|
||||||
if (drawGuns && !data.Player.isDormant) {
|
|
||||||
drawPlayerWeapon(
|
|
||||||
data.Player.pos,
|
|
||||||
data.Player.playerType,
|
|
||||||
data.Player.weaponId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.Player.hasBomb && !data.Player.isDormant) {
|
|
||||||
drawPlayerBomb(
|
|
||||||
data.Player.pos,
|
|
||||||
data.Player.playerType
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radarData != null) {
|
if (radarData != null) {
|
||||||
if (radarData.bombPlanted && !radarData.bombExploded && radarData.bombDefuseTimeleft >= 0) {
|
if (radarData.bombPlanted && !radarData.bombExploded && radarData.bombDefuseTimeleft >= 0) {
|
||||||
let maxWidth = 1024 - 128 - 128;
|
|
||||||
|
let maxWidth = 1024-128-128;
|
||||||
let timeleft = radarData.bombDefuseTimeleft;
|
let timeleft = radarData.bombDefuseTimeleft;
|
||||||
|
|
||||||
// Base bar
|
// Base bar
|
||||||
ctx.fillStyle = "black";
|
ctx.fillStyle = "black"
|
||||||
ctx.fillRect(128, 16, maxWidth, 16);
|
ctx.fillRect(128, 16, maxWidth, 16)
|
||||||
|
|
||||||
// Bomb timer
|
// Bomb timer
|
||||||
if (radarData.bombBeingDefused) {
|
if (radarData.bombBeingDefused) {
|
||||||
if (radarData.bombCanDefuse) {
|
if (radarData.bombCanDefuse) {
|
||||||
ctx.fillStyle = teamColor;
|
ctx.fillStyle = teamColor
|
||||||
} else {
|
} else {
|
||||||
ctx.fillStyle = enemyColor;
|
ctx.fillStyle = enemyColor
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ctx.fillStyle = bombColor;
|
ctx.fillStyle = bombColor
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.fillRect(130, 18, (maxWidth - 2) * (timeleft / 40), 12);
|
ctx.fillRect(130, 18, (maxWidth-2) * (timeleft / 40), 12)
|
||||||
|
|
||||||
ctx.font = "24px Arial";
|
ctx.font = "24px Arial";
|
||||||
ctx.textAlign = "center";
|
ctx.textAlign = "center"
|
||||||
ctx.textBaseline = "middle";
|
ctx.textBaseline = "middle"
|
||||||
ctx.fillStyle = textColor;
|
ctx.fillStyle = textColor
|
||||||
ctx.fillText(`${timeleft.toFixed(1)}s`, 1024 / 2, 28 + 24);
|
ctx.fillText(`${timeleft.toFixed(1)}s`, 1024/2, 28+24);
|
||||||
|
|
||||||
// Defuse time lines
|
// Defuse time lines
|
||||||
ctx.strokeStyle = "black";
|
ctx.strokeStyle = "black"
|
||||||
ctx.lineWidth = 2;
|
ctx.lineWidth = 2
|
||||||
|
|
||||||
// Kit defuse
|
// Kit defuse
|
||||||
ctx.beginPath();
|
ctx.beginPath()
|
||||||
ctx.moveTo(128 + (maxWidth * (5 / 40)), 16);
|
ctx.moveTo(128 + (maxWidth * (5 / 40)), 16)
|
||||||
ctx.lineTo(128 + (maxWidth * (5 / 40)), 32);
|
ctx.lineTo(128 + (maxWidth * (5 / 40)), 32)
|
||||||
ctx.stroke();
|
ctx.stroke()
|
||||||
|
|
||||||
// Normal defuse
|
// Normal defuse
|
||||||
ctx.beginPath();
|
ctx.beginPath()
|
||||||
ctx.moveTo(130 + (maxWidth - 2) * (10 / 40), 16);
|
ctx.moveTo(130 + (maxWidth-2) * (10 / 40), 16)
|
||||||
ctx.lineTo(130 + (maxWidth - 2) * (10 / 40), 32);
|
ctx.lineTo(130 + (maxWidth-2) * (10 / 40), 32)
|
||||||
ctx.stroke();
|
ctx.stroke()
|
||||||
|
|
||||||
// Defuse stamp line
|
// Defuse stamp line
|
||||||
if (radarData.bombCanDefuse) {
|
if (radarData.bombCanDefuse) {
|
||||||
ctx.strokeStyle = "green";
|
console.log(radarData.bombDefuseEnd)
|
||||||
ctx.beginPath();
|
ctx.strokeStyle = "green"
|
||||||
ctx.moveTo(130 + (maxWidth - 2) * (radarData.bombDefuseEnd / 40), 16);
|
ctx.beginPath()
|
||||||
ctx.lineTo(130 + (maxWidth - 2) * (radarData.bombDefuseEnd / 40), 32);
|
ctx.moveTo(130 + (maxWidth-2) * (radarData.bombDefuseEnd / 40), 16)
|
||||||
ctx.stroke();
|
ctx.lineTo(130 + (maxWidth-2) * (radarData.bombDefuseEnd / 40), 32)
|
||||||
|
ctx.stroke()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (websocket != null) {
|
if (websocket != null) {
|
||||||
ctx.font = "100px Arial";
|
ctx.font = "100px Arial";
|
||||||
ctx.textAlign = "center";
|
ctx.textAlign = "center"
|
||||||
ctx.textBaseline = "middle";
|
ctx.textBaseline = "middle"
|
||||||
ctx.fillStyle = textColor;
|
ctx.fillStyle = textColor
|
||||||
ctx.fillText("Not on a server", 1024 / 2, 1024 / 2);
|
ctx.fillText("Not on a server", 1024/2, 1024/2);
|
||||||
} else {
|
} else {
|
||||||
ctx.font = "100px Arial";
|
ctx.font = "100px Arial";
|
||||||
ctx.textAlign = "center";
|
ctx.textAlign = "center"
|
||||||
ctx.fillStyle = textColor;
|
ctx.fillStyle = textColor
|
||||||
ctx.fillText("Disconnected", 1024 / 2, 1024 / 2);
|
ctx.fillText("Disconnected", 1024/2, 1024/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawStats) {
|
if (drawStats) {
|
||||||
ctx.font = "16px Arial";
|
ctx.font = "16px Arial";
|
||||||
ctx.textAlign = "left";
|
ctx.textAlign = "left"
|
||||||
ctx.fillStyle = textColor;
|
ctx.fillStyle = textColor
|
||||||
ctx.lineWidth = 2;
|
ctx.lineWidth = 2;
|
||||||
ctx.strokeStyle = "black";
|
ctx.strokeStyle = "black"
|
||||||
ctx.strokeText(`${freq} Hz`, 2, 18);
|
ctx.strokeText(`${freq} Hz`, 2, 18)
|
||||||
ctx.fillText(`${freq} Hz`, 2, 18);
|
ctx.fillText(`${freq} Hz`, 2, 18)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,295 +277,66 @@ function drawImage() {
|
|||||||
if (image == null || canvas == null)
|
if (image == null || canvas == null)
|
||||||
return
|
return
|
||||||
|
|
||||||
ctx.save();
|
if (zoomSet != false && boundingRect.x != null) {
|
||||||
|
|
||||||
if (rotateMap) {
|
|
||||||
ctx.translate(canvas.width / 2, canvas.height / 2);
|
|
||||||
ctx.rotate(degreesToRadians(localYaw + 270));
|
|
||||||
ctx.translate(-canvas.width / 2, -canvas.height / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerCentered && localPlayerPos) {
|
|
||||||
const playerMapPos = mapCoordinates(localPlayerPos);
|
|
||||||
const zoomLevel = 0.5;
|
|
||||||
const viewWidth = image.width * zoomLevel;
|
|
||||||
const viewHeight = image.height * zoomLevel;
|
|
||||||
const viewX = playerMapPos.x - (viewWidth / 2);
|
|
||||||
const viewY = playerMapPos.y - (viewHeight / 2);
|
|
||||||
|
|
||||||
ctx.drawImage(
|
|
||||||
image,
|
|
||||||
viewX, viewY, viewWidth, viewHeight,
|
|
||||||
0, 0, canvas.width, canvas.height
|
|
||||||
);
|
|
||||||
} else if (zoomSet != false && boundingRect.x != null) {
|
|
||||||
ctx.drawImage(image, boundingRect.x, boundingRect.y, boundingRect.width, boundingRect.height, 0, 0, canvas.width, canvas.height)
|
ctx.drawImage(image, boundingRect.x, boundingRect.y, boundingRect.width, boundingRect.height, 0, 0, canvas.width, canvas.height)
|
||||||
} else {
|
} else {
|
||||||
ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height)
|
ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawPlayerName(pos, playerName, playerType, hasAwp, hasBomb, isScoped) {
|
|
||||||
if (!map) return;
|
|
||||||
|
|
||||||
let mapPos = mapCoordinates(pos);
|
|
||||||
let textSize;
|
|
||||||
|
|
||||||
if (zoomSet) {
|
|
||||||
mapPos = boundingCoordinates(mapPos, boundingRect);
|
|
||||||
textSize = boundingScale(12, boundingRect);
|
|
||||||
} else if (playerCentered && localPlayerPos) {
|
|
||||||
const playerMapPos = mapCoordinates(localPlayerPos);
|
|
||||||
const zoomLevel = 0.5;
|
|
||||||
const viewWidth = image.width * zoomLevel;
|
|
||||||
const viewHeight = image.height * zoomLevel;
|
|
||||||
|
|
||||||
mapPos.x = (mapPos.x - (playerMapPos.x - viewWidth / 2)) * canvas.width / viewWidth;
|
|
||||||
mapPos.y = (mapPos.y - (playerMapPos.y - viewHeight / 2)) * canvas.height / viewHeight;
|
|
||||||
textSize = 12;
|
|
||||||
} else {
|
|
||||||
mapPos.x = mapPos.x * canvas.width / image.width;
|
|
||||||
mapPos.y = mapPos.y * canvas.height / image.height;
|
|
||||||
textSize = 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rotateMap) {
|
|
||||||
const canvasCenter = { x: canvas.width / 2, y: canvas.height / 2 };
|
|
||||||
mapPos = rotatePoint(canvasCenter.x, canvasCenter.y, mapPos.x, mapPos.y, localYaw + 270);
|
|
||||||
}
|
|
||||||
|
|
||||||
const textY = mapPos.y + 20;
|
|
||||||
|
|
||||||
let displayName = playerName;
|
|
||||||
if (playerType === "Local") {
|
|
||||||
displayName = "YOU";
|
|
||||||
ctx.fillStyle = localColor;
|
|
||||||
} else if (playerType === "Team") {
|
|
||||||
ctx.fillStyle = teamColor;
|
|
||||||
} else if (playerType === "Enemy") {
|
|
||||||
ctx.fillStyle = enemyColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isScoped) {
|
|
||||||
displayName += " [SCOPED]";
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.font = `${textSize}px Arial`;
|
|
||||||
ctx.textAlign = "center";
|
|
||||||
ctx.textBaseline = "top";
|
|
||||||
|
|
||||||
ctx.lineWidth = 2;
|
|
||||||
ctx.strokeStyle = "black";
|
|
||||||
ctx.strokeText(displayName, mapPos.x, textY);
|
|
||||||
ctx.fillText(displayName, mapPos.x, textY);
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawPlayerWeapon(pos, playerType, weaponId) {
|
|
||||||
if (!map) return;
|
|
||||||
|
|
||||||
let mapPos = mapCoordinates(pos);
|
|
||||||
let textSize;
|
|
||||||
|
|
||||||
if (zoomSet) {
|
|
||||||
mapPos = boundingCoordinates(mapPos, boundingRect);
|
|
||||||
textSize = boundingScale(10, boundingRect);
|
|
||||||
} else if (playerCentered && localPlayerPos) {
|
|
||||||
const playerMapPos = mapCoordinates(localPlayerPos);
|
|
||||||
const zoomLevel = 0.5;
|
|
||||||
const viewWidth = image.width * zoomLevel;
|
|
||||||
const viewHeight = image.height * zoomLevel;
|
|
||||||
|
|
||||||
mapPos.x = (mapPos.x - (playerMapPos.x - viewWidth / 2)) * canvas.width / viewWidth;
|
|
||||||
mapPos.y = (mapPos.y - (playerMapPos.y - viewHeight / 2)) * canvas.height / viewHeight;
|
|
||||||
textSize = 10;
|
|
||||||
} else {
|
|
||||||
mapPos.x = mapPos.x * canvas.width / image.width;
|
|
||||||
mapPos.y = mapPos.y * canvas.height / image.height;
|
|
||||||
textSize = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rotateMap) {
|
|
||||||
const canvasCenter = { x: canvas.width / 2, y: canvas.height / 2 };
|
|
||||||
mapPos = rotatePoint(canvasCenter.x, canvasCenter.y, mapPos.x, mapPos.y, localYaw + 270);
|
|
||||||
}
|
|
||||||
|
|
||||||
const textY = mapPos.y + (drawNames ? 35 : 20);
|
|
||||||
|
|
||||||
let weaponName = getWeaponName(weaponId);
|
|
||||||
|
|
||||||
if (weaponId === 9) {
|
|
||||||
ctx.fillStyle = "orange";
|
|
||||||
} else {
|
|
||||||
ctx.fillStyle = textColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.font = `${textSize}px Arial`;
|
|
||||||
ctx.textAlign = "center";
|
|
||||||
ctx.textBaseline = "top";
|
|
||||||
|
|
||||||
ctx.lineWidth = 2;
|
|
||||||
ctx.strokeStyle = "black";
|
|
||||||
ctx.strokeText(`[${weaponName}]`, mapPos.x, textY);
|
|
||||||
ctx.fillText(`[${weaponName}]`, mapPos.x, textY);
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawPlayerBomb(pos, playerType) {
|
|
||||||
if (!map) return;
|
|
||||||
|
|
||||||
let mapPos = mapCoordinates(pos);
|
|
||||||
let textSize;
|
|
||||||
|
|
||||||
if (zoomSet) {
|
|
||||||
mapPos = boundingCoordinates(mapPos, boundingRect);
|
|
||||||
textSize = boundingScale(10, boundingRect);
|
|
||||||
} else if (playerCentered && localPlayerPos) {
|
|
||||||
const playerMapPos = mapCoordinates(localPlayerPos);
|
|
||||||
const zoomLevel = 0.5;
|
|
||||||
const viewWidth = image.width * zoomLevel;
|
|
||||||
const viewHeight = image.height * zoomLevel;
|
|
||||||
|
|
||||||
mapPos.x = (mapPos.x - (playerMapPos.x - viewWidth / 2)) * canvas.width / viewWidth;
|
|
||||||
mapPos.y = (mapPos.y - (playerMapPos.y - viewHeight / 2)) * canvas.height / viewHeight;
|
|
||||||
textSize = 10;
|
|
||||||
} else {
|
|
||||||
mapPos.x = mapPos.x * canvas.width / image.width;
|
|
||||||
mapPos.y = mapPos.y * canvas.height / image.height;
|
|
||||||
textSize = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rotateMap) {
|
|
||||||
const canvasCenter = { x: canvas.width / 2, y: canvas.height / 2 };
|
|
||||||
mapPos = rotatePoint(canvasCenter.x, canvasCenter.y, mapPos.x, mapPos.y, localYaw + 270);
|
|
||||||
}
|
|
||||||
|
|
||||||
const textY = mapPos.y + (drawNames ? (drawGuns ? 50 : 35) : (drawGuns ? 35 : 20));
|
|
||||||
|
|
||||||
ctx.fillStyle = bombColor;
|
|
||||||
ctx.font = `${textSize}px Arial`;
|
|
||||||
ctx.textAlign = "center";
|
|
||||||
ctx.textBaseline = "top";
|
|
||||||
|
|
||||||
ctx.lineWidth = 2;
|
|
||||||
ctx.strokeStyle = "black";
|
|
||||||
ctx.strokeText("[C4]", mapPos.x, textY);
|
|
||||||
ctx.fillText("[C4]", mapPos.x, textY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawBomb(pos, planted) {
|
function drawBomb(pos, planted) {
|
||||||
if (map == null)
|
if (map == null)
|
||||||
return
|
return
|
||||||
|
|
||||||
let mapPos = mapCoordinates(pos);
|
|
||||||
let size;
|
|
||||||
|
|
||||||
if (zoomSet) {
|
if (zoomSet) {
|
||||||
mapPos = boundingCoordinates(mapPos, boundingRect);
|
pos = boundingCoordinates(mapCoordinates(pos), boundingRect)
|
||||||
size = boundingScale(8, boundingRect);
|
size = boundingScale(5, boundingRect);
|
||||||
} else if (playerCentered && localPlayerPos) {
|
|
||||||
const playerMapPos = mapCoordinates(localPlayerPos);
|
|
||||||
const zoomLevel = 0.5;
|
|
||||||
const viewWidth = image.width * zoomLevel;
|
|
||||||
const viewHeight = image.height * zoomLevel;
|
|
||||||
|
|
||||||
mapPos.x = (mapPos.x - (playerMapPos.x - viewWidth / 2)) * canvas.width / viewWidth;
|
|
||||||
mapPos.y = (mapPos.y - (playerMapPos.y - viewHeight / 2)) * canvas.height / viewHeight;
|
|
||||||
size = 8;
|
|
||||||
} else {
|
} else {
|
||||||
mapPos.x = mapPos.x * canvas.width / image.width;
|
pos = mapCoordinates(pos)
|
||||||
mapPos.y = mapPos.y * canvas.height / image.height;
|
size = 5
|
||||||
size = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rotateMap) {
|
|
||||||
const canvasCenter = { x: canvas.width / 2, y: canvas.height / 2 };
|
|
||||||
mapPos = rotatePoint(canvasCenter.x, canvasCenter.y, mapPos.x, mapPos.y, localYaw + 270);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(mapPos.x, mapPos.y, size, 0, 2 * Math.PI);
|
ctx.arc(pos.x, pos.y, size, 0, 2 * Math.PI);
|
||||||
ctx.fillStyle = bombColor;
|
ctx.fillStyle = bombColor;
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
|
|
||||||
ctx.lineWidth = 2;
|
|
||||||
ctx.strokeStyle = "black";
|
|
||||||
ctx.stroke();
|
|
||||||
|
|
||||||
ctx.font = size * 1.2 + "px Arial";
|
|
||||||
ctx.textAlign = "center";
|
|
||||||
ctx.textBaseline = "middle";
|
|
||||||
ctx.fillStyle = "white";
|
|
||||||
ctx.fillText("C4", mapPos.x, mapPos.y);
|
|
||||||
|
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
|
|
||||||
if (planted && ((new Date().getTime() / 1000) % 1) > 0.5) {
|
if (planted && ((new Date().getTime() / 1000) % 1) > 0.5) {
|
||||||
ctx.strokeStyle = enemyColor;
|
ctx.strokeStyle = enemyColor
|
||||||
ctx.lineWidth = 3;
|
ctx.lineWidth = 1;
|
||||||
ctx.beginPath();
|
ctx.stroke()
|
||||||
ctx.arc(mapPos.x, mapPos.y, size + 4, 0, 2 * Math.PI);
|
|
||||||
ctx.stroke();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawEntity(pos, fillStyle, dormant, hasBomb, yaw, hasAwp, playerType, isScoped, playerName, isPlanted, weaponId) {
|
function drawEntity(pos, fillStyle, dormant, hasBomb, yaw, hasAwp, playerType, isScoped) {
|
||||||
if (map == null)
|
if (map == null)
|
||||||
return
|
return
|
||||||
|
|
||||||
let mapPos = mapCoordinates(pos);
|
|
||||||
let circleRadius, distance, radius, arrowWidth;
|
|
||||||
|
|
||||||
if (zoomSet) {
|
if (zoomSet) {
|
||||||
mapPos = boundingCoordinates(mapPos, boundingRect);
|
pos = boundingCoordinates(mapCoordinates(pos), boundingRect)
|
||||||
circleRadius = boundingScale(7, boundingRect);
|
circleRadius = boundingScale(7, boundingRect);
|
||||||
distance = circleRadius + boundingScale(2, boundingRect);
|
distance = circleRadius + boundingScale(2, boundingRect);
|
||||||
radius = distance + boundingScale(2, boundingRect);
|
radius = distance + boundingScale(2, boundingRect)
|
||||||
arrowWidth = 35;
|
arrowWidth = 35
|
||||||
} else if (playerCentered && localPlayerPos) {
|
} else {
|
||||||
const playerMapPos = mapCoordinates(localPlayerPos);
|
pos = mapCoordinates(pos)
|
||||||
const zoomLevel = 0.5;
|
circleRadius = 7
|
||||||
const viewWidth = image.width * zoomLevel;
|
distance = circleRadius + 2
|
||||||
const viewHeight = image.height * zoomLevel;
|
|
||||||
|
|
||||||
mapPos.x = (mapPos.x - (playerMapPos.x - viewWidth / 2)) * canvas.width / viewWidth;
|
|
||||||
mapPos.y = (mapPos.y - (playerMapPos.y - viewHeight / 2)) * canvas.height / viewHeight;
|
|
||||||
|
|
||||||
circleRadius = 7;
|
|
||||||
distance = circleRadius + 2;
|
|
||||||
radius = distance + 5;
|
radius = distance + 5;
|
||||||
arrowWidth = 35;
|
arrowWidth = 35;
|
||||||
} else {
|
|
||||||
mapPos.x = mapPos.x * canvas.width / image.width;
|
|
||||||
mapPos.y = mapPos.y * canvas.height / image.height;
|
|
||||||
|
|
||||||
circleRadius = 7;
|
|
||||||
distance = circleRadius + 2;
|
|
||||||
radius = distance + 5;
|
|
||||||
arrowWidth = 35;
|
|
||||||
}
|
|
||||||
|
|
||||||
let adjustedYaw = yaw;
|
|
||||||
if (rotateMap) {
|
|
||||||
const canvasCenter = { x: canvas.width / 2, y: canvas.height / 2 };
|
|
||||||
mapPos = rotatePoint(canvasCenter.x, canvasCenter.y, mapPos.x, mapPos.y, localYaw + 270);
|
|
||||||
|
|
||||||
if (playerType === "Local") {
|
|
||||||
adjustedYaw = 90;
|
|
||||||
} else {
|
|
||||||
adjustedYaw = (yaw + 180) - localYaw + 270;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dormant) {
|
if (dormant) {
|
||||||
ctx.font = "20px Arial";
|
ctx.font = "20px Arial";
|
||||||
ctx.textAlign = "center";
|
ctx.textAlign = "center"
|
||||||
ctx.fillStyle = fillStyle;
|
ctx.fillStyle = fillStyle
|
||||||
ctx.fillText("?", mapPos.x, mapPos.y);
|
ctx.fillText("?", pos.x, pos.y);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (hasAwp) {
|
if (hasAwp) {
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(mapPos.x, mapPos.y, circleRadius, 0, 2 * Math.PI);
|
ctx.arc(pos.x, pos.y, circleRadius, 0, 2 * Math.PI);
|
||||||
ctx.fillStyle = "orange";
|
ctx.fillStyle = "orange";
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
circleRadius -= 2;
|
circleRadius -= 2;
|
||||||
@@ -668,80 +344,86 @@ function drawEntity(pos, fillStyle, dormant, hasBomb, yaw, hasAwp, playerType, i
|
|||||||
|
|
||||||
// Draw circle
|
// Draw circle
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(mapPos.x, mapPos.y, circleRadius, 0, 2 * Math.PI);
|
ctx.arc(pos.x, pos.y, circleRadius, 0, 2 * Math.PI);
|
||||||
ctx.fillStyle = fillStyle;
|
ctx.fillStyle = fillStyle;
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
|
|
||||||
if (hasAwp && false) {
|
if (hasAwp && false) {
|
||||||
let style = "yellow";
|
|
||||||
|
let style = "yellow"
|
||||||
|
|
||||||
if (playerType == "Enemy") {
|
if (playerType == "Enemy") {
|
||||||
style = "orange";
|
style = "orange"
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(mapPos.x, mapPos.y, circleRadius / 1.5, 0, 2 * Math.PI);
|
ctx.arc(pos.x, pos.y, circleRadius / 1.5, 0, 2 * Math.PI);
|
||||||
ctx.fillStyle = style;
|
ctx.fillStyle = style;
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasBomb) {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(pos.x, pos.y, circleRadius / 2, 0, 2 * Math.PI);
|
||||||
|
ctx.fillStyle = bombColor;
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
|
|
||||||
const arrowHeadX = mapPos.x + radius * Math.cos(adjustedYaw * (Math.PI / 180));
|
// Calculate arrowhead points
|
||||||
const arrowHeadY = mapPos.y - radius * Math.sin(adjustedYaw * (Math.PI / 180));
|
|
||||||
|
|
||||||
const arrowCornerX1 = mapPos.x + distance * Math.cos((adjustedYaw - arrowWidth) * (Math.PI / 180));
|
|
||||||
const arrowCornerY1 = mapPos.y - distance * Math.sin((adjustedYaw - arrowWidth) * (Math.PI / 180));
|
|
||||||
|
|
||||||
const arrowCornerX2 = mapPos.x + distance * Math.cos((adjustedYaw + arrowWidth) * (Math.PI / 180));
|
const arrowHeadX = pos.x + radius * Math.cos(yaw * (Math.PI / 180))
|
||||||
const arrowCornerY2 = mapPos.y - distance * Math.sin((adjustedYaw + arrowWidth) * (Math.PI / 180));
|
const arrowHeadY = pos.y - radius * Math.sin(yaw * (Math.PI / 180))
|
||||||
|
|
||||||
const cicleYaw = 90 - adjustedYaw;
|
const arrowCornerX1 = pos.x + distance * Math.cos((yaw - arrowWidth) * (Math.PI / 180))
|
||||||
const startAngle = degreesToRadians(cicleYaw - arrowWidth) - Math.PI / 2;
|
const arrowCornerY1 = pos.y - distance * Math.sin((yaw - arrowWidth) * (Math.PI / 180))
|
||||||
const endAngle = degreesToRadians(cicleYaw + arrowWidth) - Math.PI / 2;
|
|
||||||
|
const arrowCornerX2 = pos.x + distance * Math.cos((yaw + arrowWidth) * (Math.PI / 180))
|
||||||
|
const arrowCornerY2 = pos.y - distance * Math.sin((yaw + arrowWidth) * (Math.PI / 180))
|
||||||
|
|
||||||
|
|
||||||
|
const cicleYaw = 90-yaw
|
||||||
|
const startAngle = degreesToRadians(cicleYaw-arrowWidth)-Math.PI/2
|
||||||
|
const endAngle = degreesToRadians(cicleYaw+arrowWidth)-Math.PI/2
|
||||||
|
|
||||||
// Draw arrow
|
// Draw arrow
|
||||||
|
|
||||||
|
/// Backside of the arrow
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(mapPos.x, mapPos.y, distance, startAngle, endAngle);
|
ctx.arc(pos.x, pos.y, distance, startAngle, endAngle)
|
||||||
|
|
||||||
|
/// Draw from corners to arrowhead
|
||||||
ctx.lineTo(arrowCornerX1, arrowCornerY1);
|
ctx.lineTo(arrowCornerX1, arrowCornerY1);
|
||||||
ctx.lineTo(arrowHeadX, arrowHeadY);
|
ctx.lineTo(arrowHeadX, arrowHeadY);
|
||||||
ctx.lineTo(arrowCornerX2, arrowCornerY2);
|
ctx.lineTo(arrowCornerX2, arrowCornerY2);
|
||||||
ctx.closePath();
|
ctx.closePath()
|
||||||
ctx.fillStyle = 'white';
|
|
||||||
|
ctx.fillStyle = 'white'
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
|
|
||||||
if (isScoped) {
|
if (isScoped) {
|
||||||
const lineOfSightX = arrowHeadX + 1024 * Math.cos(adjustedYaw * (Math.PI / 180));
|
const lineOfSightX = arrowHeadX + 1024 * Math.cos(yaw * (Math.PI / 180))
|
||||||
const lineOfSightY = arrowHeadY - 1024 * Math.sin(adjustedYaw * (Math.PI / 180));
|
const lineOfSightY = arrowHeadY - 1024 * Math.sin(yaw * (Math.PI / 180))
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(arrowHeadX, arrowHeadY);
|
ctx.moveTo(arrowHeadX, arrowHeadY);
|
||||||
ctx.lineTo(lineOfSightX, lineOfSightY);
|
ctx.lineTo(lineOfSightX, lineOfSightY);
|
||||||
|
|
||||||
if (playerType == "Enemy")
|
if (playerType == "Enemy")
|
||||||
ctx.strokeStyle = enemyColor;
|
ctx.strokeStyle = enemyColor
|
||||||
else
|
else
|
||||||
ctx.strokeStyle = teamColor;
|
ctx.strokeStyle = teamColor
|
||||||
|
|
||||||
ctx.lineWidth = 1;
|
ctx.strokeWidth = 1;
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWeaponName(weaponId) {
|
|
||||||
if (weaponIdMap[weaponId]) {
|
|
||||||
return weaponIdMap[weaponId];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (weaponId >= 500) {
|
|
||||||
return "KNIFE";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "KNIFE";
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadMap(mapName) {
|
function loadMap(mapName) {
|
||||||
console.log(`[radarflow] loading map ${mapName}`);
|
console.log(`[radarflow] loading map ${mapName}`)
|
||||||
loaded = true;
|
loaded = true;
|
||||||
const map_img = new Image();
|
const map_img = new Image();
|
||||||
map_img.src = `assets/image/${mapName}_radar_psd.png`;
|
map_img.src = `assets/image/${mapName}_radar_psd.png`;
|
||||||
@@ -762,58 +444,50 @@ function loadMap(mapName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function unloadMap() {
|
function unloadMap() {
|
||||||
console.log("[radarflow] unloading map");
|
console.log("[radarflow] unloading map")
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
||||||
map = null;
|
map = null
|
||||||
mapName = null;
|
mapName = null
|
||||||
loaded = false,
|
loaded = false,
|
||||||
update = true;
|
update = true
|
||||||
requestAnimationFrame(render);
|
requestAnimationFrame(render);
|
||||||
}
|
}
|
||||||
|
|
||||||
function connect() {
|
function connect() {
|
||||||
if (websocket == null) {
|
if (websocket == null) {
|
||||||
let socket = new WebSocket(websocketAddr);
|
let socket = new WebSocket(websocketAddr)
|
||||||
|
|
||||||
socket.onopen = () => {
|
socket.onopen = () => {
|
||||||
console.log("[radarflow] Connection established");
|
console.log("[radarflow] Connection established")
|
||||||
websocket.send("requestInfo");
|
websocket.send("requestInfo");
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.onmessage = (event) => {
|
socket.onmessage = (event) => {
|
||||||
if (event.data == "error") {
|
if (event.data == "error") {
|
||||||
console.log("[radarflow] Server had an unknown error");
|
console.log("[radarflow] Server had an unknown error")
|
||||||
} else {
|
} else {
|
||||||
try {
|
|
||||||
let data = JSON.parse(event.data);
|
let data = JSON.parse(event.data);
|
||||||
radarData = data;
|
radarData = data;
|
||||||
freq = data.freq;
|
freq = data.freq;
|
||||||
|
|
||||||
if (data.money_reveal_enabled !== undefined) {
|
|
||||||
document.getElementById("moneyReveal").checked = data.money_reveal_enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.ingame == false) {
|
if (data.ingame == false) {
|
||||||
mapName = null;
|
mapName = null
|
||||||
entityData = null;
|
entityData = null
|
||||||
|
|
||||||
if (loaded)
|
if (loaded)
|
||||||
unloadMap();
|
unloadMap()
|
||||||
} else {
|
} else {
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
mapName = data.mapName;
|
mapName = data.mapName
|
||||||
entityData = data.entityData;
|
entityData = data.entityData
|
||||||
loadMap(mapName);
|
loadMap(mapName)
|
||||||
} else {
|
} else {
|
||||||
entityData = data.entityData;
|
entityData = data.entityData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update = true;
|
update = true
|
||||||
requestAnimationFrame(render);
|
requestAnimationFrame(render);
|
||||||
} catch (e) {
|
|
||||||
console.error("[radarflow] Error parsing server message:", e, event.data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -824,11 +498,11 @@ function connect() {
|
|||||||
console.log("[radarflow] connection died");
|
console.log("[radarflow] connection died");
|
||||||
}
|
}
|
||||||
|
|
||||||
playerData = null;
|
playerData = null
|
||||||
websocket = null;
|
websocket = null
|
||||||
unloadMap();
|
unloadMap()
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
connect();
|
connect();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
@@ -846,50 +520,23 @@ function connect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addEventListener("DOMContentLoaded", (e) => {
|
addEventListener("DOMContentLoaded", (e) => {
|
||||||
document.getElementById("zoomCheck").checked = false;
|
document.getElementById("zoomCheck").checked = true;
|
||||||
document.getElementById("statsCheck").checked = true;
|
|
||||||
document.getElementById("namesCheck").checked = true;
|
|
||||||
document.getElementById("gunsCheck").checked = true;
|
|
||||||
document.getElementById("moneyReveal").checked = false;
|
|
||||||
document.getElementById("rotateCheck").checked = true;
|
|
||||||
document.getElementById("centerCheck").checked = true;
|
|
||||||
|
|
||||||
canvas = document.getElementById('canvas');
|
canvas = document.getElementById('canvas');
|
||||||
canvas.width = 1024;
|
canvas.width = 1024;
|
||||||
canvas.height = 1024;
|
canvas.height = 1024;
|
||||||
canvasAspectRatio = canvas.width / canvas.height;
|
canvasAspectRatio = canvas.width / canvas.height
|
||||||
ctx = canvas.getContext('2d');
|
ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
console.log(`[radarflow] connecting to ${websocketAddr}`);
|
console.log(`[radarflow] connecting to ${websocketAddr}`)
|
||||||
connect();
|
connect()
|
||||||
});
|
});
|
||||||
|
|
||||||
function toggleZoom() {
|
function toggleZoom() {
|
||||||
shouldZoom = !shouldZoom;
|
shouldZoom = !shouldZoom
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleStats() {
|
function toggleStats() {
|
||||||
drawStats = !drawStats;
|
drawStats = !drawStats
|
||||||
}
|
|
||||||
|
|
||||||
function toggleNames() {
|
|
||||||
drawNames = !drawNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleGuns() {
|
|
||||||
drawGuns = !drawGuns;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleRotate() {
|
|
||||||
rotateMap = !rotateMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleCentered() {
|
|
||||||
playerCentered = !playerCentered;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleMoneyReveal() {
|
|
||||||
if (websocket && websocket.readyState === WebSocket.OPEN) {
|
|
||||||
websocket.send("toggleMoneyReveal");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -5,10 +5,7 @@ body {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: #000000;
|
background-color: #000000; /* Change the background color as needed */
|
||||||
background-image: url('assets/image/background.png');
|
|
||||||
background-repeat: repeat;
|
|
||||||
background-size: 128px 128px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#canvasContainer {
|
#canvasContainer {
|
||||||
@@ -26,27 +23,12 @@ canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#settingsHolder {
|
#settingsHolder {
|
||||||
visibility: visible;
|
visibility: hidden;
|
||||||
position: fixed;
|
position: absolute;
|
||||||
top: 50%;
|
top: inherit;
|
||||||
left: 0;
|
left: inherit;
|
||||||
transform: translateY(-50%);
|
width: inherit;
|
||||||
width: auto;
|
height: 20%;
|
||||||
height: auto;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
#settingsHolder .settings {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
||||||
color: white;
|
|
||||||
visibility: visible;
|
|
||||||
opacity: 0.8;
|
|
||||||
padding: 10px;
|
|
||||||
background-color: rgba(25, 25, 25, 0.7);
|
|
||||||
border-radius: 5px;
|
|
||||||
transition: opacity 0.3s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#settingsHolder:hover .settings {
|
#settingsHolder:hover .settings {
|
||||||
@@ -56,66 +38,12 @@ canvas {
|
|||||||
.settings {
|
.settings {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
||||||
|
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
color: white;
|
color: white;
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background-color: rgba(25, 25, 25, 0.7);
|
background-color: rgba(25, 25, 25, 0.7); /* Semi-transparent white background */
|
||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.3s ease; /* Smooth transition */
|
||||||
}
|
|
||||||
|
|
||||||
.dangerous-options {
|
|
||||||
display: none;
|
|
||||||
border-top: 1px solid rgba(255, 0, 0, 0.5);
|
|
||||||
margin-top: 10px;
|
|
||||||
padding-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dangerous-options.revealed {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#showDangerousBtn {
|
|
||||||
background-color: #6b0000;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 5px 10px;
|
|
||||||
margin-top: 10px;
|
|
||||||
border-radius: 3px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#showDangerousBtn:hover {
|
|
||||||
background-color: #8a0000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 600px),
|
|
||||||
(max-height: 600px) {
|
|
||||||
#settingsHolder {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 400px),
|
|
||||||
(max-height: 400px) {
|
|
||||||
#canvasContainer::before {
|
|
||||||
content: 'settings';
|
|
||||||
position: fixed;
|
|
||||||
top: 10px;
|
|
||||||
left: 10px;
|
|
||||||
background-color: rgba(25, 25, 25, 0.7);
|
|
||||||
color: white;
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
border-radius: 15px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-size: 16px;
|
|
||||||
cursor: pointer;
|
|
||||||
z-index: 101;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user