From d7b2beea1826345e3b5b93ca0aea52629190ca3c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 11 May 2009 18:23:39 +0000 Subject: Add selling for $0 back to the sample economy module. This is disabled by default but can be enabled in OpenSim.ini. If enabled, things can be sold for $0. Other amounts will cause the buyer to see a message and the transaction will fail. --- .../MoneyModule/SampleMoneyModule.cs | 30 ++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ReplaceableModules/MoneyModule/SampleMoneyModule.cs') diff --git a/OpenSim/Region/ReplaceableModules/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/ReplaceableModules/MoneyModule/SampleMoneyModule.cs index 043c110..cd68541 100644 --- a/OpenSim/Region/ReplaceableModules/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/ReplaceableModules/MoneyModule/SampleMoneyModule.cs @@ -64,6 +64,7 @@ namespace OpenSim.Region.ReplaceableModules.MoneyModule private bool gridmode = false; // private ObjectPaid handerOnObjectPaid; private bool m_enabled = true; + private bool m_sellEnabled = false; private IConfigSource m_gConfig; @@ -244,13 +245,7 @@ namespace OpenSim.Region.ReplaceableModules.MoneyModule PriceObjectScaleFactor = startupConfig.GetFloat("PriceObjectScaleFactor", 10); PriceParcelRent = startupConfig.GetInt("PriceParcelRent", 1); PriceGroupCreate = startupConfig.GetInt("PriceGroupCreate", -1); - // string EBA = startupConfig.GetString("EconomyBaseAccount", UUID.Zero.ToString()); - // Helpers.TryParse(EBA, out EconomyBaseAccount); - - // UserLevelPaysFees = startupConfig.GetInt("UserLevelPaysFees", -1); - m_stipend = startupConfig.GetInt("UserStipend", 1000); - - // m_LandAddress = startupConfig.GetString("LandServer", String.Empty); + m_sellEnabled = startupConfig.GetBoolean("SellEnabled", false); } // Send ObjectCapacity to Scene.. Which sends it to the SimStatsReporter. @@ -819,7 +814,26 @@ namespace OpenSim.Region.ReplaceableModules.MoneyModule UUID sessionID, UUID groupID, UUID categoryID, uint localID, byte saleType, int salePrice) { - remoteClient.SendBlueBoxMessage(UUID.Zero, "", "Buying is not implemented in this version"); + if (!m_sellEnabled) + { + remoteClient.SendBlueBoxMessage(UUID.Zero, "", "Buying is not implemented in this version"); + return; + } + + if (salePrice != 0) + { + remoteClient.SendBlueBoxMessage(UUID.Zero, "", "Buying anything for a price other than zero is not implemented"); + return; + } + + Scene s = LocateSceneClientIn(remoteClient.AgentId); + SceneObjectPart part = s.GetSceneObjectPart(localID); + if (part == null) + { + remoteClient.SendAgentAlertMessage("Unable to buy now. The object was not found.", false); + return; + } + s.PerformObjectBuy(remoteClient, categoryID, localID, saleType); } } -- cgit v1.1