blob: 5d0c5c1de9e648b556e65af8a9b04577945d3894 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package game
import (
"fmt"
"thehouseoficarus/internal/net"
)
func (g *Game) executeDescription(sess *net.Session, args []string, rawInput string) {
g.doDescription(sess)
}
func (g *Game) doDescription(sess *net.Session) {
p := sess.Player
sess.WriteLine("")
if p.Description != "" {
sess.WriteLine(fmt.Sprintf("Current description: %s", p.Description))
} else {
sess.WriteLine("You don't have a description set.")
}
sess.WriteLine("")
sess.Write("Enter a new description (or press enter to keep current): ")
sess.State = net.StateChangeDescription
}
func (g *Game) handleDescriptionChange(sess *net.Session, input string) {
if input != "" {
p := sess.Player
p.Description = input
g.AccountStore.SaveCharacter(p)
sess.WriteLine(fmt.Sprintf("Description set to: %s", input))
} else {
sess.WriteLine("Description left unchanged.")
}
sess.State = net.StateGame
g.writePrompt(sess)
}
|