diff options
| author | historia <[not public]> | 2026-06-27 02:49:01 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-27 02:49:01 -0400 |
| commit | 1cab9ca20e24742f770a676f84e4ed9f1636f297 (patch) | |
| tree | aad74b0f365515d971dc3ae8c0e79e0541015561 /internal/game/render_prompt.go | |
| parent | 6f3d21d6e7f01155ce0c461857a053b43d329392 (diff) | |
| download | thehouseoficarus-1cab9ca20e24742f770a676f84e4ed9f1636f297.tar.gz | |
feat: exits added to prompt
Diffstat (limited to 'internal/game/render_prompt.go')
| -rw-r--r-- | internal/game/render_prompt.go | 19 |
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])) |
