package game import ( "strconv" "thehouseoficarus/internal/color" "thehouseoficarus/internal/net" "thehouseoficarus/internal/player" "thehouseoficarus/internal/ui" ) 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) hLabel := g.resolveConstant(sess, "table_header_label") hDetail := g.resolveConstant(sess, "table_header_detail") hValue := g.resolveConstant(sess, "table_header_value") hXP := g.resolveConstant(sess, "table_header_xp") t := &ui.Table{Title: "Skills", Columns: []string{ color.Render(mode, hLabel, "Skill"), color.Render(mode, hDetail, "Abbr"), color.Render(mode, hValue, "Level"), color.Render(mode, hXP, "XP"), color.Render(mode, hXP, "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, hLabel, string(s)), color.Render(mode, hDetail, player.SkillAbbr[s]), color.Render(mode, hValue, strconv.Itoa(level)), color.Render(mode, hXP, strconv.Itoa(xp)), color.Render(mode, hXP, strconv.Itoa(next)), }) } for _, line := range t.Render(p.OptionBool("unicode"), p.OptionInt("wrap_width")) { sess.WriteLine(line) } }