From 84072ffe6365ad57c4976e9272762aa6db41de7e Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sun, 21 Jun 2026 03:46:25 -0400 Subject: feat: better score output --- internal/game/cmd_skills.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 internal/game/cmd_skills.go (limited to 'internal/game/cmd_skills.go') diff --git a/internal/game/cmd_skills.go b/internal/game/cmd_skills.go new file mode 100644 index 0000000..9d2e247 --- /dev/null +++ b/internal/game/cmd_skills.go @@ -0,0 +1,40 @@ +package game + +import ( + "strconv" + + "thehouseoficarus/internal/color" + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/player" +) + +func (g *Game) executeSkills(sess *net.Session, args []string, rawInput string) { + g.doSkills(sess) +} + +func (g *Game) doSkills(sess *net.Session) { + p := sess.Player + mode := g.colorMode(sess) + t := &Table{Title: "Skills", Columns: []string{ + color.Render(mode, color.Parse("75"), "Skill"), + color.Render(mode, color.Parse("245"), "Abbr"), + color.Render(mode, color.Parse("230"), "Level"), + color.Render(mode, color.Parse("222"), "XP"), + color.Render(mode, color.Parse("179"), "XP to Next"), + }} + for _, s := range player.AllSkills { + level := p.Level(s) + xp := p.Skills[s] + next := player.XPForNextLevel(xp) + t.Rows = append(t.Rows, []string{ + color.Render(mode, color.Parse("75"), string(s)), + color.Render(mode, color.Parse("245"), player.SkillAbbr[s]), + color.Render(mode, color.Parse("230"), strconv.Itoa(level)), + color.Render(mode, color.Parse("222"), strconv.Itoa(xp)), + color.Render(mode, color.Parse("179"), strconv.Itoa(next)), + }) + } + for _, line := range t.Render(p.OptionBool("unicode")) { + sess.WriteLine(line) + } +} -- cgit v1.2.3