From bcb9ab29d7181360c2feb618867606d8c1e47ed6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 8 May 2020 17:00:43 +0100 Subject: [PATCH] SampleMoneyModule: suport viewers new opensimextra currency-base-uri sim feature override for helperURI (that we call economy on some ini files, just because) --- .../World/MoneyModule/SampleMoneyModule.cs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index b93c7585a1..ebb650a750 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -35,6 +35,7 @@ using Nini.Config; using Nwc.XmlRpc; using Mono.Addins; using OpenMetaverse; +using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; @@ -66,6 +67,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule // private UUID EconomyBaseAccount = UUID.Zero; private Dictionary m_rpcHandlers; + private string m_economyURL; private float EnergyEfficiency = 1f; // private ObjectPaid handerOnObjectPaid; @@ -140,12 +142,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule { if (m_scenel.Count == 0) { - // XMLRPCHandler = scene; - - // To use the following you need to add: - // -helperuri
- // to the command line parameters you use to start up your client - // This commonly looks like -helperuri http://127.0.0.1:9000/ + m_economyURL = scene.RegionInfo.ServerURI; m_rpcHandlers = new Dictionary(); @@ -174,7 +171,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule scene.EventManager.OnClientClosed += ClientClosed; scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; scene.EventManager.OnMakeChildAgent += MakeChildAgent; - scene.EventManager.OnClientClosed += ClientLoggedOut; scene.EventManager.OnValidateLandBuy += ValidateLandBuy; scene.EventManager.OnLandBuy += processLandBuy; } @@ -186,6 +182,14 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule public void RegionLoaded(Scene scene) { + if (!m_enabled) + return; + + if (!string.IsNullOrWhiteSpace(m_economyURL)) + { + ISimulatorFeaturesModule fm = scene.RequestModuleInterface(); + fm?.AddOpenSimExtraFeature("currency-base-uri", m_economyURL); + } } public void processPHP(IOSHttpRequest request, IOSHttpResponse response) @@ -313,7 +317,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule client.OnMoneyBalanceRequest += SendMoneyBalance; client.OnRequestPayPrice += requestPayPrice; client.OnObjectBuy += ObjectBuy; - client.OnLogout += ClientClosed; + client.OnLogout += ClientLoggedOut; } /// @@ -768,7 +772,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule /// Event Handler for when the client logs out. /// /// - private void ClientLoggedOut(UUID AgentId, Scene scene) + private void ClientLoggedOut(IClientAPI client) { }