From 2d54824c1c56a6a5bda3d436e3ab6e0d6d7fdaf8 Mon Sep 17 00:00:00 2001 From: hzxjy Date: Wed, 22 Nov 2023 13:07:49 +0800 Subject: [PATCH] fix: add some details --- maa-cli/src/run/copilot.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/maa-cli/src/run/copilot.rs b/maa-cli/src/run/copilot.rs index 11ca2032..663da3bb 100644 --- a/maa-cli/src/run/copilot.rs +++ b/maa-cli/src/run/copilot.rs @@ -33,8 +33,10 @@ pub fn copilot( stage_dir.push("Arknights-Tile-Pos"); let jpr = "JSON Prase Error"; - let copilot_id = link.get(link.len() - 5..).context("Code Invalid")?; - if copilot_id.parse::().is_err() { + let mut copilot_id = link.trim(); + if copilot_id.starts_with("maa://") && copilot_id.parse::().is_err() { + copilot_id = link.get(link.len() - 5..).context("Code Invalid")?; + } else { return Err(anyhow!("Code Invalid")); } @@ -76,8 +78,8 @@ pub fn copilot( } // Print operators info - let binding = recast["opers"].clone(); - let opers = binding.as_array().context(jpr)?; + let opers = recast["opers"].as_array().context(jpr)?; + let groups = recast["groups"].as_array().context(jpr)?; let mut table = Table::new(); table.set_format(*format::consts::FORMAT_NO_LINESEP_WITH_TITLE); @@ -87,6 +89,12 @@ pub fn copilot( let skill = operator["skill"].as_u64().context(jpr)?; table.add_row(row![name, skill]); } + + for group in groups { + let name = group["name"].as_str().context(jpr)?; + let skill = "X"; + table.add_row(row![name, skill]); + } normal!("Operator lists:\n", table.to_string()); // Get input of user