Class: Lich::Gemstone::GameInstance
- Inherits:
-
Lich::GameBase::GameInstance::Base
- Object
- Lich::GameBase::GameInstance::Base
- Lich::Gemstone::GameInstance
- Defined in:
- documented/games.rb
Overview
Gemstone-specific game instance
Constant Summary
Constants inherited from Lich::GameBase::GameInstance::Base
Lich::GameBase::GameInstance::Base::SPLIT_REFUSAL
Constants included from Lich::GameBase::RoomFormatter
Lich::GameBase::RoomFormatter::OBVIOUS_EXIT_PATTERN
Instance Method Summary collapse
- #clean_serverstring(server_string) ⇒ Object
- #get_documentation_url ⇒ Object
-
#modify_room_display(alt_string) ⇒ String
private
Edits the GemStone room-name line to show Lich ID or game UID.
-
#process_game_specific_data(server_string, stripped_server = nil) ⇒ void
private
Parses GemStone character data: injuries, spells, vitals, and combat info.
-
#process_room_display(alt_string) ⇒ String
Prepends the shared exit / StringProc lines, and mirrors the exits into the GemStone room window on frontends that host one (once per new room).
Methods inherited from Lich::GameBase::GameInstance::Base
#adapt_for_frontend, #atmospherics, #atmospherics=, #buffer_split_line, #combat_count, #handle_atmospherics, #handle_combat_tags, #hold_split_line, #increment_combat_count, #initialize
Constructor Details
This class inherits a constructor from Lich::GameBase::GameInstance::Base
Instance Method Details
#clean_serverstring(server_string) ⇒ Object
1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 |
# File 'documented/games.rb', line 1898 def clean_serverstring(server_string) # The Rift, Scatter is broken... if server_string =~ /<compDef id='room text'><\/compDef>/ server_string.sub!(/(.*)\s\s<compDef id='room text'><\/compDef>/) { "<compDef id='room desc'>#{$1}</compDef>" } end # Handle combat and atmospherics server_string = (server_string) server_string = handle_atmospherics(server_string) server_string end |
#get_documentation_url ⇒ Object
1911 1912 1913 |
# File 'documented/games.rb', line 1911 def get_documentation_url "https://gswiki.play.net/Lich:Software/Installation" end |
#modify_room_display(alt_string) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Edits the GemStone room-name line to show Lich ID or game UID.
Injects or replaces room identifiers based on display_lichid and display_uid settings. Maps game UIDs to Lich room IDs via Room. When display_uid is enabled, replaces the game UID with the Lich UID format; when display_lichid is enabled, injects the Lich ID before the closing bracket.
1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 |
# File 'documented/games.rb', line 1944 def modify_room_display(alt_string) uid_from_string = alt_string.match(/] \((?<uid>\d+)\)/) if uid_from_string.nil? lichid_from_uid_string = Room.current.id else lichid_from_uid_string = Room["u#{uid_from_string[:uid]}"].id.to_i end if Lich.display_lichid == true alt_string.sub!(']') { " - #{lichid_from_uid_string}]" } end if Lich.display_uid == true alt_string.sub!(/] \(\d+\)/) { "]" } alt_string.sub!(']') { "] (#{(uid_from_string.nil? || XMLData.room_id == uid_from_string[:uid].to_i) ? ((XMLData.room_id == 0 || XMLData.room_id > 4294967296) ? "unknown" : "u#{XMLData.room_id}") : uid_from_string[:uid].to_i})" } end alt_string end |
#process_game_specific_data(server_string, stripped_server = nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Parses GemStone character data: injuries, spells, vitals, and combat info.
Runs Infomon::XMLParser on the raw line, then Infomon::Parser on each stripped text line. This populates the XMLData injury and spell trees used by scripts.
1924 1925 1926 1927 1928 1929 1930 1931 1932 |
# File 'documented/games.rb', line 1924 def process_game_specific_data(server_string, stripped_server = nil) # Infomon's XML-level parse needs the raw string; its line parser reuses # the text already stripped by process_xml_data (XMLParser.parse does not # mutate, so no dup or second strip_xml is needed). Infomon::XMLParser.parse(server_string) stripped_server.split("\r\n").each do |line| Infomon::Parser.parse(line) unless line.empty? end end |
#process_room_display(alt_string) ⇒ String
Prepends the shared exit / StringProc lines, and mirrors the exits into the GemStone room window on frontends that host one (once per new room).
1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 |
# File 'documented/games.rb', line 1967 def process_room_display(alt_string) exits = room_exit_entries alt_string = prepend_room_lines(alt_string, room_stringproc_entries, exits) if !exits.empty? && Frontend.supports_room_window? && Map.current.id != Game.instance_variable_get(:@last_id_shown_room_window) alt_string = "#{alt_string}<pushStream id='room' ifClosedStyle='watching'/>Room Exits: #{exits.join(', ')}\r\n<popStream/>\r\n" Game.instance_variable_set(:@last_id_shown_room_window, Map.current.id) end alt_string end |