Example #1
0
        private bool PrepareSceneForConnection(UUID sessionId, UUID sceneId, UserProfileData userProfile, out string reason)
        {
            Scene scene = m_scenes[sceneId];
            CommunicationsManager commsManager = m_scenes[sceneId].CommsManager;
            UserManagerBase userService = (UserManagerBase)commsManager.UserService;

            AgentCircuitData agent = new AgentCircuitData();
            agent.AgentID = userProfile.ID;
            agent.firstname = userProfile.FirstName;
            agent.lastname = userProfile.SurName;
            agent.SessionID = sessionId;
            agent.SecureSessionID = userProfile.CurrentAgent.SecureSessionID;
            agent.circuitcode = sessionId.CRC();
            agent.BaseFolder = UUID.Zero;
            agent.InventoryFolder = UUID.Zero;
            agent.startpos = new Vector3(0, 0, 0); // TODO Fill in region start position
            agent.CapsPath = "http://localhost/";
            agent.Appearance = userService.GetUserAppearance(userProfile.ID);

            if (agent.Appearance == null)
            {
                m_log.WarnFormat("[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
                agent.Appearance = new AvatarAppearance();
            }
            
            return scene.NewUserConnection(agent, 0, out reason);
        }
Example #2
0
        /// <summary>
        /// Calculates the CRC (cyclic redundancy check) needed to upload inventory.
        /// </summary>
        /// <param name="creationDate">Creation date</param>
        /// <param name="saleType">Sale type</param>
        /// <param name="invType">Inventory type</param>
        /// <param name="type">Type</param>
        /// <param name="assetID">Asset ID</param>
        /// <param name="groupID">Group ID</param>
        /// <param name="salePrice">Sale price</param>
        /// <param name="ownerID">Owner ID</param>
        /// <param name="creatorID">Creator ID</param>
        /// <param name="itemID">Item ID</param>
        /// <param name="folderID">Folder ID</param>
        /// <param name="everyoneMask">Everyone mask (permissions)</param>
        /// <param name="flags">Flags</param>
        /// <param name="nextOwnerMask">Next owner mask (permissions)</param>
        /// <param name="groupMask">Group mask (permissions)</param>
        /// <param name="ownerMask">Owner mask (permissions)</param>
        /// <returns>The calculated CRC</returns>
        public static uint InventoryCRC(int creationDate, byte saleType, sbyte invType, sbyte type,
            UUID assetID, UUID groupID, int salePrice, UUID ownerID, UUID creatorID,
            UUID itemID, UUID folderID, uint everyoneMask, uint flags, uint nextOwnerMask,
            uint groupMask, uint ownerMask)
        {
            uint CRC = 0;

            // IDs
            CRC += assetID.CRC(); // AssetID
            CRC += folderID.CRC(); // FolderID
            CRC += itemID.CRC(); // ItemID

            // Permission stuff
            CRC += creatorID.CRC(); // CreatorID
            CRC += ownerID.CRC(); // OwnerID
            CRC += groupID.CRC(); // GroupID

            // CRC += another 4 words which always seem to be zero -- unclear if this is a UUID or what
            CRC += ownerMask;
            CRC += nextOwnerMask;
            CRC += everyoneMask;
            CRC += groupMask;

            // The rest of the CRC fields
            CRC += flags; // Flags
            CRC += (uint)invType; // InvType
            CRC += (uint)type; // Type
            CRC += (uint)creationDate; // CreationDate
            CRC += (uint)salePrice;    // SalePrice
            CRC += (uint)((uint)saleType * 0x07073096); // SaleType

            return CRC;
        }
        private bool PrepareSceneForConnection(UUID sessionId, UUID secureSessionId, UUID sceneId, UserAccount account, out string reason)
        {
            Scene scene = m_scenes[sceneId];

            AgentCircuitData agent = new AgentCircuitData();
            agent.AgentID = account.PrincipalID;
            agent.firstname = account.FirstName;
            agent.lastname = account.LastName;
            agent.SessionID = sessionId;
            agent.SecureSessionID = secureSessionId;
            agent.circuitcode = sessionId.CRC();
            agent.BaseFolder = UUID.Zero;
            agent.InventoryFolder = UUID.Zero;
            agent.startpos = new Vector3(0, 0, 0); // TODO Fill in region start position
            agent.CapsPath = "http://localhost/";
            AvatarData avatar = scene.AvatarService.GetAvatar(account.PrincipalID);
            if (avatar != null)
                agent.Appearance = avatar.ToAvatarAppearance(account.PrincipalID);  //userService.GetUserAppearance(userProfile.ID);

            if (agent.Appearance == null)
            {
                m_log.WarnFormat("[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
                agent.Appearance = new AvatarAppearance();
            }
            
            return scene.NewUserConnection(agent, 0, out reason);
        }