Class: S2A_RULES_Packet
- Inherits:
-
Object
- Object
- S2A_RULES_Packet
- Includes:
- SteamPacket
- Defined in:
- lib/steam/packets/s2a_rules_packet.rb
Overview
The S2A_RULES_Packet class represents the response to a A2S_RULES request send to the server.
Constant Summary
Constants included from SteamPacket
SteamPacket::A2M_GET_SERVERS_BATCH2_HEADER, SteamPacket::A2S_INFO_HEADER, SteamPacket::A2S_PLAYER_HEADER, SteamPacket::A2S_RULES_HEADER, SteamPacket::A2S_SERVERQUERY_GETCHALLENGE_HEADER, SteamPacket::C2M_CHECKMD5_HEADER, SteamPacket::M2A_SERVER_BATCH_HEADER, SteamPacket::M2C_ISVALIDMD5_HEADER, SteamPacket::M2S_REQUESTRESTART_HEADER, SteamPacket::RCON_GOLDSRC_CHALLENGE_HEADER, SteamPacket::RCON_GOLDSRC_NO_CHALLENGE_HEADER, SteamPacket::RCON_GOLDSRC_RESPONSE_HEADER, SteamPacket::S2A_INFO2_HEADER, SteamPacket::S2A_INFO_DETAILED_HEADER, SteamPacket::S2A_LOGSTRING_HEADER, SteamPacket::S2A_PLAYER_HEADER, SteamPacket::S2A_RULES_HEADER, SteamPacket::S2C_CHALLENGE_HEADER, SteamPacket::S2C_CONNREJECT_HEADER, SteamPacket::S2M_HEARTBEAT2_HEADER
Instance Attribute Summary collapse
-
#rules_hash ⇒ Object
readonly
Returns the value of attribute rules_hash.
Instance Method Summary collapse
-
#initialize(content_data) ⇒ S2A_RULES_Packet
constructor
Creates a S2A_RULES response object based on the data received.
Methods included from SteamPacket
Constructor Details
#initialize(content_data) ⇒ S2A_RULES_Packet
Creates a S2A_RULES response object based on the data received.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/steam/packets/s2a_rules_packet.rb', line 17 def initialize(content_data) raise Exception.new('Wrong formatted S2A_RULES response packet.') if content_data.nil? super SteamPacket::S2A_RULES_HEADER, content_data rules_count = @content_data.short @rules_hash = {} rules_count.times do rule = @content_data.cstring value = @content_data.cstring # This is a workaround for servers sending corrupt replies break if rule.empty? or value.empty? @rules_hash[rule] = value end end |
Instance Attribute Details
#rules_hash ⇒ Object (readonly)
Returns the value of attribute rules_hash.
14 15 16 |
# File 'lib/steam/packets/s2a_rules_packet.rb', line 14 def rules_hash @rules_hash end |