From 506fc9827b0d5c43e3f96e49341c3656b7062f55 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Thu, 26 Mar 2026 14:39:23 +0100 Subject: [PATCH] record-daemon: fix summoner spells handling --- record-daemon/src/main.rs | 66 ++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/record-daemon/src/main.rs b/record-daemon/src/main.rs index e1944fa..032b579 100644 --- a/record-daemon/src/main.rs +++ b/record-daemon/src/main.rs @@ -403,40 +403,56 @@ impl Daemon { }); // If we have puuid and session, extract player-specific data from session - let (champion, final_team, final_summoner_name) = if let Some(ref p) = puuid - { - if let Some(ref sess) = session { - let champ_id = sess.get_champion_id(p); - let champ_name = - champ_id.and_then(record_daemon::lqp::champion_id_to_name); - let team_id = sess.get_team(p); - let summoner = sess.get_summoner_name(p).map(|s| s.to_string()); - ( - champ_name.or_else(|| { + let (champion, final_team, final_summoner_name, final_summoner_spells) = + if let Some(ref p) = puuid { + if let Some(ref sess) = session { + let champ_id = sess.get_champion_id(p); + let champ_name = + champ_id.and_then(record_daemon::lqp::champion_id_to_name); + let team_id = sess.get_team(p); + let summoner = sess.get_summoner_name(p).map(|s| s.to_string()); + + // Extract summoner spells from session's player_champion_selections + let spells_from_session = + sess.get_player_selection(p).map(|selection| { + record_daemon::lqp::SummonerSpells { + spell1_id: selection.spell1_id, + spell2_id: selection.spell2_id, + spell1_name: None, + spell2_name: None, + } + }); + + ( + champ_name.or_else(|| { + champion_id + .and_then(record_daemon::lqp::champion_id_to_name) + }), + team_id.or(team), + summoner.or(summoner_name), + spells_from_session.or(summoner_spells), + ) + } else { + ( champion_id - .and_then(record_daemon::lqp::champion_id_to_name) - }), - team_id.or(team), - summoner.or(summoner_name), - ) + .and_then(record_daemon::lqp::champion_id_to_name), + team, + summoner_name, + summoner_spells, + ) + } } else { ( champion_id.and_then(record_daemon::lqp::champion_id_to_name), team, summoner_name, + summoner_spells, ) - } - } else { - ( - champion_id.and_then(record_daemon::lqp::champion_id_to_name), - team, - summoner_name, - ) - }; + }; info!( "[EVENT_HANDLER] Final values: puuid={:?}, runes={:?}, summoner_spells={:?}", - puuid, runes, summoner_spells + puuid, runes, final_summoner_spells ); // Fetch all players identities for puuid mapping @@ -464,7 +480,7 @@ impl Daemon { summoner_name: final_summoner_name, puuid, runes, - summoner_spells, + summoner_spells: final_summoner_spells, all_players: all_players_info, ..Default::default() };