public EstateSettings LoadEstateSettings(UUID regionID)
        {
            EstateRegionLink link = LoadEstateRegionLink(regionID);

            // Ensure that estate settings exist for the link
            if (link != null)
            {
                if (manager.GetWithStatefullSession(typeof(EstateSettings), link.EstateID) == null)
                {
                    // Delete broken link
                    manager.Delete(link);
                    link = null;
                }
            }

            // If estate link does not exist create estate settings and link it to region.
            if (link == null)
            {
                EstateSettings estateSettings = new EstateSettings();
                //estateSettings.EstateOwner = UUID.Random();
                //estateSettings.BlockDwell = false;
                object identifier = manager.Insert(estateSettings);

                if (identifier == null)
                {
                    // Saving failed. Error is logged in the manager.
                    return(null);
                }

                uint estateID = (uint)identifier;
                link = new EstateRegionLink();
                link.EstateRegionLinkID = UUID.Random();
                link.RegionID           = regionID;
                link.EstateID           = estateID;
                manager.InsertWithStatefullSession(link);
            }

            // Load estate settings according to the existing or created link.
            return((EstateSettings)manager.GetWithStatefullSession(typeof(EstateSettings), link.EstateID));
        }
Exemplo n.º 2
0
        public EstateSettings LoadEstateSettings(UUID regionID)
        {
            EstateRegionLink link = LoadEstateRegionLink(regionID);

            // Ensure that estate settings exist for the link
            if (link != null)
            {
                if (manager.GetWithStatefullSession(typeof(EstateSettings), link.EstateID) == null)
                {
                    // Delete broken link
                    manager.Delete(link);
                    link = null;
                }
            }

            // If estate link does not exist create estate settings and link it to region.
            if (link == null)
            {
                EstateSettings estateSettings = new EstateSettings();
                //estateSettings.EstateOwner = UUID.Random();
                //estateSettings.BlockDwell = false;
                object identifier = manager.Insert(estateSettings);

                if (identifier == null)
                {
                    // Saving failed. Error is logged in the manager.
                    return null;
                }

                uint estateID = (uint)identifier;
                link = new EstateRegionLink();
                link.EstateRegionLinkID = UUID.Random();
                link.RegionID = regionID;
                link.EstateID = estateID;
                manager.InsertWithStatefullSession(link);
            }

            // Load estate settings according to the existing or created link.
            return (EstateSettings)manager.GetWithStatefullSession(typeof(EstateSettings), link.EstateID);
        }