BuySell: a few changes on sell copy

0.9.1.0-post-fixes
UbitUmarov 2018-11-12 22:54:37 +00:00
parent 7fcb3fdf11
commit d31854ee3c
1 changed files with 26 additions and 24 deletions

View File

@ -112,17 +112,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType, int salePrice) public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType, int salePrice)
{ {
SceneObjectPart part = m_scene.GetSceneObjectPart(localID); SceneObjectPart rootpart = m_scene.GetSceneObjectPart(localID);
if (part == null) if (rootpart == null)
return false; return false;
SceneObjectGroup group = part.ParentGroup; SceneObjectGroup group = rootpart.ParentGroup;
if(group == null || group.IsDeleted || group.inTransit) if(group == null || group.IsDeleted || group.inTransit)
return false; return false;
// make sure we are not buying a child part // make sure we are not buying a child part
part = group.RootPart; rootpart = group.RootPart;
switch (saleType) switch (saleType)
{ {
@ -149,15 +149,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
group.InvalidateDeepEffectivePerms(); group.InvalidateDeepEffectivePerms();
} }
part.ObjectSaleType = 0; rootpart.ObjectSaleType = 0;
part.SalePrice = 10; rootpart.SalePrice = 10;
part.ClickAction = Convert.ToByte(0); rootpart.ClickAction = Convert.ToByte(0);
group.HasGroupChanged = true; group.HasGroupChanged = true;
part.SendPropertiesToClient(remoteClient); rootpart.SendPropertiesToClient(remoteClient);
part.TriggerScriptChangedEvent(Changed.OWNER); rootpart.TriggerScriptChangedEvent(Changed.OWNER);
group.ResumeScripts(); group.ResumeScripts();
part.ScheduleFullUpdate(); rootpart.ScheduleFullUpdate();
break; break;
@ -180,23 +180,25 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
string name = rootpart.Name;
string desc = rootpart.Description;
AssetBase asset = m_scene.CreateAsset( AssetBase asset = m_scene.CreateAsset(
group.GetPartName(localID), name, desc,
group.GetPartDescription(localID),
(sbyte)AssetType.Object, (sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml), Utils.StringToBytes(sceneObjectXml),
group.OwnerID); rootpart.CreatorID);
m_scene.AssetService.Store(asset); m_scene.AssetService.Store(asset);
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.CreatorId = part.CreatorID.ToString(); item.CreatorId = rootpart.CreatorID.ToString();
item.CreatorData = part.CreatorData; item.CreatorData = rootpart.CreatorData;
item.ID = UUID.Random(); item.ID = UUID.Random();
item.Owner = remoteClient.AgentId; item.Owner = remoteClient.AgentId;
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
item.Description = asset.Description; item.Description = desc;
item.Name = asset.Name; item.Name = name;
item.AssetType = asset.Type; item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = categoryID; item.Folder = categoryID;
@ -205,15 +207,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
// apply parts inventory next perms // apply parts inventory next perms
PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms); PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms);
// change to next owner perms // change to next owner perms
perms &= part.NextOwnerMask; perms &= rootpart.NextOwnerMask;
// update folded // update folded
perms = PermissionsUtil.FixAndFoldPermissions(perms); perms = PermissionsUtil.FixAndFoldPermissions(perms);
item.BasePermissions = perms; item.BasePermissions = perms;
item.CurrentPermissions = perms; item.CurrentPermissions = perms;
item.NextPermissions = part.NextOwnerMask & perms; item.NextPermissions = rootpart.NextOwnerMask & perms;
item.EveryOnePermissions = part.EveryoneMask & perms; item.EveryOnePermissions = rootpart.EveryoneMask & perms;
item.GroupPermissions = part.GroupMask & perms; item.GroupPermissions = rootpart.GroupMask & perms;
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();
@ -231,13 +233,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
break; break;
case 3: // Sell contents case 3: // Sell contents
List<UUID> invList = part.Inventory.GetInventoryList(); List<UUID> invList = rootpart.Inventory.GetInventoryList();
bool okToSell = true; bool okToSell = true;
foreach (UUID invID in invList) foreach (UUID invID in invList)
{ {
TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID); TaskInventoryItem item1 = rootpart.Inventory.GetInventoryItem(invID);
if ((item1.CurrentPermissions & if ((item1.CurrentPermissions &
(uint)PermissionMask.Transfer) == 0) (uint)PermissionMask.Transfer) == 0)
{ {
@ -255,7 +257,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
} }
if (invList.Count > 0) if (invList.Count > 0)
m_scene.MoveTaskInventoryItems(remoteClient.AgentId, part.Name, part, invList); m_scene.MoveTaskInventoryItems(remoteClient.AgentId, rootpart.Name, rootpart, invList);
break; break;
} }