aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs114
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs39
2 files changed, 139 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index e6bae4c..3580b99 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -869,21 +869,10 @@ namespace OpenSim.Region.Environment.Scenes
869 /// </summary> 869 /// </summary>
870 /// <param name="remoteClient"></param> 870 /// <param name="remoteClient"></param>
871 /// <param name="folderID"></param> 871 /// <param name="folderID"></param>
872 /// <param name="primLocalID"></param> 872 /// <param name="part"></param>
873 /// <param name="itemID"></param> 873 /// <param name="itemID"></param>
874 public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId) 874 public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, SceneObjectPart part, LLUUID itemId)
875 { 875 {
876 SceneObjectPart part = GetSceneObjectPart(primLocalId);
877
878 if (null == part)
879 {
880 m_log.WarnFormat(
881 "[PRIM INVENTORY]: " +
882 "Move of inventory item {0} from prim with local id {1} failed because the prim could not be found",
883 itemId, primLocalId);
884
885 return;
886 }
887 876
888 TaskInventoryItem taskItem = part.GetInventoryItem(itemId); 877 TaskInventoryItem taskItem = part.GetInventoryItem(itemId);
889 878
@@ -934,7 +923,106 @@ namespace OpenSim.Region.Environment.Scenes
934 } 923 }
935 924
936 } 925 }
926
927 /// <summary>
928 /// <see>MoveTaskInventoryItem</see>
929 /// </summary>
930 /// <param name="remoteClient"></param>
931 /// <param name="folderID"></param>
932 /// <param name="primLocalID"></param>
933 /// <param name="itemID"></param>
934 public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId)
935 {
936 SceneObjectPart part = GetSceneObjectPart(primLocalId);
937
938 if (null == part)
939 {
940 m_log.WarnFormat(
941 "[PRIM INVENTORY]: " +
942 "Move of inventory item {0} from prim with local id {1} failed because the prim could not be found",
943 itemId, primLocalId);
944
945 return;
946 }
947 MoveTaskInventoryItem(remoteClient, folderId, part, itemId);
948 }
949
950 /// <summary>
951 /// <see>MoveTaskInventoryItem</see>
952 /// </summary>
953 /// <param name="remoteClient"></param>
954 /// <param name="folderID"></param>
955 /// <param name="part"></param>
956 /// <param name="itemID"></param>
957 public void MoveTaskInventoryItem(LLUUID avatarId, LLUUID folderId, SceneObjectPart part, LLUUID itemId)
958 {
959 ScenePresence avatar;
937 960
961 if (TryGetAvatar(avatarId, out avatar))
962 {
963 MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId);
964 }
965 else
966 {
967 m_log.ErrorFormat(
968 "[PRIM INVENTORY]: " +
969 "Avatar {0} cannot be found to update its prim item asset",
970 avatarId);
971 }
972 }
973
974 /// <summary>
975 /// Copy a task (prim) inventory item to another task (prim)
976 /// </summary>
977 /// <param name="destId"></param>
978 /// <param name="part"></param>
979 /// <param name="itemId"></param>
980 public void CopyTaskInventoryItem(LLUUID destId, SceneObjectPart part, LLUUID itemId)
981 {
982 TaskInventoryItem srcTaskItem = part.GetInventoryItem(itemId);
983
984 if(srcTaskItem == null)
985 {
986 // error was already logged
987 return;
988 }
989
990 SceneObjectPart destPart = GetSceneObjectPart(destId);
991
992 if(destPart == null)
993 {
994 m_log.ErrorFormat(
995 "[PRIM INVENTORY]: " +
996 "Could not find prim for ID {0}",
997 destId);
998 return;
999 }
1000
1001 TaskInventoryItem destTaskItem = new TaskInventoryItem();
1002
1003 destTaskItem.ItemID = LLUUID.Random();
1004 destTaskItem.CreatorID = srcTaskItem.CreatorID;
1005 destTaskItem.AssetID = srcTaskItem.AssetID;
1006 destTaskItem.GroupID = srcTaskItem.GroupID;
1007 destTaskItem.OwnerID = srcTaskItem.OwnerID;
1008 destTaskItem.ParentID = srcTaskItem.ParentID;
1009 destTaskItem.ParentPartID = srcTaskItem.ParentPartID;
1010
1011 destTaskItem.BaseMask = srcTaskItem.BaseMask;
1012 destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask;
1013 destTaskItem.GroupMask = srcTaskItem.GroupMask;
1014 destTaskItem.OwnerMask = srcTaskItem.OwnerMask;
1015 destTaskItem.Flags = srcTaskItem.Flags;
1016
1017 destTaskItem.Description = srcTaskItem.Description;
1018 destTaskItem.Name = srcTaskItem.Name;
1019 destTaskItem.InvType = srcTaskItem.InvType;
1020 destTaskItem.Type = srcTaskItem.Type;
1021
1022 destPart.AddInventoryItem(destTaskItem);
1023
1024 }
1025
938 /// <summary> 1026 /// <summary>
939 /// Update an item in a prim (task) inventory. 1027 /// Update an item in a prim (task) inventory.
940 /// This method does not handle scripts, <see>RezScript(IClientAPI, LLUUID, unit)</see> 1028 /// This method does not handle scripts, <see>RezScript(IClientAPI, LLUUID, unit)</see>
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 6f4e481..a4e473d 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -35,6 +35,7 @@ using Nini.Config;
35using Axiom.Math; 35using Axiom.Math;
36using libsecondlife; 36using libsecondlife;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications.Cache;
38using OpenSim.Region.Environment; 39using OpenSim.Region.Environment;
39using OpenSim.Region.Environment.Interfaces; 40using OpenSim.Region.Environment.Interfaces;
40using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; 41using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
@@ -2696,7 +2697,43 @@ namespace OpenSim.Region.ScriptEngine.Common
2696 public void llGiveInventory(string destination, string inventory) 2697 public void llGiveInventory(string destination, string inventory)
2697 { 2698 {
2698 m_host.AddScriptLPS(1); 2699 m_host.AddScriptLPS(1);
2699 NotImplemented("llGiveInventory not yet oh no!"); 2700 bool found = false;
2701 LLUUID destId = LLUUID.Zero;
2702 LLUUID objId = LLUUID.Zero;
2703
2704 if(!LLUUID.TryParse(destination, out destId))
2705 {
2706 llSay(0, "Could not parse key " + destination);
2707 return;
2708 }
2709
2710 // move the first object found with this inventory name
2711 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
2712 {
2713 if (inv.Value.Name == inventory)
2714 {
2715 found = true;
2716 objId = inv.Key;
2717 break;
2718 }
2719 }
2720
2721 // check if destination is an avatar
2722 if (World.GetScenePresence(destId) != null)
2723 {
2724 // destination is an avatar
2725 CachedUserInfo userInfo =
2726 World.CommsManager.UserProfileCacheService.GetUserDetails(destId);
2727 World.MoveTaskInventoryItem(destId,userInfo.RootFolder.ID, m_host, objId);
2728 }
2729 else
2730 {
2731 // destination is an object
2732 World.CopyTaskInventoryItem(destId, m_host, objId);
2733 }
2734
2735 if (!found)
2736 llSay(0, "Could not find object " + inventory);
2700 } 2737 }
2701 2738
2702 public void llRemoveInventory(string item) 2739 public void llRemoveInventory(string item)