diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs | 459 |
1 files changed, 459 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs new file mode 100644 index 0000000..80f6fce --- /dev/null +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs | |||
@@ -0,0 +1,459 @@ | |||
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 OpenSim 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 | |||
34 | namespace OpenSim.Region.CoreModules.Framework.EventQueue | ||
35 | { | ||
36 | public class EventQueueHelper | ||
37 | { | ||
38 | private EventQueueHelper() {} // no construction possible, it's an utility class | ||
39 | |||
40 | private static byte[] ulongToByteArray(ulong uLongValue) | ||
41 | { | ||
42 | // Reverse endianness of RegionHandle | ||
43 | return new byte[] | ||
44 | { | ||
45 | (byte)((uLongValue >> 56) % 256), | ||
46 | (byte)((uLongValue >> 48) % 256), | ||
47 | (byte)((uLongValue >> 40) % 256), | ||
48 | (byte)((uLongValue >> 32) % 256), | ||
49 | (byte)((uLongValue >> 24) % 256), | ||
50 | (byte)((uLongValue >> 16) % 256), | ||
51 | (byte)((uLongValue >> 8) % 256), | ||
52 | (byte)(uLongValue % 256) | ||
53 | }; | ||
54 | } | ||
55 | |||
56 | private static byte[] uintToByteArray(uint uIntValue) | ||
57 | { | ||
58 | byte[] resultbytes = Utils.UIntToBytes(uIntValue); | ||
59 | if (BitConverter.IsLittleEndian) | ||
60 | Array.Reverse(resultbytes); | ||
61 | |||
62 | return resultbytes; | ||
63 | } | ||
64 | |||
65 | public static OSD buildEvent(string eventName, OSD eventBody) | ||
66 | { | ||
67 | OSDMap llsdEvent = new OSDMap(2); | ||
68 | llsdEvent.Add("message", new OSDString(eventName)); | ||
69 | llsdEvent.Add("body", eventBody); | ||
70 | |||
71 | return llsdEvent; | ||
72 | } | ||
73 | |||
74 | public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint) | ||
75 | { | ||
76 | OSDMap llsdSimInfo = new OSDMap(3); | ||
77 | |||
78 | llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle))); | ||
79 | llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes())); | ||
80 | llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port)); | ||
81 | |||
82 | OSDArray arr = new OSDArray(1); | ||
83 | arr.Add(llsdSimInfo); | ||
84 | |||
85 | OSDMap llsdBody = new OSDMap(1); | ||
86 | llsdBody.Add("SimulatorInfo", arr); | ||
87 | |||
88 | return buildEvent("EnableSimulator", llsdBody); | ||
89 | } | ||
90 | |||
91 | public static OSD DisableSimulator(ulong handle) | ||
92 | { | ||
93 | //OSDMap llsdSimInfo = new OSDMap(1); | ||
94 | |||
95 | //llsdSimInfo.Add("Handle", new OSDBinary(regionHandleToByteArray(handle))); | ||
96 | |||
97 | //OSDArray arr = new OSDArray(1); | ||
98 | //arr.Add(llsdSimInfo); | ||
99 | |||
100 | OSDMap llsdBody = new OSDMap(0); | ||
101 | //llsdBody.Add("SimulatorInfo", arr); | ||
102 | |||
103 | return buildEvent("DisableSimulator", llsdBody); | ||
104 | } | ||
105 | |||
106 | public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, | ||
107 | IPEndPoint newRegionExternalEndPoint, | ||
108 | string capsURL, UUID agentID, UUID sessionID) | ||
109 | { | ||
110 | OSDArray lookAtArr = new OSDArray(3); | ||
111 | lookAtArr.Add(OSD.FromReal(lookAt.X)); | ||
112 | lookAtArr.Add(OSD.FromReal(lookAt.Y)); | ||
113 | lookAtArr.Add(OSD.FromReal(lookAt.Z)); | ||
114 | |||
115 | OSDArray positionArr = new OSDArray(3); | ||
116 | positionArr.Add(OSD.FromReal(pos.X)); | ||
117 | positionArr.Add(OSD.FromReal(pos.Y)); | ||
118 | positionArr.Add(OSD.FromReal(pos.Z)); | ||
119 | |||
120 | OSDMap infoMap = new OSDMap(2); | ||
121 | infoMap.Add("LookAt", lookAtArr); | ||
122 | infoMap.Add("Position", positionArr); | ||
123 | |||
124 | OSDArray infoArr = new OSDArray(1); | ||
125 | infoArr.Add(infoMap); | ||
126 | |||
127 | OSDMap agentDataMap = new OSDMap(2); | ||
128 | agentDataMap.Add("AgentID", OSD.FromUUID(agentID)); | ||
129 | agentDataMap.Add("SessionID", OSD.FromUUID(sessionID)); | ||
130 | |||
131 | OSDArray agentDataArr = new OSDArray(1); | ||
132 | agentDataArr.Add(agentDataMap); | ||
133 | |||
134 | OSDMap regionDataMap = new OSDMap(4); | ||
135 | regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle))); | ||
136 | regionDataMap.Add("SeedCapability", OSD.FromString(capsURL)); | ||
137 | regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes())); | ||
138 | regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port)); | ||
139 | |||
140 | OSDArray regionDataArr = new OSDArray(1); | ||
141 | regionDataArr.Add(regionDataMap); | ||
142 | |||
143 | OSDMap llsdBody = new OSDMap(3); | ||
144 | llsdBody.Add("Info", infoArr); | ||
145 | llsdBody.Add("AgentData", agentDataArr); | ||
146 | llsdBody.Add("RegionData", regionDataArr); | ||
147 | |||
148 | return buildEvent("CrossedRegion", llsdBody); | ||
149 | } | ||
150 | |||
151 | public static OSD TeleportFinishEvent( | ||
152 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, | ||
153 | uint locationID, uint flags, string capsURL, UUID agentID) | ||
154 | { | ||
155 | OSDMap info = new OSDMap(); | ||
156 | info.Add("AgentID", OSD.FromUUID(agentID)); | ||
157 | info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this? | ||
158 | info.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(regionHandle))); | ||
159 | info.Add("SeedCapability", OSD.FromString(capsURL)); | ||
160 | info.Add("SimAccess", OSD.FromInteger(simAccess)); | ||
161 | info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); | ||
162 | info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); | ||
163 | info.Add("TeleportFlags", OSD.FromBinary(1L << 4)); // AgentManager.TeleportFlags.ViaLocation | ||
164 | |||
165 | OSDArray infoArr = new OSDArray(); | ||
166 | infoArr.Add(info); | ||
167 | |||
168 | OSDMap body = new OSDMap(); | ||
169 | body.Add("Info", infoArr); | ||
170 | |||
171 | return buildEvent("TeleportFinish", body); | ||
172 | } | ||
173 | |||
174 | public static OSD ScriptRunningReplyEvent(UUID objectID, UUID itemID, bool running, bool mono) | ||
175 | { | ||
176 | OSDMap script = new OSDMap(); | ||
177 | script.Add("ObjectID", OSD.FromUUID(objectID)); | ||
178 | script.Add("ItemID", OSD.FromUUID(itemID)); | ||
179 | script.Add("Running", OSD.FromBoolean(running)); | ||
180 | script.Add("Mono", OSD.FromBoolean(mono)); | ||
181 | |||
182 | OSDArray scriptArr = new OSDArray(); | ||
183 | scriptArr.Add(script); | ||
184 | |||
185 | OSDMap body = new OSDMap(); | ||
186 | body.Add("Script", scriptArr); | ||
187 | |||
188 | return buildEvent("ScriptRunningReply", body); | ||
189 | } | ||
190 | |||
191 | public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap) | ||
192 | { | ||
193 | OSDMap body = new OSDMap(3); | ||
194 | body.Add("agent-id", new OSDUUID(agentID)); | ||
195 | body.Add("sim-ip-and-port", new OSDString(simIpAndPort)); | ||
196 | body.Add("seed-capability", new OSDString(seedcap)); | ||
197 | |||
198 | return buildEvent("EstablishAgentCommunication", body); | ||
199 | } | ||
200 | |||
201 | public static OSD KeepAliveEvent() | ||
202 | { | ||
203 | return buildEvent("FAKEEVENT", new OSDMap()); | ||
204 | } | ||
205 | |||
206 | public static OSD AgentParams(UUID agentID, bool checkEstate, int godLevel, bool limitedToEstate) | ||
207 | { | ||
208 | OSDMap body = new OSDMap(4); | ||
209 | |||
210 | body.Add("agent_id", new OSDUUID(agentID)); | ||
211 | body.Add("check_estate", new OSDInteger(checkEstate ? 1 : 0)); | ||
212 | body.Add("god_level", new OSDInteger(godLevel)); | ||
213 | body.Add("limited_to_estate", new OSDInteger(limitedToEstate ? 1 : 0)); | ||
214 | |||
215 | return body; | ||
216 | } | ||
217 | |||
218 | public static OSD InstantMessageParams(UUID fromAgent, string message, UUID toAgent, | ||
219 | string fromName, byte dialog, uint timeStamp, bool offline, int parentEstateID, | ||
220 | Vector3 position, uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket) | ||
221 | { | ||
222 | OSDMap messageParams = new OSDMap(15); | ||
223 | messageParams.Add("type", new OSDInteger((int)dialog)); | ||
224 | |||
225 | OSDArray positionArray = new OSDArray(3); | ||
226 | positionArray.Add(OSD.FromReal(position.X)); | ||
227 | positionArray.Add(OSD.FromReal(position.Y)); | ||
228 | positionArray.Add(OSD.FromReal(position.Z)); | ||
229 | messageParams.Add("position", positionArray); | ||
230 | |||
231 | messageParams.Add("region_id", new OSDUUID(UUID.Zero)); | ||
232 | messageParams.Add("to_id", new OSDUUID(toAgent)); | ||
233 | messageParams.Add("source", new OSDInteger(0)); | ||
234 | |||
235 | OSDMap data = new OSDMap(1); | ||
236 | data.Add("binary_bucket", OSD.FromBinary(binaryBucket)); | ||
237 | messageParams.Add("data", data); | ||
238 | messageParams.Add("message", new OSDString(message)); | ||
239 | messageParams.Add("id", new OSDUUID(transactionID)); | ||
240 | messageParams.Add("from_name", new OSDString(fromName)); | ||
241 | messageParams.Add("timestamp", new OSDInteger((int)timeStamp)); | ||
242 | messageParams.Add("offline", new OSDInteger(offline ? 1 : 0)); | ||
243 | messageParams.Add("parent_estate_id", new OSDInteger(parentEstateID)); | ||
244 | messageParams.Add("ttl", new OSDInteger((int)ttl)); | ||
245 | messageParams.Add("from_id", new OSDUUID(fromAgent)); | ||
246 | messageParams.Add("from_group", new OSDInteger(fromGroup ? 1 : 0)); | ||
247 | |||
248 | return messageParams; | ||
249 | } | ||
250 | |||
251 | public static OSD InstantMessage(UUID fromAgent, string message, UUID toAgent, | ||
252 | string fromName, byte dialog, uint timeStamp, bool offline, int parentEstateID, | ||
253 | Vector3 position, uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket, | ||
254 | bool checkEstate, int godLevel, bool limitedToEstate) | ||
255 | { | ||
256 | OSDMap im = new OSDMap(2); | ||
257 | im.Add("message_params", InstantMessageParams(fromAgent, message, toAgent, | ||
258 | fromName, dialog, timeStamp, offline, parentEstateID, | ||
259 | position, ttl, transactionID, fromGroup, binaryBucket)); | ||
260 | |||
261 | im.Add("agent_params", AgentParams(fromAgent, checkEstate, godLevel, limitedToEstate)); | ||
262 | |||
263 | return im; | ||
264 | } | ||
265 | |||
266 | |||
267 | public static OSD ChatterboxInvitation(UUID sessionID, string sessionName, | ||
268 | UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, | ||
269 | uint timeStamp, bool offline, int parentEstateID, Vector3 position, | ||
270 | uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket) | ||
271 | { | ||
272 | OSDMap body = new OSDMap(5); | ||
273 | body.Add("session_id", new OSDUUID(sessionID)); | ||
274 | body.Add("from_name", new OSDString(fromName)); | ||
275 | body.Add("session_name", new OSDString(sessionName)); | ||
276 | body.Add("from_id", new OSDUUID(fromAgent)); | ||
277 | |||
278 | body.Add("instantmessage", InstantMessage(fromAgent, message, toAgent, | ||
279 | fromName, dialog, timeStamp, offline, parentEstateID, position, | ||
280 | ttl, transactionID, fromGroup, binaryBucket, true, 0, true)); | ||
281 | |||
282 | OSDMap chatterboxInvitation = new OSDMap(2); | ||
283 | chatterboxInvitation.Add("message", new OSDString("ChatterBoxInvitation")); | ||
284 | chatterboxInvitation.Add("body", body); | ||
285 | return chatterboxInvitation; | ||
286 | } | ||
287 | |||
288 | public static OSD ChatterBoxSessionAgentListUpdates(UUID sessionID, | ||
289 | UUID agentID, bool canVoiceChat, bool isModerator, bool textMute) | ||
290 | { | ||
291 | OSDMap body = new OSDMap(); | ||
292 | OSDMap agentUpdates = new OSDMap(); | ||
293 | OSDMap infoDetail = new OSDMap(); | ||
294 | OSDMap mutes = new OSDMap(); | ||
295 | |||
296 | mutes.Add("text", OSD.FromBoolean(textMute)); | ||
297 | infoDetail.Add("can_voice_chat", OSD.FromBoolean(canVoiceChat)); | ||
298 | infoDetail.Add("is_moderator", OSD.FromBoolean(isModerator)); | ||
299 | infoDetail.Add("mutes", mutes); | ||
300 | OSDMap info = new OSDMap(); | ||
301 | info.Add("info", infoDetail); | ||
302 | agentUpdates.Add(agentID.ToString(), info); | ||
303 | body.Add("agent_updates", agentUpdates); | ||
304 | body.Add("session_id", OSD.FromUUID(sessionID)); | ||
305 | body.Add("updates", new OSD()); | ||
306 | |||
307 | OSDMap chatterBoxSessionAgentListUpdates = new OSDMap(); | ||
308 | chatterBoxSessionAgentListUpdates.Add("message", OSD.FromString("ChatterBoxSessionAgentListUpdates")); | ||
309 | chatterBoxSessionAgentListUpdates.Add("body", body); | ||
310 | |||
311 | return chatterBoxSessionAgentListUpdates; | ||
312 | } | ||
313 | |||
314 | public static OSD ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket) | ||
315 | { | ||
316 | OSDMap parcelProperties = new OSDMap(); | ||
317 | OSDMap body = new OSDMap(); | ||
318 | |||
319 | OSDArray ageVerificationBlock = new OSDArray(); | ||
320 | OSDMap ageVerificationMap = new OSDMap(); | ||
321 | ageVerificationMap.Add("RegionDenyAgeUnverified", | ||
322 | OSD.FromBoolean(parcelPropertiesPacket.AgeVerificationBlock.RegionDenyAgeUnverified)); | ||
323 | ageVerificationBlock.Add(ageVerificationMap); | ||
324 | body.Add("AgeVerificationBlock", ageVerificationBlock); | ||
325 | |||
326 | // LL sims send media info in this event queue message but it's not in the UDP | ||
327 | // packet we construct this event queue message from. This should be refactored in | ||
328 | // other areas of the code so it can all be send in the same message. Until then we will | ||
329 | // still send the media info via UDP | ||
330 | |||
331 | //OSDArray mediaData = new OSDArray(); | ||
332 | //OSDMap mediaDataMap = new OSDMap(); | ||
333 | //mediaDataMap.Add("MediaDesc", OSD.FromString("")); | ||
334 | //mediaDataMap.Add("MediaHeight", OSD.FromInteger(0)); | ||
335 | //mediaDataMap.Add("MediaLoop", OSD.FromInteger(0)); | ||
336 | //mediaDataMap.Add("MediaType", OSD.FromString("type/type")); | ||
337 | //mediaDataMap.Add("MediaWidth", OSD.FromInteger(0)); | ||
338 | //mediaDataMap.Add("ObscureMedia", OSD.FromInteger(0)); | ||
339 | //mediaDataMap.Add("ObscureMusic", OSD.FromInteger(0)); | ||
340 | //mediaData.Add(mediaDataMap); | ||
341 | //body.Add("MediaData", mediaData); | ||
342 | |||
343 | OSDArray parcelData = new OSDArray(); | ||
344 | OSDMap parcelDataMap = new OSDMap(); | ||
345 | OSDArray AABBMax = new OSDArray(3); | ||
346 | AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.X)); | ||
347 | AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Y)); | ||
348 | AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Z)); | ||
349 | parcelDataMap.Add("AABBMax", AABBMax); | ||
350 | |||
351 | OSDArray AABBMin = new OSDArray(3); | ||
352 | AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.X)); | ||
353 | AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Y)); | ||
354 | AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Z)); | ||
355 | parcelDataMap.Add("AABBMin", AABBMin); | ||
356 | |||
357 | parcelDataMap.Add("Area", OSD.FromInteger(parcelPropertiesPacket.ParcelData.Area)); | ||
358 | parcelDataMap.Add("AuctionID", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.AuctionID))); | ||
359 | parcelDataMap.Add("AuthBuyerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.AuthBuyerID)); | ||
360 | parcelDataMap.Add("Bitmap", OSD.FromBinary(parcelPropertiesPacket.ParcelData.Bitmap)); | ||
361 | parcelDataMap.Add("Category", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Category)); | ||
362 | parcelDataMap.Add("ClaimDate", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimDate)); | ||
363 | parcelDataMap.Add("ClaimPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimPrice)); | ||
364 | parcelDataMap.Add("Desc", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc))); | ||
365 | parcelDataMap.Add("GroupID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.GroupID)); | ||
366 | parcelDataMap.Add("GroupPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.GroupPrims)); | ||
367 | parcelDataMap.Add("IsGroupOwned", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.IsGroupOwned)); | ||
368 | parcelDataMap.Add("LandingType", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LandingType)); | ||
369 | parcelDataMap.Add("LocalID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LocalID)); | ||
370 | parcelDataMap.Add("MaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.MaxPrims)); | ||
371 | parcelDataMap.Add("MediaAutoScale", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.MediaAutoScale)); | ||
372 | parcelDataMap.Add("MediaID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.MediaID)); | ||
373 | parcelDataMap.Add("MediaURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL))); | ||
374 | parcelDataMap.Add("MusicURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL))); | ||
375 | parcelDataMap.Add("Name", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name))); | ||
376 | parcelDataMap.Add("OtherCleanTime", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCleanTime)); | ||
377 | parcelDataMap.Add("OtherCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCount)); | ||
378 | parcelDataMap.Add("OtherPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherPrims)); | ||
379 | parcelDataMap.Add("OwnerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.OwnerID)); | ||
380 | parcelDataMap.Add("OwnerPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OwnerPrims)); | ||
381 | parcelDataMap.Add("ParcelFlags", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.ParcelFlags))); | ||
382 | parcelDataMap.Add("ParcelPrimBonus", OSD.FromReal(parcelPropertiesPacket.ParcelData.ParcelPrimBonus)); | ||
383 | parcelDataMap.Add("PassHours", OSD.FromReal(parcelPropertiesPacket.ParcelData.PassHours)); | ||
384 | parcelDataMap.Add("PassPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PassPrice)); | ||
385 | parcelDataMap.Add("PublicCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PublicCount)); | ||
386 | parcelDataMap.Add("RegionDenyAnonymous", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyAnonymous)); | ||
387 | parcelDataMap.Add("RegionDenyIdentified", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyIdentified)); | ||
388 | parcelDataMap.Add("RegionDenyTransacted", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyTransacted)); | ||
389 | |||
390 | parcelDataMap.Add("RegionPushOverride", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionPushOverride)); | ||
391 | parcelDataMap.Add("RentPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RentPrice)); | ||
392 | parcelDataMap.Add("RequestResult", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RequestResult)); | ||
393 | parcelDataMap.Add("SalePrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SalePrice)); | ||
394 | parcelDataMap.Add("SelectedPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelectedPrims)); | ||
395 | parcelDataMap.Add("SelfCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelfCount)); | ||
396 | parcelDataMap.Add("SequenceID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SequenceID)); | ||
397 | parcelDataMap.Add("SimWideMaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideMaxPrims)); | ||
398 | parcelDataMap.Add("SimWideTotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideTotalPrims)); | ||
399 | parcelDataMap.Add("SnapSelection", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.SnapSelection)); | ||
400 | parcelDataMap.Add("SnapshotID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.SnapshotID)); | ||
401 | parcelDataMap.Add("Status", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Status)); | ||
402 | parcelDataMap.Add("TotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.TotalPrims)); | ||
403 | |||
404 | OSDArray UserLocation = new OSDArray(3); | ||
405 | UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.X)); | ||
406 | UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Y)); | ||
407 | UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Z)); | ||
408 | parcelDataMap.Add("UserLocation", UserLocation); | ||
409 | |||
410 | OSDArray UserLookAt = new OSDArray(3); | ||
411 | UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.X)); | ||
412 | UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Y)); | ||
413 | UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Z)); | ||
414 | parcelDataMap.Add("UserLookAt", UserLookAt); | ||
415 | |||
416 | parcelData.Add(parcelDataMap); | ||
417 | body.Add("ParcelData", parcelData); | ||
418 | parcelProperties.Add("body", body); | ||
419 | parcelProperties.Add("message", OSD.FromString("ParcelProperties")); | ||
420 | |||
421 | return parcelProperties; | ||
422 | } | ||
423 | |||
424 | public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket) | ||
425 | { | ||
426 | OSDMap groupUpdate = new OSDMap(); | ||
427 | groupUpdate.Add("message", OSD.FromString("AgentGroupDataUpdate")); | ||
428 | |||
429 | OSDMap body = new OSDMap(); | ||
430 | OSDArray agentData = new OSDArray(); | ||
431 | OSDMap agentDataMap = new OSDMap(); | ||
432 | agentDataMap.Add("AgentID", OSD.FromUUID(groupUpdatePacket.AgentData.AgentID)); | ||
433 | agentData.Add(agentDataMap); | ||
434 | body.Add("AgentData", agentData); | ||
435 | |||
436 | OSDArray groupData = new OSDArray(); | ||
437 | |||
438 | foreach (AgentGroupDataUpdatePacket.GroupDataBlock groupDataBlock in groupUpdatePacket.GroupData) | ||
439 | { | ||
440 | OSDMap groupDataMap = new OSDMap(); | ||
441 | groupDataMap.Add("ListInProfile", OSD.FromBoolean(false)); | ||
442 | groupDataMap.Add("GroupID", OSD.FromUUID(groupDataBlock.GroupID)); | ||
443 | groupDataMap.Add("GroupInsigniaID", OSD.FromUUID(groupDataBlock.GroupInsigniaID)); | ||
444 | groupDataMap.Add("Contribution", OSD.FromInteger(groupDataBlock.Contribution)); | ||
445 | groupDataMap.Add("GroupPowers", OSD.FromBinary(ulongToByteArray(groupDataBlock.GroupPowers))); | ||
446 | groupDataMap.Add("GroupName", OSD.FromString(Utils.BytesToString(groupDataBlock.GroupName))); | ||
447 | groupDataMap.Add("AcceptNotices", OSD.FromBoolean(groupDataBlock.AcceptNotices)); | ||
448 | |||
449 | groupData.Add(groupDataMap); | ||
450 | |||
451 | } | ||
452 | body.Add("GroupData", groupData); | ||
453 | groupUpdate.Add("body", body); | ||
454 | |||
455 | return groupUpdate; | ||
456 | } | ||
457 | |||
458 | } | ||
459 | } | ||