diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | 465 |
1 files changed, 465 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs new file mode 100644 index 0000000..461f776 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | |||
@@ -0,0 +1,465 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Net; | ||
30 | using OpenMetaverse; | ||
31 | using OpenMetaverse.Packets; | ||
32 | using OpenMetaverse.StructuredData; | ||
33 | using OpenMetaverse.Messages.Linden; | ||
34 | |||
35 | using OpenSim.Framework; | ||
36 | |||
37 | namespace OpenSim.Region.ClientStack.Linden | ||
38 | { | ||
39 | public class EventQueueHelper | ||
40 | { | ||
41 | private EventQueueHelper() {} // no construction possible, it's an utility class | ||
42 | |||
43 | private static byte[] ulongToByteArray(ulong uLongValue) | ||
44 | { | ||
45 | // Reverse endianness of RegionHandle | ||
46 | return new byte[] | ||
47 | { | ||
48 | (byte)((uLongValue >> 56) % 256), | ||
49 | (byte)((uLongValue >> 48) % 256), | ||
50 | (byte)((uLongValue >> 40) % 256), | ||
51 | (byte)((uLongValue >> 32) % 256), | ||
52 | (byte)((uLongValue >> 24) % 256), | ||
53 | (byte)((uLongValue >> 16) % 256), | ||
54 | (byte)((uLongValue >> 8) % 256), | ||
55 | (byte)(uLongValue % 256) | ||
56 | }; | ||
57 | } | ||
58 | |||
59 | // private static byte[] uintToByteArray(uint uIntValue) | ||
60 | // { | ||
61 | // byte[] result = new byte[4]; | ||
62 | // Utils.UIntToBytesBig(uIntValue, result, 0); | ||
63 | // return result; | ||
64 | // } | ||
65 | |||
66 | public static OSD BuildEvent(string eventName, OSD eventBody) | ||
67 | { | ||
68 | OSDMap llsdEvent = new OSDMap(2); | ||
69 | llsdEvent.Add("message", new OSDString(eventName)); | ||
70 | llsdEvent.Add("body", eventBody); | ||
71 | |||
72 | return llsdEvent; | ||
73 | } | ||
74 | |||
75 | public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint, int regionSizeX, int regionSizeY) | ||
76 | { | ||
77 | OSDMap llsdSimInfo = new OSDMap(5); | ||
78 | |||
79 | llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle))); | ||
80 | llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes())); | ||
81 | llsdSimInfo.Add("Port", OSD.FromInteger(endPoint.Port)); | ||
82 | llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); | ||
83 | llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); | ||
84 | |||
85 | OSDArray arr = new OSDArray(1); | ||
86 | arr.Add(llsdSimInfo); | ||
87 | |||
88 | OSDMap llsdBody = new OSDMap(1); | ||
89 | llsdBody.Add("SimulatorInfo", arr); | ||
90 | |||
91 | return BuildEvent("EnableSimulator", llsdBody); | ||
92 | } | ||
93 | /* | ||
94 | public static OSD DisableSimulator(ulong handle) | ||
95 | { | ||
96 | //OSDMap llsdSimInfo = new OSDMap(1); | ||
97 | |||
98 | //llsdSimInfo.Add("Handle", new OSDBinary(regionHandleToByteArray(handle))); | ||
99 | |||
100 | //OSDArray arr = new OSDArray(1); | ||
101 | //arr.Add(llsdSimInfo); | ||
102 | |||
103 | OSDMap llsdBody = new OSDMap(0); | ||
104 | //llsdBody.Add("SimulatorInfo", arr); | ||
105 | |||
106 | return BuildEvent("DisableSimulator", llsdBody); | ||
107 | } | ||
108 | */ | ||
109 | public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, | ||
110 | IPEndPoint newRegionExternalEndPoint, | ||
111 | string capsURL, UUID agentID, UUID sessionID, | ||
112 | int regionSizeX, int regionSizeY) | ||
113 | { | ||
114 | OSDArray lookAtArr = new OSDArray(3); | ||
115 | lookAtArr.Add(OSD.FromReal(lookAt.X)); | ||
116 | lookAtArr.Add(OSD.FromReal(lookAt.Y)); | ||
117 | lookAtArr.Add(OSD.FromReal(lookAt.Z)); | ||
118 | |||
119 | OSDArray positionArr = new OSDArray(3); | ||
120 | positionArr.Add(OSD.FromReal(pos.X)); | ||
121 | positionArr.Add(OSD.FromReal(pos.Y)); | ||
122 | positionArr.Add(OSD.FromReal(pos.Z)); | ||
123 | |||
124 | OSDMap infoMap = new OSDMap(2); | ||
125 | infoMap.Add("LookAt", lookAtArr); | ||
126 | infoMap.Add("Position", positionArr); | ||
127 | |||
128 | OSDArray infoArr = new OSDArray(1); | ||
129 | infoArr.Add(infoMap); | ||
130 | |||
131 | OSDMap agentDataMap = new OSDMap(2); | ||
132 | agentDataMap.Add("AgentID", OSD.FromUUID(agentID)); | ||
133 | agentDataMap.Add("SessionID", OSD.FromUUID(sessionID)); | ||
134 | |||
135 | OSDArray agentDataArr = new OSDArray(1); | ||
136 | agentDataArr.Add(agentDataMap); | ||
137 | |||
138 | OSDMap regionDataMap = new OSDMap(6); | ||
139 | regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle))); | ||
140 | regionDataMap.Add("SeedCapability", OSD.FromString(capsURL)); | ||
141 | regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes())); | ||
142 | regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port)); | ||
143 | regionDataMap.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); | ||
144 | regionDataMap.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); | ||
145 | |||
146 | OSDArray regionDataArr = new OSDArray(1); | ||
147 | regionDataArr.Add(regionDataMap); | ||
148 | |||
149 | OSDMap llsdBody = new OSDMap(3); | ||
150 | llsdBody.Add("Info", infoArr); | ||
151 | llsdBody.Add("AgentData", agentDataArr); | ||
152 | llsdBody.Add("RegionData", regionDataArr); | ||
153 | |||
154 | return BuildEvent("CrossedRegion", llsdBody); | ||
155 | } | ||
156 | |||
157 | public static OSD TeleportFinishEvent( | ||
158 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, | ||
159 | uint locationID, uint flags, string capsURL, UUID agentID, | ||
160 | int regionSizeX, int regionSizeY) | ||
161 | { | ||
162 | // not sure why flags get overwritten here | ||
163 | if ((flags & (uint)TeleportFlags.IsFlying) != 0) | ||
164 | flags = (uint)TeleportFlags.ViaLocation | (uint)TeleportFlags.IsFlying; | ||
165 | else | ||
166 | flags = (uint)TeleportFlags.ViaLocation; | ||
167 | |||
168 | OSDMap info = new OSDMap(); | ||
169 | info.Add("AgentID", OSD.FromUUID(agentID)); | ||
170 | info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this? | ||
171 | info.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(regionHandle))); | ||
172 | info.Add("SeedCapability", OSD.FromString(capsURL)); | ||
173 | info.Add("SimAccess", OSD.FromInteger(simAccess)); | ||
174 | info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); | ||
175 | info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); | ||
176 | // info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation | ||
177 | info.Add("TeleportFlags", OSD.FromUInteger(flags)); | ||
178 | info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); | ||
179 | info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); | ||
180 | |||
181 | OSDArray infoArr = new OSDArray(); | ||
182 | infoArr.Add(info); | ||
183 | |||
184 | OSDMap body = new OSDMap(); | ||
185 | body.Add("Info", infoArr); | ||
186 | |||
187 | return BuildEvent("TeleportFinish", body); | ||
188 | } | ||
189 | |||
190 | public static OSD ScriptRunningReplyEvent(UUID objectID, UUID itemID, bool running, bool mono) | ||
191 | { | ||
192 | OSDMap script = new OSDMap(); | ||
193 | script.Add("ObjectID", OSD.FromUUID(objectID)); | ||
194 | script.Add("ItemID", OSD.FromUUID(itemID)); | ||
195 | script.Add("Running", OSD.FromBoolean(running)); | ||
196 | script.Add("Mono", OSD.FromBoolean(mono)); | ||
197 | |||
198 | OSDArray scriptArr = new OSDArray(); | ||
199 | scriptArr.Add(script); | ||
200 | |||
201 | OSDMap body = new OSDMap(); | ||
202 | body.Add("Script", scriptArr); | ||
203 | |||
204 | return BuildEvent("ScriptRunningReply", body); | ||
205 | } | ||
206 | |||
207 | public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap, | ||
208 | ulong regionHandle, int regionSizeX, int regionSizeY) | ||
209 | { | ||
210 | OSDMap body = new OSDMap(6) | ||
211 | { | ||
212 | {"agent-id", new OSDUUID(agentID)}, | ||
213 | {"sim-ip-and-port", new OSDString(simIpAndPort)}, | ||
214 | {"seed-capability", new OSDString(seedcap)}, | ||
215 | {"region-handle", OSD.FromULong(regionHandle)}, | ||
216 | {"region-size-x", OSD.FromUInteger((uint)regionSizeX)}, | ||
217 | {"region-size-y", OSD.FromUInteger((uint)regionSizeY)} | ||
218 | }; | ||
219 | |||
220 | return BuildEvent("EstablishAgentCommunication", body); | ||
221 | } | ||
222 | |||
223 | public static OSD KeepAliveEvent() | ||
224 | { | ||
225 | return BuildEvent("FAKEEVENT", new OSDMap()); | ||
226 | } | ||
227 | |||
228 | public static OSD AgentParams(UUID agentID, bool checkEstate, int godLevel, bool limitedToEstate) | ||
229 | { | ||
230 | OSDMap body = new OSDMap(4); | ||
231 | |||
232 | body.Add("agent_id", new OSDUUID(agentID)); | ||
233 | body.Add("check_estate", new OSDInteger(checkEstate ? 1 : 0)); | ||
234 | body.Add("god_level", new OSDInteger(godLevel)); | ||
235 | body.Add("limited_to_estate", new OSDInteger(limitedToEstate ? 1 : 0)); | ||
236 | |||
237 | return body; | ||
238 | } | ||
239 | |||
240 | public static OSD InstantMessageParams(UUID fromAgent, string message, UUID toAgent, | ||
241 | string fromName, byte dialog, uint timeStamp, bool offline, int parentEstateID, | ||
242 | Vector3 position, uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket) | ||
243 | { | ||
244 | OSDMap messageParams = new OSDMap(15); | ||
245 | messageParams.Add("type", new OSDInteger((int)dialog)); | ||
246 | |||
247 | OSDArray positionArray = new OSDArray(3); | ||
248 | positionArray.Add(OSD.FromReal(position.X)); | ||
249 | positionArray.Add(OSD.FromReal(position.Y)); | ||
250 | positionArray.Add(OSD.FromReal(position.Z)); | ||
251 | messageParams.Add("position", positionArray); | ||
252 | |||
253 | messageParams.Add("region_id", new OSDUUID(UUID.Zero)); | ||
254 | messageParams.Add("to_id", new OSDUUID(toAgent)); | ||
255 | messageParams.Add("source", new OSDInteger(0)); | ||
256 | |||
257 | OSDMap data = new OSDMap(1); | ||
258 | data.Add("binary_bucket", OSD.FromBinary(binaryBucket)); | ||
259 | messageParams.Add("data", data); | ||
260 | messageParams.Add("message", new OSDString(message)); | ||
261 | messageParams.Add("id", new OSDUUID(transactionID)); | ||
262 | messageParams.Add("from_name", new OSDString(fromName)); | ||
263 | messageParams.Add("timestamp", new OSDInteger((int)timeStamp)); | ||
264 | messageParams.Add("offline", new OSDInteger(offline ? 1 : 0)); | ||
265 | messageParams.Add("parent_estate_id", new OSDInteger(parentEstateID)); | ||
266 | messageParams.Add("ttl", new OSDInteger((int)ttl)); | ||
267 | messageParams.Add("from_id", new OSDUUID(fromAgent)); | ||
268 | messageParams.Add("from_group", new OSDInteger(fromGroup ? 1 : 0)); | ||
269 | |||
270 | return messageParams; | ||
271 | } | ||
272 | |||
273 | public static OSD InstantMessage(UUID fromAgent, string message, UUID toAgent, | ||
274 | string fromName, byte dialog, uint timeStamp, bool offline, int parentEstateID, | ||
275 | Vector3 position, uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket, | ||
276 | bool checkEstate, int godLevel, bool limitedToEstate) | ||
277 | { | ||
278 | OSDMap im = new OSDMap(2); | ||
279 | im.Add("message_params", InstantMessageParams(fromAgent, message, toAgent, | ||
280 | fromName, dialog, timeStamp, offline, parentEstateID, | ||
281 | position, ttl, transactionID, fromGroup, binaryBucket)); | ||
282 | |||
283 | im.Add("agent_params", AgentParams(fromAgent, checkEstate, godLevel, limitedToEstate)); | ||
284 | |||
285 | return im; | ||
286 | } | ||
287 | |||
288 | |||
289 | public static OSD ChatterboxInvitation(UUID sessionID, string sessionName, | ||
290 | UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, | ||
291 | uint timeStamp, bool offline, int parentEstateID, Vector3 position, | ||
292 | uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket) | ||
293 | { | ||
294 | OSDMap body = new OSDMap(5); | ||
295 | body.Add("session_id", new OSDUUID(sessionID)); | ||
296 | body.Add("from_name", new OSDString(fromName)); | ||
297 | body.Add("session_name", new OSDString(sessionName)); | ||
298 | body.Add("from_id", new OSDUUID(fromAgent)); | ||
299 | |||
300 | body.Add("instantmessage", InstantMessage(fromAgent, message, toAgent, | ||
301 | fromName, dialog, timeStamp, offline, parentEstateID, position, | ||
302 | ttl, transactionID, fromGroup, binaryBucket, true, 0, true)); | ||
303 | |||
304 | OSDMap chatterboxInvitation = new OSDMap(2); | ||
305 | chatterboxInvitation.Add("message", new OSDString("ChatterBoxInvitation")); | ||
306 | chatterboxInvitation.Add("body", body); | ||
307 | return chatterboxInvitation; | ||
308 | } | ||
309 | |||
310 | public static OSD ChatterBoxSessionAgentListUpdates(UUID sessionID, | ||
311 | UUID agentID, bool canVoiceChat, bool isModerator, bool textMute, bool isEnterorLeave) | ||
312 | { | ||
313 | OSDMap body = new OSDMap(); | ||
314 | OSDMap agentUpdates = new OSDMap(); | ||
315 | OSDMap infoDetail = new OSDMap(); | ||
316 | OSDMap mutes = new OSDMap(); | ||
317 | |||
318 | // this should be a list of agents and parameters | ||
319 | // foreach agent | ||
320 | mutes.Add("text", OSD.FromBoolean(textMute)); | ||
321 | infoDetail.Add("can_voice_chat", OSD.FromBoolean(canVoiceChat)); | ||
322 | infoDetail.Add("is_moderator", OSD.FromBoolean(isModerator)); | ||
323 | infoDetail.Add("mutes", mutes); | ||
324 | OSDMap info = new OSDMap(); | ||
325 | info.Add("info", infoDetail); | ||
326 | if(isEnterorLeave) | ||
327 | info.Add("transition",OSD.FromString("ENTER")); | ||
328 | else | ||
329 | info.Add("transition",OSD.FromString("LEAVE")); | ||
330 | agentUpdates.Add(agentID.ToString(), info); | ||
331 | |||
332 | // foreach end | ||
333 | |||
334 | body.Add("agent_updates", agentUpdates); | ||
335 | body.Add("session_id", OSD.FromUUID(sessionID)); | ||
336 | body.Add("updates", new OSD()); | ||
337 | |||
338 | OSDMap chatterBoxSessionAgentListUpdates = new OSDMap(); | ||
339 | chatterBoxSessionAgentListUpdates.Add("message", OSD.FromString("ChatterBoxSessionAgentListUpdates")); | ||
340 | chatterBoxSessionAgentListUpdates.Add("body", body); | ||
341 | |||
342 | return chatterBoxSessionAgentListUpdates; | ||
343 | } | ||
344 | |||
345 | public static OSD ChatterBoxForceClose(UUID sessionID, string reason) | ||
346 | { | ||
347 | OSDMap body = new OSDMap(2); | ||
348 | body.Add("session_id", new OSDUUID(sessionID)); | ||
349 | body.Add("reason", new OSDString(reason)); | ||
350 | |||
351 | OSDMap chatterBoxForceClose = new OSDMap(2); | ||
352 | chatterBoxForceClose.Add("message", new OSDString("ForceCloseChatterBoxSession")); | ||
353 | chatterBoxForceClose.Add("body", body); | ||
354 | return chatterBoxForceClose; | ||
355 | } | ||
356 | |||
357 | public static OSD GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data) | ||
358 | { | ||
359 | OSDArray AgentData = new OSDArray(1); | ||
360 | OSDMap AgentDataMap = new OSDMap(1); | ||
361 | AgentDataMap.Add("AgentID", OSD.FromUUID(receiverAgent)); | ||
362 | AgentData.Add(AgentDataMap); | ||
363 | |||
364 | OSDArray GroupData = new OSDArray(data.Length); | ||
365 | OSDArray NewGroupData = new OSDArray(data.Length); | ||
366 | |||
367 | foreach (GroupMembershipData membership in data) | ||
368 | { | ||
369 | OSDMap GroupDataMap = new OSDMap(6); | ||
370 | OSDMap NewGroupDataMap = new OSDMap(1); | ||
371 | |||
372 | GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID)); | ||
373 | GroupDataMap.Add("GroupPowers", OSD.FromULong(membership.GroupPowers)); | ||
374 | GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices)); | ||
375 | GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture)); | ||
376 | GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution)); | ||
377 | GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName)); | ||
378 | NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile)); | ||
379 | |||
380 | GroupData.Add(GroupDataMap); | ||
381 | NewGroupData.Add(NewGroupDataMap); | ||
382 | } | ||
383 | |||
384 | OSDMap llDataStruct = new OSDMap(3); | ||
385 | llDataStruct.Add("AgentData", AgentData); | ||
386 | llDataStruct.Add("GroupData", GroupData); | ||
387 | llDataStruct.Add("NewGroupData", NewGroupData); | ||
388 | |||
389 | return BuildEvent("AgentGroupDataUpdate", llDataStruct); | ||
390 | |||
391 | } | ||
392 | |||
393 | public static OSD PlacesQuery(PlacesReplyPacket PlacesReply) | ||
394 | { | ||
395 | OSDMap placesReply = new OSDMap(); | ||
396 | placesReply.Add("message", OSD.FromString("PlacesReplyMessage")); | ||
397 | |||
398 | OSDMap body = new OSDMap(); | ||
399 | OSDArray agentData = new OSDArray(); | ||
400 | OSDMap agentDataMap = new OSDMap(); | ||
401 | agentDataMap.Add("AgentID", OSD.FromUUID(PlacesReply.AgentData.AgentID)); | ||
402 | agentDataMap.Add("QueryID", OSD.FromUUID(PlacesReply.AgentData.QueryID)); | ||
403 | agentDataMap.Add("TransactionID", OSD.FromUUID(PlacesReply.TransactionData.TransactionID)); | ||
404 | agentData.Add(agentDataMap); | ||
405 | body.Add("AgentData", agentData); | ||
406 | |||
407 | OSDArray QueryData = new OSDArray(); | ||
408 | |||
409 | foreach (PlacesReplyPacket.QueryDataBlock groupDataBlock in PlacesReply.QueryData) | ||
410 | { | ||
411 | OSDMap QueryDataMap = new OSDMap(); | ||
412 | QueryDataMap.Add("ActualArea", OSD.FromInteger(groupDataBlock.ActualArea)); | ||
413 | QueryDataMap.Add("BillableArea", OSD.FromInteger(groupDataBlock.BillableArea)); | ||
414 | QueryDataMap.Add("Description", OSD.FromBinary(groupDataBlock.Desc)); | ||
415 | QueryDataMap.Add("Dwell", OSD.FromInteger((int)groupDataBlock.Dwell)); | ||
416 | QueryDataMap.Add("Flags", OSD.FromString(Convert.ToString(groupDataBlock.Flags))); | ||
417 | QueryDataMap.Add("GlobalX", OSD.FromInteger((int)groupDataBlock.GlobalX)); | ||
418 | QueryDataMap.Add("GlobalY", OSD.FromInteger((int)groupDataBlock.GlobalY)); | ||
419 | QueryDataMap.Add("GlobalZ", OSD.FromInteger((int)groupDataBlock.GlobalZ)); | ||
420 | QueryDataMap.Add("Name", OSD.FromBinary(groupDataBlock.Name)); | ||
421 | QueryDataMap.Add("OwnerID", OSD.FromUUID(groupDataBlock.OwnerID)); | ||
422 | QueryDataMap.Add("SimName", OSD.FromBinary(groupDataBlock.SimName)); | ||
423 | QueryDataMap.Add("SnapShotID", OSD.FromUUID(groupDataBlock.SnapshotID)); | ||
424 | QueryDataMap.Add("ProductSku", OSD.FromInteger(0)); | ||
425 | QueryDataMap.Add("Price", OSD.FromInteger(groupDataBlock.Price)); | ||
426 | |||
427 | QueryData.Add(QueryDataMap); | ||
428 | } | ||
429 | body.Add("QueryData", QueryData); | ||
430 | placesReply.Add("QueryData[]", body); | ||
431 | |||
432 | return placesReply; | ||
433 | } | ||
434 | |||
435 | public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) | ||
436 | { | ||
437 | OSDMap message = new OSDMap(); | ||
438 | message.Add("message", OSD.FromString("ParcelProperties")); | ||
439 | OSD message_body = parcelPropertiesMessage.Serialize(); | ||
440 | message.Add("body", message_body); | ||
441 | return message; | ||
442 | } | ||
443 | |||
444 | public static OSD partPhysicsProperties(uint localID, byte physhapetype, | ||
445 | float density, float friction, float bounce, float gravmod) | ||
446 | { | ||
447 | |||
448 | OSDMap physinfo = new OSDMap(6); | ||
449 | physinfo["LocalID"] = localID; | ||
450 | physinfo["Density"] = density; | ||
451 | physinfo["Friction"] = friction; | ||
452 | physinfo["GravityMultiplier"] = gravmod; | ||
453 | physinfo["Restitution"] = bounce; | ||
454 | physinfo["PhysicsShapeType"] = (int)physhapetype; | ||
455 | |||
456 | OSDArray array = new OSDArray(1); | ||
457 | array.Add(physinfo); | ||
458 | |||
459 | OSDMap llsdBody = new OSDMap(1); | ||
460 | llsdBody.Add("ObjectData", array); | ||
461 | |||
462 | return BuildEvent("ObjectPhysicsProperties", llsdBody); | ||
463 | } | ||
464 | } | ||
465 | } | ||