Module: Lich::Gemstone::XMLDelta

Extended by:
Common::XMLParserDelta::Base
Defined in:
documented/gemstone/xml_delta.rb

Overview

GemStone's semantic deltas for the shared server-stream parser. See Lich::Common::XMLParserDelta for the composition and the hook contracts.

Class Method Summary collapse

Methods included from Common::XMLParserDelta::Base

apply_crtr_status, main_subtitle

Class Method Details

.apply_crtr_status(id, flags, in_room_objs: false) ⇒ Object

GemStone sends inside room objs, just before the creature's link, and also on its own: combat updates (one per hit), the main-text "You also see" listing, and just before a room players component. Inside room objs the tag is stashed for the link, which registers the creature and marks it in the room before applying the flags. A standalone tag for a creature already in the current room roster is applied at once; registration and room-marking stay on the link path. Any other standalone tag (an id the current room has not linked) is stashed, but nothing reads it: the stash is only consumed inside room objs, and opening room objs,



35
36
37
38
39
40
41
42
43
# File 'documented/gemstone/xml_delta.rb', line 35

def self.apply_crtr_status(id, flags, in_room_objs: false)
  return false if in_room_objs

  creature = room_creature(id)
  return false unless creature

  creature.sync_crtr_status(flags)
  :applied
end

.main_subtitle(subtitle, nav_uid_pending:) ⇒ Object

GemStone subtitles carry no brackets: " - Town Square, Central - 228" when the game shows room numbers, " - Town Square, Central" when it does not. The title is bracketed here ("[Town Square, Central]") and the number is stripped from it; the number's presence also turns on Lich.display_uid (a global, not parser state).



17
18
19
20
21
22
# File 'documented/gemstone/xml_delta.rb', line 17

def self.main_subtitle(subtitle, nav_uid_pending:) # rubocop:disable Lint/UnusedMethodArgument
  if Lich.display_uid == false && subtitle[3..-1] =~ / - \d+$/
    Lich.enable_display_uid_automatically
  end
  { room_title: '[' + subtitle[3..-1].gsub(/ - \d+$/, '') + ']' }
end