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
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# This code is free software; you can redistribute it and/or modify it under
|
4
|
+
# the terms of the new BSD License.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008-2012, Sebastian Staudt
|
7
|
+
|
8
|
+
require 'rake/testtask'
|
9
|
+
require 'rubygems/package_task'
|
10
|
+
|
11
|
+
task :default => :test
|
12
|
+
|
13
|
+
Gem::PackageTask.new Gem::Specification.load 'steam-condenser.gemspec' do |pkg|
|
14
|
+
end
|
15
|
+
|
16
|
+
# Rake task for running the test suite
|
17
|
+
Rake::TestTask.new do |t|
|
18
|
+
t.libs << 'lib' << 'test'
|
19
|
+
t.test_files = Dir.glob 'test/**/test_*.rb'
|
20
|
+
t.verbose = true
|
21
|
+
end
|
22
|
+
|
23
|
+
# Check if YARD is installed
|
24
|
+
begin
|
25
|
+
require 'yard'
|
26
|
+
|
27
|
+
# Create a rake task +:doc+ to build the documentation using YARD
|
28
|
+
YARD::Rake::YardocTask.new do |yardoc|
|
29
|
+
yardoc.name = 'doc'
|
30
|
+
yardoc.files = [ 'lib/steam/community/cacheable.rb', 'lib/**/*.rb', 'LICENSE', 'README.md' ]
|
31
|
+
yardoc.options = [ '--private', '--title', 'Metior — API Documentation' ]
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
# Create a rake task +:doc+ to show that YARD is not installed
|
35
|
+
desc 'Generate YARD Documentation (not available)'
|
36
|
+
task :doc do
|
37
|
+
$stderr.puts 'You need YARD to build the documentation. Install it using `gem install yard`.'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Task for cleaning documentation and package directories
|
42
|
+
desc 'Clean documentation and package directories'
|
43
|
+
task :clean do
|
44
|
+
FileUtils.rm_rf 'doc'
|
45
|
+
FileUtils.rm_rf 'pkg'
|
46
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2010-2011, Sebastian Staudt
|
5
|
+
|
6
|
+
require 'stringio'
|
7
|
+
|
8
|
+
# This extends the `StringIO` class from Ruby's standard library. It adds some
|
9
|
+
# methods to handle byte-wise input from a `StringIO` object.
|
10
|
+
#
|
11
|
+
# @author Sebastian Staudt
|
12
|
+
class StringIO
|
13
|
+
|
14
|
+
# Creates a new instance of `StringIO` with the given size and fills it with
|
15
|
+
# zero-bytes.
|
16
|
+
#
|
17
|
+
# @param [Fixnum] size The size the new instance should have
|
18
|
+
# @return [StringIO] A new `StringIO` instance with the given size, filled
|
19
|
+
# with zero-bytes
|
20
|
+
def self.alloc(size)
|
21
|
+
new "\0" * size
|
22
|
+
end
|
23
|
+
|
24
|
+
# Reads a single byte from the current position of the byte stream
|
25
|
+
#
|
26
|
+
# @return [Fixnum] The numeric value of the byte at the current position
|
27
|
+
def byte
|
28
|
+
read(1)[0].ord
|
29
|
+
end
|
30
|
+
|
31
|
+
# Reads a floating-point integer (32 bit) from the current position of the
|
32
|
+
# byte stream
|
33
|
+
#
|
34
|
+
# @return [Float] The floating-point integer read from the byte stream
|
35
|
+
def float
|
36
|
+
read(4).unpack('e')[0]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Reads the whole remaining content of the byte stream from the current
|
40
|
+
# position to the end
|
41
|
+
#
|
42
|
+
# @return [String] The remainder of the byte stream starting from the current
|
43
|
+
# position of the byte stream
|
44
|
+
def get
|
45
|
+
read remaining
|
46
|
+
end
|
47
|
+
|
48
|
+
# Reads an unsigned long integer (32 bit) from the current position of the
|
49
|
+
# byte stream
|
50
|
+
#
|
51
|
+
# @return [Fixnum] The unsigned long integer read from the byte stream
|
52
|
+
def long
|
53
|
+
read(4).unpack('V')[0]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns the remaining number of bytes from the current position to the end
|
57
|
+
# of the byte stream
|
58
|
+
#
|
59
|
+
# @return [Fixnum] The number of bytes until the end of the stream
|
60
|
+
def remaining
|
61
|
+
size - pos
|
62
|
+
end
|
63
|
+
|
64
|
+
# Reads an unsigned short integer (16 bit) from the current position of the
|
65
|
+
# byte stream
|
66
|
+
#
|
67
|
+
# @return [Fixnum] The unsigned short integer read from the byte stream
|
68
|
+
def short
|
69
|
+
read(2).unpack('v')[0]
|
70
|
+
end
|
71
|
+
|
72
|
+
# Reads a signed long integer (32 bit) from the current position of the byte
|
73
|
+
# stream
|
74
|
+
#
|
75
|
+
# @return [Fixnum] The signed long integer read from the byte stream
|
76
|
+
def signed_long
|
77
|
+
read(4).unpack('l')[0]
|
78
|
+
end
|
79
|
+
|
80
|
+
# Reads a zero-byte terminated string from the current position of the byte
|
81
|
+
# stream
|
82
|
+
#
|
83
|
+
# This reads the stream up until the first occurance of a zero-byte or the
|
84
|
+
# end of the stream. The zero-byte is not included in the returned string.
|
85
|
+
#
|
86
|
+
# @return [String] The zero-byte terminated string read from the byte stream
|
87
|
+
def cstring
|
88
|
+
gets("\0")[0..-2]
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2008-2011, Sebastian Staudt
|
5
|
+
|
6
|
+
require 'errors/steam_condenser_error'
|
7
|
+
|
8
|
+
# This error class indicates a problem when parsing packet data from the
|
9
|
+
# responses received from a game or master server
|
10
|
+
#
|
11
|
+
# @author Sebastian Staudt
|
12
|
+
class PacketFormatError < SteamCondenserError
|
13
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2009-2011, Sebastian Staudt
|
5
|
+
|
6
|
+
require 'errors/steam_condenser_error'
|
7
|
+
|
8
|
+
# This error class indicates that the IP address your accessing the game server
|
9
|
+
# from has been banned by the server
|
10
|
+
#
|
11
|
+
# You or the server operator will have to unban your IP address on the server.
|
12
|
+
#
|
13
|
+
# @author Sebastian Staudt
|
14
|
+
# @see GameServer#rcon_auth
|
15
|
+
class RCONBanError < SteamCondenserError
|
16
|
+
|
17
|
+
# Creates a new `RCONBanError` instance
|
18
|
+
def initialize
|
19
|
+
super 'You have been banned from this server.'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2008-2011, Sebastian Staudt
|
5
|
+
|
6
|
+
require 'errors/steam_condenser_error'
|
7
|
+
|
8
|
+
# This error class indicates that you have not authenticated yet with the game
|
9
|
+
# server you're trying to send commands via RCON
|
10
|
+
#
|
11
|
+
# @author Sebastian Staudt
|
12
|
+
# @see GameServer#rcon_auth
|
13
|
+
# @see GameServer#rcon_exec
|
14
|
+
class RCONNoAuthError < SteamCondenserError
|
15
|
+
|
16
|
+
# Creates a new `RCONNoAuthError` instance
|
17
|
+
def initialize
|
18
|
+
super 'Not authenticated yet.'
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2008-2013, Sebastian Staudt
|
5
|
+
|
6
|
+
# This error class is used as a base class for all errors related to Steam
|
7
|
+
# Condenser's operation
|
8
|
+
#
|
9
|
+
# @author Sebastian Staudt
|
10
|
+
class SteamCondenserError < StandardError
|
11
|
+
|
12
|
+
# Returns the exception that caused this error
|
13
|
+
#
|
14
|
+
# @return [Exception] The exception that caused this error
|
15
|
+
attr_reader :cause
|
16
|
+
|
17
|
+
# Creates a new `SteamCondenserError` instance
|
18
|
+
#
|
19
|
+
# @param [String] message The message to attach to the error
|
20
|
+
# @param [Exception] cause The exception that caused this error
|
21
|
+
def initialize(message, cause = nil)
|
22
|
+
super message
|
23
|
+
@cause = cause
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2008-2011, Sebastian Staudt
|
5
|
+
|
6
|
+
require 'errors/steam_condenser_error'
|
7
|
+
|
8
|
+
module SteamCondenser
|
9
|
+
|
10
|
+
# This error class indicates that an operation could not be finished within a
|
11
|
+
# reasonable amount of time
|
12
|
+
#
|
13
|
+
# This usually indicates that a server could not be contacted because of
|
14
|
+
# network problems.
|
15
|
+
#
|
16
|
+
# @author Sebastian Staudt
|
17
|
+
# @note {SteamSocket.timeout=} allows to set a custom timeout for socket
|
18
|
+
# operations
|
19
|
+
class TimeoutError < SteamCondenserError
|
20
|
+
|
21
|
+
# Creates a new `TimeoutError` instance
|
22
|
+
def initialize
|
23
|
+
super 'The operation timed out.'
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2011, Sebastian Staudt
|
5
|
+
|
6
|
+
require 'errors/steam_condenser_error'
|
7
|
+
|
8
|
+
# This error is raised when a Steam Web API request or a related action fails.
|
9
|
+
# This can have various reasons like an invalid Web API key or a broken
|
10
|
+
# request.
|
11
|
+
#
|
12
|
+
# @author Sebastian Staudt
|
13
|
+
# @see WebApi
|
14
|
+
class WebApiError < SteamCondenserError
|
15
|
+
|
16
|
+
# Creates a new `WebApiError` with an error message according to the given
|
17
|
+
# `cause`. If this cause is `:status_bad` (which will origin from the Web API
|
18
|
+
# itself) or `:http_error` the details about this failed request will be
|
19
|
+
# taken from `status_code` and `status_message`.
|
20
|
+
#
|
21
|
+
# @param [:http_error, :invalid_key, :status_bad, :unauthorized] cause A
|
22
|
+
# symbolic name for the problem which caused this error:
|
23
|
+
#
|
24
|
+
# * `:http_error`: An error during the HTTP request itself will result
|
25
|
+
# in an error with this reason.
|
26
|
+
# * `:invalid_key`: This occurs when trying to set a Web API key that
|
27
|
+
# isn't valid, i.e. a 128 bit integer in a hexadecimal string.
|
28
|
+
# * `:status_bad`: This is caused by a successful request that fails
|
29
|
+
# for some Web API internal reason (e.g. an invalid argument).
|
30
|
+
# Details about this failed request will be taken from `status_code`
|
31
|
+
# and `status_message`.
|
32
|
+
# * `:unauthorized`: This happens when a Steam Web API request is
|
33
|
+
# rejected as unauthorized. This most likely means that you did not
|
34
|
+
# specify a valid Web API key using {WebApi.api_key=}. A Web API key
|
35
|
+
# can be obtained from http://steamcommunity.com/dev/apikey.
|
36
|
+
#
|
37
|
+
# Other undefined reasons will cause a generic error message.
|
38
|
+
# @param [Fixnum] status_code The HTTP status code returned by the Web API
|
39
|
+
# @param [String] status_message The status message returned in the response
|
40
|
+
def initialize(cause, status_code = nil, status_message = '')
|
41
|
+
case cause
|
42
|
+
when :http_error then
|
43
|
+
message = "The Web API request has failed due to an HTTP error: #{status_message} (status code: #{status_code})."
|
44
|
+
when :invalid_key then
|
45
|
+
message = 'This is not a valid Steam Web API key.'
|
46
|
+
when :status_bad then
|
47
|
+
message = "The Web API request failed with the following error: #{status_message} (status code: #{status_code})."
|
48
|
+
when :unauthorized then
|
49
|
+
message = 'Your Web API request has been rejected. You most likely did not specify a valid Web API key.'
|
50
|
+
else
|
51
|
+
message = 'An unexpected error occured while executing a Web API request.'
|
52
|
+
end
|
53
|
+
|
54
|
+
super message
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2009-2011, Sebastian Staudt
|
5
|
+
|
6
|
+
# This module is used as a wrapper around Steam Condenser's classes
|
7
|
+
#
|
8
|
+
# It does not provide any own functionality, but this file is used as an entry
|
9
|
+
# point when using the gem (i.e. +require 'steam-condenser').
|
10
|
+
#
|
11
|
+
# @author Sebastian Staudt
|
12
|
+
module SteamCondenser
|
13
|
+
|
14
|
+
require 'steam-condenser/community'
|
15
|
+
require 'steam-condenser/servers'
|
16
|
+
require 'steam-condenser/version'
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2010-2011, Sebastian Staudt
|
5
|
+
|
6
|
+
module SteamCondenser
|
7
|
+
|
8
|
+
require 'steam-condenser/version'
|
9
|
+
|
10
|
+
# This module is used as a wrapper around Steam Condenser's Steam Community
|
11
|
+
# classes
|
12
|
+
#
|
13
|
+
# It does not provide any own functionality, but this file is used to easily
|
14
|
+
# require classes to interact with the Steam Community
|
15
|
+
#
|
16
|
+
# @author Sebastian Staudt
|
17
|
+
module Community
|
18
|
+
|
19
|
+
require 'steam/community/steam_id'
|
20
|
+
require 'steam/community/web_api'
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2010-2011, Sebastian Staudt
|
5
|
+
|
6
|
+
module SteamCondenser
|
7
|
+
|
8
|
+
require 'steam-condenser/version'
|
9
|
+
|
10
|
+
# This module is used as a wrapper around Steam Condenser's server classes
|
11
|
+
#
|
12
|
+
# It does not provide any own functionality, but this file is used to easily
|
13
|
+
# require classes to interact with servers
|
14
|
+
#
|
15
|
+
# @author Sebastian Staudt
|
16
|
+
module Servers
|
17
|
+
|
18
|
+
require 'steam/servers/goldsrc_server'
|
19
|
+
require 'steam/servers/master_server'
|
20
|
+
require 'steam/servers/source_server'
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2010-2013, Sebastian Staudt
|
5
|
+
|
6
|
+
module SteamCondenser
|
7
|
+
|
8
|
+
# The current version of Steam Condenser
|
9
|
+
VERSION = '1.3.5'
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2010-2011, Sebastian Staudt
|
5
|
+
|
6
|
+
# This class holds statistical information about missions played by a player in
|
7
|
+
# Alien Swarm
|
8
|
+
#
|
9
|
+
# @author Sebastian Staudt
|
10
|
+
class AlienSwarmMission
|
11
|
+
|
12
|
+
# Returns the avarage damage taken by the player while playing a round in
|
13
|
+
# this mission
|
14
|
+
#
|
15
|
+
# @return [Float] The average damage taken by the player
|
16
|
+
attr_reader :avg_damage_taken
|
17
|
+
|
18
|
+
# Returns the avarage damage dealt by the player to team mates while playing
|
19
|
+
# a round in this mission
|
20
|
+
#
|
21
|
+
# @return [Float] The average damage dealt by the player to team mates
|
22
|
+
attr_reader :avg_friendly_fire
|
23
|
+
|
24
|
+
# Returns the avarage number of aliens killed by the player while playing a
|
25
|
+
# round in this mission
|
26
|
+
#
|
27
|
+
# @return [Float] The avarage number of aliens killed by the player
|
28
|
+
attr_reader :avg_kills
|
29
|
+
|
30
|
+
# Returns the highest difficulty the player has beat this mission in
|
31
|
+
#
|
32
|
+
# @return [String] The highest difficulty the player has beat this mission in
|
33
|
+
attr_reader :best_difficulty
|
34
|
+
|
35
|
+
# Returns the total damage taken by the player in this mission
|
36
|
+
#
|
37
|
+
# @return [Fixnum] The total damage taken by the player
|
38
|
+
attr_reader :damage_taken
|
39
|
+
|
40
|
+
# Returns the total damage dealt by the player to team mates in this mission
|
41
|
+
#
|
42
|
+
# @return [Fixnum] The total damage dealt by the player to team mates
|
43
|
+
attr_reader :friendly_fire
|
44
|
+
|
45
|
+
# Returns the number of successful rounds the player played in this mission
|
46
|
+
#
|
47
|
+
# @return [Fixnum] The number of successful rounds of this mission
|
48
|
+
attr_reader :games_successful
|
49
|
+
|
50
|
+
# Returns the URL to a image displaying the mission
|
51
|
+
#
|
52
|
+
# @return [String] The URL of the mission's image
|
53
|
+
attr_reader :img
|
54
|
+
|
55
|
+
# Returns the total number of aliens killed by the player in this mission
|
56
|
+
#
|
57
|
+
# @return [Fixnum] The total number of aliens killed by the player
|
58
|
+
attr_reader :kills
|
59
|
+
|
60
|
+
# Returns the file name of the mission's map
|
61
|
+
#
|
62
|
+
# @return [String] The file name of the mission's map
|
63
|
+
attr_reader :map_name
|
64
|
+
|
65
|
+
# Returns the name of the mission
|
66
|
+
#
|
67
|
+
# @return [String] The name of the mission
|
68
|
+
attr_reader :name
|
69
|
+
|
70
|
+
# Returns various statistics about the times needed to accomplish this
|
71
|
+
# mission
|
72
|
+
#
|
73
|
+
# This includes the best times for each difficulty, the average time and the
|
74
|
+
# total time spent in this mission.
|
75
|
+
#
|
76
|
+
# @return [Hash<Symbol, String>] Various time statistics about this mission
|
77
|
+
attr_reader :time
|
78
|
+
|
79
|
+
# Returns the number of games played in this mission
|
80
|
+
#
|
81
|
+
# @return [Fixnum] The number of games played in this mission
|
82
|
+
attr_reader :total_games
|
83
|
+
|
84
|
+
# Returns the percentage of successful games played in this mission
|
85
|
+
#
|
86
|
+
# @return [Float] The percentage of successful games played in this mission
|
87
|
+
attr_reader :total_games_percentage
|
88
|
+
|
89
|
+
# Creates a new mission instance of based on the given XML data
|
90
|
+
#
|
91
|
+
# @param [String] map_name The name of the mission's map
|
92
|
+
# @param [Hash<String, Object>] mission_data The data representing this
|
93
|
+
# mission
|
94
|
+
def initialize(map_name, mission_data)
|
95
|
+
@avg_damage_taken = mission_data['damagetakenavg'].to_f
|
96
|
+
@avg_friendly_fire = mission_data['friendlyfireavg'].to_f
|
97
|
+
@avg_kills = mission_data['killsavg'].to_f
|
98
|
+
@best_difficulty = mission_data['bestdifficulty']
|
99
|
+
@damage_taken = mission_data['damagetaken'].to_i
|
100
|
+
@friendly_fire = mission_data['friendlyfire'].to_i
|
101
|
+
@games_successful = mission_data['gamessuccess'].to_i
|
102
|
+
@img = AlienSwarmStats::BASE_URL + mission_data['image']
|
103
|
+
@kills = mission_data['kills'].to_i
|
104
|
+
@map_name = map_name
|
105
|
+
@name = mission_data['name']
|
106
|
+
@total_games = mission_data['gamestotal'].to_i
|
107
|
+
@total_games_percentage = mission_data['gamestotalpct'].to_f
|
108
|
+
|
109
|
+
@time = {}
|
110
|
+
@time[:average] = mission_data['avgtime']
|
111
|
+
@time[:brutal] = mission_data['brutaltime']
|
112
|
+
@time[:easy] = mission_data['easytime']
|
113
|
+
@time[:hard] = mission_data['hardtime']
|
114
|
+
@time[:insane] = mission_data['insanetime']
|
115
|
+
@time[:normal] = mission_data['normaltime']
|
116
|
+
@time[:total] = mission_data['totaltime']
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|