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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
package game
import (
"fmt"
"strconv"
"thehouseoficarus/internal/color"
"thehouseoficarus/internal/net"
"thehouseoficarus/internal/player"
)
func (g *Game) executeScore(sess *net.Session, args []string, rawInput string) {
g.doScore(sess)
}
func (g *Game) doScore(sess *net.Session) {
p := sess.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("Battery: %s/%s", g.colorize(sess, "battery", fmt.Sprintf("%.1f", p.Battery)), color.Render(mode, color.Parse("230"), fmt.Sprintf("%.0f", p.MaxBattery()))),
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)
}
if len(p.ActiveTechs) > 0 {
sess.WriteLine("")
sess.WriteLine("Active Tech:")
for _, id := range p.ActiveTechList() {
def := GetTechDef(id)
if def != nil {
sess.WriteLine(fmt.Sprintf(" %s %s",
color.Render(mode, color.Parse("82"), "[ON]"),
color.Render(mode, color.Parse("75"), def.Name),
))
}
}
}
if len(p.ActiveBuffs) > 0 {
sess.WriteLine("")
sess.WriteLine("Active Buffs:")
for _, buff := range p.ActiveBuffs {
sess.WriteLine(fmt.Sprintf(" %s +%d%% %s (%d ticks)",
color.Render(mode, color.Parse("82"), "[BUFF]"),
buff.BonusPercent,
color.Render(mode, color.Parse("75"), buff.Stat),
buff.TicksLeft,
))
}
}
}
|