GetConfig() private method

private GetConfig ( ) : BaseCurrencyConfig
return BaseCurrencyConfig
Exemplo n.º 1
0
        public XmlRpcResponse LandBuyFunc(XmlRpcRequest request, IPEndPoint ep)
        {
            Hashtable requestData = (Hashtable)request.Params[0];

            bool success = false;

            if (requestData.ContainsKey("agentId") && requestData.ContainsKey("currencyBuy") &&
                m_connector.GetConfig().CanBuyCurrencyInworld)
            {
                UUID agentId;
                if (UUID.TryParse((string)requestData["agentId"], out agentId))
                {
                    uint amountBuying = uint.Parse(requestData["currencyBuy"].ToString());
                    m_connector.UserCurrencyTransfer(agentId, UUID.Zero, amountBuying,
                                                     "Inworld purchase", TransactionType.SystemGenerated, UUID.Zero);
                    success = true;
                }
            }
            XmlRpcResponse returnval  = new XmlRpcResponse();
            Hashtable      returnresp = new Hashtable {
                { "success", success }
            };

            returnval.Value = returnresp;
            return(returnval);
        }
        public void Start (IConfigSource config, IRegistryCore registry)
        {
            if (config.Configs ["Currency"] == null ||
                config.Configs ["Currency"].GetString ("Module", "") != "BaseCurrency")
                return;

            // we only want this if we are local..
            bool remoteCalls = false;
            IConfig connectorConfig = config.Configs ["UniverseConnectors"];
            if ((connectorConfig != null) && connectorConfig.Contains ("DoRemoteCalls"))
                remoteCalls = connectorConfig.GetBoolean ("DoRemoteCalls", false);

            if (remoteCalls)
                return;

            m_connector = Framework.Utilities.DataManager.RequestPlugin<IBaseCurrencyConnector> () as BaseCurrencyConnector;
            var curPort = m_connector.GetConfig ().ClientPort;
            if (curPort == 0 && MainServer.Instance == null)
                return;

            IHttpServer server = registry.RequestModuleInterface<ISimulationBase> ().GetHttpServer ((uint)curPort);
            server.AddXmlRPCHandler ("getCurrencyQuote", QuoteFunc);
            server.AddXmlRPCHandler ("buyCurrency", BuyFunc);
            server.AddXmlRPCHandler ("preflightBuyLandPrep", PreflightBuyLandPrepFunc);
            server.AddXmlRPCHandler ("buyLandPrep", LandBuyFunc);
            server.AddXmlRPCHandler ("getBalance", GetbalanceFunc);
            server.AddXmlRPCHandler ("/currency.php", GetbalanceFunc);
            server.AddXmlRPCHandler ("/landtool.php", GetbalanceFunc);

            m_syncMessagePoster = registry.RequestModuleInterface<ISyncMessagePosterService> ();
            m_agentInfoService = registry.RequestModuleInterface<IAgentInfoService> ();
        }
Exemplo n.º 3
0
        public void FinishedStartup()
        {
            if (m_registry == null)
            {
                return;
            }

            m_registry.RegisterModuleInterface <IMoneyModule>(this);

            ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager>();

            if (manager != null)
            {
                manager.OnAddedScene += (scene) =>
                {
                    m_scenes.Add(scene);
                    scene.EventManager.OnNewClient       += OnNewClient;
                    scene.EventManager.OnClosingClient   += OnClosingClient;
                    scene.EventManager.OnMakeRootAgent   += OnMakeRootAgent;
                    scene.EventManager.OnValidateBuyLand += EventManager_OnValidateBuyLand;
                    scene.RegisterModuleInterface <IMoneyModule>(this);
                };
                manager.OnCloseScene += (scene) =>
                {
                    scene.EventManager.OnNewClient       -= OnNewClient;
                    scene.EventManager.OnClosingClient   -= OnClosingClient;
                    scene.EventManager.OnMakeRootAgent   -= OnMakeRootAgent;
                    scene.EventManager.OnValidateBuyLand -= EventManager_OnValidateBuyLand;
                    scene.RegisterModuleInterface <IMoneyModule>(this);
                    m_scenes.Remove(scene);
                };
            }


            if (!m_connector.DoRemoteCalls)
            {
                if ((m_connector.GetConfig().GiveStipends) && (m_connector.GetConfig().Stipend > 0))
                {
                    new GiveStipends(m_connector.GetConfig(), m_registry, m_connector);
                }
            }
        }
Exemplo n.º 4
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            if (config.Configs["Currency"] == null ||
                config.Configs["Currency"].GetString("Module", "") != "SimpleCurrency")
            {
                return;
            }

            // we only want this if we are local..
            bool    remoteCalls     = false;
            IConfig connectorConfig = config.Configs["UniverseConnectors"];

            if ((connectorConfig != null) && connectorConfig.Contains("DoRemoteCalls"))
            {
                remoteCalls = connectorConfig.GetBoolean("DoRemoteCalls", false);
            }

            if (remoteCalls)
            {
                return;
            }

            m_connector = Framework.Utilities.DataManager.RequestPlugin <ISimpleCurrencyConnector>() as BaseCurrencyConnector;
            var curPort = m_connector.GetConfig().ClientPort;

            if (curPort == 0 && MainServer.Instance == null)
            {
                return;
            }

            IHttpServer server = registry.RequestModuleInterface <ISimulationBase>().GetHttpServer((uint)curPort);

            server.AddXmlRPCHandler("getCurrencyQuote", QuoteFunc);
            server.AddXmlRPCHandler("buyCurrency", BuyFunc);
            server.AddXmlRPCHandler("preflightBuyLandPrep", PreflightBuyLandPrepFunc);
            server.AddXmlRPCHandler("buyLandPrep", LandBuyFunc);
            server.AddXmlRPCHandler("getBalance", GetbalanceFunc);
            server.AddXmlRPCHandler("/currency.php", GetbalanceFunc);
            server.AddXmlRPCHandler("/landtool.php", GetbalanceFunc);

            m_syncMessagePoster = registry.RequestModuleInterface <ISyncMessagePosterService>();
            m_agentInfoService  = registry.RequestModuleInterface <IAgentInfoService>();
        }