adamaig-ruby_activeworld 0.2-linux → 0.3-linux

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,84 +0,0 @@
1
- require 'ruby_activeworld'
2
- require 'ruby_activeworld_support'
3
-
4
- class RubyAw < RubyActiveworld
5
- include RubyActiveworldSupport
6
-
7
- @@attrs_available_to = {}
8
-
9
- def initialize(host, port, global_bot=false)
10
- @@init_run ||= false
11
- if ! @@init_run
12
- @@init_run = true
13
- self.class.ruby_aw_init(AW_BUILD)
14
- end
15
- super(host, port)
16
- ruby_aw_bool_set(AW_ENTER_GLOBAL, global_bot);
17
- end
18
-
19
- def login(name, owner_id, privilege_pass, application="")
20
- ruby_aw_string_set(AW_LOGIN_NAME, name);
21
- ruby_aw_string_set(AW_LOGIN_PRIVILEGE_PASSWORD, privilege_pass);
22
- ruby_aw_int_set(AW_LOGIN_OWNER, owner_id);
23
- ruby_aw_string_set(AW_LOGIN_APPLICATION, application) if ! application.empty?
24
- ruby_aw_login
25
- end
26
-
27
- def enter(worldname)
28
- rc_sym ruby_aw_enter(worldname)
29
- end
30
-
31
- # This "registers" the bot as being interested in the named event
32
- def receive(callback)
33
- send("receive_#{callback.to_s.downcase}")
34
- end
35
-
36
- def attributes_for(callback)
37
- params = {}
38
- @@attrs_available_to[callback].each do |aw_attr|
39
- params[aw_attr] = aw_attribute_to_ruby(aw_attr)
40
- end
41
- params
42
- end
43
-
44
- def aw_attribute_to_ruby(attribute)
45
- eval "ruby_aw_#{get_aw_attribute_type(attribute)}(#{attribute})"
46
- end
47
-
48
- def get_aw_attribute_type(attribute)
49
- ATTRIBUTE_TYPE_MAP[attribute.to_sym]
50
- end
51
-
52
- def self.attributes_available_to(callback, *attributes)
53
- @@attrs_available_to[callback] = attributes
54
- end
55
-
56
- attributes_available_to :AW_EVENT_AVATAR_ADD, :AW_AVATAR_SESSION, :AW_AVATAR_NAME,
57
- :AW_AVATAR_X, :AW_AVATAR_Y, :AW_AVATAR_Z, :AW_AVATAR_YAW, :AW_AVATAR_TYPE, :AW_AVATAR_GESTURE, :AW_AVATAR_VERSION,
58
- :AW_AVATAR_CITIZEN, :AW_AVATAR_PRIVILEGE, :AW_AVATAR_PITCH, :AW_AVATAR_STATE, :AW_PLUGIN_STRING
59
-
60
- attributes_available_to :AW_EVENT_AVATAR_DELETE, :AW_AVATAR_SESSION, :AW_AVATAR_NAME,
61
- :AW_AVATAR_X, :AW_AVATAR_Y, :AW_AVATAR_Z, :AW_AVATAR_YAW, :AW_AVATAR_TYPE, :AW_AVATAR_GESTURE, :AW_AVATAR_VERSION,
62
- :AW_AVATAR_CITIZEN, :AW_AVATAR_PRIVILEGE, :AW_AVATAR_PITCH, :AW_AVATAR_STATE, :AW_PLUGIN_STRING
63
-
64
- attributes_available_to :AW_EVENT_CHAT, :AW_AVATAR_NAME, :AW_CHAT_SESSION, :AW_CHAT_TYPE, :AW_CHAT_MESSAGE
65
- attributes_available_to :AW_EVENT_AVATAR_CLICK, :AW_AVATAR_NAME, :AW_AVATAR_SESSION, :AW_CLICKED_NAME, :AW_CLICKED_SESSION
66
-
67
- attributes_available_to :AW_EVENT_USER_INFO, :AW_USERLIST_ID, :AW_USERLIST_NAME, :AW_USERLIST_WORLD,
68
- :AW_USERLIST_CITIZEN, :AW_USERLIST_STATE
69
-
70
- attributes_available_to :AW_EVENT_OBJECT_ADD, :AW_OBJECT_SESSION, :AW_CELL_SEQUENCE,
71
- :AW_CELL_X, :AW_CELL_Z, :AW_OBJECT_TYPE, :AW_OBJECT_ID, :AW_OBJECT_NUMBER, :AW_OBJECT_OWNER,
72
- :AW_OBJECT_BUILD_TIMESTAMP, :AW_OBJECT_X, :AW_OBJECT_Y, :AW_OBJECT_Z, :AW_OBJECT_YAW, :AW_OBJECT_TILT,
73
- :AW_OBJECT_ROLL, :AW_OBJECT_MODEL, :AW_OBJECT_DESCRIPTION, :AW_OBJECT_ACTION, :AW_OBJECT_DATA
74
-
75
- attributes_available_to :AW_EVENT_OBJECT_DELETE, :AW_OBJECT_SESSION, :AW_CELL_SEQUENCE,
76
- :AW_CELL_X, :AW_CELL_Z, :AW_OBJECT_ID, :AW_OBJECT_NUMBER
77
-
78
- attributes_available_to :AW_EVENT_URL, :AW_AVATAR_SESSION, :AW_AVATAR_NAME, :AW_URL_NAME, :AW_URL_POST,
79
- :AW_URL_TARGET, :AW_URL_TARGET_3D
80
-
81
- attributes_available_to :AW_EVENT_UNIVERSE_DISCONNECT, :AW_DISCONNECT_REASON
82
- attributes_available_to :AW_EVENT_WORLD_DISCONNECT, :AW_DISCONNECT_REASON
83
-
84
- end