diff options
author | Teravus Ovares | 2008-04-14 17:13:38 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-14 17:13:38 +0000 |
commit | e21886eea0a4d2782a74bb1f974b2e1056fea055 (patch) | |
tree | 33512912e98ad07ab04f3370fd48d1d0ed307a66 | |
parent | * Get Util.GetHostFromDNS to tell us the dns address it was trying to resolve... (diff) | |
download | opensim-SC_OLD-e21886eea0a4d2782a74bb1f974b2e1056fea055.zip opensim-SC_OLD-e21886eea0a4d2782a74bb1f974b2e1056fea055.tar.gz opensim-SC_OLD-e21886eea0a4d2782a74bb1f974b2e1056fea055.tar.bz2 opensim-SC_OLD-e21886eea0a4d2782a74bb1f974b2e1056fea055.tar.xz |
* Fixed a few warnings.
* Added license info to a few files it was missing from.
* Fleshed out the landbuy interfaces
* If you add '-helperuri http://127.0.0.1:9000/' to your list of parameters you tell the client to use when you start it up you can transfer ownership of parcels now in standalone. Structured gridmode requires a lot more work, see the documentation in the example money module. The example money module is not secure especially in standalone mode.
12 files changed, 347 insertions, 10 deletions
diff --git a/OpenSim/Framework/Communications/XMPP/Stanza.cs b/OpenSim/Framework/Communications/XMPP/Stanza.cs index 4c57114..ed6ef06 100644 --- a/OpenSim/Framework/Communications/XMPP/Stanza.cs +++ b/OpenSim/Framework/Communications/XMPP/Stanza.cs | |||
@@ -11,9 +11,9 @@ namespace OpenSim.Framework.Communications.XMPP | |||
11 | public string localName = String.Empty; | 11 | public string localName = String.Empty; |
12 | public JId to; | 12 | public JId to; |
13 | public JId from; | 13 | public JId from; |
14 | string id; | 14 | public string id; |
15 | string lang; | 15 | public string lang; |
16 | string nodeName; | 16 | public string nodeName; |
17 | 17 | ||
18 | public Stanza(XmlNode node, Object defaults, bool hasID) | 18 | public Stanza(XmlNode node, Object defaults, bool hasID) |
19 | { | 19 | { |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index e081e05..cd59fa0 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -424,6 +424,9 @@ namespace OpenSim.Framework | |||
424 | public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes); | 424 | public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes); |
425 | 425 | ||
426 | public delegate void MoneyTransferRequest(LLUUID sourceID, LLUUID destID, int amount, int transactionType, string description); | 426 | public delegate void MoneyTransferRequest(LLUUID sourceID, LLUUID destID, int amount, int transactionType, string description); |
427 | |||
428 | public delegate void ParcelBuy(LLUUID agentId, LLUUID groupId, bool final, bool groupOwned, | ||
429 | bool removeContribution, int parcelLocalID, int parcelArea, int parcelPrice, bool authenticated); | ||
427 | 430 | ||
428 | // We keep all this information for fraud purposes in the future. | 431 | // We keep all this information for fraud purposes in the future. |
429 | public delegate void MoneyBalanceRequest(IClientAPI remoteClient, LLUUID agentID, LLUUID sessionID, LLUUID TransactionID); | 432 | public delegate void MoneyBalanceRequest(IClientAPI remoteClient, LLUUID agentID, LLUUID sessionID, LLUUID TransactionID); |
@@ -544,6 +547,7 @@ namespace OpenSim.Framework | |||
544 | 547 | ||
545 | event MoneyBalanceRequest OnMoneyBalanceRequest; | 548 | event MoneyBalanceRequest OnMoneyBalanceRequest; |
546 | event UpdateAvatarProperties OnUpdateAvatarProperties; | 549 | event UpdateAvatarProperties OnUpdateAvatarProperties; |
550 | event ParcelBuy OnParcelBuy; | ||
547 | 551 | ||
548 | 552 | ||
549 | 553 | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 9fe2144..2599456 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -214,6 +214,7 @@ namespace OpenSim.Region.ClientStack | |||
214 | private ViewerEffectEventHandler handlerViewerEffect = null; //OnViewerEffect; | 214 | private ViewerEffectEventHandler handlerViewerEffect = null; //OnViewerEffect; |
215 | private Action<IClientAPI> handlerLogout = null; //OnLogout; | 215 | private Action<IClientAPI> handlerLogout = null; //OnLogout; |
216 | private MoneyTransferRequest handlerMoneyTransferRequest = null; //OnMoneyTransferRequest; | 216 | private MoneyTransferRequest handlerMoneyTransferRequest = null; //OnMoneyTransferRequest; |
217 | private ParcelBuy handlerParcelBuy = null; | ||
217 | private EconomyDataRequest handlerEconomoyDataRequest = null; | 218 | private EconomyDataRequest handlerEconomoyDataRequest = null; |
218 | 219 | ||
219 | private UpdateVector handlerUpdatePrimSinglePosition = null; //OnUpdatePrimSinglePosition; | 220 | private UpdateVector handlerUpdatePrimSinglePosition = null; //OnUpdatePrimSinglePosition; |
@@ -769,6 +770,7 @@ namespace OpenSim.Region.ClientStack | |||
769 | public event EconomyDataRequest OnEconomyDataRequest; | 770 | public event EconomyDataRequest OnEconomyDataRequest; |
770 | 771 | ||
771 | public event MoneyBalanceRequest OnMoneyBalanceRequest; | 772 | public event MoneyBalanceRequest OnMoneyBalanceRequest; |
773 | public event ParcelBuy OnParcelBuy; | ||
772 | 774 | ||
773 | 775 | ||
774 | #region Scene/Avatar to Client | 776 | #region Scene/Avatar to Client |
@@ -2396,6 +2398,7 @@ namespace OpenSim.Region.ClientStack | |||
2396 | AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); | 2398 | AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); |
2397 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); | 2399 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); |
2398 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest); | 2400 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest); |
2401 | AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest); | ||
2399 | } | 2402 | } |
2400 | 2403 | ||
2401 | private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack) | 2404 | private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack) |
@@ -2420,6 +2423,28 @@ namespace OpenSim.Region.ClientStack | |||
2420 | } | 2423 | } |
2421 | } | 2424 | } |
2422 | 2425 | ||
2426 | private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack) | ||
2427 | { | ||
2428 | ParcelBuyPacket parcel = (ParcelBuyPacket)Pack; | ||
2429 | if (parcel.AgentData.AgentID == AgentId && parcel.AgentData.SessionID == this.SessionId) | ||
2430 | { | ||
2431 | handlerParcelBuy = OnParcelBuy; | ||
2432 | if (handlerParcelBuy != null) | ||
2433 | { | ||
2434 | handlerParcelBuy(parcel.AgentData.AgentID, parcel.Data.GroupID, parcel.Data.Final, parcel.Data.IsGroupOwned, | ||
2435 | parcel.Data.RemoveContribution, parcel.Data.LocalID, parcel.ParcelData.Area, parcel.ParcelData.Price, | ||
2436 | false); | ||
2437 | } | ||
2438 | return true; | ||
2439 | |||
2440 | } | ||
2441 | else | ||
2442 | { | ||
2443 | return false; | ||
2444 | } | ||
2445 | |||
2446 | } | ||
2447 | |||
2423 | private bool HandleViewerEffect(IClientAPI sender, Packet Pack) | 2448 | private bool HandleViewerEffect(IClientAPI sender, Packet Pack) |
2424 | { | 2449 | { |
2425 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; | 2450 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; |
diff --git a/OpenSim/Region/Environment/Interfaces/ILandObject.cs b/OpenSim/Region/Environment/Interfaces/ILandObject.cs index 61d8670..779db01 100644 --- a/OpenSim/Region/Environment/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Environment/Interfaces/ILandObject.cs | |||
@@ -48,6 +48,7 @@ namespace OpenSim.Region.Environment.Interfaces | |||
48 | void resetLandPrimCounts(); | 48 | void resetLandPrimCounts(); |
49 | void addPrimToCount(SceneObjectGroup obj); | 49 | void addPrimToCount(SceneObjectGroup obj); |
50 | void removePrimFromCount(SceneObjectGroup obj); | 50 | void removePrimFromCount(SceneObjectGroup obj); |
51 | void updateLandSold(LLUUID avatarID, LLUUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); | ||
51 | 52 | ||
52 | 53 | ||
53 | } | 54 | } |
diff --git a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs index aabb2d1..d950af9 100644 --- a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs | |||
@@ -39,12 +39,20 @@ using OpenSim.Region.Environment.Scenes; | |||
39 | using Nwc.XmlRpc; | 39 | using Nwc.XmlRpc; |
40 | 40 | ||
41 | using MoneyTransferArgs = OpenSim.Region.Environment.Scenes.EventManager.MoneyTransferArgs; | 41 | using MoneyTransferArgs = OpenSim.Region.Environment.Scenes.EventManager.MoneyTransferArgs; |
42 | using LandBuyArgs = OpenSim.Region.Environment.Scenes.EventManager.LandBuyArgs; | ||
42 | 43 | ||
43 | namespace OpenSim.Region.Environment.Modules | 44 | namespace OpenSim.Region.Environment.Modules |
44 | { | 45 | { |
45 | /// <summary> | 46 | /// <summary> |
46 | /// Demo Economy/Money Module. This is not a production quality money/economy module! | 47 | /// Demo Economy/Money Module. This is not a production quality money/economy module! |
47 | /// This is a demo for you to use when making one that works for you. | 48 | /// This is a demo for you to use when making one that works for you. |
49 | /// // To use the following you need to add: | ||
50 | /// -helperuri <ADDRESS TO HERE OR grid MONEY SERVER> | ||
51 | /// to the command line parameters you use to start up your client | ||
52 | /// This commonly looks like -helperuri http://127.0.0.1:9000/ | ||
53 | /// | ||
54 | /// Centralized grid structure example using OpenSimWi Redux revision 9+ | ||
55 | /// svn co https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux | ||
48 | /// </summary> | 56 | /// </summary> |
49 | public class BetaGridLikeMoneyModule: IRegionModule | 57 | public class BetaGridLikeMoneyModule: IRegionModule |
50 | { | 58 | { |
@@ -134,6 +142,7 @@ namespace OpenSim.Region.Environment.Modules | |||
134 | if (m_MoneyAddress.Length > 0) | 142 | if (m_MoneyAddress.Length > 0) |
135 | { | 143 | { |
136 | // Centralized grid structure using OpenSimWi Redux revision 9+ | 144 | // Centralized grid structure using OpenSimWi Redux revision 9+ |
145 | // https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux | ||
137 | scene.AddXmlRPCHandler("dynamic_balance_update_request", GridMoneyUpdate); | 146 | scene.AddXmlRPCHandler("dynamic_balance_update_request", GridMoneyUpdate); |
138 | } | 147 | } |
139 | else | 148 | else |
@@ -165,6 +174,8 @@ namespace OpenSim.Region.Environment.Modules | |||
165 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | 174 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; |
166 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; | 175 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; |
167 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 176 | scene.EventManager.OnClientClosed += ClientLoggedOut; |
177 | scene.EventManager.OnLandBuy += ValidateLandBuy; | ||
178 | scene.EventManager.OnValidatedLandBuy += processLandBuy; | ||
168 | 179 | ||
169 | } | 180 | } |
170 | } | 181 | } |
@@ -329,6 +340,101 @@ namespace OpenSim.Region.Environment.Modules | |||
329 | } | 340 | } |
330 | } | 341 | } |
331 | 342 | ||
343 | private void ValidateLandBuy (Object osender, LandBuyArgs e) | ||
344 | { | ||
345 | LLUUID agentId = e.agentId; | ||
346 | int price = e.parcelPrice; | ||
347 | bool final = e.final; | ||
348 | |||
349 | int funds = 0; | ||
350 | |||
351 | if (m_MoneyAddress.Length > 0) | ||
352 | { | ||
353 | IClientAPI aClient = LocateClientObject(agentId); | ||
354 | if (aClient != null) | ||
355 | { | ||
356 | Scene s = LocateSceneClientIn(agentId); | ||
357 | if (s != null) | ||
358 | { | ||
359 | Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret); | ||
360 | if ((bool)hbinfo["success"] == true) | ||
361 | { | ||
362 | |||
363 | Helpers.TryParse((string)hbinfo["agentId"], out agentId); | ||
364 | try | ||
365 | { | ||
366 | funds = (Int32)hbinfo["funds"]; | ||
367 | } | ||
368 | catch (ArgumentException) | ||
369 | { | ||
370 | } | ||
371 | catch (FormatException) | ||
372 | { | ||
373 | } | ||
374 | catch (OverflowException) | ||
375 | { | ||
376 | m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId); | ||
377 | aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable"); | ||
378 | } | ||
379 | catch (InvalidCastException) | ||
380 | { | ||
381 | funds = 0; | ||
382 | } | ||
383 | |||
384 | SetLocalFundsForAgentID(agentId, funds); | ||
385 | |||
386 | } | ||
387 | else | ||
388 | { | ||
389 | m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]); | ||
390 | aClient.SendAlertMessage((string)hbinfo["errorMessage"]); | ||
391 | } | ||
392 | } | ||
393 | } | ||
394 | } | ||
395 | else | ||
396 | { | ||
397 | funds = GetFundsForAgentID(agentId); | ||
398 | } | ||
399 | if (funds >= e.parcelPrice) | ||
400 | { | ||
401 | lock (e) | ||
402 | { | ||
403 | e.economyValidated = true; | ||
404 | } | ||
405 | XMLRPCHandler.EventManager.TriggerValidatedLandBuy(this, e); | ||
406 | } | ||
407 | } | ||
408 | |||
409 | private void processLandBuy(Object osender, LandBuyArgs e) | ||
410 | { | ||
411 | LLUUID agentId = e.agentId; | ||
412 | int price = e.parcelPrice; | ||
413 | bool final = e.final; | ||
414 | |||
415 | int funds = 0; | ||
416 | |||
417 | // Only do this if we have not already transacted against this. | ||
418 | if (e.transactionID == 0) | ||
419 | { | ||
420 | funds = GetFundsForAgentID(e.agentId); | ||
421 | if (e.landValidated) | ||
422 | { | ||
423 | if (e.parcelPrice >= 0) | ||
424 | { | ||
425 | doMoneyTranfer(agentId, e.parcelOwnerID, e.parcelPrice); | ||
426 | lock (e) | ||
427 | { | ||
428 | e.transactionID = Util.UnixTimeSinceEpoch(); | ||
429 | e.amountDebited = e.parcelPrice; | ||
430 | } | ||
431 | } | ||
432 | // This tells the land module that we've transacted. | ||
433 | XMLRPCHandler.EventManager.TriggerValidatedLandBuy(this, e); | ||
434 | } | ||
435 | } | ||
436 | |||
437 | } | ||
332 | /// <summary> | 438 | /// <summary> |
333 | /// THis method gets called when someone pays someone else as a gift. | 439 | /// THis method gets called when someone pays someone else as a gift. |
334 | /// </summary> | 440 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs index ba5a098..a46895e 100644 --- a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs | |||
@@ -1,7 +1,33 @@ | |||
1 | using System; | 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 OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | using System.Text; | 30 | using System.Text; |
4 | |||
5 | using Axiom.Math; | 31 | using Axiom.Math; |
6 | using libsecondlife; | 32 | using libsecondlife; |
7 | using libsecondlife.Packets; | 33 | using libsecondlife.Packets; |
@@ -11,6 +37,8 @@ using OpenSim.Region.Environment.Scenes; | |||
11 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
12 | using OpenSim.Region.Physics.Manager; | 38 | using OpenSim.Region.Physics.Manager; |
13 | 39 | ||
40 | using LandBuyArgs = OpenSim.Region.Environment.Scenes.EventManager.LandBuyArgs; | ||
41 | |||
14 | namespace OpenSim.Region.Environment.Modules.LandManagement | 42 | namespace OpenSim.Region.Environment.Modules.LandManagement |
15 | { | 43 | { |
16 | public class LandChannel : ILandChannel | 44 | public class LandChannel : ILandChannel |
@@ -232,6 +260,18 @@ namespace OpenSim.Region.Environment.Modules.LandManagement | |||
232 | } | 260 | } |
233 | } | 261 | } |
234 | 262 | ||
263 | public ILandObject getLandObject(int parcelLocalID) | ||
264 | { | ||
265 | lock (landList) | ||
266 | { | ||
267 | if (landList.ContainsKey(parcelLocalID)) | ||
268 | { | ||
269 | return landList[parcelLocalID]; | ||
270 | } | ||
271 | } | ||
272 | return null; | ||
273 | } | ||
274 | |||
235 | public ILandObject getLandObject(int x, int y) | 275 | public ILandObject getLandObject(int x, int y) |
236 | { | 276 | { |
237 | if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) | 277 | if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) |
@@ -657,6 +697,7 @@ namespace OpenSim.Region.Environment.Modules.LandManagement | |||
657 | if (landList.ContainsKey(packet.ParcelData.LocalID)) | 697 | if (landList.ContainsKey(packet.ParcelData.LocalID)) |
658 | { | 698 | { |
659 | landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); | 699 | landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); |
700 | |||
660 | } | 701 | } |
661 | } | 702 | } |
662 | 703 | ||
@@ -912,5 +953,49 @@ namespace OpenSim.Region.Environment.Modules.LandManagement | |||
912 | } | 953 | } |
913 | } | 954 | } |
914 | 955 | ||
956 | public void handleLandBuyRequest(Object o, LandBuyArgs e) | ||
957 | { | ||
958 | if (e.economyValidated && e.landValidated) | ||
959 | { | ||
960 | lock (landList) | ||
961 | { | ||
962 | if (landList.ContainsKey(e.parcelLocalID)) | ||
963 | { | ||
964 | landList[e.parcelLocalID].updateLandSold(e.agentId, e.groupId, e.groupOwned, (uint)e.transactionID, e.parcelPrice, e.parcelArea); | ||
965 | return; | ||
966 | } | ||
967 | } | ||
968 | } | ||
969 | else if (e.landValidated == false) | ||
970 | { | ||
971 | ILandObject lob = null; | ||
972 | lock (landList) | ||
973 | { | ||
974 | if (landList.ContainsKey(e.parcelLocalID)) | ||
975 | { | ||
976 | lob = landList[e.parcelLocalID]; | ||
977 | } | ||
978 | } | ||
979 | if (lob != null) | ||
980 | { | ||
981 | LLUUID AuthorizedID = lob.landData.authBuyerID; | ||
982 | int saleprice = lob.landData.salePrice; | ||
983 | LLUUID pOwnerID = lob.landData.ownerID; | ||
984 | |||
985 | bool landforsale = ((lob.landData.landFlags & (uint)(libsecondlife.Parcel.ParcelFlags.ForSale | libsecondlife.Parcel.ParcelFlags.ForSaleObjects | libsecondlife.Parcel.ParcelFlags.SellParcelObjects)) != 0); | ||
986 | if ((AuthorizedID == LLUUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale) | ||
987 | { | ||
988 | lock (e) | ||
989 | { | ||
990 | e.parcelOwnerID = pOwnerID; | ||
991 | e.landValidated = true; | ||
992 | |||
993 | } | ||
994 | |||
995 | } | ||
996 | } | ||
997 | m_scene.EventManager.TriggerValidatedLandBuy(this, e); | ||
998 | } | ||
999 | } | ||
915 | } | 1000 | } |
916 | } | 1001 | } |
diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs index 614929b..6b2de47 100644 --- a/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs | |||
@@ -1,4 +1,31 @@ | |||
1 | using System; | 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 OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | using libsecondlife; | 30 | using libsecondlife; |
4 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
@@ -8,6 +35,8 @@ using OpenSim.Region.Environment.Scenes; | |||
8 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
9 | using Nini.Config; | 36 | using Nini.Config; |
10 | 37 | ||
38 | using LandBuyArgs = OpenSim.Region.Environment.Scenes.EventManager.LandBuyArgs; | ||
39 | |||
11 | namespace OpenSim.Region.Environment.Modules.LandManagement | 40 | namespace OpenSim.Region.Environment.Modules.LandManagement |
12 | { | 41 | { |
13 | public class LandManagementModule : IRegionModule | 42 | public class LandManagementModule : IRegionModule |
@@ -26,6 +55,8 @@ namespace OpenSim.Region.Environment.Modules.LandManagement | |||
26 | m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; | 55 | m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; |
27 | m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel); | 56 | m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel); |
28 | m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement); | 57 | m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement); |
58 | m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest; | ||
59 | m_scene.EventManager.OnValidatedLandBuy += landChannel.handleLandBuyRequest; | ||
29 | 60 | ||
30 | lock (m_scene) | 61 | lock (m_scene) |
31 | { | 62 | { |
diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs index 46ddf38..161434e 100644 --- a/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs | |||
@@ -256,12 +256,28 @@ namespace OpenSim.Region.Environment.Modules.LandManagement | |||
256 | newData.snapshotID = packet.ParcelData.SnapshotID; | 256 | newData.snapshotID = packet.ParcelData.SnapshotID; |
257 | newData.userLocation = packet.ParcelData.UserLocation; | 257 | newData.userLocation = packet.ParcelData.UserLocation; |
258 | newData.userLookAt = packet.ParcelData.UserLookAt; | 258 | newData.userLookAt = packet.ParcelData.UserLookAt; |
259 | 259 | ||
260 | m_scene.LandChannel.updateLandObject(landData.localID, newData); | 260 | m_scene.LandChannel.updateLandObject(landData.localID, newData); |
261 | 261 | ||
262 | sendLandUpdateToAvatarsOverMe(); | 262 | sendLandUpdateToAvatarsOverMe(); |
263 | } | 263 | } |
264 | } | 264 | } |
265 | public void updateLandSold(LLUUID avatarID, LLUUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) | ||
266 | { | ||
267 | LandData newData = landData.Copy(); | ||
268 | newData.ownerID = avatarID; | ||
269 | newData.groupID = groupID; | ||
270 | newData.isGroupOwned = groupOwned; | ||
271 | //newData.auctionID = AuctionID; | ||
272 | newData.claimDate = Util.UnixTimeSinceEpoch(); | ||
273 | newData.claimPrice = claimprice; | ||
274 | newData.salePrice = 0; | ||
275 | newData.authBuyerID = LLUUID.Zero; | ||
276 | newData.landFlags &= ~(uint)(libsecondlife.Parcel.ParcelFlags.ForSale | Parcel.ParcelFlags.ForSaleObjects | Parcel.ParcelFlags.SellParcelObjects); | ||
277 | m_scene.LandChannel.updateLandObject(landData.localID, newData); | ||
278 | |||
279 | sendLandUpdateToAvatarsOverMe(); | ||
280 | } | ||
265 | 281 | ||
266 | public bool isEitherBannedOrRestricted(LLUUID avatar) | 282 | public bool isEitherBannedOrRestricted(LLUUID avatar) |
267 | { | 283 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index ebdb0a6..1c36853 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -130,6 +130,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
130 | EventManager.TriggerMoneyTransfer(this, args); | 130 | EventManager.TriggerMoneyTransfer(this, args); |
131 | } | 131 | } |
132 | 132 | ||
133 | public virtual void ProcessParcelBuy(LLUUID agentId, LLUUID groupId, bool final, bool groupOwned, | ||
134 | bool removeContribution, int parcelLocalID, int parcelArea, int parcelPrice, bool authenticated) | ||
135 | { | ||
136 | EventManager.LandBuyArgs args = new EventManager.LandBuyArgs( | ||
137 | agentId, groupId, final, groupOwned, removeContribution, parcelLocalID, parcelArea, parcelPrice, authenticated); | ||
138 | |||
139 | m_eventManager.TriggerLandBuy(this, args); | ||
140 | } | ||
141 | |||
133 | public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | 142 | public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
134 | { | 143 | { |
135 | 144 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f15ec43..410120f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1001,8 +1001,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1001 | LLVector3 RayEnd = new LLVector3(0, 0, 0); | 1001 | LLVector3 RayEnd = new LLVector3(0, 0, 0); |
1002 | LLVector3 RayStart = new LLVector3(0, 0, 0); | 1002 | LLVector3 RayStart = new LLVector3(0, 0, 0); |
1003 | LLVector3 direction = new LLVector3(0, 0, -1); | 1003 | LLVector3 direction = new LLVector3(0, 0, -1); |
1004 | Vector3 AXOrigin = new Vector3(); | 1004 | //Vector3 AXOrigin = new Vector3(); |
1005 | Vector3 AXdirection = new Vector3(); | 1005 | //Vector3 AXdirection = new Vector3(); |
1006 | Ray testRay = new Ray(); | 1006 | Ray testRay = new Ray(); |
1007 | EntityIntersection rt = new EntityIntersection(); | 1007 | EntityIntersection rt = new EntityIntersection(); |
1008 | 1008 | ||
@@ -1573,6 +1573,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1573 | 1573 | ||
1574 | client.OnGrabObject += ProcessObjectGrab; | 1574 | client.OnGrabObject += ProcessObjectGrab; |
1575 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 1575 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
1576 | client.OnParcelBuy += ProcessParcelBuy; | ||
1576 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | 1577 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; |
1577 | client.OnPacketStats += AddPacketStats; | 1578 | client.OnPacketStats += AddPacketStats; |
1578 | 1579 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 02c9f3f..67edf6b 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
@@ -176,10 +176,50 @@ namespace OpenSim.Region.Environment.Scenes | |||
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | public class LandBuyArgs : System.EventArgs | ||
180 | { | ||
181 | public LLUUID agentId = LLUUID.Zero; | ||
182 | |||
183 | public LLUUID groupId = LLUUID.Zero; | ||
184 | |||
185 | public LLUUID parcelOwnerID = LLUUID.Zero; | ||
186 | |||
187 | public bool final = false; | ||
188 | public bool groupOwned = false; | ||
189 | public bool removeContribution = false; | ||
190 | public int parcelLocalID = 0; | ||
191 | public int parcelArea = 0; | ||
192 | public int parcelPrice = 0; | ||
193 | public bool authenticated = false; | ||
194 | public bool landValidated = false; | ||
195 | public bool economyValidated = false; | ||
196 | public int transactionID = 0; | ||
197 | public int amountDebited = 0; | ||
198 | |||
199 | |||
200 | public LandBuyArgs(LLUUID pagentId, LLUUID pgroupId, bool pfinal, bool pgroupOwned, | ||
201 | bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice, | ||
202 | bool pauthenticated) | ||
203 | { | ||
204 | agentId = pagentId; | ||
205 | groupId = pgroupId; | ||
206 | final = pfinal; | ||
207 | groupOwned = pgroupOwned; | ||
208 | removeContribution = premoveContribution; | ||
209 | parcelLocalID = pparcelLocalID; | ||
210 | parcelArea = pparcelArea; | ||
211 | parcelPrice = pparcelPrice; | ||
212 | authenticated = pauthenticated; | ||
213 | } | ||
214 | } | ||
215 | |||
179 | public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e); | 216 | public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e); |
180 | 217 | ||
181 | public event MoneyTransferEvent OnMoneyTransfer; | 218 | public delegate void LandBuy(Object sender, LandBuyArgs e); |
182 | 219 | ||
220 | public event MoneyTransferEvent OnMoneyTransfer; | ||
221 | public event LandBuy OnLandBuy; | ||
222 | public event LandBuy OnValidatedLandBuy; | ||
183 | 223 | ||
184 | /* Designated Event Deletage Instances */ | 224 | /* Designated Event Deletage Instances */ |
185 | 225 | ||
@@ -212,6 +252,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
212 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; | 252 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; |
213 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; | 253 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; |
214 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; | 254 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; |
255 | private LandBuy handlerLandBuy = null; | ||
256 | private LandBuy handlerValidatedLandBuy = null; | ||
215 | 257 | ||
216 | public void TriggerOnScriptChangedEvent(uint localID, uint change) | 258 | public void TriggerOnScriptChangedEvent(uint localID, uint change) |
217 | { | 259 | { |
@@ -476,5 +518,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
476 | handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel); | 518 | handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel); |
477 | } | 519 | } |
478 | } | 520 | } |
521 | public void TriggerLandBuy (Object sender, LandBuyArgs e) | ||
522 | { | ||
523 | handlerLandBuy = OnLandBuy; | ||
524 | if (handlerLandBuy != null) | ||
525 | { | ||
526 | handlerLandBuy(sender, e); | ||
527 | } | ||
528 | } | ||
529 | public void TriggerValidatedLandBuy(Object sender, LandBuyArgs e) | ||
530 | { | ||
531 | handlerValidatedLandBuy = OnValidatedLandBuy; | ||
532 | if (handlerValidatedLandBuy != null) | ||
533 | { | ||
534 | handlerValidatedLandBuy(sender, e); | ||
535 | } | ||
536 | } | ||
479 | } | 537 | } |
480 | } | 538 | } |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 9e9b52b..23b3015 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
49 | public event ObjectPermissions OnObjectPermissions; | 49 | public event ObjectPermissions OnObjectPermissions; |
50 | 50 | ||
51 | public event MoneyTransferRequest OnMoneyTransferRequest; | 51 | public event MoneyTransferRequest OnMoneyTransferRequest; |
52 | public event ParcelBuy OnParcelBuy; | ||
52 | public event Action<IClientAPI> OnConnectionClosed; | 53 | public event Action<IClientAPI> OnConnectionClosed; |
53 | 54 | ||
54 | public event ImprovedInstantMessage OnInstantMessage; | 55 | public event ImprovedInstantMessage OnInstantMessage; |