package game import ( "fmt" "strconv" "thehouseoficarus/internal/color" "thehouseoficarus/internal/net" "thehouseoficarus/internal/player" ) func (g *Game) doScore(sess *net.Session) { p := sess.Player.(*player.Player) mode := g.colorMode(sess) sess.WriteLines( "", fmt.Sprintf("Name: %s", g.colorize(sess, "player_name", p.Name)), fmt.Sprintf("Combat Level: %s", color.Render(mode, color.Parse("230"), fmt.Sprint(p.CombatLevel()))), fmt.Sprintf("HP: %s/%s", g.colorize(sess, "character_hp", fmt.Sprint(p.HP)), color.Render(mode, color.Parse("230"), fmt.Sprint(p.MaxHP()))), fmt.Sprintf("Credits: %s", g.colorize(sess, "credits_pickup", fmt.Sprint(p.Credits))), ) t := &Table{Title: "Skills", Columns: []string{ color.Render(mode, color.Parse("75"), "Skill"), color.Render(mode, color.Parse("230"), "Level"), color.Render(mode, color.Parse("222"), "XP"), }} 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("230"), strconv.Itoa(level)), color.Render(mode, color.Parse("222"), fmt.Sprintf("%d / %d XP", xp, xp+next)), }) } for _, line := range t.Render(p.OptionBool("unicode")) { sess.WriteLine(line) } }