Class: GoldSrcServer
- Inherits:
-
Object
- Object
- GoldSrcServer
- Includes:
- GameServer
- Defined in:
- lib/steam/servers/goldsrc_server.rb
Constant Summary
Constants included from GameServer
GameServer::REQUEST_CHALLENGE, GameServer::REQUEST_INFO, GameServer::REQUEST_PLAYER, GameServer::REQUEST_RULES
Class Method Summary collapse
-
.split_player_status(player_status) ⇒ Object
Splits the player status obtained with rcon status.
Instance Method Summary collapse
-
#initialize(ip_address, port_number = 27015, is_hltv = false) ⇒ GoldSrcServer
constructor
A new instance of GoldSrcServer.
- #rcon_auth(password) ⇒ Object
- #rcon_exec(command) ⇒ Object
Methods included from GameServer
#handle_response_for_request, #init, #ping, #players, #rules, #server_info, #to_s, #update_challenge_number, #update_ping, #update_player_info, #update_rules_info, #update_server_info
Constructor Details
#initialize(ip_address, port_number = 27015, is_hltv = false) ⇒ GoldSrcServer
Returns a new instance of GoldSrcServer.
24 25 26 27 |
# File 'lib/steam/servers/goldsrc_server.rb', line 24 def initialize(ip_address, port_number = 27015, is_hltv = false) super port_number @socket = GoldSrcSocket.new ip_address, port_number, is_hltv end |
Class Method Details
.split_player_status(player_status) ⇒ Object
Splits the player status obtained with rcon status
14 15 16 17 18 19 20 21 22 |
# File 'lib/steam/servers/goldsrc_server.rb', line 14 def self.split_player_status(player_status) player_data = player_status.match(/# *(\d+) +"(.*)" +(\d+) +(.*)/).to_a[1..-1] player_data[3] = player_data[3].split player_data.flatten! player_data[0] = player_data[2] player_data.delete_at(2) player_data.delete_at(4) player_data end |
Instance Method Details
#rcon_auth(password) ⇒ Object
29 30 31 32 |
# File 'lib/steam/servers/goldsrc_server.rb', line 29 def rcon_auth(password) @rcon_password = password true end |
#rcon_exec(command) ⇒ Object
34 35 36 |
# File 'lib/steam/servers/goldsrc_server.rb', line 34 def rcon_exec(command) @socket.rcon_exec(@rcon_password, command).strip end |