steam-condenser 0.13.0 → 0.13.1
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/lib/steam-condenser/version.rb +1 -1
- data/lib/steam/servers/game_server.rb +19 -6
- metadata +4 -4
@@ -28,8 +28,6 @@ module GameServer
|
|
28
28
|
def self.player_status_attributes(status_header)
|
29
29
|
status_header.split.map do |attribute|
|
30
30
|
case attribute
|
31
|
-
when '#'
|
32
|
-
:id
|
33
31
|
when 'connected'
|
34
32
|
:time
|
35
33
|
when 'frag'
|
@@ -42,13 +40,22 @@ module GameServer
|
|
42
40
|
|
43
41
|
# Splits the player status obtained with +rcon status+
|
44
42
|
def self.split_player_status(attributes, player_status)
|
45
|
-
|
43
|
+
player_status.sub! /^\d+ +/, '' if attributes.first != :userid
|
44
|
+
|
45
|
+
first_quote = player_status.index '"'
|
46
|
+
last_quote = player_status.rindex '"'
|
47
|
+
data = [
|
48
|
+
player_status[0, first_quote],
|
49
|
+
player_status[first_quote + 1..last_quote - 1],
|
50
|
+
player_status[last_quote + 1..-1]
|
51
|
+
]
|
46
52
|
data = [ data[0].split, data[1], data[2].split ]
|
47
53
|
data.flatten!
|
48
54
|
|
49
|
-
if attributes.size > data.size
|
50
|
-
data.insert
|
51
|
-
|
55
|
+
if attributes.size > data.size && attributes.include?(:state)
|
56
|
+
data.insert 3, nil, nil, nil
|
57
|
+
elsif attributes.size < data.size
|
58
|
+
data.delete_at 1
|
52
59
|
end
|
53
60
|
|
54
61
|
player_data = {}
|
@@ -89,6 +96,10 @@ module GameServer
|
|
89
96
|
@player_hash
|
90
97
|
end
|
91
98
|
|
99
|
+
def rcon_authenticated?
|
100
|
+
@rcon_authenticated
|
101
|
+
end
|
102
|
+
|
92
103
|
# Returns a hash of the settings applied on the server. These settings are
|
93
104
|
# also called rules.
|
94
105
|
# The hash has the format of +rule_name+ => +rule_value+
|
@@ -173,6 +184,8 @@ module GameServer
|
|
173
184
|
rcon_auth rcon_password
|
174
185
|
players = rcon_exec('status').lines.select do |line|
|
175
186
|
line.start_with?('#') && line != "#end\n"
|
187
|
+
end.map do |line|
|
188
|
+
line[1..-1].strip
|
176
189
|
end
|
177
190
|
attributes = GameServer.player_status_attributes players.shift
|
178
191
|
|
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: 41
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 13
|
9
|
-
-
|
10
|
-
version: 0.13.
|
9
|
+
- 1
|
10
|
+
version: 0.13.1
|
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: 2011-04-
|
18
|
+
date: 2011-04-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: bzip2-ruby
|