steam-condenser 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +228 -0
- data/CONTRIBUTING.md +59 -0
- data/Gemfile.lock +12 -13
- data/README.md +9 -4
- data/lib/steam-condenser/version.rb +1 -1
- data/lib/steam/community/alien_swarm/alien_swarm_mission.rb +10 -9
- data/lib/steam/community/alien_swarm/alien_swarm_stats.rb +74 -72
- data/lib/steam/community/css/css_map.rb +2 -2
- data/lib/steam/community/css/css_stats.rb +54 -56
- data/lib/steam/community/css/css_weapon.rb +4 -4
- data/lib/steam/community/game_item.rb +2 -3
- data/lib/steam/community/game_leaderboard.rb +22 -15
- data/lib/steam/community/l4d/abstract_l4d_stats.rb +64 -61
- data/lib/steam/community/l4d/l4d2_stats.rb +26 -21
- data/lib/steam/community/steam_id.rb +8 -11
- data/lib/steam/community/web_api.rb +19 -14
- data/lib/steam/packets/s2a_info2_packet.rb +16 -14
- data/lib/steam/packets/s2a_info_detailed_packet.rb +24 -19
- data/lib/steam/packets/steam_packet_factory.rb +7 -2
- data/lib/steam/servers/game_server.rb +3 -2
- data/lib/steam/servers/master_server.rb +1 -1
- data/lib/steam/sockets/source_socket.rb +4 -9
- data/pkg/steam-condenser-1.3.5.gem +0 -0
- data/pkg/steam-condenser-1.3.5/Gemfile +7 -0
- data/pkg/steam-condenser-1.3.5/Gemfile.lock +45 -0
- data/pkg/steam-condenser-1.3.5/LICENSE +25 -0
- data/pkg/steam-condenser-1.3.5/README.md +70 -0
- data/pkg/steam-condenser-1.3.5/Rakefile +46 -0
- data/pkg/steam-condenser-1.3.5/lib/core_ext/stringio.rb +91 -0
- data/pkg/steam-condenser-1.3.5/lib/errors/packet_format_error.rb +13 -0
- data/pkg/steam-condenser-1.3.5/lib/errors/rcon_ban_error.rb +22 -0
- data/pkg/steam-condenser-1.3.5/lib/errors/rcon_no_auth_error.rb +21 -0
- data/pkg/steam-condenser-1.3.5/lib/errors/steam_condenser_error.rb +26 -0
- data/pkg/steam-condenser-1.3.5/lib/errors/timeout_error.rb +28 -0
- data/pkg/steam-condenser-1.3.5/lib/errors/web_api_error.rb +57 -0
- data/pkg/steam-condenser-1.3.5/lib/steam-condenser.rb +18 -0
- data/pkg/steam-condenser-1.3.5/lib/steam-condenser/community.rb +24 -0
- data/pkg/steam-condenser-1.3.5/lib/steam-condenser/servers.rb +24 -0
- data/pkg/steam-condenser-1.3.5/lib/steam-condenser/version.rb +11 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/alien_swarm/alien_swarm_mission.rb +119 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/alien_swarm/alien_swarm_stats.rb +186 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/alien_swarm/alien_swarm_weapon.rb +49 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/app_news.rb +133 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/cacheable.rb +199 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/css/css_map.rb +61 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/css/css_stats.rb +142 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/css/css_weapon.rb +69 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/defense_grid/defense_grid_stats.rb +238 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/dods/dods_class.rb +90 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/dods/dods_stats.rb +62 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/dods/dods_weapon.rb +67 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/dota2/dota2_beta_inventory.rb +30 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/dota2/dota2_inventory.rb +30 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/dota2/dota2_item.rb +33 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/game_achievement.rb +109 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/game_class.rb +22 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/game_inventory.rb +171 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/game_item.rb +156 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/game_item_schema.rb +131 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/game_leaderboard.rb +205 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/game_leaderboard_entry.rb +43 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/game_stats.rb +175 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/game_weapon.rb +41 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/l4d/abstract_l4d_stats.rb +185 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/l4d/abstract_l4d_weapon.rb +56 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/l4d/l4d2_map.rb +90 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/l4d/l4d2_stats.rb +174 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/l4d/l4d2_weapon.rb +38 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/l4d/l4d_explosive.rb +34 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/l4d/l4d_map.rb +65 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/l4d/l4d_stats.rb +73 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/l4d/l4d_weapon.rb +26 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/portal2/portal2_inventory.rb +30 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/portal2/portal2_item.rb +55 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/portal2/portal2_stats.rb +33 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/steam_game.rb +193 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/steam_group.rb +129 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/steam_id.rb +498 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_beta_inventory.rb +28 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_class.rb +92 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_class_factory.rb +40 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_engineer.rb +43 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_golden_wrench.rb +70 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_inventory.rb +30 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_item.rb +55 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_medic.rb +35 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_sniper.rb +28 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_spy.rb +41 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/tf2/tf2_stats.rb +77 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/web_api.rb +130 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/community/xml_data.rb +27 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/a2m_get_servers_batch2_packet.rb +59 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/a2s_info_packet.rb +24 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/a2s_player_packet.rb +31 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/a2s_rules_packet.rb +32 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/a2s_serverquery_getchallenge_packet.rb +25 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/c2m_checkmd5_packet.rb +31 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/m2a_server_batch_packet.rb +52 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/m2c_isvalidmd5_packet.rb +34 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/m2s_requestrestart_packet.rb +34 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/rcon/rcon_auth_request.rb +28 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/rcon/rcon_auth_response.rb +30 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/rcon/rcon_exec_request.rb +28 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/rcon/rcon_exec_response.rb +37 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/rcon/rcon_goldsrc_request.rb +35 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/rcon/rcon_goldsrc_response.rb +34 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/rcon/rcon_packet.rb +57 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/rcon/rcon_packet_factory.rb +43 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/rcon/rcon_terminator.rb +29 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/request_with_challenge.rb +19 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/s2a_info2_packet.rb +74 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/s2a_info_base_packet.rb +25 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/s2a_info_detailed_packet.rb +59 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/s2a_logstring_packet.rb +30 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/s2a_player_packet.rb +44 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/s2a_rules_packet.rb +48 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/s2c_challenge_packet.rb +35 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/s2m_heartbeat2_packet.rb +72 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/steam_packet.rb +52 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/packets/steam_packet_factory.rb +108 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/servers/game_server.rb +392 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/servers/goldsrc_server.rb +74 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/servers/master_server.rb +188 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/servers/server.rb +115 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/servers/source_server.rb +117 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/sockets/goldsrc_socket.rb +142 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/sockets/master_server_socket.rb +34 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/sockets/rcon_socket.rb +103 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/sockets/source_socket.rb +78 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/sockets/steam_socket.rb +91 -0
- data/pkg/steam-condenser-1.3.5/lib/steam/steam_player.rb +143 -0
- data/pkg/steam-condenser-1.3.5/steam-condenser.gemspec +26 -0
- data/pkg/steam-condenser-1.3.5/test/core_ext/test_stringio.rb +59 -0
- data/pkg/steam-condenser-1.3.5/test/fixtures/invalid.xml +2 -0
- data/pkg/steam-condenser-1.3.5/test/fixtures/sonofthor.xml +882 -0
- data/pkg/steam-condenser-1.3.5/test/fixtures/status_goldsrc +3 -0
- data/pkg/steam-condenser-1.3.5/test/fixtures/status_source +3 -0
- data/pkg/steam-condenser-1.3.5/test/fixtures/valve-members.xml +231 -0
- data/pkg/steam-condenser-1.3.5/test/helper.rb +48 -0
- data/pkg/steam-condenser-1.3.5/test/steam/community/test_cacheable.rb +100 -0
- data/pkg/steam-condenser-1.3.5/test/steam/community/test_steam_group.rb +83 -0
- data/pkg/steam-condenser-1.3.5/test/steam/community/test_steam_id.rb +144 -0
- data/pkg/steam-condenser-1.3.5/test/steam/community/test_web_api.rb +98 -0
- data/pkg/steam-condenser-1.3.5/test/steam/packets/test_steam_packet.rb +37 -0
- data/pkg/steam-condenser-1.3.5/test/steam/servers/test_game_server.rb +296 -0
- data/pkg/steam-condenser-1.3.5/test/steam/servers/test_goldsrc_server.rb +59 -0
- data/pkg/steam-condenser-1.3.5/test/steam/servers/test_master_server.rb +131 -0
- data/pkg/steam-condenser-1.3.5/test/steam/servers/test_server.rb +72 -0
- data/pkg/steam-condenser-1.3.5/test/steam/servers/test_source_server.rb +134 -0
- data/pkg/steam-condenser-1.3.5/test/steam/sockets/test_goldsrc_socket.rb +127 -0
- data/pkg/steam-condenser-1.3.5/test/steam/sockets/test_master_server_socket.rb +42 -0
- data/pkg/steam-condenser-1.3.5/test/steam/sockets/test_rcon_socket.rb +118 -0
- data/pkg/steam-condenser-1.3.5/test/steam/sockets/test_source_socket.rb +77 -0
- data/pkg/steam-condenser-1.3.5/test/steam/sockets/test_steam_socket.rb +97 -0
- data/steam-condenser.gemspec +2 -3
- data/test/steam/community/test_cacheable.rb +3 -0
- data/test/steam/community/test_web_api.rb +15 -2
- data/test/steam/packets/test_steam_packet.rb +1 -1
- data/test/steam/sockets/test_source_socket.rb +1 -1
- metadata +151 -27
@@ -169,11 +169,11 @@ class SteamId
|
|
169
169
|
def self.steam_id_to_community_id(steam_id)
|
170
170
|
if steam_id == 'STEAM_ID_LAN' || steam_id == 'BOT'
|
171
171
|
raise SteamCondenserError, "Cannot convert SteamID \"#{steam_id}\" to a community ID."
|
172
|
-
elsif steam_id =~ /^STEAM_[0-1]:[0-1]:[0-9]
|
173
|
-
steam_id =
|
172
|
+
elsif steam_id =~ /^STEAM_[0-1]:([0-1]:[0-9]+)$/
|
173
|
+
steam_id = $1.split(':').map! { |s| s.to_i }
|
174
174
|
steam_id[0] + steam_id[1] * 2 + 76561197960265728
|
175
|
-
elsif steam_id =~
|
176
|
-
steam_id =
|
175
|
+
elsif steam_id =~ /^\[U:([0-1]:[0-9]+)\]$/
|
176
|
+
steam_id = $1.split(':').map { |s| s.to_i }
|
177
177
|
steam_id[0] + steam_id[1] + 76561197960265727
|
178
178
|
else
|
179
179
|
raise SteamCondenserError, "SteamID \"#{steam_id}\" doesn't have the correct format."
|
@@ -305,9 +305,8 @@ class SteamId
|
|
305
305
|
# @see #initialize
|
306
306
|
def fetch_friends
|
307
307
|
friends_data = parse "#{base_url}/friends?xml=1"
|
308
|
-
@friends = []
|
309
|
-
|
310
|
-
@friends << SteamId.new(friend.to_i, false)
|
308
|
+
@friends = friends_data['friends']['friend'].map do |friend|
|
309
|
+
SteamId.new friend.to_i, false
|
311
310
|
end
|
312
311
|
end
|
313
312
|
|
@@ -449,8 +448,7 @@ class SteamId
|
|
449
448
|
# @return [Fixnum] The number of minutes this user played the given game in
|
450
449
|
# the last two weeks
|
451
450
|
def recent_playtime(id)
|
452
|
-
|
453
|
-
@recent_playtimes[game.app_id]
|
451
|
+
@recent_playtimes[find_game(id).app_id]
|
454
452
|
end
|
455
453
|
|
456
454
|
# Returns the total time in minutes this user has played this game
|
@@ -460,8 +458,7 @@ class SteamId
|
|
460
458
|
# @return [Fixnum] The total number of minutes this user played the given
|
461
459
|
# game
|
462
460
|
def total_playtime(id)
|
463
|
-
|
464
|
-
@total_playtimes[game.app_id]
|
461
|
+
@total_playtimes[find_game(id).app_id]
|
465
462
|
end
|
466
463
|
|
467
464
|
private
|
@@ -18,6 +18,8 @@ module WebApi
|
|
18
18
|
|
19
19
|
@@api_key = nil
|
20
20
|
|
21
|
+
@@secure = true
|
22
|
+
|
21
23
|
# Returns the Steam Web API key currently used by Steam Condenser
|
22
24
|
#
|
23
25
|
# @return [String] The currently active Steam Web API key
|
@@ -39,6 +41,13 @@ module WebApi
|
|
39
41
|
@@api_key = api_key
|
40
42
|
end
|
41
43
|
|
44
|
+
# Sets whether HTTPS should be used for the communication with the Web API
|
45
|
+
#
|
46
|
+
# @param [Boolean] secure Whether to use HTTPS
|
47
|
+
def self.secure=(secure)
|
48
|
+
@@secure = !!secure
|
49
|
+
end
|
50
|
+
|
42
51
|
# Returns a raw list of interfaces and their methods that are available in
|
43
52
|
# Steam's Web API
|
44
53
|
#
|
@@ -63,8 +72,8 @@ module WebApi
|
|
63
72
|
# HTTP GET
|
64
73
|
# @raise [WebApiError] if the request to Steam's Web API fails
|
65
74
|
# @return [String] The raw JSON data replied to the request
|
66
|
-
def self.json(interface, method, version = 1, params =
|
67
|
-
get
|
75
|
+
def self.json(interface, method, version = 1, params = {})
|
76
|
+
get :json, interface, method, version, params
|
68
77
|
end
|
69
78
|
|
70
79
|
# Fetches JSON data from Steam Web API using the specified interface, method
|
@@ -79,8 +88,8 @@ module WebApi
|
|
79
88
|
# HTTP GET
|
80
89
|
# @raise [WebApiError] if the request to Steam's Web API fails
|
81
90
|
# @return [Hash<Symbol, Object>] The JSON data replied to the request
|
82
|
-
def self.json!(interface, method, version = 1, params =
|
83
|
-
data = json
|
91
|
+
def self.json!(interface, method, version = 1, params = {})
|
92
|
+
data = json interface, method, version, params
|
84
93
|
result = MultiJson.load(data, { :symbolize_keys => true })[:result]
|
85
94
|
|
86
95
|
status = result[:status]
|
@@ -105,20 +114,16 @@ module WebApi
|
|
105
114
|
# HTTP GET
|
106
115
|
# @raise [WebApiError] if the request to Steam's Web API fails
|
107
116
|
# @return [String] The data as replied by the Web API in the desired format
|
108
|
-
def self.get(format, interface, method, version = 1, params =
|
117
|
+
def self.get(format, interface, method, version = 1, params = {})
|
109
118
|
version = version.to_s.rjust(4, '0')
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
unless params.nil? && params.empty?
|
116
|
-
url += '?' + params.map { |k,v| "#{k}=#{v}" }.join('&')
|
117
|
-
end
|
119
|
+
params = { :format => format, :key => WebApi.api_key }.merge params
|
120
|
+
protocol = @@secure ? 'https' : 'http'
|
121
|
+
url = "#{protocol}://api.steampowered.com/#{interface}/#{method}/v#{version}/" +
|
122
|
+
'?' + params.map { |k,v| "#{k}=#{v}" }.join('&')
|
118
123
|
|
119
124
|
begin
|
120
125
|
puts "Querying Steam Web API: #{url.gsub(@@api_key, 'SECRET')}" if $DEBUG
|
121
|
-
open(url, {
|
126
|
+
open(url, { 'Content-Type' => 'application/x-www-form-urlencoded' ,:proxy => true }).read
|
122
127
|
rescue OpenURI::HTTPError
|
123
128
|
status = $!.io.status[0]
|
124
129
|
status = [status, ''] unless status.is_a? Array
|
@@ -30,20 +30,22 @@ class S2A_INFO2_Packet
|
|
30
30
|
def initialize(data)
|
31
31
|
super S2A_INFO2_HEADER, data
|
32
32
|
|
33
|
-
info
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
33
|
+
info.merge!({
|
34
|
+
:protocol_version => @content_data.byte,
|
35
|
+
:server_name => @content_data.cstring,
|
36
|
+
:map_name => @content_data.cstring,
|
37
|
+
:game_directory => @content_data.cstring,
|
38
|
+
:game_description => @content_data.cstring,
|
39
|
+
:app_id => @content_data.short,
|
40
|
+
:number_of_players => @content_data.byte,
|
41
|
+
:max_players => @content_data.byte,
|
42
|
+
:number_of_bots => @content_data.byte,
|
43
|
+
:dedicated => @content_data.byte.chr,
|
44
|
+
:operating_system => @content_data.byte.chr,
|
45
|
+
:password_needed => @content_data.byte == 1,
|
46
|
+
:secure => @content_data.byte == 1,
|
47
|
+
:game_version => @content_data.cstring
|
48
|
+
})
|
47
49
|
|
48
50
|
if @content_data.remaining > 0
|
49
51
|
extra_data_flag = @content_data.byte
|
@@ -24,29 +24,34 @@ class S2A_INFO_DETAILED_Packet
|
|
24
24
|
def initialize(data)
|
25
25
|
super S2A_INFO_DETAILED_HEADER, data
|
26
26
|
|
27
|
-
info
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
27
|
+
info.merge!({
|
28
|
+
:game_ip => @content_data.cstring,
|
29
|
+
:server_name => @content_data.cstring,
|
30
|
+
:map_name => @content_data.cstring,
|
31
|
+
:game_directory => @content_data.cstring,
|
32
|
+
:game_description => @content_data.cstring,
|
33
|
+
:number_of_players => @content_data.byte,
|
34
|
+
:max_players => @content_data.byte,
|
35
|
+
:network_version => @content_data.byte,
|
36
|
+
:dedicated => @content_data.byte.chr,
|
37
|
+
:operating_system => @content_data.byte.chr,
|
38
|
+
:password_needed => @content_data.byte == 1,
|
39
|
+
:is_mod => @content_data.byte == 1
|
40
|
+
})
|
39
41
|
|
40
42
|
if info[:is_mod]
|
41
|
-
info[:mod_info] = {
|
42
|
-
|
43
|
-
|
43
|
+
info[:mod_info] = {
|
44
|
+
:url_info => @content_data.cstring,
|
45
|
+
:url_dl => @content_data.cstring
|
46
|
+
}
|
44
47
|
@content_data.byte
|
45
48
|
if @content_data.remaining == 12
|
46
|
-
info[:mod_info]
|
47
|
-
|
48
|
-
|
49
|
-
|
49
|
+
info[:mod_info].merge!({
|
50
|
+
:mod_version => @content_data.long,
|
51
|
+
:mod_size => @content_data.long,
|
52
|
+
:sv_only => @content_data.byte == 1,
|
53
|
+
:cl_dll => @content_data.byte == 1,
|
54
|
+
})
|
50
55
|
info[:secure] = @content_data.byte == 1
|
51
56
|
info[:number_of_bots] = @content_data.byte
|
52
57
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under
|
2
2
|
# the terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2008-
|
4
|
+
# Copyright (c) 2008-2013, Sebastian Staudt
|
5
5
|
|
6
|
-
require 'bzip2-ruby'
|
7
6
|
require 'zlib'
|
8
7
|
|
9
8
|
require 'errors/packet_format_error'
|
@@ -95,6 +94,12 @@ module SteamPacketFactory
|
|
95
94
|
packet_data = split_packets.join ''
|
96
95
|
|
97
96
|
if is_compressed
|
97
|
+
begin
|
98
|
+
require 'bzip2-ruby'
|
99
|
+
rescue LoadError
|
100
|
+
raise SteamCondenserError, 'The "bzip2-ruby" gem is not installed. Please install it, if you want to query Source servers sending compressed packets.'
|
101
|
+
end
|
102
|
+
|
98
103
|
packet_data = Bzip2.decompress packet_data
|
99
104
|
|
100
105
|
unless Zlib.crc32(packet_data) == packet_checksum
|
@@ -279,8 +279,9 @@ module GameServer
|
|
279
279
|
|
280
280
|
players.each do |player|
|
281
281
|
player_data = GameServer.split_player_status(attributes, player)
|
282
|
-
|
283
|
-
|
282
|
+
player_name = player_data[:name]
|
283
|
+
if @player_hash.key? player_name
|
284
|
+
@player_hash[player_name].add_info player_data
|
284
285
|
end
|
285
286
|
end
|
286
287
|
end
|
@@ -26,7 +26,7 @@ class MasterServer
|
|
26
26
|
@@retries = 3
|
27
27
|
|
28
28
|
# The master server address to query for GoldSrc game servers
|
29
|
-
GOLDSRC_MASTER_SERVER = 'hl1master.steampowered.com',
|
29
|
+
GOLDSRC_MASTER_SERVER = 'hl1master.steampowered.com', 27011
|
30
30
|
|
31
31
|
# The master server address to query for Source game servers
|
32
32
|
SOURCE_MASTER_SERVER = 'hl2master.steampowered.com', 27011
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under
|
2
2
|
# the terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2008-
|
4
|
+
# Copyright (c) 2008-2013, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'core_ext/stringio'
|
7
7
|
require 'errors/timeout_error'
|
@@ -26,6 +26,7 @@ class SourceSocket
|
|
26
26
|
def reply
|
27
27
|
receive_packet 1400
|
28
28
|
is_compressed = false
|
29
|
+
packet_checksum = 0
|
29
30
|
|
30
31
|
if @buffer.long == 0xFFFFFFFE
|
31
32
|
split_packets = []
|
@@ -46,22 +47,16 @@ class SourceSocket
|
|
46
47
|
|
47
48
|
puts "Received packet #{packet_number} of #{packet_count} for request ##{request_id}" if $DEBUG
|
48
49
|
|
50
|
+
bytes_read = 0
|
49
51
|
if split_packets.size < packet_count
|
50
52
|
begin
|
51
53
|
bytes_read = receive_packet
|
52
54
|
rescue SteamCondenser::TimeoutError
|
53
|
-
bytes_read = 0
|
54
55
|
end
|
55
|
-
else
|
56
|
-
bytes_read = 0
|
57
56
|
end
|
58
57
|
end while bytes_read > 0 && @buffer.long == 0xFFFFFFFE
|
59
58
|
|
60
|
-
|
61
|
-
packet = SteamPacketFactory.reassemble_packet(split_packets, true, packet_checksum)
|
62
|
-
else
|
63
|
-
packet = SteamPacketFactory.reassemble_packet(split_packets)
|
64
|
-
end
|
59
|
+
packet = SteamPacketFactory.reassemble_packet(split_packets, is_compressed, packet_checksum)
|
65
60
|
else
|
66
61
|
packet = SteamPacketFactory.packet_from_data(@buffer.get)
|
67
62
|
end
|
Binary file
|
@@ -0,0 +1,45 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
steam-condenser (1.3.6)
|
5
|
+
multi_json (~> 1.7.2)
|
6
|
+
multi_xml (~> 0.5.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
colorize (0.5.8)
|
12
|
+
coveralls (0.6.7)
|
13
|
+
colorize
|
14
|
+
multi_json (~> 1.3)
|
15
|
+
rest-client
|
16
|
+
simplecov (>= 0.7)
|
17
|
+
thor
|
18
|
+
metaclass (0.0.1)
|
19
|
+
mime-types (1.23)
|
20
|
+
mocha (0.13.3)
|
21
|
+
metaclass (~> 0.0.1)
|
22
|
+
multi_json (1.7.3)
|
23
|
+
multi_xml (0.5.3)
|
24
|
+
rake (10.0.4)
|
25
|
+
rest-client (1.6.7)
|
26
|
+
mime-types (>= 1.16)
|
27
|
+
shoulda-context (1.1.1)
|
28
|
+
simplecov (0.7.1)
|
29
|
+
multi_json (~> 1.0)
|
30
|
+
simplecov-html (~> 0.7.1)
|
31
|
+
simplecov-html (0.7.1)
|
32
|
+
thor (0.18.1)
|
33
|
+
yard (0.8.6.1)
|
34
|
+
|
35
|
+
PLATFORMS
|
36
|
+
java
|
37
|
+
ruby
|
38
|
+
|
39
|
+
DEPENDENCIES
|
40
|
+
coveralls
|
41
|
+
mocha (~> 0.13.0)
|
42
|
+
rake (~> 10.0.1)
|
43
|
+
shoulda-context (~> 1.1.1)
|
44
|
+
steam-condenser!
|
45
|
+
yard (~> 0.8.0)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Copyright (c) 2008-2013, Sebastian Staudt
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
8
|
+
this list of conditions and the following disclaimer.
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
* Neither the name of the author nor the names of its contributors
|
13
|
+
may be used to endorse or promote products derived from this software
|
14
|
+
without specific prior written permission.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
20
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
22
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
23
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,70 @@
|
|
1
|
+
Steam Condenser
|
2
|
+
===============
|
3
|
+
|
4
|
+
[![Build Status](https://secure.travis-ci.org/koraktor/steam-condenser-ruby.png)](http://travis-ci.org/koraktor/steam-condenser-ruby) [![Dependency Status](https://gemnasium.com/koraktor/steam-condenser-ruby.png)](https://gemnasium.com/koraktor/steam-condenser-ruby) [![Code Climate](https://codeclimate.com/github/koraktor/steam-condenser-ruby.png)](https://codeclimate.com/github/koraktor/steam-condenser-ruby) [![Coverage Status](https://coveralls.io/repos/koraktor/steam-condenser-ruby/badge.png?branch=master)](https://coveralls.io/r/koraktor/steam-condenser-ruby)
|
5
|
+
|
6
|
+
The Steam Condenser is a multi-language library for querying the Steam
|
7
|
+
Community, Source and GoldSrc game servers as well as the Steam master servers.
|
8
|
+
Currently it is implemented in Java, PHP and Ruby.
|
9
|
+
|
10
|
+
## Requirements
|
11
|
+
|
12
|
+
* Ruby 1.8.7 or newer (and compatible Ruby VMs)
|
13
|
+
* Any operating system able to run such a VM
|
14
|
+
|
15
|
+
The following gems are required:
|
16
|
+
|
17
|
+
* `bzip2-ruby` (for Source servers sending compressed responses)
|
18
|
+
* `multi_json` (for the Web API features)
|
19
|
+
* `multi_xml` (for the Steam Community features)
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
To install Steam Condenser as a Ruby gem use the following command:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ gem install steam-condenser
|
27
|
+
```
|
28
|
+
|
29
|
+
If you're projet dependencies are managed by [Bundler](http://gembundler.com)
|
30
|
+
add this to your `Gemfile`:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
gem 'steam-condenser'
|
34
|
+
```
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
To start using Steam Condenser requiring the base file is usually enough:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
require 'steam-condenser'
|
42
|
+
```
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
This code is free software; you can redistribute it and/or modify it under the
|
47
|
+
terms of the new BSD License. A copy of this license can be found in the
|
48
|
+
included LICENSE file.
|
49
|
+
|
50
|
+
## Credits
|
51
|
+
|
52
|
+
* Sebastian Staudt – koraktor(at)gmail.com
|
53
|
+
* DeFirence – defirence(at)defirence.za.net
|
54
|
+
* Mike Połtyn – mike(at)railslove.com
|
55
|
+
* Sam Kinard – snkinard(at)gmail.com
|
56
|
+
* "withgod" – noname(at)withgod.jp
|
57
|
+
* John Amicangelo - amicangelo.j(at)husky.neu.edu
|
58
|
+
* Eric Litak – elitak(at)gmail.com
|
59
|
+
|
60
|
+
## See Also
|
61
|
+
|
62
|
+
* [Steam Condenser home](https://koraktor.de/steam-condenser)
|
63
|
+
* [Documentation](http://rubydoc.info/gems/steam-condenser)
|
64
|
+
* [GitHub project page](https://github.com/koraktor/steam-condenser)
|
65
|
+
* [Wiki](https://github.com/koraktor/steam-condenser/wiki)
|
66
|
+
* [Google group](http://groups.google.com/group/steam-condenser)
|
67
|
+
* [Ohloh profile](http://www.ohloh.net/projects/steam-condenser)
|
68
|
+
|
69
|
+
Follow Steam Condenser on Twitter
|
70
|
+
[@steamcondenser](http://twitter.com/steamcondenser).
|