public override OpenMetaverse.StructuredData.OSDMap ToOSD() { OpenMetaverse.StructuredData.OSDMap result = new OpenMetaverse.StructuredData.OSDMap(); result["PrincipalID"] = PrincipalID; result["Friend"] = Friend; result["MyFlags"] = MyFlags; result["TheirFlags"] = TheirFlags; return result; }
public override OpenMetaverse.StructuredData.OSDMap ToOSD() { OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(); map["TotalTierDebit"] = TotalTierDebit; map["TotalTierCredits"] = TotalTierCredits; map["ParcelDirectoryFee"] = ParcelDirectoryFee; map["LandFee"] = LandFee; map["ObjectFee"] = ObjectFee; map["GroupFee"] = GroupFee; map["StartingDate"] = StartingDate; return map; }
public override OpenMetaverse.StructuredData.OSDMap ToOSD() { OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(); map["TotalTierDebit"] = TotalTierDebit; map["TotalTierCredits"] = TotalTierCredits; map["ParcelDirectoryFee"] = ParcelDirectoryFee; map["LandFee"] = LandFee; map["ObjectFee"] = ObjectFee; map["GroupFee"] = GroupFee; map["Balance"] = Balance; map["StartingDate"] = StartingDate; return(map); }
private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) { m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName); if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel) { OSDMap extrasMap; OSDMap specialUI = new OSDMap(); using (StreamReader s = new StreamReader(Path.Combine(VIEWER_SUPPORT_DIR, "panel_toolbar.xml"))) { if (features.ContainsKey("OpenSimExtras")) { extrasMap = (OSDMap)features["OpenSimExtras"]; } else { extrasMap = new OSDMap(); features["OpenSimExtras"] = extrasMap; } specialUI["toolbar"] = OSDMap.FromString(s.ReadToEnd()); extrasMap["special-ui"] = specialUI; } m_log.DebugFormat("[SPECIAL UI]: Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName); if (Directory.Exists(Path.Combine(VIEWER_SUPPORT_DIR, "Floaters"))) { OSDMap floaters = new OSDMap(); uint n = 0; foreach (String name in Directory.GetFiles(Path.Combine(VIEWER_SUPPORT_DIR, "Floaters"), "*.xml")) { using (StreamReader s = new StreamReader(name)) { string simple_name = Path.GetFileNameWithoutExtension(name); m_log.DebugFormat("[XXX]: Reading {0} ({1})", name, simple_name); OSDMap floater = new OSDMap(); floaters[simple_name] = OSDMap.FromString(s.ReadToEnd()); n++; } } specialUI["floaters"] = floaters; m_log.DebugFormat("[SPECIAL UI]: Sending {0} floaters", n); } } else { m_log.DebugFormat("[SPECIAL UI]: NOT Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName); } }
public override void FromOSD(OpenMetaverse.StructuredData.OSDMap map) { ID = map["ID"]; Description = map["Description"]; FromAgent = map["FromAgent"]; FromAgentName = map["FromAgentName"]; ToAgent = map["ToAgent"]; ToAgentName = map["ToAgentName"]; Amount = map["Amount"]; TransferType = (TransactionType)Int32.Parse(map["TransferType"]); TransferDate = map["TransferDate"]; ToBalance = map["ToBalance"]; FromBalance = map["FromBalance"]; FromObjectName = map["FromObjectName"]; ToObjectName = map["ToObjectName"]; RegionName = map["RegionName"]; }
public void UpdateAgent(IAgentInfo agent) { try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf( agent.PrincipalID.ToString(), "RemoteServerURI"); foreach (string url in serverURIs) { OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(); map["Method"] = "updateagent"; map["Agent"] = agent.ToOSD(); WebUtils.PostToService(url + "osd", map, false, false); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteAgentConnector]: Exception when contacting server: {0}", e); } }
public override OpenMetaverse.StructuredData.OSDMap ToOSD() { OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(); map["ID"] = ID; map["Description"] = Description; map["FromAgent"] = FromAgent; map["FromAgentName"] = FromAgentName; map["ToAgent"] = ToAgent; map["ToAgentName"] = ToAgentName; map["Amount"] = Amount; map["TransferType"] = TransferType.ToString(); map["TransferDate"] = TransferDate; map["ToBalance"] = ToBalance; map["FromObjectName"] = FromObjectName; map["ToObjectName"] = ToObjectName; map["RegionName"] = RegionName; return(map); }
public void UpdateAgent(IAgentInfo agent) { try { List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf( agent.PrincipalID.ToString(), "RemoteServerURI"); foreach (string url in serverURIs) { OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(); map["Method"] = "updateagent"; map["Agent"] = agent.ToOSD(); WebUtils.PostToService(url + "osd", map, false, false); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteAgentConnector]: Exception when contacting server: {0}", e); } }
/// <summary> /// Converts a list of primitives to an object that can be serialized /// with the LLSD system /// </summary> /// <param name="prims">Primitives to convert to a serializable object</param> /// <returns>An object that can be serialized with LLSD</returns> public static StructuredData.OSD PrimListToOSD(List<Primitive> prims) { StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(prims.Count); for (int i = 0; i < prims.Count; i++) map.Add(prims[i].LocalID.ToString(), prims[i].GetOSD()); return map; }
public override OpenMetaverse.StructuredData.OSDMap ToOSD() { OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(); map["ID"] = ID; map["Description"] = Description; map["FromAgent"] = FromAgent; map["FromAgentName"] = FromAgentName; map["ToAgent"] = ToAgent; map["ToAgentName"] = ToAgentName; map["Amount"] = Amount; map["TransferType"] = TransferType.ToString(); map["TransferDate"] = TransferDate; map["ToBalance"] = ToBalance; map["FromObjectName"] = FromObjectName; map["ToObjectName"] = ToObjectName; map["RegionName"] = RegionName; return map; }
private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) { m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName); if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel) { OSDMap extrasMap; OSDMap specialUI = new OSDMap(); using (StreamReader s = new StreamReader(Path.Combine(VIEWER_SUPPORT_DIR, "panel_toolbar.xml"))) { if (features.ContainsKey("OpenSimExtras")) extrasMap = (OSDMap)features["OpenSimExtras"]; else { extrasMap = new OSDMap(); features["OpenSimExtras"] = extrasMap; } specialUI["toolbar"] = OSDMap.FromString(s.ReadToEnd()); extrasMap["special-ui"] = specialUI; } m_log.DebugFormat("[SPECIAL UI]: Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName); if (Directory.Exists(Path.Combine(VIEWER_SUPPORT_DIR, "Floaters"))) { OSDMap floaters = new OSDMap(); uint n = 0; foreach (String name in Directory.GetFiles(Path.Combine(VIEWER_SUPPORT_DIR, "Floaters"), "*.xml")) { using (StreamReader s = new StreamReader(name)) { string simple_name = Path.GetFileNameWithoutExtension(name); m_log.DebugFormat("[XXX]: Reading {0} ({1})", name, simple_name); OSDMap floater = new OSDMap(); floaters[simple_name] = OSDMap.FromString(s.ReadToEnd()); n++; } } specialUI["floaters"] = floaters; m_log.DebugFormat("[SPECIAL UI]: Sending {0} floaters", n); } } else m_log.DebugFormat("[SPECIAL UI]: NOT Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName); }
/// <summary> /// /// </summary> /// <returns></returns> public byte[] SerializeAttachment() { if (OwnerID == UUID.Zero || AttachmentID == UUID.Zero) return Utils.EmptyBytes; OpenMetaverse.StructuredData.OSDMap att = new OpenMetaverse.StructuredData.OSDMap(); att.Add("item_id", OpenMetaverse.StructuredData.OSD.FromUUID(AttachmentID)); att.Add("owner_id", OpenMetaverse.StructuredData.OSD.FromUUID(OwnerID)); return OpenMetaverse.StructuredData.OSDParser.SerializeLLSDXmlBytes(att); /* //I guess this is how this works, no gaurentees string lsd = "<llsd><item_id>" + AttachmentID.ToString() + "</item_id><owner_id>" + OwnerID.ToString() + "</owner_id></llsd>"; return Utils.StringToBytes(lsd); */ }
public override OpenMetaverse.StructuredData.OSDMap ToOSD() { OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(); map["GroupID"] = GroupID; map["Duration"] = Duration; map["Majority"] = Majority; map["Text"] = Text; map["Quorum"] = Quorum; map["Session"] = Session; return map; }
private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) { m_log.DebugFormat("[CAMERA-ONLY MODE]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName); if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel) { OSDMap extrasMap; if (features.ContainsKey("OpenSimExtras")) { extrasMap = (OSDMap)features["OpenSimExtras"]; } else { extrasMap = new OSDMap(); features["OpenSimExtras"] = extrasMap; } extrasMap["camera-only-mode"] = OSDMap.FromString("true"); m_log.DebugFormat("[CAMERA-ONLY MODE]: Sent in {0}", m_scene.RegionInfo.RegionName); // Detaching attachments doesn't work for HG visitors, // so I'm giving that up. //Util.FireAndForget(delegate { DetachAttachments(agentID); }); } else m_log.DebugFormat("[CAMERA-ONLY MODE]: NOT Sending camera-only-mode in {0}", m_scene.RegionInfo.RegionName); }
private void memberListContextMenuSave_Click(object sender, EventArgs e) { SaveFileDialog saveMembers = new SaveFileDialog(); saveMembers.Filter = "CSV|.csv|JSON|.json"; saveMembers.Title = "Save visible group members"; saveMembers.ShowDialog(); if (saveMembers.FileName != string.Empty) { try { switch (saveMembers.FilterIndex) { case 1: System.IO.FileStream fs = (System.IO.FileStream)saveMembers.OpenFile(); System.IO.StreamWriter sw = new System.IO.StreamWriter(fs, System.Text.Encoding.UTF8); sw.WriteLine("UUID,Name"); foreach (ListViewItem item in lvwGeneralMembers.Items) { sw.WriteLine("{0},{1}", item.Name, item.Text); } sw.Close(); break; case 2: OpenMetaverse.StructuredData.OSDArray members = new OpenMetaverse.StructuredData.OSDArray(lvwGeneralMembers.Items.Count); foreach (ListViewItem item in lvwGeneralMembers.Items) { OpenMetaverse.StructuredData.OSDMap member = new OpenMetaverse.StructuredData.OSDMap(2); member["UUID"] = item.Name; member["Name"] = item.Text; members.Add(member); } System.IO.File.WriteAllText(saveMembers.FileName, OpenMetaverse.StructuredData.OSDParser.SerializeJsonString(members)); break; } instance.TabConsole.DisplayNotificationInChat(string.Format("Saved {0} members to {1}", lvwGeneralMembers.Items.Count, saveMembers.FileName)); } catch (Exception ex) { instance.TabConsole.DisplayNotificationInChat("Failed to save member list: " + ex.Message, ChatBufferTextStyle.Error); } } }
/// <summary> /// Parses add request /// </summary> /// <param name="request"></param> /// <param name="agentID"></param> /// <param name="cap"></param> /// <returns></returns> public void ProcessAdd(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap map, UUID agentID, Caps cap) { httpResponse.KeepAlive = false; if (!m_scene.TryGetScenePresence(agentID, out ScenePresence avatar)) { httpResponse.StatusCode = (int)HttpStatusCode.Gone; return; } UploadObjectAssetMessage message = new UploadObjectAssetMessage(); try { message.Deserialize(map); } catch (Exception ex) { m_log.Error("[UPLOAD OBJECT ASSET MODULE]: Error deserializing message " + ex.ToString()); message = null; } if (message == null) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; return; } try { Vector3 pos = avatar.AbsolutePosition + (Vector3.UnitX * avatar.Rotation); Quaternion rot = Quaternion.Identity; Vector3 rootpos = Vector3.Zero; SceneObjectGroup rootGroup = null; SceneObjectGroup[] allparts = new SceneObjectGroup[message.Objects.Length]; for (int i = 0; i < message.Objects.Length; i++) { UploadObjectAssetMessage.Object obj = message.Objects[i]; PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); if (i == 0) { rootpos = obj.Position; } for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) { UploadObjectAssetMessage.Object.ExtraParam extraParam = obj.ExtraParams[extparams]; switch ((ushort)extraParam.Type) { case (ushort)ExtraParamType.Sculpt: Primitive.SculptData sculpt = new Primitive.SculptData(extraParam.ExtraParamData, 0); pbs.SculptEntry = true; pbs.SculptTexture = obj.SculptID; pbs.SculptType = (byte)sculpt.Type; break; case (ushort)ExtraParamType.Flexible: Primitive.FlexibleData flex = new Primitive.FlexibleData(extraParam.ExtraParamData, 0); pbs.FlexiEntry = true; pbs.FlexiDrag = flex.Drag; pbs.FlexiForceX = flex.Force.X; pbs.FlexiForceY = flex.Force.Y; pbs.FlexiForceZ = flex.Force.Z; pbs.FlexiGravity = flex.Gravity; pbs.FlexiSoftness = flex.Softness; pbs.FlexiTension = flex.Tension; pbs.FlexiWind = flex.Wind; break; case (ushort)ExtraParamType.Light: Primitive.LightData light = new Primitive.LightData(extraParam.ExtraParamData, 0); pbs.LightColorA = light.Color.A; pbs.LightColorB = light.Color.B; pbs.LightColorG = light.Color.G; pbs.LightColorR = light.Color.R; pbs.LightCutoff = light.Cutoff; pbs.LightEntry = true; pbs.LightFalloff = light.Falloff; pbs.LightIntensity = light.Intensity; pbs.LightRadius = light.Radius; break; case 0x40: pbs.ReadProjectionData(extraParam.ExtraParamData, 0); break; } } pbs.PathBegin = (ushort)obj.PathBegin; pbs.PathCurve = (byte)obj.PathCurve; pbs.PathEnd = (ushort)obj.PathEnd; pbs.PathRadiusOffset = (sbyte)obj.RadiusOffset; pbs.PathRevolutions = (byte)obj.Revolutions; pbs.PathScaleX = (byte)obj.ScaleX; pbs.PathScaleY = (byte)obj.ScaleY; pbs.PathShearX = (byte)obj.ShearX; pbs.PathShearY = (byte)obj.ShearY; pbs.PathSkew = (sbyte)obj.Skew; pbs.PathTaperX = (sbyte)obj.TaperX; pbs.PathTaperY = (sbyte)obj.TaperY; pbs.PathTwist = (sbyte)obj.Twist; pbs.PathTwistBegin = (sbyte)obj.TwistBegin; pbs.HollowShape = (HollowShape)obj.ProfileHollow; pbs.PCode = (byte)PCode.Prim; pbs.ProfileBegin = (ushort)obj.ProfileBegin; pbs.ProfileCurve = (byte)obj.ProfileCurve; pbs.ProfileEnd = (ushort)obj.ProfileEnd; pbs.Scale = obj.Scale; pbs.State = (byte)0; pbs.LastAttachPoint = (byte)0; SceneObjectPart prim = new SceneObjectPart(); prim.UUID = UUID.Random(); prim.CreatorID = agentID; prim.OwnerID = agentID; prim.GroupID = obj.GroupID; prim.LastOwnerID = prim.OwnerID; prim.RezzerID = agentID; prim.CreationDate = Util.UnixTimeSinceEpoch(); prim.Name = obj.Name; prim.Description = ""; prim.PayPrice[0] = -2; prim.PayPrice[1] = -2; prim.PayPrice[2] = -2; prim.PayPrice[3] = -2; prim.PayPrice[4] = -2; Primitive.TextureEntry tmp = new Primitive.TextureEntry(UUID.Parse("89556747-24cb-43ed-920b-47caed15465f")); for (int j = 0; j < obj.Faces.Length; j++) { UploadObjectAssetMessage.Object.Face face = obj.Faces[j]; Primitive.TextureEntryFace primFace = tmp.CreateFace((uint)j); primFace.Bump = face.Bump; primFace.RGBA = face.Color; primFace.Fullbright = face.Fullbright; primFace.Glow = face.Glow; primFace.TextureID = face.ImageID; primFace.Rotation = face.ImageRot; primFace.MediaFlags = ((face.MediaFlags & 1) != 0); primFace.OffsetU = face.OffsetS; primFace.OffsetV = face.OffsetT; primFace.RepeatU = face.ScaleS; primFace.RepeatV = face.ScaleT; primFace.TexMapType = (MappingType)(face.MediaFlags & 6); } pbs.TextureEntry = tmp.GetBytes(); prim.Shape = pbs; prim.Scale = obj.Scale; SceneObjectGroup grp = new SceneObjectGroup(); grp.SetRootPart(prim); prim.ParentID = 0; if (i == 0) { rootGroup = grp; } grp.AttachToScene(m_scene); grp.AbsolutePosition = obj.Position; prim.RotationOffset = obj.Rotation; // Required for linking grp.RootPart.ClearUpdateSchedule(); if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos)) { m_scene.AddSceneObject(grp); grp.AbsolutePosition = obj.Position; } allparts[i] = grp; } for (int j = 1; j < allparts.Length; j++) { // Required for linking rootGroup.RootPart.ClearUpdateSchedule(); allparts[j].RootPart.ClearUpdateSchedule(); rootGroup.LinkToGroup(allparts[j]); } rootGroup.ScheduleGroupForFullAnimUpdate(); httpResponse.StatusCode = (int)HttpStatusCode.OK; httpResponse.RawBuffer = Util.UTF8NBGetbytes(String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(allparts[0].LocalId))); } catch { } httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; }
public void VoteOnActiveProposals(UUID agentID, UUID groupID, UUID proposalID, string vote) { object remoteValue = DoRemote(agentID, groupID, proposalID, vote); if (remoteValue != null || m_doRemoteOnly) return; if (!CheckGroupPermissions(agentID, groupID, (ulong) GroupPowers.VoteOnProposal)) return; OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(); map["Vote"] = vote; GenericUtils.AddGeneric(groupID, proposalID.ToString(), agentID.ToString(), map, data); }
public override OpenMetaverse.StructuredData.OSDMap ToOSD() { OpenMetaverse.StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(); map["ID"] = ID; map["AgentID"] = AgentID; map["IP"] = IP; map["Amount"] = Amount; map["RealAmount"] = RealAmount; map["PurchaseDate"] = PurchaseDate; map["UpdateDate"] = UpdateDate; return map; }