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 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Merge branch 'bigmerge' of ssh://3dhosting.de/var/git/careminster into bigmerge (diff) | |
download | opensim-SC-797982ee11fd117e74ff3b09c7b74c1973062c8e.zip opensim-SC-797982ee11fd117e74ff3b09c7b74c1973062c8e.tar.gz opensim-SC-797982ee11fd117e74ff3b09c7b74c1973062c8e.tar.bz2 opensim-SC-797982ee11fd117e74ff3b09c7b74c1973062c8e.tar.xz |
Implement llTransferLindenDollars
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 77 |
1 files changed, 77 insertions, 0 deletions
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 | ||