Skip to content

Commit c275784

Browse files
committed
adding support for checkmate all and checkmate control
1 parent 492fe3c commit c275784

File tree

22 files changed

+119
-53
lines changed

22 files changed

+119
-53
lines changed

RELEASE.md

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

3+
## v0.99.3 September 22,2023
4+
5+
- Added support for Checkmate All (checkmate_all), and Checkmate Control (checkmate_control)
6+
37
## v0.99.2 September 2, 2023
48

59
- Added support for Season of the Witch

src/Cargo.lock

Lines changed: 9 additions & 9 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.99.2"
4+
version = "0.99.3"
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/activitystoreinterface.rs

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2121
*/
2222

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

3031
use crate::playeractivitiessummary::PlayerActivitiesSummary;
3132
use crate::utils::{
32-
format_error, COMPETITIVE_PVP_ACTIVITY_HASH,
33-
FREELANCE_COMPETITIVE_PVP_ACTIVITY_HASH,
33+
format_error, CHECKMATE_CONTROL_ACTIVITY_HASH,
34+
COMPETITIVE_PVP_ACTIVITY_HASH, FREELANCE_COMPETITIVE_PVP_ACTIVITY_HASH,
3435
};
3536
use crate::{
3637
crucible::{CrucibleActivity, Member, PlayerName, Team},
@@ -817,7 +818,26 @@ impl ActivityStoreInterface {
817818
}
818819
}
819820

820-
fn add_mode(
821+
fn remove_from_modes(
822+
&self,
823+
activity: &mut DestinyPostGameCarnageReportData,
824+
mode: Mode,
825+
) {
826+
let o: Option<usize> = activity
827+
.activity_details
828+
.modes
829+
.iter()
830+
.position(|m| m == &mode);
831+
832+
if o.is_none() {
833+
return;
834+
}
835+
836+
let index: usize = o.unwrap();
837+
activity.activity_details.modes.remove(index);
838+
}
839+
840+
fn set_mode(
821841
&self,
822842
activity: &mut DestinyPostGameCarnageReportData,
823843
mode: Mode,
@@ -850,53 +870,53 @@ impl ActivityStoreInterface {
850870

851871
match activity.activity_details.director_activity_hash {
852872
4242525388 | 559852413 => {
853-
self.add_mode(activity, Mode::PrivateMatchesClash);
873+
self.set_mode(activity, Mode::PrivateMatchesClash);
854874
self.add_to_modes(activity, Mode::Clash);
855875
}
856876
1859507212 | 3959500077 => {
857-
self.add_mode(activity, Mode::PrivateMatchesControl);
877+
self.set_mode(activity, Mode::PrivateMatchesControl);
858878
self.add_to_modes(activity, Mode::Control);
859879
}
860880
2491884566 | 3076038389 => {
861-
self.add_mode(activity, Mode::PrivateMatchesRumble);
881+
self.set_mode(activity, Mode::PrivateMatchesRumble);
862882
self.add_to_modes(activity, Mode::Rumble);
863883
}
864884
29726492 | 1543557109 => {
865-
self.add_mode(activity, Mode::PrivateMatchesMayhem);
885+
self.set_mode(activity, Mode::PrivateMatchesMayhem);
866886
self.add_to_modes(activity, Mode::AllMayhem);
867887
}
868888
2143799792 | 2903879783 => {
869-
self.add_mode(activity, Mode::PrivateMatchesSurvival);
889+
self.set_mode(activity, Mode::PrivateMatchesSurvival);
870890
self.add_to_modes(activity, Mode::Survival);
871891
}
872892
2923123473 => {
873-
self.add_mode(activity, Mode::Elimination);
893+
self.set_mode(activity, Mode::Elimination);
874894
}
875895
3530889940 => {
876-
self.add_mode(activity, Mode::Momentum);
896+
self.set_mode(activity, Mode::Momentum);
877897
}
878898
84526555 => {
879-
self.add_mode(activity, Mode::ScorchedTeam);
899+
self.set_mode(activity, Mode::ScorchedTeam);
880900
self.add_to_modes(activity, Mode::Scorched);
881901
}
882902
3344441646 => {
883-
self.add_mode(activity, Mode::Scorched);
903+
self.set_mode(activity, Mode::Scorched);
884904
}
885905
1887396202 => {
886-
self.add_mode(activity, Mode::Showdown);
906+
self.set_mode(activity, Mode::Showdown);
887907
}
888908
1978116819 => {
889-
self.add_mode(activity, Mode::Rift);
909+
self.set_mode(activity, Mode::Rift);
890910
}
891911
2404525917 => {
892-
self.add_mode(activity, Mode::Breakthrough);
912+
self.set_mode(activity, Mode::Breakthrough);
893913
}
894914
1218001922 => {
895-
self.add_mode(activity, Mode::PrivateMatchesSupremacy);
915+
self.set_mode(activity, Mode::PrivateMatchesSupremacy);
896916
self.add_to_modes(activity, Mode::Supremacy);
897917
}
898918
3767360267 => {
899-
self.add_mode(activity, Mode::PrivateMatchesCountdown);
919+
self.set_mode(activity, Mode::PrivateMatchesCountdown);
900920
self.add_to_modes(activity, Mode::Countdown);
901921
}
902922
_ => was_updated = false,
@@ -919,15 +939,15 @@ impl ActivityStoreInterface {
919939
if activity.activity_details.mode == Mode::None {
920940
match activity.activity_details.director_activity_hash {
921941
2259621230 => {
922-
self.add_mode(activity, Mode::Rumble);
942+
self.set_mode(activity, Mode::Rumble);
923943
was_updated = true;
924944
}
925945
903584917 | 3847433434 => {
926-
self.add_mode(activity, Mode::AllMayhem);
946+
self.set_mode(activity, Mode::AllMayhem);
927947
was_updated = true;
928948
}
929949
1113451448 => {
930-
self.add_mode(activity, Mode::Rift);
950+
self.set_mode(activity, Mode::Rift);
931951
was_updated = true;
932952
}
933953
_ => (),
@@ -943,24 +963,38 @@ impl ActivityStoreInterface {
943963
== FREELANCE_COMPETITIVE_PVP_ACTIVITY_HASH
944964
{
945965
if activity.activity_details.mode == Mode::Rift {
946-
self.add_mode(activity, Mode::RiftCompetitive);
966+
self.set_mode(activity, Mode::RiftCompetitive);
947967
self.add_to_modes(activity, Mode::RiftCompetitive);
948968
was_updated = true;
949969
}
950970

951971
if activity.activity_details.mode == Mode::Showdown {
952-
self.add_mode(activity, Mode::ShowdownCompetitive);
972+
self.set_mode(activity, Mode::ShowdownCompetitive);
953973
self.add_to_modes(activity, Mode::ShowdownCompetitive);
954974
was_updated = true;
955975
}
956976

957977
if activity.activity_details.mode == Mode::Survival {
958-
self.add_mode(activity, Mode::SurvivalCompetitive);
978+
self.set_mode(activity, Mode::SurvivalCompetitive);
959979
self.add_to_modes(activity, Mode::SurvivalCompetitive);
960980
was_updated = true;
961981
}
962982
}
963983

984+
//add support for checkmate (adding modes)
985+
986+
if activity.activity_details.director_activity_hash
987+
== CHECKMATE_CONTROL_ACTIVITY_HASH
988+
{
989+
self.set_mode(activity, Mode::CheckmateControl);
990+
991+
self.add_to_modes(activity, Mode::CheckmateAll);
992+
self.add_to_modes(activity, Mode::CheckmateControl);
993+
994+
self.remove_from_modes(activity, Mode::PvPQuickplay);
995+
self.remove_from_modes(activity, Mode::ControlQuickplay);
996+
}
997+
964998
if activity.activity_details.mode == Mode::PrivateMatchesAll {
965999
was_updated = self.fix_private_match(activity);
9661000
}

src/dcli/src/enums/mode.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ pub enum Mode {
122122
RiftCompetitive = 700,
123123
ShowdownCompetitive = 701,
124124
SurvivalCompetitive = 702,
125+
126+
CheckmateAll = 710,
127+
CheckmateControl = 711,
128+
CheckmateSurvival = 712,
129+
CheckmateRumble = 713,
125130
}
126131

127132
impl Mode {
@@ -217,6 +222,11 @@ impl Mode {
217222
701 => Ok(Mode::ShowdownCompetitive),
218223
702 => Ok(Mode::SurvivalCompetitive),
219224

225+
710 => Ok(Mode::CheckmateAll),
226+
711 => Ok(Mode::CheckmateControl),
227+
712 => Ok(Mode::CheckmateSurvival),
228+
713 => Ok(Mode::CheckmateRumble),
229+
220230
_ => Err(Error::UnknownEnumValue),
221231
}
222232
}
@@ -291,6 +301,10 @@ impl Mode {
291301
|| *self == Mode::ShowdownCompetitive
292302
|| *self == Mode::SurvivalCompetitive
293303
|| *self == Mode::Relic
304+
|| *self == Mode::CheckmateAll
305+
|| *self == Mode::CheckmateControl
306+
|| *self == Mode::CheckmateSurvival
307+
|| *self == Mode::CheckmateRumble
294308
}
295309

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

421+
"checkmate_all" => Ok(Mode::CheckmateAll),
422+
"checkmate_control" => Ok(Mode::CheckmateControl),
423+
"checkmate_survival" => Ok(Mode::CheckmateSurvival),
424+
"checkmate_rumble" => Ok(Mode::CheckmateRumble),
425+
407426
_ => Err("Unknown Mode type"),
408427
}
409428
}
@@ -500,6 +519,11 @@ impl fmt::Display for Mode {
500519
Mode::ShowdownCompetitive => "Showdown Competitive",
501520
Mode::SurvivalCompetitive => "Survival Competitive",
502521
Mode::Relic => "Relic",
522+
523+
Mode::CheckmateAll => "All Checkmate",
524+
Mode::CheckmateControl => "Checkmate Control",
525+
Mode::CheckmateSurvival => "Checkmate Survival",
526+
Mode::CheckmateRumble => "Checkmate Rumble",
503527
};
504528

505529
write!(f, "{}", out)

src/dcli/src/utils.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ pub const TSV_DELIM: &str = "\t";
4747
pub const COMPETITIVE_PVP_ACTIVITY_HASH: u32 = 2754695317;
4848
pub const FREELANCE_COMPETITIVE_PVP_ACTIVITY_HASH: u32 = 2607135461;
4949

50+
pub const CHECKMATE_CONTROL_ACTIVITY_HASH: u32 = 3374318171;
51+
pub const CHECKMATE_RUMBLE_ACTIVITY_HASH: u32 = 2461220411;
52+
pub const CHECKMATE_SURVIVAL_ACTIVITY_HASH: u32 = 3876264582;
53+
5054
const VERSION: &str = env!("CARGO_PKG_VERSION");
5155

5256
pub fn f32_are_equal(a: f32, b: f32) -> bool {

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.99.2"
4+
version = "0.99.3"
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.99.2"
4+
version = "0.99.3"
55
authors = ["Mike Chambers <mikechambers@gmail.com>"]
66
edition = "2018"
77
description = "Command line tool for viewing Destiny 2 activity details."

src/dcliad/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ OPTIONS:
6767
6868
Addition values available are crimsom_doubles, supremacy, survival, countdown, all_doubles, doubles,
6969
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
70-
scorched_team, breakthrough, clash_quickplay, trials_of_the_nine, relic [default: all_pvp]
70+
scorched_team, breakthrough, clash_quickplay, trials_of_the_nine, relic, checkmate_all, checkmate_control, checkmate_rumble, checkmate_survival [default: all_pvp]
7171
-n, --name <name>
7272
Bungie name for player
7373
@@ -77,9 +77,9 @@ OPTIONS:
7777
The number of weapons to display details for [default: 5]
7878
```
7979

80-
| ARGUMENT | OPTIONS |
81-
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
82-
| --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 |
80+
| ARGUMENT | OPTIONS |
81+
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
82+
| --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 |
8383

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

src/dcliad/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ struct Opt {
508508
/// private_survival, private_rumble, showdown_competitive, survival_competitive,
509509
/// rift_competitive, showdown, lockdown, iron_banner_rift,
510510
/// zone_control, iron_banner_zone_control, rift,
511-
/// scorched, scorched_team, breakthrough, clash_quickplay, trials_of_the_nine, relic
511+
/// scorched, scorched_team, breakthrough, clash_quickplay, trials_of_the_nine, relic, checkmate_all, checkmate_control, checkmate_rumble, checkmate_survival
512512
#[structopt(long = "mode", short = "M",
513513
parse(try_from_str=parse_and_validate_mode), default_value = "all_pvp")]
514514
mode: Mode,

0 commit comments

Comments
 (0)