aboutsummaryrefslogtreecommitdiff
path: root/internal/game
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-27 02:49:01 -0400
committerhistoria <[not public]>2026-06-27 02:49:01 -0400
commit1cab9ca20e24742f770a676f84e4ed9f1636f297 (patch)
treeaad74b0f365515d971dc3ae8c0e79e0541015561 /internal/game
parent6f3d21d6e7f01155ce0c461857a053b43d329392 (diff)
downloadthehouseoficarus-1cab9ca20e24742f770a676f84e4ed9f1636f297.tar.gz
feat: exits added to prompt
Diffstat (limited to 'internal/game')
-rw-r--r--internal/game/cmd_prompt.go12
-rw-r--r--internal/game/render_prompt.go19
2 files changed, 20 insertions, 11 deletions
diff --git a/internal/game/cmd_prompt.go b/internal/game/cmd_prompt.go
index 110d08c..3596ebf 100644
--- a/internal/game/cmd_prompt.go
+++ b/internal/game/cmd_prompt.go
@@ -9,7 +9,7 @@ import (
func (g *Game) executePrompt(sess *net.Session, args []string, rawInput string) {
if len(args) == 0 {
- g.doPrompt(sess, "")
+ g.doHelp(sess, "prompt")
} else {
msgStart := strings.Index(strings.ToLower(rawInput), "prompt ") + 7
if msgStart >= 7 && msgStart < len(rawInput) {
@@ -23,16 +23,6 @@ func (g *Game) executePrompt(sess *net.Session, args []string, rawInput string)
func (g *Game) doPrompt(sess *net.Session, input string) {
p := sess.Player
- if input == "" {
- prompt := p.Prompt
- if prompt == "" {
- prompt = "> "
- }
- sess.WriteLine(fmt.Sprintf("Prompt: %s", prompt))
- sess.WriteLine("Use 'prompt <value>' to change. Use 'prompt none' for blank. Use 'prompt reset' to restore default.")
- return
- }
-
if input == "reset" {
p.Prompt = "> "
g.AccountStore.SaveCharacter(p)
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]))