Compare commits
10 Commits
faster-bom
...
5e97135970
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e97135970 | |||
| 504d54bbeb | |||
| 235c3a6151 | |||
| f2824af426 | |||
| ec679b22cb | |||
|
|
c86216ec6e | ||
|
|
02c3ac8dde | ||
|
|
f3f08cbede | ||
|
|
831d232d23 | ||
|
|
b7984a9168 |
563
Cargo.lock
generated
563
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
36
Cargo.toml
36
Cargo.toml
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "radarflow"
|
name = "radarflow"
|
||||||
version = "0.2.4"
|
version = "0.2.5"
|
||||||
authors = ["Janek S <development@superyu.xyz"]
|
authors = ["Janek S <development@superyu.xyz"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
@@ -8,39 +8,39 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# memory
|
# memory
|
||||||
memflow = "0.2.1"
|
memflow = "0.2.3"
|
||||||
memflow-native = { git = "https://github.com/memflow/memflow-native" }
|
memflow-native = { git = "https://github.com/memflow/memflow-native" }
|
||||||
dataview = "1.0.1"
|
dataview = "1.0.1"
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
log = "0.4.21"
|
log = "0.4.22"
|
||||||
simple_logger = "4.3.3"
|
simple_logger = "5.0.0"
|
||||||
|
|
||||||
# error handling
|
# error handling
|
||||||
anyhow = "1.0.81"
|
anyhow = "1.0.93"
|
||||||
|
|
||||||
# derive stuff
|
# derive stuff
|
||||||
enum-primitive-derive = "0.3.0"
|
enum-primitive-derive = "0.3.0"
|
||||||
num-traits = "0.2.18"
|
num-traits = "0.2.19"
|
||||||
serde = { version = "1.0.197", features = ["derive"] }
|
serde = { version = "1.0.215", features = ["derive"] }
|
||||||
serde_json = "1.0.115"
|
serde_json = "1.0.133"
|
||||||
clap = { version = "4.5.4", features = ["derive", "string"] }
|
clap = { version = "4.5.21", features = ["derive", "string"] }
|
||||||
|
|
||||||
# tokio
|
# tokio
|
||||||
tokio = { version = "1.37.0", features = ["full"] }
|
tokio = { version = "1.37.0", features = ["full"] }
|
||||||
|
|
||||||
# networking
|
# networking
|
||||||
axum = { version = "0.7.5", features = ["ws"] }
|
axum = { version = "0.7.9", features = ["ws"] }
|
||||||
tower-http = { version = "0.5.2", features = ["fs"] }
|
tower-http = { version = "0.6.2", features = ["fs"] }
|
||||||
tower = "0.4.13"
|
tower = "0.5.1"
|
||||||
local-ip-address = "0.6.1"
|
local-ip-address = "0.6.3"
|
||||||
|
|
||||||
# other
|
# other
|
||||||
itertools = "0.12.1"
|
itertools = "0.13.0"
|
||||||
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
reqwest = { version = "0.12.2", features = ["blocking"] }
|
reqwest = { version = "0.12.9", features = ["blocking"] }
|
||||||
serde = { version = "1.0.197", features = ["derive"] }
|
serde = { version = "1.0.215", features = ["derive"] }
|
||||||
serde_json = "1.0.115"
|
serde_json = "1.0.133"
|
||||||
vergen = { version = "8.3.1", features = ["build", "cargo", "git", "gitcl", "rustc", "si"] }
|
vergen-gitcl = { version = "1.0.0", features = ["build", "cargo", "rustc",] }
|
||||||
|
|||||||
20
build.rs
20
build.rs
@@ -1,7 +1,7 @@
|
|||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use vergen::EmitBuilder;
|
use vergen_gitcl::{Emitter, GitclBuilder};
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
struct InfoJson {
|
struct InfoJson {
|
||||||
@@ -36,29 +36,27 @@ fn build_number() -> Result<(), Box<dyn Error>> {
|
|||||||
fn main() -> Result<(), Box<dyn Error>> {
|
fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
|
||||||
download(
|
download(
|
||||||
"https://raw.githubusercontent.com/a2x/cs2-dumper/main/output/client.dll.rs",
|
"https://raw.githubusercontent.com/a2x/cs2-dumper/refs/heads/main/output/client_dll.rs",
|
||||||
"./src/dma/cs2dumper/client_mod.rs"
|
"./src/dma/cs2dumper/client_mod.rs"
|
||||||
).expect("Failed to download build file \"client.dll.rs\"");
|
).expect("Failed to download build file \"client.dll.rs\"");
|
||||||
|
|
||||||
download(
|
download(
|
||||||
"https://raw.githubusercontent.com/a2x/cs2-dumper/main/output/offsets.rs",
|
"https://raw.githubusercontent.com/a2x/cs2-dumper/refs/heads/main/output/offsets.rs",
|
||||||
"./src/dma/cs2dumper/offsets_mod.rs"
|
"./src/dma/cs2dumper/offsets_mod.rs"
|
||||||
).expect("Failed to download build file \"offsets.rs\"");
|
).expect("Failed to download build file \"offsets.rs\"");
|
||||||
|
|
||||||
download(
|
download(
|
||||||
"https://raw.githubusercontent.com/a2x/cs2-dumper/main/output/engine2.dll.rs",
|
"https://raw.githubusercontent.com/a2x/cs2-dumper/refs/heads/main/output/engine2_dll.rs",
|
||||||
"./src/dma/cs2dumper/engine2_mod.rs"
|
"./src/dma/cs2dumper/engine2_mod.rs"
|
||||||
).expect("Failed to download build file \"engine2.dll.rs\"");
|
).expect("Failed to download build file \"engine2.dll.rs\"");
|
||||||
|
|
||||||
build_number()?;
|
build_number()?;
|
||||||
|
|
||||||
EmitBuilder::builder()
|
let gitcl = GitclBuilder::all_git()?;
|
||||||
.git_sha(true)
|
|
||||||
.git_commit_date()
|
|
||||||
.cargo_debug()
|
Emitter::new()
|
||||||
.cargo_target_triple()
|
.add_instructions(&gitcl)?
|
||||||
.rustc_semver()
|
|
||||||
.rustc_llvm_version()
|
|
||||||
.emit()?;
|
.emit()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -45,7 +45,11 @@ fn version() -> String {
|
|||||||
avail.join(", ")
|
avail.join(", ")
|
||||||
};
|
};
|
||||||
|
|
||||||
format!(" {pkg_ver} (rev {git_hash})\nCommit Date: {commit_date}\nAvailable Connectors: {avail_cons}")
|
format!(
|
||||||
|
"{pkg_ver} (rev {git_hash})\n\
|
||||||
|
Commit Date: {commit_date}\n\
|
||||||
|
Available Connectors: {avail_cons}\n"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn port_in_range(s: &str) -> Result<u16, String> {
|
fn port_in_range(s: &str) -> Result<u16, String> {
|
||||||
|
|||||||
@@ -16,12 +16,15 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PlayerData {
|
impl PlayerData {
|
||||||
pub fn new(pos: Vec3, yaw: f32, player_type: PlayerType, has_bomb: bool, has_awp: bool, is_scoped: bool) -> PlayerData {
|
pub fn new(pos: Vec3, yaw: f32, player_type: PlayerType, has_bomb: bool, has_awp: bool, is_scoped: bool, player_name: String) -> PlayerData {
|
||||||
PlayerData { pos, yaw, player_type, has_bomb, has_awp, is_scoped }
|
PlayerData { pos, yaw, player_type, has_bomb, has_awp, is_scoped, player_name }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 player_name_ptr = 0u64;
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut batcher = MemoryViewBatcher::new(&mut self.process);
|
let mut batcher = MemoryViewBatcher::new(&mut self.process);
|
||||||
@@ -105,9 +106,24 @@ 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_CSPlayerPawnBase::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 = {
|
let has_awp = {
|
||||||
@@ -126,7 +142,8 @@ impl DmaCtx {
|
|||||||
team,
|
team,
|
||||||
health,
|
health,
|
||||||
has_awp,
|
has_awp,
|
||||||
is_scoped: is_scoped != 0
|
is_scoped: is_scoped != 0,
|
||||||
|
player_name,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,4 +269,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 player_name: String,
|
||||||
}
|
}
|
||||||
@@ -165,7 +165,8 @@ 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
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -202,7 +203,8 @@ 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
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub struct CsData {
|
|||||||
// Common
|
// Common
|
||||||
pub local: u64,
|
pub local: u64,
|
||||||
pub local_pawn: u64,
|
pub local_pawn: u64,
|
||||||
pub is_dead: bool,
|
// pub is_dead: bool, // TODO: Why is this here?
|
||||||
pub tick_count: i32,
|
pub tick_count: i32,
|
||||||
pub freeze_period: bool,
|
pub freeze_period: bool,
|
||||||
pub round_start_count: u8,
|
pub round_start_count: u8,
|
||||||
@@ -169,7 +169,7 @@ impl CsData {
|
|||||||
{
|
{
|
||||||
// Globals
|
// Globals
|
||||||
let tick_count_addr = (self.globals + 0x40).into();
|
let tick_count_addr = (self.globals + 0x40).into();
|
||||||
let map_addr = (self.globals + 0x188).into();
|
let map_addr = (self.globals + 384).into();
|
||||||
|
|
||||||
// Gamerules
|
// Gamerules
|
||||||
let bomb_dropped_addr = (self.gamerules + cs2dumper::client::C_CSGameRules::m_bBombDropped as u64).into();
|
let bomb_dropped_addr = (self.gamerules + cs2dumper::client::C_CSGameRules::m_bBombDropped as u64).into();
|
||||||
@@ -178,7 +178,7 @@ impl CsData {
|
|||||||
let round_start_count_addr = (self.gamerules + cs2dumper::client::C_CSGameRules::m_nRoundStartCount as u64).into();
|
let round_start_count_addr = (self.gamerules + cs2dumper::client::C_CSGameRules::m_nRoundStartCount as u64).into();
|
||||||
|
|
||||||
// Game Entity System
|
// Game Entity System
|
||||||
let highest_index_addr = (self.game_ent_sys + cs2dumper::offsets::client_dll::dwGameEntitySystem_getHighestEntityIndex as u64).into();
|
let highest_index_addr = (self.game_ent_sys + cs2dumper::offsets::client_dll::dwGameEntitySystem_highestEntityIndex as u64).into();
|
||||||
|
|
||||||
let mut batcher = ctx.process.batcher();
|
let mut batcher = ctx.process.batcher();
|
||||||
batcher.read_into(
|
batcher.read_into(
|
||||||
@@ -237,7 +237,7 @@ impl CsData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let map_string = ctx.process.read_char_string_n(map_ptr.into(), 32).unwrap_or(String::from("<empty>"));
|
let map_string = ctx.process.read_utf8_lossy(map_ptr.into(), 32).unwrap_or(String::from("<empty>"));
|
||||||
|
|
||||||
self.map = map_string;
|
self.map = map_string;
|
||||||
self.bomb_dropped = bomb_dropped != 0;
|
self.bomb_dropped = bomb_dropped != 0;
|
||||||
|
|||||||
BIN
webradar/assets/image/background.png
Normal file
BIN
webradar/assets/image/background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 MiB |
@@ -6,8 +6,9 @@ const bombColor = "#eda338"
|
|||||||
const textColor = "#d1d1d1"
|
const textColor = "#d1d1d1"
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
shouldZoom = true
|
shouldZoom = false
|
||||||
drawStats = false
|
|
||||||
|
drawStats = true
|
||||||
|
|
||||||
// Common
|
// Common
|
||||||
canvas = null
|
canvas = null
|
||||||
@@ -39,7 +40,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 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;
|
||||||
@@ -92,7 +93,7 @@ function boundingCoordinates(coordinates, boundingRect) {
|
|||||||
const newX = (coordinates.x - boundingRect.x) / xScale;
|
const newX = (coordinates.x - boundingRect.x) / xScale;
|
||||||
const newY = (coordinates.y - boundingRect.y) / yScale;
|
const newY = (coordinates.y - boundingRect.y) / yScale;
|
||||||
|
|
||||||
return {x: newX, y: newY};
|
return { x: newX, y: newY };
|
||||||
}
|
}
|
||||||
|
|
||||||
function boundingScale(value, boundingRect) {
|
function boundingScale(value, boundingRect) {
|
||||||
@@ -107,7 +108,48 @@ function mapCoordinates(coordinates) {
|
|||||||
offset_x /= map.scale;
|
offset_x /= map.scale;
|
||||||
offset_y /= -map.scale;
|
offset_y /= -map.scale;
|
||||||
|
|
||||||
return {x: offset_x, y: offset_y}
|
return { x: offset_x, y: offset_y }
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawPlayerName(pos, playerName, playerType, hasAwp, hasBomb) {
|
||||||
|
if (!map) return;
|
||||||
|
|
||||||
|
if (zoomSet) {
|
||||||
|
pos = boundingCoordinates(mapCoordinates(pos), boundingRect);
|
||||||
|
textSize = boundingScale(12, boundingRect);
|
||||||
|
} else {
|
||||||
|
pos = mapCoordinates(pos);
|
||||||
|
textSize = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
const textY = pos.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 (hasAwp) {
|
||||||
|
displayName += " [AWP]";
|
||||||
|
}
|
||||||
|
if (hasBomb) {
|
||||||
|
displayName += " [C4]";
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.font = `${textSize}px Arial`;
|
||||||
|
ctx.textAlign = "center";
|
||||||
|
ctx.textBaseline = "top";
|
||||||
|
|
||||||
|
ctx.lineWidth = 2;
|
||||||
|
ctx.strokeStyle = "black";
|
||||||
|
ctx.strokeText(displayName, pos.x, textY);
|
||||||
|
|
||||||
|
ctx.fillText(displayName, pos.x, textY);
|
||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
@@ -132,15 +174,14 @@ function render() {
|
|||||||
} else {
|
} else {
|
||||||
mapCords = mapCoordinates(data.Player.pos)
|
mapCords = mapCoordinates(data.Player.pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
minX = Math.min(minX, mapCords.x);
|
minX = Math.min(minX, mapCords.x);
|
||||||
minY = Math.min(minY, mapCords.y);
|
minY = Math.min(minY, mapCords.y);
|
||||||
maxX = Math.max(maxX, mapCords.x);
|
maxX = Math.max(maxX, mapCords.x);
|
||||||
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)
|
||||||
boundingRect = makeBoundingRect(minX-safetyBound, minY-safetyBound, maxX+safetyBound, maxY+safetyBound, image.width/image.height)
|
|
||||||
|
|
||||||
zoomSet = true
|
zoomSet = true
|
||||||
} else if (zoomSet) {
|
} else if (zoomSet) {
|
||||||
@@ -168,14 +209,18 @@ function render() {
|
|||||||
|
|
||||||
drawEntity(
|
drawEntity(
|
||||||
data.Player.pos,
|
data.Player.pos,
|
||||||
fillStyle,
|
fillStyle,
|
||||||
data.Player.isDormant,
|
data.Player.isDormant,
|
||||||
data.Player.hasBomb,
|
data.Player.hasBomb,
|
||||||
data.Player.yaw,
|
data.Player.yaw,
|
||||||
data.Player.hasAwp,
|
data.Player.hasAwp,
|
||||||
data.Player.playerType,
|
data.Player.playerType,
|
||||||
data.Player.isScoped
|
data.Player.isScoped
|
||||||
)
|
);
|
||||||
|
|
||||||
|
if (drawStats && data.Player.playerName) {
|
||||||
|
drawPlayerName(data.Player.pos, data.Player.playerName, data.Player.playerType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -183,13 +228,13 @@ function render() {
|
|||||||
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) {
|
||||||
@@ -201,14 +246,14 @@ function render() {
|
|||||||
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
|
||||||
@@ -221,8 +266,8 @@ function render() {
|
|||||||
|
|
||||||
// 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
|
||||||
@@ -230,8 +275,8 @@ function render() {
|
|||||||
console.log(radarData.bombDefuseEnd)
|
console.log(radarData.bombDefuseEnd)
|
||||||
ctx.strokeStyle = "green"
|
ctx.strokeStyle = "green"
|
||||||
ctx.beginPath()
|
ctx.beginPath()
|
||||||
ctx.moveTo(130 + (maxWidth-2) * (radarData.bombDefuseEnd / 40), 16)
|
ctx.moveTo(130 + (maxWidth - 2) * (radarData.bombDefuseEnd / 40), 16)
|
||||||
ctx.lineTo(130 + (maxWidth-2) * (radarData.bombDefuseEnd / 40), 32)
|
ctx.lineTo(130 + (maxWidth - 2) * (radarData.bombDefuseEnd / 40), 32)
|
||||||
ctx.stroke()
|
ctx.stroke()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,12 +288,12 @@ function render() {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,7 +354,7 @@ function drawBomb(pos, planted) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawEntity(pos, fillStyle, dormant, hasBomb, yaw, hasAwp, playerType, isScoped) {
|
function drawEntity(pos, fillStyle, dormant, hasBomb, yaw, hasAwp, playerType, isScoped, playerName) {
|
||||||
if (map == null)
|
if (map == null)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -331,7 +376,7 @@ function drawEntity(pos, fillStyle, dormant, hasBomb, yaw, hasAwp, playerType, i
|
|||||||
ctx.font = "20px Arial";
|
ctx.font = "20px Arial";
|
||||||
ctx.textAlign = "center"
|
ctx.textAlign = "center"
|
||||||
ctx.fillStyle = fillStyle
|
ctx.fillStyle = fillStyle
|
||||||
ctx.fillText("?", pos.x, pos.y);
|
ctx.fillText("?", pos.x, pos.y);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (hasAwp) {
|
if (hasAwp) {
|
||||||
@@ -385,9 +430,9 @@ function drawEntity(pos, fillStyle, dormant, hasBomb, yaw, hasAwp, playerType, i
|
|||||||
const arrowCornerY2 = pos.y - distance * Math.sin((yaw + arrowWidth) * (Math.PI / 180))
|
const arrowCornerY2 = pos.y - distance * Math.sin((yaw + arrowWidth) * (Math.PI / 180))
|
||||||
|
|
||||||
|
|
||||||
const cicleYaw = 90-yaw
|
const cicleYaw = 90 - yaw
|
||||||
const startAngle = degreesToRadians(cicleYaw-arrowWidth)-Math.PI/2
|
const startAngle = degreesToRadians(cicleYaw - arrowWidth) - Math.PI / 2
|
||||||
const endAngle = degreesToRadians(cicleYaw+arrowWidth)-Math.PI/2
|
const endAngle = degreesToRadians(cicleYaw + arrowWidth) - Math.PI / 2
|
||||||
|
|
||||||
// Draw arrow
|
// Draw arrow
|
||||||
|
|
||||||
@@ -461,15 +506,23 @@ function connect() {
|
|||||||
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 {
|
||||||
let data = JSON.parse(event.data);
|
let data = JSON.parse(event.data);
|
||||||
radarData = data;
|
radarData = data;
|
||||||
freq = data.freq;
|
freq = data.freq;
|
||||||
|
|
||||||
|
if (data.entityData) {
|
||||||
|
data.entityData.forEach(entity => {
|
||||||
|
if (entity.Player) {
|
||||||
|
console.log(`Player: ${entity.Player.playerType}, Name: ${entity.Player.playerName || 'undefined'}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (data.ingame == false) {
|
if (data.ingame == false) {
|
||||||
mapName = null
|
mapName = null
|
||||||
entityData = null
|
entityData = null
|
||||||
@@ -490,7 +543,7 @@ function connect() {
|
|||||||
requestAnimationFrame(render);
|
requestAnimationFrame(render);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.onclose = (event) => {
|
socket.onclose = (event) => {
|
||||||
if (event.wasClean) {
|
if (event.wasClean) {
|
||||||
console.log("[radarflow] connection closed");
|
console.log("[radarflow] connection closed");
|
||||||
@@ -502,11 +555,11 @@ function connect() {
|
|||||||
websocket = null
|
websocket = null
|
||||||
unloadMap()
|
unloadMap()
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
connect();
|
connect();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.onerror = (error) => {
|
socket.onerror = (error) => {
|
||||||
console.log(`[radarflow] websocket error: ${error}`);
|
console.log(`[radarflow] websocket error: ${error}`);
|
||||||
};
|
};
|
||||||
@@ -520,8 +573,8 @@ function connect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addEventListener("DOMContentLoaded", (e) => {
|
addEventListener("DOMContentLoaded", (e) => {
|
||||||
document.getElementById("zoomCheck").checked = true;
|
document.getElementById("zoomCheck").checked = false;
|
||||||
|
document.getElementById("statsCheck").checked = true;
|
||||||
|
|
||||||
canvas = document.getElementById('canvas');
|
canvas = document.getElementById('canvas');
|
||||||
canvas.width = 1024;
|
canvas.width = 1024;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ body {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: #000000; /* Change the background color as needed */
|
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 {
|
||||||
@@ -23,12 +26,27 @@ canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#settingsHolder {
|
#settingsHolder {
|
||||||
visibility: hidden;
|
visibility: visible;
|
||||||
position: absolute;
|
position: fixed;
|
||||||
top: inherit;
|
top: 50%;
|
||||||
left: inherit;
|
left: 0;
|
||||||
width: inherit;
|
transform: translateY(-50%);
|
||||||
height: 20%;
|
width: auto;
|
||||||
|
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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user