Class: SteamCondenser::Servers::Packets::A2M_GET_SERVERS_BATCH2_Packet

Inherits:
Object
  • Object
show all
Includes:
BasePacket
Defined in:
lib/steam-condenser/servers/packets/a2m_get_servers_batch2_packet.rb

Overview

This packet class represents a A2M_GET_SERVERS_BATCH2 request sent to a master server

It is used to receive a list of game servers matching the specified filters.

Filtering: Instead of filtering the results sent by the master server locally, you should at least use the following filters to narrow down the results sent by the master server. Receiving all servers from the master server is taking quite some time.

Available filters:

  • \type\d: Request only dedicated servers
  • \secure\1: Request only secure servers
  • \gamedir\[mod]: Request only servers of a specific mod
  • \map\[mapname]: Request only servers running a specific map
  • \linux\1: Request only linux servers
  • \emtpy\1: Request only non-empty servers
  • \full\: Request only servers not full
  • \proxy\1: Request only spectator proxy servers

See Also:

Author:

  • Sebastian Staudt

Constant Summary

Constants included from BasePacket

BasePacket::A2M_GET_SERVERS_BATCH2_HEADER, BasePacket::A2S_INFO_HEADER, BasePacket::A2S_PLAYER_HEADER, BasePacket::A2S_RULES_HEADER, BasePacket::A2S_SERVERQUERY_GETCHALLENGE_HEADER, BasePacket::C2M_CHECKMD5_HEADER, BasePacket::M2A_SERVER_BATCH_HEADER, BasePacket::RCON_GOLDSRC_CHALLENGE_HEADER, BasePacket::RCON_GOLDSRC_NO_CHALLENGE_HEADER, BasePacket::RCON_GOLDSRC_RESPONSE_HEADER, BasePacket::S2A_INFO2_HEADER, BasePacket::S2A_INFO_DETAILED_HEADER, BasePacket::S2A_PLAYER_HEADER, BasePacket::S2A_RULES_HEADER, BasePacket::S2C_CHALLENGE_HEADER, BasePacket::S2C_CONNREJECT_HEADER

Instance Method Summary collapse

Constructor Details

#initialize(region_code = Servers::MasterServer::REGION_ALL, start_ip = '0.0.0.0:0', filter = '') ⇒ A2M_GET_SERVERS_BATCH2_Packet

Creates a master server request, filtering by the given paramters

Parameters:

  • region_code (Numeric) (defaults to: Servers::MasterServer::REGION_ALL)

    The region code to filter servers by region

  • start_ip (String) (defaults to: '0.0.0.0:0')

    This should be the last IP received from the master server or 0.0.0.0

  • filter (String) (defaults to: '')

    The filters to apply in the form "\filtername\value..."


47
48
49
50
51
52
53
# File 'lib/steam-condenser/servers/packets/a2m_get_servers_batch2_packet.rb', line 47

def initialize(region_code = Servers::MasterServer::REGION_ALL, start_ip = '0.0.0.0:0', filter = '')
  super A2M_GET_SERVERS_BATCH2_HEADER

  @filter = filter
  @region_code = region_code
  @start_ip = start_ip
end

Instance Method Details

#to_sString

Returns the raw data representing this packet

Returns:

  • (String)

    A string containing the raw data of this request packet


58
59
60
# File 'lib/steam-condenser/servers/packets/a2m_get_servers_batch2_packet.rb', line 58

def to_s
  [@header_data, @region_code, @start_ip, @filter].pack('c2Z*Z*')
end