diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
9 files changed, 505 insertions, 51 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 6d16c52..f63089d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Xml; | ||
31 | using log4net; | 32 | using log4net; |
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
@@ -36,6 +37,7 @@ using OpenSim.Framework; | |||
36 | using OpenSim.Region.Framework; | 37 | using OpenSim.Region.Framework; |
37 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
39 | 41 | ||
40 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 42 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
41 | { | 43 | { |
@@ -198,8 +200,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
198 | 200 | ||
199 | public UUID RezSingleAttachmentFromInventory( | 201 | public UUID RezSingleAttachmentFromInventory( |
200 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | 202 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) |
203 | { | ||
204 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); | ||
205 | } | ||
206 | |||
207 | public UUID RezSingleAttachmentFromInventory( | ||
208 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | ||
201 | { | 209 | { |
202 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | 210 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); |
203 | 211 | ||
204 | if (updateInventoryStatus) | 212 | if (updateInventoryStatus) |
205 | { | 213 | { |
@@ -218,7 +226,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
218 | } | 226 | } |
219 | 227 | ||
220 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 228 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
221 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 229 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) |
222 | { | 230 | { |
223 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 231 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
224 | if (invAccess != null) | 232 | if (invAccess != null) |
@@ -244,13 +252,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
244 | if (tainted) | 252 | if (tainted) |
245 | objatt.HasGroupChanged = true; | 253 | objatt.HasGroupChanged = true; |
246 | 254 | ||
255 | if (doc != null) | ||
256 | { | ||
257 | objatt.LoadScriptState(doc); | ||
258 | objatt.ResetOwnerChangeFlag(); | ||
259 | } | ||
260 | |||
247 | // Fire after attach, so we don't get messy perms dialogs | 261 | // Fire after attach, so we don't get messy perms dialogs |
248 | // 3 == AttachedRez | 262 | // 3 == AttachedRez |
249 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); | 263 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); |
250 | objatt.ResumeScripts(); | 264 | objatt.ResumeScripts(); |
251 | 265 | ||
252 | // Do this last so that event listeners have access to all the effects of the attachment | 266 | // Do this last so that event listeners have access to all the effects of the attachment |
253 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | 267 | //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); |
254 | } | 268 | } |
255 | else | 269 | else |
256 | { | 270 | { |
@@ -279,7 +293,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
279 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 293 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
280 | { | 294 | { |
281 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 295 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
282 | item = m_scene.InventoryService.GetItem(item); | 296 | if (m_scene.InventoryService != null) |
297 | item = m_scene.InventoryService.GetItem(item); | ||
283 | 298 | ||
284 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 299 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); |
285 | } | 300 | } |
@@ -324,6 +339,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
324 | { | 339 | { |
325 | // XXYY!! | 340 | // XXYY!! |
326 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 341 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
342 | if (item == null) | ||
343 | m_log.Error("[ATTACHMENT]: item == null"); | ||
344 | if (m_scene == null) | ||
345 | m_log.Error("[ATTACHMENT]: m_scene == null"); | ||
346 | if (m_scene.InventoryService == null) | ||
347 | m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); | ||
327 | item = m_scene.InventoryService.GetItem(item); | 348 | item = m_scene.InventoryService.GetItem(item); |
328 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | 349 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); |
329 | 350 | ||
@@ -412,6 +433,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
412 | if (group.GetFromItemID() == itemID) | 433 | if (group.GetFromItemID() == itemID) |
413 | { | 434 | { |
414 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 435 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
436 | // CM / XMREngine!!!! Needed to conclude attach event | ||
437 | SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
415 | group.DetachToInventoryPrep(); | 438 | group.DetachToInventoryPrep(); |
416 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 439 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
417 | m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); | 440 | m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 02f0968..9c8cbc6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -49,7 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
49 | private int m_shoutdistance = 100; | 49 | private int m_shoutdistance = 100; |
50 | private int m_whisperdistance = 10; | 50 | private int m_whisperdistance = 10; |
51 | private List<Scene> m_scenes = new List<Scene>(); | 51 | private List<Scene> m_scenes = new List<Scene>(); |
52 | 52 | private List<string> FreezeCache = new List<string>(); | |
53 | private string m_adminPrefix = ""; | ||
53 | internal object m_syncy = new object(); | 54 | internal object m_syncy = new object(); |
54 | 55 | ||
55 | internal IConfig m_config; | 56 | internal IConfig m_config; |
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
76 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 77 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); |
77 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 78 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); |
78 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 79 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); |
80 | m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", ""); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | public virtual void AddRegion(Scene scene) | 83 | public virtual void AddRegion(Scene scene) |
@@ -171,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
171 | return; | 173 | return; |
172 | } | 174 | } |
173 | 175 | ||
174 | DeliverChatToAvatars(ChatSourceType.Agent, c); | 176 | if (FreezeCache.Contains(c.Sender.AgentId.ToString())) |
177 | { | ||
178 | if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping) | ||
179 | c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false); | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | DeliverChatToAvatars(ChatSourceType.Agent, c); | ||
184 | } | ||
175 | } | 185 | } |
176 | 186 | ||
177 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) | 187 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) |
@@ -185,6 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
185 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) | 195 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) |
186 | { | 196 | { |
187 | string fromName = c.From; | 197 | string fromName = c.From; |
198 | string fromNamePrefix = ""; | ||
188 | UUID fromID = UUID.Zero; | 199 | UUID fromID = UUID.Zero; |
189 | string message = c.Message; | 200 | string message = c.Message; |
190 | IScene scene = c.Scene; | 201 | IScene scene = c.Scene; |
@@ -207,7 +218,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
207 | fromPos = avatar.AbsolutePosition; | 218 | fromPos = avatar.AbsolutePosition; |
208 | fromName = avatar.Name; | 219 | fromName = avatar.Name; |
209 | fromID = c.Sender.AgentId; | 220 | fromID = c.Sender.AgentId; |
210 | 221 | if (avatar.GodLevel > 200) | |
222 | { | ||
223 | fromNamePrefix = m_adminPrefix; | ||
224 | } | ||
211 | break; | 225 | break; |
212 | 226 | ||
213 | case ChatSourceType.Object: | 227 | case ChatSourceType.Object: |
@@ -227,7 +241,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
227 | s.ForEachScenePresence( | 241 | s.ForEachScenePresence( |
228 | delegate(ScenePresence presence) | 242 | delegate(ScenePresence presence) |
229 | { | 243 | { |
230 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); | 244 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
245 | if (Presencecheck != null) | ||
246 | { | ||
247 | if (Presencecheck.IsEitherBannedOrRestricted(c.SenderUUID) != true) | ||
248 | { | ||
249 | TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); | ||
250 | } | ||
251 | } | ||
252 | |||
231 | } | 253 | } |
232 | ); | 254 | ); |
233 | } | 255 | } |
@@ -270,25 +292,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
270 | } | 292 | } |
271 | 293 | ||
272 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); | 294 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); |
273 | 295 | if (c.Scene != null) | |
274 | ((Scene)c.Scene).ForEachScenePresence( | 296 | { |
275 | delegate(ScenePresence presence) | 297 | ((Scene)c.Scene).ForEachScenePresence |
276 | { | 298 | ( |
277 | // ignore chat from child agents | 299 | delegate(ScenePresence presence) |
278 | if (presence.IsChildAgent) return; | 300 | { |
279 | 301 | // ignore chat from child agents | |
280 | IClientAPI client = presence.ControllingClient; | 302 | if (presence.IsChildAgent) return; |
281 | 303 | ||
282 | // don't forward SayOwner chat from objects to | 304 | IClientAPI client = presence.ControllingClient; |
283 | // non-owner agents | 305 | |
284 | if ((c.Type == ChatTypeEnum.Owner) && | 306 | // don't forward SayOwner chat from objects to |
285 | (null != c.SenderObject) && | 307 | // non-owner agents |
286 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 308 | if ((c.Type == ChatTypeEnum.Owner) && |
287 | return; | 309 | (null != c.SenderObject) && |
288 | 310 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | |
289 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 311 | return; |
290 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 312 | |
291 | }); | 313 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, |
314 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | ||
315 | } | ||
316 | ); | ||
317 | } | ||
292 | } | 318 | } |
293 | 319 | ||
294 | 320 | ||
@@ -317,5 +343,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
317 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, | 343 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, |
318 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); | 344 | fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); |
319 | } | 345 | } |
346 | |||
347 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
348 | public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
349 | { | ||
350 | System.Threading.Timer Timer; | ||
351 | if (flags == 0) | ||
352 | { | ||
353 | FreezeCache.Add(target.ToString()); | ||
354 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
355 | Timer = new System.Threading.Timer(timeCB, target, 30000, 0); | ||
356 | Timers.Add(target, Timer); | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | FreezeCache.Remove(target.ToString()); | ||
361 | Timers.TryGetValue(target, out Timer); | ||
362 | Timers.Remove(target); | ||
363 | Timer.Dispose(); | ||
364 | } | ||
365 | } | ||
366 | |||
367 | private void OnEndParcelFrozen(object avatar) | ||
368 | { | ||
369 | UUID target = (UUID)avatar; | ||
370 | FreezeCache.Remove(target.ToString()); | ||
371 | System.Threading.Timer Timer; | ||
372 | Timers.TryGetValue(target, out Timer); | ||
373 | Timers.Remove(target); | ||
374 | Timer.Dispose(); | ||
375 | } | ||
320 | } | 376 | } |
321 | } | 377 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 80982fd..4c01985 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
67 | return false; | 67 | return false; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 71 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
72 | 72 | ||
73 | protected List<Scene> m_Scenes = new List<Scene>(); | 73 | protected List<Scene> m_Scenes = new List<Scene>(); |
@@ -203,9 +203,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
203 | 203 | ||
204 | UserFriendData data = m_Friends[principalID]; | 204 | UserFriendData data = m_Friends[principalID]; |
205 | 205 | ||
206 | string searchFor = friendID.ToString(); | ||
206 | foreach (FriendInfo fi in data.Friends) | 207 | foreach (FriendInfo fi in data.Friends) |
207 | { | 208 | { |
208 | if (fi.Friend == friendID.ToString()) | 209 | if (fi.Friend == searchFor) |
209 | return (uint)fi.TheirFlags; | 210 | return (uint)fi.TheirFlags; |
210 | } | 211 | } |
211 | return 0; | 212 | return 0; |
@@ -292,7 +293,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
292 | 293 | ||
293 | // Inform the friends that this user is online | 294 | // Inform the friends that this user is online |
294 | StatusChange(agentID, true); | 295 | StatusChange(agentID, true); |
295 | 296 | ||
296 | // Register that we need to send the list of online friends to this user | 297 | // Register that we need to send the list of online friends to this user |
297 | lock (m_NeedsListOfFriends) | 298 | lock (m_NeedsListOfFriends) |
298 | if (!m_NeedsListOfFriends.Contains(agentID)) | 299 | if (!m_NeedsListOfFriends.Contains(agentID)) |
@@ -498,7 +499,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
498 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 499 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
499 | { | 500 | { |
500 | if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) | 501 | if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) |
501 | { | 502 | { |
502 | // we got a friendship offer | 503 | // we got a friendship offer |
503 | UUID principalID = new UUID(im.fromAgentID); | 504 | UUID principalID = new UUID(im.fromAgentID); |
504 | UUID friendID = new UUID(im.toAgentID); | 505 | UUID friendID = new UUID(im.toAgentID); |
@@ -727,7 +728,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
727 | // we're done | 728 | // we're done |
728 | return true; | 729 | return true; |
729 | } | 730 | } |
730 | 731 | ||
731 | return false; | 732 | return false; |
732 | } | 733 | } |
733 | 734 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index fdfcd10..9412735 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -172,13 +172,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
172 | 172 | ||
173 | private void RetrieveInstantMessages(IClientAPI client) | 173 | private void RetrieveInstantMessages(IClientAPI client) |
174 | { | 174 | { |
175 | if (m_RestURL != "") | 175 | if (m_RestURL == String.Empty) |
176 | { | 176 | return; |
177 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); | ||
178 | 177 | ||
179 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | 178 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); |
179 | |||
180 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | ||
180 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); | 181 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
181 | 182 | ||
183 | if (msglist != null) | ||
184 | { | ||
182 | foreach (GridInstantMessage im in msglist) | 185 | foreach (GridInstantMessage im in msglist) |
183 | { | 186 | { |
184 | // client.SendInstantMessage(im); | 187 | // client.SendInstantMessage(im); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 0707119..266621f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
261 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 261 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
262 | // it's actually doing a lot of work. | 262 | // it's actually doing a lot of work. |
263 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 263 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
264 | if (endPoint.Address != null) | 264 | if (endPoint != null && endPoint.Address != null) |
265 | { | 265 | { |
266 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 266 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
267 | // both regions | 267 | // both regions |
@@ -836,15 +836,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
836 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 836 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
837 | 837 | ||
838 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 838 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
839 | if (eq != null) | 839 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; |
840 | { | 840 | if (neighbourExternal != null) |
841 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
842 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
843 | } | ||
844 | else | ||
845 | { | 841 | { |
846 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 842 | if (eq != null) |
847 | capsPath); | 843 | { |
844 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
845 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
846 | } | ||
847 | else | ||
848 | { | ||
849 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
850 | capsPath); | ||
851 | } | ||
848 | } | 852 | } |
849 | 853 | ||
850 | if (!WaitForCallback(agent.UUID)) | 854 | if (!WaitForCallback(agent.UUID)) |
@@ -914,10 +918,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
914 | agent.child = true; | 918 | agent.child = true; |
915 | agent.Appearance = sp.Appearance; | 919 | agent.Appearance = sp.Appearance; |
916 | 920 | ||
917 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 921 | IPEndPoint external = region.ExternalEndPoint; |
918 | d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, | 922 | if (external != null) |
923 | { | ||
924 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
925 | d.BeginInvoke(sp, agent, region, external, true, | ||
919 | InformClientOfNeighbourCompleted, | 926 | InformClientOfNeighbourCompleted, |
920 | d); | 927 | d); |
928 | } | ||
921 | } | 929 | } |
922 | #endregion | 930 | #endregion |
923 | 931 | ||
@@ -1046,6 +1054,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1046 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1054 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1047 | try | 1055 | try |
1048 | { | 1056 | { |
1057 | //neighbour.ExternalEndPoint may return null, which will be caught | ||
1049 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1058 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
1050 | InformClientOfNeighbourCompleted, | 1059 | InformClientOfNeighbourCompleted, |
1051 | d); | 1060 | d); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index e32dbb3..329a259 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -290,6 +290,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
290 | return false; | 290 | return false; |
291 | } | 291 | } |
292 | 292 | ||
293 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
294 | { | ||
295 | if (destination == null) | ||
296 | return false; | ||
297 | |||
298 | foreach (Scene s in m_sceneList) | ||
299 | { | ||
300 | if (s.RegionInfo.RegionID == destination.RegionID) | ||
301 | { | ||
302 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | ||
303 | return s.IncomingCloseChildAgent(id); | ||
304 | } | ||
305 | } | ||
306 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | ||
307 | return false; | ||
308 | } | ||
309 | |||
293 | /** | 310 | /** |
294 | * Object-related communications | 311 | * Object-related communications |
295 | */ | 312 | */ |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 9e8454f..377c868 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -253,6 +253,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
253 | return false; | 253 | return false; |
254 | } | 254 | } |
255 | 255 | ||
256 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
257 | { | ||
258 | if (destination == null) | ||
259 | return false; | ||
260 | |||
261 | // Try local first | ||
262 | if (m_localBackend.CloseChildAgent(destination, id)) | ||
263 | return true; | ||
264 | |||
265 | // else do the remote thing | ||
266 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | ||
267 | return m_remoteConnector.CloseChildAgent(destination, id); | ||
268 | |||
269 | return false; | ||
270 | } | ||
256 | 271 | ||
257 | public bool CloseAgent(GridRegion destination, UUID id) | 272 | public bool CloseAgent(GridRegion destination, UUID id) |
258 | { | 273 | { |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index bc653ce..57b7672 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -261,10 +261,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
261 | // Fix ownership/creator of inventory items | 261 | // Fix ownership/creator of inventory items |
262 | // Not doing so results in inventory items | 262 | // Not doing so results in inventory items |
263 | // being no copy/no mod for everyone | 263 | // being no copy/no mod for everyone |
264 | lock (part.TaskInventory) | 264 | part.TaskInventory.LockItemsForRead(true); |
265 | TaskInventoryDictionary inv = part.TaskInventory; | ||
266 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | ||
265 | { | 267 | { |
266 | TaskInventoryDictionary inv = part.TaskInventory; | 268 | if (!ResolveUserUuid(kvp.Value.OwnerID)) |
267 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | ||
268 | { | 269 | { |
269 | if (!ResolveUserUuid(kvp.Value.OwnerID)) | 270 | if (!ResolveUserUuid(kvp.Value.OwnerID)) |
270 | { | 271 | { |
@@ -276,6 +277,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
276 | } | 277 | } |
277 | } | 278 | } |
278 | } | 279 | } |
280 | part.TaskInventory.LockItemsForRead(false); | ||
279 | } | 281 | } |
280 | 282 | ||
281 | if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) | 283 | if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 4ccd0f0..9d6c9a9 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -82,6 +82,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
82 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 82 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
83 | 83 | ||
84 | private bool m_allowedForcefulBans = true; | 84 | private bool m_allowedForcefulBans = true; |
85 | private UUID DefaultGodParcelGroup; | ||
86 | private string DefaultGodParcelName; | ||
85 | 87 | ||
86 | // caches ExtendedLandData | 88 | // caches ExtendedLandData |
87 | private Cache parcelInfoCache; | 89 | private Cache parcelInfoCache; |
@@ -96,6 +98,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
96 | 98 | ||
97 | public void Initialise(IConfigSource source) | 99 | public void Initialise(IConfigSource source) |
98 | { | 100 | { |
101 | IConfig cnf = source.Configs["LandManagement"]; | ||
102 | if (cnf != null) | ||
103 | { | ||
104 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
105 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
106 | } | ||
99 | } | 107 | } |
100 | 108 | ||
101 | public void AddRegion(Scene scene) | 109 | public void AddRegion(Scene scene) |
@@ -351,7 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
351 | { | 359 | { |
352 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | 360 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) |
353 | { | 361 | { |
354 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | 362 | if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID)) |
355 | { | 363 | { |
356 | SendYouAreBannedNotice(avatar); | 364 | SendYouAreBannedNotice(avatar); |
357 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | 365 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); |
@@ -991,6 +999,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
991 | //Owner Flag | 999 | //Owner Flag |
992 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 1000 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
993 | } | 1001 | } |
1002 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
1003 | { | ||
1004 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
1005 | } | ||
994 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 1006 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
995 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 1007 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
996 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 1008 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) |
@@ -1520,5 +1532,321 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1520 | 1532 | ||
1521 | UpdateLandObject(localID, land.LandData); | 1533 | UpdateLandObject(localID, land.LandData); |
1522 | } | 1534 | } |
1535 | |||
1536 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1537 | { | ||
1538 | ILandObject land = null; | ||
1539 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1540 | foreach (ILandObject landObject in Land) | ||
1541 | { | ||
1542 | if (landObject.LandData.LocalID == landID) | ||
1543 | { | ||
1544 | land = landObject; | ||
1545 | } | ||
1546 | } | ||
1547 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1548 | land.LandData.Name = DefaultGodParcelName; | ||
1549 | land.SendLandUpdateToAvatarsOverMe(); | ||
1550 | } | ||
1551 | |||
1552 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1553 | { | ||
1554 | ScenePresence SP; | ||
1555 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
1556 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1557 | if (SP.GodLevel != 0) | ||
1558 | { | ||
1559 | if (flags == 0) //All parcels, scripted or not | ||
1560 | { | ||
1561 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1562 | { | ||
1563 | if (e.OwnerID == targetID) | ||
1564 | { | ||
1565 | returns.Add(e); | ||
1566 | } | ||
1567 | } | ||
1568 | ); | ||
1569 | } | ||
1570 | if (flags == 4) //All parcels, scripted object | ||
1571 | { | ||
1572 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1573 | { | ||
1574 | if (e.OwnerID == targetID) | ||
1575 | { | ||
1576 | if (e.scriptScore >= 0.01) | ||
1577 | { | ||
1578 | returns.Add(e); | ||
1579 | } | ||
1580 | } | ||
1581 | } | ||
1582 | ); | ||
1583 | } | ||
1584 | if (flags == 4) //not target parcel, scripted object | ||
1585 | { | ||
1586 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1587 | { | ||
1588 | if (e.OwnerID == targetID) | ||
1589 | { | ||
1590 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1591 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1592 | { | ||
1593 | if (e.scriptScore >= 0.01) | ||
1594 | { | ||
1595 | returns.Add(e); | ||
1596 | } | ||
1597 | } | ||
1598 | } | ||
1599 | } | ||
1600 | ); | ||
1601 | } | ||
1602 | foreach (SceneObjectGroup ol in returns) | ||
1603 | { | ||
1604 | ReturnObject(ol, client); | ||
1605 | } | ||
1606 | } | ||
1607 | } | ||
1608 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1609 | { | ||
1610 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1611 | objs[0] = obj; | ||
1612 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1613 | } | ||
1614 | |||
1615 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1616 | |||
1617 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1618 | { | ||
1619 | ScenePresence targetAvatar = null; | ||
1620 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1621 | ScenePresence parcelManager = null; | ||
1622 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1623 | System.Threading.Timer Timer; | ||
1624 | |||
1625 | if (targetAvatar.GodLevel == 0) | ||
1626 | { | ||
1627 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1628 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1629 | return; | ||
1630 | if (flags == 0) | ||
1631 | { | ||
1632 | targetAvatar.AllowMovement = false; | ||
1633 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1634 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1635 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1636 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1637 | Timers.Add(targetAvatar.UUID, Timer); | ||
1638 | } | ||
1639 | else | ||
1640 | { | ||
1641 | targetAvatar.AllowMovement = true; | ||
1642 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1643 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1644 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1645 | Timers.Remove(targetAvatar.UUID); | ||
1646 | Timer.Dispose(); | ||
1647 | } | ||
1648 | } | ||
1649 | } | ||
1650 | private void OnEndParcelFrozen(object avatar) | ||
1651 | { | ||
1652 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1653 | targetAvatar.AllowMovement = true; | ||
1654 | System.Threading.Timer Timer; | ||
1655 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1656 | Timers.Remove(targetAvatar.UUID); | ||
1657 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1658 | } | ||
1659 | |||
1660 | |||
1661 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1662 | { | ||
1663 | ScenePresence targetAvatar = null; | ||
1664 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1665 | ScenePresence parcelManager = null; | ||
1666 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1667 | //Just eject | ||
1668 | if (flags == 0) | ||
1669 | { | ||
1670 | if (targetAvatar.GodLevel == 0) | ||
1671 | { | ||
1672 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1673 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1674 | return; | ||
1675 | |||
1676 | Vector3 position = new Vector3(0, 0, 0); | ||
1677 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1678 | allParcels = AllParcels(); | ||
1679 | if (allParcels.Count != 1) | ||
1680 | { | ||
1681 | foreach (ILandObject parcel in allParcels) | ||
1682 | { | ||
1683 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1684 | { | ||
1685 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1686 | { | ||
1687 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1688 | { | ||
1689 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1690 | { | ||
1691 | if (parcel.ContainsPoint(x, y)) | ||
1692 | { | ||
1693 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1694 | targetAvatar.TeleportWithMomentum(position); | ||
1695 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1696 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1697 | return; | ||
1698 | } | ||
1699 | } | ||
1700 | } | ||
1701 | } | ||
1702 | } | ||
1703 | } | ||
1704 | } | ||
1705 | Vector3 targetVector; | ||
1706 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1707 | { | ||
1708 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1709 | { | ||
1710 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1711 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1712 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1713 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1714 | return; | ||
1715 | } | ||
1716 | else | ||
1717 | { | ||
1718 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1719 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1720 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1721 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1722 | return; | ||
1723 | } | ||
1724 | } | ||
1725 | else | ||
1726 | { | ||
1727 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1728 | { | ||
1729 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1730 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1731 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1732 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1733 | return; | ||
1734 | } | ||
1735 | else | ||
1736 | { | ||
1737 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1738 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1739 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1740 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1741 | return; | ||
1742 | } | ||
1743 | } | ||
1744 | } | ||
1745 | } | ||
1746 | //Eject and ban | ||
1747 | if (flags == 1) | ||
1748 | { | ||
1749 | if (targetAvatar.GodLevel == 0) | ||
1750 | { | ||
1751 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1752 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1753 | return; | ||
1754 | |||
1755 | Vector3 position = new Vector3(0, 0, 0); | ||
1756 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1757 | allParcels = AllParcels(); | ||
1758 | if (allParcels.Count != 1) | ||
1759 | { | ||
1760 | foreach (ILandObject parcel in allParcels) | ||
1761 | { | ||
1762 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1763 | { | ||
1764 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1765 | { | ||
1766 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1767 | { | ||
1768 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1769 | { | ||
1770 | if (parcel.ContainsPoint(x, y)) | ||
1771 | { | ||
1772 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1773 | targetAvatar.TeleportWithMomentum(position); | ||
1774 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1775 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1776 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1777 | entry.AgentID = targetAvatar.UUID; | ||
1778 | entry.Flags = AccessList.Ban; | ||
1779 | entry.Time = new DateTime(); | ||
1780 | land.LandData.ParcelAccessList.Add(entry); | ||
1781 | return; | ||
1782 | } | ||
1783 | } | ||
1784 | } | ||
1785 | } | ||
1786 | } | ||
1787 | } | ||
1788 | } | ||
1789 | Vector3 targetVector; | ||
1790 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1791 | { | ||
1792 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1793 | { | ||
1794 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1795 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1796 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1797 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1798 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1799 | entry.AgentID = targetAvatar.UUID; | ||
1800 | entry.Flags = AccessList.Ban; | ||
1801 | entry.Time = new DateTime(); | ||
1802 | land.LandData.ParcelAccessList.Add(entry); | ||
1803 | return; | ||
1804 | } | ||
1805 | else | ||
1806 | { | ||
1807 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1808 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1809 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1810 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1811 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1812 | entry.AgentID = targetAvatar.UUID; | ||
1813 | entry.Flags = AccessList.Ban; | ||
1814 | entry.Time = new DateTime(); | ||
1815 | land.LandData.ParcelAccessList.Add(entry); | ||
1816 | return; | ||
1817 | } | ||
1818 | } | ||
1819 | else | ||
1820 | { | ||
1821 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1822 | { | ||
1823 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1824 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1825 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1826 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1827 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1828 | entry.AgentID = targetAvatar.UUID; | ||
1829 | entry.Flags = AccessList.Ban; | ||
1830 | entry.Time = new DateTime(); | ||
1831 | land.LandData.ParcelAccessList.Add(entry); | ||
1832 | return; | ||
1833 | } | ||
1834 | else | ||
1835 | { | ||
1836 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1837 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1838 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1839 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1840 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1841 | entry.AgentID = targetAvatar.UUID; | ||
1842 | entry.Flags = AccessList.Ban; | ||
1843 | entry.Time = new DateTime(); | ||
1844 | land.LandData.ParcelAccessList.Add(entry); | ||
1845 | return; | ||
1846 | } | ||
1847 | } | ||
1848 | } | ||
1849 | } | ||
1850 | } | ||
1523 | } | 1851 | } |
1524 | } | 1852 | } |