aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs49
1 files changed, 45 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index da6da1e..9328501 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -4089,22 +4089,30 @@ namespace OpenSim.Region.Environment.Scenes
4089 part.GetProperties(client); 4089 part.GetProperties(client);
4090 } 4090 }
4091 4091
4092 public void PerformObjectBuy(IClientAPI remoteClient, UUID categoryID, 4092 public bool PerformObjectBuy(IClientAPI remoteClient, UUID categoryID,
4093 uint localID, byte saleType) 4093 uint localID, byte saleType)
4094 { 4094 {
4095 SceneObjectPart part = GetSceneObjectPart(localID); 4095 SceneObjectPart part = GetSceneObjectPart(localID);
4096 4096
4097 if (part == null) 4097 if (part == null)
4098 return; 4098 return false;
4099 4099
4100 if (part.ParentGroup == null) 4100 if (part.ParentGroup == null)
4101 return; 4101 return false;
4102 4102
4103 SceneObjectGroup group = part.ParentGroup; 4103 SceneObjectGroup group = part.ParentGroup;
4104 4104
4105 switch (saleType) 4105 switch (saleType)
4106 { 4106 {
4107 case 1: // Sell as original (in-place sale) 4107 case 1: // Sell as original (in-place sale)
4108 uint effectivePerms=group.GetEffectivePermissions();
4109
4110 if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
4111 {
4112 remoteClient.SendAgentAlertMessage("This item doesn't appear to be for sale", false);
4113 return false;
4114 }
4115
4108 group.SetOwnerId(remoteClient.AgentId); 4116 group.SetOwnerId(remoteClient.AgentId);
4109 group.SetRootPartOwner(part, remoteClient.AgentId, 4117 group.SetRootPartOwner(part, remoteClient.AgentId,
4110 remoteClient.ActiveGroupId); 4118 remoteClient.ActiveGroupId);
@@ -4138,6 +4146,14 @@ namespace OpenSim.Region.Environment.Scenes
4138 4146
4139 if (userInfo != null) 4147 if (userInfo != null)
4140 { 4148 {
4149 uint perms=group.GetEffectivePermissions();
4150
4151 if ((perms & (uint)PermissionMask.Transfer) == 0)
4152 {
4153 remoteClient.SendAgentAlertMessage("This item doesn't appear to be for sale", false);
4154 return false;
4155 }
4156
4141 AssetBase asset = CreateAsset( 4157 AssetBase asset = CreateAsset(
4142 group.GetPartName(localID), 4158 group.GetPartName(localID),
4143 group.GetPartDescription(localID), 4159 group.GetPartDescription(localID),
@@ -4157,7 +4173,6 @@ namespace OpenSim.Region.Environment.Scenes
4157 item.InvType = (int)InventoryType.Object; 4173 item.InvType = (int)InventoryType.Object;
4158 item.Folder = categoryID; 4174 item.Folder = categoryID;
4159 4175
4160 uint perms=group.GetEffectivePermissions();
4161 uint nextPerms=(perms & 7) << 13; 4176 uint nextPerms=(perms & 7) << 13;
4162 if ((nextPerms & (uint)PermissionMask.Copy) == 0) 4177 if ((nextPerms & (uint)PermissionMask.Copy) == 0)
4163 perms &= ~(uint)PermissionMask.Copy; 4178 perms &= ~(uint)PermissionMask.Copy;
@@ -4177,16 +4192,42 @@ namespace OpenSim.Region.Environment.Scenes
4177 userInfo.AddItem(item); 4192 userInfo.AddItem(item);
4178 remoteClient.SendInventoryItemCreateUpdate(item); 4193 remoteClient.SendInventoryItemCreateUpdate(item);
4179 } 4194 }
4195 else
4196 {
4197 remoteClient.SendAgentAlertMessage("Cannot buy now. Your inventory is unavailable", false);
4198 return false;
4199 }
4180 break; 4200 break;
4181 4201
4182 case 3: // Sell contents 4202 case 3: // Sell contents
4183 List<UUID> invList = part.GetInventoryList(); 4203 List<UUID> invList = part.GetInventoryList();
4184 4204
4205 bool okToSell = true;
4206
4207 foreach (UUID invID in invList)
4208 {
4209 TaskInventoryItem item = part.GetInventoryItem(invID);
4210 if ((item.CurrentPermissions &
4211 (uint)PermissionMask.Transfer) == 0)
4212 {
4213 okToSell = false;
4214 break;
4215 }
4216 }
4217
4218 if (!okToSell)
4219 {
4220 remoteClient.SendAgentAlertMessage("This item's inventory doesn't appear to be for sale", false);
4221 return false;
4222 }
4223
4185 if (invList.Count > 0) 4224 if (invList.Count > 0)
4186 MoveTaskInventoryItems(remoteClient.AgentId, part.Name, 4225 MoveTaskInventoryItems(remoteClient.AgentId, part.Name,
4187 part, invList); 4226 part, invList);
4188 break; 4227 break;
4189 } 4228 }
4229
4230 return true;
4190 } 4231 }
4191 4232
4192 public void CleanTempObjects() 4233 public void CleanTempObjects()