steam-condenser 0.11.3 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +0 -1
- data/lib/datagram_channel.rb +1 -2
- data/lib/steam-condenser/version.rb +1 -1
- data/lib/steam/community/css/css_stats.rb +42 -40
- data/lib/steam/community/defense_grid/defense_grid_stats.rb +4 -2
- data/lib/steam/community/dods/dods_class.rb +4 -2
- data/lib/steam/community/dods/dods_stats.rb +3 -1
- data/lib/steam/community/dods/dods_weapon.rb +4 -2
- data/lib/steam/community/game_class.rb +2 -6
- data/lib/steam/community/game_stats.rb +1 -3
- data/lib/steam/community/game_weapon.rb +1 -5
- data/lib/steam/community/l4d/abstract_l4d_stats.rb +3 -4
- data/lib/steam/community/l4d/abstract_l4d_weapon.rb +2 -3
- data/lib/steam/community/l4d/l4d2_stats.rb +3 -1
- data/lib/steam/community/l4d/l4d2_weapon.rb +4 -2
- data/lib/steam/community/l4d/l4d_explosive.rb +4 -2
- data/lib/steam/community/l4d/l4d_map.rb +1 -1
- data/lib/steam/community/l4d/l4d_stats.rb +4 -2
- data/lib/steam/community/l4d/l4d_weapon.rb +4 -2
- data/lib/steam/community/tf2/tf2_class.rb +3 -1
- data/lib/steam/community/tf2/tf2_class_factory.rb +1 -4
- data/lib/steam/community/tf2/tf2_engineer.rb +3 -1
- data/lib/steam/community/tf2/tf2_medic.rb +3 -1
- data/lib/steam/community/tf2/tf2_sniper.rb +3 -1
- data/lib/steam/community/tf2/tf2_spy.rb +3 -1
- data/lib/steam/community/tf2/tf2_stats.rb +4 -1
- data/lib/steam/packets/a2a_ack_packet.rb +6 -3
- data/lib/steam/packets/a2a_ping_packet.rb +3 -1
- data/lib/steam/packets/a2m_get_servers_batch2_packet.rb +4 -2
- data/lib/steam/packets/a2s_info_packet.rb +4 -2
- data/lib/steam/packets/a2s_player_packet.rb +3 -2
- data/lib/steam/packets/a2s_rules_packet.rb +3 -2
- data/lib/steam/packets/a2s_serverquery_getchallenge_packet.rb +4 -2
- data/lib/steam/packets/m2a_server_batch_packet.rb +4 -2
- data/lib/steam/packets/rcon/rcon_auth_request.rb +4 -2
- data/lib/steam/packets/rcon/rcon_auth_response.rb +4 -2
- data/lib/steam/packets/rcon/rcon_exec_request.rb +4 -2
- data/lib/steam/packets/rcon/rcon_exec_response.rb +6 -4
- data/lib/steam/packets/rcon/rcon_goldsrc_request.rb +3 -1
- data/lib/steam/packets/rcon/rcon_goldsrc_response.rb +4 -2
- data/lib/steam/packets/rcon/rcon_packet.rb +2 -3
- data/lib/steam/packets/rcon/rcon_packet_factory.rb +2 -3
- data/lib/steam/packets/s2a_info2_packet.rb +4 -2
- data/lib/steam/packets/s2a_info_base_packet.rb +2 -3
- data/lib/steam/packets/s2a_info_detailed_packet.rb +4 -2
- data/lib/steam/packets/s2a_player_packet.rb +4 -2
- data/lib/steam/packets/s2a_rules_packet.rb +3 -1
- data/lib/steam/packets/s2c_challenge_packet.rb +3 -1
- data/lib/steam/packets/steam_packet.rb +1 -1
- data/lib/steam/packets/steam_packet_factory.rb +2 -5
- data/lib/steam/servers/game_server.rb +2 -5
- data/lib/steam/servers/goldsrc_server.rb +3 -1
- data/lib/steam/servers/source_server.rb +3 -1
- data/lib/steam/sockets/goldsrc_socket.rb +4 -2
- data/lib/steam/sockets/master_server_socket.rb +3 -1
- data/lib/steam/sockets/rcon_socket.rb +3 -1
- data/lib/steam/sockets/source_socket.rb +5 -3
- data/lib/steam/sockets/steam_socket.rb +3 -6
- data/lib/stringio_additions.rb +1 -1
- metadata +4 -5
- data/lib/abstract_class.rb +0 -38
data/Rakefile
CHANGED
data/lib/datagram_channel.rb
CHANGED
@@ -24,8 +24,7 @@ class DatagramChannel
|
|
24
24
|
if args[0].is_a? IPAddr
|
25
25
|
ip_address = args[0].to_s
|
26
26
|
elsif args[0].is_a? String
|
27
|
-
|
28
|
-
ip_address = "#{sockaddr[0]}.#{sockaddr[1]}.#{sockaddr[2]}.#{sockaddr[3]}"
|
27
|
+
ip_address = IPSocket.getaddress args[0]
|
29
28
|
else
|
30
29
|
raise ArgumentError
|
31
30
|
end
|
@@ -8,7 +8,9 @@ require 'steam/community/css/css_weapon'
|
|
8
8
|
|
9
9
|
# The CSSStats class represents the game statistics for a single user in
|
10
10
|
# Counter-Strike: Source
|
11
|
-
class CSSStats
|
11
|
+
class CSSStats
|
12
|
+
|
13
|
+
include GameStats
|
12
14
|
|
13
15
|
MAPS = [ 'cs_assault', 'cs_compound', 'cs_havana', 'cs_italy', 'cs_militia',
|
14
16
|
'cs_office', 'de_aztec', 'de_cbble', 'de_chateau', 'de_dust',
|
@@ -31,45 +33,45 @@ class CSSStats < GameStats
|
|
31
33
|
@last_match_stats = {}
|
32
34
|
@total_stats = {}
|
33
35
|
|
34
|
-
@last_match_stats[:cost_per_kill]
|
35
|
-
@last_match_stats[:ct_wins]
|
36
|
-
@last_match_stats[:damage]
|
37
|
-
@last_match_stats[:deaths]
|
38
|
-
@last_match_stats[:dominations]
|
39
|
-
@last_match_stats[:
|
40
|
-
@last_match_stats[:kills]
|
41
|
-
@last_match_stats[:max_players]
|
42
|
-
@last_match_stats[:money]
|
43
|
-
@last_match_stats[:revenges]
|
44
|
-
@last_match_stats[:stars]
|
45
|
-
@last_match_stats[:t_wins]
|
46
|
-
@last_match_stats[:wins]
|
47
|
-
@total_stats[:blind_kills]
|
48
|
-
@total_stats[:bombs_defused]
|
49
|
-
@total_stats[:bombs_planted]
|
50
|
-
@total_stats[:damage]
|
51
|
-
@total_stats[:deaths]
|
52
|
-
@total_stats[:domination_overkills]
|
53
|
-
@total_stats[:dominations]
|
54
|
-
@total_stats[:earned_money]
|
55
|
-
@total_stats[:enemy_weapon_kills]
|
56
|
-
@total_stats[:headshots]
|
57
|
-
@total_stats[:hits]
|
58
|
-
@total_stats[:hostages_rescued]
|
59
|
-
@total_stats[:kills]
|
60
|
-
@total_stats[:knife_kills]
|
61
|
-
@total_stats[:logos_sprayed]
|
62
|
-
@total_stats[:nightvision_damage]
|
63
|
-
@total_stats[:pistol_rounds_won]
|
64
|
-
@total_stats[:revenges]
|
65
|
-
@total_stats[:rounds_played]
|
66
|
-
@total_stats[:rounds_won]
|
67
|
-
@total_stats[:seconds_played]
|
68
|
-
@total_stats[:shots]
|
69
|
-
@total_stats[:stars]
|
70
|
-
@total_stats[:weapons_donated]
|
71
|
-
@total_stats[:windows_broken]
|
72
|
-
@total_stats[:zoomed_sniper_kills]
|
36
|
+
@last_match_stats[:cost_per_kill] = @xml_data.elements['stats/lastmatch/costkill'].text.to_f
|
37
|
+
@last_match_stats[:ct_wins] = @xml_data.elements['stats/lastmatch/ct_wins'].text.to_i
|
38
|
+
@last_match_stats[:damage] = @xml_data.elements['stats/lastmatch/dmg'].text.to_i
|
39
|
+
@last_match_stats[:deaths] = @xml_data.elements['stats/lastmatch/deaths'].text.to_i
|
40
|
+
@last_match_stats[:dominations] = @xml_data.elements['stats/lastmatch/dominations'].text.to_i
|
41
|
+
@last_match_stats[:favorite_weapon_id] = @xml_data.elements['stats/lastmatch/favwpnid'].text.to_i
|
42
|
+
@last_match_stats[:kills] = @xml_data.elements['stats/lastmatch/kills'].text.to_i
|
43
|
+
@last_match_stats[:max_players] = @xml_data.elements['stats/lastmatch/max_players'].text.to_i
|
44
|
+
@last_match_stats[:money] = @xml_data.elements['stats/lastmatch/money'].text.to_i
|
45
|
+
@last_match_stats[:revenges] = @xml_data.elements['stats/lastmatch/revenges'].text.to_i
|
46
|
+
@last_match_stats[:stars] = @xml_data.elements['stats/lastmatch/stars'].text.to_i
|
47
|
+
@last_match_stats[:t_wins] = @xml_data.elements['stats/lastmatch/t_wins'].text.to_i
|
48
|
+
@last_match_stats[:wins] = @xml_data.elements['stats/lastmatch/wins'].text.to_i
|
49
|
+
@total_stats[:blind_kills] = @xml_data.elements['stats/lifetime/blindkills'].text.to_i
|
50
|
+
@total_stats[:bombs_defused] = @xml_data.elements['stats/lifetime/bombsdefused'].text.to_i
|
51
|
+
@total_stats[:bombs_planted] = @xml_data.elements['stats/lifetime/bombsplanted'].text.to_i
|
52
|
+
@total_stats[:damage] = @xml_data.elements['stats/lifetime/dmg'].text.to_i
|
53
|
+
@total_stats[:deaths] = @xml_data.elements['stats/summary/deaths'].text.to_i
|
54
|
+
@total_stats[:domination_overkills] = @xml_data.elements['stats/lifetime/dominationoverkills'].text.to_i
|
55
|
+
@total_stats[:dominations] = @xml_data.elements['stats/lifetime/dominations'].text.to_i
|
56
|
+
@total_stats[:earned_money] = @xml_data.elements['stats/lifetime/money'].text.to_i
|
57
|
+
@total_stats[:enemy_weapon_kills] = @xml_data.elements['stats/lifetime/enemywpnkills'].text.to_i
|
58
|
+
@total_stats[:headshots] = @xml_data.elements['stats/lifetime/headshots'].text.to_i
|
59
|
+
@total_stats[:hits] = @xml_data.elements['stats/summary/shotshit'].text.to_i
|
60
|
+
@total_stats[:hostages_rescued] = @xml_data.elements['stats/lifetime/hostagesrescued'].text.to_i
|
61
|
+
@total_stats[:kills] = @xml_data.elements['stats/summary/kills'].text.to_i
|
62
|
+
@total_stats[:knife_kills] = @xml_data.elements['stats/lifetime/knifekills'].text.to_i
|
63
|
+
@total_stats[:logos_sprayed] = @xml_data.elements['stats/lifetime/decals'].text.to_i
|
64
|
+
@total_stats[:nightvision_damage] = @xml_data.elements['stats/lifetime/nvgdmg'].text.to_i
|
65
|
+
@total_stats[:pistol_rounds_won] = @xml_data.elements['stats/lifetime/pistolrounds'].text.to_i
|
66
|
+
@total_stats[:revenges] = @xml_data.elements['stats/lifetime/revenges'].text.to_i
|
67
|
+
@total_stats[:rounds_played] = @xml_data.elements['stats/summary/rounds'].text.to_i
|
68
|
+
@total_stats[:rounds_won] = @xml_data.elements['stats/summary/wins'].text.to_i
|
69
|
+
@total_stats[:seconds_played] = @xml_data.elements['stats/summary/timeplayed'].text.to_i
|
70
|
+
@total_stats[:shots] = @xml_data.elements['stats/summary/shots'].text.to_i
|
71
|
+
@total_stats[:stars] = @xml_data.elements['stats/summary/stars'].text.to_i
|
72
|
+
@total_stats[:weapons_donated] = @xml_data.elements['stats/lifetime/wpndonated'].text.to_i
|
73
|
+
@total_stats[:windows_broken] = @xml_data.elements['stats/lifetime/winbroken'].text.to_i
|
74
|
+
@total_stats[:zoomed_sniper_kills] = @xml_data.elements['stats/lifetime/zsniperkills'].text.to_i
|
73
75
|
|
74
76
|
@last_match_stats[:kdratio] = @last_match_stats[:kills].to_f / @last_match_stats[:deaths]
|
75
77
|
@total_stats[:accuracy] = @total_stats[:hits].to_f / @total_stats[:shots]
|
@@ -1,13 +1,15 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2009, Sebastian Staudt
|
4
|
+
# Copyright (c) 2009-2010, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/game_stats'
|
7
7
|
|
8
8
|
# The DefenseGridStats class represents the game statistics for a single user in
|
9
9
|
# Defense Grid: The Awakening
|
10
|
-
class DefenseGridStats
|
10
|
+
class DefenseGridStats
|
11
|
+
|
12
|
+
include GameStats
|
11
13
|
|
12
14
|
attr_reader :bronze_medals, :damage_done, :damage_campaign, :damage_challenge,
|
13
15
|
:encountered, :gold_medals, :heat_damage, :interest, :killed,
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2009, Sebastian Staudt
|
4
|
+
# Copyright (c) 2009-2010, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/game_class'
|
7
7
|
|
8
8
|
# Represents the stats for a DoD:S class for a specific user
|
9
|
-
class DoDSClass
|
9
|
+
class DoDSClass
|
10
|
+
|
11
|
+
include GameClass
|
10
12
|
|
11
13
|
attr_reader :blocks, :bombs_defused, :bombs_planted, :captures, :deaths,
|
12
14
|
:dominations, :key, :kills, :name, :rounds_lost, :rounds_won,
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2009, Sebastian Staudt
|
4
|
+
# Copyright (c) 2009-2010, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/game_weapon'
|
7
7
|
|
8
8
|
# Represents the stats for a Day of Defeat: Source weapon for a specific user
|
9
|
-
class DoDSWeapon
|
9
|
+
class DoDSWeapon
|
10
|
+
|
11
|
+
include GameWeapon
|
10
12
|
|
11
13
|
attr_reader :headshots, :name, :hits
|
12
14
|
|
@@ -1,14 +1,10 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2009, Sebastian Staudt
|
5
|
-
|
6
|
-
require 'abstract_class'
|
4
|
+
# Copyright (c) 2009-2010, Sebastian Staudt
|
7
5
|
|
8
6
|
# Super class for classes representing player classes
|
9
|
-
|
10
|
-
|
11
|
-
include AbstractClass
|
7
|
+
module GameClass
|
12
8
|
|
13
9
|
attr_reader :name, :play_time
|
14
10
|
|
@@ -10,9 +10,7 @@ require 'steam/community/game_achievement'
|
|
10
10
|
|
11
11
|
# The GameStats class represents the game statistics for a single user and a
|
12
12
|
# specific game
|
13
|
-
|
14
|
-
|
15
|
-
protected :initialize
|
13
|
+
module GameStats
|
16
14
|
|
17
15
|
attr_reader :app_id, :custom_url, :game_friendly_name, :game_name,
|
18
16
|
:hours_played, :privacy_state, :steam_id64
|
@@ -1,17 +1,16 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2009, Sebastian Staudt
|
4
|
+
# Copyright (c) 2009-2010, Sebastian Staudt
|
5
5
|
|
6
|
-
require 'abstract_class'
|
7
6
|
require 'steam/community/game_stats'
|
8
7
|
|
9
8
|
# AbstractL4DStats is an abstract base class for statistics for Left4Dead and
|
10
9
|
# Left4Dead 2. As both games have more or less the same statistics available in
|
11
10
|
# the Steam Community the code for both is pretty much the same.
|
12
|
-
|
11
|
+
module AbstractL4DStats
|
13
12
|
|
14
|
-
include
|
13
|
+
include GameStats
|
15
14
|
|
16
15
|
SPECIAL_INFECTED = %w(boomer hunter smoker tank)
|
17
16
|
|
@@ -3,12 +3,11 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2009-2010, Sebastian Staudt
|
5
5
|
|
6
|
-
require 'abstract_class'
|
7
6
|
require 'steam/community/game_weapon'
|
8
7
|
|
9
|
-
|
8
|
+
module AbstractL4DWeapon
|
10
9
|
|
11
|
-
include
|
10
|
+
include GameWeapon
|
12
11
|
|
13
12
|
attr_reader :accuracy, :headshots_percentage, :kill_percentage
|
14
13
|
|
@@ -7,7 +7,9 @@ require 'steam/community/l4d/abstract_l4d_stats'
|
|
7
7
|
require 'steam/community/l4d/l4d2_map'
|
8
8
|
require 'steam/community/l4d/l4d2_weapon'
|
9
9
|
|
10
|
-
class L4D2Stats
|
10
|
+
class L4D2Stats
|
11
|
+
|
12
|
+
include AbstractL4DStats
|
11
13
|
|
12
14
|
SPECIAL_INFECTED = SPECIAL_INFECTED + %w{charger jockey spitter}
|
13
15
|
|
@@ -1,11 +1,13 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2009, Sebastian Staudt
|
4
|
+
# Copyright (c) 2009-2010, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/l4d/abstract_l4d_weapon'
|
7
7
|
|
8
|
-
class L4D2Weapon
|
8
|
+
class L4D2Weapon
|
9
|
+
|
10
|
+
include AbstractL4DWeapon
|
9
11
|
|
10
12
|
attr_reader :damage, :weapon_group
|
11
13
|
|
@@ -1,11 +1,13 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2009, Sebastian Staudt
|
4
|
+
# Copyright (c) 2009-2010, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/game_weapon'
|
7
7
|
|
8
|
-
class L4DExplosive
|
8
|
+
class L4DExplosive
|
9
|
+
|
10
|
+
include GameWeapon
|
9
11
|
|
10
12
|
# Creates a new instance of L4DExplosive based on the assigned XML data
|
11
13
|
def initialize(weapon_data)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2009, Sebastian Staudt
|
4
|
+
# Copyright (c) 2009-2010, Sebastian Staudt
|
5
5
|
|
6
6
|
# L4DMap holds statistical information about maps played by a player in
|
7
7
|
# Survival mode of Left4Dead.
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2009, Sebastian Staudt
|
4
|
+
# Copyright (c) 2009-2010, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/l4d/abstract_l4d_stats'
|
7
7
|
require 'steam/community/l4d/l4d_explosive'
|
8
8
|
require 'steam/community/l4d/l4d_map'
|
9
9
|
require 'steam/community/l4d/l4d_weapon'
|
10
10
|
|
11
|
-
class L4DStats
|
11
|
+
class L4DStats
|
12
|
+
|
13
|
+
include AbstractL4DStats
|
12
14
|
|
13
15
|
# Creates a L4DStats object by calling the super constructor with the game
|
14
16
|
# name "l4d".
|
@@ -1,11 +1,13 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2009, Sebastian Staudt
|
4
|
+
# Copyright (c) 2009-2010, Sebastian Staudt
|
5
5
|
|
6
6
|
require 'steam/community/l4d/abstract_l4d_weapon'
|
7
7
|
|
8
|
-
class L4DWeapon
|
8
|
+
class L4DWeapon
|
9
|
+
|
10
|
+
include AbstractL4DWeapon
|
9
11
|
|
10
12
|
attr_reader :accuracy, :headshots_percentage, :kill_percentage
|
11
13
|
|
@@ -6,7 +6,9 @@
|
|
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
|
-
|
9
|
+
module TF2Class
|
10
|
+
|
11
|
+
include GameClass
|
10
12
|
|
11
13
|
attr_reader :max_buildings_destroyed, :max_captures, :max_damage,
|
12
14
|
:max_defenses, :max_dominations, :max_kill_assists, :max_kills,
|
@@ -3,7 +3,6 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2008-2010, Sebastian Staudt
|
5
5
|
|
6
|
-
require 'abstract_class'
|
7
6
|
require 'steam/community/tf2/tf2_class'
|
8
7
|
require 'steam/community/tf2/tf2_engineer'
|
9
8
|
require 'steam/community/tf2/tf2_medic'
|
@@ -12,9 +11,7 @@ require 'steam/community/tf2/tf2_spy'
|
|
12
11
|
|
13
12
|
# The TF2ClassFactory is used to created instances of TF2Class based on the XML
|
14
13
|
# input data
|
15
|
-
|
16
|
-
|
17
|
-
include AbstractClass
|
14
|
+
module TF2ClassFactory
|
18
15
|
|
19
16
|
# Creates a new instance of TF2Class storing the statistics for a Team
|
20
17
|
# Fortress 2 class with the assigned XML data
|
@@ -7,7 +7,9 @@ require 'steam/community/tf2/tf2_class'
|
|
7
7
|
|
8
8
|
# Represents the stats for the Team Fortress 2 engineer class for a specific
|
9
9
|
# user
|
10
|
-
class TF2Engineer
|
10
|
+
class TF2Engineer
|
11
|
+
|
12
|
+
include TF2Class
|
11
13
|
|
12
14
|
attr_reader :max_buildings_built, :max_teleports, :max_sentry_kills
|
13
15
|
|
@@ -6,7 +6,9 @@
|
|
6
6
|
require 'steam/community/tf2/tf2_class'
|
7
7
|
|
8
8
|
# Represents the stats for the Team Fortress 2 sniper class for a specific user
|
9
|
-
class TF2Sniper
|
9
|
+
class TF2Sniper
|
10
|
+
|
11
|
+
include TF2Class
|
10
12
|
|
11
13
|
# Creates a new instance of TF2Sniper based on the assigned XML data
|
12
14
|
def initialize(class_data)
|
@@ -3,11 +3,14 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2008-2010, Sebastian Staudt
|
5
5
|
|
6
|
+
require 'steam/community/game_stats'
|
6
7
|
require 'steam/community/tf2/tf2_class_factory'
|
7
8
|
|
8
9
|
# The TF2Stats class represents the game statistics for a single user in Team
|
9
10
|
# Fortress 2
|
10
|
-
class TF2Stats
|
11
|
+
class TF2Stats
|
12
|
+
|
13
|
+
include GameStats
|
11
14
|
|
12
15
|
attr_reader :accumulated_points
|
13
16
|
|
@@ -3,19 +3,22 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2008-2010, Sebastian Staudt
|
5
5
|
|
6
|
+
require 'exceptions/packet_format_exception'
|
6
7
|
require 'steam/packets/steam_packet'
|
7
8
|
|
8
9
|
# The A2A_ACK_Packet class represents the response to a A2A_PING
|
9
10
|
# request send to the server.
|
10
|
-
class A2A_ACK_Packet
|
11
|
+
class A2A_ACK_Packet
|
12
|
+
|
13
|
+
include SteamPacket
|
11
14
|
|
12
15
|
# Creates a A2A_ACK response object based on the data received.
|
13
16
|
def initialize(data)
|
14
17
|
if data != "\0" && data != "00000000000000\0"
|
15
|
-
raise
|
18
|
+
raise PacketFormatException.new('Wrong formatted A2A_ACK packet.')
|
16
19
|
end
|
17
20
|
|
18
|
-
super
|
21
|
+
super A2A_ACK_HEADER, data
|
19
22
|
end
|
20
23
|
|
21
24
|
end
|
@@ -7,7 +7,9 @@ require 'steam/packets/steam_packet'
|
|
7
7
|
|
8
8
|
# The A2A_PING_Packet class represents a A2A_PING request send to the
|
9
9
|
# server.
|
10
|
-
class A2A_PING_Packet
|
10
|
+
class A2A_PING_Packet
|
11
|
+
|
12
|
+
include SteamPacket
|
11
13
|
|
12
14
|
# Creates a new A2A_PING request object
|
13
15
|
def initialize
|
@@ -6,11 +6,13 @@
|
|
6
6
|
require 'steam/packets/steam_packet'
|
7
7
|
require 'steam/servers/master_server'
|
8
8
|
|
9
|
-
class A2M_GET_SERVERS_BATCH2_Packet
|
9
|
+
class A2M_GET_SERVERS_BATCH2_Packet
|
10
|
+
|
11
|
+
include SteamPacket
|
10
12
|
|
11
13
|
# Creates a master server request, filtering by the given paramters.
|
12
14
|
def initialize(region_code = MasterServer::REGION_ALL, start_ip = '0.0.0.0:0', filter = '')
|
13
|
-
super
|
15
|
+
super A2M_GET_SERVERS_BATCH2_HEADER
|
14
16
|
|
15
17
|
@filter = filter
|
16
18
|
@region_code = region_code
|
@@ -7,11 +7,13 @@ require 'steam/packets/steam_packet'
|
|
7
7
|
|
8
8
|
# The A2S_INFO_Packet class represents a A2S_INFO request send to the
|
9
9
|
# server.
|
10
|
-
class A2S_INFO_Packet
|
10
|
+
class A2S_INFO_Packet
|
11
|
+
|
12
|
+
include SteamPacket
|
11
13
|
|
12
14
|
# Creates a new A2S_INFO request object
|
13
15
|
def initialize
|
14
|
-
super
|
16
|
+
super A2S_INFO_HEADER, "Source Engine Query\0"
|
15
17
|
end
|
16
18
|
|
17
19
|
end
|
@@ -8,13 +8,14 @@ require 'steam/packets/steam_packet'
|
|
8
8
|
|
9
9
|
# The A2S_PLAYER_Packet class represents a A2S_PLAYER request send to the
|
10
10
|
# server.
|
11
|
-
class A2S_PLAYER_Packet
|
11
|
+
class A2S_PLAYER_Packet
|
12
12
|
|
13
13
|
include RequestWithChallenge
|
14
|
+
include SteamPacket
|
14
15
|
|
15
16
|
# Creates a new A2S_PLAYER request object including the challenge_number
|
16
17
|
def initialize(challenge_number = -1)
|
17
|
-
super
|
18
|
+
super A2S_PLAYER_HEADER, challenge_number
|
18
19
|
end
|
19
20
|
|
20
21
|
end
|
@@ -7,13 +7,14 @@ require 'steam/packets/request_with_challenge'
|
|
7
7
|
require 'steam/packets/steam_packet'
|
8
8
|
|
9
9
|
# Creates a new A2A_RULES request object including the challenge_number
|
10
|
-
class A2S_RULES_Packet
|
10
|
+
class A2S_RULES_Packet
|
11
11
|
|
12
12
|
include RequestWithChallenge
|
13
|
+
include SteamPacket
|
13
14
|
|
14
15
|
# Creates a new A2S_RULES request object including the challenge_number
|
15
16
|
def initialize(challenge_number = -1)
|
16
|
-
super
|
17
|
+
super A2S_RULES_HEADER, challenge_number
|
17
18
|
end
|
18
19
|
|
19
20
|
end
|
@@ -7,11 +7,13 @@ require 'steam/packets/steam_packet'
|
|
7
7
|
|
8
8
|
# The A2S_SERVERQUERY_GETCHALLENGE_Packet class represents a
|
9
9
|
# A2S_SERVERQUERY_GETCHALLENGE request send to the server.
|
10
|
-
class A2S_SERVERQUERY_GETCHALLENGE_Packet
|
10
|
+
class A2S_SERVERQUERY_GETCHALLENGE_Packet
|
11
|
+
|
12
|
+
include SteamPacket
|
11
13
|
|
12
14
|
# Creates a new A2S_SERVERQUERY_GETCHALLENGE request object
|
13
15
|
def initialize
|
14
|
-
super
|
16
|
+
super A2S_SERVERQUERY_GETCHALLENGE_HEADER
|
15
17
|
end
|
16
18
|
|
17
19
|
end
|
@@ -5,12 +5,14 @@
|
|
5
5
|
|
6
6
|
require 'steam/packets/steam_packet'
|
7
7
|
|
8
|
-
class M2A_SERVER_BATCH_Packet
|
8
|
+
class M2A_SERVER_BATCH_Packet
|
9
|
+
|
10
|
+
include SteamPacket
|
9
11
|
|
10
12
|
attr_reader :servers
|
11
13
|
|
12
14
|
def initialize(data)
|
13
|
-
super
|
15
|
+
super M2A_SERVER_BATCH_HEADER, data
|
14
16
|
|
15
17
|
unless @content_data.byte == 0x0A
|
16
18
|
raise PacketFormatException.new('Master query response is missing additional 0x0A byte.')
|
@@ -5,10 +5,12 @@
|
|
5
5
|
|
6
6
|
require 'steam/packets/rcon/rcon_packet'
|
7
7
|
|
8
|
-
class RCONAuthRequest
|
8
|
+
class RCONAuthRequest
|
9
|
+
|
10
|
+
include RCONPacket
|
9
11
|
|
10
12
|
def initialize(request_id, rcon_password)
|
11
|
-
super request_id,
|
13
|
+
super request_id, SERVERDATA_AUTH, rcon_password
|
12
14
|
end
|
13
15
|
|
14
16
|
end
|
@@ -5,10 +5,12 @@
|
|
5
5
|
|
6
6
|
require 'steam/packets/rcon/rcon_packet'
|
7
7
|
|
8
|
-
class RCONAuthResponse
|
8
|
+
class RCONAuthResponse
|
9
|
+
|
10
|
+
include RCONPacket
|
9
11
|
|
10
12
|
def initialize(request_id)
|
11
|
-
super request_id,
|
13
|
+
super request_id, SERVERDATA_AUTH_RESPONSE, ''
|
12
14
|
end
|
13
15
|
|
14
16
|
end
|
@@ -5,10 +5,12 @@
|
|
5
5
|
|
6
6
|
require 'steam/packets/rcon/rcon_packet'
|
7
7
|
|
8
|
-
class RCONExecRequest
|
8
|
+
class RCONExecRequest
|
9
|
+
|
10
|
+
include RCONPacket
|
9
11
|
|
10
12
|
def initialize(request_id, rcon_command)
|
11
|
-
super request_id,
|
13
|
+
super request_id, SERVERDATA_EXECCOMMAND, rcon_command
|
12
14
|
end
|
13
15
|
|
14
16
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2008-
|
4
|
+
# Copyright (c) 2008-2010, Sebastian Staudt
|
5
5
|
|
6
|
-
require
|
6
|
+
require 'steam/packets/rcon/rcon_packet'
|
7
7
|
|
8
|
-
class RCONExecResponse
|
8
|
+
class RCONExecResponse
|
9
|
+
|
10
|
+
include RCONPacket
|
9
11
|
|
10
12
|
def initialize(request_id, command_response)
|
11
|
-
super request_id,
|
13
|
+
super request_id, SERVERDATA_RESPONSE_VALUE, command_response
|
12
14
|
end
|
13
15
|
|
14
16
|
def response
|
@@ -5,10 +5,12 @@
|
|
5
5
|
|
6
6
|
require 'steam/packets/steam_packet'
|
7
7
|
|
8
|
-
class RCONGoldSrcResponse
|
8
|
+
class RCONGoldSrcResponse
|
9
|
+
|
10
|
+
include SteamPacket
|
9
11
|
|
10
12
|
def initialize(command_response)
|
11
|
-
super
|
13
|
+
super RCON_GOLDSRC_RESPONSE_HEADER, command_response
|
12
14
|
end
|
13
15
|
|
14
16
|
def response
|
@@ -3,12 +3,11 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2008-2010, Sebastian Staudt
|
5
5
|
|
6
|
-
require 'abstract_class'
|
7
6
|
require 'steam/packets/steam_packet'
|
8
7
|
|
9
|
-
|
8
|
+
module RCONPacket
|
10
9
|
|
11
|
-
include
|
10
|
+
include SteamPacket
|
12
11
|
|
13
12
|
SERVERDATA_AUTH = 3
|
14
13
|
SERVERDATA_AUTH_RESPONSE = 2
|
@@ -3,16 +3,15 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2008-2010, Sebastian Staudt
|
5
5
|
|
6
|
-
require 'abstract_class'
|
7
6
|
require 'stringio_additions'
|
8
7
|
require 'exceptions/packet_format_exception'
|
9
8
|
require 'steam/packets/steam_packet_factory'
|
10
9
|
require 'steam/packets/rcon/rcon_auth_response'
|
11
10
|
require 'steam/packets/rcon/rcon_exec_response'
|
12
11
|
|
13
|
-
|
12
|
+
module RCONPacketFactory
|
14
13
|
|
15
|
-
include
|
14
|
+
include SteamPacketFactory
|
16
15
|
|
17
16
|
def self.packet_from_data(raw_data)
|
18
17
|
byte_buffer = StringIO.new raw_data
|
@@ -7,11 +7,13 @@ require 'steam/packets/s2a_info_base_packet'
|
|
7
7
|
|
8
8
|
# The S2A_INFO2_Packet class represents the response to a A2A_INFO
|
9
9
|
# request send to a Source server.
|
10
|
-
class S2A_INFO2_Packet
|
10
|
+
class S2A_INFO2_Packet
|
11
|
+
|
12
|
+
include S2A_INFO_BasePacket
|
11
13
|
|
12
14
|
# Creates a S2A_INFO2 response object based on the data received.
|
13
15
|
def initialize(data)
|
14
|
-
super
|
16
|
+
super S2A_INFO2_HEADER, data
|
15
17
|
|
16
18
|
@protocol_version = @content_data.byte
|
17
19
|
@server_name = @content_data.cstring
|
@@ -3,14 +3,13 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2008-2010, Sebastian Staudt
|
5
5
|
|
6
|
-
require 'abstract_class'
|
7
6
|
require 'steam/packets/steam_packet'
|
8
7
|
|
9
8
|
# The S2A_INFO_BasePacket class represents the response to a A2S_INFO
|
10
9
|
# request send to the server.
|
11
|
-
|
10
|
+
module S2A_INFO_BasePacket
|
12
11
|
|
13
|
-
include
|
12
|
+
include SteamPacket
|
14
13
|
|
15
14
|
attr_reader :info_hash
|
16
15
|
|
@@ -9,11 +9,13 @@ require "steam/packets/s2a_info_base_packet"
|
|
9
9
|
# request send to a GoldSrc server.
|
10
10
|
# This is deprecated by 10/24/2008 for GoldSrc servers. They use the same
|
11
11
|
# format as Source servers (S2A_INFO2) now.
|
12
|
-
class S2A_INFO_DETAILED_Packet
|
12
|
+
class S2A_INFO_DETAILED_Packet
|
13
|
+
|
14
|
+
include S2A_INFO_BasePacket
|
13
15
|
|
14
16
|
# Creates a S2A_INFO_DETAILED response object based on the data received.
|
15
17
|
def initialize(data)
|
16
|
-
super
|
18
|
+
super S2A_INFO_DETAILED_HEADER, data
|
17
19
|
|
18
20
|
@game_ip = @content_data.cstring
|
19
21
|
@server_name = @content_data.cstring
|
@@ -7,7 +7,9 @@ require 'steam/packets/steam_packet'
|
|
7
7
|
|
8
8
|
# The S2A_PLAYER_Packet class represents the response to a A2S_PLAYER
|
9
9
|
# request send to the server.
|
10
|
-
class S2A_PLAYER_Packet
|
10
|
+
class S2A_PLAYER_Packet
|
11
|
+
|
12
|
+
include SteamPacket
|
11
13
|
|
12
14
|
attr_reader :player_hash
|
13
15
|
|
@@ -15,7 +17,7 @@ class S2A_PLAYER_Packet < SteamPacket
|
|
15
17
|
def initialize(content_data)
|
16
18
|
raise Exception.new('Wrong formatted S2A_PLAYER packet.') if content_data.nil?
|
17
19
|
|
18
|
-
super
|
20
|
+
super S2A_PLAYER_HEADER, content_data
|
19
21
|
|
20
22
|
# Ignore player count
|
21
23
|
@content_data.byte
|
@@ -7,7 +7,9 @@ require 'steam/packets/steam_packet'
|
|
7
7
|
|
8
8
|
# The S2A_RULES_Packet class represents the response to a A2S_RULES
|
9
9
|
# request send to the server.
|
10
|
-
class S2A_RULES_Packet
|
10
|
+
class S2A_RULES_Packet
|
11
|
+
|
12
|
+
include SteamPacket
|
11
13
|
|
12
14
|
attr_reader :rules_hash
|
13
15
|
|
@@ -7,7 +7,9 @@ require 'steam/packets/steam_packet'
|
|
7
7
|
|
8
8
|
# The S2C_CHALLENGE_Packet class represents the response
|
9
9
|
# to a A2S_SERVERQUERY_GETCHALLENGE request send to the server.
|
10
|
-
class S2C_CHALLENGE_Packet
|
10
|
+
class S2C_CHALLENGE_Packet
|
11
|
+
|
12
|
+
include SteamPacket
|
11
13
|
|
12
14
|
# Creates a AS2C_CHALLENGE response object based on the data received.
|
13
15
|
def initialize(challenge_number)
|
@@ -5,7 +5,6 @@
|
|
5
5
|
|
6
6
|
require 'zlib'
|
7
7
|
|
8
|
-
require 'abstract_class'
|
9
8
|
require 'exceptions/steam_condenser_exception'
|
10
9
|
require 'steam/packets/s2a_info_detailed_packet'
|
11
10
|
require 'steam/packets/a2s_info_packet'
|
@@ -22,13 +21,11 @@ require 'steam/packets/a2m_get_servers_batch2_packet'
|
|
22
21
|
require 'steam/packets/m2a_server_batch_packet'
|
23
22
|
require 'steam/packets/rcon/rcon_goldsrc_response'
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
include AbstractClass
|
24
|
+
module SteamPacketFactory
|
28
25
|
|
29
26
|
# Creates a new packet object based on the header byte of the given raw data
|
30
27
|
def self.packet_from_data(raw_data)
|
31
|
-
header = raw_data[0].
|
28
|
+
header = raw_data[0].ord
|
32
29
|
data = raw_data[1..-1]
|
33
30
|
|
34
31
|
case header
|
@@ -3,7 +3,6 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2008-2010, Sebastian Staudt
|
5
5
|
|
6
|
-
require 'abstract_class'
|
7
6
|
require 'exceptions/steam_condenser_exception'
|
8
7
|
require 'steam/steam_player'
|
9
8
|
require 'steam/packets/a2s_info_packet'
|
@@ -16,9 +15,7 @@ require 'steam/packets/s2a_player_packet'
|
|
16
15
|
require 'steam/packets/s2a_rules_packet'
|
17
16
|
require 'steam/packets/s2c_challenge_packet'
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
include AbstractClass
|
18
|
+
module GameServer
|
22
19
|
|
23
20
|
REQUEST_CHALLENGE = 0
|
24
21
|
REQUEST_INFO = 1
|
@@ -134,7 +131,7 @@ class GameServer
|
|
134
131
|
players.pop if is_a? GoldSrcServer
|
135
132
|
|
136
133
|
players.each do |player|
|
137
|
-
player_data = split_player_status(player)
|
134
|
+
player_data = self.class.split_player_status(player)
|
138
135
|
@player_hash[player_data[1]].add_info(*player_data) if @player_hash.key?(player_data[1])
|
139
136
|
end
|
140
137
|
end
|
@@ -6,7 +6,9 @@
|
|
6
6
|
require 'steam/servers/game_server'
|
7
7
|
require 'steam/sockets/goldsrc_socket'
|
8
8
|
|
9
|
-
class GoldSrcServer
|
9
|
+
class GoldSrcServer
|
10
|
+
|
11
|
+
include GameServer
|
10
12
|
|
11
13
|
# Splits the player status obtained with +rcon status+
|
12
14
|
def self.split_player_status(player_status)
|
@@ -11,7 +11,9 @@ require 'steam/servers/game_server'
|
|
11
11
|
require 'steam/sockets/rcon_socket'
|
12
12
|
require 'steam/sockets/source_socket'
|
13
13
|
|
14
|
-
class SourceServer
|
14
|
+
class SourceServer
|
15
|
+
|
16
|
+
include GameServer
|
15
17
|
|
16
18
|
# Splits the player status obtained with +rcon status+
|
17
19
|
def self.split_player_status(player_status)
|
@@ -10,7 +10,9 @@ require 'steam/sockets/steam_socket'
|
|
10
10
|
|
11
11
|
# The SourceSocket class is a sub class of SteamSocket respecting the
|
12
12
|
# specifications of the Source query protocol.
|
13
|
-
class GoldSrcSocket
|
13
|
+
class GoldSrcSocket
|
14
|
+
|
15
|
+
include SteamSocket
|
14
16
|
|
15
17
|
def initialize(ipaddress, port_number = 27015, is_hltv = false)
|
16
18
|
super ipaddress, port_number
|
@@ -29,7 +31,7 @@ class GoldSrcSocket < SteamSocket
|
|
29
31
|
begin
|
30
32
|
# Parsing of split packet headers
|
31
33
|
request_id = @buffer.long
|
32
|
-
packet_number_and_count = @buffer.byte
|
34
|
+
packet_number_and_count = @buffer.byte
|
33
35
|
packet_count = packet_number_and_count & 0xF
|
34
36
|
packet_number = (packet_number_and_count >> 4) + 1
|
35
37
|
|
@@ -9,7 +9,9 @@ require 'steam/packets/rcon/rcon_packet'
|
|
9
9
|
require 'steam/packets/rcon/rcon_packet_factory'
|
10
10
|
require 'steam/sockets/steam_socket'
|
11
11
|
|
12
|
-
class RCONSocket
|
12
|
+
class RCONSocket
|
13
|
+
|
14
|
+
include SteamSocket
|
13
15
|
|
14
16
|
def initialize(ip_address, port_number)
|
15
17
|
super ip_address, port_number
|
@@ -8,7 +8,9 @@ require 'steam/sockets/steam_socket'
|
|
8
8
|
|
9
9
|
# The SourceSocket class is a sub class of SteamSocket respecting the
|
10
10
|
# specifications of the Source query protocol.
|
11
|
-
class SourceSocket
|
11
|
+
class SourceSocket
|
12
|
+
|
13
|
+
include SteamSocket
|
12
14
|
|
13
15
|
# Reads a packet from the channel. The Source query protocol specifies a
|
14
16
|
# maximum packet size of 1400 byte. Greater packets will be split over several
|
@@ -24,8 +26,8 @@ class SourceSocket < SteamSocket
|
|
24
26
|
# Parsing of split packet headers
|
25
27
|
request_id = @buffer.long
|
26
28
|
is_compressed = ((request_id & 0x80000000) != 0)
|
27
|
-
packet_count = @buffer.byte
|
28
|
-
packet_number = @buffer.byte
|
29
|
+
packet_count = @buffer.byte
|
30
|
+
packet_number = @buffer.byte + 1
|
29
31
|
|
30
32
|
if is_compressed
|
31
33
|
@buffer.long
|
@@ -3,7 +3,6 @@
|
|
3
3
|
#
|
4
4
|
# Copyright (c) 2008-2010, Sebastian Staudt
|
5
5
|
|
6
|
-
require 'abstract_class'
|
7
6
|
require 'datagram_channel'
|
8
7
|
require 'ipaddr'
|
9
8
|
require 'stringio_additions'
|
@@ -11,13 +10,11 @@ require 'exceptions/timeout_exception'
|
|
11
10
|
|
12
11
|
# Defines common methods for sockets used to connect to game and master
|
13
12
|
# servers.
|
14
|
-
|
15
|
-
|
16
|
-
include AbstractClass
|
13
|
+
module SteamSocket
|
17
14
|
|
18
15
|
def initialize(*args)
|
19
16
|
@channel = DatagramChannel.open
|
20
|
-
@channel.connect
|
17
|
+
@channel.connect(*args)
|
21
18
|
@channel.configure_blocking false
|
22
19
|
|
23
20
|
@remote_socket = Socket.getaddrinfo args[0].to_s, args[1]
|
@@ -32,7 +29,7 @@ class SteamSocket
|
|
32
29
|
raise TimeoutException if select([@channel.socket], nil, nil, 1).nil?
|
33
30
|
|
34
31
|
if buffer_length == 0
|
35
|
-
@buffer.
|
32
|
+
@buffer.rewind
|
36
33
|
else
|
37
34
|
@buffer = StringIO.allocate buffer_length
|
38
35
|
end
|
data/lib/stringio_additions.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steam-condenser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 11
|
9
|
-
-
|
10
|
-
version: 0.11.
|
9
|
+
- 4
|
10
|
+
version: 0.11.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sebastian Staudt
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-07 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -45,7 +45,6 @@ files:
|
|
45
45
|
- LICENSE
|
46
46
|
- README.md
|
47
47
|
- Rakefile
|
48
|
-
- lib/abstract_class.rb
|
49
48
|
- lib/datagram_channel.rb
|
50
49
|
- lib/exceptions/packet_format_exception.rb
|
51
50
|
- lib/exceptions/rcon_ban_exception.rb
|
data/lib/abstract_class.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# This code is free software; you can redistribute it and/or modify it under the
|
2
|
-
# terms of the new BSD License.
|
3
|
-
#
|
4
|
-
# Copyright (c) 2008-2009, Sebastian Staudt
|
5
|
-
|
6
|
-
# This module is used to mimic the behavior of abstract classes known from other
|
7
|
-
# object-oriented programming languages
|
8
|
-
module AbstractClass
|
9
|
-
|
10
|
-
# If this module is included in a class:
|
11
|
-
# * protect the constructor of the class
|
12
|
-
# * make sure every derived class has a constructor calling the super
|
13
|
-
# constructor
|
14
|
-
def self.included(klass)
|
15
|
-
klass.module_eval do
|
16
|
-
|
17
|
-
class << self
|
18
|
-
protected :new
|
19
|
-
|
20
|
-
# Each derived class gets a constructor calling the super constructor
|
21
|
-
def inherited(klass)
|
22
|
-
klass.module_eval do
|
23
|
-
|
24
|
-
# The constructor for derived classes, simply calling the super
|
25
|
-
# constructor
|
26
|
-
def self.new(*args)
|
27
|
-
super
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|