Module: Lich::DragonRealms::DetachableClientInit

Defined in:
documented/dragonrealms/detachable_client_init.rb

Overview

Builds the one-time state push a newly attached detachable-client frontend receives, so it starts with the vitals, status, hands, and exits it missed before attaching.

DragonRealms-owned: the GemStone feed differs substantially, so it has its own Lich::Gemstone::DetachableClientInit. Shared code that overlaps (indicators, spell, hands, compass) is duplicated on purpose so each game can change its push without affecting the other. Waiting for the login feed and sending the result stay in detachable_client_send_init (global_defs.rb).

Not sent, because the DragonRealms feed has no equivalent: stance, mind, and encumbrance bars (experience arrives as its own stream). Injuries are not sent yet: the DragonRealms injury image names for an injured body part have not been confirmed from a captured feed.

Constant Summary collapse

INDICATORS =

Every indicator the game sends. One not yet sent is reported as not visible rather than as an empty attribute.

%w[IconBLEEDING IconPOISONED IconDISEASED IconSTANDING IconKNEELING IconSITTING IconPRONE
IconSTUNNED IconHIDDEN IconINVISIBLE IconDEAD IconWEBBED IconJOINED].freeze
VITALS =

[progressBar id, text label]. The game labels stamina as "fatigue".

[%w[health health], %w[mana mana], %w[stamina fatigue], %w[spirit spirit], %w[concentration concentration]].freeze
SHORT_DIRS =

The compass values of RoomBlock::COMPASS_DIRS, kept for callers; the compass itself comes from RoomBlock.compass.

Lich::Common::RoomBlock::COMPASS_DIRS

Class Method Summary collapse

Class Method Details

.init_string ⇒ String

Returns the XML to send to the frontend.

Returns:

  • (String) —

    the XML to send to the frontend



48
49
50
51
52
53
54
55
56
# File 'documented/dragonrealms/detachable_client_init.rb', line 48

def self.init_string
  [
    vitals,
    "<spell>#{encode(XMLData.prepared_spell)}</spell>",
    hands,
    indicators,
    compass,
  ].join
end

.ready? ⇒ Boolean

Whether enough of the login feed has been parsed to build the push. In the DragonRealms login feed the first follows everything the push describes (vitals, indicators, spell, hands, and room exits), whereas IconJOINED and arrive before some of it. XMLData.prompt starts empty and holds the prompt text once one has been parsed.

Returns:

  • (Boolean)


43
44
45
# File 'documented/dragonrealms/detachable_client_init.rb', line 43

def self.ready?
  !XMLData.prompt.empty?
end