aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs49
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs2
3 files changed, 71 insertions, 8 deletions
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;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Region.Environment; 37using OpenSim.Region.Environment;
38using OpenSim.Region.Environment.Interfaces; 38using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Environment.Modules;
39using OpenSim.Region.Environment.Modules.LandManagement; 40using OpenSim.Region.Environment.Modules.LandManagement;
40using OpenSim.Region.Environment.Scenes; 41using OpenSim.Region.Environment.Scenes;
41using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; 42using 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 @@
28using System; 28using System;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Environment;
32using OpenSim.Region.Environment.Modules;
33using OpenSim.Region.Environment.Scenes;
31 34
32namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase 35namespace 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);