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
Rewrites the GemStone room-name line to inject or hide Lich ID and/or UID.
-
#process_game_specific_data(server_string, stripped_server = nil) ⇒ void
private
Parses GemStone-specific data via Infomon (vitals, experience, combat state).
-
#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
1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 |
# File 'documented/games.rb', line 1620 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
1667 1668 1669 |
# File 'documented/games.rb', line 1667 def get_documentation_url "https://gswiki.play.net/Lich:Software/Installation" end |
#handle_atmospherics(server_string) ⇒ Object
1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 |
# File 'documented/games.rb', line 1650 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
1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 |
# File 'documented/games.rb', line 1633 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.
Rewrites the GemStone room-name line to inject or hide Lich ID and/or UID.
Injects Lich room ID before the closing bracket, and/or replaces the game's inline UID with Lich's UID format depending on display settings (;display lichid, ;display uid).
1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 |
# File 'documented/games.rb', line 1698 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-specific data via Infomon (vitals, experience, combat state).
Runs Infomon's XML and line parsers to update character state (experience, vitals, wounds, scars). Processes both raw and stripped versions of the server string.
1680 1681 1682 1683 1684 1685 1686 1687 1688 |
# File 'documented/games.rb', line 1680 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).
1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 |
# File 'documented/games.rb', line 1721 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 |