diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/OpenSim.RegionServer/ClientView.API.cs | 251 |
1 files changed, 171 insertions, 80 deletions
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs index f59e170..fe46fcb 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs | |||
@@ -182,56 +182,7 @@ namespace OpenSim | |||
182 | this.OutPacket(reply); | 182 | this.OutPacket(reply); |
183 | } | 183 | } |
184 | 184 | ||
185 | /// <summary> | 185 | |
186 | /// | ||
187 | /// </summary> | ||
188 | /// <param name="wearables"></param> | ||
189 | public void SendWearables(AvatarWearable[] wearables) | ||
190 | { | ||
191 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | ||
192 | aw.AgentData.AgentID = this.AgentID; | ||
193 | aw.AgentData.SerialNum = 0; | ||
194 | aw.AgentData.SessionID = this.SessionID; | ||
195 | |||
196 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | ||
197 | AgentWearablesUpdatePacket.WearableDataBlock awb; | ||
198 | for (int i = 0; i < wearables.Length; i++) | ||
199 | { | ||
200 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
201 | awb.WearableType = (byte)i; | ||
202 | awb.AssetID = wearables[i].AssetID; | ||
203 | awb.ItemID = wearables[i].ItemID; | ||
204 | aw.WearableData[i] = awb; | ||
205 | } | ||
206 | |||
207 | this.OutPacket(aw); | ||
208 | } | ||
209 | |||
210 | /// <summary> | ||
211 | /// | ||
212 | /// </summary> | ||
213 | /// <param name="agentID"></param> | ||
214 | /// <param name="visualParams"></param> | ||
215 | /// <param name="textureEntry"></param> | ||
216 | public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) | ||
217 | { | ||
218 | AvatarAppearancePacket avp = new AvatarAppearancePacket(); | ||
219 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | ||
220 | avp.ObjectData.TextureEntry = textureEntry; | ||
221 | |||
222 | AvatarAppearancePacket.VisualParamBlock avblock = null; | ||
223 | for (int i = 0; i < visualParams.Length; i++) | ||
224 | { | ||
225 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | ||
226 | avblock.ParamValue = visualParams[i]; | ||
227 | avp.VisualParam[i] = avblock; | ||
228 | } | ||
229 | |||
230 | avp.Sender.IsTrial = false; | ||
231 | avp.Sender.ID = agentID; | ||
232 | OutPacket(avp); | ||
233 | } | ||
234 | |||
235 | /// <summary> | 186 | /// <summary> |
236 | /// Send the region heightmap to the client | 187 | /// Send the region heightmap to the client |
237 | /// </summary> | 188 | /// </summary> |
@@ -287,7 +238,91 @@ namespace OpenSim | |||
287 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); | 238 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); |
288 | } | 239 | } |
289 | } | 240 | } |
241 | |||
242 | public void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort) | ||
243 | { | ||
244 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | ||
245 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | ||
246 | enablesimpacket.SimulatorInfo.Handle = neighbourHandle; | ||
247 | |||
248 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
249 | enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; | ||
250 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; | ||
251 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; | ||
252 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; | ||
253 | enablesimpacket.SimulatorInfo.Port = neighbourPort; | ||
254 | OutPacket(enablesimpacket); | ||
255 | } | ||
256 | |||
257 | public AgentCircuitData RequestClientInfo() | ||
258 | { | ||
259 | AgentCircuitData agentData = new AgentCircuitData(); | ||
260 | agentData.AgentID = this.AgentId; | ||
261 | agentData.SessionID = this.SessionID; | ||
262 | agentData.SecureSessionID = this.SecureSessionID; | ||
263 | agentData.circuitcode = this.CircuitCode; | ||
264 | agentData.child = false; | ||
265 | agentData.firstname = this.firstName; | ||
266 | agentData.lastname = this.lastName; | ||
267 | |||
268 | return agentData; | ||
269 | } | ||
270 | |||
271 | #region Appearance/ Wearables Methods | ||
272 | |||
273 | /// <summary> | ||
274 | /// | ||
275 | /// </summary> | ||
276 | /// <param name="wearables"></param> | ||
277 | public void SendWearables(AvatarWearable[] wearables) | ||
278 | { | ||
279 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | ||
280 | aw.AgentData.AgentID = this.AgentID; | ||
281 | aw.AgentData.SerialNum = 0; | ||
282 | aw.AgentData.SessionID = this.SessionID; | ||
283 | |||
284 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | ||
285 | AgentWearablesUpdatePacket.WearableDataBlock awb; | ||
286 | for (int i = 0; i < wearables.Length; i++) | ||
287 | { | ||
288 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
289 | awb.WearableType = (byte)i; | ||
290 | awb.AssetID = wearables[i].AssetID; | ||
291 | awb.ItemID = wearables[i].ItemID; | ||
292 | aw.WearableData[i] = awb; | ||
293 | } | ||
294 | |||
295 | this.OutPacket(aw); | ||
296 | } | ||
297 | |||
298 | /// <summary> | ||
299 | /// | ||
300 | /// </summary> | ||
301 | /// <param name="agentID"></param> | ||
302 | /// <param name="visualParams"></param> | ||
303 | /// <param name="textureEntry"></param> | ||
304 | public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) | ||
305 | { | ||
306 | AvatarAppearancePacket avp = new AvatarAppearancePacket(); | ||
307 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | ||
308 | avp.ObjectData.TextureEntry = textureEntry; | ||
309 | |||
310 | AvatarAppearancePacket.VisualParamBlock avblock = null; | ||
311 | for (int i = 0; i < visualParams.Length; i++) | ||
312 | { | ||
313 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | ||
314 | avblock.ParamValue = visualParams[i]; | ||
315 | avp.VisualParam[i] = avblock; | ||
316 | } | ||
317 | |||
318 | avp.Sender.IsTrial = false; | ||
319 | avp.Sender.ID = agentID; | ||
320 | OutPacket(avp); | ||
321 | } | ||
322 | |||
323 | #endregion | ||
290 | 324 | ||
325 | #region Avatar Packet/data sending Methods | ||
291 | 326 | ||
292 | /// <summary> | 327 | /// <summary> |
293 | /// | 328 | /// |
@@ -316,11 +351,12 @@ namespace OpenSim | |||
316 | libsecondlife.LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); | 351 | libsecondlife.LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); |
317 | byte[] pb = pos2.GetBytes(); | 352 | byte[] pb = pos2.GetBytes(); |
318 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | 353 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); |
319 | 354 | ||
320 | OutPacket(objupdate); | 355 | OutPacket(objupdate); |
321 | 356 | ||
322 | } | 357 | } |
323 | 358 | ||
359 | |||
324 | /// <summary> | 360 | /// <summary> |
325 | /// | 361 | /// |
326 | /// </summary> | 362 | /// </summary> |
@@ -384,34 +420,7 @@ namespace OpenSim | |||
384 | return objdata; | 420 | return objdata; |
385 | } | 421 | } |
386 | 422 | ||
387 | public void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort) | 423 | #endregion |
388 | { | ||
389 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | ||
390 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | ||
391 | enablesimpacket.SimulatorInfo.Handle = neighbourHandle; | ||
392 | |||
393 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
394 | enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; | ||
395 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; | ||
396 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; | ||
397 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; | ||
398 | enablesimpacket.SimulatorInfo.Port = neighbourPort; | ||
399 | OutPacket(enablesimpacket); | ||
400 | } | ||
401 | |||
402 | public AgentCircuitData RequestClientInfo() | ||
403 | { | ||
404 | AgentCircuitData agentData = new AgentCircuitData(); | ||
405 | agentData.AgentID = this.AgentId; | ||
406 | agentData.SessionID = this.SessionID; | ||
407 | agentData.SecureSessionID = this.SecureSessionID; | ||
408 | agentData.circuitcode = this.CircuitCode; | ||
409 | agentData.child = false; | ||
410 | agentData.firstname = this.firstName; | ||
411 | agentData.lastname = this.lastName; | ||
412 | |||
413 | return agentData; | ||
414 | } | ||
415 | 424 | ||
416 | #region Primitive Packet/data Sending Methods | 425 | #region Primitive Packet/data Sending Methods |
417 | 426 | ||
@@ -508,6 +517,88 @@ namespace OpenSim | |||
508 | objectData.PathTwist = primData.PathTwist; | 517 | objectData.PathTwist = primData.PathTwist; |
509 | objectData.PathTwistBegin = primData.PathTwistBegin; | 518 | objectData.PathTwistBegin = primData.PathTwistBegin; |
510 | } | 519 | } |
520 | |||
521 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) | ||
522 | { | ||
523 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
524 | terse.RegionData.RegionHandle = regionHandle; | ||
525 | terse.RegionData.TimeDilation = timeDilation; | ||
526 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
527 | terse.ObjectData[0] = this.CreatePrimImprovedBlock(localID, position, rotation); | ||
528 | |||
529 | this.OutPacket(terse); | ||
530 | } | ||
531 | |||
532 | /// <summary> | ||
533 | /// | ||
534 | /// </summary> | ||
535 | /// <param name="localID"></param> | ||
536 | /// <param name="position"></param> | ||
537 | /// <param name="rotation"></param> | ||
538 | /// <returns></returns> | ||
539 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, LLVector3 position, LLQuaternion rotation) | ||
540 | { | ||
541 | uint ID = localID; | ||
542 | byte[] bytes = new byte[60]; | ||
543 | |||
544 | int i = 0; | ||
545 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
546 | dat.TextureEntry = new byte[0]; | ||
547 | bytes[i++] = (byte)(ID % 256); | ||
548 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
549 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
550 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
551 | bytes[i++] = 0; | ||
552 | bytes[i++] = 0; | ||
553 | |||
554 | byte[] pb = position.GetBytes(); | ||
555 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
556 | i += 12; | ||
557 | ushort ac = 32767; | ||
558 | |||
559 | //vel | ||
560 | bytes[i++] = (byte)(ac % 256); | ||
561 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
562 | bytes[i++] = (byte)(ac % 256); | ||
563 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
564 | bytes[i++] = (byte)(ac % 256); | ||
565 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
566 | |||
567 | //accel | ||
568 | bytes[i++] = (byte)(ac % 256); | ||
569 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
570 | bytes[i++] = (byte)(ac % 256); | ||
571 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
572 | bytes[i++] = (byte)(ac % 256); | ||
573 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
574 | |||
575 | ushort rw, rx, ry, rz; | ||
576 | rw = (ushort)(32768 * (rotation.W + 1)); | ||
577 | rx = (ushort)(32768 * (rotation.X + 1)); | ||
578 | ry = (ushort)(32768 * (rotation.Y + 1)); | ||
579 | rz = (ushort)(32768 * (rotation.Z + 1)); | ||
580 | |||
581 | //rot | ||
582 | bytes[i++] = (byte)(rx % 256); | ||
583 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
584 | bytes[i++] = (byte)(ry % 256); | ||
585 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
586 | bytes[i++] = (byte)(rz % 256); | ||
587 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
588 | bytes[i++] = (byte)(rw % 256); | ||
589 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
590 | |||
591 | //rotation vel | ||
592 | bytes[i++] = (byte)(ac % 256); | ||
593 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
594 | bytes[i++] = (byte)(ac % 256); | ||
595 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
596 | bytes[i++] = (byte)(ac % 256); | ||
597 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
598 | |||
599 | dat.Data = bytes; | ||
600 | return dat; | ||
601 | } | ||
511 | #endregion | 602 | #endregion |
512 | 603 | ||
513 | #endregion | 604 | #endregion |