diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1110 |
1 files changed, 1104 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6c1d14a..7f7b820 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -4324,15 +4324,57 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4324 | AddLocalPacketHandler(PacketType.AgentRequestSit, HandleAgentRequestSit); | 4324 | AddLocalPacketHandler(PacketType.AgentRequestSit, HandleAgentRequestSit); |
4325 | AddLocalPacketHandler(PacketType.AgentSit, HandleAgentSit); | 4325 | AddLocalPacketHandler(PacketType.AgentSit, HandleAgentSit); |
4326 | AddLocalPacketHandler(PacketType.SoundTrigger, HandleSoundTrigger); | 4326 | AddLocalPacketHandler(PacketType.SoundTrigger, HandleSoundTrigger); |
4327 | AddLocalPacketHandler(PacketType.AvatarPickerRequest, HandleAvatarPickerRequest); | ||
4328 | AddLocalPacketHandler(PacketType.AgentDataUpdateRequest, HandleAgentDataUpdateRequest); | ||
4329 | AddLocalPacketHandler(PacketType.UserInfoRequest, HandleUserInfoRequest); | ||
4330 | AddLocalPacketHandler(PacketType.UpdateUserInfo, HandleUpdateUserInfo); | ||
4331 | AddLocalPacketHandler(PacketType.SetStartLocationRequest, HandleSetStartLocationRequest); | ||
4332 | AddLocalPacketHandler(PacketType.AgentThrottle, HandleAgentThrottle); | ||
4333 | AddLocalPacketHandler(PacketType.AgentPause, HandleAgentPause); | ||
4334 | AddLocalPacketHandler(PacketType.AgentResume, HandleAgentResume); | ||
4335 | AddLocalPacketHandler(PacketType.ForceScriptControlRelease, HandleForceScriptControlRelease); | ||
4336 | AddLocalPacketHandler(PacketType.ObjectLink, HandleObjectLink); | ||
4337 | AddLocalPacketHandler(PacketType.ObjectDelink, HandleObjectDelink); | ||
4338 | AddLocalPacketHandler(PacketType.ObjectAdd, HandleObjectAdd); | ||
4339 | AddLocalPacketHandler(PacketType.ObjectShape, HandleObjectShape); | ||
4340 | AddLocalPacketHandler(PacketType.ObjectExtraParams, HandleObjectExtraParams); | ||
4341 | AddLocalPacketHandler(PacketType.ObjectDuplicate, HandleObjectDuplicate); | ||
4342 | AddLocalPacketHandler(PacketType.RequestMultipleObjects, HandleRequestMultipleObjects); | ||
4343 | AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect); | ||
4344 | AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect); | ||
4345 | AddLocalPacketHandler(PacketType.ObjectPosition, HandleObjectPosition); | ||
4346 | AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); | ||
4347 | AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); | ||
4348 | AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate); | ||
4349 | AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage); | ||
4350 | AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab); | ||
4351 | AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate); | ||
4352 | AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab); | ||
4353 | AddLocalPacketHandler(PacketType.ObjectSpinStart, HandleObjectSpinStart); | ||
4354 | AddLocalPacketHandler(PacketType.ObjectSpinUpdate, HandleObjectSpinUpdate); | ||
4355 | AddLocalPacketHandler(PacketType.ObjectSpinStop, HandleObjectSpinStop); | ||
4356 | AddLocalPacketHandler(PacketType.ObjectDescription, HandleObjectDescription); | ||
4357 | AddLocalPacketHandler(PacketType.ObjectName, HandleObjectName); | ||
4358 | AddLocalPacketHandler(PacketType.ObjectPermissions, HandleObjectPermissions); | ||
4359 | AddLocalPacketHandler(PacketType.Undo, HandleUndo); | ||
4360 | AddLocalPacketHandler(PacketType.ObjectDuplicateOnRay, HandleObjectDuplicateOnRay); | ||
4361 | AddLocalPacketHandler(PacketType.RequestObjectPropertiesFamily, HandleRequestObjectPropertiesFamily); | ||
4362 | AddLocalPacketHandler(PacketType.ObjectIncludeInSearch, HandleObjectIncludeInSearch); | ||
4363 | AddLocalPacketHandler(PacketType.ScriptAnswerYes, HandleScriptAnswerYes); | ||
4364 | AddLocalPacketHandler(PacketType.ObjectClickAction, HandleObjectClickAction); | ||
4365 | AddLocalPacketHandler(PacketType.ObjectMaterial, HandleObjectMaterial); | ||
4327 | //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); | 4366 | //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); |
4328 | //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); | 4367 | //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); |
4329 | //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); | 4368 | //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); |
4330 | //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); | 4369 | //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); |
4370 | |||
4331 | 4371 | ||
4332 | } | 4372 | } |
4333 | 4373 | ||
4334 | #region Packet Handlers | 4374 | #region Packet Handlers |
4335 | 4375 | ||
4376 | #region Scene/Avatar | ||
4377 | |||
4336 | private bool HandleAgentUpdate(IClientAPI sener, Packet Pack) | 4378 | private bool HandleAgentUpdate(IClientAPI sener, Packet Pack) |
4337 | { | 4379 | { |
4338 | if (OnAgentUpdate != null) | 4380 | if (OnAgentUpdate != null) |
@@ -5260,6 +5302,1041 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5260 | return true; | 5302 | return true; |
5261 | } | 5303 | } |
5262 | 5304 | ||
5305 | private bool HandleAvatarPickerRequest(IClientAPI sender, Packet Pack) | ||
5306 | { | ||
5307 | AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; | ||
5308 | |||
5309 | #region Packet Session and User Check | ||
5310 | if (m_checkPackets) | ||
5311 | { | ||
5312 | if (avRequestQuery.AgentData.SessionID != SessionId || | ||
5313 | avRequestQuery.AgentData.AgentID != AgentId) | ||
5314 | return true; | ||
5315 | } | ||
5316 | #endregion | ||
5317 | |||
5318 | AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData; | ||
5319 | AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data; | ||
5320 | //m_log.Debug("Agent Sends:" + Utils.BytesToString(querydata.Name)); | ||
5321 | |||
5322 | AvatarPickerRequest handlerAvatarPickerRequest = OnAvatarPickerRequest; | ||
5323 | if (handlerAvatarPickerRequest != null) | ||
5324 | { | ||
5325 | handlerAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID, | ||
5326 | Utils.BytesToString(querydata.Name)); | ||
5327 | } | ||
5328 | return true; | ||
5329 | } | ||
5330 | |||
5331 | private bool HandleAgentDataUpdateRequest(IClientAPI sender, Packet Pack) | ||
5332 | { | ||
5333 | AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack; | ||
5334 | |||
5335 | #region Packet Session and User Check | ||
5336 | if (m_checkPackets) | ||
5337 | { | ||
5338 | if (avRequestDataUpdatePacket.AgentData.SessionID != SessionId || | ||
5339 | avRequestDataUpdatePacket.AgentData.AgentID != AgentId) | ||
5340 | return true; | ||
5341 | } | ||
5342 | #endregion | ||
5343 | |||
5344 | FetchInventory handlerAgentDataUpdateRequest = OnAgentDataUpdateRequest; | ||
5345 | |||
5346 | if (handlerAgentDataUpdateRequest != null) | ||
5347 | { | ||
5348 | handlerAgentDataUpdateRequest(this, avRequestDataUpdatePacket.AgentData.AgentID, avRequestDataUpdatePacket.AgentData.SessionID); | ||
5349 | } | ||
5350 | |||
5351 | return true; | ||
5352 | } | ||
5353 | |||
5354 | private bool HandleUserInfoRequest(IClientAPI sender, Packet Pack) | ||
5355 | { | ||
5356 | UserInfoRequest handlerUserInfoRequest = OnUserInfoRequest; | ||
5357 | if (handlerUserInfoRequest != null) | ||
5358 | { | ||
5359 | handlerUserInfoRequest(this); | ||
5360 | } | ||
5361 | else | ||
5362 | { | ||
5363 | SendUserInfoReply(false, true, ""); | ||
5364 | } | ||
5365 | return true; | ||
5366 | |||
5367 | } | ||
5368 | |||
5369 | private bool HandleUpdateUserInfo(IClientAPI sender, Packet Pack) | ||
5370 | { | ||
5371 | UpdateUserInfoPacket updateUserInfo = (UpdateUserInfoPacket)Pack; | ||
5372 | |||
5373 | #region Packet Session and User Check | ||
5374 | if (m_checkPackets) | ||
5375 | { | ||
5376 | if (updateUserInfo.AgentData.SessionID != SessionId || | ||
5377 | updateUserInfo.AgentData.AgentID != AgentId) | ||
5378 | return true; | ||
5379 | } | ||
5380 | #endregion | ||
5381 | |||
5382 | UpdateUserInfo handlerUpdateUserInfo = OnUpdateUserInfo; | ||
5383 | if (handlerUpdateUserInfo != null) | ||
5384 | { | ||
5385 | bool visible = true; | ||
5386 | string DirectoryVisibility = | ||
5387 | Utils.BytesToString(updateUserInfo.UserData.DirectoryVisibility); | ||
5388 | if (DirectoryVisibility == "hidden") | ||
5389 | visible = false; | ||
5390 | |||
5391 | handlerUpdateUserInfo( | ||
5392 | updateUserInfo.UserData.IMViaEMail, | ||
5393 | visible, this); | ||
5394 | } | ||
5395 | return true; | ||
5396 | } | ||
5397 | |||
5398 | private bool HandleSetStartLocationRequest(IClientAPI sender, Packet Pack) | ||
5399 | { | ||
5400 | SetStartLocationRequestPacket avSetStartLocationRequestPacket = (SetStartLocationRequestPacket)Pack; | ||
5401 | |||
5402 | #region Packet Session and User Check | ||
5403 | if (m_checkPackets) | ||
5404 | { | ||
5405 | if (avSetStartLocationRequestPacket.AgentData.SessionID != SessionId || | ||
5406 | avSetStartLocationRequestPacket.AgentData.AgentID != AgentId) | ||
5407 | return true; | ||
5408 | } | ||
5409 | #endregion | ||
5410 | |||
5411 | if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId) | ||
5412 | { | ||
5413 | TeleportLocationRequest handlerSetStartLocationRequest = OnSetStartLocationRequest; | ||
5414 | if (handlerSetStartLocationRequest != null) | ||
5415 | { | ||
5416 | handlerSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos, | ||
5417 | avSetStartLocationRequestPacket.StartLocationData.LocationLookAt, | ||
5418 | avSetStartLocationRequestPacket.StartLocationData.LocationID); | ||
5419 | } | ||
5420 | } | ||
5421 | return true; | ||
5422 | } | ||
5423 | |||
5424 | private bool HandleAgentThrottle(IClientAPI sender, Packet Pack) | ||
5425 | { | ||
5426 | AgentThrottlePacket atpack = (AgentThrottlePacket)Pack; | ||
5427 | |||
5428 | #region Packet Session and User Check | ||
5429 | if (m_checkPackets) | ||
5430 | { | ||
5431 | if (atpack.AgentData.SessionID != SessionId || | ||
5432 | atpack.AgentData.AgentID != AgentId) | ||
5433 | return true; | ||
5434 | } | ||
5435 | #endregion | ||
5436 | |||
5437 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); | ||
5438 | return true; | ||
5439 | } | ||
5440 | |||
5441 | private bool HandleAgentPause(IClientAPI sender, Packet Pack) | ||
5442 | { | ||
5443 | m_udpClient.IsPaused = true; | ||
5444 | return true; | ||
5445 | } | ||
5446 | |||
5447 | private bool HandleAgentResume(IClientAPI sender, Packet Pack) | ||
5448 | { | ||
5449 | m_udpClient.IsPaused = false; | ||
5450 | SendStartPingCheck(m_udpClient.CurrentPingSequence++); | ||
5451 | return true; | ||
5452 | } | ||
5453 | |||
5454 | private bool HandleForceScriptControlRelease(IClientAPI sender, Packet Pack) | ||
5455 | { | ||
5456 | ForceReleaseControls handlerForceReleaseControls = OnForceReleaseControls; | ||
5457 | if (handlerForceReleaseControls != null) | ||
5458 | { | ||
5459 | handlerForceReleaseControls(this, AgentId); | ||
5460 | } | ||
5461 | return true; | ||
5462 | } | ||
5463 | |||
5464 | #endregion Scene/Avatar | ||
5465 | |||
5466 | #region Objects/m_sceneObjects | ||
5467 | |||
5468 | private bool HandleObjectLink(IClientAPI sender, Packet Pack) | ||
5469 | { | ||
5470 | ObjectLinkPacket link = (ObjectLinkPacket)Pack; | ||
5471 | |||
5472 | #region Packet Session and User Check | ||
5473 | if (m_checkPackets) | ||
5474 | { | ||
5475 | if (link.AgentData.SessionID != SessionId || | ||
5476 | link.AgentData.AgentID != AgentId) | ||
5477 | return true; | ||
5478 | } | ||
5479 | #endregion | ||
5480 | |||
5481 | uint parentprimid = 0; | ||
5482 | List<uint> childrenprims = new List<uint>(); | ||
5483 | if (link.ObjectData.Length > 1) | ||
5484 | { | ||
5485 | parentprimid = link.ObjectData[0].ObjectLocalID; | ||
5486 | |||
5487 | for (int i = 1; i < link.ObjectData.Length; i++) | ||
5488 | { | ||
5489 | childrenprims.Add(link.ObjectData[i].ObjectLocalID); | ||
5490 | } | ||
5491 | } | ||
5492 | LinkObjects handlerLinkObjects = OnLinkObjects; | ||
5493 | if (handlerLinkObjects != null) | ||
5494 | { | ||
5495 | handlerLinkObjects(this, parentprimid, childrenprims); | ||
5496 | } | ||
5497 | return true; | ||
5498 | } | ||
5499 | |||
5500 | private bool HandleObjectDelink(IClientAPI sender, Packet Pack) | ||
5501 | { | ||
5502 | ObjectDelinkPacket delink = (ObjectDelinkPacket)Pack; | ||
5503 | |||
5504 | #region Packet Session and User Check | ||
5505 | if (m_checkPackets) | ||
5506 | { | ||
5507 | if (delink.AgentData.SessionID != SessionId || | ||
5508 | delink.AgentData.AgentID != AgentId) | ||
5509 | return true; | ||
5510 | } | ||
5511 | #endregion | ||
5512 | |||
5513 | // It appears the prim at index 0 is not always the root prim (for | ||
5514 | // instance, when one prim of a link set has been edited independently | ||
5515 | // of the others). Therefore, we'll pass all the ids onto the delink | ||
5516 | // method for it to decide which is the root. | ||
5517 | List<uint> prims = new List<uint>(); | ||
5518 | for (int i = 0; i < delink.ObjectData.Length; i++) | ||
5519 | { | ||
5520 | prims.Add(delink.ObjectData[i].ObjectLocalID); | ||
5521 | } | ||
5522 | DelinkObjects handlerDelinkObjects = OnDelinkObjects; | ||
5523 | if (handlerDelinkObjects != null) | ||
5524 | { | ||
5525 | handlerDelinkObjects(prims); | ||
5526 | } | ||
5527 | |||
5528 | return true; | ||
5529 | } | ||
5530 | |||
5531 | private bool HandleObjectAdd(IClientAPI sender, Packet Pack) | ||
5532 | { | ||
5533 | if (OnAddPrim != null) | ||
5534 | { | ||
5535 | ObjectAddPacket addPacket = (ObjectAddPacket)Pack; | ||
5536 | |||
5537 | #region Packet Session and User Check | ||
5538 | if (m_checkPackets) | ||
5539 | { | ||
5540 | if (addPacket.AgentData.SessionID != SessionId || | ||
5541 | addPacket.AgentData.AgentID != AgentId) | ||
5542 | return true; | ||
5543 | } | ||
5544 | #endregion | ||
5545 | |||
5546 | PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); | ||
5547 | // m_log.Info("[REZData]: " + addPacket.ToString()); | ||
5548 | //BypassRaycast: 1 | ||
5549 | //RayStart: <69.79469, 158.2652, 98.40343> | ||
5550 | //RayEnd: <61.97724, 141.995, 92.58341> | ||
5551 | //RayTargetID: 00000000-0000-0000-0000-000000000000 | ||
5552 | |||
5553 | //Check to see if adding the prim is allowed; useful for any module wanting to restrict the | ||
5554 | //object from rezing initially | ||
5555 | |||
5556 | AddNewPrim handlerAddPrim = OnAddPrim; | ||
5557 | if (handlerAddPrim != null) | ||
5558 | handlerAddPrim(AgentId, ActiveGroupId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection); | ||
5559 | } | ||
5560 | return true; | ||
5561 | } | ||
5562 | |||
5563 | private bool HandleObjectShape(IClientAPI sender, Packet Pack) | ||
5564 | { | ||
5565 | ObjectShapePacket shapePacket = (ObjectShapePacket)Pack; | ||
5566 | |||
5567 | #region Packet Session and User Check | ||
5568 | if (m_checkPackets) | ||
5569 | { | ||
5570 | if (shapePacket.AgentData.SessionID != SessionId || | ||
5571 | shapePacket.AgentData.AgentID != AgentId) | ||
5572 | return true; | ||
5573 | } | ||
5574 | #endregion | ||
5575 | |||
5576 | UpdateShape handlerUpdatePrimShape = null; | ||
5577 | for (int i = 0; i < shapePacket.ObjectData.Length; i++) | ||
5578 | { | ||
5579 | handlerUpdatePrimShape = OnUpdatePrimShape; | ||
5580 | if (handlerUpdatePrimShape != null) | ||
5581 | { | ||
5582 | UpdateShapeArgs shapeData = new UpdateShapeArgs(); | ||
5583 | shapeData.ObjectLocalID = shapePacket.ObjectData[i].ObjectLocalID; | ||
5584 | shapeData.PathBegin = shapePacket.ObjectData[i].PathBegin; | ||
5585 | shapeData.PathCurve = shapePacket.ObjectData[i].PathCurve; | ||
5586 | shapeData.PathEnd = shapePacket.ObjectData[i].PathEnd; | ||
5587 | shapeData.PathRadiusOffset = shapePacket.ObjectData[i].PathRadiusOffset; | ||
5588 | shapeData.PathRevolutions = shapePacket.ObjectData[i].PathRevolutions; | ||
5589 | shapeData.PathScaleX = shapePacket.ObjectData[i].PathScaleX; | ||
5590 | shapeData.PathScaleY = shapePacket.ObjectData[i].PathScaleY; | ||
5591 | shapeData.PathShearX = shapePacket.ObjectData[i].PathShearX; | ||
5592 | shapeData.PathShearY = shapePacket.ObjectData[i].PathShearY; | ||
5593 | shapeData.PathSkew = shapePacket.ObjectData[i].PathSkew; | ||
5594 | shapeData.PathTaperX = shapePacket.ObjectData[i].PathTaperX; | ||
5595 | shapeData.PathTaperY = shapePacket.ObjectData[i].PathTaperY; | ||
5596 | shapeData.PathTwist = shapePacket.ObjectData[i].PathTwist; | ||
5597 | shapeData.PathTwistBegin = shapePacket.ObjectData[i].PathTwistBegin; | ||
5598 | shapeData.ProfileBegin = shapePacket.ObjectData[i].ProfileBegin; | ||
5599 | shapeData.ProfileCurve = shapePacket.ObjectData[i].ProfileCurve; | ||
5600 | shapeData.ProfileEnd = shapePacket.ObjectData[i].ProfileEnd; | ||
5601 | shapeData.ProfileHollow = shapePacket.ObjectData[i].ProfileHollow; | ||
5602 | |||
5603 | handlerUpdatePrimShape(m_agentId, shapePacket.ObjectData[i].ObjectLocalID, | ||
5604 | shapeData); | ||
5605 | } | ||
5606 | } | ||
5607 | return true; | ||
5608 | } | ||
5609 | |||
5610 | private bool HandleObjectExtraParams(IClientAPI sender, Packet Pack) | ||
5611 | { | ||
5612 | ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack; | ||
5613 | |||
5614 | #region Packet Session and User Check | ||
5615 | if (m_checkPackets) | ||
5616 | { | ||
5617 | if (extraPar.AgentData.SessionID != SessionId || | ||
5618 | extraPar.AgentData.AgentID != AgentId) | ||
5619 | return true; | ||
5620 | } | ||
5621 | #endregion | ||
5622 | |||
5623 | ObjectExtraParams handlerUpdateExtraParams = OnUpdateExtraParams; | ||
5624 | if (handlerUpdateExtraParams != null) | ||
5625 | { | ||
5626 | for (int i = 0; i < extraPar.ObjectData.Length; i++) | ||
5627 | { | ||
5628 | handlerUpdateExtraParams(m_agentId, extraPar.ObjectData[i].ObjectLocalID, | ||
5629 | extraPar.ObjectData[i].ParamType, | ||
5630 | extraPar.ObjectData[i].ParamInUse, extraPar.ObjectData[i].ParamData); | ||
5631 | } | ||
5632 | } | ||
5633 | return true; | ||
5634 | } | ||
5635 | |||
5636 | private bool HandleObjectDuplicate(IClientAPI sender, Packet Pack) | ||
5637 | { | ||
5638 | ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; | ||
5639 | |||
5640 | #region Packet Session and User Check | ||
5641 | if (m_checkPackets) | ||
5642 | { | ||
5643 | if (dupe.AgentData.SessionID != SessionId || | ||
5644 | dupe.AgentData.AgentID != AgentId) | ||
5645 | return true; | ||
5646 | } | ||
5647 | #endregion | ||
5648 | |||
5649 | ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData; | ||
5650 | |||
5651 | ObjectDuplicate handlerObjectDuplicate = null; | ||
5652 | |||
5653 | for (int i = 0; i < dupe.ObjectData.Length; i++) | ||
5654 | { | ||
5655 | handlerObjectDuplicate = OnObjectDuplicate; | ||
5656 | if (handlerObjectDuplicate != null) | ||
5657 | { | ||
5658 | handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, | ||
5659 | dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID, | ||
5660 | AgentandGroupData.GroupID); | ||
5661 | } | ||
5662 | } | ||
5663 | |||
5664 | return true; | ||
5665 | } | ||
5666 | |||
5667 | private bool HandleRequestMultipleObjects(IClientAPI sender, Packet Pack) | ||
5668 | { | ||
5669 | RequestMultipleObjectsPacket incomingRequest = (RequestMultipleObjectsPacket)Pack; | ||
5670 | |||
5671 | #region Packet Session and User Check | ||
5672 | if (m_checkPackets) | ||
5673 | { | ||
5674 | if (incomingRequest.AgentData.SessionID != SessionId || | ||
5675 | incomingRequest.AgentData.AgentID != AgentId) | ||
5676 | return true; | ||
5677 | } | ||
5678 | #endregion | ||
5679 | |||
5680 | ObjectRequest handlerObjectRequest = null; | ||
5681 | |||
5682 | for (int i = 0; i < incomingRequest.ObjectData.Length; i++) | ||
5683 | { | ||
5684 | handlerObjectRequest = OnObjectRequest; | ||
5685 | if (handlerObjectRequest != null) | ||
5686 | { | ||
5687 | handlerObjectRequest(incomingRequest.ObjectData[i].ID, this); | ||
5688 | } | ||
5689 | } | ||
5690 | return true; | ||
5691 | } | ||
5692 | |||
5693 | private bool HandleObjectSelect(IClientAPI sender, Packet Pack) | ||
5694 | { | ||
5695 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | ||
5696 | |||
5697 | #region Packet Session and User Check | ||
5698 | if (m_checkPackets) | ||
5699 | { | ||
5700 | if (incomingselect.AgentData.SessionID != SessionId || | ||
5701 | incomingselect.AgentData.AgentID != AgentId) | ||
5702 | return true; | ||
5703 | } | ||
5704 | #endregion | ||
5705 | |||
5706 | ObjectSelect handlerObjectSelect = null; | ||
5707 | |||
5708 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | ||
5709 | { | ||
5710 | handlerObjectSelect = OnObjectSelect; | ||
5711 | if (handlerObjectSelect != null) | ||
5712 | { | ||
5713 | handlerObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this); | ||
5714 | } | ||
5715 | } | ||
5716 | return true; | ||
5717 | } | ||
5718 | |||
5719 | private bool HandleObjectDeselect(IClientAPI sender, Packet Pack) | ||
5720 | { | ||
5721 | ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; | ||
5722 | |||
5723 | #region Packet Session and User Check | ||
5724 | if (m_checkPackets) | ||
5725 | { | ||
5726 | if (incomingdeselect.AgentData.SessionID != SessionId || | ||
5727 | incomingdeselect.AgentData.AgentID != AgentId) | ||
5728 | return true; | ||
5729 | } | ||
5730 | #endregion | ||
5731 | |||
5732 | ObjectDeselect handlerObjectDeselect = null; | ||
5733 | |||
5734 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) | ||
5735 | { | ||
5736 | handlerObjectDeselect = OnObjectDeselect; | ||
5737 | if (handlerObjectDeselect != null) | ||
5738 | { | ||
5739 | OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this); | ||
5740 | } | ||
5741 | } | ||
5742 | return true; | ||
5743 | } | ||
5744 | |||
5745 | private bool HandleObjectPosition(IClientAPI sender, Packet Pack) | ||
5746 | { | ||
5747 | // DEPRECATED: but till libsecondlife removes it, people will use it | ||
5748 | ObjectPositionPacket position = (ObjectPositionPacket)Pack; | ||
5749 | |||
5750 | #region Packet Session and User Check | ||
5751 | if (m_checkPackets) | ||
5752 | { | ||
5753 | if (position.AgentData.SessionID != SessionId || | ||
5754 | position.AgentData.AgentID != AgentId) | ||
5755 | return true; | ||
5756 | } | ||
5757 | #endregion | ||
5758 | |||
5759 | |||
5760 | for (int i = 0; i < position.ObjectData.Length; i++) | ||
5761 | { | ||
5762 | UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; | ||
5763 | if (handlerUpdateVector != null) | ||
5764 | handlerUpdateVector(position.ObjectData[i].ObjectLocalID, position.ObjectData[i].Position, this); | ||
5765 | } | ||
5766 | |||
5767 | return true; | ||
5768 | } | ||
5769 | |||
5770 | private bool HandleObjectScale(IClientAPI sender, Packet Pack) | ||
5771 | { | ||
5772 | // DEPRECATED: but till libsecondlife removes it, people will use it | ||
5773 | ObjectScalePacket scale = (ObjectScalePacket)Pack; | ||
5774 | |||
5775 | #region Packet Session and User Check | ||
5776 | if (m_checkPackets) | ||
5777 | { | ||
5778 | if (scale.AgentData.SessionID != SessionId || | ||
5779 | scale.AgentData.AgentID != AgentId) | ||
5780 | return true; | ||
5781 | } | ||
5782 | #endregion | ||
5783 | |||
5784 | for (int i = 0; i < scale.ObjectData.Length; i++) | ||
5785 | { | ||
5786 | UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | ||
5787 | if (handlerUpdatePrimGroupScale != null) | ||
5788 | handlerUpdatePrimGroupScale(scale.ObjectData[i].ObjectLocalID, scale.ObjectData[i].Scale, this); | ||
5789 | } | ||
5790 | |||
5791 | return true; | ||
5792 | } | ||
5793 | |||
5794 | private bool HandleObjectRotation(IClientAPI sender, Packet Pack) | ||
5795 | { | ||
5796 | // DEPRECATED: but till libsecondlife removes it, people will use it | ||
5797 | ObjectRotationPacket rotation = (ObjectRotationPacket)Pack; | ||
5798 | |||
5799 | #region Packet Session and User Check | ||
5800 | if (m_checkPackets) | ||
5801 | { | ||
5802 | if (rotation.AgentData.SessionID != SessionId || | ||
5803 | rotation.AgentData.AgentID != AgentId) | ||
5804 | return true; | ||
5805 | } | ||
5806 | #endregion | ||
5807 | |||
5808 | for (int i = 0; i < rotation.ObjectData.Length; i++) | ||
5809 | { | ||
5810 | UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; | ||
5811 | if (handlerUpdatePrimRotation != null) | ||
5812 | handlerUpdatePrimRotation(rotation.ObjectData[i].ObjectLocalID, rotation.ObjectData[i].Rotation, this); | ||
5813 | } | ||
5814 | |||
5815 | return true; | ||
5816 | } | ||
5817 | |||
5818 | private bool HandleObjectFlagUpdate(IClientAPI sender, Packet Pack) | ||
5819 | { | ||
5820 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; | ||
5821 | |||
5822 | #region Packet Session and User Check | ||
5823 | if (m_checkPackets) | ||
5824 | { | ||
5825 | if (flags.AgentData.SessionID != SessionId || | ||
5826 | flags.AgentData.AgentID != AgentId) | ||
5827 | return true; | ||
5828 | } | ||
5829 | #endregion | ||
5830 | |||
5831 | UpdatePrimFlags handlerUpdatePrimFlags = OnUpdatePrimFlags; | ||
5832 | |||
5833 | if (handlerUpdatePrimFlags != null) | ||
5834 | { | ||
5835 | byte[] data = Pack.ToBytes(); | ||
5836 | // 46,47,48 are special positions within the packet | ||
5837 | // This may change so perhaps we need a better way | ||
5838 | // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) | ||
5839 | bool UsePhysics = (data[46] != 0) ? true : false; | ||
5840 | bool IsTemporary = (data[47] != 0) ? true : false; | ||
5841 | bool IsPhantom = (data[48] != 0) ? true : false; | ||
5842 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); | ||
5843 | } | ||
5844 | return true; | ||
5845 | } | ||
5846 | |||
5847 | private bool HandleObjectImage(IClientAPI sender, Packet Pack) | ||
5848 | { | ||
5849 | ObjectImagePacket imagePack = (ObjectImagePacket)Pack; | ||
5850 | |||
5851 | UpdatePrimTexture handlerUpdatePrimTexture = null; | ||
5852 | for (int i = 0; i < imagePack.ObjectData.Length; i++) | ||
5853 | { | ||
5854 | handlerUpdatePrimTexture = OnUpdatePrimTexture; | ||
5855 | if (handlerUpdatePrimTexture != null) | ||
5856 | { | ||
5857 | handlerUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, | ||
5858 | imagePack.ObjectData[i].TextureEntry, this); | ||
5859 | } | ||
5860 | } | ||
5861 | return true; | ||
5862 | } | ||
5863 | |||
5864 | private bool HandleObjectGrab(IClientAPI sender, Packet Pack) | ||
5865 | { | ||
5866 | ObjectGrabPacket grab = (ObjectGrabPacket)Pack; | ||
5867 | |||
5868 | #region Packet Session and User Check | ||
5869 | if (m_checkPackets) | ||
5870 | { | ||
5871 | if (grab.AgentData.SessionID != SessionId || | ||
5872 | grab.AgentData.AgentID != AgentId) | ||
5873 | return true; | ||
5874 | } | ||
5875 | #endregion | ||
5876 | |||
5877 | GrabObject handlerGrabObject = OnGrabObject; | ||
5878 | |||
5879 | if (handlerGrabObject != null) | ||
5880 | { | ||
5881 | List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>(); | ||
5882 | if ((grab.SurfaceInfo != null) && (grab.SurfaceInfo.Length > 0)) | ||
5883 | { | ||
5884 | foreach (ObjectGrabPacket.SurfaceInfoBlock surfaceInfo in grab.SurfaceInfo) | ||
5885 | { | ||
5886 | SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs(); | ||
5887 | arg.Binormal = surfaceInfo.Binormal; | ||
5888 | arg.FaceIndex = surfaceInfo.FaceIndex; | ||
5889 | arg.Normal = surfaceInfo.Normal; | ||
5890 | arg.Position = surfaceInfo.Position; | ||
5891 | arg.STCoord = surfaceInfo.STCoord; | ||
5892 | arg.UVCoord = surfaceInfo.UVCoord; | ||
5893 | touchArgs.Add(arg); | ||
5894 | } | ||
5895 | } | ||
5896 | handlerGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this, touchArgs); | ||
5897 | } | ||
5898 | return true; | ||
5899 | } | ||
5900 | |||
5901 | private bool HandleObjectGrabUpdate(IClientAPI sender, Packet Pack) | ||
5902 | { | ||
5903 | ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack; | ||
5904 | |||
5905 | #region Packet Session and User Check | ||
5906 | if (m_checkPackets) | ||
5907 | { | ||
5908 | if (grabUpdate.AgentData.SessionID != SessionId || | ||
5909 | grabUpdate.AgentData.AgentID != AgentId) | ||
5910 | return true; | ||
5911 | } | ||
5912 | #endregion | ||
5913 | |||
5914 | MoveObject handlerGrabUpdate = OnGrabUpdate; | ||
5915 | |||
5916 | if (handlerGrabUpdate != null) | ||
5917 | { | ||
5918 | List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>(); | ||
5919 | if ((grabUpdate.SurfaceInfo != null) && (grabUpdate.SurfaceInfo.Length > 0)) | ||
5920 | { | ||
5921 | foreach (ObjectGrabUpdatePacket.SurfaceInfoBlock surfaceInfo in grabUpdate.SurfaceInfo) | ||
5922 | { | ||
5923 | SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs(); | ||
5924 | arg.Binormal = surfaceInfo.Binormal; | ||
5925 | arg.FaceIndex = surfaceInfo.FaceIndex; | ||
5926 | arg.Normal = surfaceInfo.Normal; | ||
5927 | arg.Position = surfaceInfo.Position; | ||
5928 | arg.STCoord = surfaceInfo.STCoord; | ||
5929 | arg.UVCoord = surfaceInfo.UVCoord; | ||
5930 | touchArgs.Add(arg); | ||
5931 | } | ||
5932 | } | ||
5933 | handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, | ||
5934 | grabUpdate.ObjectData.GrabPosition, this, touchArgs); | ||
5935 | } | ||
5936 | return true; | ||
5937 | } | ||
5938 | |||
5939 | private bool HandleObjectDeGrab(IClientAPI sender, Packet Pack) | ||
5940 | { | ||
5941 | ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack; | ||
5942 | |||
5943 | #region Packet Session and User Check | ||
5944 | if (m_checkPackets) | ||
5945 | { | ||
5946 | if (deGrab.AgentData.SessionID != SessionId || | ||
5947 | deGrab.AgentData.AgentID != AgentId) | ||
5948 | return true; | ||
5949 | } | ||
5950 | #endregion | ||
5951 | |||
5952 | DeGrabObject handlerDeGrabObject = OnDeGrabObject; | ||
5953 | if (handlerDeGrabObject != null) | ||
5954 | { | ||
5955 | List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>(); | ||
5956 | if ((deGrab.SurfaceInfo != null) && (deGrab.SurfaceInfo.Length > 0)) | ||
5957 | { | ||
5958 | foreach (ObjectDeGrabPacket.SurfaceInfoBlock surfaceInfo in deGrab.SurfaceInfo) | ||
5959 | { | ||
5960 | SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs(); | ||
5961 | arg.Binormal = surfaceInfo.Binormal; | ||
5962 | arg.FaceIndex = surfaceInfo.FaceIndex; | ||
5963 | arg.Normal = surfaceInfo.Normal; | ||
5964 | arg.Position = surfaceInfo.Position; | ||
5965 | arg.STCoord = surfaceInfo.STCoord; | ||
5966 | arg.UVCoord = surfaceInfo.UVCoord; | ||
5967 | touchArgs.Add(arg); | ||
5968 | } | ||
5969 | } | ||
5970 | handlerDeGrabObject(deGrab.ObjectData.LocalID, this, touchArgs); | ||
5971 | } | ||
5972 | return true; | ||
5973 | } | ||
5974 | |||
5975 | private bool HandleObjectSpinStart(IClientAPI sender, Packet Pack) | ||
5976 | { | ||
5977 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinStart packet"); | ||
5978 | ObjectSpinStartPacket spinStart = (ObjectSpinStartPacket)Pack; | ||
5979 | |||
5980 | #region Packet Session and User Check | ||
5981 | if (m_checkPackets) | ||
5982 | { | ||
5983 | if (spinStart.AgentData.SessionID != SessionId || | ||
5984 | spinStart.AgentData.AgentID != AgentId) | ||
5985 | return true; | ||
5986 | } | ||
5987 | #endregion | ||
5988 | |||
5989 | SpinStart handlerSpinStart = OnSpinStart; | ||
5990 | if (handlerSpinStart != null) | ||
5991 | { | ||
5992 | handlerSpinStart(spinStart.ObjectData.ObjectID, this); | ||
5993 | } | ||
5994 | return true; | ||
5995 | } | ||
5996 | |||
5997 | private bool HandleObjectSpinUpdate(IClientAPI sender, Packet Pack) | ||
5998 | { | ||
5999 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinUpdate packet"); | ||
6000 | ObjectSpinUpdatePacket spinUpdate = (ObjectSpinUpdatePacket)Pack; | ||
6001 | |||
6002 | #region Packet Session and User Check | ||
6003 | if (m_checkPackets) | ||
6004 | { | ||
6005 | if (spinUpdate.AgentData.SessionID != SessionId || | ||
6006 | spinUpdate.AgentData.AgentID != AgentId) | ||
6007 | return true; | ||
6008 | } | ||
6009 | #endregion | ||
6010 | |||
6011 | Vector3 axis; | ||
6012 | float angle; | ||
6013 | spinUpdate.ObjectData.Rotation.GetAxisAngle(out axis, out angle); | ||
6014 | //m_log.Warn("[CLIENT]: ObjectSpinUpdate packet rot axis:" + axis + " angle:" + angle); | ||
6015 | |||
6016 | SpinObject handlerSpinUpdate = OnSpinUpdate; | ||
6017 | if (handlerSpinUpdate != null) | ||
6018 | { | ||
6019 | handlerSpinUpdate(spinUpdate.ObjectData.ObjectID, spinUpdate.ObjectData.Rotation, this); | ||
6020 | } | ||
6021 | return true; | ||
6022 | } | ||
6023 | |||
6024 | private bool HandleObjectSpinStop(IClientAPI sender, Packet Pack) | ||
6025 | { | ||
6026 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); | ||
6027 | ObjectSpinStopPacket spinStop = (ObjectSpinStopPacket)Pack; | ||
6028 | |||
6029 | #region Packet Session and User Check | ||
6030 | if (m_checkPackets) | ||
6031 | { | ||
6032 | if (spinStop.AgentData.SessionID != SessionId || | ||
6033 | spinStop.AgentData.AgentID != AgentId) | ||
6034 | return true; | ||
6035 | } | ||
6036 | #endregion | ||
6037 | |||
6038 | SpinStop handlerSpinStop = OnSpinStop; | ||
6039 | if (handlerSpinStop != null) | ||
6040 | { | ||
6041 | handlerSpinStop(spinStop.ObjectData.ObjectID, this); | ||
6042 | } | ||
6043 | return true; | ||
6044 | } | ||
6045 | |||
6046 | private bool HandleObjectDescription(IClientAPI sender, Packet Pack) | ||
6047 | { | ||
6048 | ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; | ||
6049 | |||
6050 | #region Packet Session and User Check | ||
6051 | if (m_checkPackets) | ||
6052 | { | ||
6053 | if (objDes.AgentData.SessionID != SessionId || | ||
6054 | objDes.AgentData.AgentID != AgentId) | ||
6055 | return true; | ||
6056 | } | ||
6057 | #endregion | ||
6058 | |||
6059 | GenericCall7 handlerObjectDescription = null; | ||
6060 | |||
6061 | for (int i = 0; i < objDes.ObjectData.Length; i++) | ||
6062 | { | ||
6063 | handlerObjectDescription = OnObjectDescription; | ||
6064 | if (handlerObjectDescription != null) | ||
6065 | { | ||
6066 | handlerObjectDescription(this, objDes.ObjectData[i].LocalID, | ||
6067 | Util.FieldToString(objDes.ObjectData[i].Description)); | ||
6068 | } | ||
6069 | } | ||
6070 | return true; | ||
6071 | } | ||
6072 | |||
6073 | private bool HandleObjectName(IClientAPI sender, Packet Pack) | ||
6074 | { | ||
6075 | ObjectNamePacket objName = (ObjectNamePacket)Pack; | ||
6076 | |||
6077 | #region Packet Session and User Check | ||
6078 | if (m_checkPackets) | ||
6079 | { | ||
6080 | if (objName.AgentData.SessionID != SessionId || | ||
6081 | objName.AgentData.AgentID != AgentId) | ||
6082 | return true; | ||
6083 | } | ||
6084 | #endregion | ||
6085 | |||
6086 | GenericCall7 handlerObjectName = null; | ||
6087 | for (int i = 0; i < objName.ObjectData.Length; i++) | ||
6088 | { | ||
6089 | handlerObjectName = OnObjectName; | ||
6090 | if (handlerObjectName != null) | ||
6091 | { | ||
6092 | handlerObjectName(this, objName.ObjectData[i].LocalID, | ||
6093 | Util.FieldToString(objName.ObjectData[i].Name)); | ||
6094 | } | ||
6095 | } | ||
6096 | return true; | ||
6097 | } | ||
6098 | |||
6099 | private bool HandleObjectPermissions(IClientAPI sender, Packet Pack) | ||
6100 | { | ||
6101 | if (OnObjectPermissions != null) | ||
6102 | { | ||
6103 | ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack; | ||
6104 | |||
6105 | #region Packet Session and User Check | ||
6106 | if (m_checkPackets) | ||
6107 | { | ||
6108 | if (newobjPerms.AgentData.SessionID != SessionId || | ||
6109 | newobjPerms.AgentData.AgentID != AgentId) | ||
6110 | return true; | ||
6111 | } | ||
6112 | #endregion | ||
6113 | |||
6114 | UUID AgentID = newobjPerms.AgentData.AgentID; | ||
6115 | UUID SessionID = newobjPerms.AgentData.SessionID; | ||
6116 | |||
6117 | ObjectPermissions handlerObjectPermissions = null; | ||
6118 | |||
6119 | for (int i = 0; i < newobjPerms.ObjectData.Length; i++) | ||
6120 | { | ||
6121 | ObjectPermissionsPacket.ObjectDataBlock permChanges = newobjPerms.ObjectData[i]; | ||
6122 | |||
6123 | byte field = permChanges.Field; | ||
6124 | uint localID = permChanges.ObjectLocalID; | ||
6125 | uint mask = permChanges.Mask; | ||
6126 | byte set = permChanges.Set; | ||
6127 | |||
6128 | handlerObjectPermissions = OnObjectPermissions; | ||
6129 | |||
6130 | if (handlerObjectPermissions != null) | ||
6131 | handlerObjectPermissions(this, AgentID, SessionID, field, localID, mask, set); | ||
6132 | } | ||
6133 | } | ||
6134 | |||
6135 | // Here's our data, | ||
6136 | // PermField contains the field the info goes into | ||
6137 | // PermField determines which mask we're changing | ||
6138 | // | ||
6139 | // chmask is the mask of the change | ||
6140 | // setTF is whether we're adding it or taking it away | ||
6141 | // | ||
6142 | // objLocalID is the localID of the object. | ||
6143 | |||
6144 | // Unfortunately, we have to pass the event the packet because objData is an array | ||
6145 | // That means multiple object perms may be updated in a single packet. | ||
6146 | |||
6147 | return true; | ||
6148 | } | ||
6149 | |||
6150 | private bool HandleUndo(IClientAPI sender, Packet Pack) | ||
6151 | { | ||
6152 | UndoPacket undoitem = (UndoPacket)Pack; | ||
6153 | |||
6154 | #region Packet Session and User Check | ||
6155 | if (m_checkPackets) | ||
6156 | { | ||
6157 | if (undoitem.AgentData.SessionID != SessionId || | ||
6158 | undoitem.AgentData.AgentID != AgentId) | ||
6159 | return true; | ||
6160 | } | ||
6161 | #endregion | ||
6162 | |||
6163 | if (undoitem.ObjectData.Length > 0) | ||
6164 | { | ||
6165 | for (int i = 0; i < undoitem.ObjectData.Length; i++) | ||
6166 | { | ||
6167 | UUID objiD = undoitem.ObjectData[i].ObjectID; | ||
6168 | AgentSit handlerOnUndo = OnUndo; | ||
6169 | if (handlerOnUndo != null) | ||
6170 | { | ||
6171 | handlerOnUndo(this, objiD); | ||
6172 | } | ||
6173 | |||
6174 | } | ||
6175 | } | ||
6176 | return true; | ||
6177 | } | ||
6178 | |||
6179 | private bool HandleObjectDuplicateOnRay(IClientAPI sender, Packet Pack) | ||
6180 | { | ||
6181 | ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack; | ||
6182 | |||
6183 | #region Packet Session and User Check | ||
6184 | if (m_checkPackets) | ||
6185 | { | ||
6186 | if (dupeOnRay.AgentData.SessionID != SessionId || | ||
6187 | dupeOnRay.AgentData.AgentID != AgentId) | ||
6188 | return true; | ||
6189 | } | ||
6190 | #endregion | ||
6191 | |||
6192 | ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null; | ||
6193 | |||
6194 | for (int i = 0; i < dupeOnRay.ObjectData.Length; i++) | ||
6195 | { | ||
6196 | handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay; | ||
6197 | if (handlerObjectDuplicateOnRay != null) | ||
6198 | { | ||
6199 | handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, | ||
6200 | dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, | ||
6201 | dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, | ||
6202 | dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); | ||
6203 | } | ||
6204 | } | ||
6205 | |||
6206 | return true; | ||
6207 | } | ||
6208 | |||
6209 | private bool HandleRequestObjectPropertiesFamily(IClientAPI sender, Packet Pack) | ||
6210 | { | ||
6211 | //This powers the little tooltip that appears when you move your mouse over an object | ||
6212 | RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack; | ||
6213 | |||
6214 | #region Packet Session and User Check | ||
6215 | if (m_checkPackets) | ||
6216 | { | ||
6217 | if (packToolTip.AgentData.SessionID != SessionId || | ||
6218 | packToolTip.AgentData.AgentID != AgentId) | ||
6219 | return true; | ||
6220 | } | ||
6221 | #endregion | ||
6222 | |||
6223 | RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData; | ||
6224 | |||
6225 | RequestObjectPropertiesFamily handlerRequestObjectPropertiesFamily = OnRequestObjectPropertiesFamily; | ||
6226 | |||
6227 | if (handlerRequestObjectPropertiesFamily != null) | ||
6228 | { | ||
6229 | handlerRequestObjectPropertiesFamily(this, m_agentId, packObjBlock.RequestFlags, | ||
6230 | packObjBlock.ObjectID); | ||
6231 | } | ||
6232 | |||
6233 | return true; | ||
6234 | } | ||
6235 | |||
6236 | private bool HandleObjectIncludeInSearch(IClientAPI sender, Packet Pack) | ||
6237 | { | ||
6238 | //This lets us set objects to appear in search (stuff like DataSnapshot, etc) | ||
6239 | ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack; | ||
6240 | ObjectIncludeInSearch handlerObjectIncludeInSearch = null; | ||
6241 | |||
6242 | #region Packet Session and User Check | ||
6243 | if (m_checkPackets) | ||
6244 | { | ||
6245 | if (packInSearch.AgentData.SessionID != SessionId || | ||
6246 | packInSearch.AgentData.AgentID != AgentId) | ||
6247 | return true; | ||
6248 | } | ||
6249 | #endregion | ||
6250 | |||
6251 | foreach (ObjectIncludeInSearchPacket.ObjectDataBlock objData in packInSearch.ObjectData) | ||
6252 | { | ||
6253 | bool inSearch = objData.IncludeInSearch; | ||
6254 | uint localID = objData.ObjectLocalID; | ||
6255 | |||
6256 | handlerObjectIncludeInSearch = OnObjectIncludeInSearch; | ||
6257 | |||
6258 | if (handlerObjectIncludeInSearch != null) | ||
6259 | { | ||
6260 | handlerObjectIncludeInSearch(this, inSearch, localID); | ||
6261 | } | ||
6262 | } | ||
6263 | return true; | ||
6264 | } | ||
6265 | |||
6266 | private bool HandleScriptAnswerYes(IClientAPI sender, Packet Pack) | ||
6267 | { | ||
6268 | ScriptAnswerYesPacket scriptAnswer = (ScriptAnswerYesPacket)Pack; | ||
6269 | |||
6270 | #region Packet Session and User Check | ||
6271 | if (m_checkPackets) | ||
6272 | { | ||
6273 | if (scriptAnswer.AgentData.SessionID != SessionId || | ||
6274 | scriptAnswer.AgentData.AgentID != AgentId) | ||
6275 | return true; | ||
6276 | } | ||
6277 | #endregion | ||
6278 | |||
6279 | ScriptAnswer handlerScriptAnswer = OnScriptAnswer; | ||
6280 | if (handlerScriptAnswer != null) | ||
6281 | { | ||
6282 | handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions); | ||
6283 | } | ||
6284 | return true; | ||
6285 | } | ||
6286 | |||
6287 | private bool HandleObjectClickAction(IClientAPI sender, Packet Pack) | ||
6288 | { | ||
6289 | ObjectClickActionPacket ocpacket = (ObjectClickActionPacket)Pack; | ||
6290 | |||
6291 | #region Packet Session and User Check | ||
6292 | if (m_checkPackets) | ||
6293 | { | ||
6294 | if (ocpacket.AgentData.SessionID != SessionId || | ||
6295 | ocpacket.AgentData.AgentID != AgentId) | ||
6296 | return true; | ||
6297 | } | ||
6298 | #endregion | ||
6299 | |||
6300 | GenericCall7 handlerObjectClickAction = OnObjectClickAction; | ||
6301 | if (handlerObjectClickAction != null) | ||
6302 | { | ||
6303 | foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData) | ||
6304 | { | ||
6305 | byte action = odata.ClickAction; | ||
6306 | uint localID = odata.ObjectLocalID; | ||
6307 | handlerObjectClickAction(this, localID, action.ToString()); | ||
6308 | } | ||
6309 | } | ||
6310 | return true; | ||
6311 | } | ||
6312 | |||
6313 | private bool HandleObjectMaterial(IClientAPI sender, Packet Pack) | ||
6314 | { | ||
6315 | ObjectMaterialPacket ompacket = (ObjectMaterialPacket)Pack; | ||
6316 | |||
6317 | #region Packet Session and User Check | ||
6318 | if (m_checkPackets) | ||
6319 | { | ||
6320 | if (ompacket.AgentData.SessionID != SessionId || | ||
6321 | ompacket.AgentData.AgentID != AgentId) | ||
6322 | return true; | ||
6323 | } | ||
6324 | #endregion | ||
6325 | |||
6326 | GenericCall7 handlerObjectMaterial = OnObjectMaterial; | ||
6327 | if (handlerObjectMaterial != null) | ||
6328 | { | ||
6329 | foreach (ObjectMaterialPacket.ObjectDataBlock odata in ompacket.ObjectData) | ||
6330 | { | ||
6331 | byte material = odata.Material; | ||
6332 | uint localID = odata.ObjectLocalID; | ||
6333 | handlerObjectMaterial(this, localID, material.ToString()); | ||
6334 | } | ||
6335 | } | ||
6336 | return true; | ||
6337 | } | ||
6338 | |||
6339 | #endregion Objects/m_sceneObjects | ||
5263 | 6340 | ||
5264 | #endregion Packet Handlers | 6341 | #endregion Packet Handlers |
5265 | 6342 | ||
@@ -5755,9 +6832,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5755 | // Main packet processing conditional | 6832 | // Main packet processing conditional |
5756 | switch (Pack.Type) | 6833 | switch (Pack.Type) |
5757 | { | 6834 | { |
5758 | #region Scene/Avatar | ||
5759 | #region CommentedOut | 6835 | #region CommentedOut |
5760 | /* | 6836 | /* |
6837 | #region Scene/Avatar | ||
6838 | |||
6839 | |||
5761 | case PacketType.AvatarPropertiesRequest: | 6840 | case PacketType.AvatarPropertiesRequest: |
5762 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | 6841 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; |
5763 | 6842 | ||
@@ -6419,8 +7498,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6419 | 7498 | ||
6420 | } | 7499 | } |
6421 | break; | 7500 | break; |
6422 | */ | 7501 | |
6423 | #endregion | ||
6424 | case PacketType.AvatarPickerRequest: | 7502 | case PacketType.AvatarPickerRequest: |
6425 | AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; | 7503 | AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; |
6426 | 7504 | ||
@@ -6444,7 +7522,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6444 | Utils.BytesToString(querydata.Name)); | 7522 | Utils.BytesToString(querydata.Name)); |
6445 | } | 7523 | } |
6446 | break; | 7524 | break; |
6447 | 7525 | ||
6448 | case PacketType.AgentDataUpdateRequest: | 7526 | case PacketType.AgentDataUpdateRequest: |
6449 | AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack; | 7527 | AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack; |
6450 | 7528 | ||
@@ -6564,7 +7642,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6564 | 7642 | ||
6565 | #endregion | 7643 | #endregion |
6566 | 7644 | ||
6567 | #region Objects/m_sceneObjects | 7645 | |
7646 | //#region Objects/m_sceneObjects | ||
6568 | 7647 | ||
6569 | case PacketType.ObjectLink: | 7648 | case PacketType.ObjectLink: |
6570 | ObjectLinkPacket link = (ObjectLinkPacket)Pack; | 7649 | ObjectLinkPacket link = (ObjectLinkPacket)Pack; |
@@ -6723,6 +7802,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6723 | } | 7802 | } |
6724 | } | 7803 | } |
6725 | break; | 7804 | break; |
7805 | |||
6726 | case PacketType.ObjectDuplicate: | 7806 | case PacketType.ObjectDuplicate: |
6727 | ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; | 7807 | ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; |
6728 | 7808 | ||
@@ -6775,6 +7855,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6775 | } | 7855 | } |
6776 | } | 7856 | } |
6777 | break; | 7857 | break; |
7858 | |||
6778 | case PacketType.ObjectSelect: | 7859 | case PacketType.ObjectSelect: |
6779 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | 7860 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; |
6780 | 7861 | ||
@@ -6798,6 +7879,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6798 | } | 7879 | } |
6799 | } | 7880 | } |
6800 | break; | 7881 | break; |
7882 | |||
6801 | case PacketType.ObjectDeselect: | 7883 | case PacketType.ObjectDeselect: |
6802 | ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; | 7884 | ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; |
6803 | 7885 | ||
@@ -6821,6 +7903,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6821 | } | 7903 | } |
6822 | } | 7904 | } |
6823 | break; | 7905 | break; |
7906 | |||
6824 | case PacketType.ObjectPosition: | 7907 | case PacketType.ObjectPosition: |
6825 | // DEPRECATED: but till libsecondlife removes it, people will use it | 7908 | // DEPRECATED: but till libsecondlife removes it, people will use it |
6826 | ObjectPositionPacket position = (ObjectPositionPacket)Pack; | 7909 | ObjectPositionPacket position = (ObjectPositionPacket)Pack; |
@@ -6843,6 +7926,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6843 | } | 7926 | } |
6844 | 7927 | ||
6845 | break; | 7928 | break; |
7929 | |||
6846 | case PacketType.ObjectScale: | 7930 | case PacketType.ObjectScale: |
6847 | // DEPRECATED: but till libsecondlife removes it, people will use it | 7931 | // DEPRECATED: but till libsecondlife removes it, people will use it |
6848 | ObjectScalePacket scale = (ObjectScalePacket)Pack; | 7932 | ObjectScalePacket scale = (ObjectScalePacket)Pack; |
@@ -6864,6 +7948,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6864 | } | 7948 | } |
6865 | 7949 | ||
6866 | break; | 7950 | break; |
7951 | |||
6867 | case PacketType.ObjectRotation: | 7952 | case PacketType.ObjectRotation: |
6868 | // DEPRECATED: but till libsecondlife removes it, people will use it | 7953 | // DEPRECATED: but till libsecondlife removes it, people will use it |
6869 | ObjectRotationPacket rotation = (ObjectRotationPacket)Pack; | 7954 | ObjectRotationPacket rotation = (ObjectRotationPacket)Pack; |
@@ -6885,6 +7970,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6885 | } | 7970 | } |
6886 | 7971 | ||
6887 | break; | 7972 | break; |
7973 | |||
6888 | case PacketType.ObjectFlagUpdate: | 7974 | case PacketType.ObjectFlagUpdate: |
6889 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; | 7975 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; |
6890 | 7976 | ||
@@ -6925,6 +8011,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6925 | } | 8011 | } |
6926 | } | 8012 | } |
6927 | break; | 8013 | break; |
8014 | |||
6928 | case PacketType.ObjectGrab: | 8015 | case PacketType.ObjectGrab: |
6929 | ObjectGrabPacket grab = (ObjectGrabPacket)Pack; | 8016 | ObjectGrabPacket grab = (ObjectGrabPacket)Pack; |
6930 | 8017 | ||
@@ -6959,6 +8046,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6959 | handlerGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this, touchArgs); | 8046 | handlerGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this, touchArgs); |
6960 | } | 8047 | } |
6961 | break; | 8048 | break; |
8049 | |||
6962 | case PacketType.ObjectGrabUpdate: | 8050 | case PacketType.ObjectGrabUpdate: |
6963 | ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack; | 8051 | ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack; |
6964 | 8052 | ||
@@ -6994,6 +8082,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6994 | grabUpdate.ObjectData.GrabPosition, this, touchArgs); | 8082 | grabUpdate.ObjectData.GrabPosition, this, touchArgs); |
6995 | } | 8083 | } |
6996 | break; | 8084 | break; |
8085 | |||
6997 | case PacketType.ObjectDeGrab: | 8086 | case PacketType.ObjectDeGrab: |
6998 | ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack; | 8087 | ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack; |
6999 | 8088 | ||
@@ -7027,6 +8116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7027 | handlerDeGrabObject(deGrab.ObjectData.LocalID, this, touchArgs); | 8116 | handlerDeGrabObject(deGrab.ObjectData.LocalID, this, touchArgs); |
7028 | } | 8117 | } |
7029 | break; | 8118 | break; |
8119 | |||
7030 | case PacketType.ObjectSpinStart: | 8120 | case PacketType.ObjectSpinStart: |
7031 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinStart packet"); | 8121 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinStart packet"); |
7032 | ObjectSpinStartPacket spinStart = (ObjectSpinStartPacket)Pack; | 8122 | ObjectSpinStartPacket spinStart = (ObjectSpinStartPacket)Pack; |
@@ -7070,6 +8160,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7070 | handlerSpinUpdate(spinUpdate.ObjectData.ObjectID, spinUpdate.ObjectData.Rotation, this); | 8160 | handlerSpinUpdate(spinUpdate.ObjectData.ObjectID, spinUpdate.ObjectData.Rotation, this); |
7071 | } | 8161 | } |
7072 | break; | 8162 | break; |
8163 | |||
8164 | |||
7073 | case PacketType.ObjectSpinStop: | 8165 | case PacketType.ObjectSpinStop: |
7074 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); | 8166 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); |
7075 | ObjectSpinStopPacket spinStop = (ObjectSpinStopPacket)Pack; | 8167 | ObjectSpinStopPacket spinStop = (ObjectSpinStopPacket)Pack; |
@@ -7114,6 +8206,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7114 | } | 8206 | } |
7115 | } | 8207 | } |
7116 | break; | 8208 | break; |
8209 | |||
7117 | case PacketType.ObjectName: | 8210 | case PacketType.ObjectName: |
7118 | ObjectNamePacket objName = (ObjectNamePacket)Pack; | 8211 | ObjectNamePacket objName = (ObjectNamePacket)Pack; |
7119 | 8212 | ||
@@ -7137,6 +8230,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7137 | } | 8230 | } |
7138 | } | 8231 | } |
7139 | break; | 8232 | break; |
8233 | |||
7140 | case PacketType.ObjectPermissions: | 8234 | case PacketType.ObjectPermissions: |
7141 | if (OnObjectPermissions != null) | 8235 | if (OnObjectPermissions != null) |
7142 | { | 8236 | { |
@@ -7212,6 +8306,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7212 | } | 8306 | } |
7213 | } | 8307 | } |
7214 | break; | 8308 | break; |
8309 | |||
7215 | case PacketType.ObjectDuplicateOnRay: | 8310 | case PacketType.ObjectDuplicateOnRay: |
7216 | ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack; | 8311 | ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack; |
7217 | 8312 | ||
@@ -7239,6 +8334,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7239 | } | 8334 | } |
7240 | 8335 | ||
7241 | break; | 8336 | break; |
8337 | |||
7242 | case PacketType.RequestObjectPropertiesFamily: | 8338 | case PacketType.RequestObjectPropertiesFamily: |
7243 | //This powers the little tooltip that appears when you move your mouse over an object | 8339 | //This powers the little tooltip that appears when you move your mouse over an object |
7244 | RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack; | 8340 | RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack; |
@@ -7263,6 +8359,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7263 | } | 8359 | } |
7264 | 8360 | ||
7265 | break; | 8361 | break; |
8362 | |||
7266 | case PacketType.ObjectIncludeInSearch: | 8363 | case PacketType.ObjectIncludeInSearch: |
7267 | //This lets us set objects to appear in search (stuff like DataSnapshot, etc) | 8364 | //This lets us set objects to appear in search (stuff like DataSnapshot, etc) |
7268 | ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack; | 8365 | ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack; |
@@ -7358,8 +8455,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7358 | } | 8455 | } |
7359 | break; | 8456 | break; |
7360 | 8457 | ||
8458 | //#endregion | ||
8459 | */ | ||
7361 | #endregion | 8460 | #endregion |
7362 | |||
7363 | #region Inventory/Asset/Other related packets | 8461 | #region Inventory/Asset/Other related packets |
7364 | 8462 | ||
7365 | case PacketType.RequestImage: | 8463 | case PacketType.RequestImage: |