Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat(league): dar nota aos jogadores com piso de amostra e copiar o Riot ID (#259)

antonio710eaa56ab3e
diff --git a/src-tauri/src/commands/league/meta.rs b/src-tauri/src/commands/league/meta.rs
new file mode 100644
index 00000000..2b2e96a8
--- /dev/null
+++ b/src-tauri/src/commands/league/meta.rs
@@ -0,0 +1,139 @@
+use serde_json::Value;
+
+/// Picks the most played variant of a list of `{ids, play, win, pick_rate}`
+/// entries. Most played beats highest win rate on purpose: a 100% win rate over
+/// two games is noise.
+pub fn most_played(entries: &[Value]) -> Option<&Value> {
+ entries
+ .iter()
+ .max_by_key(|e| e.get("play").and_then(Value::as_i64).unwrap_or(0))
+}
+
+pub fn id_list(entry: Option<&Value>) -> Vec<i64> {
+ entry
+ .and_then(|e| e.get("ids"))
+ .and_then(Value::as_array)
+ .map(|arr| arr.iter().filter_map(Value::as_i64).collect())
+ .unwrap_or_default()
+}
+
+/// Win rate of a variant as a percentage, when it has enough games to mean
+/// something.
+pub fn variant_winrate(entry: Option<&Value>) -> Option<f64> {
+ let entry = entry?;
+ let play = entry.get("play").and_then(Value::as_i64).unwrap_or(0);
+ let win = entry.get("win").and_then(Value::as_i64).unwrap_or(0);
+ if play < 5 {
+ return None;
+ }
+ Some(((win as f64 / play as f64) * 1000.0).round() / 10.0)
+}
+
+/// Skill order as the letters the client uses, from the most played build.
+pub fn skill_order(skills: &[Value]) -> Vec<String> {
+ most_played(skills)
+ .and_then(|e| e.get("order"))
+ .and_then(Value::as_array)
+ .map(|arr| {
+ arr.iter()
+ .filter_map(Value::as_str)
+ .map(str::to_string)
+ .collect()
+ })
+ .unwrap_or_default()
+}
+
+/// The first three levels of the order, which is what people actually memorise.
+pub fn first_levels(order: &[String], count: usize) -> Vec<String> {
+ order.iter().take(count).cloned().collect()
+}
+
+/// Counter champions, when the source has them. The field exists but comes back
+/// empty for plenty of champion/position pairs, so an empty list is normal and
+/// must render as "no data" rather than as an error.
+pub fn counters(raw: &Value) -> Vec<Value> {
+ raw.get("counters")
+ .and_then(Value::as_array)
+ .map(|arr| {
+ arr.iter()
+ .filter_map(|c| {
+ let id = c.get("champion_id").and_then(Value::as_i64)?;
+ let play = c.get("play").and_then(Value::as_i64).unwrap_or(0);
+ let win = c.get("win").and_then(Value::as_i64).unwrap_or(0);
+ Some(serde_json::json!({
+ "championId": id,
+ "games": play,
+ "winrate": if play > 0 {
+ serde_json::json!(((win as f64 / play as f64) * 1000.0).round() / 10.0)
+ } else {
+ Value::Null
+ },
+ }))
+ })
+ .collect()
+ })
+ .unwrap_or_default()
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use serde_json::json;
+
+ fn variants() -> Vec<Value> {
+ vec![
+ json!({ "ids": [1, 2], "play": 10, "win": 9 }),
+ json!({ "ids": [3, 4], "play": 40, "win": 20 }),
+ json!({ "ids": [5], "play": 2, "win": 2 }),
+ ]
+ }
+
+ #[test]
+ fn the_most_played_variant_wins_over_the_luckiest_one() {
+ let entries = variants();
+ let picked = most_played(&entries);
+ assert_eq!(id_list(picked), vec![3, 4]);
+ }
+
+ #[test]
+ fn a_variant_with_too_few_games_reports_no_winrate() {
+ let entries = variants();
+ assert_eq!(variant_winrate(Some(&entries[1])), Some(50.0));
+ assert_eq!(variant_winrate(Some(&entries[2])), None);
+ assert_eq!(variant_winrate(None), None);
+ }
+
+ #[test]
+ fn empty_input_never_panics() {
+ assert!(most_played(&[]).is_none());
+ assert!(id_list(None).is_empty());
+ assert!(skill_order(&[]).is_empty());
+ assert!(counters(&json!({})).is_empty());
+ assert!(counters(&json!({ "counters": [] })).is_empty());
+ }
+
+ #[test]
+ fn the_skill_order_comes_from_the_most_played_build() {
+ let skills = vec![
+ json!({ "order": ["Q", "W", "E"], "play": 3 }),
+ json!({ "order": ["E", "Q", "W", "Q", "Q", "R"], "play": 44 }),
+ ];
+ let order = skill_order(&skills);
+ assert_eq!(order, vec!["E", "Q", "W", "Q", "Q", "R"]);
+ assert_eq!(first_levels(&order, 3), vec!["E", "Q", "W"]);
+ // Asking for more levels than exist just returns what there is.
+ assert_eq!(first_levels(&order, 99).len(), 6);
+ }
+
+ #[test]
+ fn counters_are_normalised_and_skip_entries_without_a_champion() {
+ let raw = json!({ "counters": [
+ { "champion_id": 22, "play": 40, "win": 30 },
+ { "play": 10, "win": 5 }
+ ]});
+ let list = counters(&raw);
+ assert_eq!(list.len(), 1);
+ assert_eq!(list[0]["championId"], 22);
+ assert_eq!(list[0]["winrate"], 75.0);
+ }
+}
diff --git a/src-tauri/src/commands/league/mod.rs b/src-tauri/src/commands/league/mod.rs
index 8b824cb6..8812835e 100644
--- a/src-tauri/src/commands/league/mod.rs
+++ b/src-tauri/src/commands/league/mod.rs
@@ -3,6 +3,7 @@ pub mod champ_select;
pub mod live;
pub mod lobby;
pub mod locator;
+pub mod meta;
pub mod stats;
pub mod ws;
@@ -722,6 +723,7 @@ fn compute_history_stats(games: &[Value], puuid: &str) -> Value {
let mut flash_on_f = 0usize;
let mut total_damage = 0.0f64;
let mut total_gold = 0.0f64;
+ let mut scored_games: Vec<stats::ScoredGame> = Vec::new();
for game in games {
let participant = game
@@ -759,9 +761,29 @@ fn compute_history_stats(games: &[Value], puuid: &str) -> Value {
if win {
wins += 1;
}
- kills += stats.get("kills").and_then(Value::as_i64).unwrap_or(0);
- deaths += stats.get("deaths").and_then(Value::as_i64).unwrap_or(0);
- assists += stats.get("assists").and_then(Value::as_i64).unwrap_or(0);
+ let game_kills = stats.get("kills").and_then(Value::as_i64).unwrap_or(0);
+ let game_deaths = stats.get("deaths").and_then(Value::as_i64).unwrap_or(0);
+ let game_assists = stats.get("assists").and_then(Value::as_i64).unwrap_or(0);
+ kills += game_kills;
+ deaths += game_deaths;
+ assists += game_assists;
+ scored_games.push(stats::ScoredGame {
+ queue_id: game.get("queueId").and_then(Value::as_i64).unwrap_or(-1),
+ duration: game
+ .get("gameDuration")
+ .and_then(Value::as_i64)
+ .unwrap_or(0),
+ kills: game_kills,
+ deaths: game_deaths,
+ assists: game_assists,
+ win,
+ support: participant
+ .get("timeline")
+ .and_then(|t| t.get("lane"))
+ .and_then(Value::as_str)
+ == Some("NONE")
+ || stats.get("role").and_then(Value::as_str) == Some("DUO_SUPPORT"),
+ });
total_damage += stats
.get("totalDamageDealtToChampions")
.and_then(Value::as_f64)
@@ -864,11 +886,15 @@ fn compute_history_stats(games: &[Value], puuid: &str) -> Value {
Value::Null
};
+ let (score, scored_count) = stats::player_score(&scored_games);
+
json!({
"games": total,
"wins": wins,
"winrate": winrate,
"kda": (kda * 10.0).round() / 10.0,
+ "score": score.map(|s| (s * 100.0).round() / 100.0),
+ "scoredGames": scored_count,
"streak": { "win": streak_kind.unwrap_or(false), "length": streak_len },
"topChampions": top.iter().map(|(id, g, w)| json!({ "championId": id, "games": g, "wins": w })).collect::<Vec<_>>(),
"insights": insights,
@@ -1254,6 +1280,88 @@ pub async fn league_match_analysis() -> Result<Value, String> {
}))
}
+/// Build reference for a champion in a position: skill order, items by phase,
+/// summoner spells and counters, from the same public op.gg API the tier list
+/// uses. Presented as reference, never applied automatically.
+#[tauri::command]
+pub async fn league_champion_meta(
+ champion_id: i64,
+ position: Option<String>,
+ region: Option<String>,
+ tier: Option<String>,
+) -> Result<Value, String> {
+ ensure_enabled()?;
+ let position = position.unwrap_or_else(|| "mid".to_string()).to_lowercase();
+ let region = region.unwrap_or_else(|| "br".to_string());
+ let bracket = tier.unwrap_or_else(|| "emerald_plus".to_string());
+ if champion_id <= 0
+ || !position.chars().all(|c| c.is_ascii_alphabetic())
+ || !region.chars().all(|c| c.is_ascii_alphanumeric())
+ || !bracket
+ .chars()
+ .all(|c| c.is_ascii_alphanumeric() || c == '_')
+ {
+ return Err("invalid champion, position, region or tier".to_string());
+ }
+ let url = format!(
+ "https://lol-api-champion.op.gg/api/{}/champions/ranked/{}/{}?tier={}",
+ region, champion_id, position, bracket
+ );
+ let http = reqwest::Client::builder()
+ .timeout(std::time::Duration::from_secs(20))
+ .user_agent("OmniGet")
+ .build()
+ .map_err(|e| e.to_string())?;
+ let resp = http
+ .get(&url)
+ .send()
+ .await
+ .map_err(|e| format!("build reference unavailable: {}", e))?;
+ if !resp.status().is_success() {
+ return Err(format!(
+ "build reference returned {}",
+ resp.status().as_u16()
+ ));
+ }
+ let body = resp
+ .json::<Value>()
+ .await
+ .map_err(|e| format!("invalid build reference response: {}", e))?;
+ let data = body.get("data").unwrap_or(&body);
+
+ let array = |key: &str| -> Vec<Value> {
+ data.get(key)
+ .and_then(Value::as_array)
+ .cloned()
+ .unwrap_or_default()
+ };
+ let phase = |key: &str| -> Value {
+ let entries = array(key);
+ let picked = meta::most_played(&entries);
+ json!({
+ "ids": meta::id_list(picked),
+ "winrate": meta::variant_winrate(picked),
+ })
+ };
+
+ let skills = array("skills");
+ let order = meta::skill_order(&skills);
+
+ Ok(json!({
+ "championId": champion_id,
+ "position": position,
+ "source": "op.gg",
+ "skillOrder": order,
+ "skillPriority": meta::first_levels(&order, 3),
+ "starterItems": phase("starter_items"),
+ "coreItems": phase("core_items"),
+ "boots": phase("boots"),
+ "lastItems": phase("last_items"),
+ "spells": phase("summoner_spells"),
+ "counters": meta::counters(data),
+ }))
+}
+
/// Objective respawn estimates and a readable feed of what just happened,
/// derived from the in-game event log.
#[tauri::command]
@@ -2128,6 +2236,18 @@ pub async fn league_apply_runes(
.await;
}
+ // Creating a page into a full book fails with an opaque error, so the
+ // inventory is checked first and the reason is said out loud.
+ if let Ok(inventory) = lcu_get_raw(&client, "/lol-perks/v1/inventory").await {
+ let can_add = inventory
+ .get("canAddCustomPage")
+ .and_then(Value::as_bool)
+ .unwrap_or(true);
+ if !can_add {
+ return Err("rune pages are full".to_string());
+ }
+ }
+
let page = lcu_send(
&client,
reqwest::Method::POST,
diff --git a/src-tauri/src/commands/league/stats.rs b/src-tauri/src/commands/league/stats.rs
index 8c3b30ed..f35c73ca 100644
--- a/src-tauri/src/commands/league/stats.rs
+++ b/src-tauri/src/commands/league/stats.rs
@@ -483,6 +483,58 @@ pub fn impact_score(input: &ImpactInput) -> f64 {
.clamp(0.0, 10.0)
}
+/// Queues whose result carries signal for a player score. Customs, bots and
+/// rotating modes are left out.
+pub const SCORED_QUEUES: [i64; 5] = [400, 420, 430, 440, 450];
+
+/// Below this many usable games the average describes luck, not the player, so no
+/// score is reported at all — an honest blank beats a confident wrong number.
+pub const SCORE_MIN_GAMES: usize = 5;
+
+/// Games shorter than this were remakes.
+pub const SCORE_MIN_DURATION: i64 = 180;
+
+pub struct ScoredGame {
+ pub queue_id: i64,
+ pub duration: i64,
+ pub kills: i64,
+ pub deaths: i64,
+ pub assists: i64,
+ pub win: bool,
+ pub support: bool,
+}
+
+pub fn score_counts(game: &ScoredGame) -> bool {
+ SCORED_QUEUES.contains(&game.queue_id) && game.duration >= SCORE_MIN_DURATION
+}
+
+/// One game's contribution: a KDA-like ratio (assists worth a little more for
+/// supports, whose impact rarely shows up as kills), minus a penalty for games
+/// that ran away, plus the result.
+pub fn game_score(game: &ScoredGame) -> f64 {
+ let assist_weight = if game.support { 1.2 } else { 1.0 };
+ let ratio =
+ (game.kills as f64 + game.assists as f64 * assist_weight) / (game.deaths.max(1) as f64);
+ let penalty = if game.deaths > 20 && game.kills <= 10 {
+ 1.0
+ } else if game.deaths > 15 && game.kills <= 10 {
+ 0.5
+ } else {
+ 0.0
+ };
+ ratio - penalty + if game.win { 1.0 } else { -1.0 }
+}
+
+/// Average score over the usable games, or `None` when the sample is too small.
+pub fn player_score(games: &[ScoredGame]) -> (Option<f64>, usize) {
+ let usable: Vec<&ScoredGame> = games.iter().filter(|g| score_counts(g)).collect();
+ if usable.len() < SCORE_MIN_GAMES {
+ return (None, usable.len());
+ }
+ let total: f64 = usable.iter().map(|g| game_score(g)).sum();
+ (Some(total / usable.len() as f64), usable.len())
+}
+
/// Groups players that share a party id, which the gameflow session reports
/// directly. Solo players carry a unique id, so single-player groups are
/// dropped just like in the history-based detection.
@@ -905,4 +957,83 @@ mod tests {
let unknown = default_targets("");
assert!(unknown.cs_per_min > 0.0);
}
+
+ fn scored(kills: i64, deaths: i64, assists: i64, win: bool) -> ScoredGame {
+ ScoredGame {
+ queue_id: 420,
+ duration: 1800,
+ kills,
+ deaths,
+ assists,
+ win,
+ support: false,
+ }
+ }
+
+ #[test]
+ fn only_ranked_and_normal_games_of_real_length_count() {
+ assert!(score_counts(&scored(5, 2, 5, true)));
+ let remake = ScoredGame {
+ duration: 120,
+ ..scored(0, 0, 0, false)
+ };
+ assert!(!score_counts(&remake));
+ let arena = ScoredGame {
+ queue_id: 1700,
+ ..scored(5, 2, 5, true)
+ };
+ assert!(!score_counts(&arena));
+ }
+
+ #[test]
+ fn a_clean_win_scores_above_a_fed_loss() {
+ let clean = game_score(&scored(8, 4, 8, true));
+ let fed = game_score(&scored(2, 22, 1, false));
+ assert!(clean > fed);
+ assert!(fed < -1.8, "got {}", fed);
+ // (8 + 8) / 4 = 4, no penalty, +1 for the win.
+ assert!(close(clean, 5.0, 1e-9), "got {}", clean);
+ }
+
+ #[test]
+ fn support_assists_weigh_a_little_more() {
+ let carry = game_score(&scored(2, 4, 12, true));
+ let support = game_score(&ScoredGame {
+ support: true,
+ ..scored(2, 4, 12, true)
+ });
+ assert!(support > carry);
+ }
+
+ #[test]
+ fn a_deathless_game_does_not_divide_by_zero() {
+ assert!(game_score(&scored(7, 0, 3, true)).is_finite());
+ }
+
+ #[test]
+ fn no_score_is_reported_below_the_sample_floor() {
+ let few: Vec<ScoredGame> = (0..SCORE_MIN_GAMES - 1)
+ .map(|_| scored(5, 2, 5, true))
+ .collect();
+ let (score, games) = player_score(&few);
+ assert_eq!(score, None);
+ assert_eq!(games, SCORE_MIN_GAMES - 1);
+ assert_eq!(player_score(&[]), (None, 0));
+ }
+
+ #[test]
+ fn unusable_games_do_not_count_toward_the_floor() {
+ let mut games: Vec<ScoredGame> = (0..5).map(|_| scored(5, 2, 5, true)).collect();
+ games.push(ScoredGame {
+ duration: 60,
+ ..scored(0, 0, 0, false)
+ });
+ let (score, counted) = player_score(&games);
+ assert_eq!(counted, 5);
+ assert!(close(
+ score.unwrap(),
+ game_score(&scored(5, 2, 5, true)),
+ 1e-9
+ ));
+ }
}
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 83ecec8d..670c6f37 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -839,6 +839,7 @@ pub fn run() {
commands::league::league_apply_runes,
commands::league::league_send_chat,
commands::league::league_rune_recommendations,
+ commands::league::league_champion_meta,
commands::league::league_champion_tiers,
commands::league::league_champion_build,
commands::league::league_ability_cooldowns,
diff --git a/src/components/league/AnalysisTab.svelte b/src/components/league/AnalysisTab.svelte
index 720dae86..2fdd9e56 100644
--- a/src/components/league/AnalysisTab.svelte
+++ b/src/components/league/AnalysisTab.svelte
@@ -3,6 +3,7 @@
import { t } from "$lib/i18n";
import { CDRAGON, TAG_KEYS, type Champion, type RankedEntry, type ScoutPlayer } from "./shared";
import { markedPlayers, winrateSquad } from "$lib/league-scouting";
+ import { writeText } from "@tauri-apps/plugin-clipboard-manager";
let {
analysis,
@@ -35,6 +36,20 @@
let marked = $derived(markedPlayers(scoutPlayers, notes));
let squadSide = $derived(winrateSquad(scoutPlayers, analysis?.premades ?? [], scoutReports));
+ let copied = $state("");
+
+ async function copyRiotId(player: { gameName?: string; tagLine?: string; puuid?: string }) {
+ const id = player.tagLine ? `${player.gameName}#${player.tagLine}` : (player.gameName ?? "");
+ if (!id) return;
+ try {
+ await writeText(id);
+ copied = player.puuid ?? id;
+ setTimeout(() => { if (copied === (player.puuid ?? id)) copied = ""; }, 1500);
+ } catch {
+ copied = "";
+ }
+ }
+
let openNotes = $state<Record<string, boolean>>({});
let chatPreview = $state("");
let chatSending = $state(false);
@@ -190,6 +205,11 @@
<span class="scout-kda">
{r.stats.kda} KDA{#if r.impact !== null && r.impact !== undefined} · <span class="impact" title={$t("league.impact_hint") as string}>{r.impact}</span>{/if}
</span>
+ {#if r.stats.score !== null && r.stats.score !== undefined}
+ <span class="scout-score" title={`${$t("league.score_hint")} (${r.stats.scoredGames})`}>
+ {$t("league.score_label")} {r.stats.score.toFixed(1)}
+ </span>
+ {/if}
</div>
{:else if r?.privateProfile}
<span class="scout-private">{$t("league.scout_private")}</span>
@@ -198,6 +218,11 @@
{:else if r}
<span class="scout-private">…</span>
{/if}
+ {#if p.gameName}
+ <button class="note-toggle" onclick={() => copyRiotId(p)} aria-label={$t("league.copy_riot_id") as string} title={$t("league.copy_riot_id") as string}>
+ {copied === (p.puuid ?? p.gameName) ? "✓" : "⧉"}
+ </button>
+ {/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>
{/if}
diff --git a/src/components/league/MetaTab.svelte b/src/components/league/MetaTab.svelte
index 9dc56029..2b6d077a 100644
--- a/src/components/league/MetaTab.svelte
+++ b/src/components/league/MetaTab.svelte
@@ -2,6 +2,7 @@
import { onMount } from "svelte";
import { invoke } from "@tauri-apps/api/core";
import { t } from "$lib/i18n";
+ import { translateBackendError } from "$lib/error-translate";
import { getSettings, updateSettings } from "$lib/stores/settings-store.svelte";
import { CDRAGON, type Champion } from "./shared";
@@ -79,7 +80,7 @@
appliedRuneIndex = null;
} catch (e: any) {
runePages = [];
- runeError = typeof e === "string" ? e : (e?.message ?? String(e));
+ runeError = translateBackendError(typeof e === "string" ? e : (e?.message ?? String(e)), (k) => $t(k) as string);
}
}
@@ -100,7 +101,7 @@
});
appliedRuneIndex = index;
} catch (e: any) {
- runeError = typeof e === "string" ? e : (e?.message ?? String(e));
+ runeError = translateBackendError(typeof e === "string" ? e : (e?.message ?? String(e)), (k) => $t(k) as string);
} finally {
runeApplying = false;
}
@@ -124,6 +125,43 @@
}
});
+ let metaInfo = $state<any>(null);
+ let metaLoading = $state(false);
+ let metaError = $state("");
+
+ async function loadMeta(championId: number) {
+ if (championId <= 0 || metaLoading) return;
+ metaLoading = true;
+ metaError = "";
+ try {
+ metaInfo = await invoke<any>("league_champion_meta", {
+ championId,
+ position: myAssignedPosition ? opggPosition(myAssignedPosition) : undefined,
+ });
+ } catch (e: any) {
+ metaInfo = null;
+ metaError = typeof e === "string" ? e : (e?.message ?? String(e));
+ } finally {
+ metaLoading = false;
+ }
+ }
+
+ // op.gg names positions differently from the client.
+ function opggPosition(position: string): string {
+ const map: Record<string, string> = {
+ TOP: "top",
+ JUNGLE: "jungle",
+ MIDDLE: "mid",
+ BOTTOM: "adc",
+ UTILITY: "support",
+ };
+ return map[position] ?? "mid";
+ }
+
+ function itemIcon(id: number): string {
+ return `${CDRAGON}/../../game/assets/items/icons2d/${id}.png`;
+ }
+
let buildChampionId = $state<number>(0);
let buildInfo = $state<any>(null);
let buildLoading = $state(false);
@@ -295,6 +333,62 @@
{:else if buildInfo}
<p class="empty-hint">{$t("league.build_empty")}</p>
{/if}
+ <div class="divider"></div>
+ <div class="card-head">
+ <h4 class="section-title">{$t("league.meta_reference")}</h4>
+ <button
+ class="button"
+ onclick={() => loadMeta(champSelectChampionId || (buildChampionId ?? 0))}
+ disabled={metaLoading || (!champSelectChampionId && !buildChampionId)}
+ >{$t("league.refresh")}</button>
+ </div>
+ {#if metaError}
+ <p class="action-error" role="alert">{metaError}</p>
+ {:else if metaLoading}
+ <p class="empty-hint">…</p>
+ {:else if metaInfo}
+ {#if metaInfo.skillPriority?.length}
+ <p class="win-note">
+ {$t("league.skill_priority")}: <strong>{metaInfo.skillPriority.join(" › ")}</strong>
+ </p>
+ <div class="skill-order">
+ {#each metaInfo.skillOrder as skill, i (`${i}-${skill}`)}
+ <span class="skill-step" class:ult={skill === "R"}>{skill}</span>
+ {/each}
+ </div>
+ {/if}
+ {#each [["starterItems", "items_starter"], ["coreItems", "items_core"], ["boots", "items_boots"], ["lastItems", "items_last"]] as [key, label] (key)}
+ {#if metaInfo[key]?.ids?.length}
+ <div class="build-phase">
+ <span class="list-label">{$t(`league.${label}`)}</span>
+ <div class="build-items">
+ {#each metaInfo[key].ids as id (id)}
+ <span class="build-item">
+ <img class="item-icon" src={itemIcon(id)} alt="" loading="lazy" onerror={(e) => { (e.currentTarget as HTMLImageElement).style.visibility = "hidden"; }} />
+ </span>
+ {/each}
+ {#if metaInfo[key].winrate !== null && metaInfo[key].winrate !== undefined}
+ <span class="dim">{metaInfo[key].winrate}%</span>
+ {/if}
+ </div>
+ </div>
+ {/if}
+ {/each}
+ {#if metaInfo.counters?.length}
+ <div class="build-phase">
+ <span class="list-label">{$t("league.counters")}</span>
+ <div class="build-items">
+ {#each metaInfo.counters.slice(0, 6) as c (c.championId)}
+ <span class="build-item">
+ <img class="champ-icon tiny" src={`${CDRAGON}/champion-icons/${c.championId}.png`} alt="" title={championById.get(c.championId)?.name ?? ""} loading="lazy" />
+ <span class="dim">{c.winrate}%</span>
+ </span>
+ {/each}
+ </div>
+ </div>
+ {/if}
+ <p class="win-disclaimer">{$t("league.meta_source")}</p>
+ {/if}
</section>
<section class="card">
diff --git a/src/lib/error-translate.ts b/src/lib/error-translate.ts
index 8c27d1ab..4737d4ec 100644
--- a/src/lib/error-translate.ts
+++ b/src/lib/error-translate.ts
@@ -4,6 +4,7 @@
*/
const BACKEND_ERROR_MAP: Record<string, string> = {
+ "rune pages are full": "league.runes_full",
"Video requires login. Use browser cookies or try another URL.":
"errors.login_required",
"This video requires login. Import cookies for this site in Settings → Cookies, then retry.":
diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.json
index 29d94139..e489174e 100644
--- a/src/lib/i18n/el.json
+++ b/src/lib/i18n/el.json
@@ -47,6 +47,15 @@
"build_desc": "Υπολογίζεται από τους αγώνες αυτού του ήρωα μέσα στο δικό σου πρόσφατο ιστορικό — χωρίς site build τρίτων, οπότε το δείγμα είναι μικρό και δηλώνεται.",
"build_champion": "Διάλεξε ήρωα",
"build_samples": "αγώνες",
+ "meta_reference": "Αναφορά build",
+ "meta_source": "Συγκεντρωτικά δημόσια δεδομένα op.gg για το τρέχον patch. Εμφανίζεται ως αναφορά· τίποτα δεν εφαρμόζεται αυτόματα.",
+ "skill_priority": "Προτεραιότητα δεξιοτήτων",
+ "items_starter": "Αρχικά αντικείμενα",
+ "items_core": "Βασικά αντικείμενα",
+ "items_boots": "Μπότες",
+ "items_last": "Αντικείμενα τέλους",
+ "counters": "Δυσκολεύεται εναντίον",
+ "runes_full": "Οι σελίδες rune είναι γεμάτες. Σβήσε μία στον client για να δημιουργήσει τη δική του το OmniGet.",
"build_empty": "Δεν υπάρχουν ακόμα αγώνες με αυτόν τον ήρωα στο δείγμα.",
"tab_meta": "Μέτα",
"runes_title": "Runes",
@@ -64,6 +73,9 @@
"tiers_ban": "ban",
"tiers_empty": "Η λίστα tier δεν είναι διαθέσιμη τώρα.",
"impact_label": "Επίδραση",
+ "score_label": "Βαθμός",
+ "score_hint": "Μέσος όρος πρόσφατων ranked και normal παιχνιδιών. Κρύβεται κάτω από πέντε έγκυρα παιχνίδια.",
+ "copy_riot_id": "Αντιγραφή Riot ID",
"impact_hint": "Σύνθεση KDA, συμμετοχής σε kills, ζημιάς, ζημιάς που δέχτηκε, χρυσού, vision και CS, σε κλίμακα 0-10",
"tab_search": "Αναζήτηση",
"search_title": "Εύρεση παίκτη",
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index 3ef8da8e..e94922b2 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -65,6 +65,15 @@
"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",
"build_samples": "games seen",
+ "meta_reference": "Build reference",
+ "meta_source": "Aggregated from public op.gg data for the current patch. Shown for reference; nothing is applied automatically.",
+ "skill_priority": "Skill priority",
+ "items_starter": "Starting items",
+ "items_core": "Core items",
+ "items_boots": "Boots",
+ "items_last": "Late items",
+ "counters": "Struggles against",
+ "runes_full": "Your rune pages are full. Delete one in the client to let OmniGet create its page.",
"build_empty": "No games with this champion in the sample yet.",
"tab_meta": "Meta",
"runes_title": "Runes",
@@ -82,6 +91,9 @@
"tiers_ban": "ban",
"tiers_empty": "Tier list unavailable right now.",
"impact_label": "Impact",
+ "score_label": "Score",
+ "score_hint": "Average of recent ranked and normal games. Hidden below five usable games.",
+ "copy_riot_id": "Copy Riot ID",
"impact_hint": "Composite of KDA, kill participation, damage, damage taken, gold, vision and CS share, scored 0-10",
"tab_search": "Search",
"search_title": "Find a player",
diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.json
index bf04bd43..cb73d3b7 100644
--- a/src/lib/i18n/es.json
+++ b/src/lib/i18n/es.json
@@ -47,6 +47,15 @@
"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",
"build_samples": "partidas vistas",
+ "meta_reference": "Referencia de build",
+ "meta_source": "Agregado de datos públicos de op.gg para el parche actual. Se muestra como referencia; nada se aplica automáticamente.",
+ "skill_priority": "Prioridad de habilidades",
+ "items_starter": "Objetos iniciales",
+ "items_core": "Objetos principales",
+ "items_boots": "Botas",
+ "items_last": "Objetos finales",
+ "counters": "Tiene dificultades contra",
+ "runes_full": "Tus páginas de runas están llenas. Borra una en el cliente para que OmniGet cree la suya.",
"build_empty": "Aún no hay partidas con este campeón en la muestra.",
"tab_meta": "Meta",
"runes_title": "Runas",
@@ -64,6 +73,9 @@
"tiers_ban": "baneo",
"tiers_empty": "Lista de tiers no disponible ahora.",
"impact_label": "Impacto",
+ "score_label": "Nota",
+ "score_hint": "Promedio de partidas clasificatorias y normales recientes. Oculta con menos de cinco partidas válidas.",
+ "copy_riot_id": "Copiar Riot ID",
"impact_hint": "Compuesto de KDA, participación en asesinatos, daño, daño recibido, oro, visión y CS, en escala 0-10",
"tab_search": "Buscar",
"search_title": "Buscar jugador",
diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json
index 76ad3417..461500ea 100644
--- a/src/lib/i18n/fr.json
+++ b/src/lib/i18n/fr.json
@@ -47,6 +47,15 @@
"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",
"build_samples": "parties vues",
+ "meta_reference": "Référence de build",
+ "meta_source": "Agrégat de données publiques op.gg pour le patch actuel. Affiché à titre de référence ; rien n'est appliqué automatiquement.",
+ "skill_priority": "Priorité des compétences",
+ "items_starter": "Objets de départ",
+ "items_core": "Objets principaux",
+ "items_boots": "Bottes",
+ "items_last": "Objets de fin",
+ "counters": "En difficulté contre",
+ "runes_full": "Vos pages de runes sont pleines. Supprimez-en une dans le client pour qu'OmniGet crée la sienne.",
"build_empty": "Aucune partie avec ce champion dans l'échantillon.",
"tab_meta": "Méta",
"runes_title": "Runes",
@@ -64,6 +73,9 @@
"tiers_ban": "ban",
"tiers_empty": "Liste de tiers indisponible pour le moment.",
"impact_label": "Impact",
+ "score_label": "Note",
+ "score_hint": "Moyenne des parties classées et normales récentes. Masquée en dessous de cinq parties valides.",
+ "copy_riot_id": "Copier le Riot ID",
"impact_hint": "Composite de KDA, participation aux kills, dégâts, dégâts subis, or, vision et CS, noté de 0 à 10",
"tab_search": "Rechercher",
"search_title": "Trouver un joueur",
diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.json
index 502d5517..a5f66aeb 100644
--- a/src/lib/i18n/it.json
+++ b/src/lib/i18n/it.json
@@ -47,6 +47,15 @@
"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",
"build_samples": "partite viste",
+ "meta_reference": "Riferimento build",
+ "meta_source": "Aggregato da dati pubblici di op.gg per la patch attuale. Mostrato come riferimento; nulla viene applicato automaticamente.",
+ "skill_priority": "Priorità abilità",
+ "items_starter": "Oggetti iniziali",
+ "items_core": "Oggetti principali",
+ "items_boots": "Stivali",
+ "items_last": "Oggetti finali",
+ "counters": "Fa fatica contro",
+ "runes_full": "Le tue pagine rune sono piene. Eliminane una nel client perché OmniGet crei la sua.",
"build_empty": "Nessuna partita con questo campione nel campione.",
"tab_meta": "Meta",
"runes_title": "Rune",
@@ -64,6 +73,9 @@
"tiers_ban": "ban",
"tiers_empty": "Tier list non disponibile al momento.",
"impact_label": "Impatto",
+ "score_label": "Punteggio",
+ "score_hint": "Media delle partite classificate e normali recenti. Nascosto sotto cinque partite valide.",
+ "copy_riot_id": "Copia Riot ID",
"impact_hint": "Composto di KDA, partecipazione alle uccisioni, danni, danni subiti, oro, visione e CS, su scala 0-10",
"tab_search": "Cerca",
"search_title": "Trova giocatore",
diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.json
index c490a704..6ae27171 100644
--- a/src/lib/i18n/ja.json
+++ b/src/lib/i18n/ja.json
@@ -47,6 +47,15 @@
"build_desc": "あなた自身の直近の試合に含まれるそのチャンピオンの試合から算出。外部ビルドサイトは使っていないため、サンプルは小さくその旨を明示します。",
"build_champion": "チャンピオンを選択",
"build_samples": "試合を参照",
+ "meta_reference": "ビルドの参考",
+ "meta_source": "現行パッチの op.gg 公開データの集計です。参考表示のみで、自動適用はしません。",
+ "skill_priority": "スキル優先度",
+ "items_starter": "初期アイテム",
+ "items_core": "コアアイテム",
+ "items_boots": "ブーツ",
+ "items_last": "後期アイテム",
+ "counters": "苦手な相手",
+ "runes_full": "ルーンページが満杯です。クライアントで1つ削除すると OmniGet がページを作成できます。",
"build_empty": "サンプル内にこのチャンピオンの試合がまだありません。",
"tab_meta": "メタ",
"runes_title": "ルーン",
@@ -64,6 +73,9 @@
"tiers_ban": "バン",
"tiers_empty": "ティアリストは現在利用できません。",
"impact_label": "インパクト",
+ "score_label": "スコア",
+ "score_hint": "直近のランクおよびノーマルの平均。有効な試合が5未満なら非表示。",
+ "copy_riot_id": "Riot IDをコピー",
"impact_hint": "KDA・キル関与・与ダメージ・被ダメージ・ゴールド・視界・CSの合成指標(0〜10)",
"tab_search": "検索",
"search_title": "プレイヤー検索",
diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.ts
index 0475821f..03c218a5 100644
--- a/src/lib/i18n/keys.ts
+++ b/src/lib/i18n/keys.ts
@@ -444,6 +444,8 @@ export type TranslationKeys =
| 'league.col_gold_hint'
| 'league.col_player'
| 'league.connected'
+ | 'league.copy_riot_id'
+ | 'league.counters'
| 'league.defeat'
| 'league.disabled_body'
| 'league.disabled_title'
@@ -487,6 +489,10 @@ export type TranslationKeys =
| 'league.history_title'
| 'league.impact_hint'
| 'league.impact_label'
+ | 'league.items_boots'
+ | 'league.items_core'
+ | 'league.items_last'
+ | 'league.items_starter'
| 'league.jungle_empty'
| 'league.jungle_gank3'
| 'league.jungle_invade'
@@ -501,6 +507,8 @@ export type TranslationKeys =
| 'league.marked_in_enemies'
| 'league.match_damage'
| 'league.match_detail_unavailable'
+ | 'league.meta_reference'
+ | 'league.meta_source'
| 'league.nav'
| 'league.notify_ready'
| 'league.notify_ready_desc'
@@ -561,8 +569,11 @@ export type TranslationKeys =
| 'league.runes_default'
| 'league.runes_desc'
| 'league.runes_empty'
+ | 'league.runes_full'
| 'league.runes_spells'
| 'league.runes_title'
+ | 'league.score_hint'
+ | 'league.score_label'
| 'league.scout_allies'
| 'league.scout_enemies'
| 'league.scout_enemies_hidden'
@@ -589,6 +600,7 @@ export type TranslationKeys =
| 'league.settings_enable'
| 'league.settings_enable_desc'
| 'league.settings_title'
+ | 'league.skill_priority'
| 'league.solo_kills_label'
| 'league.spectate'
| 'league.spectate_loading'
diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.json
index 8d83c7f4..3bb54200 100644
--- a/src/lib/i18n/pt.json
+++ b/src/lib/i18n/pt.json
@@ -47,6 +47,15 @@
"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",
"build_samples": "partidas vistas",
+ "meta_reference": "Referência de build",
+ "meta_source": "Agregado de dados públicos do op.gg para o patch atual. Exibido como referência; nada é aplicado automaticamente.",
+ "skill_priority": "Prioridade de habilidades",
+ "items_starter": "Itens iniciais",
+ "items_core": "Itens principais",
+ "items_boots": "Botas",
+ "items_last": "Itens finais",
+ "counters": "Tem dificuldade contra",
+ "runes_full": "Suas páginas de runas estão cheias. Apague uma no cliente para o OmniGet criar a dele.",
"build_empty": "Nenhuma partida com esse campeão na amostra ainda.",
"tab_meta": "Meta",
"runes_title": "Runas",
@@ -64,6 +73,9 @@
"tiers_ban": "ban",
"tiers_empty": "Tier list indisponível no momento.",
"impact_label": "Impacto",
+ "score_label": "Nota",
+ "score_hint": "Média das partidas ranqueadas e normais recentes. Escondida abaixo de cinco partidas válidas.",
+ "copy_riot_id": "Copiar Riot ID",
"impact_hint": "Composto de KDA, participação em abates, dano, dano recebido, ouro, visão e CS, numa escala de 0 a 10",
"tab_search": "Buscar",
"search_title": "Procurar jogador",
diff --git a/src/lib/i18n/ru.json b/src/lib/i18n/ru.json
index 06d38967..56a8bf48 100644
--- a/src/lib/i18n/ru.json
+++ b/src/lib/i18n/ru.json
@@ -47,6 +47,15 @@
"build_desc": "Собрана по играм этого чемпиона в вашей недавней истории — без сторонних сайтов сборок, поэтому выборка мала и это указано честно.",
"build_champion": "Выберите чемпиона",
"build_samples": "игр учтено",
+ "meta_reference": "Ориентир по сборке",
+ "meta_source": "Сводка публичных данных op.gg для текущего патча. Показано как справка; ничего не применяется автоматически.",
+ "skill_priority": "Приоритет умений",
+ "items_starter": "Стартовые предметы",
+ "items_core": "Основные предметы",
+ "items_boots": "Обувь",
+ "items_last": "Поздние предметы",
+ "counters": "Тяжело против",
+ "runes_full": "Страницы рун заполнены. Удалите одну в клиенте, чтобы OmniGet создал свою.",
"build_empty": "Игр с этим чемпионом в выборке пока нет.",
"tab_meta": "Мета",
"runes_title": "Руны",
@@ -64,6 +73,9 @@
"tiers_ban": "бан",
"tiers_empty": "Тир-лист сейчас недоступен.",
"impact_label": "Влияние",
+ "score_label": "Оценка",
+ "score_hint": "Среднее по недавним рейтинговым и обычным играм. Скрыта, если меньше пяти пригодных игр.",
+ "copy_riot_id": "Копировать Riot ID",
"impact_hint": "Composite: KDA, участие в убийствах, урон, полученный урон, золото, обзор и CS по шкале 0-10",
"tab_search": "Поиск",
"search_title": "Найти игрока",
diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.json
index f465c0b9..79790e9f 100644
--- a/src/lib/i18n/zh-TW.json
+++ b/src/lib/i18n/zh-TW.json
@@ -47,6 +47,15 @@
"build_desc": "根據你自己近期對戰中該英雄的出裝統計得出——不使用第三方出裝網站,因此樣本較小且如實標註。",
"build_champion": "選擇英雄",
"build_samples": "場對戰",
+ "meta_reference": "出裝參考",
+ "meta_source": "根據目前版本的 op.gg 公開資料彙總。僅作參考,不會自動套用。",
+ "skill_priority": "技能加點優先順序",
+ "items_starter": "初始裝備",
+ "items_core": "核心裝備",
+ "items_boots": "鞋子",
+ "items_last": "後期裝備",
+ "counters": "苦手對手",
+ "runes_full": "符文頁已滿。請在客戶端刪除一頁,讓 OmniGet 建立自己的頁面。",
"build_empty": "樣本中還沒有該英雄的對戰。",
"tab_meta": "版本",
"runes_title": "符文",
@@ -64,6 +73,9 @@
"tiers_ban": "禁用",
"tiers_empty": "強度榜暫時無法使用。",
"impact_label": "影響力",
+ "score_label": "評分",
+ "score_hint": "近期排位與一般對局的平均值。有效對局少於五場時隱藏。",
+ "copy_riot_id": "複製 Riot ID",
"impact_hint": "由 KDA、參團率、輸出、承傷、經濟、視野與補兵合成的 0-10 分指標",
"tab_search": "搜尋",
"search_title": "尋找玩家",
diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.json
index f4bb6b60..7cdafbd6 100644
--- a/src/lib/i18n/zh.json
+++ b/src/lib/i18n/zh.json
@@ -47,6 +47,15 @@
"build_desc": "根据你自己近期对局中该英雄的出装统计得出——不使用第三方出装网站,因此样本较小且如实标注。",
"build_champion": "选择英雄",
"build_samples": "场对局",
+ "meta_reference": "出装参考",
+ "meta_source": "根据当前版本的 op.gg 公开数据汇总。仅作参考,不会自动应用。",
+ "skill_priority": "技能加点优先级",
+ "items_starter": "初始装备",
+ "items_core": "核心装备",
+ "items_boots": "鞋子",
+ "items_last": "后期装备",
+ "counters": "苦手对手",
+ "runes_full": "符文页已满。请在客户端删除一页,让 OmniGet 创建自己的页面。",
"build_empty": "样本中还没有该英雄的对局。",
"tab_meta": "版本",
"runes_title": "符文",
@@ -64,6 +73,9 @@
"tiers_ban": "禁用",
"tiers_empty": "强度榜暂时不可用。",
"impact_label": "影响力",
+ "score_label": "评分",
+ "score_hint": "近期排位与普通对局的平均值。有效对局少于五场时隐藏。",
+ "copy_riot_id": "复制 Riot ID",
"impact_hint": "由 KDA、参团率、输出、承伤、经济、视野和补刀合成的 0-10 分指标",
"tab_search": "搜索",
"search_title": "查找玩家",
diff --git a/src/routes/league/+page.svelte b/src/routes/league/+page.svelte
index 45441c90..b4cde180 100644
--- a/src/routes/league/+page.svelte
+++ b/src/routes/league/+page.svelte
@@ -1922,6 +1922,43 @@
background: var(--surface-hover);
}
+ .league-page :global(.skill-order) {
+ display: flex;
+ gap: 3px;
+ flex-wrap: wrap;
+ margin: 6px 0 10px;
+ }
+
+ .league-page :global(.skill-step) {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 18px;
+ height: 18px;
+ border: 1px solid var(--border);
+ border-radius: 4px;
+ font-size: 10.5px;
+ color: var(--text-secondary);
+ }
+
+ .league-page :global(.skill-step.ult) {
+ border-color: var(--accent);
+ color: var(--text);
+ }
+
+ .league-page :global(.build-phase) {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ margin-bottom: 8px;
+ }
+
+ .league-page :global(.scout-score) {
+ font-size: 11.5px;
+ color: var(--text-secondary);
+ font-variant-numeric: tabular-nums;
+ }
+
.league-page :global(.objective-line) {
display: flex;
gap: 12px;