Skip to content

Commit 5c8311c

Browse files
committed
Updating for v0.5.6 release.
1 parent 3de18f6 commit 5c8311c

File tree

16 files changed

+108
-64
lines changed

16 files changed

+108
-64
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ $ cargo build --release
204204

205205
which will place the compiled tools in *src/target/release*
206206

207+
## Known Issues
208+
209+
* Tied matches are not displayed correctly, and are treated as a Victory.
210+
207211
## License
208212

209213
Project released under a [MIT License](LICENSE.md).

RELEASE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# dcli Release Notes
22

3+
## v0.5.6 February 7, 2021
4+
* Display mercy data in dcliah
5+
36
## v0.5.5 January 24, 2021
47
* Added player rating to dcliad (this is based on Destiny combat rating, similar to elo)
58
* Fixed bug where wrong platform was being stored for players. Requires database update and data to be re-synced

src/Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dcli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dcli"
33
#version
4-
version = "0.5.5"
4+
version = "0.5.6"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
edition = "2018"
77
description = "Library for the dcli collection of command line tools for Destiny 2."

src/dcli/src/crucible.rs

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ use std::{cmp::max, collections::hash_map::DefaultHasher, hash::Hasher};
3434
use std::{collections::HashMap, hash::Hash};
3535

3636
use crate::utils::{
37-
calculate_efficiency, calculate_kills_deaths_assists, calculate_kills_deaths_ratio,
37+
calculate_efficiency, calculate_kills_deaths_assists,
38+
calculate_kills_deaths_ratio,
3839
};
3940

4041
const PLAYER_START_BUFFER: u32 = 30;
@@ -55,7 +56,10 @@ pub struct CrucibleActivity {
5556
}
5657

5758
impl CrucibleActivity {
58-
pub fn get_member_performance(&self, member_id: &str) -> Option<&CruciblePlayerPerformance> {
59+
pub fn get_member_performance(
60+
&self,
61+
member_id: &str,
62+
) -> Option<&CruciblePlayerPerformance> {
5963
for t in self.teams.values() {
6064
for p in &t.player_performances {
6165
if p.player.member_id == member_id {
@@ -225,7 +229,8 @@ impl AggregateCruciblePerformances {
225229
performances: &[&CruciblePlayerPerformance],
226230
) -> AggregateCruciblePerformances {
227231
let mut out = AggregateCruciblePerformances::default();
228-
let mut extended = ExtendedCruciblePlayerActivityPerformances::default();
232+
let mut extended =
233+
ExtendedCruciblePlayerActivityPerformances::default();
229234

230235
out.total_activities = performances.len() as u32;
231236

@@ -258,7 +263,8 @@ impl AggregateCruciblePerformances {
258263
out.highest_deaths = max(p.stats.deaths, out.highest_deaths);
259264
out.highest_opponents_defeated =
260265
max(p.stats.opponents_defeated, out.highest_opponents_defeated);
261-
out.highest_efficiency = out.highest_efficiency.max(p.stats.efficiency);
266+
out.highest_efficiency =
267+
out.highest_efficiency.max(p.stats.efficiency);
262268
out.highest_kills_deaths_ratio = out
263269
.highest_kills_deaths_ratio
264270
.max(p.stats.kills_deaths_ratio);
@@ -289,9 +295,11 @@ impl AggregateCruciblePerformances {
289295

290296
#[allow(clippy::comparison_chain)]
291297
if streak > 0 {
292-
longest_win_streak = std::cmp::max(longest_win_streak, streak as u32);
298+
longest_win_streak =
299+
std::cmp::max(longest_win_streak, streak as u32);
293300
} else if streak < 0 {
294-
longest_loss_streak = std::cmp::max(longest_loss_streak, streak.abs() as u32);
301+
longest_loss_streak =
302+
std::cmp::max(longest_loss_streak, streak.abs() as u32);
295303
}
296304

297305
last_standing = p.stats.standing;
@@ -317,12 +325,18 @@ impl AggregateCruciblePerformances {
317325
e.weapon_kills_grenade,
318326
);
319327

320-
extended.highest_weapon_kills_melee =
321-
max(extended.highest_weapon_kills_melee, e.weapon_kills_melee);
322-
extended.highest_weapon_kills_super =
323-
max(extended.highest_weapon_kills_super, e.weapon_kills_super);
324-
extended.highest_all_medals_earned =
325-
max(extended.highest_all_medals_earned, e.all_medals_earned);
328+
extended.highest_weapon_kills_melee = max(
329+
extended.highest_weapon_kills_melee,
330+
e.weapon_kills_melee,
331+
);
332+
extended.highest_weapon_kills_super = max(
333+
extended.highest_weapon_kills_super,
334+
e.weapon_kills_super,
335+
);
336+
extended.highest_all_medals_earned = max(
337+
extended.highest_all_medals_earned,
338+
e.all_medals_earned,
339+
);
326340

327341
for m in &e.medals {
328342
let key = &m.medal.id;
@@ -362,7 +376,8 @@ impl AggregateCruciblePerformances {
362376
if ws.kills == 0 {
363377
0.0
364378
} else {
365-
(ws.precision_kills as f32 / ws.kills as f32) * 100.0
379+
(ws.precision_kills as f32 / ws.kills as f32)
380+
* 100.0
366381
}
367382
};
368383
}
@@ -373,11 +388,13 @@ impl AggregateCruciblePerformances {
373388
out.longest_loss_streak = longest_loss_streak;
374389

375390
if has_extended {
376-
let mut medals: Vec<MedalStat> = medal_hash.into_iter().map(|(_id, m)| m).collect();
391+
let mut medals: Vec<MedalStat> =
392+
medal_hash.into_iter().map(|(_id, m)| m).collect();
377393

378394
medals.sort_by(|a, b| b.count.cmp(&a.count));
379395

380-
let mut weapons: Vec<WeaponStat> = weapon_hash.into_iter().map(|(_id, w)| w).collect();
396+
let mut weapons: Vec<WeaponStat> =
397+
weapon_hash.into_iter().map(|(_id, w)| w).collect();
381398
weapons.sort_by(|a, b| b.kills.cmp(&a.kills));
382399

383400
extended.medals = medals;
@@ -389,11 +406,14 @@ impl AggregateCruciblePerformances {
389406
}
390407

391408
if out.total_activities > 0 {
392-
out.win_rate = (out.wins as f32 / out.total_activities as f32) * 100.0;
409+
out.win_rate =
410+
(out.wins as f32 / out.total_activities as f32) * 100.0;
393411
}
394412

395-
out.efficiency = calculate_efficiency(out.kills, out.deaths, out.assists);
396-
out.kills_deaths_ratio = calculate_kills_deaths_ratio(out.kills, out.deaths);
413+
out.efficiency =
414+
calculate_efficiency(out.kills, out.deaths, out.assists);
415+
out.kills_deaths_ratio =
416+
calculate_kills_deaths_ratio(out.kills, out.deaths);
397417
out.kills_deaths_assists =
398418
calculate_kills_deaths_assists(out.kills, out.deaths, out.assists);
399419

src/dclia/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dclia"
33
#version
4-
version = "0.5.5"
4+
version = "0.5.6"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
description = "Command line tool for retrieving information on current activity for specified player character."
77
homepage = "https://www.mikechambers.com"

src/dcliad/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dcliad"
33
#version
4-
version = "0.5.5"
4+
version = "0.5.6"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
edition = "2018"
77
description = "Command line tool for viewing Destiny 2 activity details."

src/dcliah/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "dcliah"
33
#version
4-
version = "0.5.5"
4+
version = "0.5.6"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
edition = "2018"
77
description = "Command line tool for viewing Destiny 2 activity history."

src/dcliah/src/main.rs

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ use dcli::enums::{
3232
use dcli::manifestinterface::ManifestInterface;
3333
use dcli::{
3434
crucible::{
35-
AggregateCruciblePerformances, CruciblePlayerActivityPerformance, CruciblePlayerPerformance,
35+
AggregateCruciblePerformances, CruciblePlayerActivityPerformance,
36+
CruciblePlayerPerformance,
3637
},
3738
enums::mode::Mode,
3839
utils::{calculate_ratio, human_duration},
@@ -45,7 +46,8 @@ use dcli::enums::weaponsort::WeaponSort;
4546
use dcli::activitystoreinterface::ActivityStoreInterface;
4647

4748
use dcli::utils::{
48-
determine_data_dir, format_f32, human_date_format, repeat_str, uppercase_first_char,
49+
determine_data_dir, format_f32, human_date_format, repeat_str,
50+
uppercase_first_char,
4951
};
5052
//use dcli::utils::EXIT_FAILURE;
5153
use dcli::utils::EXIT_FAILURE;
@@ -243,7 +245,9 @@ fn print_default(
243245
let grenades = extended.weapon_kills_grenade;
244246
let melees = extended.weapon_kills_melee;
245247

246-
let mercy_str = if activity.performance.stats.completion_reason == CompletionReason::Mercy {
248+
let mercy_str = if activity.performance.stats.completion_reason
249+
== CompletionReason::Mercy
250+
{
247251
"X"
248252
} else {
249253
""
@@ -401,13 +405,17 @@ fn print_default(
401405
}
402406
WeaponSort::KillsPerGameTotal => {
403407
weapons.sort_by(|a, b| {
404-
let a_kpg = calculate_ratio(a.kills, aggregate.total_activities);
405-
let b_kpg = calculate_ratio(b.kills, aggregate.total_activities);
408+
let a_kpg =
409+
calculate_ratio(a.kills, aggregate.total_activities);
410+
let b_kpg =
411+
calculate_ratio(b.kills, aggregate.total_activities);
406412
b_kpg.partial_cmp(&a_kpg).unwrap()
407413
});
408414
}
409415
WeaponSort::PrecisionTotal => {
410-
weapons.sort_by(|a, b| b.precision_kills.partial_cmp(&a.precision_kills).unwrap());
416+
weapons.sort_by(|a, b| {
417+
b.precision_kills.partial_cmp(&a.precision_kills).unwrap()
418+
});
411419
}
412420
WeaponSort::PrecisionPercent => {
413421
weapons.sort_by(|a, b| {
@@ -418,8 +426,10 @@ fn print_default(
418426
}
419427
WeaponSort::Type => {
420428
weapons.sort_by(|a, b| {
421-
let a_type = format!("{}", a.weapon.item_sub_type).to_lowercase();
422-
let b_type = format!("{}", b.weapon.item_sub_type).to_lowercase();
429+
let a_type =
430+
format!("{}", a.weapon.item_sub_type).to_lowercase();
431+
let b_type =
432+
format!("{}", b.weapon.item_sub_type).to_lowercase();
423433

424434
a_type.cmp(&b_type)
425435
});
@@ -653,33 +663,40 @@ async fn main() {
653663
_ => opt.end_moment.get_date_time(),
654664
};
655665

656-
let time_period = match DateTimePeriod::with_start_end_time(start_time, end_time) {
657-
Ok(e) => e,
658-
Err(_e) => {
659-
eprintln!("--end-moment must be greater than --moment");
660-
std::process::exit(EXIT_FAILURE);
661-
}
662-
};
666+
let time_period =
667+
match DateTimePeriod::with_start_end_time(start_time, end_time) {
668+
Ok(e) => e,
669+
Err(_e) => {
670+
eprintln!("--end-moment must be greater than --moment");
671+
std::process::exit(EXIT_FAILURE);
672+
}
673+
};
674+
675+
let mut store =
676+
match ActivityStoreInterface::init_with_path(&data_dir, opt.verbose)
677+
.await
678+
{
679+
Ok(e) => e,
680+
Err(e) => {
681+
print_error(
682+
"Could not initialize activity store. Have you run dclias?",
683+
e,
684+
);
685+
std::process::exit(EXIT_FAILURE);
686+
}
687+
};
663688

664-
let mut store = match ActivityStoreInterface::init_with_path(&data_dir, opt.verbose).await {
689+
let mut manifest = match ManifestInterface::new(&data_dir, false).await {
665690
Ok(e) => e,
666691
Err(e) => {
667692
print_error(
668-
"Could not initialize activity store. Have you run dclias?",
693+
"Could not initialize manifest. Have you run dclim?",
669694
e,
670695
);
671696
std::process::exit(EXIT_FAILURE);
672697
}
673698
};
674699

675-
let mut manifest = match ManifestInterface::new(&data_dir, false).await {
676-
Ok(e) => e,
677-
Err(e) => {
678-
print_error("Could not initialize manifest. Have you run dclim?", e);
679-
std::process::exit(EXIT_FAILURE);
680-
}
681-
};
682-
683700
if !opt.no_sync {
684701
match store.sync(&opt.member_id, &opt.platform).await {
685702
Ok(_e) => (),

0 commit comments

Comments
 (0)