From 62ff40dc6abc8289c938b1750eb9fe976e942679 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 15 Dec 2025 00:01:10 +0100 Subject: [PATCH] Preview of char Id --- lib_efo/src/entity/implementations.rs | 2 +- ..._entity__test__snapshot_full_oneline_display.snap | 2 +- lib_efo/src/stats/implementations.rs | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib_efo/src/entity/implementations.rs b/lib_efo/src/entity/implementations.rs index 50c3ad6..348062c 100644 --- a/lib_efo/src/entity/implementations.rs +++ b/lib_efo/src/entity/implementations.rs @@ -42,7 +42,7 @@ impl Displayable for Entity { .metadata .governor .as_ref() - .map(|g| format!(" 󰻾[{:>2}]", g).red()) + .map(|g| format!(" {}", g.to_symbol()).red()) .unwrap_or_default(); let prestige = if *self.metadata.prestige > 0 { diff --git a/lib_efo/src/entity/snapshots/lib_efo__entity__test__snapshot_full_oneline_display.snap b/lib_efo/src/entity/snapshots/lib_efo__entity__test__snapshot_full_oneline_display.snap index abc9b08..34a1d49 100644 --- a/lib_efo/src/entity/snapshots/lib_efo__entity__test__snapshot_full_oneline_display.snap +++ b/lib_efo/src/entity/snapshots/lib_efo__entity__test__snapshot_full_oneline_display.snap @@ -4,5 +4,5 @@ expression: e.oneline_display() --- ├──┬─ 0c00000 Hero  ──────> ( 2, 4)⚓ ⧗10 │ ├─ Faction: 2 │ Effect: ⟳ (1 ⭾ 5), Stats: 0 0💰 0 0󰡢 3 -│ └─  󰻾[7900000]  󰻾[0b000000-0000-0000-0000-000000000000] +│ └─  󰻾[7900000]  󰻾[0b00000] │ diff --git a/lib_efo/src/stats/implementations.rs b/lib_efo/src/stats/implementations.rs index bb56ca6..a48fe1c 100644 --- a/lib_efo/src/stats/implementations.rs +++ b/lib_efo/src/stats/implementations.rs @@ -1,7 +1,7 @@ //! All traits implementatition for the main structs are deffered here #![allow(dead_code)] -use crate::stats::{GameStat, TownId}; +use crate::stats::{CharacterId, GameStat, TownId}; use colored::Colorize; use std::str::FromStr; @@ -408,6 +408,16 @@ impl Symbols for TownId { } } +impl Symbols for CharacterId { + fn to_symbol(&self) -> String { + format!("󰻾[{}]", self.0.to_string().split_at(7).0) + } + + fn to_shortest(&self) -> String { + self.0.to_string().split_at(7).0.to_string() + } +} + impl FromStr for FactionId { type Err = EpochError; // the error we get from `usize::parse`