From dcafdc85ea796721b5546a7c55b58a6f60f26415 Mon Sep 17 00:00:00 2001 From: Shaydera Date: Sat, 21 Nov 2026 00:16:14 +0100 Subject: [PATCH] Send shown player names from the service The service now names every player the way the open log's game shows them: "Ravel Ashwood" for WoW Forever, the first part of the logged name everywhere else. Rosters, deaths, killing blows, recap sources, aura holders, meter units and replay units carry that name, so the UI no longer splits names itself. Pet and NPC names are sent as logged, hyphens included. Names that also serve as keys stay as logged: ability row actors, pet names and the ability detail's targets, which gain a map to each player's shown name. --- crates/openlogs-service/src/auras_dto.rs | 12 ++-- crates/openlogs-service/src/compare_dto.rs | 2 +- crates/openlogs-service/src/detail_dto.rs | 36 +++++------ crates/openlogs-service/src/meter_dto.rs | 2 +- crates/openlogs-service/src/overview_dto.rs | 21 ++++--- crates/openlogs-service/src/player_dto.rs | 5 +- crates/openlogs-service/src/recap_dto.rs | 2 +- crates/openlogs-service/src/refs.rs | 60 +++++++++++++++++-- crates/openlogs-service/src/replay_dto.rs | 19 ++++-- crates/openlogs-service/src/scope_dto.rs | 13 +--- crates/openlogs-wasm/tests/engine.rs | 31 ++++++---- ui/src/api/types.ts | 4 +- .../components/ability/AbilityDetailView.tsx | 8 +-- ui/src/components/auras/AurasTab.tsx | 6 +- ui/src/components/casts/CastsTab.tsx | 4 +- ui/src/components/chrome/crumbs.ts | 4 +- ui/src/components/chrome/headerTiles.ts | 3 +- ui/src/components/compare/CompareDeaths.tsx | 4 +- ui/src/components/deaths/DeathList.tsx | 6 +- ui/src/components/deaths/DeathRecapView.tsx | 3 +- ui/src/components/deaths/DeathsTab.test.tsx | 6 +- ui/src/components/deaths/RecapPanel.tsx | 6 +- ui/src/components/deaths/recapModel.test.ts | 6 +- ui/src/components/deaths/recapModel.ts | 8 +-- .../deaths/set/DeathWindowChart.tsx | 8 +-- .../components/deaths/set/LifetimeMatrix.tsx | 3 +- .../deaths/set/SetDeathsPage.test.tsx | 8 +-- ui/src/components/filters/labels.ts | 3 +- ui/src/components/filters/pickerModel.ts | 3 +- ui/src/components/overview/DeathsPanel.tsx | 4 +- ui/src/components/overview/Timeline.tsx | 4 +- ui/src/components/overview/players.test.ts | 14 ----- ui/src/components/overview/players.ts | 13 +--- ui/src/components/player/CastsAndBuffs.tsx | 4 +- ui/src/components/player/OverTimeChart.tsx | 4 +- ui/src/components/player/PlayerAbilities.tsx | 14 ++--- ui/src/components/player/PlayerHeader.tsx | 6 +- ui/src/components/player/PlayerKpis.tsx | 3 +- ui/src/components/player/PlayerSidePanels.tsx | 6 +- ui/src/components/replay/AuraIcons.tsx | 4 +- ui/src/components/replay/Meter.tsx | 8 +-- ui/src/components/replay/ReplayControls.tsx | 3 +- ui/src/components/replay/ReplayLegend.tsx | 4 +- ui/src/components/replay/hudIndex.ts | 5 +- ui/src/components/replay/stageDraw.ts | 6 +- ui/src/components/reports/PlayerName.test.tsx | 2 +- ui/src/components/reports/PlayerName.tsx | 6 +- ui/src/components/reports/ReportParts.tsx | 4 +- ui/src/components/reports/augSplit.test.ts | 4 +- ui/src/components/reports/augSplit.ts | 3 +- ui/src/components/reports/breakdown.test.ts | 4 +- ui/src/components/reports/rankedTargets.tsx | 3 +- ui/src/components/reports/targetGroups.ts | 4 +- ui/src/components/resources/ResourcesTab.tsx | 4 +- ui/src/components/target/TargetDetailView.tsx | 4 +- ui/src/components/views/TimelineView.test.tsx | 2 +- ui/src/currentGame.ts | 22 +++---- ui/src/gameData.test.ts | 12 ++-- ui/src/store.test.ts | 10 ++-- ui/src/test/compareFixture.ts | 2 +- ui/src/test/overviewFixture.ts | 12 ++-- ui/src/test/replayFixture.ts | 12 ++-- ui/src/test/reportFixtures.ts | 26 ++++---- ui/src/test/viewFixtures.ts | 6 +- 64 files changed, 272 insertions(+), 268 deletions(-) delete mode 100644 ui/src/components/overview/players.test.ts diff --git a/crates/openlogs-service/src/auras_dto.rs b/crates/openlogs-service/src/auras_dto.rs index f6d5c26..652fac4 100644 --- a/crates/openlogs-service/src/auras_dto.rs +++ b/crates/openlogs-service/src/auras_dto.rs @@ -7,7 +7,7 @@ use openlogs_analysis::{ use serde::{Deserialize, Serialize}; use crate::overview_dto::{PlayerRef, SpellRef}; -use crate::refs::Refs; +use crate::refs::{Refs, shown}; use crate::scope_dto::{DimensionDto, RowKeyDto, key_dto}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)] @@ -92,9 +92,11 @@ pub struct AurasReportDto { pub spells: BTreeMap, } -fn holder_dto(refs: &mut Refs, holder: &AuraHolder) -> AuraHolderDto { +fn holder_dto(fight: &Fight, refs: &mut Refs, holder: &AuraHolder) -> AuraHolderDto { AuraHolderDto { - name: holder.name.clone(), + name: holder + .player + .map_or_else(|| holder.name.clone(), |p| shown(fight, p, &holder.name)), player: holder.player.map(|p| refs.player(p)), } } @@ -127,7 +129,7 @@ pub fn auras_report_dto( name, spell_id: refs.spell(fight, row.spell), spell_ids: row.spells.iter().map(|&s| refs.spell(fight, s)).collect(), - holder: row.holder.as_ref().map(|h| holder_dto(&mut refs, h)), + holder: row.holder.as_ref().map(|h| holder_dto(fight, &mut refs, h)), sources: row.sources.iter().map(|&p| refs.player(p)).collect(), applications: row.applications, uptime: row.uptime, @@ -135,7 +137,7 @@ pub fn auras_report_dto( .lanes .iter() .map(|lane| AuraLaneDto { - holder: holder_dto(&mut refs, &lane.holder), + holder: holder_dto(fight, &mut refs, &lane.holder), spell_id: refs.spell(fight, lane.spell), spell_ids: lane.spells.iter().map(|&s| refs.spell(fight, s)).collect(), sources: lane.sources.iter().map(|&p| refs.player(p)).collect(), diff --git a/crates/openlogs-service/src/compare_dto.rs b/crates/openlogs-service/src/compare_dto.rs index 705e949..e63bb2c 100644 --- a/crates/openlogs-service/src/compare_dto.rs +++ b/crates/openlogs-service/src/compare_dto.rs @@ -165,7 +165,7 @@ mod tests { let faelan = &dto.players[0]; assert_eq!( (faelan.player.name.as_str(), faelan.player.spec_id), - ("Faelan-Emberfall-EU", Some(62)) + ("Faelan", Some(62)) ); assert_eq!( faelan.player.actor_id, faelan_a, diff --git a/crates/openlogs-service/src/detail_dto.rs b/crates/openlogs-service/src/detail_dto.rs index 22ea642..cdc95a9 100644 --- a/crates/openlogs-service/src/detail_dto.rs +++ b/crates/openlogs-service/src/detail_dto.rs @@ -1,4 +1,4 @@ -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeMap; use openlogs_analysis::{ AbilityDetail, ActorId, ActorKind, EnemyGroup, Fight, SpellId, TargetDetail, @@ -7,6 +7,7 @@ use serde::Serialize; use crate::overview_dto::{PlayerRef, player_ref}; use crate::player_dto::MetricDto; +use crate::refs::{logged_name, shown}; use crate::report_dto::PlayerAmount; #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] @@ -50,8 +51,8 @@ pub struct AbilityDetailDto { pub dead: Vec<[i32; 2]>, /// Names of the units in `hits`, keyed by actor id. pub target_names: BTreeMap, - /// Names in `target_names` that belong to players; only these are shortened in the UI. - pub player_targets: Vec, + /// The shown name of each player in `target_names`; other units are shown as logged. + pub shown_names: BTreeMap, } pub fn ability_detail_dto( @@ -60,25 +61,15 @@ pub fn ability_detail_dto( metric: MetricDto, ) -> AbilityDetailDto { let info = fight.spells.get(&detail.spell); - let target_names = detail + let target_names: BTreeMap = detail .hits .iter() - .map(|hit| { - let actor = fight.actors.get(hit.target); - ( - hit.target, - actor.name.clone().unwrap_or_else(|| actor.guid.clone()), - ) - }) + .map(|hit| (hit.target, logged_name(fight, hit.target).to_owned())) .collect(); - let player_targets: BTreeSet = detail - .hits + let shown_names = target_names .iter() - .filter(|hit| fight.actors.get(hit.target).kind == ActorKind::Player) - .map(|hit| { - let actor = fight.actors.get(hit.target); - actor.name.clone().unwrap_or_else(|| actor.guid.clone()) - }) + .filter(|&(&id, _)| fight.actors.get(id).kind == ActorKind::Player) + .map(|(&id, logged)| (logged.clone(), shown(fight, id, logged))) .collect(); AbilityDetailDto { player: player_ref(fight, detail.player), @@ -117,7 +108,7 @@ pub fn ability_detail_dto( uptime: detail.uptime, dead: detail.dead.iter().map(|&(a, b)| [a, b]).collect(), target_names, - player_targets: player_targets.into_iter().collect(), + shown_names, } } @@ -240,7 +231,7 @@ mod tests { use crate::test_fight::{PLAYER_FLAGS, fight, heal_event, unit}; #[test] - fn only_players_are_listed_as_player_targets() { + fn only_player_targets_get_a_shown_name() { let mut actors = Actors::new(); let priest = unit(&mut actors, "Player-1", "Ulvara-Emberfall-EU", PLAYER_FLAGS); actors.set_spec(priest, 256); @@ -265,7 +256,10 @@ mod tests { ) .unwrap(); let dto = ability_detail_dto(&fight, &detail, MetricDto::Healing); - assert_eq!(dto.player_targets, vec!["Faelan-Emberfall-EU".to_string()]); + assert_eq!( + dto.shown_names, + BTreeMap::from([("Faelan-Emberfall-EU".to_string(), "Faelan".to_string())]) + ); assert!(dto.target_names.values().any(|name| name == "Ky-Veth Ward")); } } diff --git a/crates/openlogs-service/src/meter_dto.rs b/crates/openlogs-service/src/meter_dto.rs index e7796ac..b21b36c 100644 --- a/crates/openlogs-service/src/meter_dto.rs +++ b/crates/openlogs-service/src/meter_dto.rs @@ -210,7 +210,7 @@ mod tests { ); assert_eq!( json["units"], - json!({ hunter.to_string(): "Brannoc-Emberfall-EU", wolf.to_string(): "Wolf" }) + json!({ hunter.to_string(): "Brannoc", wolf.to_string(): "Wolf" }) ); let taken = meter(&fight, &filter, MeterCategory::DamageTaken, Some(hunter)); assert_eq!( diff --git a/crates/openlogs-service/src/overview_dto.rs b/crates/openlogs-service/src/overview_dto.rs index 796ac5f..3c7488a 100644 --- a/crates/openlogs-service/src/overview_dto.rs +++ b/crates/openlogs-service/src/overview_dto.rs @@ -1,12 +1,14 @@ use std::collections::BTreeMap; use openlogs_analysis::{ - ActorId, ContextItem, ContextState, Death, DeathContext, Fight, Hit, NO_SPELL, NOBODY, - PhaseKind, QuickOverview, SpellId, listed_player, + ActorId, ContextItem, ContextState, Death, DeathContext, Fight, Hit, NO_SPELL, PhaseKind, + QuickOverview, SpellId, listed_player, }; use openlogs_gamedata::{ConsumableKind, CooldownCategory, Curated, Role}; use serde::Serialize; +use crate::refs::name_of; + #[derive(Debug, Clone, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct QuickOverviewDto { @@ -265,11 +267,6 @@ fn note_spell( spells.entry(id).or_insert(SpellRef { name }); } -fn actor_name(fight: &Fight, id: ActorId) -> String { - let actor = fight.actors.get(id); - actor.name.clone().unwrap_or_else(|| actor.guid.clone()) -} - /// The death context without absorb shields: the overview's death list and the player page's /// death sentence do not show rotational shields; only the death recap lists them. pub(crate) fn without_shields(curated: &Curated, context: &[DeathContext]) -> Vec { @@ -359,7 +356,7 @@ pub(crate) fn hit_dto( HitDto { t: hit.t, spell_id: hit.spell, - source_name: (hit.source != NOBODY).then(|| actor_name(fight, hit.source)), + source_name: name_of(fight, hit.source), amount: hit.amount, overkill: hit.overkill, environmental: hit.environmental, @@ -391,7 +388,7 @@ pub fn death_dto( let context = context_dtos(fight, curated, context, spells); DeathDto { player: death.player, - player_name: actor_name(fight, death.player), + player_name: name_of(fight, death.player).unwrap_or_default(), t: death.t, killing_blow, damage_last_5s, @@ -574,7 +571,7 @@ pub fn player_ref(fight: &Fight, id: ActorId) -> PlayerRef { let class = actor.class().and_then(openlogs_gamedata::class); PlayerRef { actor_id: id, - name: actor.name.clone().unwrap_or_else(|| actor.guid.clone()), + name: name_of(fight, id).unwrap_or_default(), spec_id: actor.spec_id, spec_name: crate::player_dto::spec_name(fight, id), spec_icon: spec.map(|s| s.icon.to_string()), @@ -586,7 +583,9 @@ pub fn player_ref(fight: &Fight, id: ActorId) -> PlayerRef { #[cfg(test)] mod tests { - use openlogs_analysis::{Actors, Attribution, Event, EventKind, ReportFilter, SpellInfo}; + use openlogs_analysis::{ + Actors, Attribution, Event, EventKind, NOBODY, ReportFilter, SpellInfo, + }; use super::*; use crate::test_fight::{PLAYER_FLAGS, fight, unit}; diff --git a/crates/openlogs-service/src/player_dto.rs b/crates/openlogs-service/src/player_dto.rs index b4d3e81..20d3d6c 100644 --- a/crates/openlogs-service/src/player_dto.rs +++ b/crates/openlogs-service/src/player_dto.rs @@ -10,6 +10,7 @@ use serde::{Deserialize, Serialize}; use crate::overview_dto::{ ContextDto, HitDto, PlayerRef, SpellRef, context_dtos, player_ref, without_shields, }; +use crate::refs::shown_name; use crate::report_dto::{ AbilityRowDto, AttributionDto, BuffShareDto, Names, PlayerAmount, TakenSpellDto, TargetShareDto, }; @@ -314,9 +315,7 @@ pub fn player_detail_dto( killing_blow: death.killing_blow.map(|hit| HitDto { t: hit.t, spell_id: names.spell(hit.spell), - source_name: (hit.source != NOBODY) - .then(|| fight.actors.get(hit.source).name.clone()) - .flatten(), + source_name: shown_name(fight, hit.source), amount: hit.amount, overkill: hit.overkill, environmental: hit.environmental, diff --git a/crates/openlogs-service/src/recap_dto.rs b/crates/openlogs-service/src/recap_dto.rs index 72891a1..19b6f1a 100644 --- a/crates/openlogs-service/src/recap_dto.rs +++ b/crates/openlogs-service/src/recap_dto.rs @@ -413,7 +413,7 @@ mod tests { serde_json::Value::Null ); assert_eq!(death["events"][1]["sourceName"], "Stormstream Totem"); - assert_eq!(death["events"][1]["sourceOwnerName"], "Mulgar-Emberfall-EU"); + assert_eq!(death["events"][1]["sourceOwnerName"], "Mulgar"); assert_eq!( death["lethalBurst"], serde_json::json!({ "spellId": 1302982, "count": 2, "windowMs": 1009 }) diff --git a/crates/openlogs-service/src/refs.rs b/crates/openlogs-service/src/refs.rs index 1c6d1f1..c177df8 100644 --- a/crates/openlogs-service/src/refs.rs +++ b/crates/openlogs-service/src/refs.rs @@ -1,6 +1,7 @@ use std::collections::BTreeMap; -use openlogs_analysis::{ActorId, Fight, NOBODY, SpellId}; +use openlogs_analysis::{ActorId, ActorKind, Fight, NOBODY, SpellId}; +use openlogs_index::GameFlavor; use crate::overview_dto::{PlayerRef, SpellRef, player_ref}; @@ -39,9 +40,58 @@ impl Refs { } } +/// The name the UI shows for a unit's `logged` name: a player's as its game shows it, any other +/// unit's as logged. +pub(crate) fn shown(fight: &Fight, id: ActorId, logged: &str) -> String { + if fight.actors.get(id).kind == ActorKind::Player { + GameFlavor::player_name(fight.flavor, logged) + } else { + logged.to_owned() + } +} + +/// The shown name; `None` when the log named nobody or a unit without a name. +pub(crate) fn shown_name(fight: &Fight, id: ActorId) -> Option { + if id == NOBODY { + return None; + } + let logged = fight.actors.get(id).name.as_deref()?; + Some(shown(fight, id, logged)) +} + +/// The logged name, or the GUID of a unit without a name. +pub(crate) fn logged_name(fight: &Fight, id: ActorId) -> &str { + let actor = fight.actors.get(id); + actor.name.as_deref().unwrap_or(&actor.guid) +} + +/// The shown name, or the shown GUID of a unit without a name; `None` for nobody. pub(crate) fn name_of(fight: &Fight, id: ActorId) -> Option { - (id != NOBODY).then(|| { - let actor = fight.actors.get(id); - actor.name.clone().unwrap_or_else(|| actor.guid.clone()) - }) + (id != NOBODY).then(|| shown(fight, id, logged_name(fight, id))) +} + +#[cfg(test)] +mod tests { + use openlogs_analysis::Actors; + + use super::*; + use crate::test_fight::{PLAYER_FLAGS, fight, unit}; + + #[test] + fn players_are_shown_by_their_game_and_other_units_as_logged() { + let mut actors = Actors::new(); + let ravel = unit( + &mut actors, + "Player-1", + "Ravel-Ashwood-Normal-EU", + PLAYER_FLAGS, + ); + let ward = unit(&mut actors, "Creature-0-1-1-1-9-01", "Ky-Veth Ward", 0xa18); + let mut fight = fight(actors, Vec::new()); + fight.flavor = Some(GameFlavor::Forever); + + assert_eq!(player_ref(&fight, ravel).name, "Ravel Ashwood"); + assert_eq!(name_of(&fight, ravel).as_deref(), Some("Ravel Ashwood")); + assert_eq!(name_of(&fight, ward).as_deref(), Some("Ky-Veth Ward")); + } } diff --git a/crates/openlogs-service/src/replay_dto.rs b/crates/openlogs-service/src/replay_dto.rs index e688e91..9ad18c2 100644 --- a/crates/openlogs-service/src/replay_dto.rs +++ b/crates/openlogs-service/src/replay_dto.rs @@ -10,7 +10,7 @@ use openlogs_index::MapBounds; use serde::Serialize; use crate::overview_dto::{PhaseDto, PhaseKindDto, PlayerRef, SpellRef}; -use crate::refs::Refs; +use crate::refs::{Refs, shown}; #[derive(Debug, Clone, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] @@ -272,7 +272,7 @@ pub fn replay_dto(fight: &Fight, replay: &Replay, advanced_logging: bool) -> Rep duration_ms: replay.duration_ms, roster, spells, - units: replay.units.iter().map(unit_dto).collect(), + units: replay.units.iter().map(|u| unit_dto(fight, u)).collect(), tracks: replay.tracks.iter().map(track_dto).collect(), health: replay.health.iter().map(health_dto).collect(), power: replay @@ -340,10 +340,10 @@ pub fn replay_dto(fight: &Fight, replay: &Replay, advanced_logging: bool) -> Rep } } -fn unit_dto(unit: &ReplayUnit) -> ReplayUnitDto { +fn unit_dto(fight: &Fight, unit: &ReplayUnit) -> ReplayUnitDto { ReplayUnitDto { actor: unit.actor, - name: unit.name.clone(), + name: shown(fight, unit.actor, &unit.name), kind: match unit.kind { UnitKind::Player => UnitKindDto::Player, UnitKind::Pet => UnitKindDto::Pet, @@ -591,7 +591,16 @@ mod tests { assert_eq!(json["advancedLogging"], true); assert_eq!(json["encounterId"], 3492); - assert_eq!(json["roster"][0]["name"], "Faelan-Emberfall-EU"); + assert_eq!(json["roster"][0]["name"], "Faelan"); + let unit_name = |actor: ActorId| { + dto.units + .iter() + .find(|u| u.actor == actor) + .unwrap() + .name + .clone() + }; + assert_eq!(unit_name(mage), "Faelan"); assert_eq!(json["spells"]["44425"]["name"], "Arcane Barrage"); assert_eq!(json["casts"][0]["spellId"], 44425); assert_eq!( diff --git a/crates/openlogs-service/src/scope_dto.rs b/crates/openlogs-service/src/scope_dto.rs index 2f884f5..5d2f106 100644 --- a/crates/openlogs-service/src/scope_dto.rs +++ b/crates/openlogs-service/src/scope_dto.rs @@ -3,10 +3,10 @@ use openlogs_analysis::{ FilterOption, MissType, Misses, OptionValue, RowKey, Scope, ScopeMetric, Side, SpellId, UnitRef, }; -use openlogs_index::GameFlavor; use serde::{Deserialize, Serialize}; use crate::overview_dto::{PlayerRef, player_ref}; +use crate::refs::shown_name; #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] @@ -407,16 +407,7 @@ fn instance_number(fight: &Fight, id: ActorId) -> u32 { pub(crate) fn unit_name(fight: &Fight, unit: &UnitRef) -> (String, Option) { match unit { - UnitRef::Player(id) => ( - fight - .actors - .get(*id) - .name - .as_deref() - .map(|name| GameFlavor::player_name(fight.flavor, name)) - .unwrap_or_default(), - None, - ), + UnitRef::Player(id) => (shown_name(fight, *id).unwrap_or_default(), None), UnitRef::Pet { name, .. } | UnitRef::Unit(name) => (name.clone(), None), UnitRef::Instance(id) => ( fight.actors.get(*id).name.clone().unwrap_or_default(), diff --git a/crates/openlogs-wasm/tests/engine.rs b/crates/openlogs-wasm/tests/engine.rs index 3648986..0ba296d 100644 --- a/crates/openlogs-wasm/tests/engine.rs +++ b/crates/openlogs-wasm/tests/engine.rs @@ -6,9 +6,9 @@ use serde_json::{Value, json}; const FIXTURE: &str = include_str!("../../openlogs-index/tests/fixtures/mini_raid.txt"); /// A synthetic +12 in the real line format. const MYTHIC_PLUS: &str = include_str!("../../openlogs-index/tests/fixtures/mythic_plus.txt"); -const FAELAN: &str = "Faelan-Emberfall-EU"; +const FAELAN: &str = "Faelan"; /// In pull 1 only. -const PYRRIN: &str = "Pyrrin-Emberfall-EU"; +const PYRRIN: &str = "Pyrrin"; fn whole_pull() -> Value { json!({ "startMs": null, "endMs": null, "attribution": "augmented", "includeOverkill": false }) @@ -896,8 +896,8 @@ fn a_run_opens_like_a_pull_with_boss_phases_and_no_boss_hp() { ); } -/// The class each player of the open-world log's combat pull takes from their casts. -fn classes_from_casts(engine: Engine, log: &str) -> (Value, Value) { +/// The class each named player of the open-world log's combat pull takes from their casts. +fn classes_from_casts(engine: Engine, log: &str, [ravel, brakk]: [&str; 2]) -> (Value, Value) { let (mut engine, view) = open_with(engine, log); let pull = view["fights"] .as_array() @@ -922,10 +922,7 @@ fn classes_from_casts(engine: Engine, log: &str) -> (Value, Value) { .unwrap()["classId"] .clone() }; - ( - class_of("Ravel-Ashwood-Normal-EU"), - class_of("Brakk-Thornfield-Normal-EU"), - ) + (class_of(ravel), class_of(brakk)) } #[test] @@ -947,11 +944,19 @@ fn a_log_reads_the_spell_classes_of_its_own_game() { }; assert_eq!( - classes_from_casts(engine(warrior_and_rogue, rogue_and_warrior), FOREVER), + classes_from_casts( + engine(warrior_and_rogue, rogue_and_warrior), + FOREVER, + ["Ravel Ashwood", "Brakk Thornfield"] + ), (json!(4), json!(1)) ); assert_eq!( - classes_from_casts(engine(rogue_and_warrior, warrior_and_rogue), &retail), + classes_from_casts( + engine(rogue_and_warrior, warrior_and_rogue), + &retail, + ["Ravel", "Brakk"] + ), (json!(4), json!(1)) ); } @@ -992,7 +997,7 @@ fn a_forever_player_shows_the_tree_of_their_talents() { .as_array() .unwrap() .iter() - .find(|p| p["name"] == "Ravel-Ashwood-Normal-EU") + .find(|p| p["name"] == "Ravel Ashwood") .unwrap(); assert_eq!( @@ -1049,8 +1054,8 @@ fn players_without_a_spec_take_the_class_of_their_casts() { let set = feed_set(&mut engine, OPEN_WORLD, &[pull], set_damage()).remove(0); for report in [single, set] { - assert_eq!(class_of(&report, "Ravel-Ashwood-Normal-EU"), 4); - assert_eq!(class_of(&report, "Brakk-Thornfield-Normal-EU"), 1); + assert_eq!(class_of(&report, "Ravel Ashwood"), 4); + assert_eq!(class_of(&report, "Brakk Thornfield"), 1); } } diff --git a/ui/src/api/types.ts b/ui/src/api/types.ts index cc79d68..fcf6500 100644 --- a/ui/src/api/types.ts +++ b/ui/src/api/types.ts @@ -739,8 +739,8 @@ export interface AbilityDetail { dead: [number, number][]; /** Unit names by actor id (JSON keys are strings). */ targetNames: Record; - /** Names in `targetNames` that belong to players; only these drop their realm in the UI. */ - playerTargets: string[]; + /** The shown name of each player in `targetNames`; other units are shown as logged. */ + shownNames: Record; } export interface UnitLife { diff --git a/ui/src/components/ability/AbilityDetailView.tsx b/ui/src/components/ability/AbilityDetailView.tsx index ebd6deb..78edbb2 100644 --- a/ui/src/components/ability/AbilityDetailView.tsx +++ b/ui/src/components/ability/AbilityDetailView.tsx @@ -10,7 +10,7 @@ import { PageFilter } from '../detail/PageFilter'; import { TimeAxis } from '../detail/TimeAxis'; import { GameIcon } from '../GameIcon'; import { Kpi, KpiStrip } from '../Kpi'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import { band } from '../player/chartGeometry'; import { abilityTraits, directHitsPerCast } from './abilityTraits'; import { hitHistogram, schoolName } from './hitHistogram'; @@ -25,13 +25,11 @@ export function AbilityDetailView({ detail }: { detail: AbilityDetail }) { const [target, setTarget] = useState(null); const titleRef = useRef(null); useFocusRequest('page', () => titleRef.current); - const name = shortName(detail.player.name); + const name = detail.player.name; // Melee swings have no spell entry in the log. const title = detail.spellName || (detail.spellId === 0 ? t('overview.melee') : t('overview.unknownSpell', { id: detail.spellId })); const healing = detail.metric === 'healing'; - // Only player names carry a realm suffix; NPC names may contain hyphens of their own. - const players = new Set(detail.playerTargets); - const display = (unit: string) => (players.has(unit) ? shortName(unit) : unit); + const display = (unit: string) => detail.shownNames[unit] ?? unit; const rawTarget = (hit: AbilityHit) => detail.targetNames[String(hit.target)] ?? '?'; const targetName = (hit: AbilityHit) => display(rawTarget(hit)); const visible = detail.hits.filter((h) => (!critsOnly || h.critical) && (target === null || rawTarget(h) === target)); diff --git a/ui/src/components/auras/AurasTab.tsx b/ui/src/components/auras/AurasTab.tsx index 725fa6a..8244c37 100644 --- a/ui/src/components/auras/AurasTab.tsx +++ b/ui/src/components/auras/AurasTab.tsx @@ -10,7 +10,7 @@ import { GameIcon, MonogramTile } from '../GameIcon'; import { rowValue } from '../filters/labels'; import { NoMatch } from '../filters/NoMatch'; import { ReportHead } from '../filters/ReportHead'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import { band, intervalList } from '../player/chartGeometry'; import { PlayerIcon } from '../reports/PlayerName'; import { reportSpellName, rosterIndex } from '../reports/reportData'; @@ -41,7 +41,7 @@ export function AurasTab({ report }: { report: AurasReport | SetAuras }) { const seams = isSetReport(report) ? report.pulls : null; const roster = rosterIndex(report.roster); const spellName = (id: number) => reportSpellName(report.spells, id); - const holderName = (holder: AuraHolder) => (holder.player !== null ? shortName(roster.get(holder.player)?.name ?? holder.name) : holder.name); + const holderName = (holder: AuraHolder) => (holder.player !== null ? (roster.get(holder.player)?.name ?? holder.name) : holder.name); const rowName = (row: AuraRow) => (row.holder ? holderName(row.holder) : spellName(row.spellId)); const byTarget = report.group === 'target'; // A holder row's uptime would mix different auras, so by target it is neither shown nor sorted by. @@ -240,7 +240,7 @@ function AuraLanes(props: { <> - {shortName(player.name)} + {player.name} ) : ( diff --git a/ui/src/components/casts/CastsTab.tsx b/ui/src/components/casts/CastsTab.tsx index 86e314b..eede4e6 100644 --- a/ui/src/components/casts/CastsTab.tsx +++ b/ui/src/components/casts/CastsTab.tsx @@ -8,7 +8,7 @@ import { GameIcon, MonogramTile } from '../GameIcon'; import { rowLabel, rowValue, valueLabel } from '../filters/labels'; import { NoMatch } from '../filters/NoMatch'; import { ReportHead } from '../filters/ReportHead'; -import { classColor, playerIndex, shortName } from '../overview/players'; +import { classColor, playerIndex } from '../overview/players'; import { PlayerIcon } from '../reports/PlayerName'; import { barWidth, rosterIndex } from '../reports/reportData'; import { SideActions } from '../reports/ReportParts'; @@ -78,7 +78,7 @@ export function CastsTab({ report }: { report: CastsReport }) { const linesOf = (player: number) => extras.filter((e) => e.player === player).map(extraLine); const selected = breakdown.rows.find((r) => keyOf(r) === selectedKey) ?? breakdown.rows[0]; const split = (row: GroupedRow | undefined, dimension: 'source' | 'ability') => row?.splits.find((s) => s.dimension === dimension)?.rows; - const nameOf = (player: number) => shortName(roster.get(player)?.name ?? t('report.unknownPlayer')); + const nameOf = (player: number) => roster.get(player)?.name ?? t('report.unknownPlayer'); const friendly = scope.perspective === 'friendly'; const caption = t(friendly ? 'report.player' : 'scope.source'); const noteKey = inSet ? 'casts.noteSet' : range ? 'casts.noteRange' : cutDeath !== null ? 'casts.noteCut' : 'casts.note'; diff --git a/ui/src/components/chrome/crumbs.ts b/ui/src/components/chrome/crumbs.ts index 123171f..667bd81 100644 --- a/ui/src/components/chrome/crumbs.ts +++ b/ui/src/components/chrome/crumbs.ts @@ -3,7 +3,7 @@ import { formatDuration } from '../../i18n/format'; import { t } from '../../i18n/i18n'; import { combatName, isCombatPull, moreEnemies, pullNumber, pullStatus, runBadge, runStatus } from '../../pulls/groupPulls'; import type { FightTab, ReportData } from '../../store'; -import { playerIndex, shortName, spellName } from '../overview/players'; +import { playerIndex, spellName } from '../overview/players'; import { setIdentity } from './fightMeta'; import { tabLabel } from './fightTabs'; @@ -56,7 +56,7 @@ function detailLevels(details: Detail[], overview: QuickOverview | null, report: const playerName = (id: number) => { const loaded = report?.tab === 'player' && report.data.player.actorId === id ? report.data.player.name : null; const name = roster.get(id)?.name ?? loaded; - return name === null ? t('report.unknownPlayer') : shortName(name); + return name === null ? t('report.unknownPlayer') : name; }; return details.flatMap((detail, depth): Level[] => { const action: CrumbAction = { kind: 'detail', depth }; diff --git a/ui/src/components/chrome/headerTiles.ts b/ui/src/components/chrome/headerTiles.ts index 0ba211c..0009a87 100644 --- a/ui/src/components/chrome/headerTiles.ts +++ b/ui/src/components/chrome/headerTiles.ts @@ -20,7 +20,6 @@ import { rowLabel, valueLabel } from '../filters/labels'; import { deathWindowMs, medianMs } from '../deaths/set/lifetimeModel'; import { kickTotals } from '../interrupts/kickTotals'; import type { KpiTone } from '../Kpi'; -import { shortName } from '../overview/players'; import { type PullFirst, type SetRow, averageFirstDeath, bestPull, earliestOfPulls, pullFirstDeaths } from '../overview/setOverviewModel'; import { formatCapTime, powerName } from '../resources/powerNames'; import { overhealShare } from '../reports/overheal'; @@ -180,7 +179,7 @@ const share = (part: number, whole: number) => formatShare(whole > 0 ? (part / w function playerName(roster: { actorId: number; name: string }[], id: number): string { const player = roster.find((p) => p.actorId === id); - return player ? shortName(player.name) : t('report.unknownPlayer'); + return player?.name ?? t('report.unknownPlayer'); } function damageTiles(report: ReportOf['damage'] | null): HeaderTile[] { diff --git a/ui/src/components/compare/CompareDeaths.tsx b/ui/src/components/compare/CompareDeaths.tsx index b60583e..c230707 100644 --- a/ui/src/components/compare/CompareDeaths.tsx +++ b/ui/src/components/compare/CompareDeaths.tsx @@ -2,7 +2,7 @@ import type { DeathEntry, PullComparison, QuickOverview } from '../../api/types' import { formatEventTime } from '../../i18n/format'; import { t } from '../../i18n/i18n'; import { GameIcon } from '../GameIcon'; -import { classColor, playerIndex, shortName, spellName } from '../overview/players'; +import { classColor, playerIndex, spellName } from '../overview/players'; import { hitIcon, hitName, sourceLabel } from '../reports/reportData'; /** Every death of both pulls in time order: time, player, killing blow. */ @@ -52,7 +52,7 @@ function DeathLine({ death, overview, color }: { death: DeathEntry; overview: Qu
  • {formatEventTime(death.t)} - {shortName(death.playerName)} + {death.playerName} {kb ? ( diff --git a/ui/src/components/deaths/DeathList.tsx b/ui/src/components/deaths/DeathList.tsx index 216d886..4203f3a 100644 --- a/ui/src/components/deaths/DeathList.tsx +++ b/ui/src/components/deaths/DeathList.tsx @@ -7,7 +7,7 @@ import { pullCutDeath, replaySplitShown, useApp } from '../../store'; import { GameIcon, MonogramTile } from '../GameIcon'; import { NoMatch } from '../filters/NoMatch'; import { ReportHead } from '../filters/ReportHead'; -import { classColor, playerIndex, shortName } from '../overview/players'; +import { classColor, playerIndex } from '../overview/players'; import { hitIcon, hitName, reportSpellName, rosterIndex } from '../reports/reportData'; import { deathJumpMs } from '../replay/playback'; import { PullHead } from '../set/PullHead'; @@ -68,7 +68,7 @@ export function DeathList({ report, groups }: { report: DeathsReport; groups: De const one = scope.target.length === 1 ? scope.target[0] : null; const onePlayer = one?.kind === 'player' ? roster.get(one.actorId) : undefined; - const title = onePlayer ? t('deaths.of', { name: shortName(onePlayer.name) }) : t('recap.all', { count }); + const title = onePlayer ? t('deaths.of', { name: onePlayer.name }) : t('recap.all', { count }); // A set's filter pickers sit on its first panel. const head = (id: string, text: string) => inSet ? ( @@ -95,7 +95,7 @@ export function DeathList({ report, groups }: { report: DeathsReport; groups: De [scope.ability.length === 0 && hitName(kb, spellName), scope.source.length === 0 && hitSource(kb)].filter(Boolean).join(' · '); const item = (entry: ListedDeath) => { const { group, death } = entry; - const name = shortName(death.playerName); + const name = death.playerName; const kb = death.killingBlow; const blow = kb ? hitName(kb, spellName) : ''; const on = keyOf(entry) === selectedKey; diff --git a/ui/src/components/deaths/DeathRecapView.tsx b/ui/src/components/deaths/DeathRecapView.tsx index 4877174..c4078d7 100644 --- a/ui/src/components/deaths/DeathRecapView.tsx +++ b/ui/src/components/deaths/DeathRecapView.tsx @@ -3,7 +3,6 @@ import { spellIcon } from '../../icons'; import { t } from '../../i18n/i18n'; import type { PullView } from '../../pulls/groupPulls'; import { GameIcon } from '../GameIcon'; -import { shortName } from '../overview/players'; import { hitIcon, reportSpellName } from '../reports/reportData'; import { RecapPanel } from './RecapPanel'; import { contextRows, recapRows, type ContextRow } from './recapModel'; @@ -23,7 +22,7 @@ export function DeathRecapView({ recap, report, pull = null }: { recap: DeathRec

    {events}

    - {t('recap.eventsOn', { name: shortName(recap.playerName) })} + {t('recap.eventsOn', { name: recap.playerName })} {rows.length === 0 ? (

    {t('recap.noEvents')}

    diff --git a/ui/src/components/deaths/DeathsTab.test.tsx b/ui/src/components/deaths/DeathsTab.test.tsx index bb815f8..b90d692 100644 --- a/ui/src/components/deaths/DeathsTab.test.tsx +++ b/ui/src/components/deaths/DeathsTab.test.tsx @@ -13,7 +13,7 @@ const faelan = recapFixture.deaths[0]; const sabrel: DeathRecap = { ...faelan, player: 7, - playerName: 'Sabrel-Emberfall-EU', + playerName: 'Sabrel', t: 419_080, number: 5, specName: 'Windwalker Monk', @@ -29,7 +29,7 @@ const report: DeathsReport = { ...recapFixture, roster: [ ...recapFixture.roster, - { actorId: 7, name: 'Sabrel-Emberfall-EU', specId: 269, specIcon: 'spell_monk_windwalker_spec', specName: 'Windwalker Monk', classId: 10, classToken: 'MONK', role: 'damage' }, + { actorId: 7, name: 'Sabrel', specId: 269, specIcon: 'spell_monk_windwalker_spec', specName: 'Windwalker Monk', classId: 10, classToken: 'MONK', role: 'damage' }, ], deaths: [faelan, sabrel], }; @@ -64,7 +64,7 @@ describe('DeathsTab', () => { it('lists enemy kills with their killing blow, killer and time alive', () => { useApp.setState({ filters: { ...initialState().filters, perspective: 'enemy' } }); const rawling: ReportUnit = { unit: { kind: 'instance', actorId: 9 }, name: 'Blightscale Rawling', number: 7 }; - const kill = { t: 61_000, unit: rawling, killingBlow: { ...faelan.killingBlow!, sourceName: 'Faelan-Emberfall-EU' }, killer: { unit: { kind: 'player' as const, actorId: 4 }, name: 'Faelan', number: null }, aliveMs: 12_000 }; + const kill = { t: 61_000, unit: rawling, killingBlow: { ...faelan.killingBlow!, sourceName: 'Faelan' }, killer: { unit: { kind: 'player' as const, actorId: 4 }, name: 'Faelan', number: null }, aliveMs: 12_000 }; render(); const rows = within(screen.getByRole('table', { name: 'Kills · 1' })).getAllByRole('row'); expect(rows[1]).toHaveTextContent('1:01Blightscale Rawling #7Virulent SpitFaelan0:12'); diff --git a/ui/src/components/deaths/RecapPanel.tsx b/ui/src/components/deaths/RecapPanel.tsx index ea99104..565fad6 100644 --- a/ui/src/components/deaths/RecapPanel.tsx +++ b/ui/src/components/deaths/RecapPanel.tsx @@ -7,7 +7,7 @@ import { t } from '../../i18n/i18n'; import type { PullView } from '../../pulls/groupPulls'; import { replayOffered, useApp } from '../../store'; import { GameIcon, MonogramTile } from '../GameIcon'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import { hitIcon, hitName, reportSpellName, rosterIndex } from '../reports/reportData'; import { deathJumpMs } from '../replay/playback'; import { hitSource, recapCallout, recapPlot } from './recapModel'; @@ -22,7 +22,7 @@ export function RecapPanel({ recap, report, pull = null }: { recap: DeathRecap; const spellName = (id: number) => reportSpellName(report.spells, id); const roster = rosterIndex(report.roster); const player = roster.get(recap.player); - const name = shortName(recap.playerName); + const name = recap.playerName; const colour = classColor(player?.classToken ?? null); const kb = recap.killingBlow; const rezzer = recap.resurrectedBy?.source != null ? roster.get(recap.resurrectedBy.source) : undefined; @@ -35,7 +35,7 @@ export function RecapPanel({ recap, report, pull = null }: { recap: DeathRecap; recap.resurrectedAt === null ? null : rezzer - ? t('recap.resurrectedBy', { time: formatEventTime(recap.resurrectedAt), name: shortName(rezzer.name) }) + ? t('recap.resurrectedBy', { time: formatEventTime(recap.resurrectedAt), name: rezzer.name }) : t('recap.resurrected', { time: formatEventTime(recap.resurrectedAt) }); return ( diff --git a/ui/src/components/deaths/recapModel.test.ts b/ui/src/components/deaths/recapModel.test.ts index 650a196..f55bd5b 100644 --- a/ui/src/components/deaths/recapModel.test.ts +++ b/ui/src/components/deaths/recapModel.test.ts @@ -55,9 +55,9 @@ describe('recapCallout', () => { describe('eventSource', () => { it('names the owner of a totem or pet and drops the realm of players', () => { - expect(eventSource(event({ sourceName: 'Stormstream Totem', sourceOwnerName: 'Mulgar-Emberfall-EU' }))).toBe('Mulgar (Totem)'); - expect(eventSource(event({ sourceName: 'Fel Imp', sourceOwnerName: 'Årvel-Emberfall-EU' }))).toBe('Årvel (Pet)'); - expect(eventSource(event({ sourceName: 'Tyrell-Highmarch-EU' }))).toBe('Tyrell'); + expect(eventSource(event({ sourceName: 'Stormstream Totem', sourceOwnerName: 'Mulgar' }))).toBe('Mulgar (Totem)'); + expect(eventSource(event({ sourceName: 'Fel Imp', sourceOwnerName: 'Årvel' }))).toBe('Årvel (Pet)'); + expect(eventSource(event({ sourceName: 'Tyrell' }))).toBe('Tyrell'); }); }); diff --git a/ui/src/components/deaths/recapModel.ts b/ui/src/components/deaths/recapModel.ts index 1f90899..8d684b6 100644 --- a/ui/src/components/deaths/recapModel.ts +++ b/ui/src/components/deaths/recapModel.ts @@ -11,7 +11,7 @@ import { } from '../../i18n/format'; import { locale, t } from '../../i18n/i18n'; import type { MessageKey } from '../../i18n/i18n'; -import { shortName, usedAtLabel } from '../overview/players'; +import { usedAtLabel } from '../overview/players'; import { hitName } from '../reports/reportData'; /** HP curve and event window before a death (matches the backend). */ @@ -169,7 +169,7 @@ export function recapCallout(recap: DeathRecap, spellName: (id: number) => strin /** Who dealt a hit: its source (a player without the realm), else world damage, a debuff whose caster is gone, or unknown. */ export function hitSource(hit: { sourceName: string | null; environmental: boolean; periodic: boolean }): string { - if (hit.sourceName) return shortName(hit.sourceName); + if (hit.sourceName) return hit.sourceName; if (hit.environmental) return t('deaths.environment'); return t(hit.periodic ? 'recap.debuffSource' : 'deaths.unknownSource'); } @@ -178,9 +178,9 @@ export function hitSource(hit: { sourceName: string | null; environmental: boole export function eventSource(e: RecapEvent): string { if (e.sourceOwnerName) { const kind = /totem/i.test(e.sourceName ?? '') ? t('recap.totem') : t('recap.pet'); - return t('recap.ownedSource', { owner: shortName(e.sourceOwnerName), kind }); + return t('recap.ownedSource', { owner: e.sourceOwnerName, kind }); } - return e.sourceName ? shortName(e.sourceName) : hitSource(e); + return e.sourceName || hitSource(e); } export interface RecapRow { diff --git a/ui/src/components/deaths/set/DeathWindowChart.tsx b/ui/src/components/deaths/set/DeathWindowChart.tsx index 16c7253..0f8d658 100644 --- a/ui/src/components/deaths/set/DeathWindowChart.tsx +++ b/ui/src/components/deaths/set/DeathWindowChart.tsx @@ -5,7 +5,7 @@ import { type MessageKey, t } from '../../../i18n/i18n'; import type { PullView } from '../../../pulls/groupPulls'; import { useApp } from '../../../store'; import { ReportHead } from '../../filters/ReportHead'; -import { classColor, shortName } from '../../overview/players'; +import { classColor } from '../../overview/players'; import { hitName, reportSpellName, rosterIndex } from '../../reports/reportData'; import { CompactPullHead, SeamRow } from '../../set/PullHead'; import { deathWindowMs, windowScaleMs, windowTicksMs } from './lifetimeModel'; @@ -79,7 +79,7 @@ export function DeathWindowChart({ parts, report, selected }: { parts: PullPart[ aria-label={t('setDeaths.bar', { n: pull.n, time: formatEventTimeTenths(death.t), - name: shortName(death.playerName), + name: death.playerName, window: formatSeconds(deathWindowMs(death)), })} aria-pressed={on} @@ -147,7 +147,7 @@ function DeathTip(props: { const blow = !kb ? t('setDeaths.diesNoBlow') : kb.sourceName - ? t('setDeaths.diesFrom', { source: shortName(kb.sourceName), spell: hitName(kb, spellName) }) + ? t('setDeaths.diesFrom', { source: kb.sourceName, spell: hitName(kb, spellName) }) : t('setDeaths.diesFromSpell', { spell: hitName(kb, spellName) }); const x = atPct(death.t, durationMs); const side = openLeft ? { right: `${100 - x + 1}%` } : { left: `${x + 1}%` }; @@ -155,7 +155,7 @@ function DeathTip(props: { diff --git a/ui/src/components/deaths/set/LifetimeMatrix.tsx b/ui/src/components/deaths/set/LifetimeMatrix.tsx index e008090..828a472 100644 --- a/ui/src/components/deaths/set/LifetimeMatrix.tsx +++ b/ui/src/components/deaths/set/LifetimeMatrix.tsx @@ -3,7 +3,6 @@ import type { SetDeaths } from '../../../api/types'; import { formatEventTimeTenths, formatPercent, formatShare } from '../../../i18n/format'; import { t } from '../../../i18n/i18n'; import { PULL_CHIP } from '../../../pulls/groupPulls'; -import { shortName } from '../../overview/players'; import { PlayerName } from '../../reports/PlayerName'; import { rosterIndex } from '../../reports/reportData'; import { LIFE_BANDS, type LifetimeCell, lifeBand, lifetimeRows, minPullOptions } from './lifetimeModel'; @@ -32,7 +31,7 @@ export function LifetimeMatrix({ parts, report }: { parts: PullPart[]; report: S const titleId = useId(); const roster = useMemo(() => rosterIndex(report.roster), [report.roster]); const rows = useMemo( - () => lifetimeRows(parts.map(({ part }) => part), (id) => shortName(roster.get(id)?.name ?? '')), + () => lifetimeRows(parts.map(({ part }) => part), (id) => roster.get(id)?.name ?? ''), [parts, roster], ); const options = minPullOptions(parts.length); diff --git a/ui/src/components/deaths/set/SetDeathsPage.test.tsx b/ui/src/components/deaths/set/SetDeathsPage.test.tsx index 05adf80..e30be4d 100644 --- a/ui/src/components/deaths/set/SetDeathsPage.test.tsx +++ b/ui/src/components/deaths/set/SetDeathsPage.test.tsx @@ -24,14 +24,14 @@ const report: SetDeaths = { ...recapFixture, roster: [ ...recapFixture.roster, - { actorId: 8, name: 'Tovric-Emberfall-EU', specId: 71, specIcon: 'ability_warrior_savageblow', specName: 'Arms Warrior', classId: 1, classToken: 'WARRIOR', role: 'damage' }, + { actorId: 8, name: 'Tovric', specId: 71, specIcon: 'ability_warrior_savageblow', specName: 'Arms Warrior', classId: 1, classToken: 'WARRIOR', role: 'damage' }, ], deaths: [], pulls: [ { fightIndex: 1, durationMs: 100_000, - deaths: [death(4, 'Faelan-Emberfall-EU', 50_000)], + deaths: [death(4, 'Faelan', 50_000)], kills: [], lifetime: [ { player: 4, firstDeathMs: 50_000 }, @@ -51,7 +51,7 @@ const report: SetDeaths = { { fightIndex: 3, durationMs: 150_000, - deaths: [death(8, 'Tovric-Emberfall-EU', 30_000), death(6, 'Serrik-Silverbrook-EU', 61_000)], + deaths: [death(8, 'Tovric', 30_000), death(6, 'Serrik', 61_000)], kills: [], lifetime: [ { player: 4, firstDeathMs: null }, @@ -84,7 +84,7 @@ describe('set deaths page', () => { it('the same death time in two pulls selects only the clicked pull', async () => { const [first, second, third] = report.pulls; - const twice = { ...report, pulls: [first, { ...second, deaths: [death(4, 'Faelan-Emberfall-EU', 50_000)] }, third] }; + const twice = { ...report, pulls: [first, { ...second, deaths: [death(4, 'Faelan', 50_000)] }, third] }; render(); const list = within(screen.getByRole('complementary', { name: /^All deaths/ })); await userEvent.click(within(list.getByRole('group', { name: 'Pull #2' })).getByRole('button', { name: /Faelan/ })); diff --git a/ui/src/components/filters/labels.ts b/ui/src/components/filters/labels.ts index 46d5fa2..65767d9 100644 --- a/ui/src/components/filters/labels.ts +++ b/ui/src/components/filters/labels.ts @@ -1,6 +1,5 @@ import type { AbilityRef, BreakdownRow, BreakdownRowKind, FilterOption, RowKey, UnitRef } from '../../api/types'; import { t } from '../../i18n/i18n'; -import { shortName } from '../overview/players'; export type ScopeValue = UnitRef | AbilityRef; @@ -32,7 +31,7 @@ export function valueLabel(value: ScopeValue, name: string, number: number | nul export const rowLabel = (row: BreakdownRow) => valueLabel(rowValue(row.key), row.name, row.number, row.key.kind === 'ability' ? row.key.rowKind : 'own'); -export const rowPet = (key: RowKey): string | null => (key.kind === 'ability' && key.pet ? shortName(key.pet) : null); +export const rowPet = (key: RowKey): string | null => (key.kind === 'ability' && key.pet ? key.pet : null); /** The label with the pets behind an ability, for where the pet name is not shown beside it. */ export function petLabel(label: string, key: RowKey): string { diff --git a/ui/src/components/filters/pickerModel.ts b/ui/src/components/filters/pickerModel.ts index 2d7c9ea..0ad1579 100644 --- a/ui/src/components/filters/pickerModel.ts +++ b/ui/src/components/filters/pickerModel.ts @@ -1,6 +1,5 @@ import type { FilterOption, PlayerRef } from '../../api/types'; import { t } from '../../i18n/i18n'; -import { shortName } from '../overview/players'; import { type ScopeValue, optionLabel, optionValue, sameValue, valueLabel } from './labels'; export interface PickerSection { @@ -68,7 +67,7 @@ export function selectionLabel(value: ScopeValue, options: FilterOption[], roste switch (value.kind) { case 'player': { const player = roster.get(value.actorId); - return player ? shortName(player.name) : t('report.unknownPlayer'); + return player?.name ?? t('report.unknownPlayer'); } case 'instance': { for (const o of options) { diff --git a/ui/src/components/overview/DeathsPanel.tsx b/ui/src/components/overview/DeathsPanel.tsx index 82b3bb7..8485d46 100644 --- a/ui/src/components/overview/DeathsPanel.tsx +++ b/ui/src/components/overview/DeathsPanel.tsx @@ -7,7 +7,7 @@ import { GameIcon } from '../GameIcon'; import { PlayerIcon } from '../reports/PlayerName'; import { hitIcon, hitName } from '../reports/reportData'; import { contextBadges, damageParts, deathSource } from './deathModel'; -import { classColor, playerIndex, shortName, spellName } from './players'; +import { classColor, playerIndex, spellName } from './players'; const MAX_ROWS = 5; @@ -59,7 +59,7 @@ export function DeathsPanel({ overview }: { overview: QuickOverview }) { function DeathRow({ n, death, player, overview }: { n: number; death: DeathEntry; player: PlayerRef | undefined; overview: QuickOverview }) { const openDeathRecap = useApp((s) => s.openDeathRecap); - const name = shortName(death.playerName); + const name = death.playerName; const kb = death.killingBlow; const kbName = kb ? hitName(kb, (id) => spellName(overview, id)) : ''; const parts = damageParts(overview, death); diff --git a/ui/src/components/overview/Timeline.tsx b/ui/src/components/overview/Timeline.tsx index b198383..24bbdf7 100644 --- a/ui/src/components/overview/Timeline.tsx +++ b/ui/src/components/overview/Timeline.tsx @@ -7,7 +7,7 @@ import { PullCutoffShade, afterCutTitle } from '../reports/CutoffShade'; import { clickToRange, fullRange, phaseInPull, rangeSpan, sameRange } from '../reports/rangeGeometry'; import { useBrush } from '../reports/useBrush'; import { useRangeKeys } from '../reports/useRangeKeys'; -import { playerIndex, shortName, spellName } from './players'; +import { playerIndex, spellName } from './players'; import { TIMELINE_VIEW_BOX, percentOf, timelineGeometry, timelineSummary } from './timelineGeometry'; /** @@ -26,7 +26,7 @@ export function Timeline({ overview, run = false }: { overview: QuickOverview; r const geometry = timelineGeometry(overview.timeline, duration); const phaseRanges = phases.map((phase) => phaseInPull(phase, end)); const players = playerIndex(overview); - const nameOf = (actorId: number) => shortName(players.get(actorId)?.name ?? ''); + const nameOf = (actorId: number) => players.get(actorId)?.name ?? ''; const plotRef = useRef(null); const hintId = useId(); diff --git a/ui/src/components/overview/players.test.ts b/ui/src/components/overview/players.test.ts deleted file mode 100644 index 48188d6..0000000 --- a/ui/src/components/overview/players.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { afterEach, describe, expect, it } from 'vitest'; -import { setCurrentLog } from '../../currentGame'; -import { shortName } from './players'; - -describe('player names', () => { - afterEach(() => setCurrentLog(null)); - - it('shows a Forever name in full and a retail name by its first part', () => { - setCurrentLog({ game: { kind: 'forever' }, dataGame: 'forever' }); - expect([shortName('Ravel-Ashwood-Normal-EU'), shortName('Wolf')]).toEqual(['Ravel Ashwood', 'Wolf']); - setCurrentLog({ game: { kind: 'retail' }, dataGame: 'retail' }); - expect(shortName('Faelan-Emberfall-EU')).toBe('Faelan'); - }); -}); diff --git a/ui/src/components/overview/players.ts b/ui/src/components/overview/players.ts index 4cd06e0..f224241 100644 --- a/ui/src/components/overview/players.ts +++ b/ui/src/components/overview/players.ts @@ -1,20 +1,9 @@ import type { PlayerRef, QuickOverview, Role } from '../../api/types'; -import { currentGame } from '../../currentGame'; import { formatEventTime } from '../../i18n/format'; import { t } from '../../i18n/i18n'; export const ROLE_ORDER: (Role | null)[] = ['tank', 'healer', 'damage', null]; -/** - * A player's name from the logged `Name-Realm-Region`: "Faelan-Emberfall-EU" → "Faelan". A Forever name - * may itself contain `-`: "Ravel-Ashwood-Normal-EU" → "Ravel Ashwood". Keep in step with the service's - * `GameFlavor::player_name`. - */ -export function shortName(name: string): string { - const parts = name.split('-'); - return currentGame()?.kind === 'forever' && parts.length > 2 ? parts.slice(0, -2).join(' ') : parts[0]; -} - export function classColor(token: string | null): string { return token ? `var(--class-${token.toLowerCase()})` : 'var(--text)'; } @@ -43,6 +32,6 @@ export function usedAtLabel(ms: number): string { */ export function sortedRoster(overview: QuickOverview): PlayerRef[] { return [...overview.players].sort( - (a, b) => ROLE_ORDER.indexOf(a.role) - ROLE_ORDER.indexOf(b.role) || shortName(a.name).localeCompare(shortName(b.name)), + (a, b) => ROLE_ORDER.indexOf(a.role) - ROLE_ORDER.indexOf(b.role) || a.name.localeCompare(b.name), ); } diff --git a/ui/src/components/player/CastsAndBuffs.tsx b/ui/src/components/player/CastsAndBuffs.tsx index 39a291a..7b67fe4 100644 --- a/ui/src/components/player/CastsAndBuffs.tsx +++ b/ui/src/components/player/CastsAndBuffs.tsx @@ -6,7 +6,7 @@ import { t } from '../../i18n/i18n'; import { useApp } from '../../store'; import { TimeAxis } from '../detail/TimeAxis'; import { GameIcon } from '../GameIcon'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import { reportSpellName, rosterIndex } from '../reports/reportData'; import { buffColor } from './buffColors'; import { band, castsCrowd, intervalList } from './chartGeometry'; @@ -140,7 +140,7 @@ export function CastsAndBuffs({ detail }: { detail: PlayerDetail }) { {name(row.spellId)} - {external && {t('player.buffFrom', { name: shortName(source?.name ?? '?') })}} + {external && {t('player.buffFrom', { name: source?.name ?? '?' })}} {dead} diff --git a/ui/src/components/player/OverTimeChart.tsx b/ui/src/components/player/OverTimeChart.tsx index 489ce9a..6cd7ff9 100644 --- a/ui/src/components/player/OverTimeChart.tsx +++ b/ui/src/components/player/OverTimeChart.tsx @@ -4,7 +4,7 @@ import { formatAmount, formatAxisAmount, formatPercent } from '../../i18n/format import { t } from '../../i18n/i18n'; import { TimeAxis } from '../detail/TimeAxis'; import { GameIcon } from '../GameIcon'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import { reportSpellName, rosterIndex } from '../reports/reportData'; import { band, intervalList, manaPath, seriesPaths } from './chartGeometry'; @@ -48,7 +48,7 @@ export function OverTimeChart({ detail }: { detail: PlayerDetail }) { const text = !rez ? t('player.dead') : caster - ? t('player.deadRezBy', { spell: name(rez.spellId), name: shortName(caster.name) }) + ? t('player.deadRezBy', { spell: name(rez.spellId), name: caster.name }) : t('player.deadRez', { spell: name(rez.spellId) }); return [{ key: death.t, leftPct: Math.round((at.leftPct + at.widthPct / 2) * 100) / 100, text }]; }); diff --git a/ui/src/components/player/PlayerAbilities.tsx b/ui/src/components/player/PlayerAbilities.tsx index d7f0ba3..841a342 100644 --- a/ui/src/components/player/PlayerAbilities.tsx +++ b/ui/src/components/player/PlayerAbilities.tsx @@ -5,7 +5,7 @@ import { formatAmountTenths, formatCount, formatShare } from '../../i18n/format' import { t } from '../../i18n/i18n'; import { useApp } from '../../store'; import { GameIcon } from '../GameIcon'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import { toneClass } from '../reports/augSplit'; import { PlayerIcon } from '../reports/PlayerName'; import { barWidth, reportSpellName, rosterIndex } from '../reports/reportData'; @@ -117,7 +117,7 @@ export function PlayerAbilities({ detail }: { detail: PlayerDetail }) {
    @@ -186,7 +186,7 @@ function partsLabel(row: PlayerAbility, name: string, hasPets: boolean, healing: const targetsOf = (name: string, healing: boolean) => t(healing ? 'targets.healedOf' : 'targets.of', { name }); function rowLabel(row: PlayerAbility, detail: PlayerDetail): string { - if (row.kind === 'pet') return t('player.petGroup', { name: shortName(row.actorName), count: row.pets }); + if (row.kind === 'pet') return t('player.petGroup', { name: row.actorName, count: row.pets }); if (row.kind === 'unmatched') return t('report.unmatchedHits'); return reportSpellName(detail.spells, row.spellId); } @@ -296,7 +296,7 @@ function AbilityLine({ row, table, onOpen, toggle, part = false }: LineProps) { ) : ( {label} )} - {part && {shortName(row.actorName)}} + {part && {row.actorName}} {row.aug && {t('player.augTag')}} {given && {t('report.supportTag')}} {own && row.ticks * 2 > row.hits && {t(healing ? 'player.hotTag' : 'player.dotTag')}} @@ -458,7 +458,7 @@ function AugPopup({ at, popup, table }: { at: PopupAnchor; popup: AbilityPopup; {buff} · - {evoker ? shortName(evoker.name) : t('report.unknownPlayer')} + {evoker?.name ?? t('report.unknownPlayer')} {formatAmountTenths(-share.amount)}
    @@ -506,7 +506,7 @@ function PartLine({ table, depth, icon, name, amount, id }: { table: Table; dept /** The supported abilities stay in the parent rowgroup (rowgroups may not nest): the disclosure controls them by row id. */ function RecipientLines({ recipient, table, idPrefix, open, onToggle }: { recipient: SupportRecipient; table: Table; idPrefix: string; open: boolean; onToggle: () => void }) { const player = table.roster.get(recipient.player); - const name = player ? shortName(player.name) : t('report.unknownPlayer'); + const name = player?.name ?? t('report.unknownPlayer'); const rowId = (i: number) => `${idPrefix}-${i}`; const toggle: Toggle = { open, onToggle, controls: recipient.abilities.map((_, i) => rowId(i)).join(' ') }; return ( @@ -535,7 +535,7 @@ function RecipientLines({ recipient, table, idPrefix, open, onToggle }: { recipi name={ <> {spell} - {ability.petName && {shortName(ability.petName)}} + {ability.petName && {ability.petName}} } amount={ability.amount} diff --git a/ui/src/components/player/PlayerHeader.tsx b/ui/src/components/player/PlayerHeader.tsx index fb1a725..57cb5c0 100644 --- a/ui/src/components/player/PlayerHeader.tsx +++ b/ui/src/components/player/PlayerHeader.tsx @@ -7,7 +7,7 @@ import { t } from '../../i18n/i18n'; import { useApp } from '../../store'; import { Facts } from '../detail/Facts'; import { GameIcon } from '../GameIcon'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; export function PlayerHeader({ detail }: { detail: PlayerDetail }) { const titleRef = useRef(null); @@ -18,7 +18,7 @@ export function PlayerHeader({ detail }: { detail: PlayerDetail }) { // Opened on top of an enemy page: go back to it instead of closing every page. const nested = useApp((s) => s.details.length > 1); const player = detail.player; - const name = shortName(player.name); + const name = player.name; const color = classColor(player.classToken); return (
    @@ -57,7 +57,7 @@ export function PlayerHeader({ detail }: { detail: PlayerDetail }) { .filter((entry) => entry.specId !== null || entry.actorId === player.actorId) .map((entry) => ( ))} diff --git a/ui/src/components/player/PlayerKpis.tsx b/ui/src/components/player/PlayerKpis.tsx index b50519f..beaf184 100644 --- a/ui/src/components/player/PlayerKpis.tsx +++ b/ui/src/components/player/PlayerKpis.tsx @@ -4,7 +4,6 @@ import { t } from '../../i18n/i18n'; import type { MessageKey } from '../../i18n/i18n'; import { useApp } from '../../store'; import { Kpi, KpiStrip } from '../Kpi'; -import { shortName } from '../overview/players'; const CONSUMABLE_LABEL: Record = { combat_potion: 'consumables.combatPotion', @@ -17,7 +16,7 @@ export function PlayerKpis({ detail }: { detail: PlayerDetail }) { const openDeathRecap = useApp((s) => s.openDeathRecap); const healing = detail.metric === 'healing'; const otherMode = t(detail.attribution === 'augmented' ? 'aug.reattributed' : 'aug.augmented'); - const names = new Map(detail.roster.map((p) => [p.actorId, shortName(p.name)])); + const names = new Map(detail.roster.map((p) => [p.actorId, p.name])); const firstDeath = detail.deaths[0]; const kinds = [...new Set(detail.consumables.map((u) => u.kind))].map((kind) => t(CONSUMABLE_LABEL[kind])); const noConsumables = detail.consumables.length === 0; diff --git a/ui/src/components/player/PlayerSidePanels.tsx b/ui/src/components/player/PlayerSidePanels.tsx index ba666fb..9d70bb8 100644 --- a/ui/src/components/player/PlayerSidePanels.tsx +++ b/ui/src/components/player/PlayerSidePanels.tsx @@ -4,7 +4,7 @@ import { formatCount, formatEventTime, formatMillions } from '../../i18n/format' import { t } from '../../i18n/i18n'; import { useApp } from '../../store'; import { GameIcon } from '../GameIcon'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import { hitIcon, hitName, reportSpellName, rosterIndex, sourceLabel } from '../reports/reportData'; import { TargetBreakdown, targetRows } from '../reports/TargetParts'; import { targetColors } from '../reports/targetGroups'; @@ -52,7 +52,7 @@ export function PlayerSidePanels({ detail, targets = true }: { detail: PlayerDet // "Survived the range." only while a time range is set; the whole pull reads "Survived.". const range = useApp((s) => s.range); const { colorOf } = targetColors(detail.metric, detail.colorGroups, roster); - const name = shortName(detail.player.name); + const name = detail.player.name; return (
    {targets && ( @@ -142,7 +142,7 @@ function DeathBlock({ detail, death, roster }: { detail: PlayerDetail; death: Pl {caster && ( <> {` ${t('player.rezBy')} `} - {shortName(caster.name)} + {caster.name} )} {' · '} diff --git a/ui/src/components/replay/AuraIcons.tsx b/ui/src/components/replay/AuraIcons.tsx index 3e96672..bfdfcb5 100644 --- a/ui/src/components/replay/AuraIcons.tsx +++ b/ui/src/components/replay/AuraIcons.tsx @@ -3,7 +3,7 @@ import { formatInteger, formatSpan } from '../../i18n/format'; import { t } from '../../i18n/i18n'; import { spellIcon } from '../../icons'; import { GameIcon } from '../GameIcon'; -import { classColor, shortName, spellName } from '../overview/players'; +import { classColor, spellName } from '../overview/players'; import { AuraTip, useAuraTip } from './AuraTip'; import { type HudIndex, unitLabel } from './hudIndex'; import { stacksAt } from './playback'; @@ -16,7 +16,7 @@ function shortRemaining(ms: number): string { function sourceOf(hud: HudIndex, aura: ReplayAura): { name: string; color?: string } | null { const player = aura.sourcePlayer === null ? undefined : hud.roster.get(aura.sourcePlayer); - if (player) return { name: shortName(player.name), color: classColor(player.classToken) }; + if (player) return { name: player.name, color: classColor(player.classToken) }; const unit = hud.units.get(aura.source); return unit ? { name: unitLabel(unit) } : null; } diff --git a/ui/src/components/replay/Meter.tsx b/ui/src/components/replay/Meter.tsx index 5a486db..fc25c14 100644 --- a/ui/src/components/replay/Meter.tsx +++ b/ui/src/components/replay/Meter.tsx @@ -5,7 +5,7 @@ import { type MessageKey, t } from '../../i18n/i18n'; import { spellIcon } from '../../icons'; import { METER_CATEGORIES, METER_WINDOWS, type MeterMode, useApp } from '../../store'; import { GameIcon, MonogramTile } from '../GameIcon'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import { PlayerIcon } from '../reports/PlayerName'; import { barWidth, hitIcon, hitName, reportSpellName } from '../reports/reportData'; import type { HudIndex } from './hudIndex'; @@ -68,7 +68,7 @@ function EntryLabel({ entry, data, hud }: { entry: MeterEntry; data: MeterData; <> - {shortName(player.name)} + {player.name} ); @@ -103,7 +103,7 @@ function EntryLabel({ entry, data, hud }: { entry: MeterEntry; data: MeterData; {name} - {pet && {shortName(pet)}} + {pet && {pet}} {entry.rowKind === 'support_given' && {t('report.supportTag')}} @@ -220,7 +220,7 @@ function MeterBody({ hud, bounds }: { hud: HudIndex; bounds: Bounds }) {
      {rows.map((row) => { const player = hud.roster.get(row.player); - const name = player ? shortName(player.name) : t('report.unknownPlayer'); + const name = player?.name ?? t('report.unknownPlayer'); const open = row.player === expand; const { value, rate } = rowValue(row, shown); const color = { '--meter-color': classColor(player?.classToken ?? null) } as CSSProperties; diff --git a/ui/src/components/replay/ReplayControls.tsx b/ui/src/components/replay/ReplayControls.tsx index 88efb77..5f669c2 100644 --- a/ui/src/components/replay/ReplayControls.tsx +++ b/ui/src/components/replay/ReplayControls.tsx @@ -3,7 +3,6 @@ import type { ReplayData } from '../../api/types'; import { formatEventTime } from '../../i18n/format'; import { type MessageKey, t } from '../../i18n/i18n'; import { type ReplayFilters, type ReplayLayers, type ReplaySpeed, type TimeRange, useApp } from '../../store'; -import { shortName } from '../overview/players'; import { phaseLabels } from '../overview/timelineGeometry'; import { CutoffShade, cutoffRest } from '../reports/CutoffShade'; import { percentIn, timeAtX } from '../views/zoomGeometry'; @@ -190,7 +189,7 @@ function ReplayScrubber({ data, bounds, limitMs, time }: { data: ReplayData; bou ))} {deaths.map((death) => { - const name = shortName(roster.get(death.actor)?.name ?? data.units.find((unit) => unit.actor === death.actor)?.name ?? ''); + const name = roster.get(death.actor)?.name ?? data.units.find((unit) => unit.actor === death.actor)?.name ?? ''; return ( [player.actorId, player])); const players = data.units .filter((unit) => unit.kind === 'player') - .map((unit) => ({ unit, player: roster.get(unit.actor), label: shortName(unit.name) })) + .map((unit) => ({ unit, player: roster.get(unit.actor), label: unit.name })) .sort((a, b) => roleRank(a.player) - roleRank(b.player) || a.label.localeCompare(b.label)) .map(({ unit, player, label }): LegendEntry => ({ key: `player-${unit.actor}`, label, kind: 'player', actors: [unit.actor], color: classColor(player?.classToken ?? null) })); const groups = new Map(); diff --git a/ui/src/components/replay/hudIndex.ts b/ui/src/components/replay/hudIndex.ts index 09a8d88..43e8ce9 100644 --- a/ui/src/components/replay/hudIndex.ts +++ b/ui/src/components/replay/hudIndex.ts @@ -1,6 +1,6 @@ import type { PlayerRef, ReplayAura, ReplayCast, ReplayData, ReplayDeath, ReplayHealthTrack, ReplayPowerTrack, ReplayRaidMarker, ReplayTargetTrack, ReplayUnit } from '../../api/types'; import { t } from '../../i18n/i18n'; -import { ROLE_ORDER, shortName } from '../overview/players'; +import { ROLE_ORDER } from '../overview/players'; import { goneAfterMs, groupBy, healthAt } from './playback'; const MAX_ADD_FRAMES = 8; @@ -46,7 +46,7 @@ export function indexHud(data: ReplayData): HudIndex { .map(({ unit }) => unit); const players = data.units .filter((unit) => unit.kind === 'player') - .sort((a, b) => roleRank(roster.get(a.actor)) - roleRank(roster.get(b.actor)) || shortName(a.name).localeCompare(shortName(b.name))); + .sort((a, b) => roleRank(roster.get(a.actor)) - roleRank(roster.get(b.actor)) || a.name.localeCompare(b.name)); return { data, units: new Map(data.units.map((unit) => [unit.actor, unit])), @@ -72,7 +72,6 @@ export function indexHud(data: ReplayData): HudIndex { /** A player's short name, an add with its number (`Clutch 3`), else the logged name. */ export function unitLabel(unit: ReplayUnit): string { - if (unit.kind === 'player') return shortName(unit.name); if (unit.kind === 'add' && unit.addNumber !== null) return t('replay.addName', { name: unit.name, number: unit.addNumber }); return unit.name; } diff --git a/ui/src/components/replay/stageDraw.ts b/ui/src/components/replay/stageDraw.ts index 163ec6c..d8278ee 100644 --- a/ui/src/components/replay/stageDraw.ts +++ b/ui/src/components/replay/stageDraw.ts @@ -4,7 +4,6 @@ import { t } from '../../i18n/i18n'; import { type IconRef, bossIcon, classIcon, specIcon } from '../../icons'; import { bossMonogram, initials } from '../../monogram'; import type { ReplayFilters, ReplayLayers } from '../../store'; -import { shortName } from '../overview/players'; import { type Bounds, type Camera, facingOnScreen, gridStep, toScreen, toWorld } from './camera'; import type { EffectState } from './effects'; import { type MapBoundsYd, type StageMap, stageMap } from './mapArt'; @@ -97,7 +96,6 @@ export function indexStage(data: ReplayData, mapArt: MapArtTable | null): StageI for (const unit of data.units) { const track = tracks.get(unit.actor); if (!track) continue; - const label = unit.kind === 'player' ? shortName(unit.name) : unit.name; units.push({ unit, track, @@ -106,9 +104,9 @@ export function indexStage(data: ReplayData, mapArt: MapArtTable | null): StageI health: health.get(unit.actor), goneAfterMs: goneAfterMs(unit.kind, track, health.get(unit.actor)), classKey: classTokens.get(unit.kind === 'pet' ? (unit.owner ?? -1) : unit.actor) ?? null, - label, + label: unit.name, icon: unitIcon(unit, data.encounterId), - monogram: unit.kind === 'boss' ? bossMonogram(label) : unit.kind === 'player' ? label.slice(0, 2) : initials(label).toUpperCase(), + monogram: unit.kind === 'boss' ? bossMonogram(unit.name) : unit.kind === 'player' ? unit.name.slice(0, 2) : initials(unit.name).toUpperCase(), }); } return { diff --git a/ui/src/components/reports/PlayerName.test.tsx b/ui/src/components/reports/PlayerName.test.tsx index 724192e..43f6156 100644 --- a/ui/src/components/reports/PlayerName.test.tsx +++ b/ui/src/components/reports/PlayerName.test.tsx @@ -5,7 +5,7 @@ import { PlayerName } from './PlayerName'; const FAELAN: PlayerRef = { actorId: 4, - name: 'Faelan-Emberfall-EU', + name: 'Faelan', specId: 62, specName: 'Arcane Mage', specIcon: 'spell_holy_magicalsentry', diff --git a/ui/src/components/reports/PlayerName.tsx b/ui/src/components/reports/PlayerName.tsx index a0c288e..db1c549 100644 --- a/ui/src/components/reports/PlayerName.tsx +++ b/ui/src/components/reports/PlayerName.tsx @@ -2,14 +2,14 @@ import type { PlayerRef } from '../../api/types'; import { classIcon, specIcon } from '../../icons'; import { t } from '../../i18n/i18n'; import { GameIcon, MonogramTile } from '../GameIcon'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; /** * A player's icon: the spec icon, the class icon when the spec is unknown, else the monogram tile of * the name. */ export function PlayerIcon({ player, size = 22 }: { player: PlayerRef | undefined; size?: number }) { - const name = player ? shortName(player.name) : t('report.unknownPlayer'); + const name = player?.name ?? t('report.unknownPlayer'); if (player?.specIcon != null) return ; if (player?.classId != null) return ; return ; @@ -18,7 +18,7 @@ export function PlayerIcon({ player, size = 22 }: { player: PlayerRef | undefine /** A player in a row: icon and the name in the class colour, with a tooltip since rows cut a long name off. */ export function PlayerName({ player, size = 22 }: { player: PlayerRef | undefined; size?: number }) { if (!player) return {t('report.unknownPlayer')}; - const name = shortName(player.name); + const name = player.name; return ( diff --git a/ui/src/components/reports/ReportParts.tsx b/ui/src/components/reports/ReportParts.tsx index 413135b..95b492f 100644 --- a/ui/src/components/reports/ReportParts.tsx +++ b/ui/src/components/reports/ReportParts.tsx @@ -3,13 +3,13 @@ import { spellIcon } from '../../icons'; import { formatScaled, formatShare } from '../../i18n/format'; import { t } from '../../i18n/i18n'; import { GameIcon } from '../GameIcon'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import type { AugMetric } from './augSplit'; import { PlayerIcon } from './PlayerName'; import { barWidth, reportSpellName, type SpellNames } from './reportData'; const classes = (...names: (string | false | null | undefined)[]) => names.filter(Boolean).join(' '); -const playerLabel = (player: PlayerRef | undefined) => (player ? shortName(player.name) : t('report.unknownPlayer')); +const playerLabel = (player: PlayerRef | undefined) => (player?.name ?? t('report.unknownPlayer')); export interface RankedColumn { label: string; diff --git a/ui/src/components/reports/augSplit.test.ts b/ui/src/components/reports/augSplit.test.ts index 1e7c8ab..9e8ed04 100644 --- a/ui/src/components/reports/augSplit.test.ts +++ b/ui/src/components/reports/augSplit.test.ts @@ -3,8 +3,8 @@ import type { PlayerRef } from '../../api/types'; import { type AugSplit, augDelta, augTipLines, deltaClass, reattributedTotal } from './augSplit'; const roster = new Map([ - [4, { actorId: 4, name: 'Faelan-Emberfall-EU', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }], - [5, { actorId: 5, name: 'Speronis-Stonevale-EU', specId: 1473, specIcon: 'classicon_evoker_augmentation', specName: 'Augmentation Evoker', classId: 13, classToken: 'EVOKER', role: 'damage' }], + [4, { actorId: 4, name: 'Faelan', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }], + [5, { actorId: 5, name: 'Speronis', specId: 1473, specIcon: 'classicon_evoker_augmentation', specName: 'Augmentation Evoker', classId: 13, classToken: 'EVOKER', role: 'damage' }], ]); const spells = { '395152': { name: 'Ebon Might' }, '409311': { name: 'Prescience' } }; const split = (parts: Partial): AugSplit => ({ diff --git a/ui/src/components/reports/augSplit.ts b/ui/src/components/reports/augSplit.ts index 8f5240e..80e7597 100644 --- a/ui/src/components/reports/augSplit.ts +++ b/ui/src/components/reports/augSplit.ts @@ -1,7 +1,6 @@ import type { BuffShare, PlayerAmount, PlayerRef } from '../../api/types'; import { formatScaled, formatSignedScaled } from '../../i18n/format'; import { t } from '../../i18n/i18n'; -import { shortName } from '../overview/players'; import { reportSpellName, type SpellNames } from './reportData'; /** A player's total in both Aug modes and the parts the Aug tooltip shows. */ @@ -68,7 +67,7 @@ export function augTipLines(split: AugSplit, roster: Map, met })); const lines = [line(t(first), formatScaled(split.own))]; for (const from of split.supportReceivedFrom) { - lines.push(line(t('aug.tipFrom', { name: shortName(roster.get(from.player)?.name ?? '?') }), formatSignedScaled(-from.amount), 'loss')); + lines.push(line(t('aug.tipFrom', { name: roster.get(from.player)?.name ?? '?' }), formatSignedScaled(-from.amount), 'loss')); lines.push(...byBuff(split.supportReceivedByBuff.filter((share) => share.evoker === from.player), 'loss')); } const named = split.supportReceivedFrom.reduce((sum, from) => sum + from.amount, 0); diff --git a/ui/src/components/reports/breakdown.test.ts b/ui/src/components/reports/breakdown.test.ts index 0d0d71f..e67e41b 100644 --- a/ui/src/components/reports/breakdown.test.ts +++ b/ui/src/components/reports/breakdown.test.ts @@ -3,8 +3,8 @@ import type { AbilityRow, PlayerRef } from '../../api/types'; import { abilityBreakdown } from './breakdown'; const roster = new Map([ - [4, { actorId: 4, name: 'Faelan-Emberfall-EU', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }], - [5, { actorId: 5, name: 'Speronis-Stonevale-EU', specId: 1473, specIcon: 'classicon_evoker_augmentation', specName: 'Augmentation Evoker', classId: 13, classToken: 'EVOKER', role: 'damage' }], + [4, { actorId: 4, name: 'Faelan', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }], + [5, { actorId: 5, name: 'Speronis', specId: 1473, specIcon: 'classicon_evoker_augmentation', specName: 'Augmentation Evoker', classId: 13, classToken: 'EVOKER', role: 'damage' }], ]); const spells = { '1': { name: 'Arcane Missiles' }, diff --git a/ui/src/components/reports/rankedTargets.tsx b/ui/src/components/reports/rankedTargets.tsx index 1165ea8..027e747 100644 --- a/ui/src/components/reports/rankedTargets.tsx +++ b/ui/src/components/reports/rankedTargets.tsx @@ -2,7 +2,6 @@ import { type ReactNode, useState } from 'react'; import type { AbilityRow, GroupAbilities, PlayerRef, TargetRef, TargetShare } from '../../api/types'; import { t } from '../../i18n/i18n'; import { useApp } from '../../store'; -import { shortName } from '../overview/players'; import { AugTip } from './AugTip'; import type { TipLine } from './augSplit'; import { abilityBreakdown } from './breakdown'; @@ -113,7 +112,7 @@ export function RankedPopupView

      ({ id={id} at={popup.at} part={popup.data.part} - ofName={player ? shortName(player.name) : t('report.unknownPlayer')} + ofName={player?.name ?? t('report.unknownPlayer')} total={p.total} metric={metric} spells={report.spells} diff --git a/ui/src/components/reports/targetGroups.ts b/ui/src/components/reports/targetGroups.ts index 84a4313..700c9aa 100644 --- a/ui/src/components/reports/targetGroups.ts +++ b/ui/src/components/reports/targetGroups.ts @@ -1,6 +1,6 @@ import type { PlayerRef, TargetRef, TargetShare } from '../../api/types'; import { t } from '../../i18n/i18n'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; export type TargetMetric = 'damage' | 'healing'; @@ -78,7 +78,7 @@ export function targetName(target: TargetRef, roster: Map): s if (target.kind === 'unit') return target.name; if (target.kind === 'player' && target.player !== null) { const player = roster.get(target.player); - return player ? shortName(player.name) : t('report.unknownPlayer'); + return player?.name ?? t('report.unknownPlayer'); } return t('targets.unknown'); } diff --git a/ui/src/components/resources/ResourcesTab.tsx b/ui/src/components/resources/ResourcesTab.tsx index abef148..628c8d1 100644 --- a/ui/src/components/resources/ResourcesTab.tsx +++ b/ui/src/components/resources/ResourcesTab.tsx @@ -10,7 +10,7 @@ import { Kpi } from '../Kpi'; import { valueLabel } from '../filters/labels'; import { NoMatch } from '../filters/NoMatch'; import { ReportPickers } from '../filters/ReportPickers'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import { band } from '../player/chartGeometry'; import { PlayerIcon } from '../reports/PlayerName'; import { reportSpellName, rosterIndex } from '../reports/reportData'; @@ -47,7 +47,7 @@ export function ResourcesTab({ report }: { report: ResourcesReport }) { const playerOf = (u: UnitResources) => (u.unit.unit.kind === 'player' ? roster.get(u.unit.unit.actorId) : undefined); const nameOf = (u: UnitResources) => { const player = playerOf(u); - return player ? shortName(player.name) : valueLabel(u.unit.unit, u.unit.name, u.unit.number); + return player?.name ?? valueLabel(u.unit.unit, u.unit.name, u.unit.number); }; const factsOf = (u: UnitResources): UnitFacts => ({ boss: u.boss, diff --git a/ui/src/components/target/TargetDetailView.tsx b/ui/src/components/target/TargetDetailView.tsx index 1198285..79b45b3 100644 --- a/ui/src/components/target/TargetDetailView.tsx +++ b/ui/src/components/target/TargetDetailView.tsx @@ -8,7 +8,7 @@ import { Facts } from '../detail/Facts'; import { PageFilter } from '../detail/PageFilter'; import { TimeAxis } from '../detail/TimeAxis'; import { Kpi, KpiStrip } from '../Kpi'; -import { classColor, shortName } from '../overview/players'; +import { classColor } from '../overview/players'; import { PlayerIcon } from '../reports/PlayerName'; import { rosterIndex } from '../reports/reportData'; import { EnemyTile } from './EnemyTile'; @@ -236,7 +236,7 @@ export function TargetDetailView({ detail }: { detail: TargetDetail }) { diff --git a/ui/src/components/views/TimelineView.test.tsx b/ui/src/components/views/TimelineView.test.tsx index 6d0c98f..337caf3 100644 --- a/ui/src/components/views/TimelineView.test.tsx +++ b/ui/src/components/views/TimelineView.test.tsx @@ -429,7 +429,7 @@ describe('TimelineView', () => { const shown = (names: RegExp) => screen.getAllByText(names).map((element) => element.textContent); it('orders the players by role, then by name', () => { - const lirael: PlayerRef = { actorId: 6, name: 'Lirael-Emberfall-EU', specId: 65, specIcon: 'spell_holy_holybolt', specName: 'Holy Paladin', classId: 2, classToken: 'PALADIN', role: 'healer' }; + const lirael: PlayerRef = { actorId: 6, name: 'Lirael', specId: 65, specIcon: 'spell_holy_holybolt', specName: 'Holy Paladin', classId: 2, classToken: 'PALADIN', role: 'healer' }; const lanes = [lane({ kind: 'player', actorId: 3 }, 'Wendel'), lane({ kind: 'player', actorId: 4 }, 'Faelan'), lane({ kind: 'player', actorId: 6 }, 'Lirael')]; useApp.setState({ tab: 'resources', timeline: { ...resourcesTimelineFixture, roster: [...resourcesTimelineFixture.roster, lirael], lanes } }); render(); diff --git a/ui/src/currentGame.ts b/ui/src/currentGame.ts index bfb9f20..56ec8c7 100644 --- a/ui/src/currentGame.ts +++ b/ui/src/currentGame.ts @@ -1,23 +1,17 @@ -import type { DataGame, Game, LogView } from './api/types'; +import type { DataGame, LogView } from './api/types'; -let log: Pick | null = null; +let dataGame: DataGame | null = null; const listeners = new Set<() => void>(); -/** The game of the open log, which decides how names read; the store keeps it in step. */ -export function currentGame(): Game | null { - return log?.game ?? null; -} - -/** The game data of the open log, which decides which spell icons show. */ +/** The game data of the open log, which decides which spell icons show; the store keeps it in step. */ export function currentDataGame(): DataGame { - return log?.dataGame ?? 'retail'; + return dataGame ?? 'retail'; } -/** Listeners hear only of another game, not of every refresh of the open log. */ -export function setCurrentLog(next: Pick | null) { - const key = (value: typeof next) => JSON.stringify([value?.game ?? null, value?.dataGame ?? null]); - const changed = key(next) !== key(log); - log = next; +/** Listeners hear only of other game data, not of every refresh of the open log. */ +export function setCurrentLog(next: Pick | null) { + const changed = (next?.dataGame ?? null) !== dataGame; + dataGame = next?.dataGame ?? null; if (changed) listeners.forEach((listener) => listener()); } diff --git a/ui/src/gameData.test.ts b/ui/src/gameData.test.ts index 79e6f32..9a3d1da 100644 --- a/ui/src/gameData.test.ts +++ b/ui/src/gameData.test.ts @@ -100,29 +100,29 @@ describe('game data tables', () => { const notified = vi.fn(); subscribeIconTables(notified); - setCurrentLog({ game: { kind: 'forever' }, dataGame: 'forever' }); + setCurrentLog({ dataGame: 'forever' }); loadIconTables(); await vi.waitFor(() => expect(bearForm()).toBe('ability_racial_bearform')); notified.mockClear(); - setCurrentLog({ game: { kind: 'retail' }, dataGame: 'retail' }); + setCurrentLog({ dataGame: 'retail' }); expect(notified).toHaveBeenCalled(); await vi.waitFor(() => expect(bearForm()).toBe('retail_icon')); - setCurrentLog({ game: { kind: 'forever' }, dataGame: 'forever' }); + setCurrentLog({ dataGame: 'forever' }); expect(bearForm(), 'a loaded table is shown again at once').toBe('ability_racial_bearform'); }); - it('leaves the icons alone when a refreshed log keeps its game', async () => { + it('leaves the icons alone when a refreshed log keeps its game data', async () => { vi.stubGlobal('fetch', vi.fn(async () => new Response('', { status: 404 }))); const { setCurrentLog } = await import('./currentGame'); const { iconTables, subscribeIconTables } = await import('./gameData'); - setCurrentLog({ game: { kind: 'forever' }, dataGame: 'forever' }); + setCurrentLog({ dataGame: 'forever' }); const shown = iconTables(); const notified = vi.fn(); subscribeIconTables(notified); - setCurrentLog({ game: { kind: 'forever' }, dataGame: 'forever' }); + setCurrentLog({ dataGame: 'forever' }); expect(notified).not.toHaveBeenCalled(); expect(iconTables()).toBe(shown); diff --git a/ui/src/store.test.ts b/ui/src/store.test.ts index 1f28bca..d94e68b 100644 --- a/ui/src/store.test.ts +++ b/ui/src/store.test.ts @@ -21,7 +21,7 @@ import { targetDetailFixture, } from './test/reportFixtures'; import { eventsPageFixture, timelineFixture } from './test/viewFixtures'; -import { currentGame } from './currentGame'; +import { currentDataGame } from './currentGame'; import { type FightTab, initialState, useApp } from './store'; vi.mock('./api/client', () => ({ @@ -135,13 +135,13 @@ describe('logs and pulls', () => { expect(useApp.getState().view).toEqual({ kind: 'start' }); }); - it('opening a log sets the game its names follow', async () => { - const forever: LogView = { ...LOG, game: { kind: 'forever' } }; + it('opening a log sets the game data its icons follow', async () => { + const forever: LogView = { ...LOG, game: { kind: 'forever' }, dataGame: 'forever' }; vi.mocked(api.openLog).mockResolvedValueOnce(forever); await useApp.getState().openLog(chosen(forever)); - expect(currentGame()).toEqual({ kind: 'forever' }); + expect(currentDataGame()).toBe('forever'); await useApp.getState().openLog(chosen(LOG)); - expect(currentGame()).toEqual(LOG.game); + expect(currentDataGame()).toBe('retail'); }); it('shows the indexing progress while a log opens', async () => { diff --git a/ui/src/test/compareFixture.ts b/ui/src/test/compareFixture.ts index 4c1e6d1..21712cb 100644 --- a/ui/src/test/compareFixture.ts +++ b/ui/src/test/compareFixture.ts @@ -2,7 +2,7 @@ import type { FightRow, LogView, Outcome, PullComparison, QuickOverview } from ' import { overviewFixture } from './overviewFixture'; const [edrin, pyrrin, wendel, faelan] = overviewFixture.players; -const spero = { actorId: 5, name: 'Speronis-Stonevale-EU', specId: 1473, specIcon: 'classicon_evoker_augmentation', specName: 'Augmentation Evoker', classId: 13, classToken: 'EVOKER', role: 'damage' as const }; +const spero = { actorId: 5, name: 'Speronis', specId: 1473, specIcon: 'classicon_evoker_augmentation', specName: 'Augmentation Evoker', classId: 13, classToken: 'EVOKER', role: 'damage' as const }; /** Pull 1: a 2:22 wipe at 60.4 %; Wendel died to world damage at 0:47. */ const wipeOverview: QuickOverview = { diff --git a/ui/src/test/overviewFixture.ts b/ui/src/test/overviewFixture.ts index 8d510de..165a413 100644 --- a/ui/src/test/overviewFixture.ts +++ b/ui/src/test/overviewFixture.ts @@ -40,10 +40,10 @@ export const overviewFixture: QuickOverview = { ], }, players: [ - { actorId: 1, name: 'Edrin-Emberfall-EU', specId: 581, specIcon: 'ability_demonhunter_spectank', specName: 'Vengeance Demon Hunter', classId: 12, classToken: 'DEMONHUNTER', role: 'tank' }, - { actorId: 2, name: 'Pyrrin-Emberfall-EU', specId: 105, specIcon: 'spell_nature_healingtouch', specName: 'Restoration Druid', classId: 11, classToken: 'DRUID', role: 'healer' }, - { actorId: 3, name: 'Wendel-Emberfall-EU', specId: 71, specIcon: 'ability_warrior_savageblow', specName: 'Arms Warrior', classId: 1, classToken: 'WARRIOR', role: 'damage' }, - { actorId: 4, name: 'Faelan-Emberfall-EU', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }, + { actorId: 1, name: 'Edrin', specId: 581, specIcon: 'ability_demonhunter_spectank', specName: 'Vengeance Demon Hunter', classId: 12, classToken: 'DEMONHUNTER', role: 'tank' }, + { actorId: 2, name: 'Pyrrin', specId: 105, specIcon: 'spell_nature_healingtouch', specName: 'Restoration Druid', classId: 11, classToken: 'DRUID', role: 'healer' }, + { actorId: 3, name: 'Wendel', specId: 71, specIcon: 'ability_warrior_savageblow', specName: 'Arms Warrior', classId: 1, classToken: 'WARRIOR', role: 'damage' }, + { actorId: 4, name: 'Faelan', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }, ], spells: { '1236994': { name: 'Potion of Recklessness' }, @@ -61,7 +61,7 @@ export const overviewFixture: QuickOverview = { deaths: [ { player: 3, - playerName: 'Wendel-Emberfall-EU', + playerName: 'Wendel', t: 33_200, killingBlow: { t: 33_140, spellId: 0, sourceName: 'Gore Rattle', amount: 2_420_251, overkill: 1_380_351, environmental: false, periodic: false }, damageLast5s: [ @@ -80,7 +80,7 @@ export const overviewFixture: QuickOverview = { }, { player: 4, - playerName: 'Faelan-Emberfall-EU', + playerName: 'Faelan', t: 239_100, killingBlow: { t: 239_050, spellId: 1300001, sourceName: "Ula'tek", amount: 355_265, overkill: 4_923, environmental: false, periodic: false }, damageLast5s: [ diff --git a/ui/src/test/replayFixture.ts b/ui/src/test/replayFixture.ts index 1727cfb..c99ced0 100644 --- a/ui/src/test/replayFixture.ts +++ b/ui/src/test/replayFixture.ts @@ -6,15 +6,15 @@ export const replayFixture: ReplayData = { advancedLogging: true, durationMs: 300_000, roster: [ - { actorId: 1, name: 'Talwyn-Emberfall-EU', specId: 66, specIcon: 'ability_paladin_shieldofthetemplar', specName: 'Protection Paladin', classId: 2, classToken: 'PALADIN', role: 'tank' }, - { actorId: 2, name: 'Miravel-Emberfall-EU', specId: 257, specIcon: 'spell_holy_guardianspirit', specName: 'Holy Priest', classId: 5, classToken: 'PRIEST', role: 'healer' }, - { actorId: 3, name: 'Orsek-Emberfall-EU', specId: 253, specIcon: 'ability_hunter_bestialdiscipline', specName: 'Beast Mastery Hunter', classId: 3, classToken: 'HUNTER', role: 'damage' }, + { actorId: 1, name: 'Talwyn', specId: 66, specIcon: 'ability_paladin_shieldofthetemplar', specName: 'Protection Paladin', classId: 2, classToken: 'PALADIN', role: 'tank' }, + { actorId: 2, name: 'Miravel', specId: 257, specIcon: 'spell_holy_guardianspirit', specName: 'Holy Priest', classId: 5, classToken: 'PRIEST', role: 'healer' }, + { actorId: 3, name: 'Orsek', specId: 253, specIcon: 'ability_hunter_bestialdiscipline', specName: 'Beast Mastery Hunter', classId: 3, classToken: 'HUNTER', role: 'damage' }, ], spells: {}, units: [ - { actor: 1, name: 'Talwyn-Emberfall-EU', kind: 'player', specId: 66, specIcon: 'ability_paladin_shieldofthetemplar', classId: 2, owner: null, addNumber: null }, - { actor: 2, name: 'Miravel-Emberfall-EU', kind: 'player', specId: 257, specIcon: 'spell_holy_guardianspirit', classId: 5, owner: null, addNumber: null }, - { actor: 3, name: 'Orsek-Emberfall-EU', kind: 'player', specId: 253, specIcon: 'ability_hunter_bestialdiscipline', classId: 3, owner: null, addNumber: null }, + { actor: 1, name: 'Talwyn', kind: 'player', specId: 66, specIcon: 'ability_paladin_shieldofthetemplar', classId: 2, owner: null, addNumber: null }, + { actor: 2, name: 'Miravel', kind: 'player', specId: 257, specIcon: 'spell_holy_guardianspirit', classId: 5, owner: null, addNumber: null }, + { actor: 3, name: 'Orsek', kind: 'player', specId: 253, specIcon: 'ability_hunter_bestialdiscipline', classId: 3, owner: null, addNumber: null }, { actor: 4, name: 'Bristlemane', kind: 'pet', specId: null, specIcon: null, classId: null, owner: 3, addNumber: null }, { actor: 10, name: 'Gorvath the Hollow', kind: 'boss', specId: null, specIcon: null, classId: null, owner: null, addNumber: null }, { actor: 11, name: 'Ashen Husk', kind: 'add', specId: null, specIcon: null, classId: null, owner: null, addNumber: 1 }, diff --git a/ui/src/test/reportFixtures.ts b/ui/src/test/reportFixtures.ts index 1fcc708..5205ecf 100644 --- a/ui/src/test/reportFixtures.ts +++ b/ui/src/test/reportFixtures.ts @@ -1,10 +1,10 @@ import type { AbilityDetail, AuraLane, AuraRow, AurasReport, CastsReport, Breakdown, DamageReport, DamageTakenReport, DeathRecap, DeathsReport, HealingReport, InterruptsReport, PlayerAbility, PlayerDetail, PlayerRef, ReportUnit, ResourcesReport, TargetDetail } from '../api/types'; const roster: PlayerRef[] = [ - { actorId: 3, name: 'Wendel-Emberfall-EU', specId: 71, specIcon: 'ability_warrior_savageblow', specName: 'Arms Warrior', classId: 1, classToken: 'WARRIOR', role: 'damage' }, - { actorId: 4, name: 'Faelan-Emberfall-EU', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }, - { actorId: 5, name: 'Speronis-Stonevale-EU', specId: 1473, specIcon: 'classicon_evoker_augmentation', specName: 'Augmentation Evoker', classId: 13, classToken: 'EVOKER', role: 'damage' }, - { actorId: 2, name: 'Pyrrin-Emberfall-EU', specId: 105, specIcon: 'spell_nature_healingtouch', specName: 'Restoration Druid', classId: 11, classToken: 'DRUID', role: 'healer' }, + { actorId: 3, name: 'Wendel', specId: 71, specIcon: 'ability_warrior_savageblow', specName: 'Arms Warrior', classId: 1, classToken: 'WARRIOR', role: 'damage' }, + { actorId: 4, name: 'Faelan', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }, + { actorId: 5, name: 'Speronis', specId: 1473, specIcon: 'classicon_evoker_augmentation', specName: 'Augmentation Evoker', classId: 13, classToken: 'EVOKER', role: 'damage' }, + { actorId: 2, name: 'Pyrrin', specId: 105, specIcon: 'spell_nature_healingtouch', specName: 'Restoration Druid', classId: 11, classToken: 'DRUID', role: 'healer' }, ]; const spells = { @@ -255,7 +255,7 @@ export const abilityDetailFixture: AbilityDetail = { uptime: null, dead: [[12_000, 16_000]], targetNames: { '10': "Ula'tek", '11': 'Blightscale Rawling', '12': 'Blightscale Rawling' }, - playerTargets: [], + shownNames: {}, }; /** Blightscale Rawlings over 60 s. */ @@ -347,8 +347,8 @@ export const castsReportFixture: CastsReport = { ], }; -const faelanHolder = { name: 'Faelan-Emberfall-EU', player: 4 }; -const wendelHolder = { name: 'Wendel-Emberfall-EU', player: 3 }; +const faelanHolder = { name: 'Faelan', player: 4 }; +const wendelHolder = { name: 'Wendel', player: 3 }; const lane = (holder: AuraLane['holder'], spellId: number, sources: number[], applications: number, uptime: number, intervals: [number, number][]): AuraLane => ({ holder, spellId, @@ -444,7 +444,7 @@ export const resourcesReportFixture: ResourcesReport = { /** Faelan's death in the reference pull, with its events, HP and context. */ const faelanRecap: DeathRecap = { player: 4, - playerName: 'Faelan-Emberfall-EU', + playerName: 'Faelan', t: 239_100, killingBlow: { t: 239_100, spellId: 1302982, sourceName: "Ula'tek", amount: 355_265, overkill: 4_923, environmental: false, periodic: false }, damageLast5s: [{ spellId: 1302982, amount: 710_530, environmental: false }], @@ -470,11 +470,11 @@ const faelanRecap: DeathRecap = { events: [ { t: 231_990, spellId: 1286835, sourceName: "Ula'tek", kind: 'damage', amount: 33_163, absorbed: 0, excess: 0, hpPct: 94, environmental: false, periodic: false, sourceOwnerName: null }, { t: 236_470, spellId: 1297338, sourceName: null, kind: 'damage', amount: 45_999, absorbed: 0, excess: 0, hpPct: 68, environmental: false, periodic: true, sourceOwnerName: null }, - { t: 236_728, spellId: 1267745, sourceName: 'Stormstream Totem', kind: 'heal', amount: 14_195, absorbed: 0, excess: 0, hpPct: null, environmental: false, periodic: true, sourceOwnerName: 'Mulgar-Emberfall-EU' }, + { t: 236_728, spellId: 1267745, sourceName: 'Stormstream Totem', kind: 'heal', amount: 14_195, absorbed: 0, excess: 0, hpPct: null, environmental: false, periodic: true, sourceOwnerName: 'Mulgar' }, { t: 237_990, spellId: 1286835, sourceName: "Ula'tek", kind: 'damage', amount: 35_444, absorbed: 0, excess: 0, hpPct: 74, environmental: false, periodic: false, sourceOwnerName: null }, { t: 238_090, spellId: 1302982, sourceName: "Ula'tek", kind: 'damage', amount: 355_265, absorbed: 0, excess: 0, hpPct: 36, environmental: false, periodic: false, sourceOwnerName: null }, - { t: 238_270, spellId: 1287908, sourceName: 'Faelan-Emberfall-EU', kind: 'heal', amount: 12_552, absorbed: 0, excess: 0, hpPct: null, environmental: false, periodic: false, sourceOwnerName: null }, - { t: 238_600, spellId: 235450, sourceName: 'Faelan-Emberfall-EU', kind: 'absorb', amount: 20_000, absorbed: 0, excess: 0, hpPct: null, environmental: false, periodic: false, sourceOwnerName: null }, + { t: 238_270, spellId: 1287908, sourceName: 'Faelan', kind: 'heal', amount: 12_552, absorbed: 0, excess: 0, hpPct: null, environmental: false, periodic: false, sourceOwnerName: null }, + { t: 238_600, spellId: 235450, sourceName: 'Faelan', kind: 'absorb', amount: 20_000, absorbed: 0, excess: 0, hpPct: null, environmental: false, periodic: false, sourceOwnerName: null }, { t: 239_100, spellId: 1302982, sourceName: "Ula'tek", kind: 'damage', amount: 394_738, absorbed: 39_473, excess: 4_923, hpPct: 0, environmental: false, periodic: false, sourceOwnerName: null }, ], hp: [ @@ -490,8 +490,8 @@ const faelanRecap: DeathRecap = { /** The Deaths tab: Faelan's death and the druid who resurrected him. */ export const recapFixture: DeathsReport = { roster: [ - { actorId: 4, name: 'Faelan-Emberfall-EU', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }, - { actorId: 6, name: 'Serrik-Silverbrook-EU', specId: 105, specIcon: 'spell_nature_healingtouch', specName: 'Restoration Druid', classId: 11, classToken: 'DRUID', role: 'healer' }, + { actorId: 4, name: 'Faelan', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }, + { actorId: 6, name: 'Serrik', specId: 105, specIcon: 'spell_nature_healingtouch', specName: 'Restoration Druid', classId: 11, classToken: 'DRUID', role: 'healer' }, ], spells: { '1302982': { name: 'Virulent Spit' }, diff --git a/ui/src/test/viewFixtures.ts b/ui/src/test/viewFixtures.ts index 64d06fb..b614231 100644 --- a/ui/src/test/viewFixtures.ts +++ b/ui/src/test/viewFixtures.ts @@ -1,9 +1,9 @@ import type { EventRow, EventsPage, PlayerRef, Timeline, UnitInfo } from '../api/types'; const roster: PlayerRef[] = [ - { actorId: 3, name: 'Wendel-Emberfall-EU', specId: 71, specIcon: 'ability_warrior_savageblow', specName: 'Arms Warrior', classId: 1, classToken: 'WARRIOR', role: 'damage' }, - { actorId: 4, name: 'Faelan-Emberfall-EU', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }, - { actorId: 5, name: 'Speronis-Stonevale-EU', specId: 1473, specIcon: 'classicon_evoker_augmentation', specName: 'Augmentation Evoker', classId: 13, classToken: 'EVOKER', role: 'damage' }, + { actorId: 3, name: 'Wendel', specId: 71, specIcon: 'ability_warrior_savageblow', specName: 'Arms Warrior', classId: 1, classToken: 'WARRIOR', role: 'damage' }, + { actorId: 4, name: 'Faelan', specId: 62, specIcon: 'spell_holy_magicalsentry', specName: 'Arcane Mage', classId: 8, classToken: 'MAGE', role: 'damage' }, + { actorId: 5, name: 'Speronis', specId: 1473, specIcon: 'classicon_evoker_augmentation', specName: 'Augmentation Evoker', classId: 13, classToken: 'EVOKER', role: 'damage' }, ]; const units: UnitInfo[] = [