diff options
Diffstat (limited to 'internal/game/cmd_look.go')
| -rw-r--r-- | internal/game/cmd_look.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/internal/game/cmd_look.go b/internal/game/cmd_look.go index bd738be..8cadfd3 100644 --- a/internal/game/cmd_look.go +++ b/internal/game/cmd_look.go @@ -2,16 +2,16 @@ package game import ( "fmt" - "regexp" "sort" "strconv" "strings" - "thirdcollapse/internal/combat" - "thirdcollapse/internal/net" - "thirdcollapse/internal/object" - "thirdcollapse/internal/player" - "thirdcollapse/internal/world" + "thehouseoficarus/internal/color" + "thehouseoficarus/internal/combat" + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/object" + "thehouseoficarus/internal/player" + "thehouseoficarus/internal/world" ) func (g *Game) doLook(sess *net.Session) { @@ -32,9 +32,11 @@ func (g *Game) doLook(sess *net.Session) { descWidth = 70 } rawLines := wrapText(room.Description, descWidth) + mode := g.colorMode(sess) + roomDescSpec := g.resolveColor(sess, "room_desc") descLines := make([]string, len(rawLines)) for i, l := range rawLines { - descLines[i] = g.colorize(sess, "room_desc", l) + descLines[i] = color.ExpandTagsWithDefault(mode, roomDescSpec, l) } wroteDesc := false if p.OptionString("tiny_map") != "off" { @@ -331,7 +333,7 @@ func (g *Game) doLook(sess *net.Session) { for _, other := range others { if other != sess && other.Player != nil { op := other.Player.(*player.Player) - line := fmt.Sprintf("\n%s is here", op.Name) + line := fmt.Sprintf("\n%s is here", g.colorize(sess, "player_name", op.Name)) if cs := combat.GetCombat(op.Name); cs != nil { if mob := g.MobStore.GetInstance(cs.MobID); mob != nil && mob.HP > 0 { name := mobDisplayName(mob, false) @@ -476,7 +478,7 @@ func (g *Game) doLookTarget(sess *net.Session, input string) { } lines := []string{ "", - def.Name, + g.itemColorize(sess, def, def.Name), fmt.Sprintf(" %s", def.Description), fmt.Sprintf(" Value: %d credits", def.Value), } @@ -606,10 +608,8 @@ func mobInstanceIdx(mob *world.MobInstance, roomMobs []*world.MobInstance) int { return 0 } -var ansiRe = regexp.MustCompile(`\x1b\[[0-9;]*[a-zA-Z]`) - func visibleLen(s string) int { - return len(ansiRe.ReplaceAllString(s, "")) + return color.VisibleLen(s) } func wrapText(text string, width int) []string { |
