diff options
| author | historia <[not public]> | 2026-06-16 23:37:50 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-16 23:37:50 -0400 |
| commit | 389e307f205f9b7edf604fb9f86e1038ead736ef (patch) | |
| tree | 595095b5877cc2b0513d31fb126303d8796cc311 /internal/game/login_account.go | |
| parent | 085e728d22a3369bd110b77409914cfbe9ebe611 (diff) | |
| download | thehouseoficarus-389e307f205f9b7edf604fb9f86e1038ead736ef.tar.gz | |
feat: major xterm256 color overhaul, see worldbuilding docs.
Diffstat (limited to 'internal/game/login_account.go')
| -rw-r--r-- | internal/game/login_account.go | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/internal/game/login_account.go b/internal/game/login_account.go index 3ad1fee..176a1ee 100644 --- a/internal/game/login_account.go +++ b/internal/game/login_account.go @@ -5,8 +5,8 @@ import ( "os" "strings" - "thirdcollapse/internal/net" - "thirdcollapse/internal/player" + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/player" ) func (g *Game) handleAccountName(sess *net.Session, input string) { @@ -69,6 +69,7 @@ func (g *Game) handlePassword(sess *net.Session, input string) { Characters: acc.Characters, Aliases: acc.Aliases, Colors: acc.Colors, + Options: acc.Options, } if sess.Account.Aliases == nil { sess.Account.Aliases = make(map[string]string) @@ -76,6 +77,9 @@ func (g *Game) handlePassword(sess *net.Session, input string) { if sess.Account.Colors == nil { sess.Account.Colors = make(map[string]string) } + if sess.Account.Options == nil { + sess.Account.Options = make(map[string]any) + } g.showMenu(sess) } @@ -144,8 +148,27 @@ func (g *Game) handleNewAccountConfirm(sess *net.Session, input string) { Name: acc.Name, PasswordHash: acc.PasswordHash, Aliases: make(map[string]string), + Colors: make(map[string]string), + Options: make(map[string]any), } sess.PendingPass = "" + sess.State = net.StateColorChoice + sess.Write("\nShould I disable color? [y/N] ") +} + +func (g *Game) handleColorChoice(sess *net.Session, input string) { + input = strings.ToLower(strings.TrimSpace(input)) + if input == "y" || input == "yes" { + sess.Account.Options["color"] = "none" + acc, err := g.AccountStore.LoadAccount(sess.Account.Name) + if err == nil { + if acc.Options == nil { + acc.Options = make(map[string]any) + } + acc.Options["color"] = "none" + g.AccountStore.SaveAccount(acc) + } + } g.showMenu(sess) } @@ -158,7 +181,7 @@ func (g *Game) showMenu(sess *net.Session) { } if len(sess.Account.Characters) > 0 { lines = append(lines, - " (C)onnect character to TC", + " (C)onnect character to THOI", "", " (L)ist characters", " (R)ename character", @@ -171,9 +194,9 @@ func (g *Game) showMenu(sess *net.Session) { " (A)ccount rename", " (Q)uit", "", - "> ", ) sess.WriteLines(lines...) + sess.Write("> ") } func (g *Game) handleMenu(sess *net.Session, input string) { |
