diff options
author | Charles Krinke | 2008-06-26 02:46:29 +0000 |
---|---|---|
committer | Charles Krinke | 2008-06-26 02:46:29 +0000 |
commit | 1cd6b71b60d093b451ba03881ee31efd3eb29a50 (patch) | |
tree | 71e51114e772d9d9121a449a684e9c7f8a8e5a16 /OpenSim | |
parent | Minor refactoring of POS. Adds a Util.Clamp(x, min, max) function. (diff) | |
download | opensim-SC_OLD-1cd6b71b60d093b451ba03881ee31efd3eb29a50.zip opensim-SC_OLD-1cd6b71b60d093b451ba03881ee31efd3eb29a50.tar.gz opensim-SC_OLD-1cd6b71b60d093b451ba03881ee31efd3eb29a50.tar.bz2 opensim-SC_OLD-1cd6b71b60d093b451ba03881ee31efd3eb29a50.tar.xz |
Mantis#1594. Thank you, Melanie for a patch that:
Fixes:
- Wearable icon and name sreset to default on copy/paste
- Cache is not updated when renaming/moving folders
- Partial refactor to make inventory less dependen on AssetBase having a "Name" field
- Add llGiveInventoryList() function
Diffstat (limited to 'OpenSim')
4 files changed, 176 insertions, 52 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index d010bd5..3127bd6 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -380,6 +380,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
380 | baseFolder.Version = RootFolder.Version; | 380 | baseFolder.Version = RootFolder.Version; |
381 | 381 | ||
382 | m_commsManager.InventoryService.UpdateFolder(baseFolder); | 382 | m_commsManager.InventoryService.UpdateFolder(baseFolder); |
383 | |||
384 | InventoryFolderImpl folder=RootFolder.FindFolder(folderID); | ||
385 | if(folder != null) | ||
386 | { | ||
387 | folder.Name = name; | ||
388 | folder.ParentID = parentID; | ||
389 | } | ||
383 | } | 390 | } |
384 | else | 391 | else |
385 | { | 392 | { |
@@ -416,6 +423,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
416 | 423 | ||
417 | m_commsManager.InventoryService.MoveFolder(baseFolder); | 424 | m_commsManager.InventoryService.MoveFolder(baseFolder); |
418 | 425 | ||
426 | InventoryFolderImpl folder=RootFolder.FindFolder(folderID); | ||
427 | if(folder != null) | ||
428 | folder.ParentID = parentID; | ||
429 | |||
419 | return true; | 430 | return true; |
420 | } | 431 | } |
421 | else | 432 | else |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index b076855..05c0a28 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -88,61 +88,52 @@ namespace OpenSim.Region.Environment.Scenes | |||
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | /// <summary> | 91 | public void AddInventoryItem(LLUUID AgentID, InventoryItemBase item) |
92 | /// Add an inventory item to an avatar's inventory. | ||
93 | /// </summary> | ||
94 | /// <param name="remoteClient">The remote client controlling the avatar</param> | ||
95 | /// <param name="item">The item. This structure contains all the item metadata, including the folder | ||
96 | /// in which the item is to be placed.</param> | ||
97 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) | ||
98 | { | 92 | { |
99 | CachedUserInfo userInfo | 93 | CachedUserInfo userInfo |
100 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 94 | = CommsManager.UserProfileCacheService.GetUserDetails(AgentID); |
101 | 95 | ||
102 | if (userInfo != null) | 96 | if (userInfo != null) |
103 | { | 97 | { |
104 | userInfo.AddItem(item); | 98 | userInfo.AddItem(item); |
105 | remoteClient.SendInventoryItemCreateUpdate(item); | ||
106 | 99 | ||
107 | int userlevel = 0; | 100 | int userlevel = 0; |
108 | if (ExternalChecks.ExternalChecksCanBeGodLike(remoteClient.AgentId)) | 101 | if (ExternalChecks.ExternalChecksCanBeGodLike(AgentID)) |
109 | { | 102 | { |
110 | userlevel = 1; | 103 | userlevel = 1; |
111 | } | 104 | } |
112 | if (m_regInfo.MasterAvatarAssignedUUID == remoteClient.AgentId) | 105 | if (m_regInfo.MasterAvatarAssignedUUID == AgentID) |
113 | { | 106 | { |
114 | userlevel = 2; | 107 | userlevel = 2; |
115 | } | 108 | } |
116 | EventManager.TriggerOnNewInventoryItemUploadComplete(remoteClient.AgentId, item.AssetID, item.Name, userlevel); | 109 | EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel); |
117 | } | 110 | } |
118 | else | 111 | else |
119 | { | 112 | { |
120 | m_log.ErrorFormat( | 113 | m_log.ErrorFormat( |
121 | "[AGENT INVENTORY]: Agent {0} {1} was not found for add of item {2} {3}", | 114 | "[AGENT INVENTORY]: Agent {1} was not found for add of item {2} {3}", |
122 | remoteClient.Name, remoteClient.AgentId, item.Name, item.ID); | 115 | AgentID, item.Name, item.ID); |
123 | 116 | ||
124 | return; | 117 | return; |
125 | } | 118 | } |
126 | } | 119 | } |
127 | 120 | ||
128 | /// <summary> | 121 | /// <summary> |
129 | /// <see>AddInventoryItem(LLUUID, InventoryItemBase)</see> | 122 | /// Add an inventory item to an avatar's inventory. |
130 | /// </summary> | 123 | /// </summary> |
131 | /// <param name="avatarId">The ID of the avatar</param> | 124 | /// <param name="remoteClient">The remote client controlling the avatar</param> |
132 | /// <param name="item">The item. This structure contains all the item metadata, including the folder | 125 | /// <param name="item">The item. This structure contains all the item metadata, including the folder |
133 | /// in which the item is to be placed.</param> | 126 | /// in which the item is to be placed.</param> |
134 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) | 127 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) |
135 | { | 128 | { |
136 | ScenePresence avatar; | 129 | CachedUserInfo userInfo |
130 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
137 | 131 | ||
138 | if (!TryGetAvatar(avatarId, out avatar)) | 132 | if (userInfo != null) |
139 | { | 133 | { |
140 | m_log.ErrorFormat( | 134 | AddInventoryItem(remoteClient.AgentId, item); |
141 | "[AGENT INVENTORY]: Could not find avatar {0} to add inventory item", avatarId); | 135 | remoteClient.SendInventoryItemCreateUpdate(item); |
142 | return; | ||
143 | } | 136 | } |
144 | |||
145 | AddInventoryItem(avatar.ControllingClient, item); | ||
146 | } | 137 | } |
147 | 138 | ||
148 | /// <summary> | 139 | /// <summary> |
@@ -517,13 +508,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
517 | if (remoteClient.AgentId == oldAgentID) | 508 | if (remoteClient.AgentId == oldAgentID) |
518 | { | 509 | { |
519 | CreateNewInventoryItem( | 510 | CreateNewInventoryItem( |
520 | remoteClient, newFolderID, callbackID, asset, (sbyte)item.InvType, | 511 | remoteClient, newFolderID, item.Name, item.Flags, callbackID, asset, (sbyte)item.InvType, |
521 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions); | 512 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions); |
522 | } | 513 | } |
523 | else | 514 | else |
524 | { | 515 | { |
525 | CreateNewInventoryItem( | 516 | CreateNewInventoryItem( |
526 | remoteClient, newFolderID, callbackID, asset, (sbyte)item.InvType, | 517 | remoteClient, newFolderID, item.Name, item.Flags, callbackID, asset, (sbyte)item.InvType, |
527 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions); | 518 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions); |
528 | } | 519 | } |
529 | } | 520 | } |
@@ -619,11 +610,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
619 | /// <param name="asset"></param> | 610 | /// <param name="asset"></param> |
620 | /// <param name="invType"></param> | 611 | /// <param name="invType"></param> |
621 | /// <param name="nextOwnerMask"></param> | 612 | /// <param name="nextOwnerMask"></param> |
622 | private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, | 613 | private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, string name, uint flags, uint callbackID, |
623 | AssetBase asset, sbyte invType, uint nextOwnerMask) | 614 | AssetBase asset, sbyte invType, uint nextOwnerMask) |
624 | { | 615 | { |
625 | CreateNewInventoryItem( | 616 | CreateNewInventoryItem( |
626 | remoteClient, folderID, callbackID, asset, invType, | 617 | remoteClient, folderID, name, flags, callbackID, asset, invType, |
627 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask); | 618 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask); |
628 | } | 619 | } |
629 | 620 | ||
@@ -637,7 +628,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
637 | /// <param name="invType"></param> | 628 | /// <param name="invType"></param> |
638 | /// <param name="nextOwnerMask"></param> | 629 | /// <param name="nextOwnerMask"></param> |
639 | private void CreateNewInventoryItem( | 630 | private void CreateNewInventoryItem( |
640 | IClientAPI remoteClient, LLUUID folderID, uint callbackID, AssetBase asset, sbyte invType, | 631 | IClientAPI remoteClient, LLUUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, |
641 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask) | 632 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask) |
642 | { | 633 | { |
643 | CachedUserInfo userInfo | 634 | CachedUserInfo userInfo |
@@ -651,7 +642,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
651 | item.ID = LLUUID.Random(); | 642 | item.ID = LLUUID.Random(); |
652 | item.AssetID = asset.FullID; | 643 | item.AssetID = asset.FullID; |
653 | item.Description = asset.Description; | 644 | item.Description = asset.Description; |
654 | item.Name = asset.Name; | 645 | item.Name = name; |
646 | item.Flags = flags; | ||
655 | item.AssetType = asset.Type; | 647 | item.AssetType = asset.Type; |
656 | item.InvType = invType; | 648 | item.InvType = invType; |
657 | item.Folder = folderID; | 649 | item.Folder = folderID; |
@@ -715,7 +707,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
715 | AssetBase asset = CreateAsset(name, description, assetType, data); | 707 | AssetBase asset = CreateAsset(name, description, assetType, data); |
716 | AssetCache.AddAsset(asset); | 708 | AssetCache.AddAsset(asset); |
717 | 709 | ||
718 | CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, invType, nextOwnerMask); | 710 | CreateNewInventoryItem(remoteClient, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask); |
719 | } | 711 | } |
720 | else | 712 | else |
721 | { | 713 | { |
@@ -864,38 +856,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
864 | } | 856 | } |
865 | } | 857 | } |
866 | 858 | ||
867 | /// <summary> | 859 | private InventoryItemBase CreateAgentInventoryItemFromTask(LLUUID destAgent, SceneObjectPart part, LLUUID itemId) |
868 | /// Move the given item in the given prim to a folder in the client's inventory | ||
869 | /// </summary> | ||
870 | /// <param name="remoteClient"></param> | ||
871 | /// <param name="folderID"></param> | ||
872 | /// <param name="part"></param> | ||
873 | /// <param name="itemID"></param> | ||
874 | public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, SceneObjectPart part, LLUUID itemId) | ||
875 | { | 860 | { |
876 | |||
877 | TaskInventoryItem taskItem = part.GetInventoryItem(itemId); | 861 | TaskInventoryItem taskItem = part.GetInventoryItem(itemId); |
878 | 862 | ||
879 | if (null == taskItem) | 863 | if (null == taskItem) |
880 | { | 864 | { |
881 | // Console already notified of error in GetInventoryItem | 865 | // Console already notified of error in GetInventoryItem |
882 | return; | 866 | return null; |
883 | } | 867 | } |
884 | 868 | ||
885 | InventoryItemBase agentItem = new InventoryItemBase(); | 869 | InventoryItemBase agentItem = new InventoryItemBase(); |
886 | 870 | ||
887 | agentItem.ID = LLUUID.Random(); | 871 | agentItem.ID = LLUUID.Random(); |
888 | agentItem.Creator = taskItem.CreatorID; | 872 | agentItem.Creator = taskItem.CreatorID; |
889 | agentItem.Owner = remoteClient.AgentId; | 873 | agentItem.Owner = destAgent; |
890 | agentItem.AssetID = taskItem.AssetID; | 874 | agentItem.AssetID = taskItem.AssetID; |
891 | agentItem.Description = taskItem.Description; | 875 | agentItem.Description = taskItem.Description; |
892 | agentItem.Name = taskItem.Name; | 876 | agentItem.Name = taskItem.Name; |
893 | agentItem.AssetType = taskItem.Type; | 877 | agentItem.AssetType = taskItem.Type; |
894 | agentItem.InvType = taskItem.InvType; | 878 | agentItem.InvType = taskItem.InvType; |
895 | agentItem.Folder = folderId; | ||
896 | agentItem.Flags = taskItem.Flags; | 879 | agentItem.Flags = taskItem.Flags; |
897 | 880 | ||
898 | if ((remoteClient.AgentId != taskItem.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) | 881 | if ((destAgent != taskItem.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) |
899 | { | 882 | { |
900 | agentItem.BasePermissions = taskItem.NextOwnerMask; | 883 | agentItem.BasePermissions = taskItem.NextOwnerMask; |
901 | agentItem.CurrentPermissions = taskItem.NextOwnerMask; | 884 | agentItem.CurrentPermissions = taskItem.NextOwnerMask; |
@@ -910,13 +893,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
910 | agentItem.EveryOnePermissions = taskItem.EveryoneMask; | 893 | agentItem.EveryOnePermissions = taskItem.EveryoneMask; |
911 | } | 894 | } |
912 | 895 | ||
913 | AddInventoryItem(remoteClient, agentItem); | ||
914 | if (!ExternalChecks.ExternalChecksBypassPermissions()) | 896 | if (!ExternalChecks.ExternalChecksBypassPermissions()) |
915 | { | 897 | { |
916 | if ((taskItem.OwnerMask & (uint)PermissionMask.Copy) == 0) | 898 | if ((taskItem.OwnerMask & (uint)PermissionMask.Copy) == 0) |
917 | part.RemoveInventoryItem(itemId); | 899 | part.RemoveInventoryItem(itemId); |
918 | } | 900 | } |
919 | 901 | ||
902 | return agentItem; | ||
903 | } | ||
904 | |||
905 | /// <summary> | ||
906 | /// Move the given item in the given prim to a folder in the client's inventory | ||
907 | /// </summary> | ||
908 | /// <param name="remoteClient"></param> | ||
909 | /// <param name="folderID"></param> | ||
910 | /// <param name="part"></param> | ||
911 | /// <param name="itemID"></param> | ||
912 | public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, SceneObjectPart part, LLUUID itemId) | ||
913 | { | ||
914 | |||
915 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId); | ||
916 | |||
917 | agentItem.Folder = folderId; | ||
918 | AddInventoryItem(remoteClient, agentItem); | ||
920 | } | 919 | } |
921 | 920 | ||
922 | /// <summary> | 921 | /// <summary> |
@@ -964,14 +963,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
964 | 963 | ||
965 | if (TryGetAvatar(avatarId, out avatar)) | 964 | if (TryGetAvatar(avatarId, out avatar)) |
966 | { | 965 | { |
967 | MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); | 966 | MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); |
968 | } | 967 | } |
969 | else | 968 | else |
970 | { | 969 | { |
971 | m_log.ErrorFormat( | 970 | CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(avatarId); |
972 | "[PRIM INVENTORY]: " + | 971 | if(profile == null || profile.RootFolder == null) |
973 | "Avatar {0} cannot be found to update its prim item asset", | 972 | { |
974 | avatarId); | 973 | m_log.ErrorFormat( |
974 | "[PRIM INVENTORY]: " + | ||
975 | "Avatar {0} cannot be found to add item", | ||
976 | avatarId); | ||
977 | } | ||
978 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); | ||
979 | agentItem.Folder = folderId; | ||
980 | |||
981 | AddInventoryItem(avatarId, agentItem); | ||
975 | } | 982 | } |
976 | } | 983 | } |
977 | 984 | ||
@@ -1047,6 +1054,41 @@ namespace OpenSim.Region.Environment.Scenes | |||
1047 | 1054 | ||
1048 | } | 1055 | } |
1049 | 1056 | ||
1057 | public void MoveTaskInventoryItems(LLUUID destID, string category, SceneObjectPart host, List<LLUUID> items) | ||
1058 | { | ||
1059 | CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(destID); | ||
1060 | if(profile == null || profile.RootFolder == null) | ||
1061 | { | ||
1062 | m_log.ErrorFormat( | ||
1063 | "[PRIM INVENTORY]: " + | ||
1064 | "Avatar {0} cannot be found to add items", | ||
1065 | destID); | ||
1066 | return; | ||
1067 | } | ||
1068 | |||
1069 | LLUUID newFolderID = LLUUID.Random(); | ||
1070 | |||
1071 | profile.CreateFolder(category, newFolderID, 0xffff, profile.RootFolder.ID); | ||
1072 | |||
1073 | foreach (LLUUID itemID in items) | ||
1074 | { | ||
1075 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID); | ||
1076 | agentItem.Folder = newFolderID; | ||
1077 | |||
1078 | AddInventoryItem(destID, agentItem); | ||
1079 | } | ||
1080 | |||
1081 | ScenePresence avatar; | ||
1082 | |||
1083 | if (TryGetAvatar(destID, out avatar)) | ||
1084 | { | ||
1085 | profile.SendInventoryDecendents(avatar.ControllingClient, | ||
1086 | profile.RootFolder.ID, true, false); | ||
1087 | profile.SendInventoryDecendents(avatar.ControllingClient, | ||
1088 | newFolderID, false, true); | ||
1089 | } | ||
1090 | } | ||
1091 | |||
1050 | /// <summary> | 1092 | /// <summary> |
1051 | /// Update an item in a prim (task) inventory. | 1093 | /// Update an item in a prim (task) inventory. |
1052 | /// This method does not handle scripts, <see>RezScript(IClientAPI, LLUUID, unit)</see> | 1094 | /// 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 a9d1309..366b20c 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -4374,10 +4374,45 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4374 | NotImplemented("llGroundRepel"); | 4374 | NotImplemented("llGroundRepel"); |
4375 | } | 4375 | } |
4376 | 4376 | ||
4377 | private LLUUID GetTaskInventoryItem(string name) | ||
4378 | { | ||
4379 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
4380 | { | ||
4381 | if(inv.Value.Name == name) | ||
4382 | return inv.Key; | ||
4383 | } | ||
4384 | return LLUUID.Zero; | ||
4385 | } | ||
4386 | |||
4377 | public void llGiveInventoryList(string destination, string category, LSL_Types.list inventory) | 4387 | public void llGiveInventoryList(string destination, string category, LSL_Types.list inventory) |
4378 | { | 4388 | { |
4379 | m_host.AddScriptLPS(1); | 4389 | m_host.AddScriptLPS(1); |
4380 | NotImplemented("llGiveInventoryList"); | 4390 | |
4391 | LLUUID destID; | ||
4392 | if(!LLUUID.TryParse(destination, out destID)) | ||
4393 | return; | ||
4394 | |||
4395 | List<LLUUID> itemList = new List<LLUUID>(); | ||
4396 | |||
4397 | foreach (Object item in inventory.Data) | ||
4398 | { | ||
4399 | LLUUID itemID; | ||
4400 | if(LLUUID.TryParse(item.ToString(), out itemID)) | ||
4401 | { | ||
4402 | itemList.Add(itemID); | ||
4403 | } | ||
4404 | else | ||
4405 | { | ||
4406 | itemID = GetTaskInventoryItem(item.ToString()); | ||
4407 | if(itemID != LLUUID.Zero) | ||
4408 | itemList.Add(itemID); | ||
4409 | } | ||
4410 | } | ||
4411 | |||
4412 | if(itemList.Count == 0) | ||
4413 | return; | ||
4414 | |||
4415 | m_ScriptEngine.World.MoveTaskInventoryItems(destID, category, m_host, itemList); | ||
4381 | } | 4416 | } |
4382 | 4417 | ||
4383 | public void llSetVehicleType(int type) | 4418 | public void llSetVehicleType(int type) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 57c1e02..1d4a72e 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; |
@@ -4226,10 +4227,45 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4226 | NotImplemented("llGroundRepel"); | 4227 | NotImplemented("llGroundRepel"); |
4227 | } | 4228 | } |
4228 | 4229 | ||
4230 | private LLUUID GetTaskInventoryItem(string name) | ||
4231 | { | ||
4232 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
4233 | { | ||
4234 | if(inv.Value.Name == name) | ||
4235 | return inv.Key; | ||
4236 | } | ||
4237 | return LLUUID.Zero; | ||
4238 | } | ||
4239 | |||
4229 | public void llGiveInventoryList(string destination, string category, LSL_Types.list inventory) | 4240 | public void llGiveInventoryList(string destination, string category, LSL_Types.list inventory) |
4230 | { | 4241 | { |
4231 | m_host.AddScriptLPS(1); | 4242 | m_host.AddScriptLPS(1); |
4232 | NotImplemented("llGiveInventoryList"); | 4243 | |
4244 | LLUUID destID; | ||
4245 | if(!LLUUID.TryParse(destination, out destID)) | ||
4246 | return; | ||
4247 | |||
4248 | List<LLUUID> itemList = new List<LLUUID>(); | ||
4249 | |||
4250 | foreach (Object item in inventory.Data) | ||
4251 | { | ||
4252 | LLUUID itemID; | ||
4253 | if(LLUUID.TryParse(item.ToString(), out itemID)) | ||
4254 | { | ||
4255 | itemList.Add(itemID); | ||
4256 | } | ||
4257 | else | ||
4258 | { | ||
4259 | itemID = GetTaskInventoryItem(item.ToString()); | ||
4260 | if(itemID != LLUUID.Zero) | ||
4261 | itemList.Add(itemID); | ||
4262 | } | ||
4263 | } | ||
4264 | |||
4265 | if(itemList.Count == 0) | ||
4266 | return; | ||
4267 | |||
4268 | m_ScriptEngine.World.MoveTaskInventoryItems(destID, category, m_host, itemList); | ||
4233 | } | 4269 | } |
4234 | 4270 | ||
4235 | public void llSetVehicleType(int type) | 4271 | public void llSetVehicleType(int type) |