aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2017-07-25 01:30:35 +0100
committerUbitUmarov2017-07-25 01:30:35 +0100
commit81d1ebc5105c6fb163c6687826dc557313309b12 (patch)
tree7991f04b77779816bb8bfa6d85270588378636d1
parentonly hide parcel info from banned avatars (diff)
downloadopensim-SC_OLD-81d1ebc5105c6fb163c6687826dc557313309b12.zip
opensim-SC_OLD-81d1ebc5105c6fb163c6687826dc557313309b12.tar.gz
opensim-SC_OLD-81d1ebc5105c6fb163c6687826dc557313309b12.tar.bz2
opensim-SC_OLD-81d1ebc5105c6fb163c6687826dc557313309b12.tar.xz
add first code to process parcel buy pass. Still testing, and still no kick on expire ( does expire on entry )
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs90
1 files changed, 89 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 221670e..54e9e59 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -41,6 +41,7 @@ using OpenSim.Framework;
41using OpenSim.Framework.Capabilities; 41using OpenSim.Framework.Capabilities;
42using OpenSim.Framework.Console; 42using OpenSim.Framework.Console;
43using OpenSim.Framework.Servers; 43using OpenSim.Framework.Servers;
44using OpenSim.Framework.Monitoring;
44using OpenSim.Framework.Servers.HttpServer; 45using OpenSim.Framework.Servers.HttpServer;
45using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
@@ -216,6 +217,7 @@ namespace OpenSim.Region.CoreModules.World.Land
216 client.OnParcelEjectUser += ClientOnParcelEjectUser; 217 client.OnParcelEjectUser += ClientOnParcelEjectUser;
217 client.OnParcelFreezeUser += ClientOnParcelFreezeUser; 218 client.OnParcelFreezeUser += ClientOnParcelFreezeUser;
218 client.OnSetStartLocationRequest += ClientOnSetHome; 219 client.OnSetStartLocationRequest += ClientOnSetHome;
220 client.OnParcelBuyPass += ClientParcelBuyPass;
219 } 221 }
220 222
221 public void EventMakeChildAgent(ScenePresence avatar) 223 public void EventMakeChildAgent(ScenePresence avatar)
@@ -537,6 +539,92 @@ namespace OpenSim.Region.CoreModules.World.Land
537 } 539 }
538 } 540 }
539 541
542 public void ClientParcelBuyPass(IClientAPI remote_client, UUID targetID, int landLocalID)
543 {
544 ILandObject land;
545 lock (m_landList)
546 {
547 m_landList.TryGetValue(landLocalID, out land);
548 }
549 // trivial checks
550 if(land == null)
551 return;
552
553 LandData ldata = land.LandData;
554
555 if(ldata == null)
556 return;
557
558 if(ldata.OwnerID == targetID)
559 return;
560
561 if(ldata.PassHours == 0)
562 return;
563
564 if((ldata.Flags & (uint)ParcelFlags.UsePassList) == 0)
565 return;
566
567 int cost = ldata.PassPrice;
568
569 int idx = land.LandData.ParcelAccessList.FindIndex(
570 delegate(LandAccessEntry e)
571 {
572 if (e.AgentID == targetID && e.Flags == AccessList.Access)
573 return true;
574 return false;
575 });
576
577 int expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * ldata.PassHours);
578 if (idx != -1)
579 {
580 if(ldata.ParcelAccessList[idx].Expires == 0)
581 {
582 remote_client.SendAgentAlertMessage("You already have access to parcel", false);
583 return;
584 }
585
586 if(expires < land.LandData.ParcelAccessList[idx].Expires - 300f)
587 {
588 remote_client.SendAgentAlertMessage("Your pass to parcel is still valid for 5 minutes", false);
589 return;
590 }
591 }
592
593 LandAccessEntry entry = new LandAccessEntry();
594 entry.AgentID = targetID;
595 entry.Flags = AccessList.Access;
596 entry.Expires = expires;
597
598 IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>();
599 if(cost != 0 && mm != null)
600 {
601 WorkManager.RunInThreadPool(
602 delegate
603 {
604 if (!mm.AmountCovered(remote_client.AgentId, cost))
605 {
606 remote_client.SendAgentAlertMessage("Insufficient funds", true);
607 return;
608 }
609
610 mm.ApplyCharge(remote_client.AgentId, cost, MoneyTransactionType.LandPassSale);
611
612 if (idx != -1)
613 ldata.ParcelAccessList.RemoveAt(idx);
614 ldata.ParcelAccessList.Add(entry);
615 m_scene.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
616 return;
617 }, null, "ParcelBuyPass");
618 }
619 else
620 {
621 if (idx != -1)
622 ldata.ParcelAccessList.RemoveAt(idx);
623 ldata.ParcelAccessList.Add(entry);
624 m_scene.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
625 }
626 }
627
540 public void ClientOnParcelAccessListRequest(UUID agentID, UUID sessionID, uint flags, int sequenceID, 628 public void ClientOnParcelAccessListRequest(UUID agentID, UUID sessionID, uint flags, int sequenceID,
541 int landLocalID, IClientAPI remote_client) 629 int landLocalID, IClientAPI remote_client)
542 { 630 {
@@ -1769,7 +1857,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1769 land_update.MusicURL = properties.MusicURL; 1857 land_update.MusicURL = properties.MusicURL;
1770 land_update.Name = properties.Name; 1858 land_update.Name = properties.Name;
1771 land_update.ParcelFlags = (uint) properties.ParcelFlags; 1859 land_update.ParcelFlags = (uint) properties.ParcelFlags;
1772 land_update.PassHours = (int) properties.PassHours; 1860 land_update.PassHours = properties.PassHours;
1773 land_update.PassPrice = (int) properties.PassPrice; 1861 land_update.PassPrice = (int) properties.PassPrice;
1774 land_update.SalePrice = (int) properties.SalePrice; 1862 land_update.SalePrice = (int) properties.SalePrice;
1775 land_update.SnapshotID = properties.SnapshotID; 1863 land_update.SnapshotID = properties.SnapshotID;