Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
fix(league): stop mislabelling reachable profiles as private; enable the menu by default
tonhowtfeae196613ef1
diff --git a/src-tauri/omniget-core/src/models/settings.rs b/src-tauri/omniget-core/src/models/settings.rsindex cbe79ee2..da9b17c9 100644--- a/src-tauri/omniget-core/src/models/settings.rs+++ b/src-tauri/omniget-core/src/models/settings.rs@@ -33,9 +33,9 @@ pub struct AppSettings {pub league: LeagueSettings,}-#[derive(Debug, Clone, Serialize, Deserialize, Default)]+#[derive(Debug, Clone, Serialize, Deserialize)]pub struct LeagueSettings {- #[serde(default)]+ #[serde(default = "default_league_enabled")]pub enabled: bool,#[serde(default)]pub auto_accept: bool,@@ -53,6 +53,25 @@ pub struct LeagueSettings {pub ban_champions: Vec<i64>,}+fn default_league_enabled() -> bool {+ true+}++impl Default for LeagueSettings {+ fn default() -> Self {+ Self {+ enabled: default_league_enabled(),+ auto_accept: false,+ auto_pick: false,+ auto_ban: false,+ auto_lock: false,+ auto_runes: false,+ pick_champions: Vec::new(),+ ban_champions: Vec::new(),+ }+ }+}+#[derive(Debug, Clone, Serialize, Deserialize)]pub struct RpcSettings {#[serde(default = "default_rpc_enabled")]diff --git a/src-tauri/src/commands/league/mod.rs b/src-tauri/src/commands/league/mod.rsindex 0de5d8f8..391a5350 100644--- a/src-tauri/src/commands/league/mod.rs+++ b/src-tauri/src/commands/league/mod.rs@@ -120,12 +120,48 @@ async fn lcu_reachable(client: &LcuClient) -> bool {.is_ok()}+/// The client's own web server is easy to swamp: a scouting pass touches ten+/// players at once, so requests are queued instead of fired all together.+static LCU_GATE: Lazy<tokio::sync::Semaphore> = Lazy::new(|| tokio::sync::Semaphore::new(4));+async fn lcu_send(client: &LcuClient,method: reqwest::Method,path: &str,body: Option<Value>,) -> Result<Value, String> {+ let mut attempt = 0;+ loop {+ let result = lcu_send_once(client, method.clone(), path, body.clone()).await;+ match result {+ Ok(v) => return Ok(v),+ Err(e) => {+ // Retry transient failures only; a 404 means the resource is+ // genuinely absent and retrying would just waste time.+ let transient = e.contains("request failed")+ || e.contains(" 429 ")+ || e.contains(" 500 ")+ || e.contains(" 503 ");+ if !transient || attempt >= 2 {+ return Err(e);+ }+ attempt += 1;+ tokio::time::sleep(std::time::Duration::from_millis(120 * attempt as u64)).await;+ }+ }+ }+}++async fn lcu_send_once(+ client: &LcuClient,+ method: reqwest::Method,+ path: &str,+ body: Option<Value>,+) -> Result<Value, String> {+ let _permit = LCU_GATE+ .acquire()+ .await+ .map_err(|_| "request gate closed".to_string())?;let url = format!("https://127.0.0.1:{}{}", client.port, path);let mut req = http_client()?.request(method, &url)@@ -706,7 +742,11 @@ fn compute_history_stats(games: &[Value], puuid: &str) -> Value {}#[tauri::command]-pub async fn league_player_report(puuid: String) -> Result<Value, String> {+pub async fn league_player_report(+ puuid: String,+ with_impact: Option<bool>,+) -> Result<Value, String> {+ let with_impact = with_impact.unwrap_or(false);ensure_enabled()?;if puuid.is_empty() {return Err("empty puuid".to_string());@@ -727,6 +767,17 @@ pub async fn league_player_report(puuid: String) -> Result<Value, String> {.cloned().unwrap_or(Value::Null);+ // The summoner record states privacy explicitly; an empty history only+ // means the request came back thin, which is not the same thing.+ let summoner = lcu_get_raw(&client, &format!("/lol-summoner/v2/summoners/puuid/{}", puuid))+ .await+ .unwrap_or(Value::Null);+ let is_private = summoner+ .get("privacy")+ .and_then(Value::as_str)+ .map(|p| p.eq_ignore_ascii_case("PRIVATE"))+ .unwrap_or(false);+let history = lcu_get_raw(&client,&format!(@@ -736,7 +787,8 @@ pub async fn league_player_report(puuid: String) -> Result<Value, String> {).await;let mut history_ids: Vec<i64> = Vec::new();- let (stats, private_profile) = match history {+ let mut history_failed = false;+ let (stats, history_empty) = match history {Ok(h) => {let games: Vec<Value> = h.get("games")@@ -750,12 +802,20 @@ pub async fn league_player_report(puuid: String) -> Result<Value, String> {.collect();(compute_history_stats(&games, &puuid), games.is_empty())}- Err(_) => (json!({ "games": 0, "insights": [] }), true),+ Err(_) => {+ history_failed = true;+ (json!({ "games": 0, "insights": [] }), true)+ }};- // Impact needs team totals, which only the full game detail carries, so it- // is computed over a small sample instead of the whole history.- let recent_ids: Vec<i64> = history_ids.into_iter().take(5).collect();+ // Impact needs team totals, which only the full game detail carries. Five+ // extra requests per player would swamp the client during a scouting pass,+ // so it is only computed when the caller asks for it.+ let recent_ids: Vec<i64> = if with_impact {+ history_ids.into_iter().take(5).collect()+ } else {+ Vec::new()+ };let mut impact_tasks = Vec::new();for game_id in recent_ids {let task_client = client.clone();@@ -812,7 +872,12 @@ pub async fn league_player_report(puuid: String) -> Result<Value, String> {"mastery": mastery,"impact": impact,"impactGames": impacts.len(),- "privateProfile": private_profile,+ "privateProfile": is_private,+ "historyUnavailable": history_failed || (history_empty && !is_private),+ "gameName": summoner.get("gameName"),+ "tagLine": summoner.get("tagLine"),+ "summonerLevel": summoner.get("summonerLevel"),+ "profileIconId": summoner.get("profileIconId"),}))}@@ -1322,7 +1387,7 @@ pub async fn league_search_player(game_name: String, tag_line: String) -> Resultreturn Err("player not found".to_string());}- let profile = league_player_report(puuid.clone()).await?;+ let profile = league_player_report(puuid.clone(), Some(true)).await?;let history = lcu_get_raw(&client,&format!(@@ -2117,6 +2182,216 @@ pub async fn league_champion_build(}))}+/// Ability haste granted by an item, read from its own description text.+///+/// The game data files expose stats only as markup, so the number is pulled+/// from the `<attention>N</attention> Ability Haste` fragment.+fn item_ability_haste(description: &str) -> i64 {+ let lower = description.to_ascii_lowercase();+ let Some(idx) = lower.find("ability haste") else {+ return 0;+ };+ let head = &description[..idx];+ let Some(close) = head.rfind("</attention>") else {+ return 0;+ };+ let Some(open) = head[..close].rfind('>') else {+ return 0;+ };+ head[open + 1..close].trim().parse::<i64>().unwrap_or(0)+}++/// Cooldown after ability haste, using the game's own diminishing formula.+fn haste_cooldown(base: f64, haste: i64) -> f64 {+ if base <= 0.0 {+ return 0.0;+ }+ let reduced = base / (1.0 + haste as f64 / 100.0);+ (reduced * 10.0).round() / 10.0+}++/// Ability ranks a player of a given level most likely has.+///+/// Levelling order varies, so this is the standard shape — ultimate at 6/11/16,+/// the remaining points spread across the basic abilities — and it is labelled+/// as an estimate wherever it is shown.+fn estimated_ranks(level: i64) -> [i64; 4] {+ let level = level.clamp(1, 18);+ let ult = if level >= 16 {+ 3+ } else if level >= 11 {+ 2+ } else if level >= 6 {+ 1+ } else {+ 0+ };+ let spent_on_ult = ult;+ let basic_points = (level - spent_on_ult).max(0);+ // Spread the basic points across Q, W and E, favouring the earlier slots.+ let base = basic_points / 3;+ let extra = basic_points % 3;+ let mut ranks = [base.min(5), base.min(5), base.min(5), ult];+ for slot in ranks.iter_mut().take(extra as usize) {+ *slot = (*slot + 1).min(5);+ }+ ranks+}++/// Live cooldown estimates for every champion in the running game.+#[tauri::command]+pub async fn league_ability_cooldowns() -> Result<Value, String> {+ ensure_enabled()?;+ let client = get_client().await?;+ let http = http_client()?;++ let players = http+ .get("https://127.0.0.1:2999/liveclientdata/playerlist")+ .send()+ .await+ .map_err(|e| format!("live client not reachable: {}", e))?+ .json::<Value>()+ .await+ .map_err(|e| format!("invalid live client response: {}", e))?;+ let list = players.as_array().cloned().unwrap_or_default();+ if list.is_empty() {+ return Err("no players in the live game".to_string());+ }++ // Item descriptions and champion spell data both come from the client, so+ // they always match the installed patch.+ // The client localises item text, so the haste number is read from the+ // English game-data mirror instead of the localised copy.+ let items_data = http+ .get("https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default/v1/items.json")+ .send()+ .await+ .ok()+ .and_then(|r| if r.status().is_success() { Some(r) } else { None });+ let items_data = match items_data {+ Some(r) => r.json::<Value>().await.unwrap_or(Value::Null),+ None => Value::Null,+ };+ let mut haste_by_item: std::collections::HashMap<i64, i64> =+ std::collections::HashMap::new();+ if let Some(arr) = items_data.as_array() {+ for item in arr {+ let id = item.get("id").and_then(Value::as_i64).unwrap_or(0);+ let desc = item.get("description").and_then(Value::as_str).unwrap_or("");+ let haste = item_ability_haste(desc);+ if id > 0 && haste > 0 {+ haste_by_item.insert(id, haste);+ }+ }+ }++ let summary = lcu_get_raw(&client, "/lol-game-data/assets/v1/champion-summary.json")+ .await+ .unwrap_or(Value::Null);+ let mut id_by_alias: std::collections::HashMap<String, i64> =+ std::collections::HashMap::new();+ if let Some(arr) = summary.as_array() {+ for champ in arr {+ if let (Some(id), Some(alias)) = (+ champ.get("id").and_then(Value::as_i64),+ champ.get("alias").and_then(Value::as_str),+ ) {+ id_by_alias.insert(alias.to_ascii_lowercase(), id);+ }+ }+ }++ let mut rows: Vec<Value> = Vec::new();+ let mut spell_cache: std::collections::HashMap<i64, Value> =+ std::collections::HashMap::new();++ for p in &list {+ let raw_name = p.get("rawChampionName").and_then(Value::as_str).unwrap_or("");+ let alias = raw_name.rsplit('_').next().unwrap_or("").to_ascii_lowercase();+ let champion_id = id_by_alias.get(&alias).copied().unwrap_or(0);+ let level = p.get("level").and_then(Value::as_i64).unwrap_or(1);++ let mut haste = 0i64;+ let mut item_ids: Vec<i64> = Vec::new();+ if let Some(items) = p.get("items").and_then(Value::as_array) {+ for item in items {+ let id = item.get("itemID").and_then(Value::as_i64).unwrap_or(0);+ if id > 0 {+ item_ids.push(id);+ haste += haste_by_item.get(&id).copied().unwrap_or(0);+ }+ }+ }++ let spells = if champion_id > 0 {+ if let Some(cached) = spell_cache.get(&champion_id) {+ cached.clone()+ } else {+ let detail = lcu_get_raw(+ &client,+ &format!("/lol-game-data/assets/v1/champions/{}.json", champion_id),+ )+ .await+ .unwrap_or(Value::Null);+ let value = detail.get("spells").cloned().unwrap_or(Value::Null);+ spell_cache.insert(champion_id, value.clone());+ value+ }+ } else {+ Value::Null+ };++ let ranks = estimated_ranks(level);+ let keys = ["Q", "W", "E", "R"];+ let abilities: Vec<Value> = spells+ .as_array()+ .map(|arr| {+ arr.iter()+ .take(4)+ .enumerate()+ .map(|(i, spell)| {+ let coefficients: Vec<f64> = spell+ .get("cooldownCoefficients")+ .and_then(Value::as_array)+ .map(|c| c.iter().filter_map(Value::as_f64).collect())+ .unwrap_or_default();+ let rank = ranks[i].max(1) as usize;+ let base = coefficients+ .get(rank.saturating_sub(1))+ .or_else(|| coefficients.first())+ .copied()+ .unwrap_or(0.0);+ json!({+ "key": keys[i],+ "name": spell.get("name"),+ "iconPath": spell.get("abilityIconPath"),+ "rank": ranks[i],+ "baseCooldown": base,+ "cooldown": haste_cooldown(base, haste),+ "allRanks": coefficients,+ })+ })+ .collect()+ })+ .unwrap_or_default();++ rows.push(json!({+ "riotId": p.get("riotId"),+ "championName": p.get("championName"),+ "championId": champion_id,+ "team": p.get("team"),+ "position": p.get("position"),+ "level": level,+ "abilityHaste": haste,+ "items": item_ids,+ "abilities": abilities,+ "summonerSpells": p.get("summonerSpells"),+ }));+ }++ Ok(json!({ "players": rows, "estimated": true }))+}+#[tauri::command]pub async fn league_auto_accept_set(enabled: bool) -> Result<(), String> {ensure_enabled()?;diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex 6f80939e..20738d09 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -734,6 +734,7 @@ pub fn run() {commands::league::league_rune_recommendations,commands::league::league_champion_tiers,commands::league::league_champion_build,+ commands::league::league_ability_cooldowns,commands::bilibili_auth::bilibili_qr_generate,commands::bilibili_auth::bilibili_qr_poll,commands::bilibili_auth::bilibili_captcha_challenge,diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.jsonindex de1e90a1..123d5fdf 100644--- a/src/lib/i18n/el.json+++ b/src/lib/i18n/el.json@@ -37,6 +37,12 @@"nav_downloads": "Μετάβαση στις Λήψεις"},"league": {+ "cd_title": "Cooldown αντιπάλων",+ "cd_desc": "Βασικά cooldown από τα δεδομένα ηρώων του ίδιου του παιχνιδιού, διαιρεμένα με το ability haste των αντικειμένων τους. Τα ranks εκτιμώνται από το level, οπότε είναι προσεγγιστικά.",+ "cd_estimated": "εκτίμηση",+ "cd_haste": "haste",+ "col_gold_hint": "Ο χρυσός που φαίνεται είναι όσα κουβαλά ο κάθε παίκτης σε αντικείμενα, με τιμές από τα δεδομένα του παιχνιδιού — ο μόνος οικονομικός δείκτης ορατός για άλλους παίκτες.",+ "scout_no_history": "Χωρίς πρόσφατους αγώνες","build_title": "Build αντικειμένων","build_desc": "Υπολογίζεται από τους αγώνες αυτού του ήρωα μέσα στο δικό σου πρόσφατο ιστορικό — χωρίς site build τρίτων, οπότε το δείγμα είναι μικρό και δηλώνεται.","build_champion": "Διάλεξε ήρωα",diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.jsonindex 6a1e9eb2..5a714e0c 100644--- a/src/lib/i18n/en.json+++ b/src/lib/i18n/en.json@@ -37,6 +37,12 @@"nav_downloads": "Go to Downloads"},"league": {+ "cd_title": "Enemy cooldowns",+ "cd_desc": "Base cooldowns from the game's own champion data, divided by the ability haste their items give them. Ability ranks are estimated from level, so treat these as close, not exact.",+ "cd_estimated": "estimated",+ "cd_haste": "haste",+ "col_gold_hint": "Gold shown is what each player is carrying in items, priced from the game's own item data — the only economy number visible for other players.",+ "scout_no_history": "No recent games","build_title": "Item build","build_desc": "Built from the champion's games inside your own recent matches — no third-party build site involved, so the sample is small and honest about it.","build_champion": "Pick a champion",diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.jsonindex 171c2054..e4a6a9ed 100644--- a/src/lib/i18n/es.json+++ b/src/lib/i18n/es.json@@ -37,6 +37,12 @@"nav_downloads": "Ir a Descargas"},"league": {+ "cd_title": "Enfriamientos enemigos",+ "cd_desc": "Enfriamientos base de los propios datos de campeón del juego, divididos por la aceleración de habilidad que le dan sus objetos. Los rangos se estiman por nivel, así que tómalos como aproximados.",+ "cd_estimated": "estimado",+ "cd_haste": "aceleración",+ "col_gold_hint": "El oro mostrado es lo que cada jugador lleva en objetos, valorado con los datos de objetos del juego: es el único número de economía visible para los demás.",+ "scout_no_history": "Sin partidas recientes","build_title": "Build de objetos","build_desc": "Construida con las partidas de ese campeón dentro de tu propio historial reciente — sin sitios de builds de terceros, así que la muestra es pequeña y se indica.","build_champion": "Elige un campeón",diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.jsonindex 1b970c67..9bf7cab7 100644--- a/src/lib/i18n/fr.json+++ b/src/lib/i18n/fr.json@@ -37,6 +37,12 @@"nav_downloads": "Aller aux Téléchargements"},"league": {+ "cd_title": "Temps de recharge ennemis",+ "cd_desc": "Temps de recharge de base issus des données de champion du jeu, divisés par l'accélération de compétence de leurs objets. Les rangs sont estimés d'après le niveau, donc à prendre comme approximatifs.",+ "cd_estimated": "estimé",+ "cd_haste": "accélération",+ "col_gold_hint": "L'or affiché est ce que chaque joueur porte en objets, valorisé avec les données d'objets du jeu — le seul chiffre d'économie visible pour les autres.",+ "scout_no_history": "Aucune partie récente","build_title": "Build d'objets","build_desc": "Construite à partir des parties de ce champion dans votre propre historique récent — sans site de build tiers, donc l'échantillon est petit et annoncé comme tel.","build_champion": "Choisir un champion",diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.jsonindex f27a8d50..f0184198 100644--- a/src/lib/i18n/it.json+++ b/src/lib/i18n/it.json@@ -37,6 +37,12 @@"nav_downloads": "Vai ai Download"},"league": {+ "cd_title": "Ricariche nemiche",+ "cd_desc": "Ricariche base dai dati campione del gioco, divise per l'accelerazione abilità dei loro oggetti. I ranghi sono stimati dal livello, quindi consideralo approssimativo.",+ "cd_estimated": "stimato",+ "cd_haste": "accelerazione",+ "col_gold_hint": "L'oro mostrato è quello che ogni giocatore porta negli oggetti, valorizzato con i dati oggetti del gioco: è l'unico dato economico visibile per gli altri.",+ "scout_no_history": "Nessuna partita recente","build_title": "Build di oggetti","build_desc": "Costruita dalle partite di quel campione nella tua cronologia recente — nessun sito di build di terze parti, quindi il campione è piccolo e dichiarato.","build_champion": "Scegli un campione",diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.jsonindex 8e0b4aaf..6b352095 100644--- a/src/lib/i18n/ja.json+++ b/src/lib/i18n/ja.json@@ -37,6 +37,12 @@"nav_downloads": "ダウンロードへ移動"},"league": {+ "cd_title": "敵のクールダウン",+ "cd_desc": "ゲーム本体のチャンピオンデータの基本クールダウンを、装備によるアビリティヘイストで割った値です。ランクはレベルからの推定なので、目安として見てください。",+ "cd_estimated": "推定",+ "cd_haste": "ヘイスト",+ "col_gold_hint": "表示ゴールドは各プレイヤーが装備に投じた額で、ゲーム本体のアイテムデータで算出しています。他プレイヤーについて見える唯一の経済指標です。",+ "scout_no_history": "直近の試合なし","build_title": "アイテムビルド","build_desc": "あなた自身の直近の試合に含まれるそのチャンピオンの試合から算出。外部ビルドサイトは使っていないため、サンプルは小さくその旨を明示します。","build_champion": "チャンピオンを選択",diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.tsindex 9bcc22f4..b631f527 100644--- a/src/lib/i18n/keys.ts+++ b/src/lib/i18n/keys.ts@@ -381,12 +381,17 @@ export type TranslationKeys =| 'league.build_empty'| 'league.build_samples'| 'league.build_title'+ | 'league.cd_desc'+ | 'league.cd_estimated'+ | 'league.cd_haste'+ | 'league.cd_title'| 'league.champ_select_title'| 'league.chat_build'| 'league.chat_placeholder'| 'league.chat_send'| 'league.col_diff'| 'league.col_gold'+ | 'league.col_gold_hint'| 'league.col_player'| 'league.connected'| 'league.defeat'@@ -467,6 +472,7 @@ export type TranslationKeys =| 'league.scout_allies'| 'league.scout_enemies'| 'league.scout_enemies_hidden'+ | 'league.scout_no_history'| 'league.scout_note_placeholder'| 'league.scout_private'| 'league.scout_title'diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.jsonindex bab23fcf..331c4157 100644--- a/src/lib/i18n/pt.json+++ b/src/lib/i18n/pt.json@@ -37,6 +37,12 @@"nav_downloads": "Ir para Downloads"},"league": {+ "cd_title": "Cooldowns inimigos",+ "cd_desc": "Cooldowns base vindos dos dados de campeão do próprio jogo, divididos pela aceleração de habilidade que os itens dele dão. Os ranks das habilidades são estimados pelo nível, então trate como aproximado, não exato.",+ "cd_estimated": "estimado",+ "cd_haste": "aceleração",+ "col_gold_hint": "O ouro mostrado é o que cada jogador carrega em itens, precificado pelos dados de item do próprio jogo — é o único número de economia visível para os outros jogadores.",+ "scout_no_history": "Sem partidas recentes","build_title": "Build de itens","build_desc": "Montada a partir das partidas desse campeão dentro do seu próprio histórico recente — sem site de build de terceiros, então a amostra é pequena e assumida como tal.","build_champion": "Escolha um campeão",diff --git a/src/lib/i18n/ru.json b/src/lib/i18n/ru.jsonindex 474af3ba..126d8864 100644--- a/src/lib/i18n/ru.json+++ b/src/lib/i18n/ru.json@@ -37,6 +37,12 @@"nav_downloads": "Перейти к загрузкам"},"league": {+ "cd_title": "Перезарядки противников",+ "cd_desc": "Базовые перезарядки из данных чемпионов самой игры, делённые на ускорение умений от их предметов. Ранги оцениваются по уровню, так что считайте это приближением.",+ "cd_estimated": "оценка",+ "cd_haste": "ускорение",+ "col_gold_hint": "Показано золото, вложенное в предметы, по ценам из данных самой игры — это единственный экономический показатель, видимый для других игроков.",+ "scout_no_history": "Нет недавних игр","build_title": "Сборка предметов","build_desc": "Собрана по играм этого чемпиона в вашей недавней истории — без сторонних сайтов сборок, поэтому выборка мала и это указано честно.","build_champion": "Выберите чемпиона",diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.jsonindex 6b29d087..22815b00 100644--- a/src/lib/i18n/zh-TW.json+++ b/src/lib/i18n/zh-TW.json@@ -37,6 +37,12 @@"nav_downloads": "前往下載"},"league": {+ "cd_title": "敵方冷卻",+ "cd_desc": "基礎冷卻取自遊戲本身的英雄資料,再除以其裝備提供的技能急速。技能等級由角色等級推算,因此為近似值。",+ "cd_estimated": "估算",+ "cd_haste": "急速",+ "col_gold_hint": "顯示的金幣是每位玩家裝備上的價值,依遊戲自身的物品資料計價——這是其他玩家唯一可見的經濟數據。",+ "scout_no_history": "沒有近期對戰","build_title": "出裝","build_desc": "根據你自己近期對戰中該英雄的出裝統計得出——不使用第三方出裝網站,因此樣本較小且如實標註。","build_champion": "選擇英雄",diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.jsonindex 10a05570..d33d8522 100644--- a/src/lib/i18n/zh.json+++ b/src/lib/i18n/zh.json@@ -37,6 +37,12 @@"nav_downloads": "前往下载"},"league": {+ "cd_title": "敌方冷却",+ "cd_desc": "基础冷却取自游戏本身的英雄数据,再除以其装备提供的技能急速。技能等级由角色等级推算,因此为近似值。",+ "cd_estimated": "估算",+ "cd_haste": "急速",+ "col_gold_hint": "显示的金币是每位玩家装备上的价值,按游戏自身的物品数据计价——这是其他玩家唯一可见的经济数据。",+ "scout_no_history": "没有近期对局","build_title": "出装","build_desc": "根据你自己近期对局中该英雄的出装统计得出——不使用第三方出装网站,因此样本较小且如实标注。","build_champion": "选择英雄",diff --git a/src/routes/league/+page.svelte b/src/routes/league/+page.svelteindex 459399e7..87380af8 100644--- a/src/routes/league/+page.svelte+++ b/src/routes/league/+page.svelte@@ -14,7 +14,7 @@type LobbyQueue = { id: number; name: string; shortName: string; gameMode: string };let settings = $derived(getSettings());- let enabled = $derived(settings?.league?.enabled ?? false);+ let enabled = $derived(settings?.league?.enabled ?? true);let status = $state<LeagueStatus>({ connected: false, port: null, region: null });let summoner = $state<any>(null);@@ -79,7 +79,7 @@scoutPlayers = (data?.players ?? []).filter((p: any) => p);for (const p of scoutPlayers) {if (!p.puuid || scoutReports[p.puuid]) continue;- invoke<any>("league_player_report", { puuid: p.puuid })+ invoke<any>("league_player_report", { puuid: p.puuid, withImpact: false }).then((r) => {scoutReports = { ...scoutReports, [p.puuid]: r };})@@ -474,6 +474,29 @@}}+ const RAW_CDRAGON = "https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default";+ let cooldowns = $state<any>(null);++ // The client returns icon paths rooted at /lol-game-data/assets; the public+ // mirror serves the same files lowercased under its own prefix.+ function assetUrl(path: string | null | undefined): string {+ if (!path) return "";+ const clean = path.replace(/^\/lol-game-data\/assets/i, "").toLowerCase();+ return `${RAW_CDRAGON}${clean}`;+ }++ async function loadCooldowns() {+ try {+ cooldowns = await invoke<any>("league_ability_cooldowns");+ } catch {+ cooldowns = null;+ }+ }++ let enemyCooldowns = $derived(+ (cooldowns?.players ?? []).filter((p: any) => p.team && p.team !== myTeam)+ );+const PHASE_KEYS: Record<string, string> = {Lobby: "league.phase_lobby",Matchmaking: "league.phase_matchmaking",@@ -571,8 +594,10 @@}if (phase === "InProgress") {loadLiveMetrics();+ loadCooldowns();} else if (liveMetrics) {liveMetrics = null;+ cooldowns = null;}if (phase === "Lobby" || phase === "Matchmaking") {try {@@ -989,6 +1014,10 @@</div>{:else if r?.privateProfile}<span class="scout-private">{$t("league.scout_private")}</span>+ {:else if r?.historyUnavailable}+ <span class="scout-private">{$t("league.scout_no_history")}</span>+ {:else if r}+ <span class="scout-private">…</span>{/if}{#if p.puuid}<button class="note-toggle" class:has-note={(notes[p.puuid] ?? "").trim() !== ""} onclick={() => { openNotes = { ...openNotes, [p.puuid]: !openNotes[p.puuid] }; }} aria-label={$t("league.scout_note_placeholder") as string} aria-expanded={openNotes[p.puuid] ?? false}>✎</button>@@ -1327,6 +1356,7 @@<h3>{$t("league.gold_title")}</h3><span class="phase-tag">{formatGameTime(liveMetrics.gameTime ?? 0)}</span></div>+ <p class="win-disclaimer">{$t("league.col_gold_hint")}</p><div class="gold-summary"><span class="gold-team">{$t("league.your_team")}: <strong>{liveMetrics.teamGold?.[myTeam] ?? 0}</strong></span><span class="gold-diff" class:good={teamGoldLead > 0} class:bad={teamGoldLead < 0}>@@ -1339,7 +1369,7 @@<span role="columnheader">{$t("league.col_player")}</span><span role="columnheader">KDA</span><span role="columnheader">CS</span>- <span role="columnheader">{$t("league.col_gold")}</span>+ <span role="columnheader" title={$t("league.col_gold_hint") as string}>{$t("league.col_gold")}</span><span role="columnheader">{$t("league.col_diff")}</span></div>{#each liveMetrics.players as row (row.riotId)}@@ -1362,6 +1392,42 @@</div></section>+ {#if enemyCooldowns.length > 0}+ <section class="card">+ <div class="card-head">+ <h3>{$t("league.cd_title")}</h3>+ <span class="phase-tag">{$t("league.cd_estimated")}</span>+ </div>+ <p class="win-disclaimer">{$t("league.cd_desc")}</p>+ <div class="cd-list">+ {#each enemyCooldowns as p (p.riotId)}+ <div class="cd-row">+ <div class="cd-champ">+ {#if p.championId > 0}+ <img class="champ-icon small" src={`${CDRAGON}/champion-icons/${p.championId}.png`} alt="" loading="lazy" />+ {/if}+ <div class="cd-id">+ <span class="cd-name">{p.championName}</span>+ <span class="dim">{$t("league.cd_haste")} {p.abilityHaste} · lv{p.level}</span>+ </div>+ </div>+ <div class="cd-abilities">+ {#each p.abilities as ab (ab.key)}+ <span class="cd-ability" title={`${ab.name ?? ""} (${ab.key})`}>+ {#if ab.iconPath}+ <img class="ability-icon" src={assetUrl(ab.iconPath)} alt="" loading="lazy" onerror={(e) => { (e.currentTarget as HTMLImageElement).style.visibility = "hidden"; }} />+ {/if}+ <span class="cd-key">{ab.key}</span>+ <span class="cd-value">{ab.cooldown > 0 ? `${ab.cooldown}s` : "—"}</span>+ </span>+ {/each}+ </div>+ </div>+ {/each}+ </div>+ </section>+ {/if}+{#if selfRow}<section class="card"><div class="card-head">@@ -2479,6 +2545,74 @@background: var(--button);}+ .cd-list {+ display: flex;+ flex-direction: column;+ gap: 5px;+ }++ .cd-row {+ display: flex;+ align-items: center;+ gap: 12px;+ padding: 6px 8px;+ background: var(--button);+ border-radius: calc(var(--border-radius) - 4px);+ flex-wrap: wrap;+ }++ .cd-champ {+ display: flex;+ align-items: center;+ gap: 8px;+ min-width: 130px;+ }++ .cd-id {+ display: flex;+ flex-direction: column;+ gap: 1px;+ font-size: 11.5px;+ }++ .cd-name {+ font-size: 12.5px;+ font-weight: 600;+ }++ .cd-abilities {+ display: flex;+ gap: 8px;+ margin-left: auto;+ flex-wrap: wrap;+ }++ .cd-ability {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 1px;+ min-width: 38px;+ }++ .ability-icon {+ width: 26px;+ height: 26px;+ border-radius: 5px;+ background: var(--surface);+ }++ .cd-key {+ font-size: 9.5px;+ color: var(--gray);+ letter-spacing: 0.05em;+ }++ .cd-value {+ font-size: 11.5px;+ font-variant-numeric: tabular-nums;+ }+.scout-teams {display: grid;grid-template-columns: 1fr 1fr;