From 25cd8a38d6458a87803e76ad12028a912d03562e Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Wed, 8 May 2024 00:08:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E7=82=B9=E7=82=B9=E6=91=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- namerena-runner/src/player.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/namerena-runner/src/player.rs b/namerena-runner/src/player.rs index 63b3487..ebdb1d7 100644 --- a/namerena-runner/src/player.rs +++ b/namerena-runner/src/player.rs @@ -154,9 +154,24 @@ impl Player { let weapon: Option<&str>; if raw_name.contains("@") { (name, team) = raw_name.split_once("@").unwrap(); + // 判定武器 + if team.contains("+") { + (team, weapon) = team.split_once("+").unwrap(); + } else { + weapon = None; + } + } else { + // 没有队伍名, 直接是武器 + if team.contains("+") { + (name, weapon) = raw_name.split_once("+").unwrap(); + team = name; + } else { + name = raw_name.as_str(); + team = name; + weapon = None; + } } - - todo!() + Player::new(name.to_string(), team.to_string(), weapon.map(|s| s.to_string())) } pub fn update_player(&mut self) {}