diff options
author | Teravus Ovares | 2008-04-23 22:44:59 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-23 22:44:59 +0000 |
commit | 1909d74d5fa8e6cea151bb5ff6b8e40b197b9f90 (patch) | |
tree | e2f37410f60a2b038c7ced800008491c7d0f1d88 | |
parent | * Add NUnit to CONTRIBUTORS file (diff) | |
download | opensim-SC-1909d74d5fa8e6cea151bb5ff6b8e40b197b9f90.zip opensim-SC-1909d74d5fa8e6cea151bb5ff6b8e40b197b9f90.tar.gz opensim-SC-1909d74d5fa8e6cea151bb5ff6b8e40b197b9f90.tar.bz2 opensim-SC-1909d74d5fa8e6cea151bb5ff6b8e40b197b9f90.tar.xz |
* Patch from Melanie. Mantis 0001037: Add various internal plumbing to the example economy module, implements llSetPayPrice(), money() and llGiveMoney() in scripts. Thanks Melanie!
* Moves module loading before the script engine so the script engine can pick up events from modules registering interfaces with scene.
Diffstat (limited to '')
-rw-r--r-- | CONTRIBUTORS.txt | 1 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 36 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs | 121 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 49 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | 28 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs | 2 |
10 files changed, 242 insertions, 11 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index c222689..adbe8cb 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -51,6 +51,7 @@ Patches | |||
51 | * krtaylor (IBM) | 51 | * krtaylor (IBM) |
52 | * A_Biondi | 52 | * A_Biondi |
53 | * lulurun | 53 | * lulurun |
54 | * Melanie Thielker | ||
54 | 55 | ||
55 | 56 | ||
56 | LSL Devs | 57 | LSL Devs |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index fce18c7..4faaad6 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -441,6 +441,7 @@ namespace OpenSim.Framework | |||
441 | public delegate void ObjectIncludeInSearch(IClientAPI remoteClient, bool IncludeInSearch, uint localID); | 441 | public delegate void ObjectIncludeInSearch(IClientAPI remoteClient, bool IncludeInSearch, uint localID); |
442 | 442 | ||
443 | public delegate void ScriptAnswer(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, int answer); | 443 | public delegate void ScriptAnswer(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, int answer); |
444 | public delegate void RequestPayPrice(IClientAPI remoteClient, LLUUID objectID); | ||
444 | 445 | ||
445 | public interface IClientAPI | 446 | public interface IClientAPI |
446 | { | 447 | { |
@@ -557,6 +558,7 @@ namespace OpenSim.Framework | |||
557 | event MoneyBalanceRequest OnMoneyBalanceRequest; | 558 | event MoneyBalanceRequest OnMoneyBalanceRequest; |
558 | event UpdateAvatarProperties OnUpdateAvatarProperties; | 559 | event UpdateAvatarProperties OnUpdateAvatarProperties; |
559 | event ParcelBuy OnParcelBuy; | 560 | event ParcelBuy OnParcelBuy; |
561 | event RequestPayPrice OnRequestPayPrice ; | ||
560 | 562 | ||
561 | event ObjectIncludeInSearch OnObjectIncludeInSearch; | 563 | event ObjectIncludeInSearch OnObjectIncludeInSearch; |
562 | 564 | ||
@@ -621,6 +623,7 @@ namespace OpenSim.Framework | |||
621 | void SendTeleportFailed(string reason); | 623 | void SendTeleportFailed(string reason); |
622 | void SendTeleportLocationStart(); | 624 | void SendTeleportLocationStart(); |
623 | void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); | 625 | void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); |
626 | void SendPayPrice(LLUUID objectID, int[] payPrice); | ||
624 | 627 | ||
625 | void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, | 628 | void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, |
626 | LLVector3 Pos, byte[] textureEntry, uint parentID); | 629 | LLVector3 Pos, byte[] textureEntry, uint parentID); |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index e3e0b4a..b0ca496 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -522,6 +522,10 @@ namespace OpenSim | |||
522 | m_log.Info("[MODULES]: Loading Region's modules"); | 522 | m_log.Info("[MODULES]: Loading Region's modules"); |
523 | 523 | ||
524 | List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, "."); | 524 | List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, "."); |
525 | // This needs to be ahead of the script engine load, so the | ||
526 | // script module can pick up events exposed by a module | ||
527 | m_moduleLoader.InitialiseSharedModules(scene); | ||
528 | |||
525 | //m_moduleLoader.PickupModules(scene, "ScriptEngines"); | 529 | //m_moduleLoader.PickupModules(scene, "ScriptEngines"); |
526 | //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); | 530 | //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); |
527 | 531 | ||
@@ -547,7 +551,6 @@ namespace OpenSim | |||
547 | } | 551 | } |
548 | } | 552 | } |
549 | 553 | ||
550 | m_moduleLoader.InitialiseSharedModules(scene); | ||
551 | scene.SetModuleInterfaces(); | 554 | scene.SetModuleInterfaces(); |
552 | 555 | ||
553 | //moved these here as the terrain texture has to be created after the modules are initialized | 556 | //moved these here as the terrain texture has to be created after the modules are initialized |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 9e8830f..216633f 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -234,6 +234,7 @@ namespace OpenSim.Region.ClientStack | |||
234 | private UUIDNameRequest handlerTeleportHomeRequest = null; | 234 | private UUIDNameRequest handlerTeleportHomeRequest = null; |
235 | 235 | ||
236 | private ScriptAnswer handlerScriptAnswer = null; | 236 | private ScriptAnswer handlerScriptAnswer = null; |
237 | private RequestPayPrice handlerRequestPayPrice = null; | ||
237 | 238 | ||
238 | /* Properties */ | 239 | /* Properties */ |
239 | 240 | ||
@@ -791,6 +792,7 @@ namespace OpenSim.Region.ClientStack | |||
791 | public event UUIDNameRequest OnTeleportHomeRequest; | 792 | public event UUIDNameRequest OnTeleportHomeRequest; |
792 | 793 | ||
793 | public event ScriptAnswer OnScriptAnswer; | 794 | public event ScriptAnswer OnScriptAnswer; |
795 | public event RequestPayPrice OnRequestPayPrice; | ||
794 | 796 | ||
795 | #region Scene/Avatar to Client | 797 | #region Scene/Avatar to Client |
796 | 798 | ||
@@ -1167,6 +1169,32 @@ namespace OpenSim.Region.ClientStack | |||
1167 | OutPacket(money, ThrottleOutPacketType.Task); | 1169 | OutPacket(money, ThrottleOutPacketType.Task); |
1168 | } | 1170 | } |
1169 | 1171 | ||
1172 | public void SendPayPrice(LLUUID objectID, int[] payPrice) | ||
1173 | { | ||
1174 | if(payPrice[0] == 0 && | ||
1175 | payPrice[1] == 0 && | ||
1176 | payPrice[2] == 0 && | ||
1177 | payPrice[3] == 0 && | ||
1178 | payPrice[4] == 0) | ||
1179 | return; | ||
1180 | |||
1181 | PayPriceReplyPacket payPriceReply = (PayPriceReplyPacket)PacketPool.Instance.GetPacket(PacketType.PayPriceReply); | ||
1182 | payPriceReply.ObjectData.ObjectID = objectID; | ||
1183 | payPriceReply.ObjectData.DefaultPayPrice = payPrice[0]; | ||
1184 | |||
1185 | payPriceReply.ButtonData=new PayPriceReplyPacket.ButtonDataBlock[4]; | ||
1186 | payPriceReply.ButtonData[0]=new PayPriceReplyPacket.ButtonDataBlock(); | ||
1187 | payPriceReply.ButtonData[0].PayButton = payPrice[1]; | ||
1188 | payPriceReply.ButtonData[1]=new PayPriceReplyPacket.ButtonDataBlock(); | ||
1189 | payPriceReply.ButtonData[1].PayButton = payPrice[2]; | ||
1190 | payPriceReply.ButtonData[2]=new PayPriceReplyPacket.ButtonDataBlock(); | ||
1191 | payPriceReply.ButtonData[2].PayButton = payPrice[3]; | ||
1192 | payPriceReply.ButtonData[3]=new PayPriceReplyPacket.ButtonDataBlock(); | ||
1193 | payPriceReply.ButtonData[3].PayButton = payPrice[4]; | ||
1194 | |||
1195 | OutPacket(payPriceReply, ThrottleOutPacketType.Task); | ||
1196 | } | ||
1197 | |||
1170 | public void SendStartPingCheck(byte seq) | 1198 | public void SendStartPingCheck(byte seq) |
1171 | { | 1199 | { |
1172 | StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck); | 1200 | StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck); |
@@ -4555,6 +4583,14 @@ namespace OpenSim.Region.ClientStack | |||
4555 | // TODO: handle this packet | 4583 | // TODO: handle this packet |
4556 | //m_log.Warn("[CLIENT]: unhandled EconomyDataRequest packet"); | 4584 | //m_log.Warn("[CLIENT]: unhandled EconomyDataRequest packet"); |
4557 | break; | 4585 | break; |
4586 | case PacketType.RequestPayPrice: | ||
4587 | RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack; | ||
4588 | handlerRequestPayPrice = OnRequestPayPrice; | ||
4589 | if (handlerRequestPayPrice != null) | ||
4590 | { | ||
4591 | handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID); | ||
4592 | } | ||
4593 | break; | ||
4558 | 4594 | ||
4559 | #endregion | 4595 | #endregion |
4560 | 4596 | ||
diff --git a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs index d5b2ea2..8e14ec5 100644 --- a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs | |||
@@ -53,8 +53,22 @@ namespace OpenSim.Region.Environment.Modules | |||
53 | /// Centralized grid structure example using OpenSimWi Redux revision 9+ | 53 | /// Centralized grid structure example using OpenSimWi Redux revision 9+ |
54 | /// svn co https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux | 54 | /// svn co https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux |
55 | /// </summary> | 55 | /// </summary> |
56 | public class BetaGridLikeMoneyModule: IRegionModule | 56 | |
57 | public delegate void ObjectPaid(LLUUID objectID, LLUUID agentID, int amount); | ||
58 | |||
59 | public interface IMoneyModule : IRegionModule | ||
60 | { | ||
61 | bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount); | ||
62 | |||
63 | event ObjectPaid OnObjectPaid; | ||
64 | } | ||
65 | |||
66 | public class BetaGridLikeMoneyModule: IMoneyModule | ||
57 | { | 67 | { |
68 | public event ObjectPaid OnObjectPaid; | ||
69 | |||
70 | private ObjectPaid handerOnObjectPaid; | ||
71 | |||
58 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 72 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
59 | 73 | ||
60 | /// <summary> | 74 | /// <summary> |
@@ -120,7 +134,7 @@ namespace OpenSim.Region.Environment.Modules | |||
120 | IConfig startupConfig = m_gConfig.Configs["Startup"]; | 134 | IConfig startupConfig = m_gConfig.Configs["Startup"]; |
121 | IConfig economyConfig = m_gConfig.Configs["Economy"]; | 135 | IConfig economyConfig = m_gConfig.Configs["Economy"]; |
122 | 136 | ||
123 | 137 | scene.RegisterModuleInterface<IMoneyModule>(this); | |
124 | 138 | ||
125 | ReadConfigAndPopulate(scene, startupConfig, "Startup"); | 139 | ReadConfigAndPopulate(scene, startupConfig, "Startup"); |
126 | ReadConfigAndPopulate(scene, economyConfig, "Economy"); | 140 | ReadConfigAndPopulate(scene, economyConfig, "Economy"); |
@@ -298,6 +312,7 @@ namespace OpenSim.Region.Environment.Modules | |||
298 | // Subscribe to Money messages | 312 | // Subscribe to Money messages |
299 | client.OnEconomyDataRequest += EconomyDataRequestHandler; | 313 | client.OnEconomyDataRequest += EconomyDataRequestHandler; |
300 | client.OnMoneyBalanceRequest += SendMoneyBalance; | 314 | client.OnMoneyBalanceRequest += SendMoneyBalance; |
315 | client.OnRequestPayPrice += requestPayPrice; | ||
301 | client.OnLogout += ClientClosed; | 316 | client.OnLogout += ClientClosed; |
302 | 317 | ||
303 | 318 | ||
@@ -305,6 +320,21 @@ namespace OpenSim.Region.Environment.Modules | |||
305 | 320 | ||
306 | #region event Handlers | 321 | #region event Handlers |
307 | 322 | ||
323 | public void requestPayPrice(IClientAPI client, LLUUID objectID) | ||
324 | { | ||
325 | Scene scene=LocateSceneClientIn(client.AgentId); | ||
326 | if(scene == null) | ||
327 | return; | ||
328 | |||
329 | SceneObjectPart task=scene.GetSceneObjectPart(objectID); | ||
330 | if(task == null) | ||
331 | return; | ||
332 | SceneObjectGroup group=task.ParentGroup; | ||
333 | SceneObjectPart root=group.RootPart; | ||
334 | |||
335 | client.SendPayPrice(objectID, root.PayPrice); | ||
336 | } | ||
337 | |||
308 | /// <summary> | 338 | /// <summary> |
309 | /// When the client closes the connection we remove their accounting info from memory to free up resources. | 339 | /// When the client closes the connection we remove their accounting info from memory to free up resources. |
310 | /// </summary> | 340 | /// </summary> |
@@ -400,6 +430,48 @@ namespace OpenSim.Region.Environment.Modules | |||
400 | IClientAPI sender = null; | 430 | IClientAPI sender = null; |
401 | IClientAPI receiver = null; | 431 | IClientAPI receiver = null; |
402 | 432 | ||
433 | if(m_MoneyAddress.Length > 0) // Handled on server | ||
434 | e.description=String.Empty; | ||
435 | |||
436 | if(e.transactiontype == 5008) // Object gets paid | ||
437 | { | ||
438 | sender = LocateClientObject(e.sender); | ||
439 | if (sender != null) | ||
440 | { | ||
441 | SceneObjectPart part=findPrim(e.receiver); | ||
442 | if(part == null) | ||
443 | return; | ||
444 | |||
445 | string name=resolveAgentName(part.OwnerID); | ||
446 | if(name == String.Empty) | ||
447 | name="(hippos)"; | ||
448 | |||
449 | receiver = LocateClientObject(part.OwnerID); | ||
450 | |||
451 | string description=String.Format("Paid {0} via object {1}", name, e.description); | ||
452 | bool transactionresult = doMoneyTransfer(e.sender, part.OwnerID, e.amount, e.transactiontype, description); | ||
453 | |||
454 | if(transactionresult) | ||
455 | { | ||
456 | ObjectPaid handlerOnObjectPaid = OnObjectPaid; | ||
457 | if(handlerOnObjectPaid != null) | ||
458 | { | ||
459 | handlerOnObjectPaid(e.receiver, e.sender, e.amount); | ||
460 | } | ||
461 | } | ||
462 | |||
463 | if (e.sender != e.receiver) | ||
464 | { | ||
465 | sender.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.sender)); | ||
466 | } | ||
467 | if(receiver != null) | ||
468 | { | ||
469 | receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(part.OwnerID)); | ||
470 | } | ||
471 | } | ||
472 | return; | ||
473 | } | ||
474 | |||
403 | sender = LocateClientObject(e.sender); | 475 | sender = LocateClientObject(e.sender); |
404 | if (sender != null) | 476 | if (sender != null) |
405 | { | 477 | { |
@@ -923,6 +995,51 @@ namespace OpenSim.Region.Environment.Modules | |||
923 | return MoneyRespData; | 995 | return MoneyRespData; |
924 | } | 996 | } |
925 | 997 | ||
998 | private SceneObjectPart findPrim(LLUUID objectID) | ||
999 | { | ||
1000 | lock (m_scenel) | ||
1001 | { | ||
1002 | foreach (Scene s in m_scenel.Values) | ||
1003 | { | ||
1004 | SceneObjectPart part=s.GetSceneObjectPart(objectID); | ||
1005 | if(part != null) | ||
1006 | { | ||
1007 | return part; | ||
1008 | } | ||
1009 | } | ||
1010 | } | ||
1011 | return null; | ||
1012 | } | ||
1013 | |||
1014 | private string resolveObjectName(LLUUID objectID) | ||
1015 | { | ||
1016 | SceneObjectPart part=findPrim(objectID); | ||
1017 | if(part != null) | ||
1018 | { | ||
1019 | return part.Name; | ||
1020 | } | ||
1021 | return String.Empty; | ||
1022 | } | ||
1023 | |||
1024 | private string resolveAgentName(LLUUID agentID) | ||
1025 | { | ||
1026 | // try avatar username surname | ||
1027 | Scene scene=GetRandomScene(); | ||
1028 | UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(agentID); | ||
1029 | if (profile != null) | ||
1030 | { | ||
1031 | string avatarname = profile.FirstName + " " + profile.SurName; | ||
1032 | return avatarname; | ||
1033 | } | ||
1034 | return String.Empty; | ||
1035 | } | ||
1036 | |||
1037 | public bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount) | ||
1038 | { | ||
1039 | string description=String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); | ||
1040 | return doMoneyTransfer(fromID, toID, amount, 2, description); | ||
1041 | } | ||
1042 | |||
926 | /// <summary> | 1043 | /// <summary> |
927 | /// Informs the Money Grid Server of a transfer. | 1044 | /// Informs the Money Grid Server of a transfer. |
928 | /// </summary> | 1045 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 9277954..ba851fc 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -96,6 +96,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
96 | public int SalePrice; | 96 | public int SalePrice; |
97 | public uint Category; | 97 | public uint Category; |
98 | 98 | ||
99 | // TODO: This needs to be persisted in next XML version update! | ||
100 | [XmlIgnore] public int[] PayPrice = {0,0,0,0,0}; | ||
99 | 101 | ||
100 | public Int32 CreationDate; | 102 | public Int32 CreationDate; |
101 | public uint ParentID = 0; | 103 | public uint ParentID = 0; |
@@ -2456,6 +2458,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2456 | info.AddValue("m_clickAction", m_clickAction); | 2458 | info.AddValue("m_clickAction", m_clickAction); |
2457 | info.AddValue("m_shape", m_shape); | 2459 | info.AddValue("m_shape", m_shape); |
2458 | info.AddValue("m_parentGroup", m_parentGroup); | 2460 | info.AddValue("m_parentGroup", m_parentGroup); |
2461 | info.AddValue("PayPrice", PayPrice); | ||
2459 | } | 2462 | } |
2460 | 2463 | ||
2461 | } | 2464 | } |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 4f9024c..c4409bc 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -167,6 +167,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
167 | public event UUIDNameRequest OnTeleportHomeRequest; | 167 | public event UUIDNameRequest OnTeleportHomeRequest; |
168 | 168 | ||
169 | public event ScriptAnswer OnScriptAnswer; | 169 | public event ScriptAnswer OnScriptAnswer; |
170 | public event RequestPayPrice OnRequestPayPrice; | ||
170 | 171 | ||
171 | 172 | ||
172 | #pragma warning restore 67 | 173 | #pragma warning restore 67 |
@@ -342,6 +343,10 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
342 | { | 343 | { |
343 | } | 344 | } |
344 | 345 | ||
346 | public virtual void SendPayPrice(LLUUID objectID, int[] payPrice) | ||
347 | { | ||
348 | } | ||
349 | |||
345 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, | 350 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, |
346 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | 351 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) |
347 | { | 352 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 09cd4af..2d1b02d 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -36,6 +36,7 @@ using libsecondlife; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Region.Environment; | 37 | using OpenSim.Region.Environment; |
38 | using OpenSim.Region.Environment.Interfaces; | 38 | using OpenSim.Region.Environment.Interfaces; |
39 | using OpenSim.Region.Environment.Modules; | ||
39 | using OpenSim.Region.Environment.Modules.LandManagement; | 40 | using OpenSim.Region.Environment.Modules.LandManagement; |
40 | using OpenSim.Region.Environment.Scenes; | 41 | using OpenSim.Region.Environment.Scenes; |
41 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | 42 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; |
@@ -1609,8 +1610,42 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1609 | 1610 | ||
1610 | public int llGiveMoney(string destination, int amount) | 1611 | public int llGiveMoney(string destination, int amount) |
1611 | { | 1612 | { |
1613 | LLUUID invItemID=InventorySelf(); | ||
1614 | if(invItemID == LLUUID.Zero) | ||
1615 | return 0; | ||
1616 | |||
1612 | m_host.AddScriptLPS(1); | 1617 | m_host.AddScriptLPS(1); |
1613 | NotImplemented("llGiveMoney"); | 1618 | |
1619 | if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) | ||
1620 | return 0; | ||
1621 | |||
1622 | if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) == 0) | ||
1623 | { | ||
1624 | LSLError("No permissions to give money"); | ||
1625 | return 0; | ||
1626 | } | ||
1627 | |||
1628 | LLUUID toID=new LLUUID(); | ||
1629 | |||
1630 | if(!LLUUID.TryParse(destination, out toID)) | ||
1631 | { | ||
1632 | LSLError("Bad key in llGiveMoney"); | ||
1633 | return 0; | ||
1634 | } | ||
1635 | |||
1636 | IMoneyModule money=World.RequestModuleInterface<IMoneyModule>(); | ||
1637 | |||
1638 | if(money == null) | ||
1639 | { | ||
1640 | NotImplemented("llGiveMoney"); | ||
1641 | return 0; | ||
1642 | } | ||
1643 | |||
1644 | bool result=money.ObjectGiveMoney(m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); | ||
1645 | |||
1646 | if(result) | ||
1647 | return 1; | ||
1648 | |||
1614 | return 0; | 1649 | return 0; |
1615 | } | 1650 | } |
1616 | 1651 | ||
@@ -5101,7 +5136,17 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5101 | public void llSetPayPrice(int price, LSL_Types.list quick_pay_buttons) | 5136 | public void llSetPayPrice(int price, LSL_Types.list quick_pay_buttons) |
5102 | { | 5137 | { |
5103 | m_host.AddScriptLPS(1); | 5138 | m_host.AddScriptLPS(1); |
5104 | NotImplemented("llSetPayPrice"); | 5139 | |
5140 | if(quick_pay_buttons.Data.Length != 4) | ||
5141 | { | ||
5142 | LSLError("List must have 4 elements"); | ||
5143 | return; | ||
5144 | } | ||
5145 | m_host.ParentGroup.RootPart.PayPrice[0]=price; | ||
5146 | m_host.ParentGroup.RootPart.PayPrice[1]=(int)quick_pay_buttons.Data[0]; | ||
5147 | m_host.ParentGroup.RootPart.PayPrice[2]=(int)quick_pay_buttons.Data[1]; | ||
5148 | m_host.ParentGroup.RootPart.PayPrice[3]=(int)quick_pay_buttons.Data[2]; | ||
5149 | m_host.ParentGroup.RootPart.PayPrice[4]=(int)quick_pay_buttons.Data[3]; | ||
5105 | } | 5150 | } |
5106 | 5151 | ||
5107 | public LSL_Types.Vector3 llGetCameraPos() | 5152 | public LSL_Types.Vector3 llGetCameraPos() |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index b4789a9..c2e3209 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | |||
@@ -28,6 +28,9 @@ | |||
28 | using System; | 28 | using System; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Region.Environment; | ||
32 | using OpenSim.Region.Environment.Modules; | ||
33 | using OpenSim.Region.Environment.Scenes; | ||
31 | 34 | ||
32 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | 35 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase |
33 | { | 36 | { |
@@ -68,6 +71,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
68 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | 71 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; |
69 | myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; | 72 | myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; |
70 | // TODO: HOOK ALL EVENTS UP TO SERVER! | 73 | // TODO: HOOK ALL EVENTS UP TO SERVER! |
74 | IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); | ||
75 | if(money != null) | ||
76 | { | ||
77 | money.OnObjectPaid+=HandleObjectPaid; | ||
78 | } | ||
79 | |||
71 | } | 80 | } |
72 | } | 81 | } |
73 | 82 | ||
@@ -75,6 +84,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
75 | { | 84 | { |
76 | } | 85 | } |
77 | 86 | ||
87 | private void HandleObjectPaid(LLUUID objectID, LLUUID agentID, int amount) | ||
88 | { | ||
89 | SceneObjectPart part=myScriptEngine.World.GetSceneObjectPart(objectID); | ||
90 | if(part != null) | ||
91 | { | ||
92 | money(part.LocalId, agentID, amount); | ||
93 | } | ||
94 | } | ||
95 | |||
78 | public void changed(uint localID, uint change) | 96 | public void changed(uint localID, uint change) |
79 | { | 97 | { |
80 | // Add to queue for all scripts in localID, Object pass change. | 98 | // Add to queue for all scripts in localID, Object pass change. |
@@ -112,6 +130,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
112 | ); | 130 | ); |
113 | } | 131 | } |
114 | 132 | ||
133 | public void money(uint localID, LLUUID agentID, int amount) | ||
134 | { | ||
135 | myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "money", EventQueueManager.llDetectNull, new object[] { agentID.ToString(), (int)amount }); | ||
136 | } | ||
137 | |||
115 | // TODO: Replace placeholders below | 138 | // TODO: Replace placeholders below |
116 | // NOTE! THE PARAMETERS FOR THESE FUNCTIONS ARE NOT CORRECT! | 139 | // NOTE! THE PARAMETERS FOR THESE FUNCTIONS ARE NOT CORRECT! |
117 | // These needs to be hooked up to OpenSim during init of this class | 140 | // These needs to be hooked up to OpenSim during init of this class |
@@ -194,11 +217,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
194 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control", EventQueueManager.llDetectNull); | 217 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control", EventQueueManager.llDetectNull); |
195 | } | 218 | } |
196 | 219 | ||
197 | public void money(uint localID, LLUUID itemID) | ||
198 | { | ||
199 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "money", EventQueueManager.llDetectNull); | ||
200 | } | ||
201 | |||
202 | public void email(uint localID, LLUUID itemID) | 220 | public void email(uint localID, LLUUID itemID) |
203 | { | 221 | { |
204 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "email", EventQueueManager.llDetectNull); | 222 | myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "email", EventQueueManager.llDetectNull); |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs index 1119fe8..ea17e20 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
55 | void sensor(uint localID, LLUUID itemID); | 55 | void sensor(uint localID, LLUUID itemID); |
56 | void no_sensor(uint localID, LLUUID itemID); | 56 | void no_sensor(uint localID, LLUUID itemID); |
57 | void control(uint localID, LLUUID itemID); | 57 | void control(uint localID, LLUUID itemID); |
58 | void money(uint localID, LLUUID itemID); | 58 | void money(uint LocalID, LLUUID agentID, int amount); |
59 | void email(uint localID, LLUUID itemID); | 59 | void email(uint localID, LLUUID itemID); |
60 | void at_target(uint localID, LLUUID itemID); | 60 | void at_target(uint localID, LLUUID itemID); |
61 | void not_at_target(uint localID, LLUUID itemID); | 61 | void not_at_target(uint localID, LLUUID itemID); |