diff options
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 280 |
1 files changed, 167 insertions, 113 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5302fff..aae4b87 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -817,52 +817,173 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
817 | 817 | ||
818 | #region Scene/Avatar to Client | 818 | #region Scene/Avatar to Client |
819 | 819 | ||
820 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) | 820 | // temporary here ( from estatemanagermodule) |
821 | { | 821 | private uint GetRegionFlags() |
822 | RegionHandshakePacket handshake = (RegionHandshakePacket)PacketPool.Instance.GetPacket(PacketType.RegionHandshake); | 822 | { |
823 | handshake.RegionInfo = new RegionHandshakePacket.RegionInfoBlock(); | 823 | RegionFlags flags = RegionFlags.None; |
824 | handshake.RegionInfo.BillableFactor = args.billableFactor; | 824 | |
825 | handshake.RegionInfo.IsEstateManager = args.isEstateManager; | 825 | if (Scene.RegionInfo.RegionSettings.AllowDamage) |
826 | handshake.RegionInfo.TerrainHeightRange00 = args.terrainHeightRange0; | 826 | flags |= RegionFlags.AllowDamage; |
827 | handshake.RegionInfo.TerrainHeightRange01 = args.terrainHeightRange1; | 827 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) |
828 | handshake.RegionInfo.TerrainHeightRange10 = args.terrainHeightRange2; | 828 | flags |= RegionFlags.AllowLandmark; |
829 | handshake.RegionInfo.TerrainHeightRange11 = args.terrainHeightRange3; | 829 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) |
830 | handshake.RegionInfo.TerrainStartHeight00 = args.terrainStartHeight0; | 830 | flags |= RegionFlags.AllowSetHome; |
831 | handshake.RegionInfo.TerrainStartHeight01 = args.terrainStartHeight1; | 831 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) |
832 | handshake.RegionInfo.TerrainStartHeight10 = args.terrainStartHeight2; | 832 | flags |= RegionFlags.ResetHomeOnTeleport; |
833 | handshake.RegionInfo.TerrainStartHeight11 = args.terrainStartHeight3; | 833 | if (Scene.RegionInfo.RegionSettings.FixedSun) |
834 | handshake.RegionInfo.SimAccess = args.simAccess; | 834 | flags |= RegionFlags.SunFixed; |
835 | handshake.RegionInfo.WaterHeight = args.waterHeight; | 835 | // allow access override (was taxfree) |
836 | 836 | if (Scene.RegionInfo.RegionSettings.BlockTerraform) | |
837 | handshake.RegionInfo.RegionFlags = args.regionFlags; | 837 | flags |= RegionFlags.BlockTerraform; |
838 | handshake.RegionInfo.SimName = Util.StringToBytes256(args.regionName); | 838 | if (!Scene.RegionInfo.RegionSettings.AllowLandResell) |
839 | handshake.RegionInfo.SimOwner = args.SimOwner; | 839 | flags |= RegionFlags.BlockLandResell; |
840 | handshake.RegionInfo.TerrainBase0 = args.terrainBase0; | 840 | if (Scene.RegionInfo.RegionSettings.Sandbox) |
841 | handshake.RegionInfo.TerrainBase1 = args.terrainBase1; | 841 | flags |= RegionFlags.Sandbox; |
842 | handshake.RegionInfo.TerrainBase2 = args.terrainBase2; | 842 | // nulllayer not used |
843 | handshake.RegionInfo.TerrainBase3 = args.terrainBase3; | 843 | if (Scene.RegionInfo.RegionSettings.Casino) |
844 | handshake.RegionInfo.TerrainDetail0 = args.terrainDetail0; | 844 | flags |= RegionFlags.SkipAgentAction; // redefined |
845 | handshake.RegionInfo.TerrainDetail1 = args.terrainDetail1; | 845 | if (Scene.RegionInfo.RegionSettings.GodBlockSearch) |
846 | handshake.RegionInfo.TerrainDetail2 = args.terrainDetail2; | 846 | flags |= RegionFlags.SkipUpdateInterestList; // redefined |
847 | handshake.RegionInfo.TerrainDetail3 = args.terrainDetail3; | 847 | if (Scene.RegionInfo.RegionSettings.DisableCollisions) |
848 | handshake.RegionInfo.CacheID = UUID.Random(); //I guess this is for the client to remember an old setting? | 848 | flags |= RegionFlags.SkipCollisions; |
849 | handshake.RegionInfo2 = new RegionHandshakePacket.RegionInfo2Block(); | 849 | if (Scene.RegionInfo.RegionSettings.DisableScripts) |
850 | handshake.RegionInfo2.RegionID = regionInfo.RegionID; | 850 | flags |= RegionFlags.SkipScripts; |
851 | 851 | if (Scene.RegionInfo.RegionSettings.DisablePhysics) | |
852 | handshake.RegionInfo3 = new RegionHandshakePacket.RegionInfo3Block(); | 852 | flags |= RegionFlags.SkipPhysics; |
853 | handshake.RegionInfo3.CPUClassID = 9; | 853 | if (Scene.RegionInfo.EstateSettings.PublicAccess) |
854 | handshake.RegionInfo3.CPURatio = 1; | 854 | flags |= RegionFlags.ExternallyVisible; // ???? need revision |
855 | 855 | //MainlandVisible -> allow return enc object | |
856 | handshake.RegionInfo3.ColoName = Utils.EmptyBytes; | 856 | //PublicAllowed -> allow return enc estate object |
857 | handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); | 857 | if (Scene.RegionInfo.EstateSettings.BlockDwell) |
858 | handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; | 858 | flags |= RegionFlags.BlockDwell; |
859 | 859 | if (Scene.RegionInfo.RegionSettings.BlockFly) | |
860 | handshake.RegionInfo4 = new RegionHandshakePacket.RegionInfo4Block[1]; | 860 | flags |= RegionFlags.NoFly; |
861 | handshake.RegionInfo4[0] = new RegionHandshakePacket.RegionInfo4Block(); | 861 | if (Scene.RegionInfo.EstateSettings.AllowDirectTeleport) |
862 | handshake.RegionInfo4[0].RegionFlagsExtended = args.regionFlags; | 862 | flags |= RegionFlags.AllowDirectTeleport; |
863 | handshake.RegionInfo4[0].RegionProtocols = 0; // 1 here would indicate that SSB is supported | 863 | if (Scene.RegionInfo.EstateSettings.EstateSkipScripts) |
864 | 864 | flags |= RegionFlags.EstateSkipScripts; | |
865 | OutPacket(handshake, ThrottleOutPacketType.Unknown); | 865 | if (Scene.RegionInfo.RegionSettings.RestrictPushing) |
866 | flags |= RegionFlags.RestrictPushObject; | ||
867 | if (Scene.RegionInfo.EstateSettings.DenyAnonymous) | ||
868 | flags |= RegionFlags.DenyAnonymous; | ||
869 | //DenyIdentified unused | ||
870 | //DenyTransacted unused | ||
871 | if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide) | ||
872 | flags |= RegionFlags.AllowParcelChanges; | ||
873 | //AbuseEmailToEstateOwner -> block flyover | ||
874 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | ||
875 | flags |= RegionFlags.AllowVoice; | ||
876 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) | ||
877 | flags |= RegionFlags.BlockParcelSearch; | ||
878 | if (Scene.RegionInfo.EstateSettings.DenyMinors) | ||
879 | flags |= RegionFlags.DenyAgeUnverified; | ||
880 | |||
881 | return (uint)flags; | ||
882 | } | ||
883 | |||
884 | // Region handshake may need a more detailed look | ||
885 | static private readonly byte[] RegionHandshakeHeader = new byte[] { | ||
886 | Helpers.MSG_RELIABLE | Helpers.MSG_ZEROCODED, | ||
887 | 0, 0, 0, 0, // sequence number | ||
888 | 0, // extra | ||
889 | //0xff, 0xff, 0, 148 // ID 148 (low frequency bigendian) | ||
890 | 0xff, 0xff, 0, 1, 148 // ID 148 (low frequency bigendian) zero encoded | ||
891 | }; | ||
892 | |||
893 | public void SendRegionHandshake(RegionInfo _regionInfo, RegionHandshakeArgs args) | ||
894 | { | ||
895 | RegionInfo regionInfo = m_scene.RegionInfo; | ||
896 | RegionSettings regionSettings = regionInfo.RegionSettings; | ||
897 | EstateSettings es = regionInfo.EstateSettings; | ||
898 | |||
899 | bool isEstateManager = m_scene.Permissions.IsEstateManager(AgentId); // go by oficial path | ||
900 | uint regionFlags = GetRegionFlags(); | ||
901 | |||
902 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); | ||
903 | Buffer.BlockCopy(RegionHandshakeHeader, 0, buf.Data, 0, 11); | ||
904 | |||
905 | // inline zeroencode | ||
906 | LLUDPZeroEncoder zc = new LLUDPZeroEncoder(buf.Data); | ||
907 | zc.Position = 11; | ||
908 | |||
909 | //RegionInfo Block | ||
910 | //RegionFlags U32 | ||
911 | zc.AddUInt(regionFlags); | ||
912 | //SimAccess U8 | ||
913 | zc.AddByte(regionInfo.AccessLevel); | ||
914 | //SimName | ||
915 | zc.AddShortString(regionInfo.RegionName, 255); | ||
916 | //SimOwner | ||
917 | zc.AddUUID(es.EstateOwner); | ||
918 | //IsEstateManager | ||
919 | zc.AddByte((byte)(isEstateManager ? 1 : 0)); | ||
920 | //WaterHeight | ||
921 | zc.AddFloat((float)regionSettings.WaterHeight); // why is this a double ?? | ||
922 | //BillableFactor | ||
923 | zc.AddFloat(es.BillableFactor); | ||
924 | //CacheID | ||
925 | zc.AddUUID(regionInfo.RegionID); // needs review when we actuall support cache | ||
926 | //TerrainBase0 | ||
927 | //TerrainBase1 | ||
928 | //TerrainBase2 | ||
929 | //TerrainBase3 | ||
930 | // this seem not obsolete, sending zero uuids | ||
931 | // we should send the basic low resolution default ? | ||
932 | zc.AddZeros(16 * 4); | ||
933 | //TerrainDetail0 | ||
934 | zc.AddUUID(regionSettings.TerrainTexture1); | ||
935 | //TerrainDetail1 | ||
936 | zc.AddUUID(regionSettings.TerrainTexture2); | ||
937 | //TerrainDetail2 | ||
938 | zc.AddUUID(regionSettings.TerrainTexture3); | ||
939 | //TerrainDetail3 | ||
940 | zc.AddUUID(regionSettings.TerrainTexture4); | ||
941 | //TerrainStartHeight00 | ||
942 | zc.AddFloat((float)regionSettings.Elevation1SW); | ||
943 | //TerrainStartHeight01 | ||
944 | zc.AddFloat((float)regionSettings.Elevation1NW); | ||
945 | //TerrainStartHeight10 | ||
946 | zc.AddFloat((float)regionSettings.Elevation1SE); | ||
947 | //TerrainStartHeight11 | ||
948 | zc.AddFloat((float)regionSettings.Elevation1NE); | ||
949 | //TerrainHeightRange00 | ||
950 | zc.AddFloat((float)regionSettings.Elevation2SW); | ||
951 | //TerrainHeightRange01 | ||
952 | zc.AddFloat((float)regionSettings.Elevation2NW); | ||
953 | //TerrainHeightRange10 | ||
954 | zc.AddFloat((float)regionSettings.Elevation2SE); | ||
955 | //TerrainHeightRange11 | ||
956 | zc.AddFloat((float)regionSettings.Elevation2NE); | ||
957 | |||
958 | //RegionInfo2 block | ||
959 | |||
960 | //region ID | ||
961 | zc.AddUUID(regionInfo.RegionID); | ||
962 | |||
963 | //RegionInfo3 block | ||
964 | |||
965 | //CPUClassID | ||
966 | zc.AddInt(9); | ||
967 | //CPURatio | ||
968 | zc.AddInt(1); | ||
969 | // ColoName (string) | ||
970 | // ProductSKU (string) | ||
971 | // both empty strings | ||
972 | zc.AddZeros(2); | ||
973 | //ProductName | ||
974 | zc.AddShortString(regionInfo.RegionType, 255); | ||
975 | |||
976 | //RegionInfo4 block | ||
977 | |||
978 | //RegionFlagsExtended | ||
979 | zc.AddZeros(1); // we dont have this | ||
980 | //zc.AddByte(1); | ||
981 | //zc.AddUInt64(regionFlags); // we have nothing other base flags | ||
982 | //RegionProtocols | ||
983 | //zc.AddUInt64(0); // bit 0 signals server side texture baking" | ||
984 | |||
985 | buf.DataLength = zc.Finish(); | ||
986 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); | ||
866 | } | 987 | } |
867 | 988 | ||
868 | static private readonly byte[] AgentMovementCompleteHeader = new byte[] { | 989 | static private readonly byte[] AgentMovementCompleteHeader = new byte[] { |
@@ -6418,73 +6539,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6418 | // total size 63 or 47 + (texture size + 4) | 6539 | // total size 63 or 47 + (texture size + 4) |
6419 | } | 6540 | } |
6420 | 6541 | ||
6421 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) | ||
6422 | { | ||
6423 | Quaternion rotation = data.Rotation; | ||
6424 | // tpvs can only see rotations around Z in some cases | ||
6425 | if(!data.Flying && !data.IsSatOnObject) | ||
6426 | { | ||
6427 | rotation.X = 0f; | ||
6428 | rotation.Y = 0f; | ||
6429 | } | ||
6430 | rotation.Normalize(); | ||
6431 | |||
6432 | // m_log.DebugFormat( | ||
6433 | // "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name); | ||
6434 | |||
6435 | byte[] objectData = new byte[76]; | ||
6436 | |||
6437 | //Vector3 velocity = Vector3.Zero; | ||
6438 | Vector3 acceleration = Vector3.Zero; | ||
6439 | Vector3 angularvelocity = Vector3.Zero; | ||
6440 | |||
6441 | data.CollisionPlane.ToBytes(objectData, 0); | ||
6442 | data.OffsetPosition.ToBytes(objectData, 16); | ||
6443 | data.Velocity.ToBytes(objectData, 28); | ||
6444 | acceleration.ToBytes(objectData, 40); | ||
6445 | rotation.ToBytes(objectData, 52); | ||
6446 | angularvelocity.ToBytes(objectData, 64); | ||
6447 | |||
6448 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | ||
6449 | |||
6450 | update.Data = Utils.EmptyBytes; | ||
6451 | update.ExtraParams = Utils.EmptyBytes; | ||
6452 | update.FullID = data.UUID; | ||
6453 | update.ID = data.LocalId; | ||
6454 | update.Material = (byte)Material.Flesh; | ||
6455 | update.MediaURL = Utils.EmptyBytes; | ||
6456 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + | ||
6457 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); | ||
6458 | update.ObjectData = objectData; | ||
6459 | |||
6460 | SceneObjectPart parentPart = data.ParentPart; | ||
6461 | if (parentPart != null) | ||
6462 | update.ParentID = parentPart.ParentGroup.LocalId; | ||
6463 | else | ||
6464 | update.ParentID = 0; | ||
6465 | |||
6466 | update.PathCurve = 16; | ||
6467 | update.PathScaleX = 100; | ||
6468 | update.PathScaleY = 100; | ||
6469 | update.PCode = (byte)PCode.Avatar; | ||
6470 | update.ProfileCurve = 1; | ||
6471 | update.PSBlock = Utils.EmptyBytes; | ||
6472 | update.Scale = data.Appearance.AvatarSize; | ||
6473 | // update.Scale.Z -= 0.2f; | ||
6474 | |||
6475 | update.Text = Utils.EmptyBytes; | ||
6476 | update.TextColor = new byte[4]; | ||
6477 | |||
6478 | // Don't send texture anim for avatars - this has no meaning for them. | ||
6479 | update.TextureAnim = Utils.EmptyBytes; | ||
6480 | |||
6481 | // Don't send texture entry for avatars here - this is accomplished via the AvatarAppearance packet | ||
6482 | update.TextureEntry = Utils.EmptyBytes; | ||
6483 | update.UpdateFlags = 0; | ||
6484 | |||
6485 | return update; | ||
6486 | } | ||
6487 | |||
6488 | protected void CreateAvatarUpdateBlock(ScenePresence data, byte[] dest, ref int pos) | 6542 | protected void CreateAvatarUpdateBlock(ScenePresence data, byte[] dest, ref int pos) |
6489 | { | 6543 | { |
6490 | Quaternion rotation = data.Rotation; | 6544 | Quaternion rotation = data.Rotation; |