diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7832633..7c6bcf7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -36,6 +36,7 @@ using Axiom.Math; | |||
36 | using libsecondlife; | 36 | using libsecondlife; |
37 | using OpenSim; | 37 | using OpenSim; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications.Cache; | ||
39 | using OpenSim.Region.Environment; | 40 | using OpenSim.Region.Environment; |
40 | using OpenSim.Region.Environment.Interfaces; | 41 | using OpenSim.Region.Environment.Interfaces; |
41 | using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; | 42 | using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; |
@@ -2549,7 +2550,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2549 | public void llGiveInventory(string destination, string inventory) | 2550 | public void llGiveInventory(string destination, string inventory) |
2550 | { | 2551 | { |
2551 | m_host.AddScriptLPS(1); | 2552 | m_host.AddScriptLPS(1); |
2552 | NotImplemented("llGiveInventory"); | 2553 | bool found = false; |
2554 | LLUUID destId = LLUUID.Zero; | ||
2555 | LLUUID objId = LLUUID.Zero; | ||
2556 | |||
2557 | if(!LLUUID.TryParse(destination, out destId)) | ||
2558 | { | ||
2559 | llSay(0, "Could not parse key " + destination); | ||
2560 | return; | ||
2561 | } | ||
2562 | |||
2563 | // move the first object found with this inventory name | ||
2564 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
2565 | { | ||
2566 | if (inv.Value.Name == inventory) | ||
2567 | { | ||
2568 | found = true; | ||
2569 | objId = inv.Key; | ||
2570 | break; | ||
2571 | } | ||
2572 | } | ||
2573 | |||
2574 | // check if destination is an avatar | ||
2575 | if (World.GetScenePresence(destId) != null) | ||
2576 | { | ||
2577 | // destination is an avatar | ||
2578 | CachedUserInfo userInfo = | ||
2579 | World.CommsManager.UserProfileCacheService.GetUserDetails(destId); | ||
2580 | World.MoveTaskInventoryItem(destId,userInfo.RootFolder.ID, m_host, objId); | ||
2581 | } | ||
2582 | else | ||
2583 | { | ||
2584 | // destination is an object | ||
2585 | World.MoveTaskInventoryItem(destId, m_host, objId); | ||
2586 | } | ||
2587 | |||
2588 | if (!found) | ||
2589 | llSay(0, "Could not find object " + inventory); | ||
2553 | } | 2590 | } |
2554 | 2591 | ||
2555 | public void llRemoveInventory(string item) | 2592 | public void llRemoveInventory(string item) |