blob: 90f58abf0c736b4c2ace17f8b16d5330c2fd9c32 (
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
38
39
40
|
package game
import (
"thehouseoficarus/internal/net"
)
func (g *Game) executeMap(sess *net.Session, args []string, rawInput string) {
g.doMap(sess)
}
func (g *Game) doMap(sess *net.Session) {
p := sess.Player
mapWidth := p.OptionInt("map_width")
mapHeight := p.OptionInt("map_height")
if mapWidth < 5 {
mapWidth = 5
}
if mapHeight < 5 {
mapHeight = 5
}
lines := buildFullMap(g, p.RoomID, mapWidth, mapHeight, mapGlyphsForPlayer(p.OptionBool("unicode")))
mode := p.OptionString("map_padding")
if mode == "none" || mode == "x" {
lines = stripBlankRows(lines)
}
if mode == "none" || mode == "y" {
lines = leftTrimCommon(lines)
}
if len(lines) == 0 {
sess.WriteLine("\nNo map data to display.")
return
}
sess.WriteLine("")
for _, line := range lines {
sess.WriteLine(line)
}
}
|