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 included from Lich::GameBase::RoomFormatter
Lich::GameBase::RoomFormatter::OBVIOUS_EXIT_PATTERN
Instance Method Summary collapse
- #clean_serverstring(server_string) ⇒ Object
- #get_documentation_url ⇒ Object
- #handle_atmospherics(server_string) ⇒ Object
- #handle_combat_tags(server_string) ⇒ Object
-
#modify_room_display(alt_string) ⇒ String
private
Injects Lich room ID and/or UID into the GemStone room-name line.
-
#process_game_specific_data(server_string, stripped_server = nil) ⇒ void
private
Parses GemStone XML and line data for Infomon (character status tracking).
-
#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
#atmospherics, #atmospherics=, #buffer_room_objs, #combat_count, #increment_combat_count, #initialize
Constructor Details
This class inherits a constructor from Lich::GameBase::GameInstance::Base
Instance Method Details
#clean_serverstring(server_string) ⇒ Object
1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 |
# File 'documented/games.rb', line 1587 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
1634 1635 1636 |
# File 'documented/games.rb', line 1634 def get_documentation_url "https://gswiki.play.net/Lich:Software/Installation" end |
#handle_atmospherics(server_string) ⇒ Object
1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 |
# File 'documented/games.rb', line 1617 def handle_atmospherics(server_string) if @atmospherics @atmospherics = false server_string.prepend('<popStream id="atmospherics" />') unless server_string =~ /<popStream id="atmospherics" \/>/ end if server_string =~ /<pushStream id="familiar" \/><prompt time="[0-9]+">><\/prompt>/ # Cry For Help spell is broken... server_string.sub!('<pushStream id="familiar" />', '') elsif server_string =~ /<pushStream id="atmospherics" \/><prompt time="[0-9]+">><\/prompt>/ # pet pigs in DragonRealms are broken... server_string.sub!('<pushStream id="atmospherics" />', '') elsif (server_string =~ /<pushStream id="atmospherics" \/>/) @atmospherics = true end server_string end |
#handle_combat_tags(server_string) ⇒ Object
1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 |
# File 'documented/games.rb', line 1600 def (server_string) if @combat_count > 0 @end_combat_tags.each do |tag| if server_string.include?(tag) server_string = server_string.gsub(tag, "<popStream id=\"combat\" />" + tag) unless server_string.include?("<popStream id=\"combat\" />") @combat_count -= 1 end if server_string.include?("<pushStream id=\"combat\" />") server_string = server_string.gsub("<pushStream id=\"combat\" />", "") end end end increment_combat_count(server_string) server_string 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.
Injects Lich room ID and/or UID into the GemStone room-name line.
Reads the GemStone room UID from the title, looks up the Lich room ID, and substitutes based on display settings (display_lichid, display_uid).
1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 |
# File 'documented/games.rb', line 1664 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 XML and line data for Infomon (character status tracking).
Passes raw server_string to Infomon::XMLParser and stripped lines to Infomon::Parser.
1646 1647 1648 1649 1650 1651 1652 1653 1654 |
# File 'documented/games.rb', line 1646 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).
1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 |
# File 'documented/games.rb', line 1687 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 |