From 9666676766bf21364f4fc4d0d1d336e72f2a91b4 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 6 Oct 2026 12:57:23 -0400 Subject: refactor: split casino.go, dedup helpers, remove audit docs --- internal/game/core_login_account.go | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'internal/game/core_login_account.go') diff --git a/internal/game/core_login_account.go b/internal/game/core_login_account.go index 0224a06..67e692d 100644 --- a/internal/game/core_login_account.go +++ b/internal/game/core_login_account.go @@ -49,6 +49,7 @@ func (g *Game) handleAccountName(sess *net.Session, input string) { // after the account is gone. func (g *Game) resetToAccountName(sess *net.Session) { sess.Account = nil + sess.SetAuthName("") sess.PendingChar = "" sess.PendingMenu = nil sess.PendingPass = "" @@ -361,15 +362,21 @@ 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.saveAccount(acc) + if err != nil { + sess.WriteLine("Error loading account.") + g.resetToAccountName(sess) + return + } + if acc.Options == nil { + acc.Options = make(map[string]any) } + acc.Options["color"] = "none" + g.saveAccount(acc) + if sess.Account.Options == nil { + sess.Account.Options = make(map[string]any) + } + sess.Account.Options["color"] = "none" } g.showMenu(sess) } @@ -479,6 +486,7 @@ func (g *Game) handleMenu(sess *net.Session, input string) { sess.Write("New name: ") return } + sess.PendingChar = "" sess.SetState(net.StateRenameChar) sess.WriteLine("\nRename which character?") for i, name := range sess.Account.Characters { @@ -495,6 +503,7 @@ func (g *Game) handleMenu(sess *net.Session, input string) { if len(sess.Account.Characters) == 1 { sess.PendingChar = sess.Account.Characters[0] } else { + sess.PendingChar = "" sess.SetState(net.StateDeleteChar) sess.WriteLine("\nDelete which character?") for i, name := range sess.Account.Characters { -- cgit v1.2.3