diff options
author | Melanie | 2011-12-01 13:30:10 +0100 |
---|---|---|
committer | Melanie | 2011-12-01 13:30:10 +0100 |
commit | 797982ee11fd117e74ff3b09c7b74c1973062c8e (patch) | |
tree | 962a3d1c40f9c349bc667d7bd527704e38cd15c5 | |
parent | Merge branch 'bigmerge' of ssh://3dhosting.de/var/git/careminster into bigmerge (diff) | |
download | opensim-SC_OLD-797982ee11fd117e74ff3b09c7b74c1973062c8e.zip opensim-SC_OLD-797982ee11fd117e74ff3b09c7b74c1973062c8e.tar.gz opensim-SC_OLD-797982ee11fd117e74ff3b09c7b74c1973062c8e.tar.bz2 opensim-SC_OLD-797982ee11fd117e74ff3b09c7b74c1973062c8e.tar.xz |
Implement llTransferLindenDollars
4 files changed, 93 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2323335..df54ae2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1171,6 +1171,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1171 | if(m_hbRestarts > 10) | 1171 | if(m_hbRestarts > 10) |
1172 | Environment.Exit(1); | 1172 | Environment.Exit(1); |
1173 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | 1173 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); |
1174 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1175 | |||
1176 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1177 | proc.EnableRaisingEvents=false; | ||
1178 | proc.StartInfo.FileName = "/bin/kill"; | ||
1179 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1180 | proc.Start(); | ||
1181 | proc.WaitForExit(); | ||
1182 | Thread.Sleep(1000); | ||
1183 | Environment.Exit(1); | ||
1174 | HeartbeatThread.Abort(); | 1184 | HeartbeatThread.Abort(); |
1175 | Watchdog.AbortThread(HeartbeatThread.ManagedThreadId); | 1185 | Watchdog.AbortThread(HeartbeatThread.ManagedThreadId); |
1176 | HeartbeatThread = null; | 1186 | HeartbeatThread = null; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7518d01..7b4b653 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -11383,6 +11383,83 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11383 | new DetectParams[0])); | 11383 | new DetectParams[0])); |
11384 | } | 11384 | } |
11385 | 11385 | ||
11386 | public LSL_String llTransferLindenDollars(string destination, int amount) | ||
11387 | { | ||
11388 | UUID txn = UUID.Random(); | ||
11389 | |||
11390 | Util.FireAndForget(delegate(object x) | ||
11391 | { | ||
11392 | int replycode = 0; | ||
11393 | string replydata = String.Empty; | ||
11394 | |||
11395 | try | ||
11396 | { | ||
11397 | UUID invItemID=InventorySelf(); | ||
11398 | if (invItemID == UUID.Zero) | ||
11399 | { | ||
11400 | replydata = "SERVICE_ERROR"; | ||
11401 | return; | ||
11402 | } | ||
11403 | |||
11404 | m_host.AddScriptLPS(1); | ||
11405 | |||
11406 | m_host.TaskInventory.LockItemsForRead(true); | ||
11407 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | ||
11408 | m_host.TaskInventory.LockItemsForRead(false); | ||
11409 | |||
11410 | if (item.PermsGranter == UUID.Zero) | ||
11411 | { | ||
11412 | replydata = "MISSING_PERMISSION_DEBIT"; | ||
11413 | return; | ||
11414 | } | ||
11415 | |||
11416 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) | ||
11417 | { | ||
11418 | replydata = "MISSING_PERMISSION_DEBIT"; | ||
11419 | return; | ||
11420 | } | ||
11421 | |||
11422 | UUID toID = new UUID(); | ||
11423 | |||
11424 | if (!UUID.TryParse(destination, out toID)) | ||
11425 | { | ||
11426 | replydata = "INVALID_AGENT"; | ||
11427 | return; | ||
11428 | } | ||
11429 | |||
11430 | IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); | ||
11431 | |||
11432 | if (money == null) | ||
11433 | { | ||
11434 | replydata = "TRANSFERS_DISABLED"; | ||
11435 | return; | ||
11436 | } | ||
11437 | |||
11438 | bool result = money.ObjectGiveMoney( | ||
11439 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); | ||
11440 | |||
11441 | if (result) | ||
11442 | { | ||
11443 | replycode = 1; | ||
11444 | return; | ||
11445 | } | ||
11446 | |||
11447 | replydata = "LINDENDOLLAR_INSUFFICIENTFUNDS"; | ||
11448 | } | ||
11449 | finally | ||
11450 | { | ||
11451 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | ||
11452 | "transaction_result", new Object[] { | ||
11453 | new LSL_String(txn.ToString()), | ||
11454 | new LSL_Integer(replycode), | ||
11455 | new LSL_String(replydata) }, | ||
11456 | new DetectParams[0])); | ||
11457 | } | ||
11458 | }); | ||
11459 | |||
11460 | return txn.ToString(); | ||
11461 | } | ||
11462 | |||
11386 | #endregion | 11463 | #endregion |
11387 | } | 11464 | } |
11388 | 11465 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 4ad4123..e0027b2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -200,6 +200,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
200 | void llGiveInventory(string destination, string inventory); | 200 | void llGiveInventory(string destination, string inventory); |
201 | void llGiveInventoryList(string destination, string category, LSL_List inventory); | 201 | void llGiveInventoryList(string destination, string category, LSL_List inventory); |
202 | LSL_Integer llGiveMoney(string destination, int amount); | 202 | LSL_Integer llGiveMoney(string destination, int amount); |
203 | LSL_String llTransferLindenDollars(string destination, int amount); | ||
203 | void llGodLikeRezObject(string inventory, LSL_Vector pos); | 204 | void llGodLikeRezObject(string inventory, LSL_Vector pos); |
204 | LSL_Float llGround(LSL_Vector offset); | 205 | LSL_Float llGround(LSL_Vector offset); |
205 | LSL_Vector llGroundContour(LSL_Vector offset); | 206 | LSL_Vector llGroundContour(LSL_Vector offset); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index a88a1f4..c717589 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -846,6 +846,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
846 | return m_LSL_Functions.llGiveMoney(destination, amount); | 846 | return m_LSL_Functions.llGiveMoney(destination, amount); |
847 | } | 847 | } |
848 | 848 | ||
849 | public LSL_String llTransferLindenDollars(string destination, int amount) | ||
850 | { | ||
851 | return m_LSL_Functions.llTransferLindenDollars(destination, amount); | ||
852 | } | ||
853 | |||
849 | public void llGodLikeRezObject(string inventory, LSL_Vector pos) | 854 | public void llGodLikeRezObject(string inventory, LSL_Vector pos) |
850 | { | 855 | { |
851 | m_LSL_Functions.llGodLikeRezObject(inventory, pos); | 856 | m_LSL_Functions.llGodLikeRezObject(inventory, pos); |