aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-24 07:16:47 +0000
committerMelanie Thielker2008-08-24 07:16:47 +0000
commitd5b48ecbe145bee3b40797f19e770530c47a2f14 (patch)
tree80ec2a279cef4ec912c29a05195d15bea8ad97cd /OpenSim/Region/Environment/Scenes
parentSelling an object in-place (as original) now works. Builders can (diff)
downloadopensim-SC_OLD-d5b48ecbe145bee3b40797f19e770530c47a2f14.zip
opensim-SC_OLD-d5b48ecbe145bee3b40797f19e770530c47a2f14.tar.gz
opensim-SC_OLD-d5b48ecbe145bee3b40797f19e770530c47a2f14.tar.bz2
opensim-SC_OLD-d5b48ecbe145bee3b40797f19e770530c47a2f14.tar.xz
Selling a copy of a prim (prim vendor) now works.
Sack of bolts to go with the nuts?
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs65
1 files changed, 58 insertions, 7 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 01a0fc8..0052dd3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -3953,18 +3953,20 @@ namespace OpenSim.Region.Environment.Scenes
3953 if(part == null) 3953 if(part == null)
3954 return; 3954 return;
3955 3955
3956 if(part.ParentGroup == null)
3957 return;
3958
3959 SceneObjectGroup group = part.ParentGroup;
3960
3956 switch (saleType) 3961 switch (saleType)
3957 { 3962 {
3958 case 1: // Sell as original (in-place sale) 3963 case 1: // Sell as original (in-place sale)
3959 if(part.ParentGroup == null) 3964 group.SetOwnerId(remoteClient.AgentId);
3960 return; 3965 group.SetRootPartOwner(part, remoteClient.AgentId,
3961
3962 part.ParentGroup.SetOwnerId(remoteClient.AgentId);
3963 part.ParentGroup.SetRootPartOwner(part, remoteClient.AgentId,
3964 remoteClient.ActiveGroupId); 3966 remoteClient.ActiveGroupId);
3965 3967
3966 List<SceneObjectPart> partList = 3968 List<SceneObjectPart> partList =
3967 new List<SceneObjectPart>(part.ParentGroup.Children.Values); 3969 new List<SceneObjectPart>(group.Children.Values);
3968 3970
3969 if (ExternalChecks.ExternalChecksPropagatePermissions()) 3971 if (ExternalChecks.ExternalChecksPropagatePermissions())
3970 { 3972 {
@@ -3980,11 +3982,60 @@ namespace OpenSim.Region.Environment.Scenes
3980 part.ObjectSaleType = 0; 3982 part.ObjectSaleType = 0;
3981 part.SalePrice = 10; 3983 part.SalePrice = 10;
3982 3984
3983 part.ParentGroup.HasGroupChanged = true; 3985 group.HasGroupChanged = true;
3984 part.GetProperties(remoteClient); 3986 part.GetProperties(remoteClient);
3985 part.ScheduleFullUpdate(); 3987 part.ScheduleFullUpdate();
3986 3988
3987 break; 3989 break;
3990
3991 case 2: // Sell a copy
3992 string sceneObjectXml = group.ToXmlString();
3993
3994 CachedUserInfo userInfo =
3995 CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
3996
3997 if (userInfo != null)
3998 {
3999 AssetBase asset = CreateAsset(
4000 group.GetPartName(localID),
4001 group.GetPartDescription(localID),
4002 (sbyte)AssetType.Object,
4003 Helpers.StringToField(sceneObjectXml));
4004 AssetCache.AddAsset(asset);
4005
4006 InventoryItemBase item = new InventoryItemBase();
4007 item.Creator = part.CreatorID;
4008
4009 item.ID = LLUUID.Random();
4010 item.Owner = remoteClient.AgentId;
4011 item.AssetID = asset.FullID;
4012 item.Description = asset.Description;
4013 item.Name = asset.Name;
4014 item.AssetType = asset.Type;
4015 item.InvType = (int)InventoryType.Object;
4016 item.Folder = categoryID;
4017
4018 uint perms=group.GetEffectivePermissions();
4019 uint nextPerms=(perms & 7) << 13;
4020 if ((nextPerms & (uint)PermissionMask.Copy) == 0)
4021 perms &= ~(uint)PermissionMask.Copy;
4022 if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
4023 perms &= ~(uint)PermissionMask.Transfer;
4024 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
4025 perms &= ~(uint)PermissionMask.Modify;
4026
4027 item.BasePermissions = perms & part.NextOwnerMask;
4028 item.CurrentPermissions = perms & part.NextOwnerMask;
4029 item.NextPermissions = part.NextOwnerMask;
4030 item.EveryOnePermissions = part.EveryoneMask &
4031 part.NextOwnerMask;
4032 item.CurrentPermissions |= 8; // Slam!
4033 item.CreationDate = Util.UnixTimeSinceEpoch();
4034
4035 userInfo.AddItem(item);
4036 remoteClient.SendInventoryItemCreateUpdate(item);
4037 }
4038 break;
3988 } 4039 }
3989 } 4040 }
3990 } 4041 }