A class for triggering remote scene events.
 bool ValidateLandBuy(EventManager.LandBuyArgs e)
 {
     return m_connector.UserCurrencyTransfer(e.parcelOwnerID, e.agentId,
                                             (uint) e.parcelPrice, "Land Purchase", TransactionType.LandSale,
                                             UUID.Random());
 }
        public void Initialize(RegionInfo regionInfo, ISimulationDataStore dataStore,
            AgentCircuitManager authen, List<IClientNetworkServer> clientServers)
        {
            Initialize(regionInfo);

            //Set up the clientServer
            m_clientServers = clientServers;
            foreach (IClientNetworkServer clientServer in clientServers)
                clientServer.AddScene(this);

            m_sceneManager = RequestModuleInterface<ISceneManager>();
            m_simDataStore = dataStore;

            m_config = m_sceneManager.ConfigSource;
            m_authenticateHandler = authen;

            m_UniverseEventManager = new UniverseEventManager();
            m_eventManager = new EventManager();
            m_permissions = new ScenePermissions(this);

            m_sceneGraph = new SceneGraph(this, m_regInfo);

            #region Region Config

            IConfig packetConfig = m_config.Configs["PacketPool"];
            if (packetConfig != null)
            {
                PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true);
                PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true);
            }

            #endregion Region Config

            m_basesimfps = 45f;
            m_basesimphysfps = 45f;

            m_basesimphysfps = Config.Configs["Physics"].GetFloat("BasePhysicsFPS", 45f);
            m_basesimfps = Config.Configs["Protection"].GetFloat("BaseRateFramesPerSecond", 45f);
            if (m_basesimphysfps > 45f)
                m_basesimphysfps = 45f;
            if (m_basesimfps > 45f)
                m_basesimfps = 45f;

            if (m_basesimphysfps > m_basesimfps)
                m_basesimphysfps = m_basesimfps;

            m_updatetimespan = 1000/m_basesimfps;
            m_physicstimespan = 1000/m_basesimphysfps;

            #region Startup Complete config

            EventManager.OnAddToStartupQueue += AddToStartupQueue;
            EventManager.OnModuleFinishedStartup += FinishedStartup;
            //EventManager.OnStartupComplete += StartupComplete;

            AddToStartupQueue("Startup");

            #endregion
        }
        bool EventManager_OnValidateBuyLand(EventManager.LandBuyArgs e)
        {
            IParcelManagementModule parcelManagement = GetSceneFor(e.agentId).RequestModuleInterface<IParcelManagementModule>();
            if (parcelManagement == null)
                return false;
            ILandObject lob = parcelManagement.GetLandObject(e.parcelLocalID);

            if (lob != null) {
                UUID AuthorizedID = lob.LandData.AuthBuyerID;
                int saleprice = lob.LandData.SalePrice;
                UUID pOwnerID = lob.LandData.OwnerID;

                bool landforsale = ((lob.LandData.Flags & (uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects)) != 0);
                if ((AuthorizedID == UUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice &&
                    landforsale) {
                    if (m_connector.UserCurrencyTransfer (lob.LandData.OwnerID, e.agentId, (uint)saleprice, "Land Buy", TransactionType.LandSale, UUID.Zero))
                    {
                        e.parcelOwnerID = pOwnerID;
                        e.landValidated = true;
                        return true;
                    }

                    // not validated
                    e.landValidated = false;

                }
            }
            return false;
        }
        // After receiving a land buy packet, first the data needs to
        // be validated. This method validates the right to buy the
        // parcel

        public bool EventManagerOnValidateLandBuy (EventManager.LandBuyArgs e)
        {
            if (!e.landValidated) {
                ILandObject lob = GetLandObject (e.parcelLocalID);

                if (lob != null) {
                    UUID AuthorizedID = lob.LandData.AuthBuyerID;
                    int saleprice = lob.LandData.SalePrice;
                    UUID pOwnerID = lob.LandData.OwnerID;

                    bool landforsale = (
                        (lob.LandData.Flags & (uint)(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects)) != 0);
                    if ((AuthorizedID == UUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale) {
                        e.parcelOwnerID = pOwnerID;
                        e.landValidated = true;
                    } else
                        return false;
                } else
                    return false;
            }
            return true;
        }