diff options
author | Justin Clark-Casey (justincc) | 2010-08-13 22:29:42 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-13 22:29:42 +0100 |
commit | e89f0b3f71dc8bd439fcfc23d12b305369eac36b (patch) | |
tree | e14eda03955229bdc32ebe51d735157dc09f4c90 /OpenSim | |
parent | minor: remove mono compiler warning (diff) | |
download | opensim-SC_OLD-e89f0b3f71dc8bd439fcfc23d12b305369eac36b.zip opensim-SC_OLD-e89f0b3f71dc8bd439fcfc23d12b305369eac36b.tar.gz opensim-SC_OLD-e89f0b3f71dc8bd439fcfc23d12b305369eac36b.tar.bz2 opensim-SC_OLD-e89f0b3f71dc8bd439fcfc23d12b305369eac36b.tar.xz |
refactor: move Scene.PerformObjectBuy into BuySellModule
Diffstat (limited to 'OpenSim')
6 files changed, 222 insertions, 173 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 326eea9..b0ddd8f 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -37,15 +37,17 @@ using OpenSim.Framework; | |||
37 | using OpenSim.Region.Framework; | 37 | using OpenSim.Region.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.World.Objects.BuySell | 42 | namespace OpenSim.Region.CoreModules.World.Objects.BuySell |
42 | { | 43 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")] | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")] |
44 | public class BuySellModule : INonSharedRegionModule | 45 | public class BuySellModule : IBuySellModule, INonSharedRegionModule |
45 | { | 46 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 48 | ||
48 | protected Scene m_scene = null; | 49 | protected Scene m_scene = null; |
50 | protected IDialogModule m_dialogModule; | ||
49 | 51 | ||
50 | public string Name { get { return "Object BuySell Module"; } } | 52 | public string Name { get { return "Object BuySell Module"; } } |
51 | public Type ReplaceableInterface { get { return null; } } | 53 | public Type ReplaceableInterface { get { return null; } } |
@@ -55,6 +57,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
55 | public void AddRegion(Scene scene) | 57 | public void AddRegion(Scene scene) |
56 | { | 58 | { |
57 | m_scene = scene; | 59 | m_scene = scene; |
60 | m_scene.RegisterModuleInterface<IBuySellModule>(this); | ||
58 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 61 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
59 | } | 62 | } |
60 | 63 | ||
@@ -63,7 +66,10 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
63 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | 66 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; |
64 | } | 67 | } |
65 | 68 | ||
66 | public void RegionLoaded(Scene scene) {} | 69 | public void RegionLoaded(Scene scene) |
70 | { | ||
71 | m_dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
72 | } | ||
67 | 73 | ||
68 | public void Close() | 74 | public void Close() |
69 | { | 75 | { |
@@ -93,6 +99,165 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
93 | part.ParentGroup.HasGroupChanged = true; | 99 | part.ParentGroup.HasGroupChanged = true; |
94 | 100 | ||
95 | part.GetProperties(client); | 101 | part.GetProperties(client); |
102 | } | ||
103 | |||
104 | public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) | ||
105 | { | ||
106 | SceneObjectPart part = m_scene.GetSceneObjectPart(localID); | ||
107 | |||
108 | if (part == null) | ||
109 | return false; | ||
110 | |||
111 | if (part.ParentGroup == null) | ||
112 | return false; | ||
113 | |||
114 | SceneObjectGroup group = part.ParentGroup; | ||
115 | |||
116 | switch (saleType) | ||
117 | { | ||
118 | case 1: // Sell as original (in-place sale) | ||
119 | uint effectivePerms = group.GetEffectivePermissions(); | ||
120 | |||
121 | if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) | ||
122 | { | ||
123 | if (m_dialogModule != null) | ||
124 | m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); | ||
125 | return false; | ||
126 | } | ||
127 | |||
128 | group.SetOwnerId(remoteClient.AgentId); | ||
129 | group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId); | ||
130 | |||
131 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | ||
132 | |||
133 | if (m_scene.Permissions.PropagatePermissions()) | ||
134 | { | ||
135 | foreach (SceneObjectPart child in partList) | ||
136 | { | ||
137 | child.Inventory.ChangeInventoryOwner(remoteClient.AgentId); | ||
138 | child.TriggerScriptChangedEvent(Changed.OWNER); | ||
139 | child.ApplyNextOwnerPermissions(); | ||
140 | } | ||
141 | } | ||
142 | |||
143 | part.ObjectSaleType = 0; | ||
144 | part.SalePrice = 10; | ||
145 | |||
146 | group.HasGroupChanged = true; | ||
147 | part.GetProperties(remoteClient); | ||
148 | part.TriggerScriptChangedEvent(Changed.OWNER); | ||
149 | group.ResumeScripts(); | ||
150 | part.ScheduleFullUpdate(); | ||
151 | |||
152 | break; | ||
153 | |||
154 | case 2: // Sell a copy | ||
155 | Vector3 inventoryStoredPosition = new Vector3 | ||
156 | (((group.AbsolutePosition.X > (int)Constants.RegionSize) | ||
157 | ? 250 | ||
158 | : group.AbsolutePosition.X) | ||
159 | , | ||
160 | (group.AbsolutePosition.X > (int)Constants.RegionSize) | ||
161 | ? 250 | ||
162 | : group.AbsolutePosition.X, | ||
163 | group.AbsolutePosition.Z); | ||
164 | |||
165 | Vector3 originalPosition = group.AbsolutePosition; | ||
166 | |||
167 | group.AbsolutePosition = inventoryStoredPosition; | ||
168 | |||
169 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
170 | group.AbsolutePosition = originalPosition; | ||
171 | |||
172 | uint perms = group.GetEffectivePermissions(); | ||
173 | |||
174 | if ((perms & (uint)PermissionMask.Transfer) == 0) | ||
175 | { | ||
176 | if (m_dialogModule != null) | ||
177 | m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); | ||
178 | return false; | ||
179 | } | ||
180 | |||
181 | AssetBase asset = m_scene.CreateAsset( | ||
182 | group.GetPartName(localID), | ||
183 | group.GetPartDescription(localID), | ||
184 | (sbyte)AssetType.Object, | ||
185 | Utils.StringToBytes(sceneObjectXml), | ||
186 | group.OwnerID); | ||
187 | m_scene.AssetService.Store(asset); | ||
188 | |||
189 | InventoryItemBase item = new InventoryItemBase(); | ||
190 | item.CreatorId = part.CreatorID.ToString(); | ||
191 | |||
192 | item.ID = UUID.Random(); | ||
193 | item.Owner = remoteClient.AgentId; | ||
194 | item.AssetID = asset.FullID; | ||
195 | item.Description = asset.Description; | ||
196 | item.Name = asset.Name; | ||
197 | item.AssetType = asset.Type; | ||
198 | item.InvType = (int)InventoryType.Object; | ||
199 | item.Folder = categoryID; | ||
200 | |||
201 | uint nextPerms=(perms & 7) << 13; | ||
202 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
203 | perms &= ~(uint)PermissionMask.Copy; | ||
204 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
205 | perms &= ~(uint)PermissionMask.Transfer; | ||
206 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
207 | perms &= ~(uint)PermissionMask.Modify; | ||
208 | |||
209 | item.BasePermissions = perms & part.NextOwnerMask; | ||
210 | item.CurrentPermissions = perms & part.NextOwnerMask; | ||
211 | item.NextPermissions = part.NextOwnerMask; | ||
212 | item.EveryOnePermissions = part.EveryoneMask & | ||
213 | part.NextOwnerMask; | ||
214 | item.GroupPermissions = part.GroupMask & | ||
215 | part.NextOwnerMask; | ||
216 | item.CurrentPermissions |= 16; // Slam! | ||
217 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
218 | |||
219 | if (m_scene.InventoryService.AddItem(item)) | ||
220 | { | ||
221 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
222 | } | ||
223 | else | ||
224 | { | ||
225 | if (m_dialogModule != null) | ||
226 | m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); | ||
227 | return false; | ||
228 | } | ||
229 | break; | ||
230 | |||
231 | case 3: // Sell contents | ||
232 | List<UUID> invList = part.Inventory.GetInventoryList(); | ||
233 | |||
234 | bool okToSell = true; | ||
235 | |||
236 | foreach (UUID invID in invList) | ||
237 | { | ||
238 | TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID); | ||
239 | if ((item1.CurrentPermissions & | ||
240 | (uint)PermissionMask.Transfer) == 0) | ||
241 | { | ||
242 | okToSell = false; | ||
243 | break; | ||
244 | } | ||
245 | } | ||
246 | |||
247 | if (!okToSell) | ||
248 | { | ||
249 | if (m_dialogModule != null) | ||
250 | m_dialogModule.SendAlertToUser( | ||
251 | remoteClient, "This item's inventory doesn't appear to be for sale"); | ||
252 | return false; | ||
253 | } | ||
254 | |||
255 | if (invList.Count > 0) | ||
256 | m_scene.MoveTaskInventoryItems(remoteClient.AgentId, part.Name, part, invList); | ||
257 | break; | ||
258 | } | ||
259 | |||
260 | return true; | ||
96 | } | 261 | } |
97 | } | 262 | } |
98 | } \ No newline at end of file | 263 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Interfaces/IBuySellModule.cs b/OpenSim/Region/Framework/Interfaces/IBuySellModule.cs new file mode 100644 index 0000000..0132bae --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IBuySellModule.cs | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using OpenSim.Framework; | ||
30 | |||
31 | namespace OpenSim.Region.Framework.Interfaces | ||
32 | { | ||
33 | public interface IBuySellModule | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Try to buy an object | ||
37 | /// </summary> | ||
38 | /// <param name="remoteClient"></param> | ||
39 | /// <param name="categoryID"></param> | ||
40 | /// <param name="localID"></param> | ||
41 | /// <param name="saleType"></param> | ||
42 | /// <returns> | ||
43 | /// True on a successful purchase, false on failure | ||
44 | /// </returns> | ||
45 | bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType); | ||
46 | } | ||
47 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs index f8a5bad..7296ac3 100644 --- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs | |||
@@ -25,7 +25,6 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | |||
29 | namespace OpenSim.Region.Framework.Interfaces | 28 | namespace OpenSim.Region.Framework.Interfaces |
30 | { | 29 | { |
31 | public interface ICloudModule : IRegionModule | 30 | public interface ICloudModule : IRegionModule |
@@ -35,4 +34,4 @@ namespace OpenSim.Region.Framework.Interfaces | |||
35 | /// </summary> | 34 | /// </summary> |
36 | float CloudCover(int x, int y, int z); | 35 | float CloudCover(int x, int y, int z); |
37 | } | 36 | } |
38 | } | 37 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 01edf51..4f5a65e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -670,7 +670,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
670 | /// <summary> | 670 | /// <summary> |
671 | /// Create a new asset data structure. | 671 | /// Create a new asset data structure. |
672 | /// </summary> | 672 | /// </summary> |
673 | private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID) | 673 | public AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID) |
674 | { | 674 | { |
675 | AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID.ToString()); | 675 | AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID.ToString()); |
676 | asset.Description = description; | 676 | asset.Description = description; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b6def14..5f6748e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4486,165 +4486,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4486 | return inv.NeedSceneCacheClear(agentID, this); | 4486 | return inv.NeedSceneCacheClear(agentID, this); |
4487 | } | 4487 | } |
4488 | 4488 | ||
4489 | public bool PerformObjectBuy(IClientAPI remoteClient, UUID categoryID, | ||
4490 | uint localID, byte saleType) | ||
4491 | { | ||
4492 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
4493 | |||
4494 | if (part == null) | ||
4495 | return false; | ||
4496 | |||
4497 | if (part.ParentGroup == null) | ||
4498 | return false; | ||
4499 | |||
4500 | SceneObjectGroup group = part.ParentGroup; | ||
4501 | |||
4502 | switch (saleType) | ||
4503 | { | ||
4504 | case 1: // Sell as original (in-place sale) | ||
4505 | uint effectivePerms=group.GetEffectivePermissions(); | ||
4506 | |||
4507 | if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) | ||
4508 | { | ||
4509 | m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); | ||
4510 | return false; | ||
4511 | } | ||
4512 | |||
4513 | group.SetOwnerId(remoteClient.AgentId); | ||
4514 | group.SetRootPartOwner(part, remoteClient.AgentId, | ||
4515 | remoteClient.ActiveGroupId); | ||
4516 | |||
4517 | List<SceneObjectPart> partList = | ||
4518 | new List<SceneObjectPart>(group.Children.Values); | ||
4519 | |||
4520 | if (Permissions.PropagatePermissions()) | ||
4521 | { | ||
4522 | foreach (SceneObjectPart child in partList) | ||
4523 | { | ||
4524 | child.Inventory.ChangeInventoryOwner(remoteClient.AgentId); | ||
4525 | child.TriggerScriptChangedEvent(Changed.OWNER); | ||
4526 | child.ApplyNextOwnerPermissions(); | ||
4527 | } | ||
4528 | } | ||
4529 | |||
4530 | part.ObjectSaleType = 0; | ||
4531 | part.SalePrice = 10; | ||
4532 | |||
4533 | group.HasGroupChanged = true; | ||
4534 | part.GetProperties(remoteClient); | ||
4535 | part.TriggerScriptChangedEvent(Changed.OWNER); | ||
4536 | group.ResumeScripts(); | ||
4537 | part.ScheduleFullUpdate(); | ||
4538 | |||
4539 | break; | ||
4540 | |||
4541 | case 2: // Sell a copy | ||
4542 | |||
4543 | |||
4544 | Vector3 inventoryStoredPosition = new Vector3 | ||
4545 | (((group.AbsolutePosition.X > (int)Constants.RegionSize) | ||
4546 | ? 250 | ||
4547 | : group.AbsolutePosition.X) | ||
4548 | , | ||
4549 | (group.AbsolutePosition.X > (int)Constants.RegionSize) | ||
4550 | ? 250 | ||
4551 | : group.AbsolutePosition.X, | ||
4552 | group.AbsolutePosition.Z); | ||
4553 | |||
4554 | Vector3 originalPosition = group.AbsolutePosition; | ||
4555 | |||
4556 | group.AbsolutePosition = inventoryStoredPosition; | ||
4557 | |||
4558 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
4559 | group.AbsolutePosition = originalPosition; | ||
4560 | |||
4561 | uint perms=group.GetEffectivePermissions(); | ||
4562 | |||
4563 | if ((perms & (uint)PermissionMask.Transfer) == 0) | ||
4564 | { | ||
4565 | m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); | ||
4566 | return false; | ||
4567 | } | ||
4568 | |||
4569 | AssetBase asset = CreateAsset( | ||
4570 | group.GetPartName(localID), | ||
4571 | group.GetPartDescription(localID), | ||
4572 | (sbyte)AssetType.Object, | ||
4573 | Utils.StringToBytes(sceneObjectXml), | ||
4574 | group.OwnerID); | ||
4575 | AssetService.Store(asset); | ||
4576 | |||
4577 | InventoryItemBase item = new InventoryItemBase(); | ||
4578 | item.CreatorId = part.CreatorID.ToString(); | ||
4579 | |||
4580 | item.ID = UUID.Random(); | ||
4581 | item.Owner = remoteClient.AgentId; | ||
4582 | item.AssetID = asset.FullID; | ||
4583 | item.Description = asset.Description; | ||
4584 | item.Name = asset.Name; | ||
4585 | item.AssetType = asset.Type; | ||
4586 | item.InvType = (int)InventoryType.Object; | ||
4587 | item.Folder = categoryID; | ||
4588 | |||
4589 | uint nextPerms=(perms & 7) << 13; | ||
4590 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
4591 | perms &= ~(uint)PermissionMask.Copy; | ||
4592 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
4593 | perms &= ~(uint)PermissionMask.Transfer; | ||
4594 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
4595 | perms &= ~(uint)PermissionMask.Modify; | ||
4596 | |||
4597 | item.BasePermissions = perms & part.NextOwnerMask; | ||
4598 | item.CurrentPermissions = perms & part.NextOwnerMask; | ||
4599 | item.NextPermissions = part.NextOwnerMask; | ||
4600 | item.EveryOnePermissions = part.EveryoneMask & | ||
4601 | part.NextOwnerMask; | ||
4602 | item.GroupPermissions = part.GroupMask & | ||
4603 | part.NextOwnerMask; | ||
4604 | item.CurrentPermissions |= 16; // Slam! | ||
4605 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
4606 | |||
4607 | if (InventoryService.AddItem(item)) | ||
4608 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
4609 | else | ||
4610 | { | ||
4611 | m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); | ||
4612 | return false; | ||
4613 | } | ||
4614 | break; | ||
4615 | |||
4616 | case 3: // Sell contents | ||
4617 | List<UUID> invList = part.Inventory.GetInventoryList(); | ||
4618 | |||
4619 | bool okToSell = true; | ||
4620 | |||
4621 | foreach (UUID invID in invList) | ||
4622 | { | ||
4623 | TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID); | ||
4624 | if ((item1.CurrentPermissions & | ||
4625 | (uint)PermissionMask.Transfer) == 0) | ||
4626 | { | ||
4627 | okToSell = false; | ||
4628 | break; | ||
4629 | } | ||
4630 | } | ||
4631 | |||
4632 | if (!okToSell) | ||
4633 | { | ||
4634 | m_dialogModule.SendAlertToUser( | ||
4635 | remoteClient, "This item's inventory doesn't appear to be for sale"); | ||
4636 | return false; | ||
4637 | } | ||
4638 | |||
4639 | if (invList.Count > 0) | ||
4640 | MoveTaskInventoryItems(remoteClient.AgentId, part.Name, | ||
4641 | part, invList); | ||
4642 | break; | ||
4643 | } | ||
4644 | |||
4645 | return true; | ||
4646 | } | ||
4647 | |||
4648 | public void CleanTempObjects() | 4489 | public void CleanTempObjects() |
4649 | { | 4490 | { |
4650 | List<EntityBase> objs = GetEntities(); | 4491 | List<EntityBase> objs = GetEntities(); |
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 69ab33d..61cbb90 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | |||
@@ -72,8 +72,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
72 | 72 | ||
73 | private IConfigSource m_gConfig; | 73 | private IConfigSource m_gConfig; |
74 | 74 | ||
75 | |||
76 | |||
77 | /// <summary> | 75 | /// <summary> |
78 | /// Region UUIDS indexed by AgentID | 76 | /// Region UUIDS indexed by AgentID |
79 | /// </summary> | 77 | /// </summary> |
@@ -267,13 +265,11 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
267 | PriceGroupCreate = startupConfig.GetInt("PriceGroupCreate", -1); | 265 | PriceGroupCreate = startupConfig.GetInt("PriceGroupCreate", -1); |
268 | m_sellEnabled = startupConfig.GetBoolean("SellEnabled", false); | 266 | m_sellEnabled = startupConfig.GetBoolean("SellEnabled", false); |
269 | } | 267 | } |
270 | |||
271 | } | 268 | } |
272 | 269 | ||
273 | private void GetClientFunds(IClientAPI client) | 270 | private void GetClientFunds(IClientAPI client) |
274 | { | 271 | { |
275 | CheckExistAndRefreshFunds(client.AgentId); | 272 | CheckExistAndRefreshFunds(client.AgentId); |
276 | |||
277 | } | 273 | } |
278 | 274 | ||
279 | /// <summary> | 275 | /// <summary> |
@@ -815,7 +811,10 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
815 | remoteClient.SendAgentAlertMessage("Unable to buy now. The object was not found.", false); | 811 | remoteClient.SendAgentAlertMessage("Unable to buy now. The object was not found.", false); |
816 | return; | 812 | return; |
817 | } | 813 | } |
818 | s.PerformObjectBuy(remoteClient, categoryID, localID, saleType); | 814 | |
815 | IBuySellModule module = s.RequestModuleInterface<IBuySellModule>(); | ||
816 | if (module != null) | ||
817 | module.BuyObject(remoteClient, categoryID, localID, saleType); | ||
819 | } | 818 | } |
820 | } | 819 | } |
821 | 820 | ||
@@ -825,7 +824,5 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
825 | RegionMoneyRequest = 1, | 824 | RegionMoneyRequest = 1, |
826 | Gift = 2, | 825 | Gift = 2, |
827 | Purchase = 3 | 826 | Purchase = 3 |
828 | } | 827 | } |
829 | 828 | } \ No newline at end of file | |
830 | |||
831 | } | ||