From b2eb26e4babbf87c8db84e67de116ef145feb2d6 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 29 May 2007 09:16:18 +0000 Subject: [PATCH] number of changes --- Common/OpenSim.Framework/AgentInventory.cs | 11 - .../Interfaces/IClientAPI.cs | 7 +- Common/OpenSim.Framework/Interfaces/IWorld.cs | 4 +- .../OpenSim.Framework.csproj | 1 + .../OpenSim.Framework/Types/AgentWearable.cs | 18 ++ OpenGridServices.sln | 125 +++++------ .../ServiceManager/ServiceManager.csproj | 33 +-- .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 6 +- .../OpenSim.RegionServer/ClientView.API.cs | 198 +++++++++++++++++- OpenSim/OpenSim.RegionServer/ClientView.cs | 22 +- .../OpenSim.RegionServer/RegionServerBase.cs | 2 +- OpenSim/OpenSim.RegionServer/VersionInfo.cs | 2 +- OpenSim/OpenSim.World/Avatar.cs | 40 ++-- OpenSim/OpenSim.World/World.cs | 9 +- OpenSim/OpenSim.World/WorldBase.cs | 8 +- OpenSim/OpenSim/OpenSimMain.cs | 50 +++-- 16 files changed, 383 insertions(+), 153 deletions(-) create mode 100644 Common/OpenSim.Framework/Types/AgentWearable.cs diff --git a/Common/OpenSim.Framework/AgentInventory.cs b/Common/OpenSim.Framework/AgentInventory.cs index 6fdd6c5267..f2ef729fa2 100644 --- a/Common/OpenSim.Framework/AgentInventory.cs +++ b/Common/OpenSim.Framework/AgentInventory.cs @@ -237,15 +237,4 @@ namespace OpenSim.Framework.Inventory return result; } } - - public class AvatarWearable - { - public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); - public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); - - public AvatarWearable() - { - - } - } } diff --git a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs index add6c006b5..8ba15716ce 100644 --- a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs +++ b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs @@ -18,6 +18,8 @@ namespace OpenSim.Framework.Interfaces public delegate void GenericCall2(); public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary. public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); + public delegate void GenericCall5(IClientAPI remoteClient, bool status); + public delegate void GenericCall6(LLUUID uid); public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); @@ -25,6 +27,7 @@ namespace OpenSim.Framework.Interfaces public delegate void UpdatePrimVector(uint localID, LLVector3 pos, IClientAPI remoteClient); public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); public delegate void StatusChange(bool status); + public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); public interface IClientAPI { @@ -50,6 +53,8 @@ namespace OpenSim.Framework.Interfaces event UpdatePrimVector OnUpdatePrimScale; event StatusChange OnChildAgentStatus; event GenericCall2 OnStopMovement; + event NewAvatar OnNewAvatar; + event GenericCall6 OnRemoveAvatar; LLVector3 StartPos { @@ -63,7 +68,7 @@ namespace OpenSim.Framework.Interfaces } void OutPacket(Packet newPack); - void SendAppearance(AvatarWearable[] wearables); + void SendWearables(AvatarWearable[] wearables); void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); } } diff --git a/Common/OpenSim.Framework/Interfaces/IWorld.cs b/Common/OpenSim.Framework/Interfaces/IWorld.cs index 433e540fe9..ab2d63db29 100644 --- a/Common/OpenSim.Framework/Interfaces/IWorld.cs +++ b/Common/OpenSim.Framework/Interfaces/IWorld.cs @@ -8,8 +8,8 @@ namespace OpenSim.Framework.Interfaces { public interface IWorld { - bool AddNewAvatar(IClientAPI remoteClient, bool childAgent); - bool RemoveAvatar(LLUUID agentID); + void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child); + void RemoveAvatar(LLUUID agentID); RegionInfo GetRegionInfo(); } } diff --git a/Common/OpenSim.Framework/OpenSim.Framework.csproj b/Common/OpenSim.Framework/OpenSim.Framework.csproj index 519d5a8158..6c2a8c6eeb 100644 --- a/Common/OpenSim.Framework/OpenSim.Framework.csproj +++ b/Common/OpenSim.Framework/OpenSim.Framework.csproj @@ -110,6 +110,7 @@ + Code diff --git a/Common/OpenSim.Framework/Types/AgentWearable.cs b/Common/OpenSim.Framework/Types/AgentWearable.cs new file mode 100644 index 0000000000..b7fbe3c493 --- /dev/null +++ b/Common/OpenSim.Framework/Types/AgentWearable.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Framework.Types +{ + public class AvatarWearable + { + public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); + public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); + + public AvatarWearable() + { + + } + } +} diff --git a/OpenGridServices.sln b/OpenGridServices.sln index 641f710e01..bc21256417 100644 --- a/OpenGridServices.sln +++ b/OpenGridServices.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +# Visual C# Express 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenUser.Config.UserConfigDb4o", "OpenGridServices\OpenUser.Config\UserConfigDb4o\OpenUser.Config.UserConfigDb4o.csproj", "{7E494328-0000-0000-0000-000000000000}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGridServices.AssetServer", "OpenGridServices\OpenGridServices.AssetServer\OpenGridServices.AssetServer.csproj", "{0021261B-0000-0000-0000-000000000000}" @@ -25,70 +25,61 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data.MySQL", "OpenGridServices\OpenGrid.Framework.Data.MySQL\OpenGrid.Framework.Data.MySQL.csproj", "{0F3C3AC1-0000-0000-0000-000000000000}" EndProject Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - ({1E3F341A-0000-0000-0000-000000000000}).4 = ({62CDF671-0000-0000-0000-000000000000}) - ({39BD9497-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000}) - ({21BFC8E2-0000-0000-0000-000000000000}).6 = ({62CDF671-0000-0000-0000-000000000000}) - ({21BFC8E2-0000-0000-0000-000000000000}).7 = ({7924FD35-0000-0000-0000-000000000000}) - ({0A563AC1-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000}) - ({66591469-0000-0000-0000-000000000000}).5 = ({62CDF671-0000-0000-0000-000000000000}) - ({0F3C3AC1-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000}) - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E494328-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E494328-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0021261B-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0021261B-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B0027747-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B0027747-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {66591469-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {66591469-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {66591469-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {66591469-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E494328-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E494328-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0021261B-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0021261B-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0027747-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0027747-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {66591469-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66591469-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66591469-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66591469-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection EndGlobal diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj b/OpenGridServices/ServiceManager/ServiceManager.csproj index 54d31b2f8d..392f56020d 100644 --- a/OpenGridServices/ServiceManager/ServiceManager.csproj +++ b/OpenGridServices/ServiceManager/ServiceManager.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {E141F4EE-0000-0000-0000-000000000000} Debug AnyCPU - + + ServiceManager @@ -15,9 +16,11 @@ IE50 false Exe - + + ServiceManager - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,18 +61,19 @@ False False 4 - + + - + System.dll False - + System.ServiceProcess.dll False - + System.Xml.dll False @@ -75,7 +82,7 @@ - Code + Component @@ -85,4 +92,4 @@ - + \ No newline at end of file diff --git a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 54be853a0a..69f5915739 100644 --- a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -49,11 +49,7 @@ namespace OpenSim.Physics.BasicPhysicsPlugin public PhysicsScene GetScene() { - if(_mScene == null) - { - _mScene = new BasicScene(); - } - return(_mScene); + return new BasicScene(); } public string GetName() diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs index 579928c0cc..55ff8a195a 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Inventory; +using OpenSim.Framework.Types; using libsecondlife; using libsecondlife.Packets; @@ -32,6 +33,8 @@ namespace OpenSim public event UpdatePrimVector OnUpdatePrimScale; public event StatusChange OnChildAgentStatus; public event GenericCall2 OnStopMovement; + public event NewAvatar OnNewAvatar; + public event GenericCall6 OnRemoveAvatar; public LLVector3 StartPos { @@ -70,7 +73,7 @@ namespace OpenSim this.OutPacket(reply); } - public void SendAppearance(AvatarWearable[] wearables) + public void SendWearables(AvatarWearable[] wearables) { AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); aw.AgentData.AgentID = this.AgentID; @@ -90,6 +93,199 @@ namespace OpenSim this.OutPacket(aw); } + + public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) + { + AvatarAppearancePacket avp = new AvatarAppearancePacket(); + avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; + avp.ObjectData.TextureEntry = textureEntry; + + AvatarAppearancePacket.VisualParamBlock avblock = null; + for (int i = 0; i < 218; i++) + { + avblock = new AvatarAppearancePacket.VisualParamBlock(); + avblock.ParamValue = visualParams[i]; + avp.VisualParam[i] = avblock; + } + + avp.Sender.IsTrial = false; + avp.Sender.ID = agentID; + OutPacket(avp); + } + + /// + /// Send the region heightmap to the client + /// + /// heightmap + public virtual void SendLayerData(float[] map) + { + try + { + int[] patches = new int[4]; + + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x = x + 4) + { + patches[0] = x + 0 + y * 16; + patches[1] = x + 1 + y * 16; + patches[2] = x + 2 + y * 16; + patches[3] = x + 3 + y * 16; + + Packet layerpack = TerrainManager.CreateLandPacket(map, patches); + OutPacket(layerpack); + } + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString()); + } + } + + /// + /// Sends a specified patch to a client + /// + /// Patch coordinate (x) 0..16 + /// Patch coordinate (y) 0..16 + /// heightmap + public void SendLayerData(int px, int py, float[] map) + { + try + { + int[] patches = new int[1]; + int patchx, patchy; + patchx = px / 16; + patchy = py / 16; + + patches[0] = patchx + 0 + patchy * 16; + + Packet layerpack = TerrainManager.CreateLandPacket(map, patches); + OutPacket(layerpack); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); + } + } + + public void SendRegionHandshake(RegionInfo regionInfo) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + RegionHandshakePacket handshake = new RegionHandshakePacket(); + + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details"); + handshake.RegionInfo.BillableFactor = 0; + handshake.RegionInfo.IsEstateManager = false; + handshake.RegionInfo.TerrainHeightRange00 = regionInfo.TerrainHeightRange00; + handshake.RegionInfo.TerrainHeightRange01 = regionInfo.TerrainHeightRange01; + handshake.RegionInfo.TerrainHeightRange10 = regionInfo.TerrainHeightRange10; + handshake.RegionInfo.TerrainHeightRange11 = regionInfo.TerrainHeightRange11; + handshake.RegionInfo.TerrainStartHeight00 = regionInfo.TerrainStartHeight00; + handshake.RegionInfo.TerrainStartHeight01 = regionInfo.TerrainStartHeight01; + handshake.RegionInfo.TerrainStartHeight10 = regionInfo.TerrainStartHeight10; + handshake.RegionInfo.TerrainStartHeight11 = regionInfo.TerrainStartHeight11; + handshake.RegionInfo.SimAccess = 13; + handshake.RegionInfo.WaterHeight = regionInfo.RegionWaterHeight; + uint regionFlags = 72458694; + if (regionInfo.RegionTerraform) + { + regionFlags -= 64; + } + handshake.RegionInfo.RegionFlags = regionFlags; + handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0"); + handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); + handshake.RegionInfo.TerrainBase0 = regionInfo.TerrainBase0; + handshake.RegionInfo.TerrainBase1 = regionInfo.TerrainBase1; + handshake.RegionInfo.TerrainBase2 = regionInfo.TerrainBase2; + handshake.RegionInfo.TerrainBase3 = regionInfo.TerrainBase3; + handshake.RegionInfo.TerrainDetail0 = regionInfo.TerrainDetail0; + handshake.RegionInfo.TerrainDetail1 = regionInfo.TerrainDetail1; + handshake.RegionInfo.TerrainDetail2 = regionInfo.TerrainDetail2; + handshake.RegionInfo.TerrainDetail3 = regionInfo.TerrainDetail3; + handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); + + OutPacket(handshake); + } + + public void SendAvatarData(RegionInfo regionInfo, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos) + { + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + //send a objectupdate packet with information about the clients avatar + + ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); + objupdate.RegionData.RegionHandle = regionInfo.RegionHandle; + objupdate.RegionData.TimeDilation = 64096; + objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; + objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(); + //give this avatar object a local id and assign the user a name + + objupdate.ObjectData[0].ID = avatarLocalID; + objupdate.ObjectData[0].FullID = avatarID; + objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName + " \0"); + libsecondlife.LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); + byte[] pb = pos2.GetBytes(); + Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); + + OutPacket(objupdate); + + } + + protected void SetDefaultPacketValues(ref 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[76]; + objdata.ObjectData[15] = 128; + objdata.ObjectData[16] = 63; + objdata.ObjectData[56] = 128; + objdata.ObjectData[61] = 102; + objdata.ObjectData[62] = 40; + objdata.ObjectData[63] = 61; + objdata.ObjectData[64] = 189; + } + + protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket() + { + libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); + + SetDefaultPacketValues(ref objdata); + 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; + objdata.ID = 8880000; + objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); + libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100f, 23f); + //objdata.FullID=user.AgentID; + byte[] pb = pos.GetBytes(); + Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); + + return objdata; + } #endregion } diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs index 0419b7acf6..4d1634cb96 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.cs @@ -52,12 +52,16 @@ namespace OpenSim /// public partial class ClientView : ClientViewBase, IClientAPI { + public static TerrainManager TerrainManager; + protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients protected Dictionary m_packetHandlers = new Dictionary(); //local handlers for this instance public LLUUID AgentID; public LLUUID SessionID; public LLUUID SecureSessionID = LLUUID.Zero; + public string FirstName; + public string LastName; public bool m_child = false; private UseCircuitCodePacket cirpack; public Thread ClientThread; @@ -112,13 +116,9 @@ namespace OpenSim { OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent"); this.m_child = false; - //this.m_world.RemoveViewerAgent(this); - this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); - OnChildAgentStatus(this.m_child); - //this.InitNewClient(); } public void DowngradeClient() @@ -126,8 +126,7 @@ namespace OpenSim OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child"); this.m_child = true; OnChildAgentStatus(this.m_child); - //this.m_world.RemoveViewerAgent(this); - //this.m_world.AddViewerAgent(this); + } public void KillClient() @@ -230,8 +229,8 @@ namespace OpenSim protected virtual void InitNewClient() { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); - // this.ClientAvatar = m_world.AddViewerAgent(this); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); + OnNewAvatar(this, this.AgentID, this.m_child); } protected virtual void AuthUser() @@ -251,13 +250,14 @@ namespace OpenSim this.AgentID = cirpack.CircuitCode.ID; this.SessionID = cirpack.CircuitCode.SessionID; this.CircuitCode = cirpack.CircuitCode.Code; - InitNewClient(); - //this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; - // this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; + this.FirstName = sessionInfo.LoginInfo.First; + this.LastName = sessionInfo.LoginInfo.Last; + if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) { this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; } + InitNewClient(); ClientLoop(); } diff --git a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs index 7f18d34638..3b9c6e09e3 100644 --- a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs +++ b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs @@ -46,7 +46,7 @@ namespace OpenSim protected List regionData = new List(); protected List m_localWorld = new List(); protected BaseHttpServer httpServer; - protected AuthenticateSessionsBase AuthenticateSessionsHandler; + protected List AuthenticateSessionsHandler = new List(); protected ConsoleBase m_console; diff --git a/OpenSim/OpenSim.RegionServer/VersionInfo.cs b/OpenSim/OpenSim.RegionServer/VersionInfo.cs index 38b6685171..686024eec3 100644 --- a/OpenSim/OpenSim.RegionServer/VersionInfo.cs +++ b/OpenSim/OpenSim.RegionServer/VersionInfo.cs @@ -32,6 +32,6 @@ namespace OpenSim /// public class VersionInfo { - public static string Version = "0.2, SVN build "; + public static string Version = "0.3, SVN build "; } } diff --git a/OpenSim/OpenSim.World/Avatar.cs b/OpenSim/OpenSim.World/Avatar.cs index 551283a286..77c18bfd7d 100644 --- a/OpenSim/OpenSim.World/Avatar.cs +++ b/OpenSim/OpenSim.World/Avatar.cs @@ -7,6 +7,7 @@ using libsecondlife.Packets; using OpenSim.Physics.Manager; using OpenSim.Framework.Inventory; using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; using Axiom.MathLib; namespace OpenSim.world @@ -40,13 +41,13 @@ namespace OpenSim.world public Avatar(IClientAPI TheClient, World world, string regionName, Dictionary clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) { m_world = world; - // m_clientThreads = clientThreads; + // m_clientThreads = clientThreads; m_regionName = regionName; m_regionHandle = regionHandle; m_regionTerraform = regionTerraform; m_regionWaterHeight = regionWater; - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Avatar.cs - Loading details from grid (DUMMY)"); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Avatar.cs - Loading details from grid (DUMMY)"); ControllingClient = TheClient; localid = 8880000 + (this.m_world._localNumber++); Pos = ControllingClient.StartPos; @@ -65,6 +66,7 @@ namespace OpenSim.world this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); + /* //register for events ControllingClient.OnRequestWearables += new GenericCall(this.SendOurAppearance); ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); @@ -74,6 +76,7 @@ namespace OpenSim.world ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); + * */ } public PhysicsActor PhysActor @@ -90,29 +93,29 @@ namespace OpenSim.world public void ChildStatusChange(bool status) { - + } public override void addForces() { - + } public static void SetupTemplate(string name) { - + } protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) { - + } public void CompleteMovement() { - + } public void HandleAgentUpdate(Packet pack) @@ -122,35 +125,36 @@ namespace OpenSim.world public void HandleUpdate(AgentUpdatePacket pack) { - + } //really really should be moved somewhere else (RegionInfo.cs ?) public void SendRegionHandshake(World regionInfo) { - + } public static void LoadAnims() { - + } public override void LandRenegerated() { - + } - } - public class NewForce - { - public float X; - public float Y; - public float Z; - public NewForce() + public class NewForce { + public float X; + public float Y; + public float Z; + public NewForce() + { + + } } } diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs index 2580761852..8c8c2a620d 100644 --- a/OpenSim/OpenSim.World/World.cs +++ b/OpenSim/OpenSim.World/World.cs @@ -501,15 +501,14 @@ namespace OpenSim.world #region Add/Remove Avatar Methods - public override bool AddNewAvatar(IClientAPI agentClient, bool child) + public override void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child) { - - return false; + return ; } - public override bool RemoveAvatar(LLUUID agentID) + public override void RemoveAvatar(LLUUID agentID) { - return false; + return ; } #endregion diff --git a/OpenSim/OpenSim.World/WorldBase.cs b/OpenSim/OpenSim.World/WorldBase.cs index 33952bfe11..f8a4eda1fe 100644 --- a/OpenSim/OpenSim.World/WorldBase.cs +++ b/OpenSim/OpenSim.World/WorldBase.cs @@ -137,14 +137,14 @@ namespace OpenSim.world #endregion #region Add/Remove Agent/Avatar - public virtual bool AddNewAvatar(IClientAPI remoteClient, bool child) + public virtual void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child) { - return false; + return ; } - public virtual bool RemoveAvatar(LLUUID agentID) + public virtual void RemoveAvatar(LLUUID agentID) { - return false; + return ; } #endregion diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index aa41aeb8a9..22a5799380 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -96,18 +96,12 @@ namespace OpenSim if (m_sandbox) { this.SetupLocalGridServers(); - //Authenticate Session Handler - AuthenticateSessionsLocal authen = new AuthenticateSessionsLocal(); - this.AuthenticateSessionsHandler = authen; this.checkServer = new CheckSumServer(12036); this.checkServer.ServerListener(); } else { this.SetupRemoteGridServers(); - //Authenticate Session Handler - AuthenticateSessionsRemote authen = new AuthenticateSessionsRemote(); - this.AuthenticateSessionsHandler = authen; } startuptime = DateTime.Now; @@ -129,7 +123,7 @@ namespace OpenSim { loginServer = new LoginServer(regionData[0].IPListenAddr, regionData[0].IPListenPort, regionData[0].RegionLocX, regionData[0].RegionLocY, this.user_accounts); loginServer.Startup(); - loginServer.SetSessionHandler(((AuthenticateSessionsLocal)this.AuthenticateSessionsHandler).AddNewSession); + loginServer.SetSessionHandler(((AuthenticateSessionsLocal)this.AuthenticateSessionsHandler[0]).AddNewSession); //sandbox mode with loginserver not using accounts httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); @@ -187,18 +181,46 @@ namespace OpenSim World LocalWorld; UDPServer udpServer; RegionInfo regionDat = new RegionInfo(); + AuthenticateSessionsBase authenBase; string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Regions"); - string[] pluginFiles = Directory.GetFiles(path, "*.xml"); + string[] configFiles = Directory.GetFiles(path, "*.xml"); - for (int i = 0; i < pluginFiles.Length; i++) + if (configFiles.Length == 0) { - regionConfig = new XmlConfig(pluginFiles[i]); + string path2 = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Regions"); + string path3 = Path.Combine(path2, "default.xml"); + Console.WriteLine("Creating default region config file"); + //TODO create default region + IGenericConfig defaultConfig = new XmlConfig(path3); + defaultConfig.LoadData(); + defaultConfig.Commit(); + defaultConfig.Close(); + defaultConfig = null; + configFiles = Directory.GetFiles(path, "*.xml"); + } + + for (int i = 0; i < configFiles.Length; i++) + { + if (m_sandbox) + { + AuthenticateSessionsLocal authen = new AuthenticateSessionsLocal(); + this.AuthenticateSessionsHandler.Add(authen); + authenBase = authen; + } + else + { + AuthenticateSessionsRemote authen = new AuthenticateSessionsRemote(); + this.AuthenticateSessionsHandler.Add (authen); + authenBase = authen; + } + Console.WriteLine("Loading region config file"); + regionConfig = new XmlConfig(configFiles[i]); regionConfig.LoadData(); regionDat.InitConfig(this.m_sandbox, regionConfig); regionConfig.Close(); - udpServer = new UDPServer(regionDat.IPListenPort, this.AssetCache, this.InventoryCache, this.m_console, this.AuthenticateSessionsHandler); + udpServer = new UDPServer(regionDat.IPListenPort, this.AssetCache, this.InventoryCache, this.m_console, authenBase); m_udpServer.Add(udpServer); this.regionData.Add(regionDat); @@ -223,6 +245,8 @@ namespace OpenSim LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); LocalWorld.LoadPrimsFromStorage(); + + LocalWorld.StartTimer(); } } @@ -234,7 +258,7 @@ namespace OpenSim { // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server - httpServer.AddXmlRPCHandler("expect_user", ((AuthenticateSessionsRemote)this.AuthenticateSessionsHandler).ExpectUser); + httpServer.AddXmlRPCHandler("expect_user", ((AuthenticateSessionsRemote)this.AuthenticateSessionsHandler[0]).ExpectUser); httpServer.AddXmlRPCHandler("agent_crossing", delegate(XmlRpcRequest request) @@ -248,7 +272,7 @@ namespace OpenSim agent_data.circuitcode = circuitcode; agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"])); - AuthenticateSessionsHandler.UpdateAgentData(agent_data); + AuthenticateSessionsHandler[0].UpdateAgentData(agent_data); return new XmlRpcResponse(); });