diff options
| author | historia <[not public]> | 2026-06-16 23:37:50 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-16 23:37:50 -0400 |
| commit | 389e307f205f9b7edf604fb9f86e1038ead736ef (patch) | |
| tree | 595095b5877cc2b0513d31fb126303d8796cc311 /internal/game/prompt.go | |
| parent | 085e728d22a3369bd110b77409914cfbe9ebe611 (diff) | |
| download | thehouseoficarus-389e307f205f9b7edf604fb9f86e1038ead736ef.tar.gz | |
feat: major xterm256 color overhaul, see worldbuilding docs.
Diffstat (limited to 'internal/game/prompt.go')
| -rw-r--r-- | internal/game/prompt.go | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/internal/game/prompt.go b/internal/game/prompt.go index 2fc36ac..de88bc6 100644 --- a/internal/game/prompt.go +++ b/internal/game/prompt.go @@ -4,17 +4,17 @@ import ( "fmt" "strings" - "thirdcollapse/internal/color" - "thirdcollapse/internal/combat" - "thirdcollapse/internal/net" - "thirdcollapse/internal/player" + "thehouseoficarus/internal/color" + "thehouseoficarus/internal/combat" + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/player" ) func (g *Game) promptStr(sess *net.Session) string { prompt := "> " if p, ok := sess.Player.(*player.Player); ok && p != nil { - if custom := p.OptionString("prompt"); custom != "" { - prompt = custom + if p.Prompt != "" { + prompt = p.Prompt } } @@ -24,42 +24,7 @@ func (g *Game) promptStr(sess *net.Session) string { } func (g *Game) expandPromptColors(sess *net.Session, text string) string { - mode := g.colorMode(sess) - for { - start := strings.Index(text, "{") - if start < 0 { - break - } - - end := strings.Index(text[start+1:], "}") - if end < 0 { - break - } - end += start + 1 - specStr := text[start+1 : end] - - if specStr == "" || specStr == "/" { - break - } - - spec := color.Parse(specStr) - if spec.Empty() { - break - } - - closeStart := strings.Index(text[end+1:], "{/}") - if closeStart < 0 { - break - } - closeStart += end + 1 - closeEnd := closeStart + 3 - - inner := text[end+1 : closeStart] - colored := color.Render(mode, spec, inner) - - text = text[:start] + colored + text[closeEnd:] - } - return text + return color.ExpandTags(g.colorMode(sess), text) } func (g *Game) expandPromptVars(sess *net.Session, text string) string { |
