1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
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("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)
}
}
|