Module: Lich::DragonRealms::DRDefsPattern

Defined in:
documented/dragonrealms/drinfomon/drdefs.rb

Overview

Pattern constants for room/NPC parsing

Constant Summary collapse

TRAILING_AND =

Pattern to extract the final "and X" portion of room player lists

/ and (?<last>.*)$/.freeze
PLAYER_STATUS =

Pattern to match player status descriptions

/ (who|whose body)? ?(has|is|appears|glows) .+/.freeze
PARENTHETICAL =

Pattern to match parenthetical info after player names

/ \(.+\)/.freeze
PLAYER_NAME =

Pattern to extract player name (word characters at end)

/\w+$/.freeze
LYING_DOWN =

Pattern for lying down / prone players. Matches the default "who is lying down" long form and the "(prone)" short form shown when the HidePostStrings option is on (issue #4529). PARENTHETICAL still strips the "(prone)" suffix before the name is extracted.

/who is lying down|\(prone\)/i.freeze
SITTING =

Pattern for sitting players. Matches the default "who is sitting" long form and the "(sitting)" short form shown when the HidePostStrings option is on (issue #4529).

/who is sitting|\(sitting\)/i.freeze
YOU_ALSO_SEE =

Pattern for "You also see" prefix

/You also see/.freeze
MOUNT_DESCRIPTION =

Pattern for mount descriptions

/ with a [\w\s]+ sitting astride its back/.freeze
NPC_SCAN =

Pattern to find NPCs in room objects (bold tags indicate creatures)

%r{<pushBold/>[^<>]*<popBold/> which appears dead|<pushBold/>[^<>]*<popBold/> \(dead\)|<pushBold/>[^<>]*<popBold/>}.freeze
DEAD_NPC =

Pattern for dead NPCs

/which appears dead|\(dead\)/.freeze
PUSH_BOLD =

Pattern for pushBold tags (indicates creature, not object)

/pushBold/.freeze
LEADING_ARTICLE =

Pattern for leading articles

/^(a|some) /.freeze
TRAILING_PERIOD =

Pattern for trailing period

/\.$/.freeze
COMMA_OR_AND =

Pattern for splitting on comma or "and"

/,|\sand\s/.freeze
CREATURE_NAME =

Pattern for extracting creature name (letters, hyphens, apostrophes only) Note: Using [A-Za-z] instead of [A-z] to avoid matching []^_` characters

/[A-Za-z'-]+$/.freeze
WHO_STATUS =

Pattern for "who has/is" descriptions

/ who (has|is) .+/.freeze
GLOWING_WITH =

Pattern for "glowing with" modifiers

/(?:\sglowing)?\swith\s.*/.freeze
GELAPOD =

Gelapod replacement pattern

"<pushBold/>a domesticated gelapod<popBold/>".freeze
GELAPOD_REPLACEMENT =

Replacement string for the gelapod NPC when normalizing room objects.

Returns:

  • (String)

    the canonical gelapod name

See Also:

'domesticated gelapod'.freeze
CREATURE_NORMALIZATIONS =

Canonical creature names whose variant descriptions should collapse to the bare name (e.g. "a savage alfar warrior" -> "alfar warrior"). Any room-object string containing one of these is reduced to it. Players extend this list via the custom_creature_normalizations setting; see Lich::DragonRealms#normalize_creature_names.

Returns:

  • (Array<String>)

    canonical creature names

['alfar warrior', 'sinewy leopard', 'lesser naga'].freeze