aboutsummaryrefslogtreecommitdiff
path: root/internal/game/render_prompt.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/render_prompt.go')
-rw-r--r--internal/game/render_prompt.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/game/render_prompt.go b/internal/game/render_prompt.go
index 7d3fafd..b992c8c 100644
--- a/internal/game/render_prompt.go
+++ b/internal/game/render_prompt.go
@@ -7,6 +7,7 @@ import (
"thehouseoficarus/internal/color"
"thehouseoficarus/internal/net"
"thehouseoficarus/internal/player"
+ "thehouseoficarus/internal/world"
)
func (g *Game) promptStr(sess *net.Session) string {
@@ -51,6 +52,24 @@ func (g *Game) expandPromptVars(sess *net.Session, text string) string {
text = strings.ReplaceAll(text, "%m", mobHP)
text = strings.ReplaceAll(text, "%M", mobMaxHP)
+ allExits, openExits := "", ""
+ if room, err := g.World.LoadRoom(p.RoomID); err == nil {
+ for _, dir := range world.ExitOrder {
+ exitDef, ok := room.Exits[dir]
+ if !ok {
+ continue
+ }
+ letter := strings.ToUpper(string(dir)[:1])
+ allExits += letter
+ if exitDef.Condition != nil && !g.checkCondition(sess, exitDef.Condition) {
+ continue
+ }
+ openExits += letter
+ }
+ }
+ text = strings.ReplaceAll(text, "%E", allExits)
+ text = strings.ReplaceAll(text, "%e", openExits)
+
for _, sk := range player.AllSkills {
tag := string(sk)
text = strings.ReplaceAll(text, "%X_"+tag, fmt.Sprint(p.Skills[sk]))