2006-10-21 02:52:28 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2006, Second Life Reverse Engineering Team
|
|
|
|
|
* 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 Second Life Reverse Engineering Team 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.Timers;
|
2006-10-21 05:53:58 +00:00
|
|
|
using System.Collections.Generic;
|
2006-10-21 02:52:28 +00:00
|
|
|
using libsecondlife.Packets;
|
|
|
|
|
|
|
|
|
|
namespace libsecondlife
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Parcel information retrieved from a simulator
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class Parcel
|
|
|
|
|
{
|
2007-02-12 11:15:49 +00:00
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Flags]
|
|
|
|
|
public enum ParcelFlags : uint
|
|
|
|
|
{
|
|
|
|
|
/// <summary>No flags set</summary>
|
|
|
|
|
None = 0,
|
|
|
|
|
/// <summary>Allow avatars to fly (a client-side only restriction)</summary>
|
|
|
|
|
AllowFly = 1 << 0,
|
|
|
|
|
/// <summary>Allow foreign scripts to run</summary>
|
|
|
|
|
AllowOtherScripts = 1 << 1,
|
|
|
|
|
/// <summary>This parcel is for sale</summary>
|
|
|
|
|
ForSale = 1 << 2,
|
|
|
|
|
/// <summary>Allow avatars to create a landmark on this parcel</summary>
|
|
|
|
|
AllowLandmark = 1 << 3,
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
AllowTerraform = 1 << 4,
|
|
|
|
|
/// <summary>Avatars have health and can take damage on this parcel</summary>
|
|
|
|
|
AllowDamage = 1 << 5,
|
|
|
|
|
/// <summary>Foreign avatars can create objects here</summary>
|
|
|
|
|
CreateObjects = 1 << 6,
|
|
|
|
|
/// <summary>All objects on this parcel can be purchased</summary>
|
|
|
|
|
ForSaleObjects = 1 << 7,
|
|
|
|
|
/// <summary>Access is restricted to a group</summary>
|
|
|
|
|
UseAccessGroup = 1 << 8,
|
|
|
|
|
/// <summary>Access is restricted to a whitelist</summary>
|
|
|
|
|
UseAccessList = 1 << 9,
|
|
|
|
|
/// <summary>Ban blacklist is enabled</summary>
|
|
|
|
|
UseBanList = 1 << 10,
|
|
|
|
|
/// <summary>Unknown</summary>
|
|
|
|
|
UsePassList = 1 << 11,
|
|
|
|
|
/// <summary>List this parcel in the search directory</summary>
|
|
|
|
|
ShowDirectory = 1 << 12,
|
|
|
|
|
/// <summary>Unknown</summary>
|
|
|
|
|
AllowDeedToGroup = 1 << 13,
|
|
|
|
|
/// <summary>Unknown</summary>
|
|
|
|
|
ContributeWithDeed = 1 << 14,
|
|
|
|
|
/// <summary>Restrict sounds originating on this parcel to the
|
|
|
|
|
/// parcel boundaries</summary>
|
|
|
|
|
SoundLocal = 1 << 15,
|
|
|
|
|
/// <summary>Objects on this parcel are sold when the land is
|
|
|
|
|
/// purchsaed</summary>
|
|
|
|
|
SellParcelObjects = 1 << 16,
|
|
|
|
|
/// <summary>Allow this parcel to be published on the web</summary>
|
|
|
|
|
AllowPublish = 1 << 17,
|
|
|
|
|
/// <summary>The information for this parcel is mature content</summary>
|
|
|
|
|
MaturePublish = 1 << 18,
|
|
|
|
|
/// <summary>The media URL is an HTML page</summary>
|
|
|
|
|
UrlWebPage = 1 << 19,
|
|
|
|
|
/// <summary>The media URL is a raw HTML string</summary>
|
|
|
|
|
UrlRawHtml = 1 << 20,
|
|
|
|
|
/// <summary>Restrict foreign object pushes</summary>
|
|
|
|
|
RestrictPushObject = 1 << 21,
|
|
|
|
|
/// <summary>Ban all non identified/transacted avatars</summary>
|
|
|
|
|
DenyAnonymous = 1 << 22,
|
|
|
|
|
/// <summary>Ban all identified avatars</summary>
|
|
|
|
|
DenyIdentified = 1 << 23,
|
|
|
|
|
/// <summary>Ban all transacted avatars</summary>
|
|
|
|
|
DenyTransacted = 1 << 24,
|
|
|
|
|
/// <summary>Allow group-owned scripts to run</summary>
|
|
|
|
|
AllowGroupScripts = 1 << 25,
|
|
|
|
|
/// <summary>Allow object creation by group members or group
|
|
|
|
|
/// objects</summary>
|
|
|
|
|
CreateGroupObjects = 1 << 26,
|
|
|
|
|
/// <summary>Allow all objects to enter this parcel</summary>
|
|
|
|
|
AllowAllObjectEntry = 1 << 27,
|
|
|
|
|
/// <summary>Only allow group and owner objects to enter this parcel</summary>
|
|
|
|
|
AllowGroupObjectEntry = 1 << 28,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-21 02:52:28 +00:00
|
|
|
/// <summary></summary>
|
|
|
|
|
public int RequestResult;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public int SequenceID;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public bool SnapSelection;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public int SelfCount;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public int OtherCount;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public int PublicCount;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public int LocalID;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Key of land owner</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public LLUUID OwnerID;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Is the land group owned</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public bool IsGroupOwned;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public uint AuctionID;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Presumably for first land</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public bool ReservedNewbie;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Date land was claimed</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public int ClaimDate;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public int ClaimPrice;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public int RentPrice;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public LLVector3 AABBMin;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public LLVector3 AABBMax;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Bitmap describing land layout in 4x4m squares across the entire region</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public byte[] Bitmap;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Total land area</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public int Area;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public byte Status;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Max objects across region</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public int SimWideMaxObjects;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Total objects across region</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public int SimWideTotalObjects;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Max objects for parcel</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public int MaxObjects;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Total objects in parcel</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public int TotalObjects;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Total objects for owner</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public int OwnerObjects;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Total objects for group</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public int GroupObjects;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Total for other objects</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public int OtherObjects;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public float ParcelObjectBonus;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public int OtherCleanTime;
|
|
|
|
|
/// <summary></summary>
|
2007-02-12 11:15:49 +00:00
|
|
|
public ParcelFlags Flags;
|
2006-10-21 02:52:28 +00:00
|
|
|
/// <summary></summary>
|
|
|
|
|
public int SalePrice;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Parcel Name</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public string Name;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Parcel Description</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public string Desc;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>URL For Music Stream</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public string MusicURL;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>URL For other Media</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public string MediaURL;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Key to Picture for Media Placeholder</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public LLUUID MediaID;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public byte MediaAutoScale;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public LLUUID GroupID;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Price for a temporary pass</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public int PassPrice;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>How long is pass valid for</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public float PassHours;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public byte Category;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Key of authorized buyer</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public LLUUID AuthBuyerID;
|
2006-12-16 03:24:05 +00:00
|
|
|
/// <summary>Key of parcel snapshot</summary>
|
2006-10-21 02:52:28 +00:00
|
|
|
public LLUUID SnapshotID;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public LLVector3 UserLocation;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public LLVector3 UserLookAt;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public byte LandingType;
|
|
|
|
|
/// <summary></summary>
|
|
|
|
|
public float Dwell;
|
2007-01-19 13:15:12 +00:00
|
|
|
/// <summary></summary>
|
|
|
|
|
public Simulator Simulator;
|
2006-10-21 02:52:28 +00:00
|
|
|
|
|
|
|
|
private void init()
|
|
|
|
|
{
|
2006-11-07 23:30:09 +00:00
|
|
|
OwnerID = LLUUID.Zero;
|
|
|
|
|
AABBMin = LLVector3.Zero;
|
|
|
|
|
AABBMax = LLVector3.Zero;
|
2006-10-21 02:52:28 +00:00
|
|
|
Bitmap = new byte[512];
|
2006-11-07 23:30:09 +00:00
|
|
|
MediaID = LLUUID.Zero;
|
|
|
|
|
GroupID = LLUUID.Zero;
|
|
|
|
|
AuthBuyerID = LLUUID.Zero;
|
|
|
|
|
SnapshotID = LLUUID.Zero;
|
|
|
|
|
UserLocation = LLVector3.Zero;
|
|
|
|
|
UserLookAt = LLVector3.Zero;
|
2006-10-21 02:52:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Parcel()
|
|
|
|
|
{
|
|
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="simulator"></param>
|
|
|
|
|
public Parcel(Simulator simulator)
|
|
|
|
|
{
|
2007-01-19 13:15:12 +00:00
|
|
|
Simulator = simulator;
|
2006-10-21 02:52:28 +00:00
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
public void GetDwell(SecondLife client)
|
|
|
|
|
{
|
|
|
|
|
ParcelDwellRequestPacket request = new ParcelDwellRequestPacket();
|
|
|
|
|
request.AgentData.AgentID = client.Network.AgentID;
|
|
|
|
|
request.AgentData.SessionID = client.Network.SessionID;
|
|
|
|
|
request.Data.LocalID = LocalID;
|
2006-11-07 23:30:09 +00:00
|
|
|
request.Data.ParcelID = LLUUID.Zero;
|
2006-10-21 02:52:28 +00:00
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
client.Network.SendPacket((Packet)request, Simulator);
|
2006-10-21 02:52:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
/// <param name="forGroup"></param>
|
|
|
|
|
/// <param name="groupID"></param>
|
2007-02-16 00:50:19 +00:00
|
|
|
/// <param name="removeContribution"></param>
|
2006-10-21 02:52:28 +00:00
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool Buy(SecondLife client, bool forGroup, LLUUID groupID, bool removeContribution)
|
|
|
|
|
{
|
|
|
|
|
ParcelBuyPacket request = new ParcelBuyPacket();
|
|
|
|
|
|
2006-10-24 11:16:26 +00:00
|
|
|
request.AgentData.AgentID = client.Network.AgentID;
|
2006-10-21 02:52:28 +00:00
|
|
|
request.AgentData.SessionID = client.Network.SessionID;
|
|
|
|
|
|
|
|
|
|
request.Data.Final = true;
|
|
|
|
|
request.Data.GroupID = groupID;
|
|
|
|
|
request.Data.LocalID = this.LocalID;
|
|
|
|
|
request.Data.IsGroupOwned = forGroup;
|
|
|
|
|
request.Data.RemoveContribution = removeContribution;
|
|
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
client.Network.SendPacket((Packet)request, Simulator);
|
2006-10-21 02:52:28 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool Reclaim(SecondLife client)
|
|
|
|
|
{
|
|
|
|
|
ParcelReclaimPacket request = new ParcelReclaimPacket();
|
2006-10-24 11:16:26 +00:00
|
|
|
request.AgentData.AgentID = client.Network.AgentID;
|
2006-10-21 02:52:28 +00:00
|
|
|
request.AgentData.SessionID = client.Network.SessionID;
|
|
|
|
|
|
|
|
|
|
request.Data.LocalID = this.LocalID;
|
|
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
client.Network.SendPacket((Packet)request, Simulator);
|
2006-10-21 02:52:28 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
/// <param name="groupID"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool Deed(SecondLife client, LLUUID groupID)
|
|
|
|
|
{
|
|
|
|
|
ParcelDeedToGroupPacket request = new ParcelDeedToGroupPacket();
|
2006-10-24 11:16:26 +00:00
|
|
|
request.AgentData.AgentID = client.Network.AgentID;
|
2006-10-21 02:52:28 +00:00
|
|
|
request.AgentData.SessionID = client.Network.SessionID;
|
|
|
|
|
|
|
|
|
|
request.Data.LocalID = this.LocalID;
|
|
|
|
|
request.Data.GroupID = groupID;
|
|
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
client.Network.SendPacket((Packet)request, Simulator);
|
2006-10-21 02:52:28 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
public void Update(SecondLife client)
|
|
|
|
|
{
|
|
|
|
|
ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();
|
|
|
|
|
|
2006-10-24 11:16:26 +00:00
|
|
|
request.AgentData.AgentID = client.Network.AgentID;
|
2006-10-21 02:52:28 +00:00
|
|
|
request.AgentData.SessionID = client.Network.SessionID;
|
|
|
|
|
|
|
|
|
|
request.ParcelData.Flags = 0xFFFFFFFF; // TODO: Probably very important
|
|
|
|
|
request.ParcelData.LocalID = this.LocalID;
|
|
|
|
|
|
|
|
|
|
request.ParcelData.AuthBuyerID = this.AuthBuyerID;
|
|
|
|
|
request.ParcelData.Category = this.Category;
|
|
|
|
|
request.ParcelData.Desc = Helpers.StringToField(this.Desc);
|
|
|
|
|
request.ParcelData.GroupID = this.GroupID;
|
|
|
|
|
request.ParcelData.LandingType = this.LandingType;
|
|
|
|
|
request.ParcelData.MediaAutoScale = this.MediaAutoScale;
|
|
|
|
|
request.ParcelData.MediaID = this.MediaID;
|
|
|
|
|
request.ParcelData.MediaURL = Helpers.StringToField(this.MediaURL);
|
|
|
|
|
request.ParcelData.MusicURL = Helpers.StringToField(this.MusicURL);
|
|
|
|
|
request.ParcelData.Name = Helpers.StringToField(this.Name);
|
2007-02-17 01:41:12 +00:00
|
|
|
request.ParcelData.Flags = 0; // TODO: Unused?
|
|
|
|
|
request.ParcelData.ParcelFlags = (uint)this.Flags;
|
2006-10-21 02:52:28 +00:00
|
|
|
request.ParcelData.PassHours = this.PassHours;
|
|
|
|
|
request.ParcelData.PassPrice = this.PassPrice;
|
|
|
|
|
request.ParcelData.SalePrice = this.SalePrice;
|
|
|
|
|
request.ParcelData.SnapshotID = this.SnapshotID;
|
|
|
|
|
request.ParcelData.UserLocation = this.UserLocation;
|
|
|
|
|
request.ParcelData.UserLookAt = this.UserLookAt;
|
|
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
client.Network.SendPacket(request, Simulator);
|
2006-10-21 02:52:28 +00:00
|
|
|
//Packet updatePacket = Packets.Parcel.ParcelPropertiesUpdate(client.Protocol, client.Avatar.ID, client.Network.SessionID, this);
|
|
|
|
|
//Sim.SendPacket(updatePacket, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
/// <param name="returnType"></param>
|
|
|
|
|
public void ReturnObjects(SecondLife client, uint returnType)
|
|
|
|
|
{
|
|
|
|
|
// TODO: ENUM for returnType
|
|
|
|
|
|
|
|
|
|
ParcelReturnObjectsPacket request = new ParcelReturnObjectsPacket();
|
2006-10-24 11:16:26 +00:00
|
|
|
request.AgentData.AgentID = client.Network.AgentID;
|
2006-10-21 02:52:28 +00:00
|
|
|
request.AgentData.SessionID = client.Network.SessionID;
|
|
|
|
|
|
|
|
|
|
request.ParcelData.LocalID = this.LocalID;
|
|
|
|
|
request.ParcelData.ReturnType = returnType;
|
|
|
|
|
|
|
|
|
|
// TODO: Handling of TaskIDs and OwnerIDs
|
|
|
|
|
request.OwnerIDs = new ParcelReturnObjectsPacket.OwnerIDsBlock[0];
|
|
|
|
|
request.TaskIDs = new ParcelReturnObjectsPacket.TaskIDsBlock[1];
|
|
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
client.Network.SendPacket((Packet)request, Simulator);
|
2006-10-21 02:52:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
public struct ParcelInfo
|
|
|
|
|
{
|
|
|
|
|
public LLUUID ID;
|
|
|
|
|
public LLUUID OwnerID;
|
|
|
|
|
public string Name;
|
|
|
|
|
public string Description;
|
|
|
|
|
public int ActualArea;
|
|
|
|
|
public int BillableArea;
|
|
|
|
|
public bool Mature;
|
|
|
|
|
public float GlobalX;
|
|
|
|
|
public float GlobalY;
|
|
|
|
|
public float GlobalZ;
|
|
|
|
|
public string SimName;
|
|
|
|
|
public LLUUID SnapshotID;
|
|
|
|
|
public float Dwell;
|
|
|
|
|
public int SalePrice;
|
|
|
|
|
public int AuctionID;
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-21 02:52:28 +00:00
|
|
|
/// <summary>
|
2007-01-19 13:15:12 +00:00
|
|
|
/// Parcel (subdivided simulator lots) subsystem
|
2006-10-21 02:52:28 +00:00
|
|
|
/// </summary>
|
|
|
|
|
public class ParcelManager
|
|
|
|
|
{
|
2007-01-19 13:15:12 +00:00
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="parcelID"></param>
|
|
|
|
|
/// <param name="localID"></param>
|
|
|
|
|
/// <param name="dwell"></param>
|
|
|
|
|
public delegate void ParcelDwellCallback(LLUUID parcelID, int localID, float dwell);
|
|
|
|
|
public delegate void ParcelInfoCallback(ParcelInfo parcel);
|
|
|
|
|
public delegate void ParcelPropertiesCallback(Parcel parcel);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public event ParcelDwellCallback OnParcelDwell;
|
|
|
|
|
public event ParcelInfoCallback OnParcelInfo;
|
|
|
|
|
public event ParcelPropertiesCallback OnParcelProperties;
|
|
|
|
|
|
|
|
|
|
|
2006-10-21 02:52:28 +00:00
|
|
|
private SecondLife Client;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2007-01-19 13:15:12 +00:00
|
|
|
/// Default constructor
|
2006-10-21 02:52:28 +00:00
|
|
|
/// </summary>
|
2007-01-19 13:15:12 +00:00
|
|
|
/// <param name="client">A reference to the SecondLife client</param>
|
2006-10-21 02:52:28 +00:00
|
|
|
public ParcelManager(SecondLife client)
|
|
|
|
|
{
|
|
|
|
|
Client = client;
|
2006-10-27 21:42:23 +00:00
|
|
|
|
2006-10-21 02:52:28 +00:00
|
|
|
// Setup the callbacks
|
2006-11-09 10:18:03 +00:00
|
|
|
Client.Network.RegisterCallback(PacketType.ParcelInfoReply, new NetworkManager.PacketCallback(ParcelInfoReplyHandler));
|
|
|
|
|
Client.Network.RegisterCallback(PacketType.ParcelProperties, new NetworkManager.PacketCallback(ParcelPropertiesHandler));
|
|
|
|
|
Client.Network.RegisterCallback(PacketType.ParcelDwellReply, new NetworkManager.PacketCallback(ParcelDwellReplyHandler));
|
2006-10-21 02:52:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
2007-01-19 13:15:12 +00:00
|
|
|
/// <param name="parcelID"></param>
|
|
|
|
|
public void ParcelInfoRequest(LLUUID parcelID)
|
2006-10-21 02:52:28 +00:00
|
|
|
{
|
2007-01-19 13:15:12 +00:00
|
|
|
ParcelInfoRequestPacket request = new ParcelInfoRequestPacket();
|
|
|
|
|
request.AgentData.AgentID = Client.Network.AgentID;
|
|
|
|
|
request.AgentData.SessionID = Client.Network.SessionID;
|
|
|
|
|
request.Data.ParcelID = parcelID;
|
2006-10-21 02:52:28 +00:00
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
Client.Network.SendPacket((Packet)request);
|
2006-10-21 02:52:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
2007-01-19 13:15:12 +00:00
|
|
|
/// <param name="simulator"></param>
|
|
|
|
|
/// <param name="north"></param>
|
|
|
|
|
/// <param name="east"></param>
|
|
|
|
|
/// <param name="south"></param>
|
|
|
|
|
/// <param name="west"></param>
|
|
|
|
|
/// <param name="sequenceID"></param>
|
|
|
|
|
/// <param name="snapSelection"></param>
|
|
|
|
|
public void ParcelPropertiesRequest(Simulator simulator, float north, float east, float south, float west,
|
|
|
|
|
int sequenceID, bool snapSelection)
|
2006-10-21 02:52:28 +00:00
|
|
|
{
|
2007-01-19 13:15:12 +00:00
|
|
|
ParcelPropertiesRequestPacket request = new ParcelPropertiesRequestPacket();
|
|
|
|
|
|
|
|
|
|
request.AgentData.AgentID = Client.Network.AgentID;
|
|
|
|
|
request.AgentData.SessionID = Client.Network.SessionID;
|
|
|
|
|
request.ParcelData.North = north;
|
|
|
|
|
request.ParcelData.East = east;
|
|
|
|
|
request.ParcelData.South = south;
|
|
|
|
|
request.ParcelData.West = west;
|
|
|
|
|
request.ParcelData.SequenceID = sequenceID;
|
|
|
|
|
request.ParcelData.SnapSelection = snapSelection;
|
|
|
|
|
|
|
|
|
|
Client.Network.SendPacket(request, simulator);
|
2006-10-21 02:52:28 +00:00
|
|
|
}
|
|
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
private void ParcelDwellReplyHandler(Packet packet, Simulator simulator)
|
2006-10-21 02:52:28 +00:00
|
|
|
{
|
2007-01-19 13:15:12 +00:00
|
|
|
if (OnParcelDwell != null)
|
2006-10-21 02:52:28 +00:00
|
|
|
{
|
2007-01-19 13:15:12 +00:00
|
|
|
ParcelDwellReplyPacket dwell = (ParcelDwellReplyPacket)packet;
|
2006-10-21 02:52:28 +00:00
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
try { OnParcelDwell(dwell.Data.ParcelID, dwell.Data.LocalID, dwell.Data.Dwell); }
|
|
|
|
|
catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
|
2006-10-21 02:52:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ParcelInfoReplyHandler(Packet packet, Simulator simulator)
|
|
|
|
|
{
|
2007-01-19 13:15:12 +00:00
|
|
|
if (OnParcelInfo != null)
|
2006-10-21 02:52:28 +00:00
|
|
|
{
|
2007-01-19 13:15:12 +00:00
|
|
|
ParcelInfoReplyPacket info = (ParcelInfoReplyPacket)packet;
|
|
|
|
|
|
|
|
|
|
ParcelInfo parcelInfo = new ParcelInfo();
|
|
|
|
|
|
|
|
|
|
parcelInfo.ActualArea = info.Data.ActualArea;
|
|
|
|
|
parcelInfo.AuctionID = info.Data.AuctionID;
|
|
|
|
|
parcelInfo.BillableArea = info.Data.BillableArea;
|
|
|
|
|
parcelInfo.Description = Helpers.FieldToString(info.Data.Desc);
|
|
|
|
|
parcelInfo.Dwell = info.Data.Dwell;
|
|
|
|
|
parcelInfo.GlobalX = info.Data.GlobalX;
|
|
|
|
|
parcelInfo.GlobalY = info.Data.GlobalY;
|
|
|
|
|
parcelInfo.GlobalZ = info.Data.GlobalZ;
|
|
|
|
|
parcelInfo.ID = info.Data.ParcelID;
|
|
|
|
|
parcelInfo.Mature = ((info.Data.Flags & 1) != 0) ? true : false;
|
|
|
|
|
parcelInfo.Name = Helpers.FieldToString(info.Data.Name);
|
|
|
|
|
parcelInfo.OwnerID = info.Data.OwnerID;
|
|
|
|
|
parcelInfo.SalePrice = info.Data.SalePrice;
|
|
|
|
|
parcelInfo.SimName = Helpers.FieldToString(info.Data.SimName);
|
|
|
|
|
parcelInfo.SnapshotID = info.Data.SnapshotID;
|
|
|
|
|
|
|
|
|
|
try { OnParcelInfo(parcelInfo); }
|
|
|
|
|
catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
|
2006-10-27 21:42:23 +00:00
|
|
|
}
|
2006-10-21 02:52:28 +00:00
|
|
|
}
|
|
|
|
|
|
2007-01-19 13:15:12 +00:00
|
|
|
private void ParcelPropertiesHandler(Packet packet, Simulator simulator)
|
2006-10-21 02:52:28 +00:00
|
|
|
{
|
2007-01-19 13:15:12 +00:00
|
|
|
if (OnParcelProperties != null)
|
2006-10-21 02:52:28 +00:00
|
|
|
{
|
2007-01-19 13:15:12 +00:00
|
|
|
ParcelPropertiesPacket properties = (ParcelPropertiesPacket)packet;
|
|
|
|
|
|
|
|
|
|
Parcel parcel = new Parcel(simulator);
|
|
|
|
|
|
|
|
|
|
// TODO: Lots of values are not being stored, Parcel needs to be expanded to take all the data.
|
|
|
|
|
// August2006: God help me should I have to type this out again... argh.
|
|
|
|
|
// October2006: I really shouldnt have typed that.
|
|
|
|
|
parcel.RequestResult = properties.ParcelData.RequestResult;
|
|
|
|
|
parcel.SequenceID = properties.ParcelData.SequenceID;
|
|
|
|
|
parcel.SnapSelection = properties.ParcelData.SnapSelection;
|
|
|
|
|
parcel.SelfCount = properties.ParcelData.SelfCount;
|
|
|
|
|
parcel.OtherCount = properties.ParcelData.OtherCount;
|
|
|
|
|
parcel.PublicCount = properties.ParcelData.PublicCount;
|
|
|
|
|
parcel.LocalID = properties.ParcelData.LocalID;
|
|
|
|
|
parcel.OwnerID = properties.ParcelData.OwnerID;
|
|
|
|
|
parcel.IsGroupOwned = properties.ParcelData.IsGroupOwned;
|
|
|
|
|
parcel.AuctionID = properties.ParcelData.AuctionID;
|
|
|
|
|
parcel.ReservedNewbie = properties.ParcelData.ReservedNewbie;
|
|
|
|
|
parcel.ClaimDate = properties.ParcelData.ClaimDate;
|
|
|
|
|
parcel.ClaimPrice = properties.ParcelData.ClaimPrice;
|
|
|
|
|
parcel.RentPrice = properties.ParcelData.RentPrice;
|
|
|
|
|
parcel.AABBMin = properties.ParcelData.AABBMin;
|
|
|
|
|
parcel.AABBMax = properties.ParcelData.AABBMax;
|
|
|
|
|
parcel.Bitmap = properties.ParcelData.Bitmap;
|
|
|
|
|
parcel.Area = properties.ParcelData.Area;
|
|
|
|
|
parcel.Status = properties.ParcelData.Status;
|
|
|
|
|
parcel.SimWideMaxObjects = properties.ParcelData.SimWideMaxPrims;
|
|
|
|
|
parcel.SimWideTotalObjects = properties.ParcelData.SimWideTotalPrims;
|
|
|
|
|
parcel.MaxObjects = properties.ParcelData.MaxPrims;
|
|
|
|
|
parcel.TotalObjects = properties.ParcelData.TotalPrims;
|
|
|
|
|
parcel.OwnerObjects = properties.ParcelData.OwnerPrims;
|
|
|
|
|
parcel.GroupObjects = properties.ParcelData.GroupPrims;
|
|
|
|
|
parcel.OtherObjects = properties.ParcelData.OtherPrims;
|
|
|
|
|
parcel.ParcelObjectBonus = properties.ParcelData.ParcelPrimBonus;
|
|
|
|
|
parcel.OtherCleanTime = properties.ParcelData.OtherCleanTime;
|
2007-02-12 11:15:49 +00:00
|
|
|
parcel.Flags = (Parcel.ParcelFlags)properties.ParcelData.ParcelFlags;
|
2007-01-19 13:15:12 +00:00
|
|
|
parcel.SalePrice = properties.ParcelData.SalePrice;
|
|
|
|
|
parcel.Name = Helpers.FieldToString(properties.ParcelData.Name);
|
|
|
|
|
parcel.Desc = Helpers.FieldToString(properties.ParcelData.Desc);
|
|
|
|
|
parcel.MusicURL = Helpers.FieldToString(properties.ParcelData.MusicURL);
|
|
|
|
|
parcel.MediaURL = Helpers.FieldToString(properties.ParcelData.MediaURL);
|
|
|
|
|
parcel.MediaID = properties.ParcelData.MediaID;
|
|
|
|
|
parcel.MediaAutoScale = properties.ParcelData.MediaAutoScale;
|
|
|
|
|
parcel.GroupID = properties.ParcelData.GroupID;
|
|
|
|
|
parcel.PassPrice = properties.ParcelData.PassPrice;
|
|
|
|
|
parcel.PassHours = properties.ParcelData.PassHours;
|
|
|
|
|
parcel.Category = properties.ParcelData.Category;
|
|
|
|
|
parcel.AuthBuyerID = properties.ParcelData.AuthBuyerID;
|
|
|
|
|
parcel.SnapshotID = properties.ParcelData.SnapshotID;
|
|
|
|
|
parcel.UserLocation = properties.ParcelData.UserLocation;
|
|
|
|
|
parcel.UserLookAt = properties.ParcelData.UserLookAt;
|
|
|
|
|
parcel.LandingType = properties.ParcelData.LandingType;
|
|
|
|
|
|
|
|
|
|
// Fire the callback
|
|
|
|
|
try { OnParcelProperties(parcel); }
|
|
|
|
|
catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
|
2006-10-21 02:52:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|