aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_prompt.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/cmd_prompt.go')
-rw-r--r--internal/game/cmd_prompt.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/internal/game/cmd_prompt.go b/internal/game/cmd_prompt.go
new file mode 100644
index 0000000..81c3409
--- /dev/null
+++ b/internal/game/cmd_prompt.go
@@ -0,0 +1,33 @@
+package game
+
+import (
+ "fmt"
+
+ "thehouseoficarus/internal/net"
+ "thehouseoficarus/internal/player"
+)
+
+func (g *Game) doPrompt(sess *net.Session, input string) {
+ p := sess.Player.(*player.Player)
+
+ if input == "" {
+ prompt := p.Prompt
+ if prompt == "" {
+ prompt = "> "
+ }
+ sess.WriteLine(fmt.Sprintf("\nPrompt: %s", prompt))
+ sess.WriteLine("Use 'prompt <value>' to change. Use 'prompt reset' to restore default.")
+ return
+ }
+
+ if input == "reset" {
+ p.Prompt = "> "
+ g.AccountStore.SaveCharacter(p)
+ sess.WriteLine("\nPrompt reset to default.")
+ return
+ }
+
+ p.Prompt = input
+ g.AccountStore.SaveCharacter(p)
+ sess.WriteLine(fmt.Sprintf("\nPrompt set to: %s", input))
+}