*Standardized the Land module by removing all references to libsecondlife.packets

0.6.0-stable
mingchen 2008-05-05 17:44:40 +00:00
parent ce19234dc8
commit c535f3947d
7 changed files with 297 additions and 236 deletions

View File

@ -235,6 +235,26 @@ namespace OpenSim.Framework
#endregion
}
public class LandUpdateArgs : EventArgs
{
public LLUUID AuthBuyerID;
public Parcel.ParcelCategory Category;
public string Desc;
public LLUUID GroupID;
public byte LandingType;
public byte MediaAutoScale;
public LLUUID MediaID;
public string MediaURL;
public string MusicURL;
public string Name;
public uint ParcelFlags;
public float PassHours;
public int PassPrice;
public int SalePrice;
public LLUUID SnapshotID;
public LLVector3 UserLocation;
public LLVector3 UserLookAt;
}
public delegate void TextureRequest(Object sender, TextureRequestArgs e);
public delegate void AvatarNowWearing(Object sender, AvatarWearingArgs e);
@ -355,7 +375,7 @@ namespace OpenSim.Framework
public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client);
public delegate void ParcelPropertiesUpdateRequest(LandUpdateArgs args, int local_id, IClientAPI remote_client);
public delegate void ParcelSelectObjects(int land_local_id, int request_type, IClientAPI remote_client);
@ -778,6 +798,11 @@ namespace OpenSim.Framework
void sendEstateCovenantInformation();
void sendDetailedEstateData(LLUUID invoice);
void sendLandProperties(IClientAPI remote_client, int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int simObjectCapacity);
void sendLandAccessListData(List<LLUUID> avatars, uint accessFlag, int localLandID);
void sendForceClientSelectObjects(List<uint> objectIDs);
void sendLandObjectOwners(Dictionary<LLUUID, int> ownersAndCount);
byte[] GetThrottlesPacked(float multiplier);

View File

@ -2274,10 +2274,205 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
#endregion
#region Helper Methods
protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos,
#region Land Data Sending Methods
public void sendLandProperties(IClientAPI remote_client,int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int simObjectCapacity)
{
ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties);
// TODO: don't create new blocks if recycling an old packet
updatePacket.ParcelData.AABBMax = landData.AABBMax;
updatePacket.ParcelData.AABBMin = landData.AABBMin;
updatePacket.ParcelData.Area = landData.area;
updatePacket.ParcelData.AuctionID = landData.auctionID;
updatePacket.ParcelData.AuthBuyerID = landData.authBuyerID; //unemplemented
updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray;
updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc);
updatePacket.ParcelData.Category = (byte) landData.category;
updatePacket.ParcelData.ClaimDate = landData.claimDate;
updatePacket.ParcelData.ClaimPrice = landData.claimPrice;
updatePacket.ParcelData.GroupID = landData.groupID;
updatePacket.ParcelData.GroupPrims = landData.groupPrims;
updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned;
updatePacket.ParcelData.LandingType = (byte) landData.landingType;
updatePacket.ParcelData.LocalID = landData.localID;
if (landData.area > 0)
{
updatePacket.ParcelData.MaxPrims =
Convert.ToInt32(
Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * simObjectCapacity *
Convert.ToDecimal(simObjectBonusFactor)));
}
else
{
updatePacket.ParcelData.MaxPrims = 0;
}
updatePacket.ParcelData.MediaAutoScale = landData.mediaAutoScale;
updatePacket.ParcelData.MediaID = landData.mediaID;
updatePacket.ParcelData.MediaURL = Helpers.StringToField(landData.mediaURL);
updatePacket.ParcelData.MusicURL = Helpers.StringToField(landData.musicURL);
updatePacket.ParcelData.Name = Helpers.StringToField(landData.landName);
updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
updatePacket.ParcelData.OtherCount = 0; //unemplemented
updatePacket.ParcelData.OtherPrims = landData.otherPrims;
updatePacket.ParcelData.OwnerID = landData.ownerID;
updatePacket.ParcelData.OwnerPrims = landData.ownerPrims;
updatePacket.ParcelData.ParcelFlags = landData.landFlags;
updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.EstateSettings.objectBonusFactor;
updatePacket.ParcelData.PassHours = landData.passHours;
updatePacket.ParcelData.PassPrice = landData.passPrice;
updatePacket.ParcelData.PublicCount = 0; //unemplemented
uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags;
updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) >
0);
updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) >
0);
updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) >
0);
updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) >
0);
updatePacket.ParcelData.RentPrice = 0;
updatePacket.ParcelData.RequestResult = request_result;
updatePacket.ParcelData.SalePrice = landData.salePrice;
updatePacket.ParcelData.SelectedPrims = landData.selectedPrims;
updatePacket.ParcelData.SelfCount = 0; //unemplemented
updatePacket.ParcelData.SequenceID = sequence_id;
if (landData.simwideArea > 0)
{
updatePacket.ParcelData.SimWideMaxPrims =
Convert.ToInt32(
Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * simObjectCapacity *
Convert.ToDecimal(simObjectBonusFactor)));
}
else
{
updatePacket.ParcelData.SimWideMaxPrims = 0;
}
updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims;
updatePacket.ParcelData.SnapSelection = snap_selection;
updatePacket.ParcelData.SnapshotID = landData.snapshotID;
updatePacket.ParcelData.Status = (byte) landData.landStatus;
updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims +
landData.selectedPrims;
updatePacket.ParcelData.UserLocation = landData.userLocation;
updatePacket.ParcelData.UserLookAt = landData.userLookAt;
remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task);
}
public void sendLandAccessListData(List<LLUUID> avatars, uint accessFlag, int localLandID)
{
ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
replyPacket.Data.AgentID = this.AgentId;
replyPacket.Data.Flags = accessFlag;
replyPacket.Data.LocalID = localLandID;
replyPacket.Data.SequenceID = 0;
List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>();
foreach (LLUUID avatar in avatars)
{
ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock();
block.Flags = accessFlag;
block.ID = avatar;
block.Time = 0;
}
replyPacket.List = list.ToArray();
this.OutPacket((Packet)replyPacket, ThrottleOutPacketType.Task);
}
public void sendForceClientSelectObjects(List<uint> ObjectIDs)
{
bool firstCall = true;
int MAX_OBJECTS_PER_PACKET = 251;
ForceObjectSelectPacket pack = (ForceObjectSelectPacket)PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect);
ForceObjectSelectPacket.DataBlock[] data;
while (ObjectIDs.Count > 0)
{
if (firstCall)
{
pack._Header.ResetList = true;
firstCall = false;
}
else
{
pack._Header.ResetList = false;
}
if (ObjectIDs.Count > MAX_OBJECTS_PER_PACKET)
{
data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET];
}
else
{
data = new ForceObjectSelectPacket.DataBlock[ObjectIDs.Count];
}
int i;
for (i = 0; i < MAX_OBJECTS_PER_PACKET && ObjectIDs.Count > 0; i++)
{
data[i] = new ForceObjectSelectPacket.DataBlock();
data[i].LocalID = Convert.ToUInt32(ObjectIDs[0]);
ObjectIDs.RemoveAt(0);
}
pack.Data = data;
this.OutPacket((Packet)pack, ThrottleOutPacketType.Task);
}
}
public void sendLandObjectOwners(Dictionary<LLUUID, int> ownersAndCount)
{
int notifyCount = ownersAndCount.Count;
ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply);
if (notifyCount > 0)
{
if (notifyCount > 32)
{
m_log.InfoFormat(
"[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
+ " - a developer might want to investigate whether this is a hard limit", 32);
notifyCount = 32;
}
ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
= new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
int num = 0;
foreach (LLUUID owner in ownersAndCount.Keys)
{
dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock();
dataBlock[num].Count = ownersAndCount[owner];
dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added
dataBlock[num].OnlineStatus = true; //TODO: fix me later
dataBlock[num].OwnerID = owner;
num++;
if (num >= notifyCount)
{
break;
}
}
pack.Data = dataBlock;
}
this.OutPacket(pack, ThrottleOutPacketType.Task);
}
#endregion
#region Helper Methods
protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos,
LLVector3 velocity,
LLQuaternion rotation)
{
@ -4704,7 +4899,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerParcelPropertiesUpdateRequest != null)
{
handlerParcelPropertiesUpdateRequest(parcelPropertiesPacket, this);
LandUpdateArgs args = new LandUpdateArgs();
args.AuthBuyerID = parcelPropertiesPacket.ParcelData.AuthBuyerID;
args.Category = (Parcel.ParcelCategory)parcelPropertiesPacket.ParcelData.Category;
args.Desc = Helpers.FieldToUTF8String(parcelPropertiesPacket.ParcelData.Desc);
args.GroupID = parcelPropertiesPacket.ParcelData.GroupID;
args.LandingType = parcelPropertiesPacket.ParcelData.LandingType;
args.MediaAutoScale = parcelPropertiesPacket.ParcelData.MediaAutoScale;
args.MediaID = parcelPropertiesPacket.ParcelData.MediaID;
args.MediaURL = Helpers.FieldToUTF8String(parcelPropertiesPacket.ParcelData.MediaURL);
args.MusicURL = Helpers.FieldToUTF8String(parcelPropertiesPacket.ParcelData.MusicURL);
args.Name = Helpers.FieldToUTF8String(parcelPropertiesPacket.ParcelData.Name);
args.ParcelFlags = parcelPropertiesPacket.ParcelData.ParcelFlags;
args.PassHours = parcelPropertiesPacket.ParcelData.PassHours;
args.PassPrice = parcelPropertiesPacket.ParcelData.PassPrice;
args.SalePrice = parcelPropertiesPacket.ParcelData.SalePrice;
args.SnapshotID = parcelPropertiesPacket.ParcelData.SnapshotID;
args.UserLocation = parcelPropertiesPacket.ParcelData.UserLocation;
args.UserLookAt = parcelPropertiesPacket.ParcelData.UserLookAt;
handlerParcelPropertiesUpdateRequest(args, parcelPropertiesPacket.ParcelData.LocalID, this);
}
break;
case PacketType.ParcelSelectObjects:

View File

@ -27,7 +27,6 @@
using System.Collections.Generic;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes;
@ -56,7 +55,7 @@ namespace OpenSim.Region.Environment.Interfaces
void sendParcelOverlay(IClientAPI remote_client);
void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client);
void handleParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client);
void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client);
void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client);

View File

@ -27,7 +27,6 @@
using System.Collections.Generic;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes;
@ -44,12 +43,12 @@ namespace OpenSim.Region.Environment.Interfaces
void sendLandUpdateToAvatarsOverMe();
void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client);
void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client);
void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client);
bool isEitherBannedOrRestricted(LLUUID avatar);
bool isBannedFromLand(LLUUID avatar);
bool isRestrictedFromLand(LLUUID avatar);
void sendLandUpdateToClient(IClientAPI remote_client);
ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag);
List<LLUUID> createAccessListArrayByFlag(ParcelManager.AccessList flag);
void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, IClientAPI remote_client);
void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
void updateLandBitmapByteArray();

View File

@ -672,11 +672,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land
sendParcelOverlay(remote_client);
}
public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
public void handleParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client)
{
if (landList.ContainsKey(packet.ParcelData.LocalID))
if (landList.ContainsKey(localID))
{
landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client);
landList[localID].updateLandProperties(args, remote_client);
}
}

View File

@ -29,7 +29,6 @@ using System;
using System.Collections.Generic;
using System.Reflection;
using libsecondlife;
using libsecondlife.Packets;
using log4net;
using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces;
@ -121,123 +120,35 @@ namespace OpenSim.Region.Environment.Modules.World.Land
#region Packet Request Handling
/// <summary>
/// Sends land properties as requested
/// </summary>
/// <param name="sequence_id">ID sent by client for them to keep track of</param>
/// <param name="snap_selection">Bool sent by client for them to use</param>
/// <param name="remote_client">Object representing the client</param>
public void sendLandProperties(int sequence_id, bool snap_selection, int request_result,
IClientAPI remote_client)
public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
{
ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties);
// TODO: don't create new blocks if recycling an old packet
updatePacket.ParcelData.AABBMax = landData.AABBMax;
updatePacket.ParcelData.AABBMin = landData.AABBMin;
updatePacket.ParcelData.Area = landData.area;
updatePacket.ParcelData.AuctionID = landData.auctionID;
updatePacket.ParcelData.AuthBuyerID = landData.authBuyerID; //unemplemented
updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray;
updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc);
updatePacket.ParcelData.Category = (byte) landData.category;
updatePacket.ParcelData.ClaimDate = landData.claimDate;
updatePacket.ParcelData.ClaimPrice = landData.claimPrice;
updatePacket.ParcelData.GroupID = landData.groupID;
updatePacket.ParcelData.GroupPrims = landData.groupPrims;
updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned;
updatePacket.ParcelData.LandingType = (byte) landData.landingType;
updatePacket.ParcelData.LocalID = landData.localID;
if (landData.area > 0)
{
updatePacket.ParcelData.MaxPrims =
Convert.ToInt32(
Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity *
Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor)));
}
else
{
updatePacket.ParcelData.MaxPrims = 0;
}
updatePacket.ParcelData.MediaAutoScale = landData.mediaAutoScale;
updatePacket.ParcelData.MediaID = landData.mediaID;
updatePacket.ParcelData.MediaURL = Helpers.StringToField(landData.mediaURL);
updatePacket.ParcelData.MusicURL = Helpers.StringToField(landData.musicURL);
updatePacket.ParcelData.Name = Helpers.StringToField(landData.landName);
updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
updatePacket.ParcelData.OtherCount = 0; //unemplemented
updatePacket.ParcelData.OtherPrims = landData.otherPrims;
updatePacket.ParcelData.OwnerID = landData.ownerID;
updatePacket.ParcelData.OwnerPrims = landData.ownerPrims;
updatePacket.ParcelData.ParcelFlags = landData.landFlags;
updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.EstateSettings.objectBonusFactor;
updatePacket.ParcelData.PassHours = landData.passHours;
updatePacket.ParcelData.PassPrice = landData.passPrice;
updatePacket.ParcelData.PublicCount = 0; //unemplemented
uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags;
updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) >
0);
updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) >
0);
updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) >
0);
updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) >
0);
updatePacket.ParcelData.RentPrice = 0;
updatePacket.ParcelData.RequestResult = request_result;
updatePacket.ParcelData.SalePrice = landData.salePrice;
updatePacket.ParcelData.SelectedPrims = landData.selectedPrims;
updatePacket.ParcelData.SelfCount = 0; //unemplemented
updatePacket.ParcelData.SequenceID = sequence_id;
if (landData.simwideArea > 0)
{
updatePacket.ParcelData.SimWideMaxPrims =
Convert.ToInt32(
Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * m_scene.objectCapacity *
Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor)));
}
else
{
updatePacket.ParcelData.SimWideMaxPrims = 0;
}
updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims;
updatePacket.ParcelData.SnapSelection = snap_selection;
updatePacket.ParcelData.SnapshotID = landData.snapshotID;
updatePacket.ParcelData.Status = (byte) landData.landStatus;
updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims +
landData.selectedPrims;
updatePacket.ParcelData.UserLocation = landData.userLocation;
updatePacket.ParcelData.UserLookAt = landData.userLookAt;
remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task);
remote_client.sendLandProperties(remote_client, sequence_id, snap_selection, request_result, landData, m_scene.RegionInfo.EstateSettings.objectBonusFactor, m_scene.objectCapacity);
}
public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
{
if (remote_client.AgentId == landData.ownerID)
{
//Needs later group support
LandData newData = landData.Copy();
newData.authBuyerID = packet.ParcelData.AuthBuyerID;
newData.category = (Parcel.ParcelCategory) packet.ParcelData.Category;
newData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc);
newData.groupID = packet.ParcelData.GroupID;
newData.landingType = packet.ParcelData.LandingType;
newData.mediaAutoScale = packet.ParcelData.MediaAutoScale;
newData.mediaID = packet.ParcelData.MediaID;
newData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL);
newData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL);
newData.landName = Helpers.FieldToUTF8String(packet.ParcelData.Name);
newData.landFlags = packet.ParcelData.ParcelFlags;
newData.passHours = packet.ParcelData.PassHours;
newData.passPrice = packet.ParcelData.PassPrice;
newData.salePrice = packet.ParcelData.SalePrice;
newData.snapshotID = packet.ParcelData.SnapshotID;
newData.userLocation = packet.ParcelData.UserLocation;
newData.userLookAt = packet.ParcelData.UserLookAt;
newData.authBuyerID = args.AuthBuyerID;
newData.category = args.Category;
newData.landDesc = args.Desc;
newData.groupID = args.GroupID;
newData.landingType = args.LandingType;
newData.mediaAutoScale = args.MediaAutoScale;
newData.mediaID = args.MediaID;
newData.mediaURL = args.MediaURL;
newData.musicURL = args.MusicURL;
newData.landName = args.Name;
newData.landFlags = args.ParcelFlags;
newData.passHours = args.PassHours;
newData.passPrice = args.PassPrice;
newData.salePrice = args.SalePrice;
newData.snapshotID = args.SnapshotID;
newData.userLocation = args.UserLocation;
newData.userLookAt = args.UserLookAt;
m_scene.LandChannel.updateLandObject(landData.localID, newData);
@ -351,63 +262,38 @@ namespace OpenSim.Region.Environment.Modules.World.Land
#region AccessList Functions
public ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag)
public List<LLUUID> createAccessListArrayByFlag(ParcelManager.AccessList flag)
{
List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>();
List<LLUUID> list = new List<LLUUID>();
foreach (ParcelManager.ParcelAccessEntry entry in landData.parcelAccessList)
{
if (entry.Flags == flag)
{
ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock();
listBlock.Flags = (uint) 0;
listBlock.ID = entry.AgentID;
listBlock.Time = 0;
list.Add(listBlock);
list.Add(entry.AgentID);
}
}
if (list.Count == 0)
if(list.Count == 0)
{
ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock();
listBlock.Flags = (uint) 0;
listBlock.ID = LLUUID.Zero;
listBlock.Time = 0;
list.Add(listBlock);
list.Add(LLUUID.Zero);
}
return list.ToArray();
return list;
}
public void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID,
IClientAPI remote_client)
{
ParcelAccessListReplyPacket replyPacket;
if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both)
{
replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
replyPacket.Data.AgentID = agentID;
replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access;
replyPacket.Data.LocalID = landData.localID;
replyPacket.Data.SequenceID = 0;
replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access);
remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
List<LLUUID> avatars = createAccessListArrayByFlag(ParcelManager.AccessList.Access);
remote_client.sendLandAccessListData(avatars,(uint) ParcelManager.AccessList.Access,landData.localID);
}
if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both)
{
replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
replyPacket.Data.AgentID = agentID;
replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban;
replyPacket.Data.LocalID = landData.localID;
replyPacket.Data.SequenceID = 0;
replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban);
remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
List<LLUUID> avatars = createAccessListArrayByFlag(ParcelManager.AccessList.Ban);
remote_client.sendLandAccessListData(avatars, (uint)ParcelManager.AccessList.Ban, landData.localID);
}
}
@ -721,43 +607,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
}
}
bool firstCall = true;
int MAX_OBJECTS_PER_PACKET = 251;
ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect);
// TODO: don't create new blocks if recycling an old packet
ForceObjectSelectPacket.DataBlock[] data;
while (resultLocalIDs.Count > 0)
{
if (firstCall)
{
pack._Header.ResetList = true;
firstCall = false;
}
else
{
pack._Header.ResetList = false;
}
if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET)
{
data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET];
}
else
{
data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count];
}
int i;
for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++)
{
data[i] = new ForceObjectSelectPacket.DataBlock();
data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]);
resultLocalIDs.RemoveAt(0);
}
pack.Data = data;
remote_client.OutPacket((Packet) pack, ThrottleOutPacketType.Task);
}
remote_client.sendForceClientSelectObjects(resultLocalIDs);
}
/// <summary>
@ -771,9 +621,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
public void sendLandObjectOwners(IClientAPI remote_client)
{
Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>();
ParcelObjectOwnersReplyPacket pack
= (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply);
// TODO: don't create new blocks if recycling an old packet
foreach (SceneObjectGroup obj in primsOverMe)
{
@ -798,43 +645,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
}
}
int notifyCount = primCount.Count;
if (notifyCount > 0)
{
if (notifyCount > 32)
{
m_log.InfoFormat(
"[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
+ " - a developer might want to investigate whether this is a hard limit", 32);
notifyCount = 32;
}
ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
= new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
int num = 0;
foreach (LLUUID owner in primCount.Keys)
{
dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock();
dataBlock[num].Count = primCount[owner];
dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added
dataBlock[num].OnlineStatus = true; //TODO: fix me later
dataBlock[num].OwnerID = owner;
num++;
if (num >= notifyCount)
{
break;
}
}
pack.Data = dataBlock;
}
remote_client.OutPacket(pack, ThrottleOutPacketType.Task);
remote_client.sendLandObjectOwners(primCount);
}
public Dictionary<LLUUID, int> getLandObjectOwners()

View File

@ -645,5 +645,18 @@ namespace OpenSim.Region.Examples.SimpleModule
public void sendDetailedEstateData(LLUUID invoice)
{
}
public void sendLandProperties(IClientAPI remote_client, int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int simObjectCapacity)
{
}
public void sendLandAccessListData(List<LLUUID> avatars, uint accessFlag, int localLandID)
{
}
public void sendForceClientSelectObjects(List<uint> objectIDs)
{
}
public void sendLandObjectOwners(Dictionary<LLUUID, int> ownersAndCount)
{
}
}
}