Module: Lich::GameBase::RoomFormatter

Included in:
GameInstance::Base
Defined in:
documented/games.rb

Overview

Game-agnostic formatting for the Lich-injected room annotations (room number, obvious exits, and StringProc exits). Both the GemStone and DragonRealms game instances mix this in so the font and clickable-link toggles behave identically regardless of game: the module decides how an annotation looks, while each game instance decides which lines/streams to emit. Extracting it removes the near-duplicate exit/StringProc rendering that previously lived in both #process_room_display implementations.

Two independent settings drive it:

  • Lich.display_room_links - clickable command links vs plain text
  • Lich.display_room_mono - fixed-width mono style vs the proportional game font

The mono wrapper only escapes nothing and merely brackets the line, so a mono line can still contain live links (the two toggles are orthogonal).

Escaping: unlike respond (which HTML-escapes &, <, > for the classic roomnumbers.lic path), neither the mono wrapper nor the plain-text entries escape anything. This is deliberate - the links path emits live markup that must survive verbatim, and both paths are kept consistent so a toggle never silently changes escaping. Exit commands and room titles come from the mapdb and contain no markup in practice; if untrusted text is ever fed here the caller must escape it first.

Constant Summary collapse

OBVIOUS_EXIT_PATTERN =

Obvious compass / up / down / out exits (usually rendered by the game itself), excluded from the "Room Exits:" line. Hoisted here so the GS and DR paths share a single, identical definition.

/^(?:o|d|u|n|ne|e|se|s|sw|w|nw|out|down|up|north|northeast|east|southeast|south|southwest|west|northwest)$/.freeze