Selling a copy of a prim (prim vendor) now works.

Sack of bolts to go with the nuts?
0.6.0-stable
Melanie Thielker 2008-08-24 07:16:47 +00:00
parent 07cb1d4f0e
commit d5b48ecbe1
1 changed files with 58 additions and 7 deletions

View File

@ -3953,18 +3953,20 @@ namespace OpenSim.Region.Environment.Scenes
if(part == null) if(part == null)
return; return;
if(part.ParentGroup == null)
return;
SceneObjectGroup group = part.ParentGroup;
switch (saleType) switch (saleType)
{ {
case 1: // Sell as original (in-place sale) case 1: // Sell as original (in-place sale)
if(part.ParentGroup == null) group.SetOwnerId(remoteClient.AgentId);
return; group.SetRootPartOwner(part, remoteClient.AgentId,
part.ParentGroup.SetOwnerId(remoteClient.AgentId);
part.ParentGroup.SetRootPartOwner(part, remoteClient.AgentId,
remoteClient.ActiveGroupId); remoteClient.ActiveGroupId);
List<SceneObjectPart> partList = List<SceneObjectPart> partList =
new List<SceneObjectPart>(part.ParentGroup.Children.Values); new List<SceneObjectPart>(group.Children.Values);
if (ExternalChecks.ExternalChecksPropagatePermissions()) if (ExternalChecks.ExternalChecksPropagatePermissions())
{ {
@ -3980,11 +3982,60 @@ namespace OpenSim.Region.Environment.Scenes
part.ObjectSaleType = 0; part.ObjectSaleType = 0;
part.SalePrice = 10; part.SalePrice = 10;
part.ParentGroup.HasGroupChanged = true; group.HasGroupChanged = true;
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
part.ScheduleFullUpdate(); part.ScheduleFullUpdate();
break; break;
case 2: // Sell a copy
string sceneObjectXml = group.ToXmlString();
CachedUserInfo userInfo =
CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
AssetBase asset = CreateAsset(
group.GetPartName(localID),
group.GetPartDescription(localID),
(sbyte)AssetType.Object,
Helpers.StringToField(sceneObjectXml));
AssetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase();
item.Creator = part.CreatorID;
item.ID = LLUUID.Random();
item.Owner = remoteClient.AgentId;
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object;
item.Folder = categoryID;
uint perms=group.GetEffectivePermissions();
uint nextPerms=(perms & 7) << 13;
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
perms &= ~(uint)PermissionMask.Copy;
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
perms &= ~(uint)PermissionMask.Transfer;
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
perms &= ~(uint)PermissionMask.Modify;
item.BasePermissions = perms & part.NextOwnerMask;
item.CurrentPermissions = perms & part.NextOwnerMask;
item.NextPermissions = part.NextOwnerMask;
item.EveryOnePermissions = part.EveryoneMask &
part.NextOwnerMask;
item.CurrentPermissions |= 8; // Slam!
item.CreationDate = Util.UnixTimeSinceEpoch();
userInfo.AddItem(item);
remoteClient.SendInventoryItemCreateUpdate(item);
}
break;
} }
} }
} }