steam-condenser 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +30 -0
- data/LICENSE +1 -1
- data/README.md +4 -3
- data/lib/steam-condenser/version.rb +2 -2
- data/lib/steam/community/alien_swarm/alien_swarm_mission.rb +24 -22
- data/lib/steam/community/alien_swarm/alien_swarm_stats.rb +66 -65
- data/lib/steam/community/alien_swarm/alien_swarm_weapon.rb +6 -6
- data/lib/steam/community/app_news.rb +2 -2
- data/lib/steam/community/css/css_map.rb +4 -4
- data/lib/steam/community/css/css_stats.rb +43 -43
- data/lib/steam/community/css/css_weapon.rb +5 -5
- data/lib/steam/community/defense_grid/defense_grid_stats.rb +36 -35
- data/lib/steam/community/dods/dods_class.rb +14 -14
- data/lib/steam/community/dods/dods_stats.rb +5 -4
- data/lib/steam/community/dods/dods_weapon.rb +6 -6
- data/lib/steam/community/game_achievement.rb +38 -31
- data/lib/steam/community/game_inventory.rb +6 -6
- data/lib/steam/community/game_leaderboard.rb +34 -32
- data/lib/steam/community/game_leaderboard_entry.rb +6 -6
- data/lib/steam/community/game_stats.rb +39 -65
- data/lib/steam/community/game_weapon.rb +2 -2
- data/lib/steam/community/l4d/abstract_l4d_stats.rb +54 -49
- data/lib/steam/community/l4d/abstract_l4d_weapon.rb +7 -6
- data/lib/steam/community/l4d/l4d2_map.rb +10 -10
- data/lib/steam/community/l4d/l4d2_stats.rb +33 -33
- data/lib/steam/community/l4d/l4d2_weapon.rb +8 -7
- data/lib/steam/community/l4d/l4d_explosive.rb +5 -4
- data/lib/steam/community/l4d/l4d_map.rb +8 -7
- data/lib/steam/community/l4d/l4d_stats.rb +7 -7
- data/lib/steam/community/l4d/l4d_weapon.rb +5 -4
- data/lib/steam/community/portal2/portal2_stats.rb +3 -3
- data/lib/steam/community/steam_game.rb +106 -16
- data/lib/steam/community/steam_group.rb +51 -40
- data/lib/steam/community/steam_id.rb +119 -87
- data/lib/steam/community/tf2/tf2_class.rb +14 -14
- data/lib/steam/community/tf2/tf2_class_factory.rb +2 -2
- data/lib/steam/community/tf2/tf2_engineer.rb +5 -7
- data/lib/steam/community/tf2/tf2_golden_wrench.rb +1 -1
- data/lib/steam/community/tf2/tf2_medic.rb +4 -6
- data/lib/steam/community/tf2/tf2_sniper.rb +3 -5
- data/lib/steam/community/tf2/tf2_spy.rb +10 -6
- data/lib/steam/community/tf2/tf2_stats.rb +15 -7
- data/lib/steam/community/web_api.rb +15 -1
- data/lib/steam/community/xml_data.rb +17 -0
- data/lib/steam/servers/game_server.rb +4 -4
- data/lib/steam/servers/master_server.rb +2 -2
- data/lib/steam/servers/source_server.rb +0 -2
- data/lib/steam/sockets/goldsrc_socket.rb +2 -2
- data/lib/steam/steam_player.rb +2 -2
- data/steam-condenser.gemspec +3 -2
- data/test/helper.rb +10 -2
- data/test/steam/communtiy/test_steam_group.rb +4 -4
- data/test/steam/communtiy/test_steam_id.rb +28 -2
- data/test/steam/communtiy/test_web_api.rb +2 -2
- data/test/steam/packets/test_steam_packet.rb +37 -0
- data/test/steam/servers/test_game_server.rb +296 -308
- data/test/steam/servers/test_goldsrc_server.rb +59 -59
- data/test/steam/servers/test_master_server.rb +131 -131
- data/test/steam/servers/test_server.rb +72 -72
- data/test/steam/servers/test_source_server.rb +126 -140
- data/test/steam/sockets/test_master_server_socket.rb +1 -0
- metadata +39 -19
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
steam-condenser (1.2.0)
|
5
|
+
bzip2-ruby (~> 0.2.7)
|
6
|
+
multi_json (~> 1.3.1)
|
7
|
+
multi_xml (~> 0.4.1)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
bzip2-ruby (0.2.7)
|
13
|
+
metaclass (0.0.1)
|
14
|
+
mocha (0.11.1)
|
15
|
+
metaclass (~> 0.0.1)
|
16
|
+
multi_json (1.3.2)
|
17
|
+
multi_xml (0.4.4)
|
18
|
+
rake (0.9.2.2)
|
19
|
+
shoulda-context (1.0.0)
|
20
|
+
yard (0.7.5)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
mocha (~> 0.11.1)
|
27
|
+
rake (~> 0.9.2)
|
28
|
+
shoulda-context (~> 1.0.0)
|
29
|
+
steam-condenser!
|
30
|
+
yard (~> 0.7.2)
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -29,9 +29,10 @@ included LICENSE file.
|
|
29
29
|
|
30
30
|
## Credits
|
31
31
|
|
32
|
-
* Sebastian Staudt
|
33
|
-
* DeFirence
|
34
|
-
* Mike Połtyn
|
32
|
+
* Sebastian Staudt – koraktor(at)gmail.com
|
33
|
+
* DeFirence – defirence(at)defirence.za.net
|
34
|
+
* Mike Połtyn – mike(at)railslove.com
|
35
|
+
* Sam Kinard – snkinard(at)gmail.com
|
35
36
|
|
36
37
|
## See Also
|
37
38
|
|
@@ -1,11 +1,11 @@
|
|
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) 2010-
|
4
|
+
# Copyright (c) 2010-2012, Sebastian Staudt
|
5
5
|
|
6
6
|
module SteamCondenser
|
7
7
|
|
8
8
|
# The current version of Steam Condenser
|
9
|
-
VERSION = '1.
|
9
|
+
VERSION = '1.2.0'
|
10
10
|
|
11
11
|
end
|
@@ -88,30 +88,32 @@ class AlienSwarmMission
|
|
88
88
|
|
89
89
|
# Creates a new mission instance of based on the given XML data
|
90
90
|
#
|
91
|
-
# @param [
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
@
|
96
|
-
@
|
97
|
-
@
|
98
|
-
@
|
99
|
-
@
|
100
|
-
@
|
101
|
-
@
|
102
|
-
@
|
103
|
-
@
|
104
|
-
@
|
105
|
-
@
|
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
|
106
108
|
|
107
109
|
@time = {}
|
108
|
-
@time[:average] = mission_data
|
109
|
-
@time[:brutal] = mission_data
|
110
|
-
@time[:easy] = mission_data
|
111
|
-
@time[:hard] = mission_data
|
112
|
-
@time[:insane] = mission_data
|
113
|
-
@time[:normal] = mission_data
|
114
|
-
@time[:total] = mission_data
|
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']
|
115
117
|
end
|
116
118
|
|
117
119
|
end
|
@@ -17,7 +17,7 @@ class AlienSwarmStats < GameStats
|
|
17
17
|
attr_reader :lifetime_stats
|
18
18
|
|
19
19
|
# The base URL for all images referenced in the stats
|
20
|
-
BASE_URL = 'http://steamcommunity.com/public/images/gamestats/swarm/'
|
20
|
+
BASE_URL = 'http://cdn.steamcommunity.com/public/images/gamestats/swarm/'
|
21
21
|
|
22
22
|
# The names of all weapons in Alien Swarm
|
23
23
|
WEAPONS = [ 'Autogun', 'Cannon_Sentry', 'Chainsaw', 'Flamer',
|
@@ -36,28 +36,28 @@ class AlienSwarmStats < GameStats
|
|
36
36
|
super steam_id, 'alienswarm'
|
37
37
|
|
38
38
|
if public?
|
39
|
-
@hours_played = @xml_data
|
39
|
+
@hours_played = @xml_data['stats']['lifetime']['timeplayed']
|
40
40
|
|
41
41
|
@lifetime_stats = {}
|
42
|
-
@lifetime_stats[:accuracy] = @xml_data
|
43
|
-
@lifetime_stats[:aliens_burned] = @xml_data
|
44
|
-
@lifetime_stats[:aliens_killed] = @xml_data
|
45
|
-
@lifetime_stats[:campaigns] = @xml_data
|
46
|
-
@lifetime_stats[:damage_taken] = @xml_data
|
47
|
-
@lifetime_stats[:experience] = @xml_data
|
48
|
-
@lifetime_stats[:experience_required] = @xml_data
|
49
|
-
@lifetime_stats[:fast_hacks] = @xml_data
|
50
|
-
@lifetime_stats[:friendly_fire] = @xml_data
|
51
|
-
@lifetime_stats[:games_successful] = @xml_data
|
52
|
-
@lifetime_stats[:healing] = @xml_data
|
53
|
-
@lifetime_stats[:kills_per_hour] = @xml_data
|
54
|
-
@lifetime_stats[:level] = @xml_data
|
55
|
-
@lifetime_stats[:promotion] = @xml_data
|
56
|
-
@lifetime_stats[:promotion_img] = BASE_URL + @xml_data
|
57
|
-
@lifetime_stats[:next_unlock] = @xml_data
|
58
|
-
@lifetime_stats[:next_unlock_img] = BASE_URL + @xml_data
|
59
|
-
@lifetime_stats[:shots_fired] = @xml_data
|
60
|
-
@lifetime_stats[:total_games] = @xml_data
|
42
|
+
@lifetime_stats[:accuracy] = @xml_data['stats']['lifetime']['accuracy'].to_f
|
43
|
+
@lifetime_stats[:aliens_burned] = @xml_data['stats']['lifetime']['aliensburned'].to_i
|
44
|
+
@lifetime_stats[:aliens_killed] = @xml_data['stats']['lifetime']['alienskilled'].to_i
|
45
|
+
@lifetime_stats[:campaigns] = @xml_data['stats']['lifetime']['campaigns'].to_i
|
46
|
+
@lifetime_stats[:damage_taken] = @xml_data['stats']['lifetime']['damagetaken'].to_i
|
47
|
+
@lifetime_stats[:experience] = @xml_data['stats']['lifetime']['experience'].to_i
|
48
|
+
@lifetime_stats[:experience_required] = @xml_data['stats']['lifetime']['xprequired'].to_i
|
49
|
+
@lifetime_stats[:fast_hacks] = @xml_data['stats']['lifetime']['fasthacks'].to_i
|
50
|
+
@lifetime_stats[:friendly_fire] = @xml_data['stats']['lifetime']['friendlyfire'].to_i
|
51
|
+
@lifetime_stats[:games_successful] = @xml_data['stats']['lifetime']['gamessuccess'].to_i
|
52
|
+
@lifetime_stats[:healing] = @xml_data['stats']['lifetime']['healing'].to_i
|
53
|
+
@lifetime_stats[:kills_per_hour] = @xml_data['stats']['lifetime']['killsperhour'].to_f
|
54
|
+
@lifetime_stats[:level] = @xml_data['stats']['lifetime']['level'].to_i
|
55
|
+
@lifetime_stats[:promotion] = @xml_data['stats']['lifetime']['promotion'].to_i
|
56
|
+
@lifetime_stats[:promotion_img] = BASE_URL + @xml_data['stats']['lifetime']['promotionpic'] if @lifetime_stats[:promotion] > 0
|
57
|
+
@lifetime_stats[:next_unlock] = @xml_data['stats']['lifetime']['nextunlock']
|
58
|
+
@lifetime_stats[:next_unlock_img] = BASE_URL + @xml_data['stats']['lifetime']['nextunlockimg']
|
59
|
+
@lifetime_stats[:shots_fired] = @xml_data['stats']['lifetime']['shotsfired'].to_i
|
60
|
+
@lifetime_stats[:total_games] = @xml_data['stats']['lifetime']['totalgames'].to_i
|
61
61
|
|
62
62
|
@lifetime_stats[:games_successful_percentage] = (@lifetime_stats[:total_games] > 0) ? @lifetime_stats[:games_successful].to_f / @lifetime_stats[:total_games] : 0;
|
63
63
|
end
|
@@ -73,26 +73,26 @@ class AlienSwarmStats < GameStats
|
|
73
73
|
|
74
74
|
if @favorites.nil?
|
75
75
|
@favorites = {}
|
76
|
-
@favorites[:class] = @xml_data
|
77
|
-
@favorites[:class_img] = @xml_data
|
78
|
-
@favorites[:class_percentage] = @xml_data
|
79
|
-
@favorites[:difficulty] = @xml_data
|
80
|
-
@favorites[:difficulty_percentage] = @xml_data
|
81
|
-
@favorites[:extra] = @xml_data
|
82
|
-
@favorites[:extra_img] = @xml_data
|
83
|
-
@favorites[:extra_percentage] = @xml_data
|
84
|
-
@favorites[:marine] = @xml_data
|
85
|
-
@favorites[:marine_img] = @xml_data
|
86
|
-
@favorites[:marine_percentage] = @xml_data
|
87
|
-
@favorites[:mission] = @xml_data
|
88
|
-
@favorites[:mission_img] = @xml_data
|
89
|
-
@favorites[:mission_percentage] = @xml_data
|
90
|
-
@favorites[:primary_weapon] = @xml_data
|
91
|
-
@favorites[:primary_weapon_img] = @xml_data
|
92
|
-
@favorites[:primary_weapon_percentage] = @xml_data
|
93
|
-
@favorites[:secondary_weapon] = @xml_data
|
94
|
-
@favorites[:secondary_weapon_img] = @xml_data
|
95
|
-
@favorites[:secondary_weapon_percentage] = @xml_data
|
76
|
+
@favorites[:class] = @xml_data['stats']['favorites']['class']
|
77
|
+
@favorites[:class_img] = @xml_data['stats']['favorites']['classimg']
|
78
|
+
@favorites[:class_percentage] = @xml_data['stats']['favorites']['classpct'].to_f
|
79
|
+
@favorites[:difficulty] = @xml_data['stats']['favorites']['difficulty']
|
80
|
+
@favorites[:difficulty_percentage] = @xml_data['stats']['favorites']['difficultypct'].to_f
|
81
|
+
@favorites[:extra] = @xml_data['stats']['favorites']['extra']
|
82
|
+
@favorites[:extra_img] = @xml_data['stats']['favorites']['extraimg']
|
83
|
+
@favorites[:extra_percentage] = @xml_data['stats']['favorites']['extrapct'].to_f
|
84
|
+
@favorites[:marine] = @xml_data['stats']['favorites']['marine']
|
85
|
+
@favorites[:marine_img] = @xml_data['stats']['favorites']['marineimg']
|
86
|
+
@favorites[:marine_percentage] = @xml_data['stats']['favorites']['marinepct'].to_f
|
87
|
+
@favorites[:mission] = @xml_data['stats']['favorites']['mission']
|
88
|
+
@favorites[:mission_img] = @xml_data['stats']['favorites']['missionimg']
|
89
|
+
@favorites[:mission_percentage] = @xml_data['stats']['favorites']['missionpct'].to_f
|
90
|
+
@favorites[:primary_weapon] = @xml_data['stats']['favorites']['primary']
|
91
|
+
@favorites[:primary_weapon_img] = @xml_data['stats']['favorites']['primaryimg']
|
92
|
+
@favorites[:primary_weapon_percentage] = @xml_data['stats']['favorites']['primarypct'].to_f
|
93
|
+
@favorites[:secondary_weapon] = @xml_data['stats']['favorites']['secondary']
|
94
|
+
@favorites[:secondary_weapon_img] = @xml_data['stats']['favorites']['secondaryimg']
|
95
|
+
@favorites[:secondary_weapon_percentage] = @xml_data['stats']['favorites']['secondarypct'].to_f
|
96
96
|
end
|
97
97
|
|
98
98
|
@favorites
|
@@ -109,27 +109,27 @@ class AlienSwarmStats < GameStats
|
|
109
109
|
|
110
110
|
if @item_stats.nil?
|
111
111
|
@item_stats = {}
|
112
|
-
@item_stats[:ammo_deployed] = @xml_data
|
113
|
-
@item_stats[:sentryguns_deployed] = @xml_data
|
114
|
-
@item_stats[:sentry_flamers_deployed] = @xml_data
|
115
|
-
@item_stats[:sentry_freeze_deployed] = @xml_data
|
116
|
-
@item_stats[:sentry_cannon_deployed] = @xml_data
|
117
|
-
@item_stats[:medkits_used] = @xml_data
|
118
|
-
@item_stats[:flares_used] = @xml_data
|
119
|
-
@item_stats[:adrenaline_used] = @xml_data
|
120
|
-
@item_stats[:tesla_traps_deployed] = @xml_data
|
121
|
-
@item_stats[:freeze_grenades_thrown] = @xml_data
|
122
|
-
@item_stats[:electric_armor_used] = @xml_data
|
123
|
-
@item_stats[:healgun_heals] = @xml_data
|
124
|
-
@item_stats[:healgun_heals_self] = @xml_data
|
125
|
-
@item_stats[:healbeacon_heals] = @xml_data
|
126
|
-
@item_stats[:healbeacon_heals_self] = @xml_data
|
127
|
-
@item_stats[:damage_amps_used] = @xml_data
|
128
|
-
@item_stats[:healbeacons_deployed] = @xml_data
|
129
|
-
@item_stats[:healbeacon_heals_pct] = @xml_data
|
130
|
-
@item_stats[:healgun_heals_pct] = @xml_data
|
131
|
-
@item_stats[:healbeacon_heals_pct_self] = @xml_data
|
132
|
-
@item_stats[:healgun_heals_pct_self] = @xml_data
|
112
|
+
@item_stats[:ammo_deployed] = @xml_data['stats']['weapons']['ammo_deployed'].to_i
|
113
|
+
@item_stats[:sentryguns_deployed] = @xml_data['stats']['weapons']['sentryguns_deployed'].to_i
|
114
|
+
@item_stats[:sentry_flamers_deployed] = @xml_data['stats']['weapons']['sentry_flamers_deployed'].to_i
|
115
|
+
@item_stats[:sentry_freeze_deployed] = @xml_data['stats']['weapons']['sentry_freeze_deployed'].to_i
|
116
|
+
@item_stats[:sentry_cannon_deployed] = @xml_data['stats']['weapons']['sentry_cannon_deployed'].to_i
|
117
|
+
@item_stats[:medkits_used] = @xml_data['stats']['weapons']['medkits_used'].to_i
|
118
|
+
@item_stats[:flares_used] = @xml_data['stats']['weapons']['flares_used'].to_i
|
119
|
+
@item_stats[:adrenaline_used] = @xml_data['stats']['weapons']['adrenaline_used'].to_i
|
120
|
+
@item_stats[:tesla_traps_deployed] = @xml_data['stats']['weapons']['tesla_traps_deployed'].to_i
|
121
|
+
@item_stats[:freeze_grenades_thrown] = @xml_data['stats']['weapons']['freeze_grenades_thrown'].to_i
|
122
|
+
@item_stats[:electric_armor_used] = @xml_data['stats']['weapons']['electric_armor_used'].to_i
|
123
|
+
@item_stats[:healgun_heals] = @xml_data['stats']['weapons']['healgun_heals'].to_i
|
124
|
+
@item_stats[:healgun_heals_self] = @xml_data['stats']['weapons']['healgun_heals_self'].to_i
|
125
|
+
@item_stats[:healbeacon_heals] = @xml_data['stats']['weapons']['healbeacon_heals'].to_i
|
126
|
+
@item_stats[:healbeacon_heals_self] = @xml_data['stats']['weapons']['healbeacon_heals_self'].to_i
|
127
|
+
@item_stats[:damage_amps_used] = @xml_data['stats']['weapons']['damage_amps_used'].to_i
|
128
|
+
@item_stats[:healbeacons_deployed] = @xml_data['stats']['weapons']['healbeacons_deployed'].to_i
|
129
|
+
@item_stats[:healbeacon_heals_pct] = @xml_data['stats']['weapons']['healbeacon_heals_pct'].to_f
|
130
|
+
@item_stats[:healgun_heals_pct] = @xml_data['stats']['weapons']['healgun_heals_pct'].to_f
|
131
|
+
@item_stats[:healbeacon_heals_pct_self] = @xml_data['stats']['weapons']['healbeacon_heals_pct_self'].to_f
|
132
|
+
@item_stats[:healgun_heals_pct_self] = @xml_data['stats']['weapons']['healgun_heals_pct_self'].to_f
|
133
133
|
end
|
134
134
|
|
135
135
|
@item_stats
|
@@ -146,8 +146,9 @@ class AlienSwarmStats < GameStats
|
|
146
146
|
|
147
147
|
if @mission_stats.nil?
|
148
148
|
@mission_stats = {}
|
149
|
-
@xml_data
|
150
|
-
|
149
|
+
@xml_data['stats']['missions'].each do |mission_data|
|
150
|
+
mission = AlienSwarmMission.new *mission_data
|
151
|
+
@mission_stats[mission.name] = mission
|
151
152
|
end
|
152
153
|
end
|
153
154
|
|
@@ -166,7 +167,7 @@ class AlienSwarmStats < GameStats
|
|
166
167
|
if @weapon_stats.nil?
|
167
168
|
@weapon_stats = {}
|
168
169
|
WEAPONS.each do |weapon_node|
|
169
|
-
weapon_data = @xml_data
|
170
|
+
weapon_data = @xml_data['stats']['weapons'][weapon_node]
|
170
171
|
weapon = AlienSwarmWeapon.new(weapon_data)
|
171
172
|
@weapon_stats[weapon.name] = weapon
|
172
173
|
end
|
@@ -35,15 +35,15 @@ class AlienSwarmWeapon
|
|
35
35
|
|
36
36
|
# Creates a new weapon instance based on the assigned weapon XML data
|
37
37
|
#
|
38
|
-
# @param [
|
38
|
+
# @param [Hash<String, Object>] weapon_data The data representing this weapon
|
39
39
|
def initialize(weapon_data)
|
40
40
|
super
|
41
41
|
|
42
|
-
@accuracy = weapon_data
|
43
|
-
@damage = weapon_data
|
44
|
-
@friendly_fire = weapon_data
|
45
|
-
@name = weapon_data
|
46
|
-
@shots = weapon_data
|
42
|
+
@accuracy = weapon_data['accuracy'].to_f
|
43
|
+
@damage = weapon_data['damage'].to_i
|
44
|
+
@friendly_fire = weapon_data['friendlyfire'].to_i
|
45
|
+
@name = weapon_data['name']
|
46
|
+
@shots = weapon_data['shotsfired'].to_i
|
47
47
|
end
|
48
48
|
|
49
49
|
end
|
@@ -83,7 +83,7 @@ class AppNews
|
|
83
83
|
data = WebApi.json('ISteamNews', 'GetNewsForApp', 2, params)
|
84
84
|
|
85
85
|
news_items = []
|
86
|
-
MultiJson.
|
86
|
+
MultiJson.load(data, { :symbolize_keys => true })[:appnews][:newsitems].each do |news_data|
|
87
87
|
news_items << AppNews.new(app_id, news_data)
|
88
88
|
end
|
89
89
|
|
@@ -105,7 +105,7 @@ class AppNews
|
|
105
105
|
#
|
106
106
|
# @return [String] A simple text representing this news
|
107
107
|
def to_s
|
108
|
-
"
|
108
|
+
"#@feed_label: #@title"
|
109
109
|
end
|
110
110
|
|
111
111
|
private
|
@@ -32,13 +32,13 @@ class CSSMap
|
|
32
32
|
# given XML data
|
33
33
|
#
|
34
34
|
# @param [String] map_name The name of the map
|
35
|
-
# @param [
|
35
|
+
# @param [Hash<String, Object>] maps_data The XML data of all maps
|
36
36
|
def initialize(map_name, maps_data)
|
37
37
|
@name = map_name
|
38
38
|
|
39
|
-
@favorite = (maps_data
|
40
|
-
@rounds_played = maps_data
|
41
|
-
@rounds_won = maps_data
|
39
|
+
@favorite = (maps_data['favorite'] == @name)
|
40
|
+
@rounds_played = maps_data["#{@name}_rounds"].to_i
|
41
|
+
@rounds_won = maps_data["#{@name}_wins"].to_i
|
42
42
|
|
43
43
|
@rounds_lost = @rounds_played - @rounds_won
|
44
44
|
@rounds_won_percentage = (@rounds_played > 0) ? @rounds_won.to_f / @rounds_played : 0
|
@@ -34,8 +34,8 @@ class CSSStats < GameStats
|
|
34
34
|
# @return [Hash<Symbol, Object>] The overall statistics
|
35
35
|
attr_reader :total_stats
|
36
36
|
|
37
|
-
# Creates a
|
38
|
-
# with the game name
|
37
|
+
# Creates a `CSSStats` instance by calling the super constructor
|
38
|
+
# with the game name `'cs:s'`
|
39
39
|
#
|
40
40
|
# @param [String, Fixnum] steam_id The custom URL or 64bit Steam ID of the
|
41
41
|
# user
|
@@ -46,45 +46,45 @@ class CSSStats < GameStats
|
|
46
46
|
@last_match_stats = {}
|
47
47
|
@total_stats = {}
|
48
48
|
|
49
|
-
@last_match_stats[:cost_per_kill] = @xml_data
|
50
|
-
@last_match_stats[:ct_wins] = @xml_data
|
51
|
-
@last_match_stats[:damage] = @xml_data
|
52
|
-
@last_match_stats[:deaths] = @xml_data
|
53
|
-
@last_match_stats[:dominations] = @xml_data
|
54
|
-
@last_match_stats[:favorite_weapon_id] = @xml_data
|
55
|
-
@last_match_stats[:kills] = @xml_data
|
56
|
-
@last_match_stats[:max_players] = @xml_data
|
57
|
-
@last_match_stats[:money] = @xml_data
|
58
|
-
@last_match_stats[:revenges] = @xml_data
|
59
|
-
@last_match_stats[:stars] = @xml_data
|
60
|
-
@last_match_stats[:t_wins] = @xml_data
|
61
|
-
@last_match_stats[:wins] = @xml_data
|
62
|
-
@total_stats[:blind_kills] = @xml_data
|
63
|
-
@total_stats[:bombs_defused] = @xml_data
|
64
|
-
@total_stats[:bombs_planted] = @xml_data
|
65
|
-
@total_stats[:damage] = @xml_data
|
66
|
-
@total_stats[:deaths] = @xml_data
|
67
|
-
@total_stats[:domination_overkills] = @xml_data
|
68
|
-
@total_stats[:dominations] = @xml_data
|
69
|
-
@total_stats[:earned_money] = @xml_data
|
70
|
-
@total_stats[:enemy_weapon_kills] = @xml_data
|
71
|
-
@total_stats[:headshots] = @xml_data
|
72
|
-
@total_stats[:hits] = @xml_data
|
73
|
-
@total_stats[:hostages_rescued] = @xml_data
|
74
|
-
@total_stats[:kills] = @xml_data
|
75
|
-
@total_stats[:knife_kills] = @xml_data
|
76
|
-
@total_stats[:logos_sprayed] = @xml_data
|
77
|
-
@total_stats[:nightvision_damage] = @xml_data
|
78
|
-
@total_stats[:pistol_rounds_won] = @xml_data
|
79
|
-
@total_stats[:revenges] = @xml_data
|
80
|
-
@total_stats[:rounds_played] = @xml_data
|
81
|
-
@total_stats[:rounds_won] = @xml_data
|
82
|
-
@total_stats[:seconds_played] = @xml_data
|
83
|
-
@total_stats[:shots] = @xml_data
|
84
|
-
@total_stats[:stars] = @xml_data
|
85
|
-
@total_stats[:weapons_donated] = @xml_data
|
86
|
-
@total_stats[:windows_broken] = @xml_data
|
87
|
-
@total_stats[:zoomed_sniper_kills] = @xml_data
|
49
|
+
@last_match_stats[:cost_per_kill] = @xml_data['stats']['lastmatch']['costkill'].to_f
|
50
|
+
@last_match_stats[:ct_wins] = @xml_data['stats']['lastmatch']['ct_wins'].to_i
|
51
|
+
@last_match_stats[:damage] = @xml_data['stats']['lastmatch']['dmg'].to_i
|
52
|
+
@last_match_stats[:deaths] = @xml_data['stats']['lastmatch']['deaths'].to_i
|
53
|
+
@last_match_stats[:dominations] = @xml_data['stats']['lastmatch']['dominations'].to_i
|
54
|
+
@last_match_stats[:favorite_weapon_id] = @xml_data['stats']['lastmatch']['favwpnid'].to_i
|
55
|
+
@last_match_stats[:kills] = @xml_data['stats']['lastmatch']['kills'].to_i
|
56
|
+
@last_match_stats[:max_players] = @xml_data['stats']['lastmatch']['max_players'].to_i
|
57
|
+
@last_match_stats[:money] = @xml_data['stats']['lastmatch']['money'].to_i
|
58
|
+
@last_match_stats[:revenges] = @xml_data['stats']['lastmatch']['revenges'].to_i
|
59
|
+
@last_match_stats[:stars] = @xml_data['stats']['lastmatch']['stars'].to_i
|
60
|
+
@last_match_stats[:t_wins] = @xml_data['stats']['lastmatch']['t_wins'].to_i
|
61
|
+
@last_match_stats[:wins] = @xml_data['stats']['lastmatch']['wins'].to_i
|
62
|
+
@total_stats[:blind_kills] = @xml_data['stats']['lifetime']['blindkills'].to_i
|
63
|
+
@total_stats[:bombs_defused] = @xml_data['stats']['lifetime']['bombsdefused'].to_i
|
64
|
+
@total_stats[:bombs_planted] = @xml_data['stats']['lifetime']['bombsplanted'].to_i
|
65
|
+
@total_stats[:damage] = @xml_data['stats']['lifetime']['dmg'].to_i
|
66
|
+
@total_stats[:deaths] = @xml_data['stats']['summary']['deaths'].to_i
|
67
|
+
@total_stats[:domination_overkills] = @xml_data['stats']['lifetime']['dominationoverkills'].to_i
|
68
|
+
@total_stats[:dominations] = @xml_data['stats']['lifetime']['dominations'].to_i
|
69
|
+
@total_stats[:earned_money] = @xml_data['stats']['lifetime']['money'].to_i
|
70
|
+
@total_stats[:enemy_weapon_kills] = @xml_data['stats']['lifetime']['enemywpnkills'].to_i
|
71
|
+
@total_stats[:headshots] = @xml_data['stats']['lifetime']['headshots'].to_i
|
72
|
+
@total_stats[:hits] = @xml_data['stats']['summary']['shotshit'].to_i
|
73
|
+
@total_stats[:hostages_rescued] = @xml_data['stats']['lifetime']['hostagesrescued'].to_i
|
74
|
+
@total_stats[:kills] = @xml_data['stats']['summary']['kills'].to_i
|
75
|
+
@total_stats[:knife_kills] = @xml_data['stats']['lifetime']['knifekills'].to_i
|
76
|
+
@total_stats[:logos_sprayed] = @xml_data['stats']['lifetime']['decals'].to_i
|
77
|
+
@total_stats[:nightvision_damage] = @xml_data['stats']['lifetime']['nvgdmg'].to_i
|
78
|
+
@total_stats[:pistol_rounds_won] = @xml_data['stats']['lifetime']['pistolrounds'].to_i
|
79
|
+
@total_stats[:revenges] = @xml_data['stats']['lifetime']['revenges'].to_i
|
80
|
+
@total_stats[:rounds_played] = @xml_data['stats']['summary']['rounds'].to_i
|
81
|
+
@total_stats[:rounds_won] = @xml_data['stats']['summary']['wins'].to_i
|
82
|
+
@total_stats[:seconds_played] = @xml_data['stats']['summary']['timeplayed'].to_i
|
83
|
+
@total_stats[:shots] = @xml_data['stats']['summary']['shots'].to_i
|
84
|
+
@total_stats[:stars] = @xml_data['stats']['summary']['stars'].to_i
|
85
|
+
@total_stats[:weapons_donated] = @xml_data['stats']['lifetime']['wpndonated'].to_i
|
86
|
+
@total_stats[:windows_broken] = @xml_data['stats']['lifetime']['winbroken'].to_i
|
87
|
+
@total_stats[:zoomed_sniper_kills] = @xml_data['stats']['lifetime']['zsniperkills'].to_i
|
88
88
|
|
89
89
|
@last_match_stats[:kdratio] = (@total_stats[:deaths] > 0) ? @last_match_stats[:kills].to_f / @last_match_stats[:deaths] : 0
|
90
90
|
@total_stats[:accuracy] = (@total_stats[:shots] > 0) ? @total_stats[:hits].to_f / @total_stats[:shots] : 0
|
@@ -103,7 +103,7 @@ class CSSStats < GameStats
|
|
103
103
|
|
104
104
|
if @map_stats.nil?
|
105
105
|
@map_stats = {}
|
106
|
-
maps_data = @xml_data
|
106
|
+
maps_data = @xml_data['stats']['maps']
|
107
107
|
|
108
108
|
MAPS.each do |map_name|
|
109
109
|
@map_stats[map_name] = CSSMap.new(map_name, maps_data)
|
@@ -123,7 +123,7 @@ class CSSStats < GameStats
|
|
123
123
|
|
124
124
|
if @weapon_stats.nil?
|
125
125
|
@weapon_stats = {}
|
126
|
-
weapons_data = @xml_data
|
126
|
+
weapons_data = @xml_data['stats']['weapons']
|
127
127
|
|
128
128
|
WEAPONS.each do |weapon_name|
|
129
129
|
@weapon_stats[weapon_name] = CSSWeapon.new(weapon_name, weapons_data)
|