Example #1
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public GridClient()
        {
            // Initialise SmartThreadPool when using mono
            if (Type.GetType("Mono.Runtime") != null)
            {
                WorkPool.Init(true);
            }

            // These are order-dependant
            Network    = new NetworkManager(this);
            Settings   = new Settings(this);
            Parcels    = new ParcelManager(this);
            Self       = new AgentManager(this);
            Avatars    = new AvatarManager(this);
            Estate     = new EstateTools(this);
            Friends    = new FriendsManager(this);
            Grid       = new GridManager(this);
            Objects    = new ObjectManager(this);
            Groups     = new GroupManager(this);
            Assets     = new AssetManager(this);
            Appearance = new AppearanceManager(this);
            Inventory  = new InventoryManager(this);
            Directory  = new DirectoryManager(this);
            Terrain    = new TerrainManager(this);
            Sound      = new SoundManager(this);
            Throttle   = new AgentThrottle(this);
            Stats      = new OpenMetaverse.Stats.UtilizationStatistics();
        }
Example #2
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public GridClient()
        {
            // These are order-dependant
            Network    = new NetworkManager(this);
            Settings   = new Settings(this);
            Parcels    = new ParcelManager(this);
            Self       = new AgentManager(this);
            Avatars    = new AvatarManager(this);
            Friends    = new FriendsManager(this);
            Grid       = new GridManager(this);
            Objects    = new ObjectManager(this);
            Groups     = new GroupManager(this);
            Assets     = new AssetManager(this);
            Appearance = new AppearanceManager(this, Assets);
            Inventory  = new InventoryManager(this);
            Directory  = new DirectoryManager(this);
            Terrain    = new TerrainManager(this);
            Sound      = new SoundManager(this);
            Throttle   = new AgentThrottle(this);

            //if (Settings.ENABLE_INVENTORY_STORE)
            //    InventoryStore = new Inventory(Inventory);
            //if (Settings.ENABLE_LIBRARY_STORE)
            //    LibraryStore = new Inventory(Inventory);

            //Inventory.OnSkeletonsReceived +=
            //    delegate(InventoryManager manager)
            //    {
            //        if (Settings.ENABLE_INVENTORY_STORE)
            //            InventoryStore.InitializeFromSkeleton(Inventory.InventorySkeleton);
            //        if (Settings.ENABLE_LIBRARY_STORE)
            //            LibraryStore.InitializeFromSkeleton(Inventory.LibrarySkeleton);
            //    };
        }
 /// <summary>
 /// this constructor initializes a connection string and invokes methods which set connection
 /// </summary>
 public DataBaseAccess(ParcelManager managerParcel)
 {
     connectObj.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Studies\Malmo_advanced\Project\ProjectCS\DataStorageUtility\GeometryStorage.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
     //connectObj.ConnectionString = Properties.Settings.Default.GeometryStorageConnectionString; //<--- This one doesn't work!!!!!!!!! Dear teacher, if in your computer it will work, please just use this line instead of the upper one.
     //this is the bug that I cannot ever fix, since there is no sollution in internet to fix this problem!!!!
     this.managerParcel = managerParcel;
     GetConnection();
     FillDataSets();
     FillCorners();
     FillParcels();
     FillBorderSegments();
     FillManager();
 }
 /// <summary>
 /// this constructor sets the refference to parcel manager
 /// </summary>
 public DataBaseSave(ParcelManager managerParcel)
 {
     connectObj.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Studies\Malmo_advanced\Project\ProjectCS\DataStorageUtility\GeometryStorage.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
     //connectObj.ConnectionString = Properties.Settings.Default.GeometryStorageConnectionString; //<--- This one doesn't work!!!!!!!!!
     //this is the bug that I cannot ever fix, since there is no sollution in internet to fix this problem!!!!
     this.managerParcel = managerParcel;
     FillArrays();
     connectObj.Open();
     Delete();
     WritteCorners();
     WritteBorderSegments();
     WritteParcels();
     connectObj.Close();
 }
Example #5
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public GridClient()
 {
     // These are order-dependant
     Network    = new NetworkManager(this);
     Settings   = new Settings(this);
     Parcels    = new ParcelManager(this);
     Self       = new AgentManager(this);
     Avatars    = new AvatarManager(this);
     Estate     = new EstateTools(this);
     Friends    = new FriendsManager(this);
     Grid       = new GridManager(this);
     Objects    = new ObjectManager(this);
     Groups     = new GroupManager(this);
     Assets     = new AssetManager(this);
     Appearance = new AppearanceManager(this);
     Inventory  = new InventoryManager(this);
     Directory  = new DirectoryManager(this);
     Terrain    = new TerrainManager(this);
     Sound      = new SoundManager(this);
     Throttle   = new AgentThrottle(this);
     Stats      = new OpenMetaverse.Stats.UtilizationStatistics();
 }
Example #6
0
        private void ParcelInfoRequestHandler(Packet packet, LLAgent agent)
        {
            ParcelInfoRequestPacket request = (ParcelInfoRequestPacket)packet;

            SceneParcel parcel;

            if (m_parcels.TryGetParcel(request.Data.ParcelID, out parcel))
            {
                Vector3d scenePosition = m_scene.MinPosition;
                Vector3  aabbMin, aabbMax;

                ParcelInfoReplyPacket reply = new ParcelInfoReplyPacket();
                reply.AgentData.AgentID = agent.ID;
                reply.Data.ActualArea   = ParcelManager.GetParcelArea(parcel, out aabbMin, out aabbMax);
                reply.Data.AuctionID    = 0;
                reply.Data.BillableArea = reply.Data.ActualArea;
                reply.Data.Desc         = Utils.StringToBytes(parcel.Desc);
                reply.Data.Dwell        = parcel.Dwell;
                reply.Data.Flags        = (byte)parcel.Flags;
                reply.Data.GlobalX      = (float)scenePosition.X + aabbMin.X;
                reply.Data.GlobalY      = (float)scenePosition.Y + aabbMin.Y;
                reply.Data.GlobalZ      = 0f; // FIXME:
                reply.Data.Name         = Utils.StringToBytes(parcel.Name);
                reply.Data.OwnerID      = parcel.OwnerID;
                reply.Data.ParcelID     = parcel.ID;
                reply.Data.SalePrice    = parcel.SalePrice;
                reply.Data.SimName      = Utils.StringToBytes(m_scene.Name);
                reply.Data.SnapshotID   = parcel.SnapshotID;

                m_udp.SendPacket(agent, reply, ThrottleCategory.Task, false);
            }
            else
            {
                m_log.Warn(agent.Name + " requested info for unknown parcel " + request.Data.ParcelID);
            }
        }
Example #7
0
        private void SendParcelProperties(int parcelID, int sequenceID, bool snapSelection, ParcelResult result,
                                          LLAgent agent)
        {
            SceneParcel parcel;

            if (m_parcels.TryGetParcel(parcelID, out parcel))
            {
                // Owner sanity check
                if (parcel.OwnerID == UUID.Zero)
                {
                    m_log.Warn("Assigning parcel " + parcel.Name + " to " + agent.Name);
                    parcel.OwnerID = agent.ID;
                    m_parcels.AddOrUpdateParcel(parcel);
                }

                // Claim date sanity check
                if (parcel.ClaimDate <= Utils.Epoch)
                {
                    m_log.Warn("Resetting invalid parcel claim date");
                    parcel.ClaimDate = DateTime.UtcNow;
                    m_parcels.AddOrUpdateParcel(parcel);
                }

                ParcelPropertiesMessage properties = new ParcelPropertiesMessage();
                properties.Area                    = ParcelManager.GetParcelArea(parcel, out properties.AABBMin, out properties.AABBMax);
                properties.AuctionID               = 0; // Unused
                properties.AuthBuyerID             = parcel.AuthBuyerID;
                properties.Bitmap                  = parcel.Bitmap;
                properties.Category                = parcel.Category;
                properties.ClaimDate               = parcel.ClaimDate;
                properties.ClaimPrice              = 0; // Deprecated
                properties.Desc                    = parcel.Desc;
                properties.GroupID                 = parcel.GroupID;
                properties.IsGroupOwned            = parcel.IsGroupOwned;
                properties.LandingType             = parcel.Landing;
                properties.LocalID                 = parcel.LocalID;
                properties.MaxPrims                = parcel.MaxPrims;
                properties.MediaAutoScale          = parcel.Media.MediaAutoScale;
                properties.MediaDesc               = parcel.Media.MediaDesc;
                properties.MediaHeight             = parcel.Media.MediaHeight;
                properties.MediaID                 = parcel.Media.MediaID;
                properties.MediaLoop               = parcel.Media.MediaLoop;
                properties.MediaType               = parcel.Media.MediaType;
                properties.MediaURL                = parcel.Media.MediaURL;
                properties.MediaWidth              = parcel.Media.MediaWidth;
                properties.MusicURL                = parcel.Media.MediaURL;
                properties.Name                    = parcel.Name;
                properties.ObscureMedia            = parcel.ObscureMedia;
                properties.ObscureMusic            = parcel.ObscureMusic;
                properties.OtherCleanTime          = parcel.AutoReturnTime;
                properties.OwnerID                 = parcel.OwnerID;
                properties.ParcelFlags             = parcel.Flags;
                properties.ParcelPrimBonus         = 1f;
                properties.PassHours               = parcel.PassHours;
                properties.PassPrice               = parcel.PassPrice;
                properties.RegionDenyAgeUnverified = parcel.DenyAgeUnverified;
                properties.RegionDenyAnonymous     = parcel.DenyAnonymous;
                properties.RegionDenyIdentified    = false;
                properties.RegionDenyTransacted    = false;
                properties.RegionPushOverride      = parcel.PushOverride;
                properties.RentPrice               = 0; // Deprecated
                properties.RequestResult           = result;
                properties.SalePrice               = parcel.SalePrice;
                properties.SequenceID              = sequenceID;
                properties.SnapSelection           = snapSelection;
                properties.SnapshotID              = parcel.SnapshotID;
                properties.Status                  = parcel.Status;
                properties.UserLocation            = parcel.LandingLocation;
                properties.UserLookAt              = parcel.LandingLookAt;

                int ownerPrims    = 0;
                int groupPrims    = 0;
                int otherPrims    = 0;
                int selectedPrims = 0;

                lock (parcel.ParcelEntities)
                {
                    foreach (ISceneEntity entity in parcel.ParcelEntities.Values)
                    {
                        // TODO: We don't currently track whether objects have been shared/deeded to group?
                        if (entity.OwnerID == parcel.OwnerID)
                        {
                            ++ownerPrims;
                        }
                        else
                        {
                            ++otherPrims;
                        }

                        // TODO: We don't currently track selected prims
                    }
                }

                properties.OwnerPrims    = ownerPrims;
                properties.GroupPrims    = groupPrims;
                properties.OtherPrims    = otherPrims;
                properties.TotalPrims    = ownerPrims + groupPrims + otherPrims;
                properties.SelectedPrims = selectedPrims;

                // TODO: Implement these
                properties.SimWideMaxPrims   = 0;
                properties.SimWideTotalPrims = 0;

                // TODO: What are these?
                properties.SelfCount   = 0;
                properties.PublicCount = 0;
                properties.OtherCount  = 0;

                agent.EventQueue.QueueEvent("ParcelProperties", properties.Serialize());
            }
            else
            {
                m_log.Warn("SendParcelProperties() called for unknown parcel " + parcelID);
            }
        }
Example #8
0
        private void ParcelJoinHandler(Packet packet, LLAgent agent)
        {
            ParcelJoinPacket join = (ParcelJoinPacket)packet;

            int startX = (int)Math.Round(join.ParcelData.West) / 4;
            int startY = (int)Math.Round(join.ParcelData.South) / 4;
            int endX   = ((int)Math.Round(join.ParcelData.East) / 4) - 1;
            int endY   = ((int)Math.Round(join.ParcelData.North) / 4) - 1;

            if (startX < 0 || startY < 0 || endX < startX || endY < startY ||
                endX > 63 || endY > 63 || startX > endX || startY > endY)
            {
                m_log.Warn(agent.Name + String.Format(" sent invalid ParcelJoin: West {0} South {1} East {2} North {3}",
                                                      join.ParcelData.West, join.ParcelData.South, join.ParcelData.East, join.ParcelData.North));
                return;
            }

            int     largestArea = 0;
            Vector3 aabbMin, aabbMax;

            // Get the selected parcels
            List <SceneParcel> selectedParcels = new List <SceneParcel>();

            for (int y = startY; y <= endY; y++)
            {
                for (int x = startX; x <= endX; x++)
                {
                    SceneParcel parcel;
                    if (m_parcels.TryGetParcel(m_parcels.GetParcelID(x, y), out parcel))
                    {
                        if (!selectedParcels.Contains(parcel) && m_permissions.CanEditParcel(agent, parcel))
                        {
                            // Largest parcel is the "master" parcel that smaller parcels are joined into
                            int area = ParcelManager.GetParcelArea(parcel, out aabbMin, out aabbMax);
                            if (area > largestArea)
                            {
                                largestArea = area;
                                selectedParcels.Insert(0, parcel);
                            }
                            else
                            {
                                selectedParcels.Add(parcel);
                            }
                        }
                    }
                }
            }

            // Enough parcels selected check
            if (selectedParcels.Count < 2)
            {
                m_scene.PresenceAlert(this, agent, "Not enough leased parcels in selection to join");
                return;
            }

            // Same owner check
            for (int i = 1; i < selectedParcels.Count; i++)
            {
                if (selectedParcels[i].OwnerID != selectedParcels[0].OwnerID)
                {
                    m_scene.PresenceAlert(this, agent, "All parcels must have the same owner before joining");
                    return;
                }
            }

            m_parcels.JoinParcels(selectedParcels);

            // Broadcast the new parcel overlay info
            m_scene.ForEachPresence(SendParcelOverlay);
        }