From 07cb1d4f0e9acfaba22b9b8ef1611613ab827a1a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 24 Aug 2008 06:39:54 +0000 Subject: [PATCH] Selling an object in-place (as original) now works. Builders can now ply their trade. Is that nuts? --- OpenSim/Data/MySQL/MySQLRegionData.cs | 16 +++++++- .../Region/Environment/Scenes/InnerScene.cs | 5 +++ .../Environment/Scenes/Scene.Inventory.cs | 4 ++ OpenSim/Region/Environment/Scenes/Scene.cs | 38 +++++++++++++++++++ 4 files changed, 61 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index c0ebbc6eab..f6b49af229 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -1554,6 +1554,11 @@ namespace OpenSim.Data.MySQL row["LoopedSound"] = prim.Sound.ToString(); row["LoopedSoundGain"] = prim.SoundGain; } + else + { + row["LoopedSound"] = LLUUID.Zero; + row["LoopedSoundGain"] = 0.0f; + } row["TextureAnimation"] = prim.TextureAnimation; @@ -1562,22 +1567,29 @@ namespace OpenSim.Data.MySQL row["OmegaZ"] = prim.RotationalVelocity.Z; row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X; - row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().Y; + row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y; row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z; row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X; - row["CameraAtOffsetX"] = prim.GetCameraAtOffset().Y; + row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y; row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z; if (prim.GetForceMouselook()) row["ForceMouselook"] = 1; + else + row["ForceMouselook"] = 0; row["ScriptAccessPin"] = prim.ScriptAccessPin; if (prim.AllowedDrop) row["AllowedDrop"] = 1; + else + row["AllowedDrop"] = 0; + if (prim.DIE_AT_EDGE) row["DieAtEdge"] = 1; + else + row["DieAtEdge"] = 0; row["SalePrice"] = prim.SalePrice; row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType); diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index b98f2d68cc..3fa1825d48 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -1312,6 +1312,11 @@ namespace OpenSim.Region.Environment.Scenes { if (((SceneObjectGroup)ent).LocalId == childPrims[i]) { + // Make sure no child prim is set for sale + // So that, on delink, no prims are unwittingly + // left for sale and sold off + ((SceneObjectGroup)ent).RootPart.ObjectSaleType = 0; + ((SceneObjectGroup)ent).RootPart.SalePrice = 10; children.Add((SceneObjectGroup)ent); } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 83824679d3..ffb8501778 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -1985,6 +1985,10 @@ namespace OpenSim.Region.Environment.Scenes if (rootPart.OwnerID != item.Owner) { + //Need to kill the for sale here + rootPart.ObjectSaleType = 0; + rootPart.SalePrice = 10; + if (ExternalChecks.ExternalChecksPropagatePermissions()) { if ((item.CurrentPermissions & 8) != 0) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 36471e9d4c..01a0fc8a93 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -3948,6 +3948,44 @@ namespace OpenSim.Region.Environment.Scenes public void PerformObjectBuy(IClientAPI remoteClient, LLUUID categoryID, uint localID, byte saleType) { + SceneObjectPart part = GetSceneObjectPart(localID); + + if(part == null) + return; + + switch (saleType) + { + case 1: // Sell as original (in-place sale) + if(part.ParentGroup == null) + return; + + part.ParentGroup.SetOwnerId(remoteClient.AgentId); + part.ParentGroup.SetRootPartOwner(part, remoteClient.AgentId, + remoteClient.ActiveGroupId); + + List partList = + new List(part.ParentGroup.Children.Values); + + if (ExternalChecks.ExternalChecksPropagatePermissions()) + { + foreach (SceneObjectPart child in partList) + { + child.OwnerMask &= child.NextOwnerMask; + child.GroupMask &= child.NextOwnerMask; + child.EveryoneMask &= child.NextOwnerMask; + child.BaseMask &= child.NextOwnerMask; + } + } + + part.ObjectSaleType = 0; + part.SalePrice = 10; + + part.ParentGroup.HasGroupChanged = true; + part.GetProperties(remoteClient); + part.ScheduleFullUpdate(); + + break; + } } } }