steam-condenser 0.14.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +22 -0
- data/LICENSE +1 -1
- data/README.md +14 -6
- data/Rakefile +35 -0
- data/lib/{stringio_additions.rb → core_ext/stringio.rb} +1 -1
- data/lib/{exceptions/packet_format_exception.rb → errors/packet_format_error.rb} +5 -5
- data/lib/{exceptions/rcon_ban_exception.rb → errors/rcon_ban_error.rb} +5 -5
- data/lib/{exceptions/rcon_no_auth_exception.rb → errors/rcon_no_auth_error.rb} +5 -5
- data/lib/{exceptions/steam_condenser_exception.rb → errors/steam_condenser_error.rb} +3 -3
- data/lib/errors/timeout_error.rb +28 -0
- data/lib/{exceptions/web_api_exception.rb → errors/web_api_error.rb} +8 -8
- data/lib/steam/community/alien_swarm/alien_swarm_mission.rb +86 -11
- data/lib/steam/community/alien_swarm/alien_swarm_stats.rb +38 -15
- data/lib/steam/community/alien_swarm/alien_swarm_weapon.rb +29 -8
- data/lib/steam/community/app_news.rb +91 -27
- data/lib/steam/community/cacheable.rb +65 -21
- data/lib/steam/community/css/css_map.rb +39 -9
- data/lib/steam/community/css/css_stats.rb +32 -12
- data/lib/steam/community/css/css_weapon.rb +46 -10
- data/lib/steam/community/defense_grid/defense_grid_stats.rb +129 -17
- data/lib/steam/community/dods/dods_class.rb +66 -10
- data/lib/steam/community/dods/dods_stats.rb +20 -7
- data/lib/steam/community/dods/dods_weapon.rb +35 -24
- data/lib/steam/community/game_achievement.rb +50 -19
- data/lib/steam/community/game_class.rb +16 -5
- data/lib/steam/community/game_inventory.rb +37 -4
- data/lib/steam/community/game_item.rb +64 -3
- data/lib/steam/community/game_stats.rb +81 -16
- data/lib/steam/community/game_weapon.rb +29 -11
- data/lib/steam/community/l4d/abstract_l4d_stats.rb +91 -65
- data/lib/steam/community/l4d/abstract_l4d_weapon.rb +38 -8
- data/lib/steam/community/l4d/l4d2_map.rb +30 -5
- data/lib/steam/community/l4d/l4d2_stats.rb +83 -45
- data/lib/steam/community/l4d/l4d2_weapon.rb +20 -6
- data/lib/steam/community/l4d/l4d_explosive.rb +13 -5
- data/lib/steam/community/l4d/l4d_map.rb +35 -7
- data/lib/steam/community/l4d/l4d_stats.rb +23 -10
- data/lib/steam/community/l4d/l4d_weapon.rb +11 -7
- data/lib/steam/community/portal2/portal2_inventory.rb +4 -0
- data/lib/steam/community/portal2/portal2_item.rb +13 -1
- data/lib/steam/community/portal2/portal2_stats.rb +10 -6
- data/lib/steam/community/steam_game.rb +74 -0
- data/lib/steam/community/steam_group.rb +48 -14
- data/lib/steam/community/steam_id.rb +295 -64
- data/lib/steam/community/tf2/tf2_class.rb +66 -7
- data/lib/steam/community/tf2/tf2_class_factory.rb +14 -7
- data/lib/steam/community/tf2/tf2_engineer.rb +26 -6
- data/lib/steam/community/tf2/tf2_golden_wrench.rb +37 -10
- data/lib/steam/community/tf2/tf2_inventory.rb +4 -0
- data/lib/steam/community/tf2/tf2_item.rb +13 -1
- data/lib/steam/community/tf2/tf2_medic.rb +20 -5
- data/lib/steam/community/tf2/tf2_sniper.rb +15 -5
- data/lib/steam/community/tf2/tf2_spy.rb +20 -6
- data/lib/steam/community/tf2/tf2_stats.rb +20 -6
- data/lib/steam/community/web_api.rb +50 -32
- data/lib/steam/packets/c2m_checkmd5_packet.rb +1 -1
- data/lib/steam/packets/m2a_server_batch_packet.rb +3 -2
- data/lib/steam/packets/m2s_requestrestart_packet.rb +3 -3
- data/lib/steam/packets/rcon/rcon_packet_factory.rb +4 -4
- data/lib/steam/packets/request_with_challenge.rb +1 -1
- data/lib/steam/packets/s2a_info_base_packet.rb +1 -1
- data/lib/steam/packets/s2a_info_detailed_packet.rb +10 -10
- data/lib/steam/packets/s2a_player_packet.rb +5 -1
- data/lib/steam/packets/s2a_rules_packet.rb +4 -3
- data/lib/steam/packets/s2m_heartbeat2_packet.rb +2 -2
- data/lib/steam/packets/steam_packet.rb +1 -1
- data/lib/steam/packets/steam_packet_factory.rb +12 -16
- data/lib/steam/servers/game_server.rb +38 -32
- data/lib/steam/servers/goldsrc_server.rb +10 -1
- data/lib/steam/servers/master_server.rb +42 -21
- data/lib/steam/servers/server.rb +4 -5
- data/lib/steam/servers/source_server.rb +20 -5
- data/lib/steam/sockets/goldsrc_socket.rb +53 -22
- data/lib/steam/sockets/master_server_socket.rb +14 -4
- data/lib/steam/sockets/rcon_socket.rb +39 -6
- data/lib/steam/sockets/source_socket.rb +19 -15
- data/lib/steam/sockets/steam_socket.rb +33 -23
- data/lib/steam/steam_player.rb +86 -11
- data/lib/steam-condenser/community.rb +24 -24
- data/lib/steam-condenser/servers.rb +2 -2
- data/lib/steam-condenser/version.rb +3 -3
- data/steam-condenser.gemspec +23 -0
- data/test/query_tests.rb +12 -12
- data/test/rcon_tests.rb +3 -3
- data/test/steam/communtiy/steam_community_test_suite.rb +12 -0
- data/test/steam/communtiy/steam_group_tests.rb +6 -5
- data/test/steam/communtiy/steam_id_tests.rb +6 -5
- data/test/steam_community_tests.rb +3 -3
- data/test/stringio_additions_tests.rb +7 -7
- metadata +61 -43
- data/lib/exceptions/timeout_exception.rb +0 -24
- data/test/datagram_channel_tests.rb +0 -42
- data/test/socket_channel_tests.rb +0 -43
@@ -1,20 +1,79 @@
|
|
1
|
-
# This code is free software; you can redistribute it and/or modify it under
|
2
|
-
# terms of the new BSD License.
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2008-
|
4
|
+
# Copyright (c) 2008-2011, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/game_class'
|
7
7
|
|
8
8
|
# Represents the stats for a Team Fortress 2 class for a specific user
|
9
|
+
#
|
10
|
+
# @author Sebastian Staudt
|
9
11
|
module TF2Class
|
10
12
|
|
11
13
|
include GameClass
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
# Returns the maximum number of buildings the player has destroyed in a
|
16
|
+
# single life with this class
|
17
|
+
#
|
18
|
+
# @return [Fixnum] Maximum number of buildings destroyed
|
19
|
+
attr_reader :max_buildings_destroyed
|
20
|
+
|
21
|
+
# Returns the maximum number of points captured by the player in a single
|
22
|
+
# life with this class
|
23
|
+
#
|
24
|
+
# @return [Fixnum] Maximum number of points captured
|
25
|
+
attr_reader :max_captures
|
26
|
+
|
27
|
+
# Returns the maximum damage dealt by the player in a single life with this
|
28
|
+
# class
|
29
|
+
#
|
30
|
+
# @return [Fixnum] Maximum damage dealt
|
31
|
+
attr_reader :max_damage
|
32
|
+
|
33
|
+
# Returns the maximum number of defenses by the player in a single life with
|
34
|
+
# this class
|
35
|
+
#
|
36
|
+
# @return [Fixnum] Maximum number of defenses
|
37
|
+
attr_reader :max_defenses
|
38
|
+
|
39
|
+
# Returns the maximum number of dominations by the player in a single life
|
40
|
+
# with this class
|
41
|
+
#
|
42
|
+
# @return [Fixnum] Maximum number of dominations
|
43
|
+
attr_reader :max_dominations
|
44
|
+
|
45
|
+
# Returns the maximum number of times the the player assisted a teammate with
|
46
|
+
# killing an enemy in a single life with this class
|
47
|
+
#
|
48
|
+
# @return [Fixnum] Maximum number of kill assists
|
49
|
+
attr_reader :max_kill_assists
|
50
|
+
|
51
|
+
# Returns the maximum number of enemies killed by the player in a single life
|
52
|
+
# with this class
|
53
|
+
#
|
54
|
+
# @return [Fixnum] Maximum number of kills
|
55
|
+
attr_reader :max_kills
|
56
|
+
|
57
|
+
# Returns the maximum number of revenges by the player in a single life with
|
58
|
+
# this class
|
59
|
+
#
|
60
|
+
# @return [Fixnum] Maximum number of revenges
|
61
|
+
attr_reader :max_revenges
|
62
|
+
|
63
|
+
# Returns the maximum number score achieved by the player in a single life
|
64
|
+
# with this class
|
65
|
+
#
|
66
|
+
# @return [Fixnum] Maximum score
|
67
|
+
attr_reader :max_score
|
68
|
+
|
69
|
+
# Returns the maximum lifetime by the player in a single life with this class
|
70
|
+
#
|
71
|
+
# @return [Fixnum] Maximum lifetime
|
72
|
+
attr_reader :max_time_alive
|
16
73
|
|
17
|
-
# Creates a new
|
74
|
+
# Creates a new TF2 class instance based on the assigned XML data
|
75
|
+
#
|
76
|
+
# @param [REXML::Element] class_data The XML data for this class
|
18
77
|
def initialize(class_data)
|
19
78
|
@name = class_data.elements['className'].text
|
20
79
|
@max_buildings_destroyed = class_data.elements['ibuildingsdestroyed'].text.to_i
|
@@ -1,7 +1,7 @@
|
|
1
|
-
# This code is free software; you can redistribute it and/or modify it under
|
2
|
-
# terms of the new BSD License.
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2008-
|
4
|
+
# Copyright (c) 2008-2011, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/tf2/tf2_class'
|
7
7
|
require 'steam/community/tf2/tf2_engineer'
|
@@ -9,12 +9,19 @@ require 'steam/community/tf2/tf2_medic'
|
|
9
9
|
require 'steam/community/tf2/tf2_sniper'
|
10
10
|
require 'steam/community/tf2/tf2_spy'
|
11
11
|
|
12
|
-
# The TF2ClassFactory is used to created instances of TF2Class based on the
|
13
|
-
# input data
|
12
|
+
# The `TF2ClassFactory` is used to created instances of `TF2Class` based on the
|
13
|
+
# XML input data
|
14
|
+
#
|
15
|
+
# @author Sebastian Staudt
|
14
16
|
module TF2ClassFactory
|
15
17
|
|
16
|
-
# Creates a new instance of
|
17
|
-
#
|
18
|
+
# Creates a new instance of a TF2 class instance based on the given XML data
|
19
|
+
#
|
20
|
+
# This returns an instance of `TF2Class` or its subclasses `TF2Engineer`,
|
21
|
+
# `TF2Medic`, `TF2Sniper` or `TF2Spy` depending on the given XML data.
|
22
|
+
#
|
23
|
+
# @param [REXML::Element] class_data The XML data for the class
|
24
|
+
# @return [TF2Class] The statistics for the given class data
|
18
25
|
def self.tf2_class(class_data)
|
19
26
|
case class_data.elements['className'].text
|
20
27
|
when 'Engineer' then
|
@@ -1,19 +1,39 @@
|
|
1
|
-
# This code is free software; you can redistribute it and/or modify it under
|
2
|
-
# terms of the new BSD License.
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2008-
|
4
|
+
# Copyright (c) 2008-2011, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/tf2/tf2_class'
|
7
7
|
|
8
|
-
# Represents the stats for the Team Fortress 2
|
8
|
+
# Represents the stats for the Team Fortress 2 Engineer class for a specific
|
9
9
|
# user
|
10
|
+
#
|
11
|
+
# @author Sebastian Staudt
|
10
12
|
class TF2Engineer
|
11
13
|
|
12
14
|
include TF2Class
|
13
15
|
|
14
|
-
|
16
|
+
# Returns the maximum number of buildings built by the player in a single
|
17
|
+
# life as an Engineer
|
18
|
+
#
|
19
|
+
# @return [Fixnum] Maximum number of buildings built
|
20
|
+
attr_reader :max_buildings_built
|
21
|
+
|
22
|
+
# Returns the maximum number of enemies killed by sentry guns built by the
|
23
|
+
# player in a single life as an Engineer
|
24
|
+
#
|
25
|
+
# @return [Fixnum] Maximum number of sentry kills
|
26
|
+
attr_reader :max_sentry_kills
|
27
|
+
|
28
|
+
# Returns the maximum number of teammates teleported by teleporters built by
|
29
|
+
# the player in a single life as an Engineer
|
30
|
+
#
|
31
|
+
# @return [Fixnum] Maximum number of teleports
|
32
|
+
attr_reader :max_teleports
|
15
33
|
|
16
|
-
# Creates a new instance of
|
34
|
+
# Creates a new instance of the Engineer class based on the given XML data
|
35
|
+
#
|
36
|
+
# @param [REXML::Element] class_data The XML data for this Engineer
|
17
37
|
def initialize(class_data)
|
18
38
|
super class_data
|
19
39
|
|
@@ -1,28 +1,53 @@
|
|
1
|
-
# This code is free software; you can redistribute it and/or modify it under
|
2
|
-
# terms of the new BSD License.
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2010, Sebastian Staudt
|
4
|
+
# Copyright (c) 2010-2011, Sebastian Staudt
|
5
|
+
|
6
|
+
require 'multi_json'
|
5
7
|
|
6
|
-
require 'json'
|
7
8
|
require 'steam/community/steam_id'
|
8
9
|
require 'steam/community/web_api'
|
9
10
|
|
10
11
|
# Represents the special Team Fortress 2 item Golden Wrench. It includes the
|
11
|
-
# ID of the item, the serial number of the wrench, a reference to the
|
12
|
+
# ID of the item, the serial number of the wrench, a reference to the SteamID
|
12
13
|
# of the owner and the date this player crafted the wrench
|
14
|
+
#
|
15
|
+
# @author Sebastian Staudt
|
13
16
|
class TF2GoldenWrench
|
14
17
|
|
15
|
-
|
18
|
+
# Returns the date this Golden Wrench has been crafted
|
19
|
+
#
|
20
|
+
# @return [Time] The crafting date of this wrench
|
21
|
+
attr_reader :date
|
22
|
+
|
23
|
+
# Returns the unique item ID of this Golden Wrench
|
24
|
+
#
|
25
|
+
# @return [Fixnum] The ID of this wrench
|
26
|
+
attr_reader :id
|
27
|
+
|
28
|
+
# Returns the serial number of this Golden Wrench
|
29
|
+
#
|
30
|
+
# @return [Fixnum] The serial of this wrench
|
31
|
+
attr_reader :number
|
32
|
+
|
33
|
+
# Returns the SteamID of the owner of this Golden Wrench
|
34
|
+
#
|
35
|
+
# @return [SteamId] The owner of this wrench
|
36
|
+
attr_reader :owner
|
16
37
|
|
17
38
|
@@golden_wrenches = nil
|
18
39
|
|
19
|
-
# Returns
|
40
|
+
# Returns all Golden Wrenches
|
41
|
+
#
|
42
|
+
# @raise [SteamCondenserError] if an error occurs querying the Web API or
|
43
|
+
# the Steam Community
|
44
|
+
# @return [Array<GoldenWrench>] All Golden Wrenches
|
20
45
|
def self.golden_wrenches
|
21
46
|
if @@golden_wrenches.nil?
|
22
47
|
@@golden_wrenches = []
|
23
48
|
|
24
|
-
data =
|
25
|
-
data[:results][:wrenches]
|
49
|
+
data = MultiJson.decode(WebApi.json('ITFItems_440', 'GetGoldenWrenches', 2), { :symbolize_keys => true })
|
50
|
+
data[:results][:wrenches].each do |wrench_data|
|
26
51
|
@@golden_wrenches << TF2GoldenWrench.new(wrench_data)
|
27
52
|
end
|
28
53
|
end
|
@@ -32,7 +57,9 @@ class TF2GoldenWrench
|
|
32
57
|
|
33
58
|
private
|
34
59
|
|
35
|
-
# Creates a new instance of
|
60
|
+
# Creates a new instance of a Golden Wrench with the given data
|
61
|
+
#
|
62
|
+
# @param [Hash<Symbol, Object>] wrench_data The JSON data for this wrench
|
36
63
|
def initialize(wrench_data)
|
37
64
|
@date = Time.at(wrench_data[:timestamp])
|
38
65
|
@id = wrench_data[:itemID]
|
@@ -7,6 +7,8 @@ require 'steam/community/game_inventory'
|
|
7
7
|
require 'steam/community/tf2/tf2_item'
|
8
8
|
|
9
9
|
# Represents the inventory (aka. Backpack) of a Team Fortress 2 player
|
10
|
+
#
|
11
|
+
# @author Sebastian Staudt
|
10
12
|
class TF2Inventory
|
11
13
|
|
12
14
|
include Cacheable
|
@@ -14,8 +16,10 @@ class TF2Inventory
|
|
14
16
|
|
15
17
|
include GameInventory
|
16
18
|
|
19
|
+
# The Steam Application ID of Team Fortress 2
|
17
20
|
@@app_id = 440
|
18
21
|
|
22
|
+
# The class representing Team Fortress 2 items
|
19
23
|
@@item_class = TF2Item
|
20
24
|
|
21
25
|
end
|
@@ -6,13 +6,20 @@
|
|
6
6
|
require 'steam/community/game_item'
|
7
7
|
|
8
8
|
# Represents a Team Fortress 2 item
|
9
|
+
#
|
10
|
+
# @author Sebastian Staudt
|
9
11
|
class TF2Item
|
10
12
|
|
11
13
|
include GameItem
|
12
14
|
|
15
|
+
# The names of the classes available in Team Fortress 2
|
13
16
|
CLASSES = [ :scout, :sniper, :soldier, :demoman, :medic, :heavy, :pyro, :spy ]
|
14
17
|
|
15
|
-
# Creates a new instance of a
|
18
|
+
# Creates a new instance of a TF2 item with the given data
|
19
|
+
#
|
20
|
+
# @param [TF2Inventory] inventory The inventory this item is contained in
|
21
|
+
# @param [Hash<Symbol, Object>] item_data The data specifying this item
|
22
|
+
# @raise [WebApiError] on Web API errors
|
16
23
|
def initialize(inventory, item_data)
|
17
24
|
super
|
18
25
|
|
@@ -23,11 +30,16 @@ class TF2Item
|
|
23
30
|
end
|
24
31
|
|
25
32
|
# Returns the class symbols for each class this player has equipped this item
|
33
|
+
#
|
34
|
+
# @return [Array<String>] The names of the classes this player has equipped
|
35
|
+
# this item
|
26
36
|
def classes_equipped?
|
27
37
|
@equipped.reject { |class_id, equipped| !equipped }
|
28
38
|
end
|
29
39
|
|
30
40
|
# Returns whether this item is equipped by this player at all
|
41
|
+
#
|
42
|
+
# @return [Boolean] `true` if the player has equipped this item at all
|
31
43
|
def equipped?
|
32
44
|
@equipped.has_value? true
|
33
45
|
end
|
@@ -1,17 +1,32 @@
|
|
1
|
-
# This code is free software; you can redistribute it and/or modify it under
|
2
|
-
# terms of the new BSD License.
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2008-
|
4
|
+
# Copyright (c) 2008-2011, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/tf2/tf2_class'
|
7
7
|
|
8
|
-
# Represents the stats for the Team Fortress 2
|
8
|
+
# Represents the stats for the Team Fortress 2 Medic class for a specific user
|
9
|
+
#
|
10
|
+
# @author Sebastian Staudt
|
9
11
|
class TF2Medic
|
10
12
|
|
11
13
|
include TF2Class
|
12
14
|
|
13
|
-
|
15
|
+
# Returns the maximum health healed for teammates by the player in a
|
16
|
+
# single life as a Medic
|
17
|
+
#
|
18
|
+
# @return [Fixnum] Maximum health healed
|
19
|
+
attr_reader :max_health_healed
|
20
|
+
|
21
|
+
# Returns the maximum number of ÜberCharges provided by the player in a
|
22
|
+
# single life as a Medic
|
23
|
+
#
|
24
|
+
# @return [Fixnum] Maximum number of ÜberCharges
|
25
|
+
attr_reader :max_ubercharges
|
14
26
|
|
27
|
+
# Creates a new instance of the Medic class based on the given XML data
|
28
|
+
#
|
29
|
+
# @param [REXML::Element] class_data The XML data for this Medic
|
15
30
|
def initialize(class_data)
|
16
31
|
super class_data
|
17
32
|
|
@@ -1,16 +1,26 @@
|
|
1
|
-
# This code is free software; you can redistribute it and/or modify it under
|
2
|
-
# terms of the new BSD License.
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2008-
|
4
|
+
# Copyright (c) 2008-2011, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/tf2/tf2_class'
|
7
7
|
|
8
|
-
# Represents the stats for the Team Fortress 2
|
8
|
+
# Represents the stats for the Team Fortress 2 Sniper class for a specific user
|
9
|
+
#
|
10
|
+
# @author Sebastian Staudt
|
9
11
|
class TF2Sniper
|
10
12
|
|
11
13
|
include TF2Class
|
12
14
|
|
13
|
-
#
|
15
|
+
# Returns the maximum number enemies killed with a headshot by the player in
|
16
|
+
# a single life as a Sniper
|
17
|
+
#
|
18
|
+
# @return [Fixnum] Maximum number of headshots
|
19
|
+
attr_reader :max_headshots
|
20
|
+
|
21
|
+
# Creates a new instance of the Sniper class based on the given XML data
|
22
|
+
#
|
23
|
+
# @param [REXML::Element] class_data The XML data for this Sniper
|
14
24
|
def initialize(class_data)
|
15
25
|
super class_data
|
16
26
|
|
@@ -1,18 +1,32 @@
|
|
1
|
-
# This code is free software; you can redistribute it and/or modify it under
|
2
|
-
# terms of the new BSD License.
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2008-
|
4
|
+
# Copyright (c) 2008-2011, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/tf2/tf2_class'
|
7
7
|
|
8
|
-
# Represents the stats for the Team Fortress 2
|
8
|
+
# Represents the stats for the Team Fortress 2 Spy class for a specific user
|
9
|
+
#
|
10
|
+
# @author Sebastian Staudt
|
9
11
|
class TF2Spy
|
10
12
|
|
11
13
|
include TF2Class
|
12
14
|
|
13
|
-
|
15
|
+
# Returns the maximum number enemies killed with a backstab by the player in
|
16
|
+
# a single life as a Spy
|
17
|
+
#
|
18
|
+
# @return [Fixnum] Maximum number of buildings built
|
19
|
+
attr_reader :max_backstabs
|
20
|
+
|
21
|
+
# Returns the maximum health leeched from enemies by the player in a single
|
22
|
+
# life as a Spy
|
23
|
+
#
|
24
|
+
# @return [Fixnum] Maximum health leeched
|
25
|
+
attr_reader :max_health_leeched
|
14
26
|
|
15
|
-
# Creates a new instance of
|
27
|
+
# Creates a new instance of the Spy class based on the given XML data
|
28
|
+
#
|
29
|
+
# @param [REXML::Element] class_data The XML data for this Spy
|
16
30
|
def initialize(class_data)
|
17
31
|
super class_data
|
18
32
|
|
@@ -7,14 +7,22 @@ require 'steam/community/game_stats'
|
|
7
7
|
require 'steam/community/tf2/tf2_class_factory'
|
8
8
|
require 'steam/community/tf2/tf2_inventory'
|
9
9
|
|
10
|
-
#
|
11
|
-
#
|
10
|
+
# This class represents the game statistics for a single user in Team Fortress
|
11
|
+
# 2
|
12
|
+
#
|
13
|
+
# @author Sebastian Staudt
|
12
14
|
class TF2Stats < GameStats
|
13
15
|
|
16
|
+
# Returns the total points this player has achieved in his career
|
17
|
+
#
|
18
|
+
# @return [Fixnum] This player's accumulated points
|
14
19
|
attr_reader :accumulated_points
|
15
20
|
|
16
|
-
# Creates a TF2Stats
|
17
|
-
# name
|
21
|
+
# Creates a `TF2Stats` instance by calling the super constructor with the
|
22
|
+
# game name `'tf2'`
|
23
|
+
#
|
24
|
+
# @param [String, Fixnum] steam_id The custom URL or 64bit Steam ID of the
|
25
|
+
# user
|
18
26
|
def initialize(steam_id)
|
19
27
|
super steam_id, 'tf2'
|
20
28
|
|
@@ -23,8 +31,12 @@ class TF2Stats < GameStats
|
|
23
31
|
end
|
24
32
|
end
|
25
33
|
|
26
|
-
# Returns
|
27
|
-
#
|
34
|
+
# Returns the statistics for all Team Fortress 2 classes for this user
|
35
|
+
#
|
36
|
+
# If the classes haven't been parsed already, parsing is done now.
|
37
|
+
#
|
38
|
+
# @return [Hash<String, TF2Class>] A hash storing individual stats for each
|
39
|
+
# Team Fortress 2 class
|
28
40
|
def class_stats
|
29
41
|
return unless public?
|
30
42
|
|
@@ -40,6 +52,8 @@ class TF2Stats < GameStats
|
|
40
52
|
|
41
53
|
# Returns the current Team Fortress 2 inventory (a.k.a. backpack) of this
|
42
54
|
# player
|
55
|
+
#
|
56
|
+
# @return [TF2Inventory] This player's TF2 backpack
|
43
57
|
def inventory
|
44
58
|
@inventory = TF2Inventory.new(steam_id64) if @inventory.nil?
|
45
59
|
@inventory
|