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"); } } }
private bool SendRezAvatarRequest(LLAgent agent, SceneInfo neighbor, bool isChild, out IPAddress simHost, out int simPort, out Uri seedCapability) { simHost = null; simPort = 0; seedCapability = null; Uri rezAvatarRequestCap; if (neighbor.TryGetCapability("rez_avatar/request", out rezAvatarRequestCap)) { string firstName, lastName; Util.GetFirstLastName(agent.Name, out firstName, out lastName); // Find the presence position relative to this neighbor Vector3 relativePosition = agent.ScenePosition - new Vector3(neighbor.MinPosition - m_scene.MinPosition); // Calculate the direction this agent is currently facing Vector3 lookAt = Vector3.UnitY * agent.RelativeRotation; // Create the template rez_avatar/request message OSDMap rezAvatarRequest = new OSDMap { { "agent_id", OSD.FromUUID(agent.ID) }, { "session_id", OSD.FromUUID(agent.SessionID) }, { "position", OSD.FromVector3(relativePosition) }, { "look_at", OSD.FromVector3(lookAt) }, { "velocity", OSD.FromVector3(agent.Velocity) }, { "child", OSD.FromBoolean(isChild) } }; OSDMap rezAvatarResponse = null; try { // Send the message and get a response rezAvatarResponse = OSDParser.Deserialize(UntrustedHttpWebRequest.PostToUntrustedUrl( rezAvatarRequestCap, OSDParser.SerializeJsonString(rezAvatarRequest))) as OSDMap; } catch { } if (rezAvatarResponse != null) { return(RezChildAgentReplyHandler(agent, rezAvatarResponse, out simHost, out simPort, out seedCapability)); } else { m_log.Warn(m_scene.Name + " failed to create a child agent on " + neighbor.Name + ", rez_avatar/request failed"); } } else { m_log.Warn(neighbor.Name + " does not have a rez_avatar/request capability"); } return(false); }
/// <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); }
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); }
public override OSDMap ToOSD() { OSDMap Pick = new OSDMap(); Pick.Add("PickUUID", OSD.FromUUID(PickUUID)); Pick.Add("CreatorUUID", OSD.FromUUID(CreatorUUID)); Pick.Add("TopPick", OSD.FromInteger(TopPick)); Pick.Add("ParcelUUID", OSD.FromUUID(ParcelUUID)); Pick.Add("Name", OSD.FromString(Name)); Pick.Add("Description", OSD.FromString(Description)); Pick.Add("SnapshotUUID", OSD.FromUUID(SnapshotUUID)); Pick.Add("User", OSD.FromString(User)); Pick.Add("OriginalName", OSD.FromString(OriginalName)); Pick.Add("SimName", OSD.FromString(SimName)); Pick.Add("GlobalPos", OSD.FromVector3(GlobalPos)); Pick.Add("SortOrder", OSD.FromInteger(SortOrder)); Pick.Add("Enabled", OSD.FromInteger(Enabled)); return(Pick); }
public override OSDMap ToOSD() { OSDMap map = new OSDMap(); map.Add("fromAgentID", OSD.FromUUID(new UUID(fromAgentID))); map.Add("fromAgentName", OSD.FromString(fromAgentName)); map.Add("toAgentID", OSD.FromUUID(new UUID(toAgentID))); map.Add("dialog", OSD.FromInteger(dialog)); map.Add("fromGroup", OSD.FromBoolean(fromGroup)); map.Add("message", OSD.FromString(message)); map.Add("imSessionID", OSD.FromUUID(new UUID(imSessionID))); map.Add("offline", OSD.FromInteger(offline)); map.Add("Position", OSD.FromVector3(Position)); map.Add("binaryBucket", OSD.FromBinary(binaryBucket)); map.Add("ParentEstateID", OSD.FromUInteger(ParentEstateID)); map.Add("RegionID", OSD.FromUUID(new UUID(RegionID))); map.Add("timestamp", OSD.FromUInteger(timestamp)); return(map); }
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); }
private void FillOutRezAgentResponse(User user, Uri seedCapability, Vector3 startPosition, Vector3 lookAt, ref OSDMap responseMap) { IPAddress externalAddress = m_lludp.MasqueradeAddress ?? m_lludp.Address; uint regionX, regionY; GetRegionXY(m_scene.MinPosition, out regionX, out regionY); responseMap["connect"] = OSD.FromBoolean(true); responseMap["agent_id"] = OSD.FromUUID(user.ID); responseMap["sim_host"] = OSD.FromString(externalAddress.ToString()); responseMap["sim_port"] = OSD.FromInteger(m_lludp.Port); responseMap["region_seed_capability"] = OSD.FromUri(seedCapability); responseMap["position"] = OSD.FromVector3(startPosition); responseMap["look_at"] = OSD.FromVector3(lookAt); // Region information responseMap["region_id"] = OSD.FromUUID(m_scene.ID); responseMap["region_x"] = OSD.FromInteger(regionX); responseMap["region_y"] = OSD.FromInteger(regionY); }
public override OSDMap ToOSD() { OSDMap Classified = new OSDMap(); Classified.Add("ClassifiedUUID", OSD.FromUUID(ClassifiedUUID)); Classified.Add("CreatorUUID", OSD.FromUUID(CreatorUUID)); Classified.Add("CreationDate", OSD.FromUInteger(CreationDate)); Classified.Add("ExpirationDate", OSD.FromUInteger(ExpirationDate)); Classified.Add("Category", OSD.FromUInteger(Category)); Classified.Add("Name", OSD.FromString(Name)); Classified.Add("Description", OSD.FromString(Description)); Classified.Add("ParcelUUID", OSD.FromUUID(ParcelUUID)); Classified.Add("ParentEstate", OSD.FromUInteger(ParentEstate)); Classified.Add("SnapshotUUID", OSD.FromUUID(SnapshotUUID)); Classified.Add("SimName", OSD.FromString(SimName)); Classified.Add("GlobalPos", OSD.FromVector3(GlobalPos)); Classified.Add("ParcelName", OSD.FromString(ParcelName)); Classified.Add("ClassifiedFlags", OSD.FromInteger(ClassifiedFlags)); Classified.Add("PriceForListing", OSD.FromInteger(PriceForListing)); return(Classified); }
public override OSDMap ToOSD() { OSDMap Pick = new OSDMap { { "PickUUID", OSD.FromUUID(PickUUID) }, { "CreatorUUID", OSD.FromUUID(CreatorUUID) }, { "TopPick", OSD.FromInteger(TopPick) }, { "ParcelUUID", OSD.FromUUID(ParcelUUID) }, { "Name", OSD.FromString(Name) }, { "Description", OSD.FromString(Description) }, { "SnapshotUUID", OSD.FromUUID(SnapshotUUID) }, { "User", OSD.FromString(User) }, { "OriginalName", OSD.FromString(OriginalName) }, { "SimName", OSD.FromString(SimName) }, { "GlobalPos", OSD.FromVector3(GlobalPos) }, { "SortOrder", OSD.FromInteger(SortOrder) }, { "Enabled", OSD.FromInteger(Enabled) } }; return(Pick); }
public override OSDMap ToOSD() { OSDMap map = new OSDMap { { "fromAgentID", OSD.FromUUID(FromAgentID) }, { "fromAgentName", OSD.FromString(FromAgentName) }, { "toAgentID", OSD.FromUUID(ToAgentID) }, { "dialog", OSD.FromInteger(Dialog) }, { "fromGroup", OSD.FromBoolean(FromGroup) }, { "message", OSD.FromString(Message) }, { "imSessionID", OSD.FromUUID(SessionID) }, { "offline", OSD.FromInteger(Offline) }, { "Position", OSD.FromVector3(Position) }, { "binaryBucket", OSD.FromBinary(BinaryBucket) }, { "ParentEstateID", OSD.FromUInteger(ParentEstateID) }, { "RegionID", OSD.FromUUID(RegionID) }, { "timestamp", OSD.FromUInteger(Timestamp) } }; return(map); }
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); return(map); }
public OSDMap GetOSD() { Primitive.ConstructionData primData = Prim.PrimData; Primitive.ObjectProperties properties = Prim.Properties; OSDMap pathMap = new OSDMap(); pathMap["begin"] = OSD.FromReal(primData.PathBegin); pathMap["curve"] = OSD.FromInteger((int)primData.PathCurve); pathMap["end"] = OSD.FromReal(primData.PathEnd); pathMap["radius_offset"] = OSD.FromReal(primData.PathRadiusOffset); pathMap["revolutions"] = OSD.FromReal(primData.PathRevolutions); pathMap["scale_x"] = OSD.FromReal(primData.PathScaleX); pathMap["scale_y"] = OSD.FromReal(primData.PathScaleY); pathMap["shear_x"] = OSD.FromReal(primData.PathShearX); pathMap["shear_y"] = OSD.FromReal(primData.PathShearY); pathMap["skew"] = OSD.FromReal(primData.PathSkew); pathMap["taper_x"] = OSD.FromReal(primData.PathTaperX); pathMap["taper_y"] = OSD.FromReal(primData.PathTaperY); pathMap["twist"] = OSD.FromReal(primData.PathTwist); pathMap["twist_begin"] = OSD.FromReal(primData.PathTwistBegin); OSDMap profileMap = new OSDMap(); profileMap["begin"] = OSD.FromReal(primData.ProfileBegin); profileMap["curve"] = OSD.FromInteger((int)primData.ProfileCurve); profileMap["hole"] = OSD.FromInteger((int)primData.ProfileHole); profileMap["end"] = OSD.FromReal(primData.ProfileEnd); profileMap["hollow"] = OSD.FromReal(primData.ProfileHollow); OSDMap propertiesMap = new OSDMap(); if (properties != null) { propertiesMap["aggregate_perms"] = OSD.FromInteger(properties.AggregatePerms); propertiesMap["aggregate_perms_textures"] = OSD.FromInteger(properties.AggregatePermTextures); propertiesMap["aggregate_perms_textures_owner"] = OSD.FromInteger(properties.AggregatePermTexturesOwner); propertiesMap["category"] = OSD.FromInteger((int)properties.Category); propertiesMap["creation_date"] = OSD.FromDate(properties.CreationDate); propertiesMap["creator_id"] = OSD.FromUUID(properties.CreatorID); propertiesMap["description"] = OSD.FromString(properties.Description); propertiesMap["folder_id"] = OSD.FromUUID(properties.FolderID); propertiesMap["from_task_id"] = OSD.FromUUID(properties.FromTaskID); // properties.GroupID is redundant propertiesMap["inventory_serial"] = OSD.FromInteger(properties.InventorySerial); propertiesMap["item_id"] = OSD.FromUUID(properties.ItemID); propertiesMap["last_owner_id"] = OSD.FromUUID(properties.LastOwnerID); propertiesMap["name"] = OSD.FromString(properties.Name); // properties.ObjectID is redundant // properties.OwnerID is redundant propertiesMap["ownership_cost"] = OSD.FromInteger(properties.OwnershipCost); propertiesMap["permissions"] = properties.Permissions.GetOSD(); propertiesMap["sale_price"] = OSD.FromInteger(properties.SalePrice); propertiesMap["sale_type"] = OSD.FromInteger((int)properties.SaleType); propertiesMap["sit_name"] = OSD.FromString(properties.SitName); propertiesMap["touch_name"] = OSD.FromString(properties.TouchName); } OSDMap primMap = new OSDMap(); primMap["path"] = pathMap; primMap["profile"] = profileMap; primMap["properties"] = propertiesMap; primMap["acceleration"] = OSD.FromVector3(Prim.Acceleration); primMap["ang_velocity"] = OSD.FromVector3(Prim.AngularVelocity); primMap["click_action"] = OSD.FromInteger((int)Prim.ClickAction); primMap["flags"] = OSD.FromInteger((uint)Prim.Flags); primMap["group_id"] = OSD.FromUUID(Prim.GroupID); primMap["id"] = OSD.FromUUID(Prim.ID); primMap["local_id"] = OSD.FromInteger(Prim.LocalID); primMap["media_url"] = OSD.FromString(Prim.MediaURL); primMap["owner_id"] = OSD.FromUUID(Prim.OwnerID); primMap["parent_id"] = OSD.FromInteger(Prim.ParentID); primMap["particles"] = Prim.ParticleSys.GetOSD(); primMap["position"] = OSD.FromVector3(Prim.Position); primMap["rotation"] = OSD.FromQuaternion(Prim.Rotation); primMap["scale"] = OSD.FromVector3(Prim.Scale); primMap["scratch_pad"] = OSD.FromBinary(Prim.ScratchPad); primMap["sound"] = OSD.FromUUID(Prim.Sound); primMap["sound_flags"] = OSD.FromInteger((int)Prim.SoundFlags); primMap["sound_gain"] = OSD.FromReal(Prim.SoundGain); primMap["sound_radius"] = OSD.FromReal(Prim.SoundRadius); primMap["text"] = OSD.FromString(Prim.Text); primMap["text_color"] = OSD.FromColor4(Prim.TextColor); primMap["texture_anim"] = Prim.TextureAnim.GetOSD(); primMap["tree_species"] = OSD.FromInteger((int)Prim.TreeSpecies); primMap["velocity"] = OSD.FromVector3(Prim.Velocity); primMap["material"] = OSD.FromInteger((int)primData.Material); primMap["state"] = OSD.FromInteger(primData.State); primMap["pcode"] = OSD.FromInteger((int)primData.PCode); if (Prim.NameValues != null) primMap["name_values"] = OSD.FromString(NameValue.NameValuesToString(Prim.NameValues)); if (Prim.Textures != null) primMap["textures"] = Prim.Textures.GetOSD(); if (Prim.Light != null) primMap["light"] = Prim.Light.GetOSD(); if (Prim.Flexible != null) primMap["flex"] = Prim.Flexible.GetOSD(); if (Prim.Sculpt != null) primMap["sculpt"] = Prim.Sculpt.GetOSD(); OSDMap map = new OSDMap(); map["prim"] = primMap; map["sit_position"] = OSD.FromVector3(SitPosition); map["sit_rotation"] = OSD.FromQuaternion(SitRotation); map["attachment_position"] = OSD.FromVector3(AttachmentPosition); map["attachment_rotation"] = OSD.FromQuaternion(AttachmentRotation); map["last_attachment_point"] = OSD.FromInteger((int)LastAttachmentPoint); map["before_attachment_rotation"] = OSD.FromQuaternion(BeforeAttachmentRotation); map["rotation_axis"] = OSD.FromVector3(m_rotationAxis); map["link_number"] = OSD.FromInteger(m_linkNumber); map["remote_script_access_pin"] = OSD.FromInteger(RemoteScriptAccessPIN); map["inventory"] = OSD.FromString(Inventory.GetTaskInventoryAsset()); OSDArray buttons = new OSDArray { OSD.FromInteger(PayPriceButtons[0]), OSD.FromInteger(PayPriceButtons[1]), OSD.FromInteger(PayPriceButtons[2]), OSD.FromInteger(PayPriceButtons[3]) }; map["pay_price_buttons"] = buttons; map["pay_price"] = OSD.FromInteger(PayPrice); if (Prim.FaceMedia != null) { OSDArray faceMedia = new OSDArray(Prim.FaceMedia.Length); for (int i = 0; i < Prim.FaceMedia.Length; i++) { MediaEntry entry = Prim.FaceMedia[i]; if (entry != null) faceMedia.Add(entry.GetOSD()); else faceMedia.Add(new OSD()); } map["face_media"] = faceMedia; } map["media_version"] = OSD.FromString(Prim.MediaVersion); map["last_updated"] = OSD.FromDate(m_lastUpdated); return map; }
private OSDMap RezAvatarRequest(SceneInfo sceneInfo, UserSession session, Vector3 relativeStartPosition, Vector3 lookAt) { string urlFriendlySceneName = WebUtil.UrlEncode(sceneInfo.Name); Uri publicRegionSeedCap = sceneInfo.PublicSeedCapability; // Send a request to the public region seed cap OSDMap publicRegionCaps = null; try { publicRegionCaps = OSDParser.Deserialize(UntrustedHttpWebRequest.GetUntrustedUrl(publicRegionSeedCap)) as OSDMap; if (publicRegionCaps != null) { publicRegionCaps = publicRegionCaps["capabilities"] as OSDMap; } } catch { } if (publicRegionCaps != null) { // Parse the rez_avatar/request cap out Uri rezAvatarRequestCap = publicRegionCaps["rez_avatar/request"].AsUri(); if (rezAvatarRequestCap != null) { string firstName, lastName; Util.GetFirstLastName(session.User.Name, out firstName, out lastName); OSDMap rezAvatarRequest = new OSDMap { { "agent_id", OSD.FromUUID(session.User.ID) }, { "session_id", OSD.FromUUID(session.SessionID) }, { "position", OSD.FromVector3(relativeStartPosition) }, { "look_at", OSD.FromVector3(lookAt) }, { "velocity", OSD.FromVector3(Vector3.Zero) }, { "child", OSD.FromBoolean(false) } }; OSDMap rezAvatarResponse = null; try { rezAvatarResponse = OSDParser.Deserialize(UntrustedHttpWebRequest.PostToUntrustedUrl( rezAvatarRequestCap, OSDParser.SerializeLLSDXmlString(rezAvatarRequest))) as OSDMap; } catch { } if (rezAvatarResponse != null) { // Parse the response data if (rezAvatarResponse["connect"].AsBoolean()) { return(rezAvatarResponse); } else { m_log.Warn("Cannot rez avatar " + session.User.Name + ", rez_avatar/request to " + rezAvatarRequestCap + " failed: " + rezAvatarResponse["message"].AsString()); } } } else { m_log.Warn("Cannot rez avatar " + session.User.Name + ", rez_avatar/request capability not found in public region seed capability: " + publicRegionCaps.ToString()); } } else { m_log.Warn("Cannot rez avatar " + session.User.Name + ", Failed to fetch public region seed capability from " + publicRegionSeedCap); } return(null); }
public OSDMap GetOSD() { OSDMap map = new OSDMap(); map["id"] = OSD.FromUUID(ID); map["local_id"] = OSD.FromInteger(LocalID); OSDArray blacklist = new OSDArray(); if (AccessBlackList != null) { for (int i = 0; i < AccessBlackList.Count; i++) { blacklist.Add(AccessBlackList[i].GetOSD()); } } map["access_black_list"] = blacklist; OSDArray whitelist = new OSDArray(); if (AccessWhiteList != null) { for (int i = 0; i < AccessWhiteList.Count; i++) { whitelist.Add(AccessWhiteList[i].GetOSD()); } } map["access_white_list"] = whitelist; map["auth_buyer_id"] = OSD.FromUUID(AuthBuyerID); map["auto_return_time"] = OSD.FromInteger(AutoReturnTime); map["bitmap"] = OSD.FromBinary(Bitmap); map["category"] = OSD.FromInteger((int)Category); map["claim_date"] = OSD.FromDate(ClaimDate); map["desc"] = OSD.FromString(Desc); map["dwell"] = OSD.FromReal(Dwell); map["flags"] = OSD.FromInteger((uint)Flags); map["group_id"] = OSD.FromUUID(GroupID); map["is_group_owned"] = OSD.FromBoolean(IsGroupOwned); map["landing"] = OSD.FromInteger((int)Landing); map["max_prims"] = OSD.FromInteger(MaxPrims); OSDMap media = new OSDMap { { "auto_scale", OSD.FromBoolean(Media.MediaAutoScale) }, { "desc", OSD.FromString(Media.MediaDesc) }, { "height", OSD.FromInteger(Media.MediaHeight) }, { "id", OSD.FromUUID(Media.MediaID) }, { "loop", OSD.FromBoolean(Media.MediaLoop) }, { "type", OSD.FromString(Media.MediaType) }, { "url", OSD.FromString(Media.MediaURL) }, { "width", OSD.FromInteger(Media.MediaWidth) } }; map["parcel_media"] = media; map["music_url"] = OSD.FromString(MusicURL); map["name"] = OSD.FromString(Name); map["obscure_media"] = OSD.FromBoolean(ObscureMedia); map["obscure_music"] = OSD.FromBoolean(ObscureMusic); map["owner_id"] = OSD.FromUUID(OwnerID); map["pass_hours"] = OSD.FromReal(PassHours); map["pass_price"] = OSD.FromInteger(PassPrice); map["deny_age_unverified"] = OSD.FromBoolean(DenyAgeUnverified); map["deny_anonymous"] = OSD.FromBoolean(DenyAnonymous); map["push_override"] = OSD.FromBoolean(PushOverride); map["sale_price"] = OSD.FromInteger(SalePrice); map["snapshot_id"] = OSD.FromUUID(SnapshotID); map["status"] = OSD.FromInteger((int)Status); map["landing_location"] = OSD.FromVector3(LandingLocation); map["landing_look_at"] = OSD.FromVector3(LandingLookAt); return(map); }
public virtual OSD GetOSD() { OSDMap path = new OSDMap(14); path["begin"] = OSD.FromReal(PrimData.PathBegin); path["curve"] = OSD.FromInteger((int)PrimData.PathCurve); path["end"] = OSD.FromReal(PrimData.PathEnd); path["radius_offset"] = OSD.FromReal(PrimData.PathRadiusOffset); path["revolutions"] = OSD.FromReal(PrimData.PathRevolutions); path["scale_x"] = OSD.FromReal(PrimData.PathScaleX); path["scale_y"] = OSD.FromReal(PrimData.PathScaleY); path["shear_x"] = OSD.FromReal(PrimData.PathShearX); path["shear_y"] = OSD.FromReal(PrimData.PathShearY); path["skew"] = OSD.FromReal(PrimData.PathSkew); path["taper_x"] = OSD.FromReal(PrimData.PathTaperX); path["taper_y"] = OSD.FromReal(PrimData.PathTaperY); path["twist"] = OSD.FromReal(PrimData.PathTwist); path["twist_begin"] = OSD.FromReal(PrimData.PathTwistBegin); OSDMap profile = new OSDMap(4); profile["begin"] = OSD.FromReal(PrimData.ProfileBegin); profile["curve"] = OSD.FromInteger((int)PrimData.ProfileCurve); profile["hole"] = OSD.FromInteger((int)PrimData.ProfileHole); profile["end"] = OSD.FromReal(PrimData.ProfileEnd); profile["hollow"] = OSD.FromReal(PrimData.ProfileHollow); OSDMap volume = new OSDMap(2); volume["path"] = path; volume["profile"] = profile; OSDMap prim = new OSDMap(9); if (Properties != null) { prim["name"] = OSD.FromString(Properties.Name); prim["description"] = OSD.FromString(Properties.Description); } else { prim["name"] = OSD.FromString("Object"); prim["description"] = OSD.FromString(String.Empty); } prim["phantom"] = OSD.FromBoolean(((Flags & PrimFlags.Phantom) != 0)); prim["physical"] = OSD.FromBoolean(((Flags & PrimFlags.Physics) != 0)); prim["position"] = OSD.FromVector3(Position); prim["rotation"] = OSD.FromQuaternion(Rotation); prim["scale"] = OSD.FromVector3(Scale); prim["material"] = OSD.FromInteger((int)PrimData.Material); prim["shadows"] = OSD.FromBoolean(((Flags & PrimFlags.CastShadows) != 0)); prim["parentid"] = OSD.FromInteger(ParentID); prim["volume"] = volume; if (Textures != null) { prim["textures"] = Textures.GetOSD(); } if (Light != null) { prim["light"] = Light.GetOSD(); } if (Flexible != null) { prim["flex"] = Flexible.GetOSD(); } if (Sculpt != null) { prim["sculpt"] = Sculpt.GetOSD(); } return(prim); }
public void ToXmlRpc(XmlWriter writer) { writer.WriteStartElement("methodResponse"); { writer.WriteStartElement("params"); writer.WriteStartElement("param"); writer.WriteStartElement("value"); writer.WriteStartElement("struct"); { if (Success) { // session_id WriteXmlRpcStringMember(writer, false, "session_id", SessionID.ToString()); // ui-config WriteXmlRpcArrayStart(writer, "ui-config"); WriteXmlRpcStringMember(writer, true, "allow_first_life", "Y"); WriteXmlRpcArrayEnd(writer); // inventory-lib-owner WriteXmlRpcArrayStart(writer, "inventory-lib-owner"); WriteXmlRpcStringMember(writer, true, "agent_id", LibraryOwner.ToString()); WriteXmlRpcArrayEnd(writer); // start_location WriteXmlRpcStringMember(writer, false, "start_location", StartLocation); // seconds_since_epoch WriteXmlRpcIntMember(writer, false, "seconds_since_epoch", Utils.DateTimeToUnixTime(SecondsSinceEpoch)); // event_categories (TODO) WriteXmlRpcArrayStart(writer, "event_categories"); WriteXmlRpcCategory(writer, "Default Event Category", 20); WriteXmlRpcArrayEnd(writer); // tutorial_setting (TODO) WriteXmlRpcArrayStart(writer, "tutorial_setting"); WriteXmlRpcTutorialSetting(writer, "http://127.0.0.1/tutorial/"); WriteXmlRpcArrayEnd(writer); // classified_categories (TODO) WriteXmlRpcArrayStart(writer, "classified_categories"); WriteXmlRpcCategory(writer, "Default Classified Category", 1); WriteXmlRpcArrayEnd(writer); // inventory-root WriteXmlRpcArrayStart(writer, "inventory-root"); WriteXmlRpcStringMember(writer, true, "folder_id", InventoryRoot.ToString()); WriteXmlRpcArrayEnd(writer); // sim_port WriteXmlRpcIntMember(writer, false, "sim_port", SimPort); // agent_id WriteXmlRpcStringMember(writer, false, "agent_id", AgentID.ToString()); // agent_access WriteXmlRpcStringMember(writer, false, "agent_access", AgentAccess); // inventory-skeleton WriteXmlRpcArrayStart(writer, "inventory-skeleton"); if (InventorySkeleton != null) { foreach (InventoryFolder folder in InventorySkeleton) { WriteXmlRpcInventoryItem(writer, folder.Name, folder.ParentUUID, (uint)folder.Version, (uint)folder.PreferredType, folder.UUID); } } else { WriteXmlRpcInventoryItem(writer, "Inventory", UUID.Zero, 1, (uint)AssetType.Folder, InventoryRoot); } WriteXmlRpcArrayEnd(writer); // buddy-list WriteXmlRpcArrayStart(writer, "buddy-list"); if (BuddyList != null) { foreach (FriendInfo friend in BuddyList) { WriteXmlRpcBuddy(writer, (uint)friend.MyFriendRights, (uint)friend.TheirFriendRights, friend.UUID); } } else { //WriteXmlRpcBuddy(writer, 0, 0, UUID.Random()); } WriteXmlRpcArrayEnd(writer); // first_name WriteXmlRpcStringMember(writer, false, "first_name", FirstName); // global-textures WriteXmlRpcArrayStart(writer, "global-textures"); writer.WriteStartElement("value"); writer.WriteStartElement("struct"); { WriteXmlRpcStringMember(writer, false, "sun_texture_id", "cce0f112-878f-4586-a2e2-a8f104bba271"); WriteXmlRpcStringMember(writer, false, "cloud_texture_id", "fc4b9f0b-d008-45c6-96a4-01dd947ac621"); WriteXmlRpcStringMember(writer, false, "moon_texture_id", "d07f6eed-b96a-47cd-b51d-400ad4a1c428"); } writer.WriteEndElement(); writer.WriteEndElement(); WriteXmlRpcArrayEnd(writer); // inventory-skel-lib WriteXmlRpcArrayStart(writer, "inventory-skel-lib"); if (LibrarySkeleton != null) { foreach (InventoryFolder folder in LibrarySkeleton) { WriteXmlRpcInventoryItem(writer, folder.Name, folder.ParentUUID, (uint)folder.Version, (uint)folder.PreferredType, folder.UUID); } } else { WriteXmlRpcInventoryItem(writer, "Library", UUID.Zero, 1, (uint)AssetType.Folder, LibraryRoot); } WriteXmlRpcArrayEnd(writer); // seed_capability WriteXmlRpcStringMember(writer, false, "seed_capability", SeedCapability); // gestures WriteXmlRpcArrayStart(writer, "gestures"); WriteXmlRpcGesture(writer, UUID.Random(), UUID.Random()); WriteXmlRpcArrayEnd(writer); // sim_ip WriteXmlRpcStringMember(writer, false, "sim_ip", SimIP.ToString()); // inventory-lib-root WriteXmlRpcArrayStart(writer, "inventory-lib-root"); WriteXmlRpcStringMember(writer, true, "folder_id", LibraryRoot.ToString()); WriteXmlRpcArrayEnd(writer); // login-flags WriteXmlRpcArrayStart(writer, "login-flags"); writer.WriteStartElement("value"); writer.WriteStartElement("struct"); { WriteXmlRpcStringMember(writer, false, "gendered", "Y"); WriteXmlRpcStringMember(writer, false, "stipend_since_login", "N"); WriteXmlRpcStringMember(writer, false, "ever_logged_in", "Y"); if (DateTime.Now.IsDaylightSavingTime()) { WriteXmlRpcStringMember(writer, false, "daylight_savings", "Y"); } else { WriteXmlRpcStringMember(writer, false, "daylight_savings", "N"); } } writer.WriteEndElement(); writer.WriteEndElement(); WriteXmlRpcArrayEnd(writer); // inventory_host WriteXmlRpcStringMember(writer, false, "inventory_host", IPAddress.Loopback.ToString()); // home OSDArray homeRegionHandle = new OSDArray(2); uint homeRegionX, homeRegionY; Utils.LongToUInts(HomeRegion, out homeRegionX, out homeRegionY); homeRegionHandle.Add(OSD.FromReal((double)homeRegionX)); homeRegionHandle.Add(OSD.FromReal((double)homeRegionY)); OSDMap home = new OSDMap(3); home["region_handle"] = homeRegionHandle; home["position"] = OSD.FromVector3(HomePosition); home["look_at"] = OSD.FromVector3(HomeLookAt); WriteXmlRpcStringMember(writer, false, "home", OSDParser.SerializeLLSDNotation(home)); // message WriteXmlRpcStringMember(writer, false, "message", Message); // look_at WriteXmlRpcStringMember(writer, false, "look_at", OSDParser.SerializeLLSDNotation(OSD.FromVector3(LookAt))); // login WriteXmlRpcStringMember(writer, false, "login", "true"); // event_notifications WriteXmlRpcArrayStart(writer, "event_notifications"); WriteXmlRpcArrayEnd(writer); // secure_session_id WriteXmlRpcStringMember(writer, false, "secure_session_id", SecureSessionID.ToString()); // region_x WriteXmlRpcIntMember(writer, false, "region_x", RegionX); // last_name WriteXmlRpcStringMember(writer, false, "last_name", LastName); // region_y WriteXmlRpcIntMember(writer, false, "region_y", RegionY); // circuit_code WriteXmlRpcIntMember(writer, false, "circuit_code", CircuitCode); // initial-outfit WriteXmlRpcArrayStart(writer, "initial-outfit"); WriteXmlRpcArrayEnd(writer); } else { // Login failure } } writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); } writer.WriteEndElement(); writer.Close(); }
/// <summary> /// Convert the value of the given property to OSD type. /// </summary> /// <param name="property"></param> /// <returns></returns> public OSDArray ToOSDArray() { //DebugLog.WarnFormat("[SYNCED PROPERTY] ToOSDArray called for property {0}", Property.ToString()); lock (m_lock) { OSDArray propertyData = new OSDArray(); propertyData.Add(OSD.FromInteger((uint)Property)); propertyData.Add(OSD.FromLong(LastUpdateTimeStamp)); propertyData.Add(OSD.FromString(LastUpdateSyncID)); OSD value = null; switch (Property) { /////////////////////////////////////// //SOP properties with complex structure /////////////////////////////////////// case SyncableProperties.Type.AgentCircuitData: case SyncableProperties.Type.AvatarAppearance: value = (OSDMap)LastUpdateValue; break; case SyncableProperties.Type.Animations: value = (OSDArray)LastUpdateValue; break; //////////////////////////// // Integer/enum type properties //////////////////////////// case SyncableProperties.Type.CreationDate: // int case SyncableProperties.Type.LinkNum: // int case SyncableProperties.Type.OwnershipCost: // int case SyncableProperties.Type.SalePrice: // int case SyncableProperties.Type.ScriptAccessPin: // int case SyncableProperties.Type.AggregateScriptEvents: // enum case SyncableProperties.Type.Flags: // enum case SyncableProperties.Type.LocalFlags: // enum case SyncableProperties.Type.PresenceType: // enum value = OSD.FromInteger((int)LastUpdateValue); break; //////////////////////////// // Byte type properties //////////////////////////// case SyncableProperties.Type.ClickAction: case SyncableProperties.Type.Material: case SyncableProperties.Type.ObjectSaleType: value = OSD.FromInteger((byte)LastUpdateValue); break; //////////////////////////// // Boolean type properties //////////////////////////// case SyncableProperties.Type.AllowedDrop: case SyncableProperties.Type.IsAttachment: case SyncableProperties.Type.PassTouches: case SyncableProperties.Type.VolumeDetectActive: case SyncableProperties.Type.Flying: case SyncableProperties.Type.IsColliding: case SyncableProperties.Type.CollidingGround: case SyncableProperties.Type.Kinematic: case SyncableProperties.Type.IsSelected: case SyncableProperties.Type.AllowMovement: value = OSD.FromBoolean((bool)LastUpdateValue); break; //////////////////////////// // Vector3 type properties //////////////////////////// case SyncableProperties.Type.AngularVelocity: case SyncableProperties.Type.AttachedPos: case SyncableProperties.Type.GroupPosition: case SyncableProperties.Type.OffsetPosition: case SyncableProperties.Type.Scale: case SyncableProperties.Type.SitTargetPosition: case SyncableProperties.Type.SitTargetPositionLL: case SyncableProperties.Type.SOP_Acceleration: case SyncableProperties.Type.Velocity: case SyncableProperties.Type.Force: case SyncableProperties.Type.PA_Acceleration: case SyncableProperties.Type.PA_Velocity: case SyncableProperties.Type.PA_TargetVelocity: case SyncableProperties.Type.Position: case SyncableProperties.Type.RotationalVelocity: case SyncableProperties.Type.Size: case SyncableProperties.Type.Torque: case SyncableProperties.Type.AbsolutePosition: value = OSD.FromVector3((Vector3)LastUpdateValue); break; //////////////////////////// // UUID type properties //////////////////////////// case SyncableProperties.Type.AttachedAvatar: case SyncableProperties.Type.CollisionSound: case SyncableProperties.Type.CreatorID: case SyncableProperties.Type.FolderID: case SyncableProperties.Type.GroupID: case SyncableProperties.Type.LastOwnerID: case SyncableProperties.Type.OwnerID: case SyncableProperties.Type.Sound: value = OSD.FromUUID((UUID)LastUpdateValue); break; //////////////////////////// // UInt type properties //////////////////////////// case SyncableProperties.Type.LocalId: case SyncableProperties.Type.AttachmentPoint: case SyncableProperties.Type.BaseMask: case SyncableProperties.Type.Category: case SyncableProperties.Type.EveryoneMask: case SyncableProperties.Type.GroupMask: case SyncableProperties.Type.InventorySerial: case SyncableProperties.Type.NextOwnerMask: case SyncableProperties.Type.OwnerMask: case SyncableProperties.Type.AgentControlFlags: case SyncableProperties.Type.ParentId: value = OSD.FromUInteger((uint)LastUpdateValue); break; //////////////////////////// // Float type properties //////////////////////////// case SyncableProperties.Type.CollisionSoundVolume: case SyncableProperties.Type.Buoyancy: value = OSD.FromReal((float)LastUpdateValue); break; //////////////////////////// // String type properties //////////////////////////// case SyncableProperties.Type.Color: case SyncableProperties.Type.CreatorData: case SyncableProperties.Type.Description: case SyncableProperties.Type.MediaUrl: case SyncableProperties.Type.Name: case SyncableProperties.Type.RealRegion: case SyncableProperties.Type.Shape: case SyncableProperties.Type.SitName: case SyncableProperties.Type.TaskInventory: case SyncableProperties.Type.Text: case SyncableProperties.Type.TouchName: value = OSD.FromString((string)LastUpdateValue); break; //////////////////////////// // byte[] (binary data) type properties //////////////////////////// case SyncableProperties.Type.ParticleSystem: case SyncableProperties.Type.TextureAnimation: value = OSD.FromBinary((byte[])LastUpdateValue); break; //////////////////////////// // Quaternion type properties //////////////////////////// case SyncableProperties.Type.RotationOffset: case SyncableProperties.Type.SitTargetOrientation: case SyncableProperties.Type.SitTargetOrientationLL: case SyncableProperties.Type.Orientation: case SyncableProperties.Type.Rotation: value = OSD.FromQuaternion((Quaternion)LastUpdateValue); break; default: DebugLog.WarnFormat("[SYNCED PROPERTY] ToOSDArray: No handler for property {0} ", Property); break; } propertyData.Add(value); return(propertyData); } }