From c64039363daf90b37ddbeaa95b2516f0020c3f06 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 26 Apr 2007 12:56:14 +0000 Subject: Mostly working again. Updated to lastest libsl and handled the changes to the message templates (some byte fields are now ushort fields ). Still seems to be a problem when logging on, in that I get the downloading clothing message at the end of the precaching (which I didn't before) --- OpenSim.RegionServer/world/Avatar.cs | 40 +++++++++++++++++++++++++++--- OpenSim.RegionServer/world/AvatarUpdate.cs | 3 +-- OpenSim.RegionServer/world/World.cs | 2 +- 3 files changed, 39 insertions(+), 6 deletions(-) (limited to 'OpenSim.RegionServer') diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs index df7d5ba..917c893 100644 --- a/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim.RegionServer/world/Avatar.cs @@ -102,7 +102,7 @@ namespace OpenSim.world public static void SetupTemplate(string name) { - int i = 0; + int i = 0; FileInfo fInfo = new FileInfo(name); long numBytes = fInfo.Length; FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); @@ -111,8 +111,19 @@ namespace OpenSim.world br.Close(); fStream.Close(); - libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); - + libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); + + SetDefaultPacketValues(objdata); + objdata.ObjectData = data1; + objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); + objdata.PathCurve = 16; + objdata.ProfileCurve = 1; + objdata.PathScaleX = 100; + objdata.PathScaleY = 100; + objdata.ParentID = 0; + objdata.OwnerID = LLUUID.Zero; + objdata.Scale = new LLVector3(1, 1, 1); + objdata.PCode = 47; System.Text.Encoding enc = System.Text.Encoding.ASCII; libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); pos.X = 100f; @@ -126,6 +137,29 @@ namespace OpenSim.world Avatar.AvatarTemplate = objdata; } + protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) + { + objdata.PSBlock = new byte[0]; + objdata.ExtraParams = new byte[1]; + objdata.MediaURL = new byte[0]; + objdata.NameValue = new byte[0]; + objdata.Text = new byte[0]; + objdata.TextColor = new byte[4]; + objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); + objdata.JointPivot = new LLVector3(0, 0, 0); + objdata.Material = 4; + objdata.TextureAnim = new byte[0]; + objdata.Sound = LLUUID.Zero; + LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); + objdata.TextureEntry = ntex.ToBytes(); + objdata.State = 0; + objdata.Data = new byte[0]; + + objdata.ObjectData = new byte[60]; + objdata.ObjectData[46] = 128; + objdata.ObjectData[47] = 63; + } + public void CompleteMovement(World RegionInfo) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); diff --git a/OpenSim.RegionServer/world/AvatarUpdate.cs b/OpenSim.RegionServer/world/AvatarUpdate.cs index 34d032c..ba2965d 100644 --- a/OpenSim.RegionServer/world/AvatarUpdate.cs +++ b/OpenSim.RegionServer/world/AvatarUpdate.cs @@ -124,9 +124,9 @@ namespace OpenSim.world objupdate.RegionData.RegionHandle = m_regionHandle; objupdate.RegionData.TimeDilation = 64096; objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; - objupdate.ObjectData[0] = AvatarTemplate; //give this avatar object a local id and assign the user a name + objupdate.ObjectData[0].ID = this.localid; this.uuid = objupdate.ObjectData[0].FullID = ControllingClient.AgentID; objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); @@ -134,7 +134,6 @@ namespace OpenSim.world byte[] pb = pos2.GetBytes(); Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); m_world._localNumber++; - foreach (SimClient client in m_clientThreads.Values) { client.OutPacket(objupdate); diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 5bada2b..0e5dbf0 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs @@ -70,7 +70,7 @@ namespace OpenSim.world OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); TerrainManager = new TerrainManager(new SecondLife()); Terrain = new TerrainEngine(); - Avatar.SetupTemplate("avatar-template.dat"); + Avatar.SetupTemplate("avatar-template2.dat"); // MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); // Initialise this only after the world has loaded // Scripts = new ScriptEngine(this); -- cgit v1.1