Preview of char Id
Build Successful The build was successful
Gitea/epoch_forge/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2025-12-15 00:01:10 +01:00
parent beaf84e0c2
commit 62ff40dc6a
3 changed files with 13 additions and 3 deletions

View File

@ -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 {

View File

@ -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]
│

View File

@ -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`