diff options
| author | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
| commit | 9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch) | |
| tree | 0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/game/core_login_account.go | |
| parent | 4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff) | |
| download | thehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz | |
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/game/core_login_account.go')
| -rw-r--r-- | internal/game/core_login_account.go | 23 |
1 files changed, 16 insertions, 7 deletions
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 { |
