steam-csgo 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +5 -0
- data/README.md +68 -0
- data/Rakefile +7 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/steam/csgo.rb +16 -0
- data/lib/steam/csgo/base.rb +71 -0
- data/lib/steam/csgo/version.rb +7 -0
- data/steam-csgo.gemspec +30 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e577f8377c89f3716cfa6f00252c7e374201e67c
|
4
|
+
data.tar.gz: aa985cba37617c74babfa9d451bebdf5547e0f4e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1555e431f385e5e67ff2932f9e807f12183f8cec19ef946a7101ffe2f502b8e89daa64ca8258025d02c5d7529ba6ed06ae3bc6f9fafdb043033a142f6b2915a1
|
7
|
+
data.tar.gz: 4326ca9ae55f418ca00a2c70ab3680771675e1efdedbe0497b911228b555337c8c580aa188cd6f6ac55dfd45b27d78f76ea600b1185cbe081df062412e8eb851
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Steam::Csgo
|
2
|
+
|
3
|
+
A "plugin" for [fastpeek/steam](https://github.com/fastpeek/steam). Allows the Steam Client to handle CS:GO specific events as well as request information from the CS:GO Game Coordinator. Currently, only the fetching of Match results is implemented.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
- [fastpeek/steam](https://github.com/fastpeek/steam)
|
8
|
+
- Ruby 2.3.1
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'steam-csgo'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install steam-csgo
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
Here is an example that uses the plugin to request the match information for a
|
29
|
+
given match. The login flow has been omitted.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
class MyClient
|
33
|
+
def initialize
|
34
|
+
end
|
35
|
+
|
36
|
+
def ready(client)
|
37
|
+
client.steam_user.login('username', 'password')
|
38
|
+
end
|
39
|
+
|
40
|
+
def csgo_match_info(_client, info)
|
41
|
+
# Do something with info
|
42
|
+
end
|
43
|
+
|
44
|
+
def csgo_ready(client)
|
45
|
+
client.csgo.request_game_info(3_176_070_719_880_560_711,
|
46
|
+
3_176_076_024_165_171_409,
|
47
|
+
39_898)
|
48
|
+
end
|
49
|
+
|
50
|
+
def on_logon(client, msg)
|
51
|
+
case msg.body.eresult
|
52
|
+
when EResult::OK
|
53
|
+
client.csgo.start
|
54
|
+
else
|
55
|
+
raise "Error: #{msg.body.eresult}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
bot = Steam::Client.new
|
61
|
+
bot.plugin(:csgo)
|
62
|
+
bot.subscribe(MyClient.new)
|
63
|
+
bot.start
|
64
|
+
```
|
65
|
+
|
66
|
+
## Development
|
67
|
+
|
68
|
+
You can read more about how the "plugins" work on the [fastpeek/steam](https://github.com/fastpeek/steam) wiki page [here](google.com)
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'steam/csgo'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/steam/csgo.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'steam/csgo/version'
|
3
|
+
require 'steam/csgo/base'
|
4
|
+
|
5
|
+
require 'steam/proto'
|
6
|
+
Steam::Proto.load_protobufs(:csgo)
|
7
|
+
|
8
|
+
require 'steamd'
|
9
|
+
Steamd.load_language
|
10
|
+
|
11
|
+
# Top level Steam namespace
|
12
|
+
module Steam
|
13
|
+
# CSGO Plugin for fastpeek/steam
|
14
|
+
module Csgo
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Steam
|
3
|
+
module Csgo
|
4
|
+
# Handles CSGO related events
|
5
|
+
class Base
|
6
|
+
# The Steam Client
|
7
|
+
attr_reader :client
|
8
|
+
|
9
|
+
# The Steam gem will instantiate the plugin and provide the client.
|
10
|
+
#
|
11
|
+
# @param client [Steam::Client] the steam client
|
12
|
+
def initialize(client)
|
13
|
+
@client = client
|
14
|
+
end
|
15
|
+
|
16
|
+
# Request match info for a given match.
|
17
|
+
#
|
18
|
+
# @param match_id [String] the match id
|
19
|
+
# @param outcome_id [String] the outcome id
|
20
|
+
# @param token [String] the token
|
21
|
+
#
|
22
|
+
# @return [Bool]
|
23
|
+
def request_match_info(match_id, outcome_id, token)
|
24
|
+
msg = ::Csgo::CMsgGCCStrike15_v2_MatchListRequestFullGameInfo.new
|
25
|
+
msg.matchid = match_id
|
26
|
+
msg.outcomeid = outcome_id
|
27
|
+
msg.token = token
|
28
|
+
|
29
|
+
msg = GcProtobufMessage.new(
|
30
|
+
MsgGCHdrProtoBuf.new,
|
31
|
+
msg,
|
32
|
+
::Csgo::ECsgoGCMsg::K_EMsgGCCStrike15_v2_MatchListRequestFullGameInfo
|
33
|
+
)
|
34
|
+
client.game_coordinator.send_msg(msg)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Starts the plugin. Sets the Client to online and puts the Client
|
38
|
+
# into CS:GO
|
39
|
+
#
|
40
|
+
# @return [Bool]
|
41
|
+
def start
|
42
|
+
client.steam_user.change_persona_state(EPersonaState::OFFLINE)
|
43
|
+
client.game_coordinator.play(730)
|
44
|
+
|
45
|
+
# actually ask and wait if we are in gc, but just sleep 10 seconds for
|
46
|
+
# now
|
47
|
+
sleep(5)
|
48
|
+
|
49
|
+
client.game_coordinator.send_msg(
|
50
|
+
GcProtobufMessage.new(MsgGCHdrProtoBuf.new,
|
51
|
+
::Csgo::CMsgClientHello.new,
|
52
|
+
::Csgo::EGCBaseClientMsg::K_EMsgGCClientHello)
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
# The client will give us each gc message. We handle the ones we care
|
57
|
+
# about. A notice is printed on skipped emsgs
|
58
|
+
def gc_message(msg)
|
59
|
+
case msg.emsg
|
60
|
+
when ::Csgo::EGCBaseClientMsg::K_EMsgGCClientWelcome
|
61
|
+
client.csgo_ready
|
62
|
+
when ::Csgo::ECsgoGCMsg::K_EMsgGCCStrike15_v2_MatchList
|
63
|
+
match_list = msg.as(::Csgo::CMsgGCCStrike15_v2_MatchList)
|
64
|
+
client.csgo_match_info(match_list)
|
65
|
+
else
|
66
|
+
Steam.logger.debug("[CS:GO] Ignoring msg: #{msg.emsg}")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/steam-csgo.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'steam/csgo/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'steam-csgo'
|
9
|
+
spec.version = Steam::Csgo::VERSION
|
10
|
+
spec.authors = ['Taylor Finnell']
|
11
|
+
spec.email = ['tmfinnell@gmail.com']
|
12
|
+
|
13
|
+
spec.summary = 'Plugin for fastpeek/steam to provide CSGO specific apis'
|
14
|
+
spec.description = 'Plugin for fastpeek/steam to provide CSGO specific apis'
|
15
|
+
spec.homepage = 'http://github.com/fastpeek/steam-csgo'
|
16
|
+
spec.licenses = ['MIT']
|
17
|
+
spec.required_ruby_version = '2.3.1'
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
|
+
f.match(%r{^(test|spec|features)/})
|
21
|
+
end
|
22
|
+
spec.bindir = 'bin'
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ['lib']
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
+
spec.add_development_dependency 'steam', '~> 0.1'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: steam-csgo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Taylor Finnell
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: steam
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.1'
|
69
|
+
description: Plugin for fastpeek/steam to provide CSGO specific apis
|
70
|
+
email:
|
71
|
+
- tmfinnell@gmail.com
|
72
|
+
executables:
|
73
|
+
- console
|
74
|
+
- setup
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- ".rspec"
|
80
|
+
- ".rubocop.yml"
|
81
|
+
- ".travis.yml"
|
82
|
+
- Gemfile
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- lib/steam/csgo.rb
|
88
|
+
- lib/steam/csgo/base.rb
|
89
|
+
- lib/steam/csgo/version.rb
|
90
|
+
- steam-csgo.gemspec
|
91
|
+
homepage: http://github.com/fastpeek/steam-csgo
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.3.1
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.5.1
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Plugin for fastpeek/steam to provide CSGO specific apis
|
115
|
+
test_files: []
|