Class: Lich::GameBase::GameInstance::Base

Inherits:
Object
  • Object
show all
Defined in:
documented/games.rb

Overview

Base class for game instances This class provides common functionality for all game instances.

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



39
40
41
42
43
# File 'documented/games.rb', line 39

def initialize
  @atmospherics = false
  @combat_count = 0
  @end_combat_tags = ["<prompt", "<clearStream", "<component", "<pushStream id=\"percWindow"]
end

Instance Method Details

#atmosphericsObject



118
119
120
# File 'documented/games.rb', line 118

def atmospherics
  @atmospherics
end

#atmospherics=(value) ⇒ Object



122
123
124
# File 'documented/games.rb', line 122

def atmospherics=(value)
  @atmospherics = value
end

#clean_serverstring(server_string) ⇒ String

Cleans the server string for processing

Examples:

cleaned_string = instance.clean_serverstring(raw_string)

Parameters:

  • server_string (String)

    The raw server string to clean

Returns:

  • (String)

    The cleaned server string

Raises:

  • (NotImplementedError)

    If not implemented in a subclass



51
52
53
# File 'documented/games.rb', line 51

def clean_serverstring(server_string)
  raise NotImplementedError, "#{self.class} must implement #clean_serverstring"
end

#combat_countObject



114
115
116
# File 'documented/games.rb', line 114

def combat_count
  @combat_count
end

#get_documentation_urlString

Retrieves the documentation URL for the game instance

Examples:

url = instance.get_documentation_url

Returns:

  • (String)

    The documentation URL

Raises:

  • (NotImplementedError)

    If not implemented in a subclass



80
81
82
# File 'documented/games.rb', line 80

def get_documentation_url
  raise NotImplementedError, "#{self.class} must implement #get_documentation_url"
end

#handle_atmospherics(server_string) ⇒ String

Handles atmospherics in the server string

Examples:

processed_string = instance.handle_atmospherics(raw_string)

Parameters:

  • server_string (String)

    The server string containing atmospherics

Returns:

  • (String)

    The processed server string

Raises:

  • (NotImplementedError)

    If not implemented in a subclass



71
72
73
# File 'documented/games.rb', line 71

def handle_atmospherics(server_string)
  raise NotImplementedError, "#{self.class} must implement #handle_atmospherics"
end

#handle_combat_tags(server_string) ⇒ String

Handles combat tags in the server string

Examples:

processed_string = instance.handle_combat_tags(raw_string)

Parameters:

  • server_string (String)

    The server string containing combat tags

Returns:

  • (String)

    The processed server string

Raises:

  • (NotImplementedError)

    If not implemented in a subclass



61
62
63
# File 'documented/games.rb', line 61

def handle_combat_tags(server_string)
  raise NotImplementedError, "#{self.class} must implement #handle_combat_tags"
end

#increment_combat_count(server_string) ⇒ Object (protected)



128
129
130
131
132
# File 'documented/games.rb', line 128

def increment_combat_count(server_string)
  @combat_count += server_string.scan("<pushStream id=\"combat\" />").length
  @combat_count -= server_string.scan("<popStream id=\"combat\" />").length
  @combat_count = 0 if @combat_count < 0
end

#modify_room_display(alt_string, uid_from_string, lichid_from_uid_string) ⇒ String

Modifies the room display string

Examples:

modified_string = instance.modify_room_display(room_string)

Parameters:

  • alt_string (String)

    The room display string to modify

Returns:

  • (String)

    The modified room display string

Raises:

  • (NotImplementedError)

    If not implemented in a subclass



100
101
102
# File 'documented/games.rb', line 100

def modify_room_display(alt_string, uid_from_string, lichid_from_uid_string)
  raise NotImplementedError, "#{self.class} must implement #modify_room_display"
end

#process_game_specific_data(server_string) ⇒ void

This method returns an undefined value.

Processes game-specific data from the server string

Examples:

instance.process_game_specific_data(raw_string)

Parameters:

  • server_string (String)

    The server string containing game-specific data

Raises:

  • (NotImplementedError)

    If not implemented in a subclass



90
91
92
# File 'documented/games.rb', line 90

def process_game_specific_data(server_string)
  raise NotImplementedError, "#{self.class} must implement #process_game_specific_data"
end

#process_room_display(alt_string) ⇒ String

Processes the room display string

Examples:

processed_string = instance.process_room_display(room_string)

Parameters:

  • alt_string (String)

    The room display string to process

Returns:

  • (String)

    The processed room display string

Raises:

  • (NotImplementedError)

    If not implemented in a subclass



110
111
112
# File 'documented/games.rb', line 110

def process_room_display(alt_string)
  raise NotImplementedError, "#{self.class} must implement #process_room_display"
end