/OpenMetaverse/Modules/Messages/LindenMessages.cs
C# | 5118 lines | 3318 code | 633 blank | 1167 comment | 230 complexity | ce551f116872504928a4a59e327729de MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- /*
- * Copyright (c) 2009, openmetaverse.org
- * All rights reserved.
- *
- * - Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * - Neither the name of the openmetaverse.org nor the names
- * of its contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
- using System;
- using System.Collections.Generic;
- using System.Net;
- using OpenMetaverse.StructuredData;
- using OpenMetaverse.Interfaces;
- namespace OpenMetaverse.Messages.Linden
- {
- #region Teleport/Region/Movement Messages
- /// <summary>
- /// Sent to the client to indicate a teleport request has completed
- /// </summary>
- public class TeleportFinishMessage : IMessage
- {
- /// <summary>The <see cref="UUID"/> of the agent</summary>
- public UUID AgentID;
- /// <summary></summary>
- public int LocationID;
- /// <summary>The simulators handle the agent teleported to</summary>
- public ulong RegionHandle;
- /// <summary>A Uri which contains a list of Capabilities the simulator supports</summary>
- public Uri SeedCapability;
- /// <summary>Indicates the level of access required
- /// to access the simulator, or the content rating, or the simulators
- /// map status</summary>
- public SimAccess SimAccess;
- /// <summary>The IP Address of the simulator</summary>
- public IPAddress IP;
- /// <summary>The UDP Port the simulator will listen for UDP traffic on</summary>
- public int Port;
- /// <summary>Status flags indicating the state of the Agent upon arrival, Flying, etc.</summary>
- public TeleportFlags Flags;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- OSDMap map = new OSDMap(1);
- OSDArray infoArray = new OSDArray(1);
- OSDMap info = new OSDMap(8);
- info.Add("AgentID", OSD.FromUUID(AgentID));
- info.Add("LocationID", OSD.FromInteger(LocationID)); // Unused by the client
- info.Add("RegionHandle", OSD.FromULong(RegionHandle));
- info.Add("SeedCapability", OSD.FromUri(SeedCapability));
- info.Add("SimAccess", OSD.FromInteger((byte)SimAccess));
- info.Add("SimIP", MessageUtils.FromIP(IP));
- info.Add("SimPort", OSD.FromInteger(Port));
- info.Add("TeleportFlags", OSD.FromUInteger((uint)Flags));
- infoArray.Add(info);
- map.Add("Info", infoArray);
- return map;
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public void Deserialize(OSDMap map)
- {
- OSDArray array = (OSDArray)map["Info"];
- OSDMap blockMap = (OSDMap)array[0];
- AgentID = blockMap["AgentID"].AsUUID();
- LocationID = blockMap["LocationID"].AsInteger();
- RegionHandle = blockMap["RegionHandle"].AsULong();
- SeedCapability = blockMap["SeedCapability"].AsUri();
- SimAccess = (SimAccess)blockMap["SimAccess"].AsInteger();
- IP = MessageUtils.ToIP(blockMap["SimIP"]);
- Port = blockMap["SimPort"].AsInteger();
- Flags = (TeleportFlags)blockMap["TeleportFlags"].AsUInteger();
- }
- }
- /// <summary>
- /// Sent to the viewer when a neighboring simulator is requesting the agent make a connection to it.
- /// </summary>
- public class EstablishAgentCommunicationMessage : IMessage
- {
- public UUID AgentID;
- public IPAddress Address;
- public int Port;
- public Uri SeedCapability;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- OSDMap map = new OSDMap(3);
- map["agent-id"] = OSD.FromUUID(AgentID);
- map["sim-ip-and-port"] = OSD.FromString(String.Format("{0}:{1}", Address, Port));
- map["seed-capability"] = OSD.FromUri(SeedCapability);
- return map;
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public void Deserialize(OSDMap map)
- {
- string ipAndPort = map["sim-ip-and-port"].AsString();
- int i = ipAndPort.IndexOf(':');
- AgentID = map["agent-id"].AsUUID();
- Address = IPAddress.Parse(ipAndPort.Substring(0, i));
- Port = Int32.Parse(ipAndPort.Substring(i + 1));
- SeedCapability = map["seed-capability"].AsUri();
- }
- }
- public class CrossedRegionMessage : IMessage
- {
- public Vector3 LookAt;
- public Vector3 Position;
- public UUID AgentID;
- public UUID SessionID;
- public ulong RegionHandle;
- public Uri SeedCapability;
- public IPAddress IP;
- public int Port;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- OSDMap map = new OSDMap(3);
- OSDArray infoArray = new OSDArray(1);
- OSDMap infoMap = new OSDMap(2);
- infoMap["LookAt"] = OSD.FromVector3(LookAt);
- infoMap["Position"] = OSD.FromVector3(Position);
- infoArray.Add(infoMap);
- map["Info"] = infoArray;
- OSDArray agentDataArray = new OSDArray(1);
- OSDMap agentDataMap = new OSDMap(2);
- agentDataMap["AgentID"] = OSD.FromUUID(AgentID);
- agentDataMap["SessionID"] = OSD.FromUUID(SessionID);
- agentDataArray.Add(agentDataMap);
- map["AgentData"] = agentDataArray;
- OSDArray regionDataArray = new OSDArray(1);
- OSDMap regionDataMap = new OSDMap(4);
- regionDataMap["RegionHandle"] = OSD.FromULong(RegionHandle);
- regionDataMap["SeedCapability"] = OSD.FromUri(SeedCapability);
- regionDataMap["SimIP"] = MessageUtils.FromIP(IP);
- regionDataMap["SimPort"] = OSD.FromInteger(Port);
- regionDataArray.Add(regionDataMap);
- map["RegionData"] = regionDataArray;
- return map;
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public void Deserialize(OSDMap map)
- {
- OSDMap infoMap = (OSDMap)((OSDArray)map["Info"])[0];
- LookAt = infoMap["LookAt"].AsVector3();
- Position = infoMap["Position"].AsVector3();
- OSDMap agentDataMap = (OSDMap)((OSDArray)map["AgentData"])[0];
- AgentID = agentDataMap["AgentID"].AsUUID();
- SessionID = agentDataMap["SessionID"].AsUUID();
- OSDMap regionDataMap = (OSDMap)((OSDArray)map["RegionData"])[0];
- RegionHandle = regionDataMap["RegionHandle"].AsULong();
- SeedCapability = regionDataMap["SeedCapability"].AsUri();
- IP = MessageUtils.ToIP(regionDataMap["SimIP"]);
- Port = regionDataMap["SimPort"].AsInteger();
- }
- }
- public class EnableSimulatorMessage : IMessage
- {
- public class SimulatorInfoBlock
- {
- public ulong RegionHandle;
- public IPAddress IP;
- public int Port;
- }
- public SimulatorInfoBlock[] Simulators;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- OSDMap map = new OSDMap(1);
- OSDArray array = new OSDArray(Simulators.Length);
- for (int i = 0; i < Simulators.Length; i++)
- {
- SimulatorInfoBlock block = Simulators[i];
- OSDMap blockMap = new OSDMap(3);
- blockMap["Handle"] = OSD.FromULong(block.RegionHandle);
- blockMap["IP"] = MessageUtils.FromIP(block.IP);
- blockMap["Port"] = OSD.FromInteger(block.Port);
- array.Add(blockMap);
- }
- map["SimulatorInfo"] = array;
- return map;
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public void Deserialize(OSDMap map)
- {
- OSDArray array = (OSDArray)map["SimulatorInfo"];
- Simulators = new SimulatorInfoBlock[array.Count];
- for (int i = 0; i < array.Count; i++)
- {
- OSDMap blockMap = (OSDMap)array[i];
- SimulatorInfoBlock block = new SimulatorInfoBlock();
- block.RegionHandle = blockMap["Handle"].AsULong();
- block.IP = MessageUtils.ToIP(blockMap["IP"]);
- block.Port = blockMap["Port"].AsInteger();
- Simulators[i] = block;
- }
- }
- }
- /// <summary>
- /// A message sent to the client which indicates a teleport request has failed
- /// and contains some information on why it failed
- /// </summary>
- public class TeleportFailedMessage : IMessage
- {
- /// <summary></summary>
- public string ExtraParams;
- /// <summary>A string key of the reason the teleport failed e.g. CouldntTPCloser
- /// Which could be used to look up a value in a dictionary or enum</summary>
- public string MessageKey;
- /// <summary>The <see cref="UUID"/> of the Agent</summary>
- public UUID AgentID;
- /// <summary>A string human readable message containing the reason </summary>
- /// <remarks>An example: Could not teleport closer to destination</remarks>
- public string Reason;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- OSDMap map = new OSDMap(2);
- OSDMap alertInfoMap = new OSDMap(2);
- alertInfoMap["ExtraParams"] = OSD.FromString(ExtraParams);
- alertInfoMap["Message"] = OSD.FromString(MessageKey);
- OSDArray alertArray = new OSDArray();
- alertArray.Add(alertInfoMap);
- map["AlertInfo"] = alertArray;
- OSDMap infoMap = new OSDMap(2);
- infoMap["AgentID"] = OSD.FromUUID(AgentID);
- infoMap["Reason"] = OSD.FromString(Reason);
- OSDArray infoArray = new OSDArray();
- infoArray.Add(infoMap);
- map["Info"] = infoArray;
- return map;
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public void Deserialize(OSDMap map)
- {
- OSDArray alertInfoArray = (OSDArray)map["AlertInfo"];
- OSDMap alertInfoMap = (OSDMap)alertInfoArray[0];
- ExtraParams = alertInfoMap["ExtraParams"].AsString();
- MessageKey = alertInfoMap["Message"].AsString();
- OSDArray infoArray = (OSDArray)map["Info"];
- OSDMap infoMap = (OSDMap)infoArray[0];
- AgentID = infoMap["AgentID"].AsUUID();
- Reason = infoMap["Reason"].AsString();
- }
- }
- public class LandStatReplyMessage : IMessage
- {
- public uint ReportType;
- public uint RequestFlags;
- public uint TotalObjectCount;
- public class ReportDataBlock
- {
- public Vector3 Location;
- public string OwnerName;
- public float Score;
- public UUID TaskID;
- public uint TaskLocalID;
- public string TaskName;
- public float MonoScore;
- public DateTime TimeStamp;
- }
- public ReportDataBlock[] ReportDataBlocks;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- OSDMap map = new OSDMap(3);
- OSDMap requestDataMap = new OSDMap(3);
- requestDataMap["ReportType"] = OSD.FromUInteger(this.ReportType);
- requestDataMap["RequestFlags"] = OSD.FromUInteger(this.RequestFlags);
- requestDataMap["TotalObjectCount"] = OSD.FromUInteger(this.TotalObjectCount);
- OSDArray requestDatArray = new OSDArray();
- requestDatArray.Add(requestDataMap);
- map["RequestData"] = requestDatArray;
- OSDArray reportDataArray = new OSDArray();
- OSDArray dataExtendedArray = new OSDArray();
- for (int i = 0; i < ReportDataBlocks.Length; i++)
- {
- OSDMap reportMap = new OSDMap(8);
- reportMap["LocationX"] = OSD.FromReal(ReportDataBlocks[i].Location.X);
- reportMap["LocationY"] = OSD.FromReal(ReportDataBlocks[i].Location.Y);
- reportMap["LocationZ"] = OSD.FromReal(ReportDataBlocks[i].Location.Z);
- reportMap["OwnerName"] = OSD.FromString(ReportDataBlocks[i].OwnerName);
- reportMap["Score"] = OSD.FromReal(ReportDataBlocks[i].Score);
- reportMap["TaskID"] = OSD.FromUUID(ReportDataBlocks[i].TaskID);
- reportMap["TaskLocalID"] = OSD.FromReal(ReportDataBlocks[i].TaskLocalID);
- reportMap["TaskName"] = OSD.FromString(ReportDataBlocks[i].TaskName);
- reportDataArray.Add(reportMap);
- OSDMap extendedMap = new OSDMap(2);
- extendedMap["MonoScore"] = OSD.FromReal(ReportDataBlocks[i].MonoScore);
- extendedMap["TimeStamp"] = OSD.FromDate(ReportDataBlocks[i].TimeStamp);
- dataExtendedArray.Add(extendedMap);
- }
- map["ReportData"] = reportDataArray;
- map["DataExtended"] = dataExtendedArray;
- return map;
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public void Deserialize(OSDMap map)
- {
- OSDArray requestDataArray = (OSDArray)map["RequestData"];
- OSDMap requestMap = (OSDMap)requestDataArray[0];
- this.ReportType = requestMap["ReportType"].AsUInteger();
- this.RequestFlags = requestMap["RequestFlags"].AsUInteger();
- this.TotalObjectCount = requestMap["TotalObjectCount"].AsUInteger();
- if (TotalObjectCount < 1)
- {
- ReportDataBlocks = new ReportDataBlock[0];
- return;
- }
- OSDArray dataArray = (OSDArray)map["ReportData"];
- OSDArray dataExtendedArray = (OSDArray)map["DataExtended"];
- ReportDataBlocks = new ReportDataBlock[dataArray.Count];
- for (int i = 0; i < dataArray.Count; i++)
- {
- OSDMap blockMap = (OSDMap)dataArray[i];
- OSDMap extMap = (OSDMap)dataExtendedArray[i];
- ReportDataBlock block = new ReportDataBlock();
- block.Location = new Vector3(
- (float)blockMap["LocationX"].AsReal(),
- (float)blockMap["LocationY"].AsReal(),
- (float)blockMap["LocationZ"].AsReal());
- block.OwnerName = blockMap["OwnerName"].AsString();
- block.Score = (float)blockMap["Score"].AsReal();
- block.TaskID = blockMap["TaskID"].AsUUID();
- block.TaskLocalID = blockMap["TaskLocalID"].AsUInteger();
- block.TaskName = blockMap["TaskName"].AsString();
- block.MonoScore = (float)extMap["MonoScore"].AsReal();
- block.TimeStamp = Utils.UnixTimeToDateTime(extMap["TimeStamp"].AsUInteger());
- ReportDataBlocks[i] = block;
- }
- }
- }
- #endregion
- #region Parcel Messages
- /// <summary>
- /// Contains a list of prim owner information for a specific parcel in a simulator
- /// </summary>
- /// <remarks>
- /// A Simulator will always return at least 1 entry
- /// If agent does not have proper permission the OwnerID will be UUID.Zero
- /// If agent does not have proper permission OR there are no primitives on parcel
- /// the DataBlocksExtended map will not be sent from the simulator
- /// </remarks>
- public class ParcelObjectOwnersReplyMessage : IMessage
- {
- /// <summary>
- /// Prim ownership information for a specified owner on a single parcel
- /// </summary>
- public class PrimOwner
- {
- /// <summary>The <see cref="UUID"/> of the prim owner,
- /// UUID.Zero if agent has no permission to view prim owner information</summary>
- public UUID OwnerID;
- /// <summary>The total number of prims</summary>
- public int Count;
- /// <summary>True if the OwnerID is a <see cref="Group"/></summary>
- public bool IsGroupOwned;
- /// <summary>True if the owner is online
- /// <remarks>This is no longer used by the LL Simulators</remarks></summary>
- public bool OnlineStatus;
- /// <summary>The date the most recent prim was rezzed</summary>
- public DateTime TimeStamp;
- }
- /// <summary>An Array of <see cref="PrimOwner"/> objects</summary>
- public PrimOwner[] PrimOwnersBlock;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- OSDArray dataArray = new OSDArray(PrimOwnersBlock.Length);
- OSDArray dataExtendedArray = new OSDArray();
- for (int i = 0; i < PrimOwnersBlock.Length; i++)
- {
- OSDMap dataMap = new OSDMap(4);
- dataMap["OwnerID"] = OSD.FromUUID(PrimOwnersBlock[i].OwnerID);
- dataMap["Count"] = OSD.FromInteger(PrimOwnersBlock[i].Count);
- dataMap["IsGroupOwned"] = OSD.FromBoolean(PrimOwnersBlock[i].IsGroupOwned);
- dataMap["OnlineStatus"] = OSD.FromBoolean(PrimOwnersBlock[i].OnlineStatus);
- dataArray.Add(dataMap);
- OSDMap dataExtendedMap = new OSDMap(1);
- dataExtendedMap["TimeStamp"] = OSD.FromDate(PrimOwnersBlock[i].TimeStamp);
- dataExtendedArray.Add(dataExtendedMap);
- }
- OSDMap map = new OSDMap();
- map.Add("Data", dataArray);
- if (dataExtendedArray.Count > 0)
- map.Add("DataExtended", dataExtendedArray);
- return map;
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public void Deserialize(OSDMap map)
- {
- OSDArray dataArray = (OSDArray)map["Data"];
- // DataExtended is optional, will not exist of parcel contains zero prims
- OSDArray dataExtendedArray;
- if (map.ContainsKey("DataExtended"))
- {
- dataExtendedArray = (OSDArray)map["DataExtended"];
- }
- else
- {
- dataExtendedArray = new OSDArray();
- }
- PrimOwnersBlock = new PrimOwner[dataArray.Count];
- for (int i = 0; i < dataArray.Count; i++)
- {
- OSDMap dataMap = (OSDMap)dataArray[i];
- PrimOwner block = new PrimOwner();
- block.OwnerID = dataMap["OwnerID"].AsUUID();
- block.Count = dataMap["Count"].AsInteger();
- block.IsGroupOwned = dataMap["IsGroupOwned"].AsBoolean();
- block.OnlineStatus = dataMap["OnlineStatus"].AsBoolean(); // deprecated
- /* if the agent has no permissions, or there are no prims, the counts
- * should not match up, so we don't decode the DataExtended map */
- if (dataExtendedArray.Count == dataArray.Count)
- {
- OSDMap dataExtendedMap = (OSDMap)dataExtendedArray[i];
- block.TimeStamp = Utils.UnixTimeToDateTime(dataExtendedMap["TimeStamp"].AsUInteger());
- }
- PrimOwnersBlock[i] = block;
- }
- }
- }
- /// <summary>
- /// The details of a single parcel in a region, also contains some regionwide globals
- /// </summary>
- [Serializable]
- public class ParcelPropertiesMessage : IMessage
- {
- /// <summary>Simulator-local ID of this parcel</summary>
- public int LocalID;
- /// <summary>Maximum corner of the axis-aligned bounding box for this
- /// parcel</summary>
- public Vector3 AABBMax;
- /// <summary>Minimum corner of the axis-aligned bounding box for this
- /// parcel</summary>
- public Vector3 AABBMin;
- /// <summary>Total parcel land area</summary>
- public int Area;
- /// <summary></summary>
- public uint AuctionID;
- /// <summary>Key of authorized buyer</summary>
- public UUID AuthBuyerID;
- /// <summary>Bitmap describing land layout in 4x4m squares across the
- /// entire region</summary>
- public byte[] Bitmap;
- /// <summary></summary>
- public ParcelCategory Category;
- /// <summary>Date land was claimed</summary>
- public DateTime ClaimDate;
- /// <summary>Appears to always be zero</summary>
- public int ClaimPrice;
- /// <summary>Parcel Description</summary>
- public string Desc;
- /// <summary></summary>
- public ParcelFlags ParcelFlags;
- /// <summary></summary>
- public UUID GroupID;
- /// <summary>Total number of primitives owned by the parcel group on
- /// this parcel</summary>
- public int GroupPrims;
- /// <summary>Whether the land is deeded to a group or not</summary>
- public bool IsGroupOwned;
- /// <summary></summary>
- public LandingType LandingType;
- /// <summary>Maximum number of primitives this parcel supports</summary>
- public int MaxPrims;
- /// <summary>The Asset UUID of the Texture which when applied to a
- /// primitive will display the media</summary>
- public UUID MediaID;
- /// <summary>A URL which points to any Quicktime supported media type</summary>
- public string MediaURL;
- /// <summary>A byte, if 0x1 viewer should auto scale media to fit object</summary>
- public bool MediaAutoScale;
- /// <summary>URL For Music Stream</summary>
- public string MusicURL;
- /// <summary>Parcel Name</summary>
- public string Name;
- /// <summary>Autoreturn value in minutes for others' objects</summary>
- public int OtherCleanTime;
- /// <summary></summary>
- public int OtherCount;
- /// <summary>Total number of other primitives on this parcel</summary>
- public int OtherPrims;
- /// <summary>UUID of the owner of this parcel</summary>
- public UUID OwnerID;
- /// <summary>Total number of primitives owned by the parcel owner on
- /// this parcel</summary>
- public int OwnerPrims;
- /// <summary></summary>
- public float ParcelPrimBonus;
- /// <summary>How long is pass valid for</summary>
- public float PassHours;
- /// <summary>Price for a temporary pass</summary>
- public int PassPrice;
- /// <summary></summary>
- public int PublicCount;
- /// <summary>Disallows people outside the parcel from being able to see in</summary>
- public bool Privacy;
- /// <summary></summary>
- public bool RegionDenyAnonymous;
- /// <summary></summary>
- public bool RegionDenyIdentified;
- /// <summary></summary>
- public bool RegionDenyTransacted;
- /// <summary>True if the region denies access to age unverified users</summary>
- public bool RegionDenyAgeUnverified;
- /// <summary></summary>
- public bool RegionPushOverride;
- /// <summary>This field is no longer used</summary>
- public int RentPrice;
- /// The result of a request for parcel properties
- public ParcelResult RequestResult;
- /// <summary>Sale price of the parcel, only useful if ForSale is set</summary>
- /// <remarks>The SalePrice will remain the same after an ownership
- /// transfer (sale), so it can be used to see the purchase price after
- /// a sale if the new owner has not changed it</remarks>
- public int SalePrice;
- /// <summary>
- /// Number of primitives your avatar is currently
- /// selecting and sitting on in this parcel
- /// </summary>
- public int SelectedPrims;
- /// <summary></summary>
- public int SelfCount;
- /// <summary>
- /// A number which increments by 1, starting at 0 for each ParcelProperties request.
- /// Can be overriden by specifying the sequenceID with the ParcelPropertiesRequest being sent.
- /// a Negative number indicates the action in <seealso cref="ParcelPropertiesStatus"/> has occurred.
- /// </summary>
- public int SequenceID;
- /// <summary>Maximum primitives across the entire simulator</summary>
- public int SimWideMaxPrims;
- /// <summary>Total primitives across the entire simulator</summary>
- public int SimWideTotalPrims;
- /// <summary></summary>
- public bool SnapSelection;
- /// <summary>Key of parcel snapshot</summary>
- public UUID SnapshotID;
- /// <summary>Parcel ownership status</summary>
- public ParcelStatus Status;
- /// <summary>Total number of primitives on this parcel</summary>
- public int TotalPrims;
- /// <summary></summary>
- public Vector3 UserLocation;
- /// <summary></summary>
- public Vector3 UserLookAt;
- /// <summary>A description of the media</summary>
- public string MediaDesc;
- /// <summary>An Integer which represents the height of the media</summary>
- public int MediaHeight;
- /// <summary>An integer which represents the width of the media</summary>
- public int MediaWidth;
- /// <summary>A boolean, if true the viewer should loop the media</summary>
- public bool MediaLoop;
- /// <summary>A string which contains the mime type of the media</summary>
- public string MediaType;
- /// <summary>true to obscure (hide) media url</summary>
- public bool ObscureMedia;
- /// <summary>true to obscure (hide) music url</summary>
- public bool ObscureMusic;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- OSDMap map = new OSDMap(3);
- OSDArray dataArray = new OSDArray(1);
- OSDMap parcelDataMap = new OSDMap(47);
- parcelDataMap["LocalID"] = OSD.FromInteger(LocalID);
- parcelDataMap["AABBMax"] = OSD.FromVector3(AABBMax);
- parcelDataMap["AABBMin"] = OSD.FromVector3(AABBMin);
- parcelDataMap["Area"] = OSD.FromInteger(Area);
- parcelDataMap["AuctionID"] = OSD.FromInteger(AuctionID);
- parcelDataMap["AuthBuyerID"] = OSD.FromUUID(AuthBuyerID);
- parcelDataMap["Bitmap"] = OSD.FromBinary(Bitmap);
- parcelDataMap["Category"] = OSD.FromInteger((int)Category);
- parcelDataMap["ClaimDate"] = OSD.FromDate(ClaimDate);
- parcelDataMap["ClaimPrice"] = OSD.FromInteger(ClaimPrice);
- parcelDataMap["Desc"] = OSD.FromString(Desc);
- parcelDataMap["ParcelFlags"] = OSD.FromUInteger((uint)ParcelFlags);
- parcelDataMap["GroupID"] = OSD.FromUUID(GroupID);
- parcelDataMap["GroupPrims"] = OSD.FromInteger(GroupPrims);
- parcelDataMap["IsGroupOwned"] = OSD.FromBoolean(IsGroupOwned);
- parcelDataMap["LandingType"] = OSD.FromInteger((int)LandingType);
- parcelDataMap["MaxPrims"] = OSD.FromInteger(MaxPrims);
- parcelDataMap["MediaID"] = OSD.FromUUID(MediaID);
- parcelDataMap["MediaURL"] = OSD.FromString(MediaURL);
- parcelDataMap["MediaAutoScale"] = OSD.FromBoolean(MediaAutoScale);
- parcelDataMap["MusicURL"] = OSD.FromString(MusicURL);
- parcelDataMap["Name"] = OSD.FromString(Name);
- parcelDataMap["OtherCleanTime"] = OSD.FromInteger(OtherCleanTime);
- parcelDataMap["OtherCount"] = OSD.FromInteger(OtherCount);
- parcelDataMap["OtherPrims"] = OSD.FromInteger(OtherPrims);
- parcelDataMap["OwnerID"] = OSD.FromUUID(OwnerID);
- parcelDataMap["OwnerPrims"] = OSD.FromInteger(OwnerPrims);
- parcelDataMap["ParcelPrimBonus"] = OSD.FromReal((float)ParcelPrimBonus);
- parcelDataMap["PassHours"] = OSD.FromReal((float)PassHours);
- parcelDataMap["PassPrice"] = OSD.FromInteger(PassPrice);
- parcelDataMap["PublicCount"] = OSD.FromInteger(PublicCount);
- parcelDataMap["Privacy"] = OSD.FromBoolean(Privacy);
- parcelDataMap["RegionDenyAnonymous"] = OSD.FromBoolean(RegionDenyAnonymous);
- parcelDataMap["RegionDenyIdentified"] = OSD.FromBoolean(RegionDenyIdentified);
- parcelDataMap["RegionDenyTransacted"] = OSD.FromBoolean(RegionDenyTransacted);
- parcelDataMap["RegionPushOverride"] = OSD.FromBoolean(RegionPushOverride);
- parcelDataMap["RentPrice"] = OSD.FromInteger(RentPrice);
- parcelDataMap["RequestResult"] = OSD.FromInteger((int)RequestResult);
- parcelDataMap["SalePrice"] = OSD.FromInteger(SalePrice);
- parcelDataMap["SelectedPrims"] = OSD.FromInteger(SelectedPrims);
- parcelDataMap["SelfCount"] = OSD.FromInteger(SelfCount);
- parcelDataMap["SequenceID"] = OSD.FromInteger(SequenceID);
- parcelDataMap["SimWideMaxPrims"] = OSD.FromInteger(SimWideMaxPrims);
- parcelDataMap["SimWideTotalPrims"] = OSD.FromInteger(SimWideTotalPrims);
- parcelDataMap["SnapSelection"] = OSD.FromBoolean(SnapSelection);
- parcelDataMap["SnapshotID"] = OSD.FromUUID(SnapshotID);
- parcelDataMap["Status"] = OSD.FromInteger((int)Status);
- parcelDataMap["TotalPrims"] = OSD.FromInteger(TotalPrims);
- parcelDataMap["UserLocation"] = OSD.FromVector3(UserLocation);
- parcelDataMap["UserLookAt"] = OSD.FromVector3(UserLookAt);
- dataArray.Add(parcelDataMap);
- map["ParcelData"] = dataArray;
- OSDArray mediaDataArray = new OSDArray(1);
- OSDMap mediaDataMap = new OSDMap(7);
- mediaDataMap["MediaDesc"] = OSD.FromString(MediaDesc);
- mediaDataMap["MediaHeight"] = OSD.FromInteger(MediaHeight);
- mediaDataMap["MediaWidth"] = OSD.FromInteger(MediaWidth);
- mediaDataMap["MediaLoop"] = OSD.FromBoolean(MediaLoop);
- mediaDataMap["MediaType"] = OSD.FromString(MediaType);
- mediaDataMap["ObscureMedia"] = OSD.FromBoolean(ObscureMedia);
- mediaDataMap["ObscureMusic"] = OSD.FromBoolean(ObscureMusic);
- mediaDataArray.Add(mediaDataMap);
- map["MediaData"] = mediaDataArray;
- OSDArray ageVerificationBlockArray = new OSDArray(1);
- OSDMap ageVerificationBlockMap = new OSDMap(1);
- ageVerificationBlockMap["RegionDenyAgeUnverified"] = OSD.FromBoolean(RegionDenyAgeUnverified);
- ageVerificationBlockArray.Add(ageVerificationBlockMap);
- map["AgeVerificationBlock"] = ageVerificationBlockArray;
- return map;
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public void Deserialize(OSDMap map)
- {
- OSDMap parcelDataMap = (OSDMap)((OSDArray)map["ParcelData"])[0];
- LocalID = parcelDataMap["LocalID"].AsInteger();
- AABBMax = parcelDataMap["AABBMax"].AsVector3();
- AABBMin = parcelDataMap["AABBMin"].AsVector3();
- Area = parcelDataMap["Area"].AsInteger();
- AuctionID = (uint)parcelDataMap["AuctionID"].AsInteger();
- AuthBuyerID = parcelDataMap["AuthBuyerID"].AsUUID();
- Bitmap = parcelDataMap["Bitmap"].AsBinary();
- Category = (ParcelCategory)parcelDataMap["Category"].AsInteger();
- ClaimDate = Utils.UnixTimeToDateTime((uint)parcelDataMap["ClaimDate"].AsInteger());
- ClaimPrice = parcelDataMap["ClaimPrice"].AsInteger();
- Desc = parcelDataMap["Desc"].AsString();
- // LL sends this as binary, we'll convert it here
- if (parcelDataMap["ParcelFlags"].Type == OSDType.Binary)
- {
- byte[] bytes = parcelDataMap["ParcelFlags"].AsBinary();
- if (BitConverter.IsLittleEndian)
- Array.Reverse(bytes);
- ParcelFlags = (ParcelFlags)BitConverter.ToUInt32(bytes, 0);
- }
- else
- {
- ParcelFlags = (ParcelFlags)parcelDataMap["ParcelFlags"].AsUInteger();
- }
- GroupID = parcelDataMap["GroupID"].AsUUID();
- GroupPrims = parcelDataMap["GroupPrims"].AsInteger();
- IsGroupOwned = parcelDataMap["IsGroupOwned"].AsBoolean();
- LandingType = (LandingType)parcelDataMap["LandingType"].AsInteger();
- MaxPrims = parcelDataMap["MaxPrims"].AsInteger();
- MediaID = parcelDataMap["MediaID"].AsUUID();
- MediaURL = parcelDataMap["MediaURL"].AsString();
- MediaAutoScale = parcelDataMap["MediaAutoScale"].AsBoolean(); // 0x1 = yes
- MusicURL = parcelDataMap["MusicURL"].AsString();
- Name = parcelDataMap["Name"].AsString();
- OtherCleanTime = parcelDataMap["OtherCleanTime"].AsInteger();
- OtherCount = parcelDataMap["OtherCount"].AsInteger();
- OtherPrims = parcelDataMap["OtherPrims"].AsInteger();
- OwnerID = parcelDataMap["OwnerID"].AsUUID();
- OwnerPrims = parcelDataMap["OwnerPrims"].AsInteger();
- ParcelPrimBonus = (float)parcelDataMap["ParcelPrimBonus"].AsReal();
- PassHours = (float)parcelDataMap["PassHours"].AsReal();
- PassPrice = parcelDataMap["PassPrice"].AsInteger();
- PublicCount = parcelDataMap["PublicCount"].AsInteger();
- Privacy = parcelDataMap["Privacy"].AsBoolean();
- RegionDenyAnonymous = parcelDataMap["RegionDenyAnonymous"].AsBoolean();
- RegionDenyIdentified = parcelDataMap["RegionDenyIdentified"].AsBoolean();
- RegionDenyTransacted = parcelDataMap["RegionDenyTransacted"].AsBoolean();
- RegionPushOverride = parcelDataMap["RegionPushOverride"].AsBoolean();
- RentPrice = parcelDataMap["RentPrice"].AsInteger();
- RequestResult = (ParcelResult)parcelDataMap["RequestResult"].AsInteger();
- SalePrice = parcelDataMap["SalePrice"].AsInteger();
- SelectedPrims = parcelDataMap["SelectedPrims"].AsInteger();
- SelfCount = parcelDataMap["SelfCount"].AsInteger();
- SequenceID = parcelDataMap["SequenceID"].AsInteger();
- SimWideMaxPrims = parcelDataMap["SimWideMaxPrims"].AsInteger();
- SimWideTotalPrims = parcelDataMap["SimWideTotalPrims"].AsInteger();
- SnapSelection = parcelDataMap["SnapSelection"].AsBoolean();
- SnapshotID = parcelDataMap["SnapshotID"].AsUUID();
- Status = (ParcelStatus)parcelDataMap["Status"].AsInteger();
- TotalPrims = parcelDataMap["TotalPrims"].AsInteger();
- UserLocation = parcelDataMap["UserLocation"].AsVector3();
- UserLookAt = parcelDataMap["UserLookAt"].AsVector3();
- if (map.ContainsKey("MediaData")) // temporary, OpenSim doesn't send this block
- {
- OSDMap mediaDataMap = (OSDMap)((OSDArray)map["MediaData"])[0];
- MediaDesc = mediaDataMap["MediaDesc"].AsString();
- MediaHeight = mediaDataMap["MediaHeight"].AsInteger();
- MediaWidth = mediaDataMap["MediaWidth"].AsInteger();
- MediaLoop = mediaDataMap["MediaLoop"].AsBoolean();
- MediaType = mediaDataMap["MediaType"].AsString();
- ObscureMedia = mediaDataMap["ObscureMedia"].AsBoolean();
- ObscureMusic = mediaDataMap["ObscureMusic"].AsBoolean();
- }
- OSDMap ageVerificationBlockMap = (OSDMap)((OSDArray)map["AgeVerificationBlock"])[0];
- RegionDenyAgeUnverified = ageVerificationBlockMap["RegionDenyAgeUnverified"].AsBoolean();
- }
- }
- /// <summary>A message sent from the viewer to the simulator to updated a specific parcels settings</summary>
- public class ParcelPropertiesUpdateMessage : IMessage
- {
- /// <summary>The <seealso cref="UUID"/> of the agent authorized to purchase this
- /// parcel of land or a NULL <seealso cref="UUID"/> if the sale is authorized to anyone</summary>
- public UUID AuthBuyerID;
- /// <summary>true to enable auto scaling of the parcel media</summary>
- public bool MediaAutoScale;
- /// <summary>The category of this parcel used when search is enabled to restrict
- /// search results</summary>
- public ParcelCategory Category;
- /// <summary>A string containing the description to set</summary>
- public string Desc;
- /// <summary>The <seealso cref="UUID"/> of the <seealso cref="Group"/> which allows for additional
- /// powers and restrictions.</summary>
- public UUID GroupID;
- /// <summary>The <seealso cref="LandingType"/> which specifies how avatars which teleport
- /// to this parcel are handled</summary>
- public LandingType Landing;
- /// <summary>The LocalID of the parcel to update settings on</summary>
- public int LocalID;
- /// <summary>A string containing the description of the media which can be played
- /// to visitors</summary>
- public string MediaDesc;
- /// <summary></summary>
- public int MediaHeight;
- /// <summary></summary>
- public bool MediaLoop;
- /// <summary></summary>
- public UUID MediaID;
- /// <summary></summary>
- public string MediaType;
- /// <summary></summary>
- public string MediaURL;
- /// <summary></summary>
- public int MediaWidth;
- /// <summary></summary>
- public string MusicURL;
- /// <summary></summary>
- public string Name;
- /// <summary></summary>
- public bool ObscureMedia;
- /// <summary></summary>
- public bool ObscureMusic;
- /// <summary></summary>
- public ParcelFlags ParcelFlags;
- /// <summary></summary>
- public float PassHours;
- /// <summary></summary>
- public uint PassPrice;
- /// <summary></summary>
- public bool Privacy;
- /// <summary></summary>
- public uint SalePrice;
- /// <summary></summary>
- public UUID SnapshotID;
- /// <summary></summary>
- public Vector3 UserLocation;
- /// <summary></summary>
- public Vector3 UserLookAt;
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public void Deserialize(OSDMap map)
- {
- AuthBuyerID = map["auth_buyer_id"].AsUUID();
- MediaAutoScale = map["auto_scale"].AsBoolean();
- Category = (ParcelCategory)map["category"].AsInteger();
- Desc = map["description"].AsString();
- GroupID = map["group_id"].AsUUID();
- Landing = (LandingType)map["landing_type"].AsUInteger();
- LocalID = map["local_id"].AsInteger();
- MediaDesc = map["media_desc"].AsString();
- MediaHeight = map["media_height"].AsInteger();
- MediaLoop = map["media_loop"].AsBoolean();
- MediaID = map["media_id"].AsUUID();
- MediaType = map["media_type"].AsString();
- MediaURL = map["media_url"].AsString();
- MediaWidth = map["media_width"].AsInteger();
- MusicURL = map["music_url"].AsString();
- Name = map["name"].AsString();
- ObscureMedia = map["obscure_media"].AsBoolean();
- ObscureMusic = map["obscure_music"].AsBoolean();
- ParcelFlags = (ParcelFlags)map["parcel_flags"].AsUInteger();
- PassHours = (float)map["pass_hours"].AsReal();
- PassPrice = map["pass_price"].AsUInteger();
- Privacy = map["privacy"].AsBoolean();
- SalePrice = map["sale_price"].AsUInteger();
- SnapshotID = map["snapshot_id"].AsUUID();
- UserLocation = map["user_location"].AsVector3();
- UserLookAt = map["user_look_at"].AsVector3();
- }
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- OSDMap map = new OSDMap();
- map["auth_buyer_id"] = OSD.FromUUID(AuthBuyerID);
- map["auto_scale"] = OSD.FromBoolean(MediaAutoScale);
- map["category"] = OSD.FromInteger((byte)Category);
- map["description"] = OSD.FromString(Desc);
- map["flags"] = OSD.FromBinary(Utils.EmptyBytes);
- map["group_id"] = OSD.FromUUID(GroupID);
- map["landing_type"] = OSD.FromInteger((byte)Landing);
- map["local_id"] = OSD.FromInteger(LocalID);
- map["media_desc"] = OSD.FromString(MediaDesc);
- map["media_height"] = OSD.FromInteger(MediaHeight);
- map["media_id"] = OSD.FromUUID(MediaID);
- map["media_loop"] = OSD.FromBoolean(MediaLoop);
- map["media_type"] = OSD.FromString(MediaType);
- map["media_url"] = OSD.FromString(MediaURL);
- map["media_width"] = OSD.FromInteger(MediaWidth);
- map["music_url"] = OSD.FromString(MusicURL);
- map["name"] = OSD.FromString(Name);
- map["obscure_media"] = OSD.FromBoolean(ObscureMedia);
- map["obscure_music"] = OSD.FromBoolean(ObscureMusic);
- map["parcel_flags"] = OSD.FromUInteger((uint)ParcelFlags);
- map["pass_hours"] = OSD.FromReal(PassHours);
- map["privacy"] = OSD.FromBoolean(Privacy);
- map["pass_price"] = OSD.FromInteger(PassPrice);
- map["sale_price"] = OSD.FromInteger(SalePrice);
- map["snapshot_id"] = OSD.FromUUID(SnapshotID);
- map["user_location"] = OSD.FromVector3(UserLocation);
- map["user_look_at"] = OSD.FromVector3(UserLookAt);
- return map;
- }
- }
- /// <summary>Base class used for the RemoteParcelRequest message</summary>
- [Serializable]
- public abstract class RemoteParcelRequestBlock
- {
- public abstract OSDMap Serialize();
- public abstract void Deserialize(OSDMap map);
- }
- /// <summary>
- /// A message sent from the viewer to the simulator to request information
- /// on a remote parcel
- /// </summary>
- public class RemoteParcelRequestRequest : RemoteParcelRequestBlock
- {
- /// <summary>Local sim position of the parcel we are looking up</summary>
- public Vector3 Location;
- /// <summary>Region handle of the parcel we are looking up</summary>
- public ulong RegionHandle;
- /// <summary>Region <see cref="UUID"/> of the parcel we are looking up</summary>
- public UUID RegionID;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public override OSDMap Serialize()
- {
- OSDMap map = new OSDMap(3);
- map["location"] = OSD.FromVector3(Location);
- map["region_handle"] = OSD.FromULong(RegionHandle);
- map["region_id"] = OSD.FromUUID(RegionID);
- return map;
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public override void Deserialize(OSDMap map)
- {
- Location = map["location"].AsVector3();
- RegionHandle = map["region_handle"].AsULong();
- RegionID = map["region_id"].AsUUID();
- }
- }
- /// <summary>
- /// A message sent from the simulator to the viewer in response to a <see cref="RemoteParcelRequestRequest"/>
- /// which will contain parcel information
- /// </summary>
- [Serializable]
- public class RemoteParcelRequestReply : RemoteParcelRequestBlock
- {
- /// <summary>The grid-wide unique parcel ID</summary>
- public UUID ParcelID;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public override OSDMap Serialize()
- {
- OSDMap map = new OSDMap(1);
- map["parcel_id"] = OSD.FromUUID(ParcelID);
- return map;
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public override void Deserialize(OSDMap map)
- {
- if (map == null || !map.ContainsKey("parcel_id"))
- ParcelID = UUID.Zero;
- else
- ParcelID = map["parcel_id"].AsUUID();
- }
- }
- /// <summary>
- /// A message containing a request for a remote parcel from a viewer, or a response
- /// from the simulator to that request
- /// </summary>
- [Serializable]
- public class RemoteParcelRequestMessage : IMessage
- {
- /// <summary>The request or response details block</summary>
- public RemoteParcelRequestBlock Request;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- return Request.Serialize();
- }
- /// <summary>
- /// Deserialize the message
- /// </summary>
- /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
- public void Deserialize(OSDMap map)
- {
- if (map.ContainsKey("parcel_id"))
- Request = new RemoteParcelRequestReply();
- else if (map.ContainsKey("location"))
- Request = new RemoteParcelRequestRequest();
- else
- Logger.Log("Unable to deserialize RemoteParcelRequest: No message handler exists for method: " + map.AsString(), Helpers.LogLevel.Warning);
- if (Request != null)
- Request.Deserialize(map);
- }
- }
- #endregion
- #region Inventory Messages
- public class NewFileAgentInventoryMessage : IMessage
- {
- public UUID FolderID;
- public AssetType AssetType;
- public InventoryType InventoryType;
- public string Name;
- public string Description;
- public PermissionMask EveryoneMask;
- public PermissionMask GroupMask;
- public PermissionMask NextOwnerMask;
- /// <summary>
- /// Serialize the object
- /// </summary>
- /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
- public OSDMap Serialize()
- {
- OSDMap map = new OSDMap(5);
- map["folder_id"] = OSD.FromUUID(FolderID);
- map["asset_type"] = OSD.FromString(Utils.AssetTypeToString(AssetType));
- map["inventory_type"] = OSD.FromString(Utils.InventoryTypeToString(InventoryType));
- map["name"] = OSD.FromString(Name);
- map["description"] = OSD.FromString(Description);
- map["everyone_mask"] = OSD.FromInteger((int)EveryoneMask)…
Large files files are truncated, but you can click here to view the full file