libsl 0.0.2
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/.gitignore +1 -0
- data/README.md +50 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/lib/_packets.rb +10346 -0
- data/lib/agent.rb +119 -0
- data/lib/client.rb +57 -0
- data/lib/dsl.rb +54 -0
- data/lib/events.rb +59 -0
- data/lib/libsl.rb +14 -0
- data/lib/network.rb +305 -0
- data/lib/packet.rb +279 -0
- data/lib/types.rb +490 -0
- data/libsl.gemspec +30 -0
- data/test/tc_packet.rb +99 -0
- data/test/tc_types.rb +342 -0
- data/test/ts_all.rb +2 -0
- metadata +101 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
LibSL - The ruby SecondLife client framework
|
2
|
+
============================================
|
3
|
+
|
4
|
+
LibSL is a framework for building SecondLife client applications in ruby.
|
5
|
+
The most basic client application can be written in three lines of ruby code:
|
6
|
+
|
7
|
+
require 'libsl'
|
8
|
+
setup "firstname", "lastname", "password"
|
9
|
+
when_ready { shutdown }
|
10
|
+
|
11
|
+
This simple example will login to SecondLife and shutdown once we are connected.
|
12
|
+
LibSL is all about interacting with the SecondLife servers. The DSL makes this
|
13
|
+
very easy. Handle events:
|
14
|
+
|
15
|
+
# Handle one specific event
|
16
|
+
handle :event_name do |type, *args|
|
17
|
+
# do something
|
18
|
+
end
|
19
|
+
|
20
|
+
# Handle multiple events
|
21
|
+
handle [:event1, :event2] do |type, *args|
|
22
|
+
# do something
|
23
|
+
end
|
24
|
+
|
25
|
+
# Handle all events
|
26
|
+
handle :all do |type, *args|
|
27
|
+
# do something
|
28
|
+
end
|
29
|
+
|
30
|
+
Use the client API to interact with the SecondLife world:
|
31
|
+
|
32
|
+
# Send a chat message
|
33
|
+
client.agent_manager.chat("Hello!")
|
34
|
+
# Send an instant message
|
35
|
+
client.agent_manager.im("Hello!", uuid)
|
36
|
+
|
37
|
+
Or build raw packets and send them to the server:
|
38
|
+
|
39
|
+
# Request money balance
|
40
|
+
packet = MoneyBalanceRequestPacket.new({
|
41
|
+
:AgentData => {
|
42
|
+
:AgentID => client.network_manager.agent_id,
|
43
|
+
:SessionID => client.network_manager.session_id
|
44
|
+
},
|
45
|
+
:MoneyData => {
|
46
|
+
:TransactionID => LLUUID.null
|
47
|
+
}
|
48
|
+
})
|
49
|
+
send_packet packet
|
50
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
gemspec = eval(File.read(Dir["*.gemspec"].first))
|
3
|
+
|
4
|
+
|
5
|
+
desc "Validate the gemspec"
|
6
|
+
task :gemspec do
|
7
|
+
gemspec.validate
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Build packet definitions"
|
11
|
+
task :build_msg do
|
12
|
+
system "scripts/build-messages"
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Build gem locally"
|
16
|
+
task :build => [:gemspec, :build_msg] do
|
17
|
+
system "gem build #{gemspec.name}.gemspec"
|
18
|
+
FileUtils.mkdir_p "pkg"
|
19
|
+
FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", "pkg"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Install gem locally"
|
23
|
+
task :install => :build do
|
24
|
+
system "gem install pkg/#{gemspec.name}-#{gemspec.version}"
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Increment version. type=(major|minor|patch)"
|
28
|
+
task :inc_version do
|
29
|
+
version = File.read('VERSION').split(".").map{|v| v.to_i}
|
30
|
+
while version.length < 3 do version << 0 end
|
31
|
+
case ENV['type']
|
32
|
+
when 'major' then
|
33
|
+
version[0] += 1
|
34
|
+
when 'patch' then
|
35
|
+
version[2] += 1
|
36
|
+
else
|
37
|
+
version[1] += 1
|
38
|
+
end
|
39
|
+
File.open('VERSION', "w") { |f| f.write version.join(".") }
|
40
|
+
system "git add VERSION && git commit -m \"Increment version\""
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Push gem to rubygems.org (Will also create a git tag)"
|
44
|
+
task :push => :build do
|
45
|
+
puts "Creating Git tag #{gemspec.version}"
|
46
|
+
system "git tag -a -f -m \"Pushing #{gemspec.version} to rubygems.org\" \"#{gemspec.version}\""
|
47
|
+
puts "Push gem to rubygems.org"
|
48
|
+
system "gem push pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Clean automatically generated files"
|
52
|
+
task :clean do
|
53
|
+
FileUtils.rm_rf "pkg"
|
54
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|