From f22e27498e5e7fa2c0eee1e45a89dd0e107e57f9 Mon Sep 17 00:00:00 2001 From: mingchen Date: Sun, 3 Jun 2007 16:02:08 +0000 Subject: Added Basic Parcel Support *Created Parcel class to handle each parcel *Created ParcelManager class to handle the Parcel Object *For now, by default it is assigned to a fake avatar key and set for sale to L$0 --- .../ClientView.ProcessPackets.cs | 40 +- OpenSim/OpenSim.RegionServer/ClientView.cs | 4 +- OpenSim/OpenSim.RegionServer/ClientViewBase.cs | 2 + .../OpenSim.RegionServer.csproj | 519 +++++++++++---------- OpenSim/OpenSim.RegionServer/RegionInfo.cs | 15 + OpenSim/OpenSim.RegionServer/RegionInfoBase.cs | 1 + .../world/World.PacketHandlers.cs | 24 + OpenSim/OpenSim.RegionServer/world/World.cs | 8 + 8 files changed, 353 insertions(+), 260 deletions(-) (limited to 'OpenSim/OpenSim.RegionServer') diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs index 7340bea..a5ab78a 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs @@ -32,6 +32,7 @@ namespace OpenSim public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient); public delegate void StatusChange(bool status); + public event ChatFromViewer OnChatFromViewer; public event RezObject OnRezObject; public event GenericCall4 OnDeRezObject; @@ -53,18 +54,21 @@ namespace OpenSim public event UpdatePrimRotation OnUpdatePrimRotation; public event UpdatePrimVector OnUpdatePrimScale; public event StatusChange OnChildAgentStatus; + public event ParcelPropertiesRequest OnParcelPropertiesRequest; protected override void ProcessInPacket(Packet Pack) { ack_pack(Pack); + debug = true; if (debug) { if (Pack.Type != PacketType.AgentUpdate) { - Console.WriteLine(Pack.Type.ToString()); + Console.WriteLine("IN: " + Pack.Type.ToString()); } } + if (this.ProcessPacketMethod(Pack)) { //there is a handler registered that handled this packet type @@ -447,6 +451,13 @@ namespace OpenSim break; #endregion + #region Parcel Packets + case PacketType.ParcelPropertiesRequest: + ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; + OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North),propertiesRequest.ParcelData.SequenceID,propertiesRequest.ParcelData.SnapSelection, this); + break; + #endregion + #region unimplemented handlers case PacketType.AgentIsNowWearing: // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; @@ -455,6 +466,33 @@ namespace OpenSim case PacketType.ObjectScale: //OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, Pack.ToString()); break; + case PacketType.MoneyBalanceRequest: + //This need to be actually done and not thrown back with fake info + MoneyBalanceRequestPacket incoming = (MoneyBalanceRequestPacket)Pack; + MoneyBalanceReplyPacket outgoing = new MoneyBalanceReplyPacket(); + outgoing.MoneyData.AgentID = incoming.AgentData.AgentID; + outgoing.MoneyData.MoneyBalance = 31337; + outgoing.MoneyData.SquareMetersCommitted = 0; + outgoing.MoneyData.SquareMetersCredit = 100000000; + outgoing.MoneyData.TransactionID = incoming.MoneyData.TransactionID; + outgoing.MoneyData.TransactionSuccess = true; + outgoing.MoneyData.Description = libsecondlife.Helpers.StringToField(""); + this.OutPacket((Packet)outgoing); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Sent Temporary Money packet (they have leet monies)"); + + break; + + case PacketType.EstateCovenantRequest: + //This should be actually done and not thrown back with fake info + EstateCovenantRequestPacket estateCovenantRequest = (EstateCovenantRequestPacket)Pack; + EstateCovenantReplyPacket estateCovenantReply = new EstateCovenantReplyPacket(); + estateCovenantReply.Data.EstateName = libsecondlife.Helpers.StringToField("Leet Estate"); + estateCovenantReply.Data.EstateOwnerID = LLUUID.Zero; + estateCovenantReply.Data.CovenantID = LLUUID.Zero; + estateCovenantReply.Data.CovenantTimestamp = (uint)0; + this.OutPacket((Packet)estateCovenantReply); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Sent Temporary Estate packet (they are in leet estate)"); + break; #endregion } } diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs index 295cd7b..51e5fd6 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.cs @@ -110,7 +110,6 @@ namespace OpenSim m_child = child; m_regionData = regionDat; m_authenticateSessionsHandler = authenSessions; - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs - Started up new client thread to handle incoming request"); cirpack = initialcirpack; userEP = remoteEP; @@ -135,6 +134,9 @@ namespace OpenSim this.RegisterLocalPacketHandlers(); + + m_world.parcelManager.sendParcelOverlay(this); + ClientThread = new Thread(new ThreadStart(AuthUser)); ClientThread.IsBackground = true; ClientThread.Start(); diff --git a/OpenSim/OpenSim.RegionServer/ClientViewBase.cs b/OpenSim/OpenSim.RegionServer/ClientViewBase.cs index 572dbce..3cba243 100644 --- a/OpenSim/OpenSim.RegionServer/ClientViewBase.cs +++ b/OpenSim/OpenSim.RegionServer/ClientViewBase.cs @@ -46,6 +46,8 @@ namespace OpenSim // Keep track of when this packet was sent out Pack.TickCount = Environment.TickCount; + //Console.WriteLine("OUT: " + Pack.Type.ToString()); + if (!Pack.Header.Resent) { // Set the sequence number diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj index 2848baf..52bd9d8 100644 --- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj +++ b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj @@ -1,258 +1,261 @@ - - - Local - 8.0.50727 - 2.0 - {58019DB8-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.RegionServer - JScript - Grid - IE50 - false - Library - - OpenSim.RegionServer - - - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ../../bin/ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ../../bin/ - False - False - False - 4 - - - - - System.dll - False - - - System.Xml.dll - False - - - ..\..\bin\libsecondlife.dll - False - - - ..\..\bin\Axiom.MathLib.dll - False - - - ..\..\bin\Db4objects.Db4o.dll - False - - - - - OpenSim.Terrain.BasicTerrain - {9CBFE2C1-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework - {7404933D-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {16759386-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.GenericConfig.Xml - {CAC10AC1-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Physics.Manager - {DA1FDCE5-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Servers - {111F9E8F-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - XMLRPC - {9A8B526E-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - + + + Local + 8.0.50727 + 2.0 + {632E1BFD-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.RegionServer + JScript + Grid + IE50 + false + Library + + OpenSim.RegionServer + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\bin\ + False + False + False + 4 + + + + + System.dll + False + + + System.Xml.dll + False + + + ..\..\bin\libsecondlife.dll + False + + + ..\..\bin\Axiom.MathLib.dll + False + + + ..\..\bin\Db4objects.Db4o.dll + False + + + + + OpenSim.Terrain.BasicTerrain + {2270B8FE-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.GenericConfig.Xml + {E88EF749-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Physics.Manager + {8BE16150-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Servers + {8BB20F0A-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + XMLRPC + {8E81D43C-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/OpenSim.RegionServer/RegionInfo.cs b/OpenSim/OpenSim.RegionServer/RegionInfo.cs index dc9bb1a..d0ce1ce 100644 --- a/OpenSim/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim/OpenSim.RegionServer/RegionInfo.cs @@ -26,6 +26,8 @@ namespace OpenSim public string UserRecvKey = ""; private bool isSandbox; + public string RegionOwnerName = ""; + public string DataStore; public RegionInfo() @@ -222,6 +224,19 @@ namespace OpenSim } + attri = ""; + attri = configData.GetAttribute("RegionOwnerName"); + if (attri == "") + { + string name = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Region Owner Avatar Name", "Test User"); + this.RegionOwnerName = name; + configData.SetAttribute("RegionOwnerName", this.RegionOwnerName); + } + else + { + this.RegionOwnerName = attri; + } + if (!isSandbox) { //shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object diff --git a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs b/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs index 6e4c110..54557db 100644 --- a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs +++ b/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs @@ -19,6 +19,7 @@ namespace OpenSim public ulong RegionHandle; public ushort RegionWaterHeight = 20; public bool RegionTerraform = true; + public LLUUID RegionOwner = new LLUUID(); public int IPListenPort; public string IPListenAddr; diff --git a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs index 4f32335..74b8e9d 100644 --- a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs +++ b/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs @@ -292,6 +292,30 @@ namespace OpenSim.world } } } + #region Parcel Packet Handlers + void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, ClientView remote_client) + { + //Get the parcels within the bounds + List temp = new List(); + int x, y; + int inc_x = end_x - start_x; + int inc_y = end_y - start_y; + for(x = 0; x < inc_x; x++) + { + for(y = 0; y < inc_y; y++) + { + Parcel currentParcel = parcelManager.getParcel(start_x + x,start_y + y); + if(!temp.Contains(currentParcel)) + { + temp.Add(currentParcel); + currentParcel.sendParcelProperties(sequence_id,snap_selection,remote_client); + } + } + } + + parcelManager.sendParcelOverlay(remote_client); + } + #endregion /* public void RequestMapBlock(ClientView simClient, int minX, int minY, int maxX, int maxY) diff --git a/OpenSim/OpenSim.RegionServer/world/World.cs b/OpenSim/OpenSim.RegionServer/world/World.cs index ad1ce30..d2a13ca 100644 --- a/OpenSim/OpenSim.RegionServer/world/World.cs +++ b/OpenSim/OpenSim.RegionServer/world/World.cs @@ -35,6 +35,7 @@ namespace OpenSim.world private Dictionary m_scripts; private Mutex updateLock; public string m_datastore; + public ParcelManager parcelManager; #region Properties public PhysicsScene PhysScene @@ -85,6 +86,8 @@ namespace OpenSim.world Avatar.LoadAnims(); this.SetDefaultScripts(); this.LoadScriptEngines(); + parcelManager = new ParcelManager(this); + } catch (Exception e) { @@ -564,6 +567,7 @@ namespace OpenSim.world agentClient.OnLinkObjects += new LinkObjects(this.LinkObjects); agentClient.OnAddPrim += new ClientView.GenericCall4(this.AddNewPrim); agentClient.OnUpdatePrimShape += new ClientView.UpdateShape(this.UpdatePrimShape); + agentClient.OnObjectSelect += new ClientView.ObjectSelect(this.SelectPrim); agentClient.OnUpdatePrimFlags += new ClientView.UpdatePrimFlags(this.UpdatePrimFlags); agentClient.OnUpdatePrimTexture += new ClientView.UpdatePrimTexture(this.UpdatePrimTexture); @@ -571,6 +575,8 @@ namespace OpenSim.world agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation); agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale); agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject); + + agentClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(ParcelPropertiesRequest); Avatar newAvatar = null; try { @@ -618,6 +624,8 @@ namespace OpenSim.world return newAvatar; } + + public override void RemoveViewerAgent(ClientView agentClient) { try -- cgit v1.1