diff options
author | Careminster Staff | 2010-01-17 19:23:36 -0600 |
---|---|---|
committer | Melanie | 2010-01-18 01:27:01 +0000 |
commit | 44d523518af31075c77653eacc7489220db4abaa (patch) | |
tree | 968594f77805c9091d9945a0d9f22f00d9b54563 /OpenSim | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC-44d523518af31075c77653eacc7489220db4abaa.zip opensim-SC-44d523518af31075c77653eacc7489220db4abaa.tar.gz opensim-SC-44d523518af31075c77653eacc7489220db4abaa.tar.bz2 opensim-SC-44d523518af31075c77653eacc7489220db4abaa.tar.xz |
Adds land ejection and freezing. Adds more checks to land banning.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 442 |
1 files changed, 419 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d9b36a5..23da1ae 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -81,6 +81,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
81 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 81 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
82 | 82 | ||
83 | private bool m_allowedForcefulBans = true; | 83 | private bool m_allowedForcefulBans = true; |
84 | private string DefultGodParcelGroup; | ||
85 | private string DefultGodParcelName; | ||
84 | 86 | ||
85 | // caches ExtendedLandData | 87 | // caches ExtendedLandData |
86 | private Cache parcelInfoCache; | 88 | private Cache parcelInfoCache; |
@@ -153,6 +155,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
153 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; | 155 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; |
154 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; | 156 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; |
155 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; | 157 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; |
158 | client.OnParcelGodMark += ClientOnParcelGodMark; | ||
159 | client.OnSimWideDeletes += ClientOnSimWideDeletes; | ||
160 | client.OnParcelFreezeUser += ClientOnParcelFreezeUser; | ||
161 | client.OnParcelEjectUser += ClientOnParcelEjectUser; | ||
156 | 162 | ||
157 | EntityBase presenceEntity; | 163 | EntityBase presenceEntity; |
158 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) | 164 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) |
@@ -264,22 +270,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
264 | return parcelsNear; | 270 | return parcelsNear; |
265 | } | 271 | } |
266 | 272 | ||
267 | public void KickUserOffOfParcel(ScenePresence avatar) | 273 | |
268 | { | ||
269 | if (avatar.GodLevel == 0) | ||
270 | { | ||
271 | List<ILandObject> parcelsNear = ParcelsNearPoint(avatar.AbsolutePosition); | ||
272 | foreach (ILandObject check in parcelsNear) | ||
273 | { | ||
274 | if (check.IsEitherBannedOrRestricted(avatar.UUID) != true) | ||
275 | { | ||
276 | Vector3 target = check.LandData.UserLocation; | ||
277 | avatar.TeleportWithMomentum(target); | ||
278 | return; | ||
279 | } | ||
280 | } | ||
281 | } | ||
282 | } | ||
283 | public void MoveUserOutOfParcel(ScenePresence avatar) | 274 | public void MoveUserOutOfParcel(ScenePresence avatar) |
284 | { | 275 | { |
285 | if (avatar.GodLevel == 0) | 276 | if (avatar.GodLevel == 0) |
@@ -296,7 +287,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
296 | { | 287 | { |
297 | Vector3 target = new Vector3(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); | 288 | Vector3 target = new Vector3(avatar.AbsolutePosition.X + x, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); |
298 | avatar.TeleportWithMomentum(target); | 289 | avatar.TeleportWithMomentum(target); |
299 | avatar.Velocity = new Vector3(-avatar.Velocity.X - 5, avatar.Velocity.Y, avatar.Velocity.Z); | ||
300 | return; | 290 | return; |
301 | } | 291 | } |
302 | } | 292 | } |
@@ -310,11 +300,73 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
310 | { | 300 | { |
311 | Vector3 target = new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y, avatar.AbsolutePosition.Z); | 301 | Vector3 target = new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y + y, avatar.AbsolutePosition.Z); |
312 | avatar.TeleportWithMomentum(target); | 302 | avatar.TeleportWithMomentum(target); |
313 | avatar.Velocity = new Vector3(avatar.Velocity.X, -avatar.Velocity.Y - 5, avatar.Velocity.Z); | ||
314 | return; | 303 | return; |
315 | } | 304 | } |
316 | } | 305 | } |
317 | } | 306 | } |
307 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
308 | allParcels = AllParcels(); | ||
309 | if (allParcels.Count != 1) | ||
310 | { | ||
311 | foreach (ILandObject parcel in allParcels) | ||
312 | { | ||
313 | if (parcel.IsEitherBannedOrRestricted(avatar.UUID) != true) | ||
314 | { | ||
315 | Vector3 temptarget = parcel.LandData.UserLocation; | ||
316 | if (parcel.ContainsPoint((int)parcel.LandData.UserLocation.X, (int)parcel.LandData.UserLocation.Y)) | ||
317 | { | ||
318 | avatar.TeleportWithMomentum(temptarget); | ||
319 | return; | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | for (int x = 0; x <= Constants.RegionSize / 3; x += 3) | ||
324 | { | ||
325 | for (int y = 0; y <= Constants.RegionSize / 3; y += 3) | ||
326 | { | ||
327 | if (parcel.ContainsPoint(x, y)) | ||
328 | { | ||
329 | temptarget = new Vector3(x, y, avatar.AbsolutePosition.Z); | ||
330 | avatar.TeleportWithMomentum(temptarget); | ||
331 | return; | ||
332 | } | ||
333 | } | ||
334 | } | ||
335 | } | ||
336 | } | ||
337 | } | ||
338 | } | ||
339 | //Move to region side | ||
340 | if (avatar.AbsolutePosition.X > avatar.AbsolutePosition.Y) | ||
341 | { | ||
342 | if (avatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
343 | { | ||
344 | Vector3 target = new Vector3(Constants.RegionSize, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); ; | ||
345 | avatar.TeleportWithMomentum(target); | ||
346 | return; | ||
347 | } | ||
348 | else | ||
349 | { | ||
350 | Vector3 target = new Vector3(0, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); ; | ||
351 | avatar.TeleportWithMomentum(target); | ||
352 | return; | ||
353 | } | ||
354 | } | ||
355 | else | ||
356 | { | ||
357 | if (avatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
358 | { | ||
359 | Vector3 target = new Vector3(avatar.AbsolutePosition.X, Constants.RegionSize, avatar.AbsolutePosition.Z); ; | ||
360 | avatar.TeleportWithMomentum(target); | ||
361 | return; | ||
362 | } | ||
363 | else | ||
364 | { | ||
365 | Vector3 target = new Vector3(avatar.AbsolutePosition.X, 0, avatar.AbsolutePosition.Z); ; | ||
366 | avatar.TeleportWithMomentum(target); | ||
367 | return; | ||
368 | } | ||
369 | } | ||
318 | } | 370 | } |
319 | } | 371 | } |
320 | 372 | ||
@@ -357,12 +409,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
357 | { | 409 | { |
358 | if (checkBan.IsRestrictedFromLand(avatar.ControllingClient.AgentId)) | 410 | if (checkBan.IsRestrictedFromLand(avatar.ControllingClient.AgentId)) |
359 | { | 411 | { |
360 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar.ControllingClient); | 412 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, true, (int)ParcelResult.Multiple, avatar.ControllingClient); |
361 | return; | 413 | return; |
362 | } | 414 | } |
363 | if (checkBan.IsBannedFromLand(avatar.ControllingClient.AgentId)) | 415 | if (checkBan.IsBannedFromLand(avatar.ControllingClient.AgentId)) |
364 | { | 416 | { |
365 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar.ControllingClient); | 417 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, true, (int)ParcelResult.Multiple, avatar.ControllingClient); |
366 | return; | 418 | return; |
367 | } | 419 | } |
368 | } | 420 | } |
@@ -377,12 +429,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
377 | { | 429 | { |
378 | if (checkBan.IsRestrictedFromLand(avatar.ControllingClient.AgentId)) | 430 | if (checkBan.IsRestrictedFromLand(avatar.ControllingClient.AgentId)) |
379 | { | 431 | { |
380 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar.ControllingClient); | 432 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, true, (int)ParcelResult.Multiple, avatar.ControllingClient); |
381 | return; | 433 | return; |
382 | } | 434 | } |
383 | if (checkBan.IsBannedFromLand(avatar.ControllingClient.AgentId)) | 435 | if (checkBan.IsBannedFromLand(avatar.ControllingClient.AgentId)) |
384 | { | 436 | { |
385 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar.ControllingClient); | 437 | checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, true, (int)ParcelResult.Multiple, avatar.ControllingClient); |
386 | return; | 438 | return; |
387 | } | 439 | } |
388 | } | 440 | } |
@@ -490,6 +542,18 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
490 | if (m_scene.Permissions.CanEditParcel(agentID, land)) | 542 | if (m_scene.Permissions.CanEditParcel(agentID, land)) |
491 | { | 543 | { |
492 | land.UpdateAccessList(flags, entries, remote_client); | 544 | land.UpdateAccessList(flags, entries, remote_client); |
545 | List<ScenePresence> presences = ((Scene)remote_client.Scene).GetAvatars(); | ||
546 | foreach (ScenePresence presence in presences) | ||
547 | { | ||
548 | land = GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); | ||
549 | if (land != null) | ||
550 | { | ||
551 | if (land.IsEitherBannedOrRestricted(presence.UUID)) | ||
552 | { | ||
553 | MoveUserOutOfParcel(presence); | ||
554 | } | ||
555 | } | ||
556 | } | ||
493 | } | 557 | } |
494 | } | 558 | } |
495 | else | 559 | else |
@@ -1055,7 +1119,25 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1055 | m_landList.TryGetValue(localID, out land); | 1119 | m_landList.TryGetValue(localID, out land); |
1056 | } | 1120 | } |
1057 | 1121 | ||
1058 | if (land != null) land.UpdateLandProperties(args, remote_client); | 1122 | if (land != null) |
1123 | { | ||
1124 | land.UpdateLandProperties(args, remote_client); | ||
1125 | if ((args.ParcelFlags & (uint)(ParcelFlags.UseBanList | ParcelFlags.UseAccessList | ParcelFlags.UseAccessGroup | ParcelFlags.UsePassList)) != 0) | ||
1126 | { | ||
1127 | List<ScenePresence> presences = ((Scene)remote_client.Scene).GetAvatars(); | ||
1128 | foreach (ScenePresence presence in presences) | ||
1129 | { | ||
1130 | land = GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); | ||
1131 | if (land != null) | ||
1132 | { | ||
1133 | if (land.IsEitherBannedOrRestricted(presence.UUID)) | ||
1134 | { | ||
1135 | MoveUserOutOfParcel(presence); | ||
1136 | } | ||
1137 | } | ||
1138 | } | ||
1139 | } | ||
1140 | } | ||
1059 | } | 1141 | } |
1060 | 1142 | ||
1061 | public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) | 1143 | public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) |
@@ -1473,5 +1555,319 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1473 | 1555 | ||
1474 | UpdateLandObject(localID, land.LandData); | 1556 | UpdateLandObject(localID, land.LandData); |
1475 | } | 1557 | } |
1558 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1559 | { | ||
1560 | ILandObject land = null; | ||
1561 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1562 | foreach (ILandObject landObject in Land) | ||
1563 | { | ||
1564 | if (landObject.LandData.LocalID == landID) | ||
1565 | { | ||
1566 | land = landObject; | ||
1567 | } | ||
1568 | } | ||
1569 | land.DeedToGroup(new UUID(DefultGodParcelGroup)); | ||
1570 | land.LandData.Name = DefultGodParcelName; | ||
1571 | land.SendLandUpdateToAvatarsOverMe(); | ||
1572 | } | ||
1573 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1574 | { | ||
1575 | ScenePresence SP; | ||
1576 | ((Scene)client.Scene).TryGetAvatar(client.AgentId, out SP); | ||
1577 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1578 | if (SP.GodLevel != 0) | ||
1579 | { | ||
1580 | if (flags == 0) //All parcels, scripted or not | ||
1581 | { | ||
1582 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1583 | { | ||
1584 | if (e.OwnerID == targetID) | ||
1585 | { | ||
1586 | returns.Add(e); | ||
1587 | } | ||
1588 | } | ||
1589 | ); | ||
1590 | } | ||
1591 | if (flags == 4) //All parcels, scripted object | ||
1592 | { | ||
1593 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1594 | { | ||
1595 | if (e.OwnerID == targetID) | ||
1596 | { | ||
1597 | if (e.scriptScore >= 0.01) | ||
1598 | { | ||
1599 | returns.Add(e); | ||
1600 | } | ||
1601 | } | ||
1602 | } | ||
1603 | ); | ||
1604 | } | ||
1605 | if (flags == 4) //not target parcel, scripted object | ||
1606 | { | ||
1607 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1608 | { | ||
1609 | if (e.OwnerID == targetID) | ||
1610 | { | ||
1611 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1612 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1613 | { | ||
1614 | if (e.scriptScore >= 0.01) | ||
1615 | { | ||
1616 | returns.Add(e); | ||
1617 | } | ||
1618 | } | ||
1619 | } | ||
1620 | } | ||
1621 | ); | ||
1622 | } | ||
1623 | foreach (SceneObjectGroup ol in returns) | ||
1624 | { | ||
1625 | ReturnObject(ol, client); | ||
1626 | } | ||
1627 | } | ||
1628 | } | ||
1629 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1630 | { | ||
1631 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1632 | objs[0] = obj; | ||
1633 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1634 | } | ||
1635 | |||
1636 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1637 | |||
1638 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1639 | { | ||
1640 | ScenePresence targetAvatar = null; | ||
1641 | ((Scene)client.Scene).TryGetAvatar(target, out targetAvatar); | ||
1642 | ScenePresence parcelManager = null; | ||
1643 | ((Scene)client.Scene).TryGetAvatar(client.AgentId, out parcelManager); | ||
1644 | System.Threading.Timer Timer; | ||
1645 | |||
1646 | if (targetAvatar.GodLevel == 0) | ||
1647 | { | ||
1648 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1649 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1650 | return; | ||
1651 | if (flags == 0) | ||
1652 | { | ||
1653 | targetAvatar.AllowMovement = false; | ||
1654 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1655 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1656 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1657 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1658 | Timers.Add(targetAvatar.UUID, Timer); | ||
1659 | } | ||
1660 | else | ||
1661 | { | ||
1662 | targetAvatar.AllowMovement = true; | ||
1663 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1664 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1665 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1666 | Timers.Remove(targetAvatar.UUID); | ||
1667 | Timer.Dispose(); | ||
1668 | } | ||
1669 | } | ||
1670 | } | ||
1671 | private void OnEndParcelFrozen(object avatar) | ||
1672 | { | ||
1673 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1674 | targetAvatar.AllowMovement = true; | ||
1675 | System.Threading.Timer Timer; | ||
1676 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1677 | Timers.Remove(targetAvatar.UUID); | ||
1678 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1679 | } | ||
1680 | |||
1681 | |||
1682 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1683 | { | ||
1684 | ScenePresence targetAvatar = null; | ||
1685 | ((Scene)client.Scene).TryGetAvatar(target, out targetAvatar); | ||
1686 | ScenePresence parcelManager = null; | ||
1687 | ((Scene)client.Scene).TryGetAvatar(client.AgentId, out parcelManager); | ||
1688 | //Just eject | ||
1689 | if (flags == 0) | ||
1690 | { | ||
1691 | if (targetAvatar.GodLevel == 0) | ||
1692 | { | ||
1693 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1694 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1695 | return; | ||
1696 | |||
1697 | Vector3 position = new Vector3(0, 0, 0); | ||
1698 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1699 | allParcels = AllParcels(); | ||
1700 | if (allParcels.Count != 1) | ||
1701 | { | ||
1702 | foreach (ILandObject parcel in allParcels) | ||
1703 | { | ||
1704 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1705 | { | ||
1706 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1707 | { | ||
1708 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1709 | { | ||
1710 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1711 | { | ||
1712 | if (parcel.ContainsPoint(x, y)) | ||
1713 | { | ||
1714 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1715 | targetAvatar.TeleportWithMomentum(position); | ||
1716 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1717 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1718 | return; | ||
1719 | } | ||
1720 | } | ||
1721 | } | ||
1722 | } | ||
1723 | } | ||
1724 | } | ||
1725 | } | ||
1726 | Vector3 targetVector; | ||
1727 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1728 | { | ||
1729 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1730 | { | ||
1731 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1732 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1733 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1734 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1735 | return; | ||
1736 | } | ||
1737 | else | ||
1738 | { | ||
1739 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1740 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1741 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1742 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1743 | return; | ||
1744 | } | ||
1745 | } | ||
1746 | else | ||
1747 | { | ||
1748 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1749 | { | ||
1750 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1751 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1752 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1753 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1754 | return; | ||
1755 | } | ||
1756 | else | ||
1757 | { | ||
1758 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1759 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1760 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1761 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1762 | return; | ||
1763 | } | ||
1764 | } | ||
1765 | } | ||
1766 | } | ||
1767 | //Eject and ban | ||
1768 | if (flags == 1) | ||
1769 | { | ||
1770 | if (targetAvatar.GodLevel == 0) | ||
1771 | { | ||
1772 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1773 | if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) | ||
1774 | return; | ||
1775 | |||
1776 | Vector3 position = new Vector3(0, 0, 0); | ||
1777 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1778 | allParcels = AllParcels(); | ||
1779 | if (allParcels.Count != 1) | ||
1780 | { | ||
1781 | foreach (ILandObject parcel in allParcels) | ||
1782 | { | ||
1783 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1784 | { | ||
1785 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1786 | { | ||
1787 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1788 | { | ||
1789 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1790 | { | ||
1791 | if (parcel.ContainsPoint(x, y)) | ||
1792 | { | ||
1793 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1794 | targetAvatar.TeleportWithMomentum(position); | ||
1795 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1796 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1797 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1798 | entry.AgentID = targetAvatar.UUID; | ||
1799 | entry.Flags = AccessList.Ban; | ||
1800 | entry.Time = new DateTime(); | ||
1801 | land.LandData.ParcelAccessList.Add(entry); | ||
1802 | return; | ||
1803 | } | ||
1804 | } | ||
1805 | } | ||
1806 | } | ||
1807 | } | ||
1808 | } | ||
1809 | } | ||
1810 | Vector3 targetVector; | ||
1811 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1812 | { | ||
1813 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1814 | { | ||
1815 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1816 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1817 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1818 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1819 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1820 | entry.AgentID = targetAvatar.UUID; | ||
1821 | entry.Flags = AccessList.Ban; | ||
1822 | entry.Time = new DateTime(); | ||
1823 | land.LandData.ParcelAccessList.Add(entry); | ||
1824 | return; | ||
1825 | } | ||
1826 | else | ||
1827 | { | ||
1828 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1829 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1830 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1831 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1832 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1833 | entry.AgentID = targetAvatar.UUID; | ||
1834 | entry.Flags = AccessList.Ban; | ||
1835 | entry.Time = new DateTime(); | ||
1836 | land.LandData.ParcelAccessList.Add(entry); | ||
1837 | return; | ||
1838 | } | ||
1839 | } | ||
1840 | else | ||
1841 | { | ||
1842 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1843 | { | ||
1844 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1845 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1846 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1847 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1848 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1849 | entry.AgentID = targetAvatar.UUID; | ||
1850 | entry.Flags = AccessList.Ban; | ||
1851 | entry.Time = new DateTime(); | ||
1852 | land.LandData.ParcelAccessList.Add(entry); | ||
1853 | return; | ||
1854 | } | ||
1855 | else | ||
1856 | { | ||
1857 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1858 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1859 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1860 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1861 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1862 | entry.AgentID = targetAvatar.UUID; | ||
1863 | entry.Flags = AccessList.Ban; | ||
1864 | entry.Time = new DateTime(); | ||
1865 | land.LandData.ParcelAccessList.Add(entry); | ||
1866 | return; | ||
1867 | } | ||
1868 | } | ||
1869 | } | ||
1870 | } | ||
1871 | } | ||
1476 | } | 1872 | } |
1477 | } | 1873 | } |