From a8913141c081202eb1f988901a4ac0988bbd72a2 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 24 May 2011 16:03:01 -0400 Subject: Make client event handlers for money only work on root agents --- .../World/MoneyModule/SampleMoneyModule.cs | 36 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index b84a34d..952e797 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -177,9 +177,37 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule scene.EventManager.OnClientClosed += ClientLoggedOut; scene.EventManager.OnValidateLandBuy += ValidateLandBuy; scene.EventManager.OnLandBuy += processLandBuy; + scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; } } + void OnMakeRootAgent(ScenePresence presence) + { + // Do this only for root agents + // Some implementations register $$ for + // child agents, then that never goes away + // We will send a zero balance when they are + // made root. + // + // Modules overriding this should only deal with + // root agents as well. + // + IClientAPI client = presence.ControllingClient; + + client.OnEconomyDataRequest += EconomyDataRequestHandler; + client.OnMoneyBalanceRequest += SendMoneyBalance; + client.OnRequestPayPrice += requestPayPrice; + client.OnObjectBuy += ObjectBuy; + client.OnLogout += ClientClosed; + + client.SendMoneyBalance (UUID.Random(), true, new byte[0], 0); + } + + void HandleSceneEventManagerOnMakeRootAgent (ScenePresence presence) + { + + } + public void RemoveRegion(Scene scene) { } @@ -277,13 +305,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule private void OnNewClient(IClientAPI client) { GetClientFunds(client); + // Moved the event registrations to fire them when + // the agent becomes root - // Subscribe to Money messages - client.OnEconomyDataRequest += EconomyDataRequestHandler; - client.OnMoneyBalanceRequest += SendMoneyBalance; - client.OnRequestPayPrice += requestPayPrice; - client.OnObjectBuy += ObjectBuy; - client.OnLogout += ClientClosed; } /// -- cgit v1.1 From ef3f6b4e63a49430bebbc929cb61d018a0a0d37c Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 24 May 2011 16:33:51 -0400 Subject: Revert "Make client event handlers for money only work on root agents" This reverts commit a8913141c081202eb1f988901a4ac0988bbd72a2. Pulling this back until some testing under various money modules can be done. Need to be able to make purchases as a child agent. --- .../World/MoneyModule/SampleMoneyModule.cs | 36 ++++------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 952e797..b84a34d 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -177,37 +177,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule scene.EventManager.OnClientClosed += ClientLoggedOut; scene.EventManager.OnValidateLandBuy += ValidateLandBuy; scene.EventManager.OnLandBuy += processLandBuy; - scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; } } - void OnMakeRootAgent(ScenePresence presence) - { - // Do this only for root agents - // Some implementations register $$ for - // child agents, then that never goes away - // We will send a zero balance when they are - // made root. - // - // Modules overriding this should only deal with - // root agents as well. - // - IClientAPI client = presence.ControllingClient; - - client.OnEconomyDataRequest += EconomyDataRequestHandler; - client.OnMoneyBalanceRequest += SendMoneyBalance; - client.OnRequestPayPrice += requestPayPrice; - client.OnObjectBuy += ObjectBuy; - client.OnLogout += ClientClosed; - - client.SendMoneyBalance (UUID.Random(), true, new byte[0], 0); - } - - void HandleSceneEventManagerOnMakeRootAgent (ScenePresence presence) - { - - } - public void RemoveRegion(Scene scene) { } @@ -305,9 +277,13 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule private void OnNewClient(IClientAPI client) { GetClientFunds(client); - // Moved the event registrations to fire them when - // the agent becomes root + // Subscribe to Money messages + client.OnEconomyDataRequest += EconomyDataRequestHandler; + client.OnMoneyBalanceRequest += SendMoneyBalance; + client.OnRequestPayPrice += requestPayPrice; + client.OnObjectBuy += ObjectBuy; + client.OnLogout += ClientClosed; } /// -- cgit v1.1 From e398c33648dabca1b7243214e3faa1e36f8cf024 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 25 May 2011 12:17:46 +0100 Subject: Add PayPrice to serialization format Xml2 --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 +++--- .../Scenes/Serialization/SceneObjectSerializer.cs | 37 +++++++++++++++++++++- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8a8a699..331abb2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -144,11 +144,10 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 StatusSandboxPos; - // TODO: This needs to be persisted in next XML version update! - - public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; - - + [XmlIgnore] + public int[] PayPrice = {-2,-2,-2,-2,-2}; + + [XmlIgnore] public PhysicsActor PhysActor { get { return m_physActor; } diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index bb8a83a..872816c 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -341,6 +341,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); + m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0); + m_SOPXmlProcessors.Add("PayPrice1", ProcessPayPrice1); + m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); + m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); + m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); #endregion #region TaskInventoryXmlProcessors initialization @@ -698,6 +703,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); } + + private static void ProcessPayPrice0(SceneObjectPart obj, XmlTextReader reader) + { + obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty); + } + + private static void ProcessPayPrice1(SceneObjectPart obj, XmlTextReader reader) + { + obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty); + } + + private static void ProcessPayPrice2(SceneObjectPart obj, XmlTextReader reader) + { + obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty); + } + + private static void ProcessPayPrice3(SceneObjectPart obj, XmlTextReader reader) + { + obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty); + } + + private static void ProcessPayPrice4(SceneObjectPart obj, XmlTextReader reader) + { + obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); + } + #endregion #region TaskInventoryXmlProcessors @@ -1069,7 +1100,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); } - #endregion ////////// Write ///////// @@ -1175,6 +1205,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); + writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString()); + writer.WriteElementString("PayPrice1", sop.PayPrice[1].ToString()); + writer.WriteElementString("PayPrice2", sop.PayPrice[2].ToString()); + writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); + writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); writer.WriteEndElement(); } -- cgit v1.1