diff options
| author | historia <[not public]> | 2026-06-21 03:46:25 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-21 03:46:25 -0400 |
| commit | 84072ffe6365ad57c4976e9272762aa6db41de7e (patch) | |
| tree | d911389fd91e129871c23ec539e67a2666d9f78a /internal/game/cmd_skills.go | |
| parent | e4bc2de6e6aa507044a6a75b4c1954974539a857 (diff) | |
| download | thehouseoficarus-84072ffe6365ad57c4976e9272762aa6db41de7e.tar.gz | |
feat: better score output
Diffstat (limited to 'internal/game/cmd_skills.go')
| -rw-r--r-- | internal/game/cmd_skills.go | 40 |
1 files changed, 40 insertions, 0 deletions
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) + } +} |
