overlook-csgo 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c589e51df4df33aa3df5fd0567e68f3523d3fa2
4
- data.tar.gz: 42af28212e75f9dd36803373850d30ac978ae64b
3
+ metadata.gz: 657c4187f2479e74f779d4b27fe5a9d5ea1e655b
4
+ data.tar.gz: 68afc5c4f2b6bf19c78d577e00638046bc4ec35f
5
5
  SHA512:
6
- metadata.gz: feb1c94c5bad6ea0394c3af67271dc99c82c7083413aac67eba859ad9d00182bc33e7f7fffd4faaee9db73d64186ca0dceb631c3efe33a00061a1f318f93a31b
7
- data.tar.gz: ff4e2db1be562e5ed52e5eb10c661b25db4c79e70f1964b128bf7fa586fc725903003f4dd34a5bc8d6db172e5c671edd2fcb8d57e10fbd0cb4f3abd9b39be76d
6
+ metadata.gz: 39075a1b4d4aa8f615d2f3774131714827d64d7775eb9e2115832175ef3dcc3dbc7e74770ecfda175d45ecaf525cc42c434333ab5a93a8cfc48b52b3a117b7a7
7
+ data.tar.gz: f5cde04548a0131510274749bd4a814568a8b51d5c2da7678781b6ad2054b601114d966aa3be1d2990446787b92f85bd9464b8a047f5d56f0455347f86df8f24
data/.travis.yml ADDED
@@ -0,0 +1,20 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ - 2.3.0
5
+ before_install:
6
+ - ls -a
7
+ - pwd
8
+ - git clone https://github.com/github/git-lfs.git
9
+ - cd git-lfs
10
+ - git checkout 05666983c2e19664b8fc47c30b767ec160e3fea5
11
+ - script/bootstrap
12
+ - cd ..
13
+ - ls -a
14
+ - pwd
15
+ - git-lfs/bin/git-lfs init
16
+ - git-lfs/bin/git-lfs env
17
+ - git-lfs/bin/git-lfs pull
18
+ install:
19
+ - bundle
20
+ script: rake spec:all
data/README.md CHANGED
@@ -7,7 +7,7 @@ Ruby access to CS:GO demo files.
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'overlook'
10
+ gem 'overlook-csgo'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -16,7 +16,7 @@ And then execute:
16
16
 
17
17
  Or install it yourself as:
18
18
 
19
- $ gem install overlook
19
+ $ gem install overlook-csgo
20
20
 
21
21
  ## Usage
22
22
 
data/Rakefile CHANGED
@@ -1,44 +1,9 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
7
-
8
- namespace :proto do
9
- desc 'Update the generated proto'
10
- task :update do
11
- proto_version = '2.6.0'
12
-
13
- FileUtils.mkdir_p('./lib/proto/proto')
14
- FileUtils.mkdir_p('./lib/proto/compiled')
15
-
16
- base_url = "https://raw.githubusercontent.com/SteamRE/SteamKit/master/Resources/Protobufs/csgo/"
17
- protos = %w(cstrike15_gcmessages.proto cstrike15_usermessages.proto netmessages.proto steammessages.proto)
18
-
19
- Dir.chdir('./lib/proto/proto') do
20
- protos.each do |file|
21
- `curl -O #{base_url}/#{file}`
22
- end
23
-
24
- `curl -L https://github.com/google/protobuf/archive/v#{proto_version}.tar.gz -o protobuf.tar.gz`
25
- `rm -f protobuf.tar`
26
- `gunzip protobuf.tar.gz`
27
- `tar -xvzf protobuf.tar`
28
-
29
- protos.each do |file|
30
- `protoc --beefcake_out ../compiled -I . -I protobuf-#{proto_version}/src #{file}`
31
-
32
- %w(key_t class_t sendprop_t descriptor_t sounddata_t).each do |broken|
33
- fixed = broken
34
- fixed[0] = fixed[0].capitalize
35
-
36
- `sed 's/#{broken}/#{fixed}/g' #{file}`
37
- end
38
- end
39
- end
4
+ load './lib/tasks/proto.rake'
5
+ load './lib/tasks/spec.rake'
40
6
 
7
+ RSpec::Core::RakeTask.new(:spec)
41
8
 
42
- puts "**** Beefcake generates some invalid Ruby, the generated files may need small hand corrections ****"
43
- end
44
- end
9
+ task default: 'spec:fast'
data/lib/overlook.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'steamidlib'
2
+
1
3
  require 'overlook/version'
2
4
  require 'overlook/csgo'
3
5
 
@@ -10,8 +12,6 @@ require 'proto/compiled/netmessages.pb'
10
12
  require 'proto/compiled/cstrike15_gcmessages.pb'
11
13
  require 'proto/compiled/cstrike15_usermessages.pb'
12
14
 
13
- require 'steamidlib'
14
-
15
15
  module Overlook
16
16
  def self.decode_share_code(code)
17
17
  decoder = Csgo::SharecodeDecoder.new(code)
@@ -15,7 +15,6 @@ require 'overlook/csgo/demo/game_event_list_message_handler'
15
15
  require 'overlook/csgo/demo/game_event_message_handler'
16
16
  require 'overlook/csgo/demo/encrypted_data_handler'
17
17
 
18
- require 'overlook/csgo/demo/command_factory'
19
18
  require 'overlook/csgo/demo/packet_factory'
20
19
 
21
20
  module Overlook
@@ -27,6 +27,14 @@ module Overlook
27
27
  @tick = 0 unless packet?
28
28
  end
29
29
 
30
+ def self.from_io(reader)
31
+ cmd = reader.byte
32
+ tick = reader.signed_int32
33
+ slot = reader.byte
34
+
35
+ new(cmd, tick, slot)
36
+ end
37
+
30
38
  def type
31
39
  case @type
32
40
  when Command::TYPE::PACKET, Command::TYPE::SIGNON
@@ -43,7 +51,7 @@ module Overlook
43
51
  end
44
52
 
45
53
  def unknown?
46
- type == :stop
54
+ type == :unknown
47
55
  end
48
56
 
49
57
  def stop?
@@ -3,14 +3,16 @@ module Overlook
3
3
  module Csgo
4
4
  module Demo
5
5
  class Header
6
+ InvalidHeader = Class.new(StandardError)
7
+
6
8
  MAX_STRING_LENGTH = 260.freeze
7
9
 
8
- attr_accessor :map_name
10
+ attr_reader :map_name, :ticks
9
11
 
10
- def initialize(map_name)
12
+ def initialize(map_name, ticks)
11
13
  raise ArgumentError 'map_name can\'t be nil' if map_name.nil?
12
-
13
- @map_name = map_name
14
+ @map_name = map_name
15
+ @ticks = ticks
14
16
  end
15
17
 
16
18
  def to_hash
@@ -34,10 +36,10 @@ module Overlook
34
36
  frames = reader.signed_int32
35
37
  signon_length = reader.signed_int32
36
38
 
37
- raise InvalidDemo, "#{self.class.name} only supports HL2DEMO, got #{stamp}" if stamp !~ /hl2demo/i
38
- raise InvalidDemo, "#{self.class.name} only supports Valve demo files." if server_name !~ /valve/i
39
+ raise InvalidHeader, "#{self.class.name} only supports HL2DEMO, got #{stamp}" if stamp !~ /hl2demo/i
40
+ raise InvalidHeader, "#{self.class.name} only supports Valve demo files." if server_name !~ /valve/i
39
41
 
40
- new(map_name)
42
+ new(map_name, ticks)
41
43
  end
42
44
  end
43
45
  end
@@ -44,7 +44,7 @@ module Overlook
44
44
  packet_handler = PacketHandler.new(self)
45
45
 
46
46
  loop do
47
- command = CommandFactory.from_io(reader)
47
+ command = Command.from_io(reader)
48
48
 
49
49
  next if command.sync?
50
50
  break if command.stop?
@@ -1,5 +1,4 @@
1
1
  require 'stringio'
2
- require 'steamidlib'
3
2
 
4
3
  module Overlook
5
4
  module Csgo
@@ -1,3 +1,3 @@
1
1
  module Overlook
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end
@@ -69,6 +69,7 @@ module SVC_Messages
69
69
  svc_CmdKeyValues = 34
70
70
  svc_EncryptedData = 35
71
71
  svc_HltvReplay = 36
72
+ svc_Broadcast_Command = 38
72
73
  end
73
74
 
74
75
  module ReplayEventType_t
@@ -318,6 +319,10 @@ class CCLCMsg_HltvReplay
318
319
  include Beefcake::Message
319
320
  end
320
321
 
322
+ class CSVCMsg_Broadcast_Command
323
+ include Beefcake::Message
324
+ end
325
+
321
326
  class CMsgVector
322
327
  optional :x, :float, 1
323
328
  optional :y, :float, 2
@@ -723,3 +728,7 @@ class CCLCMsg_HltvReplay
723
728
  optional :primary_target_ent_index, :int32, 4
724
729
  optional :event_time, :float, 5
725
730
  end
731
+
732
+ class CSVCMsg_Broadcast_Command
733
+ optional :cmd, :string, 1
734
+ end
@@ -0,0 +1,27 @@
1
+ namespace :proto do
2
+ desc 'Update the generated proto'
3
+ task :update do
4
+ proto_version = '2.6.0'
5
+
6
+ FileUtils.mkdir_p('./lib/proto/proto')
7
+ FileUtils.mkdir_p('./lib/proto/compiled')
8
+
9
+ base_url = "https://raw.githubusercontent.com/SteamRE/SteamKit/master/Resources/Protobufs/csgo/"
10
+ protos = %w(cstrike15_gcmessages.proto cstrike15_usermessages.proto netmessages.proto steammessages.proto)
11
+
12
+ Dir.chdir('./lib/proto/proto') do
13
+ protos.each do |file|
14
+ `curl -O #{base_url}/#{file}`
15
+ end
16
+
17
+ `curl -L https://github.com/google/protobuf/archive/v#{proto_version}.tar.gz -o protobuf.tar.gz`
18
+ `rm -f protobuf.tar`
19
+ `gunzip protobuf.tar.gz`
20
+ `tar -xvzf protobuf.tar`
21
+
22
+ protos.each do |file|
23
+ `protoc --beefcake_out ../compiled -I . -I protobuf-#{proto_version}/src #{file}`
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,11 @@
1
+ namespace :spec do
2
+ desc 'Run all the tests'
3
+ task :all do
4
+ exec("rspec .")
5
+ end
6
+
7
+ desc 'Run only the fast tests'
8
+ task :fast do
9
+ exec("rspec . --tag ~slow")
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: overlook-csgo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Finnell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-23 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: beefcake
@@ -146,7 +146,7 @@ files:
146
146
  - ".gitattributes"
147
147
  - ".gitignore"
148
148
  - ".rspec"
149
- - ".ruby-version"
149
+ - ".travis.yml"
150
150
  - Gemfile
151
151
  - Gemfile.lock
152
152
  - README.md
@@ -161,7 +161,6 @@ files:
161
161
  - lib/overlook/csgo/demo.rb
162
162
  - lib/overlook/csgo/demo/base.rb
163
163
  - lib/overlook/csgo/demo/command.rb
164
- - lib/overlook/csgo/demo/command_factory.rb
165
164
  - lib/overlook/csgo/demo/encrypted_data_handler.rb
166
165
  - lib/overlook/csgo/demo/game_event_list_message_handler.rb
167
166
  - lib/overlook/csgo/demo/game_event_message_handler.rb
@@ -181,6 +180,8 @@ files:
181
180
  - lib/proto/compiled/descriptor.pb.rb
182
181
  - lib/proto/compiled/netmessages.pb.rb
183
182
  - lib/proto/compiled/steammessages.pb.rb
183
+ - lib/tasks/proto.rake
184
+ - lib/tasks/spec.rake
184
185
  - overlook-csgo.gemspec
185
186
  homepage: http://github.com/taylorfinnell/overlook
186
187
  licenses: []
@@ -201,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
202
  version: '0'
202
203
  requirements: []
203
204
  rubyforge_project:
204
- rubygems_version: 2.4.5.1
205
+ rubygems_version: 2.5.1
205
206
  signing_key:
206
207
  specification_version: 4
207
208
  summary: Ruby access to CS:GO demo files.
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.2.3
@@ -1,15 +0,0 @@
1
- module Overlook
2
- module Csgo
3
- module Demo
4
- class CommandFactory
5
- def self.from_io(reader)
6
- cmd = reader.byte
7
- tick = reader.signed_int32
8
- slot = reader.byte
9
-
10
- Command.new(cmd, tick, slot)
11
- end
12
- end
13
- end
14
- end
15
- end