aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_option.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/cmd_option.go')
-rw-r--r--internal/game/cmd_option.go35
1 files changed, 30 insertions, 5 deletions
diff --git a/internal/game/cmd_option.go b/internal/game/cmd_option.go
index 9302baa..3d4d420 100644
--- a/internal/game/cmd_option.go
+++ b/internal/game/cmd_option.go
@@ -5,22 +5,34 @@ import (
"strconv"
"strings"
- "thirdcollapse/internal/net"
- "thirdcollapse/internal/player"
+ "thehouseoficarus/internal/color"
+ "thehouseoficarus/internal/net"
+ "thehouseoficarus/internal/player"
)
func (g *Game) doOption(sess *net.Session, input string) {
p := sess.Player.(*player.Player)
+ mode := g.colorMode(sess)
if input == "" {
sess.WriteLine("")
table := &Table{
- Columns: []string{"Option", "Value", "Valid", "Description"},
+ Columns: []string{
+ color.Render(mode, color.Parse("75"), "Option"),
+ color.Render(mode, color.Parse("230"), "Value"),
+ color.Render(mode, color.Parse("243"), "Valid"),
+ color.Render(mode, color.Parse("252"), "Description"),
+ },
}
for _, def := range player.OptionDefs {
val := formatOptionValue(p, &def)
valid := formatValidValues(&def)
- table.Rows = append(table.Rows, []string{def.Name, val, valid, def.Description})
+ table.Rows = append(table.Rows, []string{
+ color.Render(mode, color.Parse("75"), def.Name),
+ color.Render(mode, color.Parse("230"), val),
+ color.Render(mode, color.Parse("243"), valid),
+ color.Render(mode, color.Parse("252"), def.Description),
+ })
}
for _, line := range table.Render(p.OptionBool("unicode")) {
sess.WriteLine(line)
@@ -56,7 +68,20 @@ func (g *Game) doOption(sess *net.Session, input string) {
p.Options = make(map[string]any)
}
p.Options[def.Name] = parsed
- g.AccountStore.SaveCharacter(p)
+
+ if sess.Account.Options == nil {
+ sess.Account.Options = make(map[string]any)
+ }
+ sess.Account.Options[def.Name] = parsed
+
+ acc, err := g.AccountStore.LoadAccount(sess.Account.Name)
+ if err == nil {
+ if acc.Options == nil {
+ acc.Options = make(map[string]any)
+ }
+ acc.Options[def.Name] = parsed
+ g.AccountStore.SaveAccount(acc)
+ }
sess.WriteLine(fmt.Sprintf("\n%s set to %s.", def.Name, formatOptionValue(p, def)))
}