tclog 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/misc/test.log ADDED
@@ -0,0 +1,189 @@
1
+ LOADING... maps/obj_northport.bsp
2
+ Match starting...
3
+ [skipnotify]^7Overall stats for: ^3*Pasra* @sora_h ^7(^21^7 Round)
4
+
5
+ [skipnotify]Weapon Acrcy Hits/Atts Kills Deaths Headshots
6
+ [skipnotify]-------------------------------------------------
7
+ [skipnotify]^3No weapon info available.
8
+ [skipnotify]
9
+ ^2Rank: ^7Schutze (0 XP)
10
+ [skipnotify]Skills Level/Points
11
+ [skipnotify]---------------------------
12
+ [skipnotify]^3No skills acquired!
13
+ [skipnotify]
14
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
15
+ ^7---------------------------------------------------------------------
16
+ [skipnotify]^1Terrorists^7 ^3*Pasra* @sora_h^3 0 0 0 0^3 0^3 2^2 0^1 0^6 0^3 0
17
+ [skipnotify]^7---------------------------------------------------------------------
18
+ ^1Terrorists^7 ^5Totals 0 0 0 0^5 0^3 0^2 0^1 0^6 0^3 0
19
+ [skipnotify]
20
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
21
+ ^7---------------------------------------------------------------------
22
+ [skipnotify]^4Specops^7 ^7*Pasra*Glass_sa^3 0 0 1 0^7 0^3 2^2 0^1 0^6 0^3 -1
23
+ [skipnotify]^7---------------------------------------------------------------------
24
+ ^4Specops^7 ^5Totals 0 0 1 0^5 0^3 -1^2 0^1 0^6 0^3 -1
25
+ [skipnotify]
26
+ Match starting...
27
+ [skipnotify]^7Overall stats for: ^3*Pasra* @sora_h ^7(^21^7 Round)
28
+
29
+ [skipnotify]Weapon Acrcy Hits/Atts Kills Deaths Headshots
30
+ [skipnotify]-------------------------------------------------
31
+ [skipnotify]^3No weapon info available.
32
+ [skipnotify]
33
+ ^2Rank: ^7Schutze (0 XP)
34
+ [skipnotify]Skills Level/Points
35
+ [skipnotify]---------------------------
36
+ [skipnotify]^3No skills acquired!
37
+ [skipnotify]
38
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
39
+ ^7---------------------------------------------------------------------
40
+ [skipnotify]^7---------------------------------------------------------------------
41
+ ^1Terrorists^7 ^5Totals 0 0 0 0^5 0^3 0^2 0^1 0^6 0^3 0
42
+ [skipnotify]
43
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
44
+ ^7---------------------------------------------------------------------
45
+ [skipnotify]^4Specops^7 ^7*Pasra*Glass_sa^3 0 0 1 0^7 0^3 2^2 0^1 0^6 0^3 -1
46
+ [skipnotify]^7---------------------------------------------------------------------
47
+ ^4Specops^7 ^5Totals 0 0 1 0^5 0^3 -1^2 0^1 0^6 0^3 -1
48
+ [skipnotify]
49
+
50
+
51
+ Match starting...
52
+ [skipnotify]^7Overall stats for: ^3*Pasra* @sora_h ^7(^21^7 Round)
53
+
54
+ [skipnotify]Weapon Acrcy Hits/Atts Kills Deaths Headshots
55
+ [skipnotify]-------------------------------------------------
56
+ [skipnotify]^3No weapon info available.
57
+ [skipnotify]
58
+ ^2Rank: ^7Schutze (0 XP)
59
+ [skipnotify]Skills Level/Points
60
+ [skipnotify]---------------------------
61
+ [skipnotify]^3No skills acquired!
62
+ [skipnotify]
63
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
64
+ ^7---------------------------------------------------------------------
65
+ [skipnotify]^1Terrorists^7 ^3*Pasra* @sora_h^3 0 0 1 0^3 0^3 2^2 0^1 0^6 0^3 -1
66
+ [skipnotify]^7---------------------------------------------------------------------
67
+ ^1Terrorists^7 ^5Totals 0 0 1 0^5 0^3 -1^2 0^1 0^6 0^3 -1
68
+ [skipnotify]
69
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
70
+ ^7---------------------------------------------------------------------
71
+ [skipnotify]^4Specops^7 ^7*Pasra*Glass_sa^3 0 0 0 0^7 0^3 2^2 0^1 0^6 0^3 0
72
+ [skipnotify]^7---------------------------------------------------------------------
73
+ ^4Specops^7 ^5Totals 0 0 0 0^5 0^3 0^2 0^1 0^6 0^3 0
74
+ [skipnotify]
75
+
76
+ Match starting...
77
+ [skipnotify]Timelimit hit.
78
+ [skipnotify]^7Overall stats for: ^3*Pasra* @sora_h ^7(^21^7 Round)
79
+
80
+ [skipnotify]Weapon Acrcy Hits/Atts Kills Deaths Headshots
81
+ [skipnotify]-------------------------------------------------
82
+ [skipnotify]^3FG-42 : ^7 0.0 ^5 0/15 ^2 0 ^1 0 ^3 0
83
+ [skipnotify]
84
+ ^3Damage Given: ^70 ^3Team Damage: ^70
85
+ [skipnotify]^3Damage Recvd: ^70
86
+ [skipnotify]
87
+ ^2Rank: ^7Schutze (5 XP)
88
+ [skipnotify]Skills Level/Points
89
+ [skipnotify]---------------------------
90
+ [skipnotify]Battle Sense ^30 (3/20)
91
+ [skipnotify]Engineering ^30 (1/20)
92
+ [skipnotify]First Aid ^30 (1/20)
93
+ [skipnotify]
94
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
95
+ ^7---------------------------------------------------------------------
96
+ [skipnotify]^1Terrorists^7 ^3*Pasra* @sora_h^3 0 0 0 0^3 0^3 4^2 0^1 0^6 0^3 0
97
+ [skipnotify]^7---------------------------------------------------------------------
98
+ ^1Terrorists^7 ^5Totals 0 0 0 0^5 0^3 0^2 0^1 0^6 0^3 0
99
+ [skipnotify]
100
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
101
+ ^7---------------------------------------------------------------------
102
+ [skipnotify]^4Specops^7 ^7*Pasra*Glass_sa^3 0 0 0 0^7 0^3 4^2 0^1 0^6 0^3 0
103
+ [skipnotify]^7---------------------------------------------------------------------
104
+ ^4Specops^7 ^5Totals 0 0 0 0^5 0^3 0^2 0^1 0^6 0^3 0
105
+ [skipnotify]
106
+
107
+ Match starting...
108
+ Planted at Main Storage [A].
109
+ *Pasra* @sora_h^7: ^7koosunayo
110
+ [skipnotify]User hound is not on the server
111
+ *Pasra* @sora_h^7: ^7pass kakattenaito kounaru
112
+ Terrorists blow the crate!
113
+ [skipnotify]^7Overall stats for: ^3*Pasra* @sora_h ^7(^21^7 Round)
114
+
115
+ [skipnotify]Weapon Acrcy Hits/Atts Kills Deaths Headshots
116
+ [skipnotify]-------------------------------------------------
117
+ [skipnotify]^3No weapon info available.
118
+ [skipnotify]
119
+ ^2Rank: ^7Schutze (0 XP)
120
+ [skipnotify]Skills Level/Points
121
+ [skipnotify]---------------------------
122
+ [skipnotify]^3No skills acquired!
123
+ [skipnotify]
124
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
125
+ ^7---------------------------------------------------------------------
126
+ [skipnotify]^1Terrorists^7 ^3*Pasra* @sora_h^3 0 0 0 0^3 0^3 5^2 0^1 0^6 0^3 10
127
+ [skipnotify]^7---------------------------------------------------------------------
128
+ ^1Terrorists^7 ^5Totals 0 0 0 0^5 0^3 10^2 0^1 0^6 0^3 10
129
+ [skipnotify]
130
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
131
+ ^7---------------------------------------------------------------------
132
+ [skipnotify]^4Specops^7 ^7*Pasra*Glass_sa^3 0 0 0 0^7 0^3 5^2 0^1 0^6 0^3 0
133
+ [skipnotify]^7---------------------------------------------------------------------
134
+ ^4Specops^7 ^5Totals 0 0 0 0^5 0^3 0^2 0^1 0^6 0^3 0
135
+ [skipnotify]
136
+
137
+ Match starting...
138
+ Planted at Main Storage [A].
139
+ Bomb defused!
140
+ Defused at Main Storage [A].
141
+ [skipnotify]^7Overall stats for: ^3*Pasra* @sora_h ^7(^21^7 Round)
142
+
143
+ [skipnotify]Weapon Acrcy Hits/Atts Kills Deaths Headshots
144
+ [skipnotify]-------------------------------------------------
145
+ [skipnotify]^3No weapon info available.
146
+ [skipnotify]
147
+ ^2Rank: ^7Schutze (0 XP)
148
+ [skipnotify]Skills Level/Points
149
+ [skipnotify]---------------------------
150
+ [skipnotify]^3No skills acquired!
151
+ [skipnotify]
152
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
153
+ ^7---------------------------------------------------------------------
154
+ [skipnotify]^1Terrorists^7 ^3*Pasra* @sora_h^3 0 0 0 0^3 0^3 6^2 0^1 0^6 0^3 10
155
+ [skipnotify]^7---------------------------------------------------------------------
156
+ ^1Terrorists^7 ^5Totals 0 0 0 0^5 0^3 10^2 0^1 0^6 0^3 10
157
+ [skipnotify]
158
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
159
+ ^7---------------------------------------------------------------------
160
+ [skipnotify]^4Specops^7 ^7*Pasra*Glass_sa^3 0 0 0 0^7 0^3 6^2 0^1 0^6 0^3 10
161
+ [skipnotify]^7---------------------------------------------------------------------
162
+ ^4Specops^7 ^5Totals 0 0 0 0^5 0^3 10^2 0^1 0^6 0^3 10
163
+ [skipnotify]
164
+ [skipnotify]^7Overall stats for: ^3*Pasra* @sora_h ^7(^21^7 Round)
165
+
166
+ [skipnotify]Weapon Acrcy Hits/Atts Kills Deaths Headshots
167
+ [skipnotify]-------------------------------------------------
168
+ [skipnotify]^3No weapon info available.
169
+ [skipnotify]
170
+ ^2Rank: ^7Schutze (0 XP)
171
+ [skipnotify]Skills Level/Points
172
+ [skipnotify]---------------------------
173
+ [skipnotify]^3No skills acquired!
174
+ [skipnotify]
175
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
176
+ ^7---------------------------------------------------------------------
177
+ [skipnotify]^1Terrorists^7 ^3*Pasra* @sora_h^3 10 16 0 0^3 0^3 6^2 0^1 0^6 0^3 10
178
+ [skipnotify]^7---------------------------------------------------------------------
179
+ ^1Terrorists^7 ^5Totals 0 0 0 0^5 0^3 10^2 0^1 0^6 0^3 10
180
+ [skipnotify]
181
+ ^7TEAM Player Kll Dth Sui TK Eff ^3AA^7 ^2DG ^1DR ^6TD ^3Score
182
+ ^7---------------------------------------------------------------------
183
+ [skipnotify]^4Specops^7 ^7*Pasra*Glass_sa^3 0 0 0 0^7 0^3 6^2 0^1 0^6 0^3 10
184
+ [skipnotify]^7---------------------------------------------------------------------
185
+ ^4Specops^7 ^5Totals 0 0 0 0^5 0^3 10^2 0^1 0^6 0^3 10
186
+ [skipnotify]
187
+
188
+
189
+ LOADING... maps/obj_railhouse.bsp
@@ -0,0 +1,193 @@
1
+ require "#{File.dirname(__FILE__)}/../lib/tclog.rb"
2
+ require 'rspec'
3
+
4
+ describe TCLog do
5
+ TESTLOG = "#{File.dirname(__FILE__)}/../misc"
6
+ OBJTEST = "#{TESTLOG}/objtest.log"
7
+ CTFTEST = "#{TESTLOG}/ctftest.log"
8
+ BCTEST = "#{TESTLOG}/bctest.log"
9
+ MISCTEST = "#{TESTLOG}/test.log"
10
+ describe "analyze" do
11
+ it "should return TCLog::Game" do
12
+ TCLog.analyze(OBJTEST).should be_a_kind_of(TCLog::Game)
13
+ end
14
+
15
+ it "accepts IO and String for log" do
16
+ TCLog.analyze(OBJTEST).should be_a_kind_of(TCLog::Game)
17
+ TCLog.analyze(open(OBJTEST)).should be_a_kind_of(TCLog::Game)
18
+ end
19
+
20
+ it "accepts gametype" do
21
+ TCLog.analyze(BCTEST, :bc).should be_a_kind_of(TCLog::Game)
22
+ end
23
+ end
24
+
25
+ describe "Game" do
26
+ describe "when gametype objective," do
27
+ before :all do
28
+ @game = TCLog.analyze(OBJTEST)
29
+ end
30
+
31
+ it "map changings have logged" do
32
+ round = @game.rounds[0]
33
+ round.map_changing?.should be_true
34
+ round.map_name.should == "obj_northport"
35
+ end
36
+
37
+ it "terrorists wins by terrorists killed all of specops" do
38
+ round = @game.rounds[1]
39
+ round.specops[:sui].should > 0
40
+ round.specops[:score].should < 0
41
+ round.won.should == :terrorists
42
+ end
43
+
44
+ it "specops wins by specops killed all of terrorists" do
45
+ round = @game.rounds[2]
46
+ round.terrorists[:sui].should > 0
47
+ round.terrorists[:score].should < 0
48
+ round.won.should == :specops
49
+ end
50
+
51
+ it "specops win by timelimit hitting" do
52
+ round = @game.rounds[3]
53
+ round.won.should == :specops
54
+ end
55
+
56
+ it "terrorists win by planting" do
57
+ round = @game.rounds[4]
58
+ round.won.should == :terrorists
59
+ end
60
+
61
+ it "specops win by defusing" do
62
+ round = @game.rounds[5]
63
+ round.won.should == :specops
64
+ end
65
+
66
+ it "map changings have recorded" do
67
+ round = @game.rounds[6]
68
+ round.map_changing?.should be_true
69
+ round.map_name.should == "obj_railhouse"
70
+ end
71
+ end
72
+
73
+ describe "when gametype capture the flag," do
74
+ before :all do
75
+ @game = TCLog.analyze(CTFTEST, :ctf)
76
+ end
77
+
78
+ it "terrorists wins by completing flags" do
79
+ @game.rounds[0].won.should == :terrorists
80
+ end
81
+
82
+ it "specops wins by completing flags" do
83
+ @game.rounds[1].won.should == :specops
84
+ end
85
+
86
+ it "terrorists wins by killing specops and getting high score" do
87
+ @game.rounds[2].terrorists[:score].should > @game.rounds[2].specops[:score]
88
+ @game.rounds[2].won.should == :terrorists
89
+ end
90
+ end
91
+
92
+ describe "when gametype bodycount," do
93
+ before :all do
94
+ @game = TCLog.analyze(BCTEST, :bc)
95
+ end
96
+
97
+ it "map changing have logged" do
98
+ @game.rounds[1].map_changing?.should be_true
99
+ @game.rounds[1].map_name.should == "obj_railhouse"
100
+ @game.rounds[2].map_changing?.should be_true
101
+ @game.rounds[2].map_name.should == "obj_northport"
102
+ end
103
+
104
+ it "specops wins by killing terrorists and getting high score" do
105
+ @game.rounds[3].specops[:score].should > @game.rounds[3].terrorists[:score]
106
+ @game.rounds[3].won = :specops
107
+ end
108
+
109
+ it "terrorists wins by getting 20p" do
110
+ @game.rounds[4].terrorists[:score].should >= 20
111
+ @game.rounds[4].won = :terrorists
112
+ end
113
+ end
114
+
115
+ describe "misc features:" do
116
+ before :all do
117
+ @game = TCLog.analyze(MISCTEST)
118
+ end
119
+ it "rounds" do
120
+ @game.rounds.should be_a_kind_of(Array)
121
+ @game.rounds.each do |r|
122
+ r.should be_a_kind_of(TCLog::Round)
123
+ end
124
+ end
125
+
126
+ it "players" do
127
+ @game.players.should be_a_kind_of(Hash)
128
+ @game.players.each do |r|
129
+ r.should be_a_kind_of(TCLog::Player)
130
+ end
131
+ end
132
+
133
+ describe "Round" do
134
+ before :all do
135
+ @round = @game.rounds[1]
136
+ end
137
+
138
+ it "players" do
139
+ @round.players.should be_a_kind_of(Array)
140
+ @round.players.each do |x|
141
+ x.should be_a_kind_of(TCLog::Player)
142
+ end
143
+
144
+ r = @game.rounds[2]
145
+ r.players.map(&:name).should_not be_include("*Pasra* sora_h")
146
+ end
147
+
148
+ it "player_results" do
149
+ @round.player_results.should be_a_kind_of(Array)
150
+ @round.player_results.each do |x|
151
+ x.should be_a_kind_of(Hash)
152
+ end
153
+ end
154
+
155
+ it "map_changing" do
156
+ r = @game.rounds[0]
157
+ r.map_changing?.should be_true
158
+ r.map_name.should == "obj_northport"
159
+ r.players.should be_empty
160
+ r.player_results.should be_empty
161
+ end
162
+ end
163
+
164
+ describe "Player" do
165
+ before :all do
166
+ @player = @game.players[0]
167
+ end
168
+
169
+ it "results" do
170
+ @player.results.each do |x|
171
+ x.should be_a_kind_of(Hash) unless x.nil?
172
+ end
173
+ @game.rounds.each_with_index do |v,i|
174
+ if v.map_changing? || !v.players.include?(@player)
175
+ @player.results[i].should be_nil
176
+ end
177
+ end
178
+ end
179
+
180
+ it "name" do
181
+ @player.name.should match(/sora_h/)
182
+ end
183
+
184
+ it "total" do
185
+ @player.total[:kill].should == 10
186
+ @player.total[:death].should == 16
187
+ @player.total[:sui].should == 1
188
+ end
189
+ end
190
+ end
191
+ end
192
+
193
+ end
data/tclog.gemspec ADDED
@@ -0,0 +1,50 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{tclog}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Shota Fukumori"]
12
+ s.date = %q{2010-12-24}
13
+ s.description = %q{Parser for etconsole.log of TrueCombat:Elite (TC:E)}
14
+ s.email = %q{sorah@tubusu.net}
15
+ s.extra_rdoc_files = [
16
+ "README.mkd"
17
+ ]
18
+ s.files = [
19
+ "README.mkd",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "lib/tclog.rb",
23
+ "misc/bctest.log",
24
+ "misc/bctest2.log",
25
+ "misc/ctftest.log",
26
+ "misc/objtest.log",
27
+ "misc/test.log",
28
+ "spec/tclog_spec.rb",
29
+ "tclog.gemspec"
30
+ ]
31
+ s.homepage = %q{http://github.com/sorah/tclog}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.7}
35
+ s.summary = %q{Parser for etconsole.log of TrueCombat:Elite (TC:E)}
36
+ s.test_files = [
37
+ "spec/tclog_spec.rb"
38
+ ]
39
+
40
+ if s.respond_to? :specification_version then
41
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ else
46
+ end
47
+ else
48
+ end
49
+ end
50
+
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tclog
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Shota Fukumori
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-12-24 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Parser for etconsole.log of TrueCombat:Elite (TC:E)
22
+ email: sorah@tubusu.net
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README.mkd
29
+ files:
30
+ - README.mkd
31
+ - Rakefile
32
+ - VERSION
33
+ - lib/tclog.rb
34
+ - misc/bctest.log
35
+ - misc/bctest2.log
36
+ - misc/ctftest.log
37
+ - misc/objtest.log
38
+ - misc/test.log
39
+ - spec/tclog_spec.rb
40
+ - tclog.gemspec
41
+ has_rdoc: true
42
+ homepage: http://github.com/sorah/tclog
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options:
47
+ - --charset=UTF-8
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ requirements: []
67
+
68
+ rubyforge_project:
69
+ rubygems_version: 1.3.7
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: Parser for etconsole.log of TrueCombat:Elite (TC:E)
73
+ test_files:
74
+ - spec/tclog_spec.rb