Skip to content

Commit

Permalink
adding support for checkmate all and checkmate control
Browse files Browse the repository at this point in the history
  • Loading branch information
mikechambers committed Sep 23, 2023
1 parent 492fe3c commit c275784
Show file tree
Hide file tree
Showing 22 changed files with 119 additions and 53 deletions.
4 changes: 4 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# dcli Release Notes

## v0.99.3 September 22,2023

- Added support for Checkmate All (checkmate_all), and Checkmate Control (checkmate_control)

## v0.99.2 September 2, 2023

- Added support for Season of the Witch
Expand Down
18 changes: 9 additions & 9 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/dcli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dcli"
#version
version = "0.99.2"
version = "0.99.3"
authors = ["Mike Chambers <[email protected]>"]
edition = "2018"
description = "Library for the dcli collection of command line tools for Destiny 2."
Expand Down
80 changes: 57 additions & 23 deletions src/dcli/src/activitystoreinterface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

use std::ops::Index;
use std::str::FromStr;
use std::{collections::HashMap, path::Path};
use tell::{Tell, TellLevel};
Expand All @@ -29,8 +30,8 @@ use indicatif::{ProgressBar, ProgressState, ProgressStyle};

use crate::playeractivitiessummary::PlayerActivitiesSummary;
use crate::utils::{
format_error, COMPETITIVE_PVP_ACTIVITY_HASH,
FREELANCE_COMPETITIVE_PVP_ACTIVITY_HASH,
format_error, CHECKMATE_CONTROL_ACTIVITY_HASH,
COMPETITIVE_PVP_ACTIVITY_HASH, FREELANCE_COMPETITIVE_PVP_ACTIVITY_HASH,
};
use crate::{
crucible::{CrucibleActivity, Member, PlayerName, Team},
Expand Down Expand Up @@ -817,7 +818,26 @@ impl ActivityStoreInterface {
}
}

fn add_mode(
fn remove_from_modes(
&self,
activity: &mut DestinyPostGameCarnageReportData,
mode: Mode,
) {
let o: Option<usize> = activity
.activity_details
.modes
.iter()
.position(|m| m == &mode);

if o.is_none() {
return;
}

let index: usize = o.unwrap();
activity.activity_details.modes.remove(index);
}

fn set_mode(
&self,
activity: &mut DestinyPostGameCarnageReportData,
mode: Mode,
Expand Down Expand Up @@ -850,53 +870,53 @@ impl ActivityStoreInterface {

match activity.activity_details.director_activity_hash {
4242525388 | 559852413 => {
self.add_mode(activity, Mode::PrivateMatchesClash);
self.set_mode(activity, Mode::PrivateMatchesClash);
self.add_to_modes(activity, Mode::Clash);
}
1859507212 | 3959500077 => {
self.add_mode(activity, Mode::PrivateMatchesControl);
self.set_mode(activity, Mode::PrivateMatchesControl);
self.add_to_modes(activity, Mode::Control);
}
2491884566 | 3076038389 => {
self.add_mode(activity, Mode::PrivateMatchesRumble);
self.set_mode(activity, Mode::PrivateMatchesRumble);
self.add_to_modes(activity, Mode::Rumble);
}
29726492 | 1543557109 => {
self.add_mode(activity, Mode::PrivateMatchesMayhem);
self.set_mode(activity, Mode::PrivateMatchesMayhem);
self.add_to_modes(activity, Mode::AllMayhem);
}
2143799792 | 2903879783 => {
self.add_mode(activity, Mode::PrivateMatchesSurvival);
self.set_mode(activity, Mode::PrivateMatchesSurvival);
self.add_to_modes(activity, Mode::Survival);
}
2923123473 => {
self.add_mode(activity, Mode::Elimination);
self.set_mode(activity, Mode::Elimination);
}
3530889940 => {
self.add_mode(activity, Mode::Momentum);
self.set_mode(activity, Mode::Momentum);
}
84526555 => {
self.add_mode(activity, Mode::ScorchedTeam);
self.set_mode(activity, Mode::ScorchedTeam);
self.add_to_modes(activity, Mode::Scorched);
}
3344441646 => {
self.add_mode(activity, Mode::Scorched);
self.set_mode(activity, Mode::Scorched);
}
1887396202 => {
self.add_mode(activity, Mode::Showdown);
self.set_mode(activity, Mode::Showdown);
}
1978116819 => {
self.add_mode(activity, Mode::Rift);
self.set_mode(activity, Mode::Rift);
}
2404525917 => {
self.add_mode(activity, Mode::Breakthrough);
self.set_mode(activity, Mode::Breakthrough);
}
1218001922 => {
self.add_mode(activity, Mode::PrivateMatchesSupremacy);
self.set_mode(activity, Mode::PrivateMatchesSupremacy);
self.add_to_modes(activity, Mode::Supremacy);
}
3767360267 => {
self.add_mode(activity, Mode::PrivateMatchesCountdown);
self.set_mode(activity, Mode::PrivateMatchesCountdown);
self.add_to_modes(activity, Mode::Countdown);
}
_ => was_updated = false,
Expand All @@ -919,15 +939,15 @@ impl ActivityStoreInterface {
if activity.activity_details.mode == Mode::None {
match activity.activity_details.director_activity_hash {
2259621230 => {
self.add_mode(activity, Mode::Rumble);
self.set_mode(activity, Mode::Rumble);
was_updated = true;
}
903584917 | 3847433434 => {
self.add_mode(activity, Mode::AllMayhem);
self.set_mode(activity, Mode::AllMayhem);
was_updated = true;
}
1113451448 => {
self.add_mode(activity, Mode::Rift);
self.set_mode(activity, Mode::Rift);
was_updated = true;
}
_ => (),
Expand All @@ -943,24 +963,38 @@ impl ActivityStoreInterface {
== FREELANCE_COMPETITIVE_PVP_ACTIVITY_HASH
{
if activity.activity_details.mode == Mode::Rift {
self.add_mode(activity, Mode::RiftCompetitive);
self.set_mode(activity, Mode::RiftCompetitive);
self.add_to_modes(activity, Mode::RiftCompetitive);
was_updated = true;
}

if activity.activity_details.mode == Mode::Showdown {
self.add_mode(activity, Mode::ShowdownCompetitive);
self.set_mode(activity, Mode::ShowdownCompetitive);
self.add_to_modes(activity, Mode::ShowdownCompetitive);
was_updated = true;
}

if activity.activity_details.mode == Mode::Survival {
self.add_mode(activity, Mode::SurvivalCompetitive);
self.set_mode(activity, Mode::SurvivalCompetitive);
self.add_to_modes(activity, Mode::SurvivalCompetitive);
was_updated = true;
}
}

//add support for checkmate (adding modes)

if activity.activity_details.director_activity_hash
== CHECKMATE_CONTROL_ACTIVITY_HASH
{
self.set_mode(activity, Mode::CheckmateControl);

self.add_to_modes(activity, Mode::CheckmateAll);
self.add_to_modes(activity, Mode::CheckmateControl);

self.remove_from_modes(activity, Mode::PvPQuickplay);
self.remove_from_modes(activity, Mode::ControlQuickplay);
}

if activity.activity_details.mode == Mode::PrivateMatchesAll {
was_updated = self.fix_private_match(activity);
}
Expand Down
24 changes: 24 additions & 0 deletions src/dcli/src/enums/mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ pub enum Mode {
RiftCompetitive = 700,
ShowdownCompetitive = 701,
SurvivalCompetitive = 702,

CheckmateAll = 710,
CheckmateControl = 711,
CheckmateSurvival = 712,
CheckmateRumble = 713,
}

impl Mode {
Expand Down Expand Up @@ -217,6 +222,11 @@ impl Mode {
701 => Ok(Mode::ShowdownCompetitive),
702 => Ok(Mode::SurvivalCompetitive),

710 => Ok(Mode::CheckmateAll),
711 => Ok(Mode::CheckmateControl),
712 => Ok(Mode::CheckmateSurvival),
713 => Ok(Mode::CheckmateRumble),

_ => Err(Error::UnknownEnumValue),
}
}
Expand Down Expand Up @@ -291,6 +301,10 @@ impl Mode {
|| *self == Mode::ShowdownCompetitive
|| *self == Mode::SurvivalCompetitive
|| *self == Mode::Relic
|| *self == Mode::CheckmateAll
|| *self == Mode::CheckmateControl
|| *self == Mode::CheckmateSurvival
|| *self == Mode::CheckmateRumble
}

pub fn is_private(&self) -> bool {
Expand Down Expand Up @@ -404,6 +418,11 @@ impl FromStr for Mode {
"survival_competitive" => Ok(Mode::SurvivalCompetitive),
"relic" => Ok(Mode::Relic),

"checkmate_all" => Ok(Mode::CheckmateAll),
"checkmate_control" => Ok(Mode::CheckmateControl),
"checkmate_survival" => Ok(Mode::CheckmateSurvival),
"checkmate_rumble" => Ok(Mode::CheckmateRumble),

_ => Err("Unknown Mode type"),
}
}
Expand Down Expand Up @@ -500,6 +519,11 @@ impl fmt::Display for Mode {
Mode::ShowdownCompetitive => "Showdown Competitive",
Mode::SurvivalCompetitive => "Survival Competitive",
Mode::Relic => "Relic",

Mode::CheckmateAll => "All Checkmate",
Mode::CheckmateControl => "Checkmate Control",
Mode::CheckmateSurvival => "Checkmate Survival",
Mode::CheckmateRumble => "Checkmate Rumble",
};

write!(f, "{}", out)
Expand Down
4 changes: 4 additions & 0 deletions src/dcli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ pub const TSV_DELIM: &str = "\t";
pub const COMPETITIVE_PVP_ACTIVITY_HASH: u32 = 2754695317;
pub const FREELANCE_COMPETITIVE_PVP_ACTIVITY_HASH: u32 = 2607135461;

pub const CHECKMATE_CONTROL_ACTIVITY_HASH: u32 = 3374318171;
pub const CHECKMATE_RUMBLE_ACTIVITY_HASH: u32 = 2461220411;
pub const CHECKMATE_SURVIVAL_ACTIVITY_HASH: u32 = 3876264582;

const VERSION: &str = env!("CARGO_PKG_VERSION");

pub fn f32_are_equal(a: f32, b: f32) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/dclia/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dclia"
#version
version = "0.99.2"
version = "0.99.3"
authors = ["Mike Chambers <[email protected]>"]
description = "Command line tool for retrieving information on current activity for specified player character."
homepage = "https://www.mikechambers.com"
Expand Down
2 changes: 1 addition & 1 deletion src/dcliad/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dcliad"
#version
version = "0.99.2"
version = "0.99.3"
authors = ["Mike Chambers <[email protected]>"]
edition = "2018"
description = "Command line tool for viewing Destiny 2 activity details."
Expand Down
8 changes: 4 additions & 4 deletions src/dcliad/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ OPTIONS:
Addition values available are crimsom_doubles, supremacy, survival, countdown, all_doubles, doubles,
private_clash, private_control, private_survival, private_rumble, showdown_competitive, survival_competitive, rift_competitive, showdown, lockdown, scorched, rift, iron_banner_rift, zone_control, iron_banner_zone_control
scorched_team, breakthrough, clash_quickplay, trials_of_the_nine, relic [default: all_pvp]
scorched_team, breakthrough, clash_quickplay, trials_of_the_nine, relic, checkmate_all, checkmate_control, checkmate_rumble, checkmate_survival [default: all_pvp]
-n, --name <name>
Bungie name for player
Expand All @@ -77,9 +77,9 @@ OPTIONS:
The number of weapons to display details for [default: 5]
```

| ARGUMENT | OPTIONS |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| --mode | all_pvp (default), control, clash, elimination, mayhem, iron_banner, all_private, rumble, pvp_competitive, quickplay and trials_of_osiris, crimsom_doubles, supremacy, survival, countdown, all_doubles, doubles private_clash, private_control, private_survival, private_rumble, showdown_competitive, survival_competitive, rift_competitive, showdown, lockdown, scorched, rift, iron_banner_rift, zone_control, iron_banner_zone_control, scorched_team, breakthrough, clash_quickplay, trials_of_the_nine, relic |
| ARGUMENT | OPTIONS |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| --mode | all_pvp (default), control, clash, elimination, mayhem, iron_banner, all_private, rumble, pvp_competitive, quickplay and trials_of_osiris, crimsom_doubles, supremacy, survival, countdown, all_doubles, doubles private_clash, private_control, private_survival, private_rumble, showdown_competitive, survival_competitive, rift_competitive, showdown, lockdown, scorched, rift, iron_banner_rift, zone_control, iron_banner_zone_control, scorched_team, breakthrough, clash_quickplay, trials_of_the_nine, relic, checkmate_all, checkmate_control, checkmate_rumble, checkmate_survival |

Manifest can be downloaded and synced with from [dclim](https://github.com/mikechambers/dcli/tree/main/src/dclim).

Expand Down
2 changes: 1 addition & 1 deletion src/dcliad/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ struct Opt {
/// private_survival, private_rumble, showdown_competitive, survival_competitive,
/// rift_competitive, showdown, lockdown, iron_banner_rift,
/// zone_control, iron_banner_zone_control, rift,
/// scorched, scorched_team, breakthrough, clash_quickplay, trials_of_the_nine, relic
/// scorched, scorched_team, breakthrough, clash_quickplay, trials_of_the_nine, relic, checkmate_all, checkmate_control, checkmate_rumble, checkmate_survival
#[structopt(long = "mode", short = "M",
parse(try_from_str=parse_and_validate_mode), default_value = "all_pvp")]
mode: Mode,
Expand Down
Loading

0 comments on commit c275784

Please sign in to comment.