aboutsummaryrefslogtreecommitdiff
path: root/internal/game/core_login_account.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/core_login_account.go')
-rw-r--r--internal/game/core_login_account.go46
1 files changed, 23 insertions, 23 deletions
diff --git a/internal/game/core_login_account.go b/internal/game/core_login_account.go
index f6e5631..921af82 100644
--- a/internal/game/core_login_account.go
+++ b/internal/game/core_login_account.go
@@ -20,7 +20,7 @@ func (g *Game) handleAccountName(sess *net.Session, input string) {
if err == nil {
sess.Account = &player.Account{Name: actualName}
sess.SetAuthName(actualName)
- sess.State = net.StatePassword
+ sess.SetState(net.StatePassword)
sess.SetEcho(false)
sess.Write("Password: ")
} else {
@@ -31,7 +31,7 @@ func (g *Game) handleAccountName(sess *net.Session, input string) {
}
sess.Account = &player.Account{Name: name}
sess.SetAuthName(name)
- sess.State = net.StateNewAccountPass
+ sess.SetState(net.StateNewAccountPass)
sess.SetEcho(false)
sess.WriteLine("\r\nOh, a new visitor to this rock!")
sess.Write("Choose password: ")
@@ -46,7 +46,7 @@ func (g *Game) handlePassword(sess *net.Session, input string) {
if len(input) > 128 {
sess.SetEcho(true)
sess.WriteLine("Wrong password.")
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.Write("Account name: ")
return
}
@@ -54,14 +54,14 @@ func (g *Game) handlePassword(sess *net.Session, input string) {
if err != nil {
sess.SetEcho(true)
sess.WriteLine("Error loading account.")
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.Write("Account name: ")
return
}
if !player.CheckPassword(input, acc.PasswordHash) {
sess.SetEcho(true)
sess.WriteLine("Wrong password.")
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.Write("Account name: ")
return
}
@@ -116,7 +116,7 @@ func (g *Game) handlePasswordOffOwner(sess *net.Session, input string) {
}
sess.SetEcho(true)
sess.WriteLine("Wrong password.")
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.Write("Account name: ")
})
return
@@ -168,7 +168,7 @@ func (g *Game) applyPasswordAuth(sess *net.Session, auth passwordAuth) {
sess.SetEcho(true)
reject := func(message string) {
sess.WriteLine(message)
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.Write("Account name: ")
}
if auth.loadErr {
@@ -220,7 +220,7 @@ func (g *Game) handleNewPass(sess *net.Session, input string) {
if input == "" {
sess.SetEcho(true)
sess.Account = nil
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.Write("Account name: ")
return
}
@@ -230,7 +230,7 @@ func (g *Game) handleNewPass(sess *net.Session, input string) {
return
}
sess.PendingPass = input
- sess.State = net.StateNewAccount
+ sess.SetState(net.StateNewAccount)
sess.Write("Confirm password: ")
}
@@ -239,7 +239,7 @@ func (g *Game) handleNewAccount(sess *net.Session, input string) {
if input == "" {
sess.SetEcho(true)
sess.Account = nil
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.Write("Account name: ")
return
}
@@ -247,7 +247,7 @@ func (g *Game) handleNewAccount(sess *net.Session, input string) {
sess.SetEcho(true)
sess.WriteLine("Passwords do not match.")
sess.Account = nil
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.Write("Account name: ")
return
}
@@ -287,7 +287,7 @@ func (g *Game) applyNewAccount(sess *net.Session, hash string, hashErr error) {
sess.SetEcho(true)
sess.WriteLine(fmt.Sprintf("Error creating account: %v", hashErr))
sess.Account = nil
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.Write("Account name: ")
return
}
@@ -299,7 +299,7 @@ func (g *Game) applyNewAccount(sess *net.Session, hash string, hashErr error) {
if _, findErr := g.AccountStore.FindAccount(sess.Account.Name); findErr == nil {
sess.SetEcho(true)
sess.Account = nil
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.WriteLine("That account name was just taken; please sign in instead.")
sess.Write("Account name: ")
return
@@ -313,7 +313,7 @@ func (g *Game) applyNewAccount(sess *net.Session, hash string, hashErr error) {
sess.SetEcho(true)
sess.WriteLine(fmt.Sprintf("Error creating account: %v", err))
sess.Account = nil
- sess.State = net.StateAccountName
+ sess.SetState(net.StateAccountName)
sess.Write("Account name: ")
return
}
@@ -327,7 +327,7 @@ func (g *Game) applyNewAccount(sess *net.Session, hash string, hashErr error) {
Options: make(map[string]any),
}
sess.PendingPass = ""
- sess.State = net.StateColorChoice
+ sess.SetState(net.StateColorChoice)
sess.Write("\nShould I disable color? [y/N] ")
}
@@ -359,7 +359,7 @@ func menuColorMode(sess *net.Session) string {
}
func (g *Game) showMenu(sess *net.Session) {
- sess.State = net.StateMenu
+ sess.SetState(net.StateMenu)
mode := menuColorMode(sess)
lines := []string{
"",
@@ -404,7 +404,7 @@ func (g *Game) handleMenu(sess *net.Session, input string) {
for i, name := range sess.Account.Characters {
sess.WriteLine(fmt.Sprintf(" %d) %s", i+1, name))
}
- sess.State = net.StateNewCharName
+ sess.SetState(net.StateNewCharName)
sess.PendingChar = "connect"
sess.Write("\n> ")
@@ -420,12 +420,12 @@ func (g *Game) handleMenu(sess *net.Session, input string) {
sess.Write("\n> ")
case "n":
- sess.State = net.StateNewCharName
+ sess.SetState(net.StateNewCharName)
sess.PendingChar = ""
sess.Write("What's your character name?: ")
case "a":
- sess.State = net.StateRenameAccount
+ sess.SetState(net.StateRenameAccount)
sess.Write("New account name: ")
case "r":
@@ -436,12 +436,12 @@ func (g *Game) handleMenu(sess *net.Session, input string) {
}
if len(sess.Account.Characters) == 1 {
sess.PendingChar = sess.Account.Characters[0]
- sess.State = net.StateRenameCharName
+ sess.SetState(net.StateRenameCharName)
sess.WriteLine(fmt.Sprintf("\nRenaming %s.", sess.PendingChar))
sess.Write("New name: ")
return
}
- sess.State = net.StateRenameChar
+ sess.SetState(net.StateRenameChar)
sess.WriteLine("\nRename which character?")
for i, name := range sess.Account.Characters {
sess.WriteLine(fmt.Sprintf(" %d) %s", i+1, name))
@@ -457,7 +457,7 @@ func (g *Game) handleMenu(sess *net.Session, input string) {
if len(sess.Account.Characters) == 1 {
sess.PendingChar = sess.Account.Characters[0]
} else {
- sess.State = net.StateDeleteChar
+ sess.SetState(net.StateDeleteChar)
sess.WriteLine("\nDelete which character?")
for i, name := range sess.Account.Characters {
sess.WriteLine(fmt.Sprintf(" %d) %s", i+1, name))
@@ -468,7 +468,7 @@ func (g *Game) handleMenu(sess *net.Session, input string) {
g.showDeleteConfirm(sess)
case "p":
- sess.State = net.StatePurgeAccount
+ sess.SetState(net.StatePurgeAccount)
sess.WriteLine(fmt.Sprintf("\nPurge account %s and all characters?\nTo be clear you are about to PERMANENTLY DELETE EVERYTHING!\nType PURGE %s to confirm, or anything else to cancel.", sess.Account.Name, sess.Account.Name))
sess.Write("\n> ")