Exemplo n.º 1
0
        public static OSD InstantMessageParams(UUID fromAgent, string message, UUID toAgent,
                                               string fromName, byte dialog, uint timeStamp, bool offline, int parentEstateID,
                                               Vector3 position, uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket)
        {
            OSDMap messageParams = new OSDMap(15);

            messageParams.Add("type", new OSDInteger((int)dialog));

            OSDArray positionArray = new OSDArray(3);

            positionArray.Add(OSD.FromReal(position.X));
            positionArray.Add(OSD.FromReal(position.Y));
            positionArray.Add(OSD.FromReal(position.Z));
            messageParams.Add("position", positionArray);

            messageParams.Add("region_id", new OSDUUID(UUID.Zero));
            messageParams.Add("to_id", new OSDUUID(toAgent));
            messageParams.Add("source", new OSDInteger(0));

            OSDMap data = new OSDMap(1);

            data.Add("binary_bucket", OSD.FromBinary(binaryBucket));
            messageParams.Add("data", data);
            messageParams.Add("message", new OSDString(message));
            messageParams.Add("id", new OSDUUID(transactionID));
            messageParams.Add("from_name", new OSDString(fromName));
            messageParams.Add("timestamp", new OSDInteger((int)timeStamp));
            messageParams.Add("offline", new OSDInteger(offline ? 1 : 0));
            messageParams.Add("parent_estate_id", new OSDInteger(parentEstateID));
            messageParams.Add("ttl", new OSDInteger((int)ttl));
            messageParams.Add("from_id", new OSDUUID(fromAgent));
            messageParams.Add("from_group", new OSDInteger(fromGroup ? 1 : 0));

            return(messageParams);
        }
Exemplo n.º 2
0
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map ["eventID"]     = eventID;
            map ["creator"]     = creator;
            map ["name"]        = name;
            map ["category"]    = category;
            map ["description"] = description;
            map ["date"]        = date;
            map ["dateUTC"]     = dateUTC;
            map ["duration"]    = duration;
            map ["cover"]       = cover;
            map ["amount"]      = amount;
            map ["simName"]     = simName;
            //map["globalPos"] = globalPos;
            map ["GPosX"] = OSD.FromReal(globalPos.X).ToString();
            map ["GPosY"] = OSD.FromReal(globalPos.Y).ToString();
            map ["GPosZ"] = OSD.FromReal(globalPos.Z).ToString();
            //map["regionPos"] = regionPos;
            map ["RPosX"]      = OSD.FromReal(regionPos.X).ToString();
            map ["RPosY"]      = OSD.FromReal(regionPos.Y).ToString();
            map ["RPosZ"]      = OSD.FromReal(regionPos.Z).ToString();
            map ["eventFlags"] = eventFlags;
            map ["maturity"]   = maturity;
            return(map);
        }
Exemplo n.º 3
0
            public OSD GetOSD(int faceNumber)
            {
                OSDMap tex = new OSDMap(10);

                if (faceNumber >= 0)
                {
                    tex["face_number"] = OSD.FromInteger(faceNumber);
                }
                tex["colors"]      = OSD.FromColor4(RGBA);
                tex["scales"]      = OSD.FromReal(RepeatU);
                tex["scalet"]      = OSD.FromReal(RepeatV);
                tex["offsets"]     = OSD.FromReal(OffsetU);
                tex["offsett"]     = OSD.FromReal(OffsetV);
                tex["imagerot"]    = OSD.FromReal(Rotation);
                tex["bump"]        = OSD.FromInteger((int)Bump);
                tex["shiny"]       = OSD.FromInteger((int)Shiny);
                tex["fullbright"]  = OSD.FromBoolean(Fullbright);
                tex["media_flags"] = OSD.FromInteger(Convert.ToInt32(MediaFlags));
                tex["mapping"]     = OSD.FromInteger((int)TexMapType);
                tex["glow"]        = OSD.FromReal(Glow);

                if (TextureID != Primitive.TextureEntry.WHITE_TEXTURE)
                {
                    tex["imageid"] = OSD.FromUUID(TextureID);
                }
                else
                {
                    tex["imageid"] = OSD.FromUUID(UUID.Zero);
                }

                return(tex);
            }
Exemplo n.º 4
0
        public OSDMap Pack()
        {
            OSDMap args = new OSDMap();

            args["message_type"] = OSD.FromString("AgentPosition");

            args["region_handle"] = OSD.FromString(RegionHandle.ToString());
            args["circuit_code"]  = OSD.FromString(CircuitCode.ToString());
            args["agent_uuid"]    = OSD.FromUUID(AgentID);
            args["session_uuid"]  = OSD.FromUUID(SessionID);

            args["position"]  = OSD.FromString(Position.ToString());
            args["velocity"]  = OSD.FromString(Velocity.ToString());
            args["center"]    = OSD.FromString(Center.ToString());
            args["size"]      = OSD.FromString(Size.ToString());
            args["at_axis"]   = OSD.FromString(AtAxis.ToString());
            args["left_axis"] = OSD.FromString(LeftAxis.ToString());
            args["up_axis"]   = OSD.FromString(UpAxis.ToString());

            args["far"]          = OSD.FromReal(Far);
            args["changed_grid"] = OSD.FromBoolean(ChangedGrid);

            if ((Throttles != null) && (Throttles.Length > 0))
            {
                args["throttles"] = OSD.FromBinary(Throttles);
            }

            return(args);
        }
Exemplo n.º 5
0
        public virtual OSDMap ToBriefOSDMap()
        {
            OSDMap ret = new OSDMap();

            ret.Add("Value", OSD.FromReal(Value));
            return(ret);
        }
        public override OSDMap ToOSD()
        {
            OSDMap body = new OSDMap
            {
                { "MaxDragDistance", OSD.FromReal(MaxDragDistance) },
                { "DrawDistance", OSD.FromReal(DefaultDrawDistance) },
                { "ForceDrawDistance", OSD.FromInteger(ForceDrawDistance ? 1 : 0) },
                { "MaxPrimScale", OSD.FromReal(MaximumPrimScale) },
                { "MinPrimScale", OSD.FromReal(MinimumPrimScale) },
                { "MaxPhysPrimScale", OSD.FromReal(MaximumPhysPrimScale) },
                { "MaxHollowSize", OSD.FromReal(MaximumHollowSize) },
                { "MinHoleSize", OSD.FromReal(MinimumHoleSize) },
                { "EnforceMaxBuild", OSD.FromInteger(ClampPrimSizes ? 1 : 0) },
                { "MaxLinkCount", OSD.FromInteger(MaximumLinkCount) },
                { "MaxLinkCountPhys", OSD.FromInteger(MaximumLinkCountPhys) },
                { "LSLFunctions", LSLCommands },
                { "RenderWater", OSD.FromInteger(RenderWater ? 1 : 0) },
                { "TerrainDetailScale", OSD.FromReal(TerrainDetailScale) },
                { "MaxInventoryItemsTransfer", OSD.FromInteger(MaximumInventoryItemsTransfer) },
                { "AllowMinimap", OSD.FromInteger(DisplayMinimap ? 1 : 0) },
                { "AllowPhysicalPrims", OSD.FromInteger(AllowPhysicalPrims ? 1 : 0) },
                { "OffsetOfUTC", OSD.FromInteger(OffsetOfUTC) },
                { "OffsetOfUTCDST", OSD.FromInteger(OffsetOfUTCDST ? 1 : 0) },
                { "ToggleTeenMode", OSD.FromInteger(EnableTeenMode ? 1 : 0) },
                { "SetTeenMode", OSD.FromInteger(SetTeenMode ? 1 : 0) },
                { "ShowTags", OSD.FromInteger(ShowTags) },
                { "MaxGroups", OSD.FromInteger(MaxGroups) },
                { "AllowParcelWindLight", OSD.FromInteger(AllowParcelWindLight ? 1 : 0) }
            };

            return(body);
        }
        public override OSDMap ToOSD()
        {
            OSDMap Classified = new OSDMap {
                { "ClassifiedUUID", OSD.FromUUID(ClassifiedUUID) },
                { "CreatorUUID", OSD.FromUUID(CreatorUUID) },
                { "CreationDate", OSD.FromUInteger(CreationDate) },
                { "ExpirationDate", OSD.FromUInteger(ExpirationDate) },
                { "Category", OSD.FromUInteger(Category) },
                { "Name", OSD.FromString(Name) },
                { "Description", OSD.FromString(Description) },
                { "ParcelUUID", OSD.FromUUID(ParcelUUID) },
                { "ParentEstate", OSD.FromUInteger(ParentEstate) },
                { "SnapshotUUID", OSD.FromUUID(SnapshotUUID) },
                { "ScopeID", OSD.FromUUID(ScopeID) },
                { "SimName", OSD.FromString(SimName) },
                //  broken for non en_US locales                                        {"GlobalPos", OSD.FromVector3(GlobalPos)},
                { "GPosX", OSD.FromReal(GlobalPos.X).ToString() },
                { "GPosY", OSD.FromReal(GlobalPos.Y).ToString() },
                { "GPosZ", OSD.FromReal(GlobalPos.Z).ToString() },
                { "ParcelName", OSD.FromString(ParcelName) },
                { "ClassifiedFlags", OSD.FromInteger(ClassifiedFlags) },
                { "PriceForListing", OSD.FromInteger(PriceForListing) }
            };

            return(Classified);
        }
Exemplo n.º 8
0
        public void SerializeReal()
        {
            OSD llsdReal = OSD.FromReal(947835.234d);

            byte[] binaryRealSerialized = OSDParser.SerializeLLSDBinary(llsdReal);
            Assert.AreEqual(binaryReal, binaryRealSerialized);
        }
Exemplo n.º 9
0
        private Dictionary <UUID, InventoryBase> CreateInventory(UUID ownerID, out InventoryFolder rootFolder)
        {
            Dictionary <UUID, InventoryBase> inventory = new Dictionary <UUID, InventoryBase>();

            // Create a default inventory
            UUID rootFolderID = CreateFolder(inventory, UUID.Zero, "My Inventory", "application/vnd.ll.folder", ownerID);

            rootFolder = (InventoryFolder)inventory[rootFolderID];

            CreateFolder(inventory, rootFolderID, "Animations", "application/vnd.ll.animation", ownerID);
            CreateFolder(inventory, rootFolderID, "Body Parts", "application/vnd.ll.bodypart", ownerID);
            CreateFolder(inventory, rootFolderID, "Calling Cards", "application/vnd.ll.callingcard", ownerID);
            CreateFolder(inventory, rootFolderID, "Gestures", "application/vnd.ll.gesture", ownerID);
            CreateFolder(inventory, rootFolderID, "Landmarks", "application/vnd.ll.landmark", ownerID);
            CreateFolder(inventory, rootFolderID, "Lost and Found", "application/vnd.ll.lostandfoundfolder", ownerID);
            CreateFolder(inventory, rootFolderID, "Notecards", "application/vnd.ll.notecard", ownerID);
            CreateFolder(inventory, rootFolderID, "Objects", "application/vnd.ll.primitive", ownerID);
            CreateFolder(inventory, rootFolderID, "Photo Album", "application/vnd.ll.snapshotfolder", ownerID);
            CreateFolder(inventory, rootFolderID, "Scripts", "application/vnd.ll.lsltext", ownerID);
            CreateFolder(inventory, rootFolderID, "Sounds", "audio/ogg", ownerID);
            CreateFolder(inventory, rootFolderID, "Textures", "image/x-j2c", ownerID);
            CreateFolder(inventory, rootFolderID, "Trash", "application/vnd.ll.trashfolder", ownerID);

            UUID clothingFolder = CreateFolder(inventory, rootFolderID, "Clothing", "application/vnd.ll.clothing", ownerID);
            UUID outfitFolder   = CreateFolder(inventory, clothingFolder, "Default Outfit", "application/octet-stream", ownerID);

            UUID hairItem  = CreateItem(inventory, outfitFolder, "Default Hair", "Default Hair", WearableType.Hair, HAIR_ASSET, "application/vnd.ll.bodypart", ownerID);
            UUID pantsItem = CreateItem(inventory, outfitFolder, "Default Pants", "Default Pants", WearableType.Pants, PANTS_ASSET, "application/vnd.ll.clothing", ownerID);
            UUID shapeItem = CreateItem(inventory, outfitFolder, "Default Shape", "Default Shape", WearableType.Shape, SHAPE_ASSET, "application/vnd.ll.bodypart", ownerID);
            UUID shirtItem = CreateItem(inventory, outfitFolder, "Default Shirt", "Default Shirt", WearableType.Shirt, SHIRT_ASSET, "application/vnd.ll.clothing", ownerID);
            UUID skinItem  = CreateItem(inventory, outfitFolder, "Default Skin", "Default Skin", WearableType.Skin, SKIN_ASSET, "application/vnd.ll.bodypart", ownerID);
            UUID eyesItem  = CreateItem(inventory, outfitFolder, "Default Eyes", "Default Eyes", WearableType.Eyes, EYES_ASSET, "application/vnd.ll.bodypart", ownerID);

            if (m_userClient != null)
            {
                OSDMap appearanceMap = new OSDMap
                {
                    { "Height", OSD.FromReal(1.771488d) },
                    { "ShapeItem", OSD.FromUUID(shapeItem) },
                    { "ShapeAsset", OSD.FromUUID(SHAPE_ASSET) },
                    { "EyesItem", OSD.FromUUID(eyesItem) },
                    { "EyesAsset", OSD.FromUUID(EYES_ASSET) },
                    { "HairItem", OSD.FromUUID(hairItem) },
                    { "HairAsset", OSD.FromUUID(HAIR_ASSET) },
                    { "PantsItem", OSD.FromUUID(pantsItem) },
                    { "PantsAsset", OSD.FromUUID(PANTS_ASSET) },
                    { "ShirtItem", OSD.FromUUID(shirtItem) },
                    { "ShirtAsset", OSD.FromUUID(SHIRT_ASSET) },
                    { "SkinItem", OSD.FromUUID(skinItem) },
                    { "SkinAsset", OSD.FromUUID(SKIN_ASSET) }
                };

                m_userClient.UpdateUserFields(ownerID, new OSDMap {
                    { "LLAppearance", appearanceMap }
                });
            }

            return(inventory);
        }
Exemplo n.º 10
0
        private void SendChildUpdate(IScenePresence presence)
        {
            const float DEFAULT_DRAW_DISTANCE = 128.0f;

            // Build the template child_avatar/update message
            OSDMap childUpdate = new OSDMap();

            childUpdate["agent_id"] = OSD.FromUUID(presence.ID);
            childUpdate["rotation"] = OSD.FromQuaternion(presence.SceneRotation);

            float drawDistance = DEFAULT_DRAW_DISTANCE;

            if (presence is LLAgent)
            {
                LLAgent agent = (LLAgent)presence;
                drawDistance = agent.DrawDistance;

                childUpdate["camera_center"] = OSD.FromVector3(agent.CameraPosition);
                childUpdate["camera_at"]     = OSD.FromVector3(agent.CameraAtAxis);
                childUpdate["camera_left"]   = OSD.FromVector3(agent.CameraLeftAxis);
                childUpdate["camera_up"]     = OSD.FromVector3(agent.CameraUpAxis);
            }

            childUpdate["draw_distance"] = OSD.FromReal(drawDistance);

            // Get a list of neighbors to send this update to based on the draw distance
            SceneInfo[] neighbors = m_scene.GetNeighborsNear(m_scene.MinPosition + new Vector3d(presence.ScenePosition), drawDistance);
            for (int i = 0; i < neighbors.Length; i++)
            {
                SceneInfo neighbor = neighbors[i];

                // Find the presence position relative to this neighbor
                Vector3 relativePosition = presence.ScenePosition - new Vector3(neighbor.MinPosition - presence.Scene.MinPosition);
                childUpdate["position"] = OSD.FromVector3(relativePosition);

                Uri childUpdateCap;
                if (neighbor.TryGetCapability("child_avatar/update", out childUpdateCap))
                {
                    try
                    {
                        // Send the message
                        //m_log.Debug("Sending child agent update for " + presence.Name);
                        string message = OSDParser.SerializeJsonString(childUpdate);
                        UntrustedHttpWebRequest.PostToUntrustedUrl(childUpdateCap, message);
                    }
                    catch (Exception ex)
                    {
                        m_log.Warn("child_avatar/update from " + m_scene.Name + " to " + neighbor.Name + " for agent " +
                                   presence.Name + " failed: " + ex.Message);
                    }
                }
                else
                {
                    // This shouldn't happen since we check for the child_avatar/update capability
                    // before adding this agent/neighbor pair to the queue
                    throw new InvalidOperationException("child_avatar/update capability not found in SendChildUpdate handler");
                }
            }
        }
        /// <summary>
        /// Returns the new user ID or throws an exception containing the error code
        /// The error codes can be found here: https://wiki.secondlife.com/wiki/RegAPIError
        /// </summary>
        /// <param name="user">New user account to create</param>
        /// <returns>The UUID of the new user account</returns>
        public UUID CreateUser(CreateUserParam user)
        {
            if (Initializing)
            {
                throw new InvalidOperationException("still initializing");
            }

            if (_caps.CreateUser == null)
            {
                throw new InvalidOperationException("access denied; only approved developers have access to the registration api");
            }

            // Create the POST data
            var query = new OSDMap
            {
                { "username", OSD.FromString(user.FirstName) },
                { "last_name_id", OSD.FromInteger(user.LastName.ID) },
                { "email", OSD.FromString(user.Email) },
                { "password", OSD.FromString(user.Password) },
                { "dob", OSD.FromString(user.Birthdate.ToString("yyyy-MM-dd")) }
            };

            if (user.LimitedToEstate != null)
            {
                query.Add("limited_to_estate", OSD.FromInteger(user.LimitedToEstate.Value));
            }

            if (!string.IsNullOrEmpty(user.StartRegionName))
            {
                query.Add("start_region_name", OSD.FromInteger(user.LimitedToEstate.Value));
            }

            if (user.StartLocation != null)
            {
                query.Add("start_local_x", OSD.FromReal(user.StartLocation.Value.X));
                query.Add("start_local_y", OSD.FromReal(user.StartLocation.Value.Y));
                query.Add("start_local_z", OSD.FromReal(user.StartLocation.Value.Z));
            }

            if (user.StartLookAt != null)
            {
                query.Add("start_look_at_x", OSD.FromReal(user.StartLookAt.Value.X));
                query.Add("start_look_at_y", OSD.FromReal(user.StartLookAt.Value.Y));
                query.Add("start_look_at_z", OSD.FromReal(user.StartLookAt.Value.Z));
            }

            //byte[] postData = OSDParser.SerializeXmlBytes(query);

            // Make the request
            var request = new CapsClient(_caps.CreateUser);

            request.OnComplete += CreateUserResponse;
            request.BeginGetResponse(REQUEST_TIMEOUT);

            // FIXME: Block
            return(UUID.Zero);
        }
Exemplo n.º 12
0
        public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
                                      IPEndPoint newRegionExternalEndPoint,
                                      string capsURL, UUID agentID, UUID sessionID,
                                      int regionSizeX, int regionSizeY)
        {
            OSDArray lookAtArr = new OSDArray(3);

            lookAtArr.Add(OSD.FromReal(lookAt.X));
            lookAtArr.Add(OSD.FromReal(lookAt.Y));
            lookAtArr.Add(OSD.FromReal(lookAt.Z));

            OSDArray positionArr = new OSDArray(3);

            positionArr.Add(OSD.FromReal(pos.X));
            positionArr.Add(OSD.FromReal(pos.Y));
            positionArr.Add(OSD.FromReal(pos.Z));

            OSDMap infoMap = new OSDMap(2);

            infoMap.Add("LookAt", lookAtArr);
            infoMap.Add("Position", positionArr);

            OSDArray infoArr = new OSDArray(1);

            infoArr.Add(infoMap);

            OSDMap agentDataMap = new OSDMap(2);

            agentDataMap.Add("AgentID", OSD.FromUUID(agentID));
            agentDataMap.Add("SessionID", OSD.FromUUID(sessionID));

            OSDArray agentDataArr = new OSDArray(1);

            agentDataArr.Add(agentDataMap);

            OSDMap regionDataMap = new OSDMap(6);

            regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle)));
            regionDataMap.Add("SeedCapability", OSD.FromString(capsURL));
            regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes()));
            regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port));
            regionDataMap.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
            regionDataMap.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));

            OSDArray regionDataArr = new OSDArray(1);

            regionDataArr.Add(regionDataMap);

            OSDMap llsdBody = new OSDMap(3);

            llsdBody.Add("Info", infoArr);
            llsdBody.Add("AgentData", agentDataArr);
            llsdBody.Add("RegionData", regionDataArr);

            return(BuildEvent("CrossedRegion", llsdBody));
        }
Exemplo n.º 13
0
        public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
                                      IPAddress address, int port,
                                      string capsURL, UUID agentID, UUID sessionID, int RegionSizeX, int RegionSizeY)
        {
            OSDArray lookAtArr = new OSDArray(3)
            {
                OSD.FromReal(lookAt.X), OSD.FromReal(lookAt.Y), OSD.FromReal(lookAt.Z)
            };

            OSDArray positionArr = new OSDArray(3)
            {
                OSD.FromReal(pos.X), OSD.FromReal(pos.Y), OSD.FromReal(pos.Z)
            };

            OSDMap infoMap = new OSDMap(2)
            {
                { "LookAt", lookAtArr }, { "Position", positionArr }
            };

            OSDArray infoArr = new OSDArray(1)
            {
                infoMap
            };

            OSDMap agentDataMap = new OSDMap(2)
            {
                { "AgentID", OSD.FromUUID(agentID) }, { "SessionID", OSD.FromUUID(sessionID) }
            };

            OSDArray agentDataArr = new OSDArray(1)
            {
                agentDataMap
            };

            OSDMap regionDataMap = new OSDMap(4)
            {
                { "RegionHandle", OSD.FromBinary(ulongToByteArray(handle)) },
                { "SeedCapability", OSD.FromString(capsURL) },
                { "SimIP", OSD.FromBinary(address.GetAddressBytes()) },
                { "SimPort", OSD.FromInteger(port) },
                { "RegionSizeX", OSD.FromUInteger((uint)RegionSizeX) },
                { "RegionSizeY", OSD.FromUInteger((uint)RegionSizeY) }
            };

            OSDArray regionDataArr = new OSDArray(1)
            {
                regionDataMap
            };

            OSDMap llsdBody = new OSDMap(3)
            {
                { "Info", infoArr }, { "AgentData", agentDataArr }, { "RegionData", regionDataArr }
            };

            return(buildEvent("CrossedRegion", llsdBody));
        }
Exemplo n.º 14
0
        public OSD Pack()
        {
            OSDMap data = new OSDMap();

            data["InboundVersion"]  = OSD.FromReal(InboundVersion);
            data["OutboundVersion"] = OSD.FromReal(OutboundVersion);
            data["WearablesCount"]  = OSD.FromInteger(WearablesCount);

            return(data);
        }
Exemplo n.º 15
0
        public virtual OSDMap ToBriefOSDMap()
        {
            OSDMap ret = new OSDMap();

            ret.Add("Value", OSD.FromReal(Value));

            double lastChangeOverTime, averageChangeOverTime;

            return(ret);
        }
Exemplo n.º 16
0
        public OSDMap Pack(EntityTransferContext ctx)
        {
            OSDMap args = new OSDMap();

            args["message_type"] = OSD.FromString("AgentPosition");

            args["region_handle"] = OSD.FromString(RegionHandle.ToString());
            args["circuit_code"]  = OSD.FromString(CircuitCode.ToString());
            args["agent_uuid"]    = OSD.FromUUID(AgentID);
            args["session_uuid"]  = OSD.FromUUID(SessionID);

            args["position"]  = OSD.FromString(Position.ToString());
            args["velocity"]  = OSD.FromString(Velocity.ToString());
            args["center"]    = OSD.FromString(Center.ToString());
            args["size"]      = OSD.FromString(Size.ToString());
            args["at_axis"]   = OSD.FromString(AtAxis.ToString());
            args["left_axis"] = OSD.FromString(LeftAxis.ToString());
            args["up_axis"]   = OSD.FromString(UpAxis.ToString());

            args["far"]          = OSD.FromReal(Far);
            args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
            //args["god_level"] = OSD.FromString(GodLevel.ToString());
            if (GodData != null)
            {
                args["god_data"] = GodData;
                OSDMap g = (OSDMap)GodData;
                // Set legacy value
                // TODO: remove after 0.9 is superseded
                if (g.ContainsKey("ViewerUiIsGod"))
                {
                    args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;
                }
            }

            if ((Throttles != null) && (Throttles.Length > 0))
            {
                args["throttles"] = OSD.FromBinary(Throttles);
            }

            if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0)
            {
                OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
                foreach (KeyValuePair <ulong, string> kvp in ChildrenCapSeeds)
                {
                    OSDMap pair = new OSDMap();
                    pair["handle"] = OSD.FromString(kvp.Key.ToString());
                    pair["seed"]   = OSD.FromString(kvp.Value);
                    childrenSeeds.Add(pair);
                }
                args["children_seeds"] = childrenSeeds;
            }

            return(args);
        }
Exemplo n.º 17
0
            public OSD GetOSD()
            {
                OSDMap map = new OSDMap();

                map["color"]     = OSD.FromColor4(Color);
                map["intensity"] = OSD.FromReal(Intensity);
                map["radius"]    = OSD.FromReal(Radius);
                map["cutoff"]    = OSD.FromReal(Cutoff);
                map["falloff"]   = OSD.FromReal(Falloff);

                return(map);
            }
Exemplo n.º 18
0
            /// <summary>
            ///
            /// </summary>
            /// <returns></returns>
            public OSD GetOSD()
            {
                OSDMap map = new OSDMap();

                map["simulate_lod"]     = OSD.FromInteger(Softness);
                map["gravity"]          = OSD.FromReal(Gravity);
                map["air_friction"]     = OSD.FromReal(Drag);
                map["wind_sensitivity"] = OSD.FromReal(Wind);
                map["tension"]          = OSD.FromReal(Tension);
                map["user_force"]       = OSD.FromVector3(Force);

                return(map);
            }
Exemplo n.º 19
0
        /// <summary>
        /// Create an OSDMap from the appearance data
        /// </summary>
        public OSDMap Pack()
        {
            OSDMap data = new OSDMap();

            data["owner"]  = OSD.FromUUID(Owner);
            data["serial"] = OSD.FromInteger(m_serial);
            data["height"] = OSD.FromReal(m_avatarHeight);

            // Wearables
            List <AvatarWearable> wearables = GetWearables();
            OSDArray wears = new OSDArray(wearables.Count);

            foreach (AvatarWearable wearable in wearables)
            {
                wears.Add(wearable.Pack());
            }
            data["wearables"] = wears;

            // Avatar Textures
            OSDArray textures = new OSDArray(AvatarAppearance.TEXTURE_COUNT);

            for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
            {
                if (m_texture.FaceTextures[i] != null)
                {
                    textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID));
                }
                else
                {
                    textures.Add(OSD.FromUUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
                }
            }
            data["textures"] = textures;

            // Visual Parameters
            OSDBinary visualparams = new OSDBinary(m_visualparams);

            data["visualparams"] = visualparams;

            // Attachments
            List <AvatarAttachment> attachments = GetAttachments();
            OSDArray attachs = new OSDArray(attachments.Count);

            foreach (AvatarAttachment attach in attachments)
            {
                attachs.Add(attach.Pack());
            }
            data["attachments"] = attachs;

            return(data);
        }
Exemplo n.º 20
0
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["GroupID"]          = OSD.FromUUID(GroupID);
            map["IsGroupOwned"]     = OSD.FromBoolean(IsGroupOwned);
            map["OwnerID"]          = OSD.FromUUID(OwnerID);
            map["Maturity"]         = OSD.FromInteger(Maturity);
            map["Area"]             = OSD.FromInteger(Area);
            map["AuctionID"]        = OSD.FromUInteger(AuctionID);
            map["SalePrice"]        = OSD.FromInteger(SalePrice);
            map["InfoUUID"]         = OSD.FromUUID(InfoUUID);
            map["Dwell"]            = OSD.FromInteger(Dwell);
            map["Flags"]            = OSD.FromInteger((int)Flags);
            map["Name"]             = OSD.FromString(Name);
            map["Description"]      = OSD.FromString(Description);
            map["UserLocation"]     = OSD.FromVector3(UserLocation);
            map["LocalID"]          = OSD.FromInteger(LocalID);
            map["GlobalID"]         = OSD.FromUUID(GlobalID);
            map["RegionID"]         = OSD.FromUUID(RegionID);
            map["ScopeID"]          = OSD.FromUUID(ScopeID);
            map["MediaDescription"] = OSD.FromString(MediaDescription);
            map["MediaWidth"]       = OSD.FromInteger(MediaWidth);
            map["MediaHeight"]      = OSD.FromInteger(MediaHeight);
            map["MediaLoop"]        = OSD.FromBoolean(MediaLoop);
            map["MediaType"]        = OSD.FromString(MediaType);
            map["ObscureMedia"]     = OSD.FromBoolean(ObscureMedia);
            map["ObscureMusic"]     = OSD.FromBoolean(ObscureMusic);
            map["SnapshotID"]       = OSD.FromUUID(SnapshotID);
            map["MediaAutoScale"]   = OSD.FromInteger(MediaAutoScale);
            map["MediaLoopSet"]     = OSD.FromReal(MediaLoopSet);
            map["MediaURL"]         = OSD.FromString(MediaURL);
            map["MusicURL"]         = OSD.FromString(MusicURL);
            map["Bitmap"]           = OSD.FromBinary(Bitmap);
            map["Category"]         = OSD.FromInteger((int)Category);
            map["FirstParty"]       = OSD.FromBoolean(FirstParty);
            map["ClaimDate"]        = OSD.FromInteger(ClaimDate);
            map["ClaimPrice"]       = OSD.FromInteger(ClaimPrice);
            map["Status"]           = OSD.FromInteger((int)Status);
            map["LandingType"]      = OSD.FromInteger(LandingType);
            map["PassHours"]        = OSD.FromReal(PassHours);
            map["PassPrice"]        = OSD.FromInteger(PassPrice);
            map["UserLookAt"]       = OSD.FromVector3(UserLookAt);
            map["AuthBuyerID"]      = OSD.FromUUID(AuthBuyerID);
            map["OtherCleanTime"]   = OSD.FromInteger(OtherCleanTime);
            map["RegionHandle"]     = OSD.FromULong(RegionHandle);
            map["Private"]          = OSD.FromBoolean(Private);
            map["GenericDataMap"]   = GenericData;
            return(map);
        }
Exemplo n.º 21
0
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map["GlobalPosX"] = OSD.FromReal(GlobalPosX).ToString();
            map["GlobalPosY"] = OSD.FromReal(GlobalPosY).ToString();
//            map["GlobalPosX"] = GlobalPosX;
//            map["GlobalPosY"] = GlobalPosY;
            map["LandData"]      = LandData.ToOSD();
            map["RegionName"]    = RegionName;
            map["RegionType"]    = RegionType;
            map["RegionTerrain"] = RegionTerrain;
            map["RegionArea"]    = RegionArea;
            return(map);
        }
Exemplo n.º 22
0
        private void UpdateFontSize()
        {
            double f        = 8.25;
            double existing = s["chat_font_size"].AsReal();

            if (!double.TryParse(cbFontSize.Text, out f))
            {
                cbFontSize.Text = s["chat_font_size"].AsReal().ToString(System.Globalization.CultureInfo.InvariantCulture);
                return;
            }

            if (Math.Abs(existing - f) > 0.0001f)
            {
                s["chat_font_size"] = OSD.FromReal(f);
            }
        }
Exemplo n.º 23
0
        private void SaveConfig(object state)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => SaveConfig(state)));
                return;
            }

            s["parcel_audio_url"]      = OSD.FromString(txtAudioURL.Text);
            s["parcel_audio_vol"]      = OSD.FromReal(audioVolume);
            s["parcel_audio_play"]     = OSD.FromBoolean(cbPlayAudioStream.Checked);
            s["parcel_audio_keep_url"] = OSD.FromBoolean(cbKeep.Checked);
            s["object_audio_vol"]      = OSD.FromReal(this.instance.MediaManager.ObjectVolume);
            s["object_audio_enable"]   = OSD.FromBoolean(cbObjSoundEnable.Checked);
            s["ui_audio_vol"]          = OSD.FromReal(this.instance.MediaManager.UIVolume);
        }
Exemplo n.º 24
0
        private string Report()
        {
            OSDMap args = new OSDMap(30);

            //int time = Util.ToUnixTime(DateTime.Now);
            args["OSStatsURI"]   = OSD.FromString("http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/" + osXStatsURI + "/");
            args["TimeZoneName"] = OSD.FromString(localZone);
            args["TimeZoneOffs"] = OSD.FromReal(utcOffset.TotalHours);
            args["UxTime"]       = OSD.FromInteger(Util.ToUnixTime(DateTime.Now));
            args["Memory"]       = OSD.FromReal(Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
            args["Version"]      = OSD.FromString(VersionInfo.Version);

            string strBuffer = "";

            strBuffer = OSDParser.SerializeJsonString(args);

            return(strBuffer);
        }
Exemplo n.º 25
0
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map.Add("RegionID", OSD.FromUUID(RegionID));
            map.Add("RegionLocX", OSD.FromReal(RegionLocX));
            map.Add("RegionLocY", OSD.FromReal(RegionLocY));
            map.Add("TelehubRotX", OSD.FromReal(TelehubRotX));
            map.Add("TelehubRotY", OSD.FromReal(TelehubRotY));
            map.Add("TelehubRotZ", OSD.FromReal(TelehubRotZ));
            map.Add("TelehubLocX", OSD.FromReal(TelehubLocX));
            map.Add("TelehubLocY", OSD.FromReal(TelehubLocY));
            map.Add("TelehubLocZ", OSD.FromReal(TelehubLocZ));
            map.Add("Spawns", OSD.FromString(BuildFromList(SpawnPos)));
            map.Add("ObjectUUID", OSD.FromUUID(ObjectUUID));
            map.Add("Name", OSD.FromString(Name));
            return(map);
        }
Exemplo n.º 26
0
        public void SerializeReal()
        {
            OSD    llsdOne   = OSD.FromReal(12987234.723847d);
            string sOne      = OSDParser.SerializeLLSDNotation(llsdOne);
            OSD    llsdOneDS = OSDParser.DeserializeLLSDNotation(sOne);

            Assert.AreEqual(OSDType.Real, llsdOneDS.Type);
            Assert.AreEqual(12987234.723847d, llsdOneDS.AsReal());

            OSD    llsdTwo   = OSD.FromReal(-32347892.234234d);
            string sTwo      = OSDParser.SerializeLLSDNotation(llsdTwo);
            OSD    llsdTwoDS = OSDParser.DeserializeLLSDNotation(sTwo);

            Assert.AreEqual(OSDType.Real, llsdTwoDS.Type);
            Assert.AreEqual(-32347892.234234d, llsdTwoDS.AsReal());

            OSD    llsdThree   = OSD.FromReal(Double.MaxValue);
            string sThree      = OSDParser.SerializeLLSDNotation(llsdThree);
            OSD    llsdThreeDS = OSDParser.DeserializeLLSDNotation(sThree);

            Assert.AreEqual(OSDType.Real, llsdThreeDS.Type);
            Assert.AreEqual(Double.MaxValue, llsdThreeDS.AsReal());

            OSD    llsdFour   = OSD.FromReal(Double.MinValue);
            string sFour      = OSDParser.SerializeLLSDNotation(llsdFour);
            OSD    llsdFourDS = OSDParser.DeserializeLLSDNotation(sFour);

            Assert.AreEqual(OSDType.Real, llsdFourDS.Type);
            Assert.AreEqual(Double.MinValue, llsdFourDS.AsReal());

            OSD    llsdFive   = OSD.FromReal(-1.1123123E+50d);
            string sFive      = OSDParser.SerializeLLSDNotation(llsdFive);
            OSD    llsdFiveDS = OSDParser.DeserializeLLSDNotation(sFive);

            Assert.AreEqual(OSDType.Real, llsdFiveDS.Type);
            Assert.AreEqual(-1.1123123E+50d, llsdFiveDS.AsReal());

            OSD    llsdSix   = OSD.FromReal(2.0193899999999998204e-06);
            string sSix      = OSDParser.SerializeLLSDNotation(llsdSix);
            OSD    llsdSixDS = OSDParser.DeserializeLLSDNotation(sSix);

            Assert.AreEqual(OSDType.Real, llsdSixDS.Type);
            Assert.AreEqual(2.0193899999999998204e-06, llsdSixDS.AsReal());
        }
Exemplo n.º 27
0
        public OSDMap Pack(EntityTransferContext ctx)
        {
            OSDMap args = new OSDMap();

            args["message_type"] = OSD.FromString("AgentPosition");

            args["region_handle"] = OSD.FromString(RegionHandle.ToString());
            args["circuit_code"]  = OSD.FromString(CircuitCode.ToString());
            args["agent_uuid"]    = OSD.FromUUID(AgentID);
            args["session_uuid"]  = OSD.FromUUID(SessionID);

            args["position"]  = OSD.FromString(Position.ToString());
            args["velocity"]  = OSD.FromString(Velocity.ToString());
            args["center"]    = OSD.FromString(Center.ToString());
            args["size"]      = OSD.FromString(Size.ToString());
            args["at_axis"]   = OSD.FromString(AtAxis.ToString());
            args["left_axis"] = OSD.FromString(LeftAxis.ToString());
            args["up_axis"]   = OSD.FromString(UpAxis.ToString());

            args["far"]          = OSD.FromReal(Far);
            args["changed_grid"] = OSD.FromBoolean(ChangedGrid);

            if ((Throttles != null) && (Throttles.Length > 0))
            {
                args["throttles"] = OSD.FromBinary(Throttles);
            }

            if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0)
            {
                OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
                foreach (KeyValuePair <ulong, string> kvp in ChildrenCapSeeds)
                {
                    OSDMap pair = new OSDMap();
                    pair["handle"] = OSD.FromString(kvp.Key.ToString());
                    pair["seed"]   = OSD.FromString(kvp.Value);
                    childrenSeeds.Add(pair);
                }
                args["children_seeds"] = childrenSeeds;
            }

            return(args);
        }
            public OSD GetOSD()
            {
                OSDMap map = new OSDMap();

                map["crc"]               = OSD.FromInteger(CRC);
                map["part_flags"]        = OSD.FromInteger(PartFlags);
                map["pattern"]           = OSD.FromInteger((int)Pattern);
                map["max_age"]           = OSD.FromReal(MaxAge);
                map["start_age"]         = OSD.FromReal(StartAge);
                map["inner_angle"]       = OSD.FromReal(InnerAngle);
                map["outer_angle"]       = OSD.FromReal(OuterAngle);
                map["burst_rate"]        = OSD.FromReal(BurstRate);
                map["burst_radius"]      = OSD.FromReal(BurstRadius);
                map["burst_speed_min"]   = OSD.FromReal(BurstSpeedMin);
                map["burst_speed_max"]   = OSD.FromReal(BurstSpeedMax);
                map["burst_part_count"]  = OSD.FromInteger(BurstPartCount);
                map["ang_velocity"]      = OSD.FromVector3(AngularVelocity);
                map["part_acceleration"] = OSD.FromVector3(PartAcceleration);
                map["texture"]           = OSD.FromUUID(Texture);
                map["target"]            = OSD.FromUUID(Target);

                map["part_data_flags"]  = (uint)PartDataFlags;
                map["part_max_age"]     = PartMaxAge;
                map["part_start_color"] = PartStartColor;
                map["part_end_color"]   = PartEndColor;
                map["part_start_scale"] = new Vector3(PartStartScaleX, PartStartScaleY, 0f);
                map["part_end_scale"]   = new Vector3(PartEndScaleX, PartEndScaleY, 0f);

                if (HasGlow())
                {
                    map["part_start_glow"] = PartStartGlow;
                    map["part_end_glow"]   = PartEndGlow;
                }

                if (HasBlendFunc())
                {
                    map["blendfunc_source"] = BlendFuncSource;
                    map["blendfunc_dest"]   = BlendFuncDest;
                }

                return(map);
            }
Exemplo n.º 29
0
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap
            {
                { "RegionID", OSD.FromUUID(RegionID) },
                { "RegionLocX", OSD.FromReal(RegionLocX) },
                { "RegionLocY", OSD.FromReal(RegionLocY) },
                { "TelehubRotX", OSD.FromReal(TelehubRotX) },
                { "TelehubRotY", OSD.FromReal(TelehubRotY) },
                { "TelehubRotZ", OSD.FromReal(TelehubRotZ) },
                { "TelehubLocX", OSD.FromReal(TelehubLocX) },
                { "TelehubLocY", OSD.FromReal(TelehubLocY) },
                { "TelehubLocZ", OSD.FromReal(TelehubLocZ) },
                { "Spawns", OSD.FromString(BuildFromList(SpawnPos)) },
                { "ObjectUUID", OSD.FromUUID(ObjectUUID) },
                { "Name", OSD.FromString(Name) }
            };

            return(map);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Report back collected statistical information as json serialization.
        /// </summary>
        /// <returns></returns>
        public override string XReport(string uptime, string version)
        {
            OSDMap args = new OSDMap(30);

            args["AssetsInCache"]                     = OSD.FromReal(AssetsInCache);
            args["TimeAfterCacheMiss"]                = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0);
            args["BlockedMissingTextureRequests"]     = OSD.FromReal(BlockedMissingTextureRequests);
            args["AssetServiceRequestFailures"]       = OSD.FromReal(AssetServiceRequestFailures);
            args["abnormalClientThreadTerminations"]  = OSD.FromReal(abnormalClientThreadTerminations);
            args["InventoryServiceRetrievalFailures"] = OSD.FromReal(InventoryServiceRetrievalFailures);
            args["Dilatn"]  = OSD.FromReal(timeDilation);
            args["SimFPS"]  = OSD.FromReal(simFps);
            args["PhyFPS"]  = OSD.FromReal(physicsFps);
            args["AgntUp"]  = OSD.FromReal(agentUpdates);
            args["RootAg"]  = OSD.FromReal(rootAgents);
            args["ChldAg"]  = OSD.FromReal(childAgents);
            args["Prims"]   = OSD.FromReal(totalPrims);
            args["AtvPrm"]  = OSD.FromReal(activePrims);
            args["AtvScr"]  = OSD.FromReal(activeScripts);
            args["ScrLPS"]  = OSD.FromReal(scriptLinesPerSecond);
            args["PktsIn"]  = OSD.FromReal(inPacketsPerSecond);
            args["PktOut"]  = OSD.FromReal(outPacketsPerSecond);
            args["PendDl"]  = OSD.FromReal(pendingDownloads);
            args["PendUl"]  = OSD.FromReal(pendingUploads);
            args["UnackB"]  = OSD.FromReal(unackedBytes);
            args["TotlFt"]  = OSD.FromReal(totalFrameTime);
            args["NetFt"]   = OSD.FromReal(netFrameTime);
            args["PhysFt"]  = OSD.FromReal(physicsFrameTime);
            args["OthrFt"]  = OSD.FromReal(otherFrameTime);
            args["AgntFt"]  = OSD.FromReal(agentFrameTime);
            args["ImgsFt"]  = OSD.FromReal(imageFrameTime);
            args["Memory"]  = OSD.FromString(base.XReport(uptime, version));
            args["Uptime"]  = OSD.FromString(uptime);
            args["Version"] = OSD.FromString(version);

            string strBuffer = String.Empty;

            strBuffer = OSDParser.SerializeJsonString(args);

            return(strBuffer);
        }