aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorMelanie2010-08-18 00:59:20 +0100
committerMelanie2010-08-18 00:59:20 +0100
commite74809ff4c7fd67ceb5336e5d8e7811591f6cce3 (patch)
tree3e878fb80be75106631d76a12b8da9e65e98f7b9 /OpenSim/Region/CoreModules/World
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
parent* Changed a few OSD.FromBinary() calls to the more accurate OSD.FromULong() t... (diff)
downloadopensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.zip
opensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.tar.gz
opensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.tar.bz2
opensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs263
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs17
6 files changed, 301 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 27e492b..171e0b9 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -345,7 +345,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
345 { 345 {
346 if (!s.IsChildAgent) 346 if (!s.IsChildAgent)
347 { 347 {
348 s.ControllingClient.SendTeleportLocationStart();
349 m_scene.TeleportClientHome(user, s.ControllingClient); 348 m_scene.TeleportClientHome(user, s.ControllingClient);
350 } 349 }
351 } 350 }
@@ -480,7 +479,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
480 ScenePresence s = m_scene.GetScenePresence(prey); 479 ScenePresence s = m_scene.GetScenePresence(prey);
481 if (s != null) 480 if (s != null)
482 { 481 {
483 s.ControllingClient.SendTeleportLocationStart();
484 m_scene.TeleportClientHome(prey, s.ControllingClient); 482 m_scene.TeleportClientHome(prey, s.ControllingClient);
485 } 483 }
486 } 484 }
@@ -500,7 +498,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
500 // Also make sure they are actually in the region 498 // Also make sure they are actually in the region
501 if (p != null && !p.IsChildAgent) 499 if (p != null && !p.IsChildAgent)
502 { 500 {
503 p.ControllingClient.SendTeleportLocationStart();
504 m_scene.TeleportClientHome(p.UUID, p.ControllingClient); 501 m_scene.TeleportClientHome(p.UUID, p.ControllingClient);
505 } 502 }
506 } 503 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 7e29a56..d00cb07 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -147,12 +147,12 @@ namespace OpenSim.Region.CoreModules.World.Land
147 { 147 {
148 } 148 }
149 149
150 private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) 150// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
151 { 151// {
152 ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); 152// ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y);
153 reason = "You are not allowed to enter this sim."; 153// reason = "You are not allowed to enter this sim.";
154 return nearestParcel != null; 154// return nearestParcel != null;
155 } 155// }
156 156
157 void EventManagerOnNewClient(IClientAPI client) 157 void EventManagerOnNewClient(IClientAPI client)
158 { 158 {
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
new file mode 100644
index 0000000..62abd4c
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -0,0 +1,263 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using OpenMetaverse;
35using OpenMetaverse.Packets;
36using OpenSim.Framework;
37using OpenSim.Region.Framework;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Scenes.Serialization;
41
42namespace OpenSim.Region.CoreModules.World.Objects.BuySell
43{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")]
45 public class BuySellModule : IBuySellModule, INonSharedRegionModule
46 {
47// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 protected Scene m_scene = null;
50 protected IDialogModule m_dialogModule;
51
52 public string Name { get { return "Object BuySell Module"; } }
53 public Type ReplaceableInterface { get { return null; } }
54
55 public void Initialise(IConfigSource source) {}
56
57 public void AddRegion(Scene scene)
58 {
59 m_scene = scene;
60 m_scene.RegisterModuleInterface<IBuySellModule>(this);
61 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
62 }
63
64 public void RemoveRegion(Scene scene)
65 {
66 m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
67 }
68
69 public void RegionLoaded(Scene scene)
70 {
71 m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
72 }
73
74 public void Close()
75 {
76 RemoveRegion(m_scene);
77 }
78
79 public void SubscribeToClientEvents(IClientAPI client)
80 {
81 client.OnObjectSaleInfo += ObjectSaleInfo;
82 }
83
84 protected void ObjectSaleInfo(
85 IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice)
86 {
87 SceneObjectPart part = m_scene.GetSceneObjectPart(localID);
88 if (part == null || part.ParentGroup == null)
89 return;
90
91 if (part.ParentGroup.IsDeleted)
92 return;
93
94 part = part.ParentGroup.RootPart;
95
96 part.ObjectSaleType = saleType;
97 part.SalePrice = salePrice;
98
99 part.ParentGroup.HasGroupChanged = true;
100
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;
261 }
262 }
263} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 2817477..d4166d0 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -588,8 +588,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
588 client.OnModifyTerrain += client_OnModifyTerrain; 588 client.OnModifyTerrain += client_OnModifyTerrain;
589 client.OnBakeTerrain += client_OnBakeTerrain; 589 client.OnBakeTerrain += client_OnBakeTerrain;
590 client.OnLandUndo += client_OnLandUndo; 590 client.OnLandUndo += client_OnLandUndo;
591 client.OnUnackedTerrain += client_OnUnackedTerrain;
591 } 592 }
592 593
593 /// <summary> 594 /// <summary>
594 /// Checks to see if the terrain has been modified since last check 595 /// Checks to see if the terrain has been modified since last check
595 /// but won't attempt to limit those changes to the limits specified in the estate settings 596 /// but won't attempt to limit those changes to the limits specified in the estate settings
@@ -810,6 +811,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
810 InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter 811 InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter
811 } 812 }
812 } 813 }
814
815 protected void client_OnUnackedTerrain(IClientAPI client, int patchX, int patchY)
816 {
817 //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
818 client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised());
819 }
813 820
814 private void StoreUndoState() 821 private void StoreUndoState()
815 { 822 {
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index a1a4f9e..9f88517 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -138,14 +138,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
138 remoteClient.SendMapBlock(blocks, 2); 138 remoteClient.SendMapBlock(blocks, 2);
139 } 139 }
140 140
141 private Scene GetClientScene(IClientAPI client) 141// private Scene GetClientScene(IClientAPI client)
142 { 142// {
143 foreach (Scene s in m_scenes) 143// foreach (Scene s in m_scenes)
144 { 144// {
145 if (client.Scene.RegionInfo.RegionHandle == s.RegionInfo.RegionHandle) 145// if (client.Scene.RegionInfo.RegionHandle == s.RegionInfo.RegionHandle)
146 return s; 146// return s;
147 } 147// }
148 return m_scene; 148// return m_scene;
149 } 149// }
150 } 150 }
151} 151}
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 9d9967a..f036d85 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -1000,11 +1000,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1000 return responsemap; 1000 return responsemap;
1001 } 1001 }
1002 1002
1003 public void RegenerateMaptile(byte[] data) 1003 public void GenerateMaptile()
1004 { 1004 {
1005 // Cannot create a map for a nonexistant heightmap
1006 if (m_scene.Heightmap == null)
1007 return;
1008
1009 //create a texture asset of the terrain
1010 IMapImageGenerator terrain = m_scene.RequestModuleInterface<IMapImageGenerator>();
1011 if (terrain == null)
1012 return;
1013
1014 byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png");
1015 if (data == null)
1016 return;
1017
1005 UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; 1018 UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
1006 1019
1007 m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE"); 1020 m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE");
1008 1021
1009 m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random(); 1022 m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random();
1010 1023