diff options
author | UbitUmarov | 2018-05-12 21:35:25 +0100 |
---|---|---|
committer | UbitUmarov | 2018-05-12 21:35:25 +0100 |
commit | fbb77274da777c7c0e0192f0e187045aa4399541 (patch) | |
tree | fe42364a4c41b8c1604a7009d99c4fe3e5f60851 | |
parent | let wearables check command suport variable number of wearables (diff) | |
download | opensim-SC-fbb77274da777c7c0e0192f0e187045aa4399541.zip opensim-SC-fbb77274da777c7c0e0192f0e187045aa4399541.tar.gz opensim-SC-fbb77274da777c7c0e0192f0e187045aa4399541.tar.bz2 opensim-SC-fbb77274da777c7c0e0192f0e187045aa4399541.tar.xz |
OOps my bad, always do deep copy, let viewers do v1 v2 fixes
-rw-r--r-- | OpenSim/Services/UserAccountService/UserAccountService.cs | 107 |
1 files changed, 54 insertions, 53 deletions
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 880517c..abd9bbf 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -878,72 +878,73 @@ namespace OpenSim.Services.UserAccountService | |||
878 | 878 | ||
879 | // Wearables | 879 | // Wearables |
880 | AvatarWearable basewearable; | 880 | AvatarWearable basewearable; |
881 | AvatarWearable newbasewearable; | ||
882 | WearableItem wearable; | 881 | WearableItem wearable; |
883 | 882 | ||
883 | AvatarWearable newbasewearable = new AvatarWearable(); | ||
884 | // copy wearables creating new inventory entries | 884 | // copy wearables creating new inventory entries |
885 | // converting from v1.0 wearables to v2.0 | ||
886 | for (int i = 0; i < wearables.Length; i++) | 885 | for (int i = 0; i < wearables.Length; i++) |
887 | { | 886 | { |
888 | basewearable = wearables[i]; | 887 | basewearable = wearables[i]; |
889 | if(basewearable == null || basewearable.Count == 0) | 888 | if(basewearable == null || basewearable.Count == 0) |
890 | continue; | 889 | continue; |
891 | 890 | ||
892 | newbasewearable = new AvatarWearable(); | 891 | newbasewearable.Clear(); |
893 | int j = basewearable.Count - 1; | 892 | for(int j = 0; j < basewearable.Count; j++) |
894 | |||
895 | wearable = basewearable[j]; | ||
896 | if (wearable.ItemID != UUID.Zero) | ||
897 | { | 893 | { |
898 | m_log.DebugFormat("[XXX]: Getting item {0} from avie {1}", wearable.ItemID, source); | 894 | wearable = basewearable[j]; |
899 | // Get inventory item and copy it | 895 | if (wearable.ItemID != UUID.Zero) |
900 | InventoryItemBase item = m_InventoryService.GetItem(source, wearable.ItemID); | ||
901 | |||
902 | if(item != null && item.AssetType == (int)AssetType.Link) | ||
903 | { | 896 | { |
904 | if(item.AssetID == UUID.Zero ) | 897 | m_log.DebugFormat("[XXX]: Getting item {0} from avie {1} for {2} {3}", |
905 | item = null; | 898 | wearable.ItemID, source, i, j); |
906 | else | 899 | // Get inventory item and copy it |
907 | item = m_InventoryService.GetItem(source, item.AssetID); | 900 | InventoryItemBase item = m_InventoryService.GetItem(source, wearable.ItemID); |
908 | } | ||
909 | 901 | ||
910 | if (item != null) | 902 | if(item != null && item.AssetType == (int)AssetType.Link) |
911 | { | 903 | { |
912 | InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); | 904 | if(item.AssetID == UUID.Zero ) |
913 | destinationItem.Name = item.Name; | 905 | item = null; |
914 | destinationItem.Owner = destination; | 906 | else |
915 | destinationItem.Description = item.Description; | 907 | item = m_InventoryService.GetItem(source, item.AssetID); |
916 | destinationItem.InvType = item.InvType; | 908 | } |
917 | destinationItem.CreatorId = item.CreatorId; | ||
918 | destinationItem.CreatorData = item.CreatorData; | ||
919 | destinationItem.NextPermissions = item.NextPermissions; | ||
920 | destinationItem.CurrentPermissions = item.CurrentPermissions; | ||
921 | destinationItem.BasePermissions = item.BasePermissions; | ||
922 | destinationItem.EveryOnePermissions = item.EveryOnePermissions; | ||
923 | destinationItem.GroupPermissions = item.GroupPermissions; | ||
924 | destinationItem.AssetType = item.AssetType; | ||
925 | destinationItem.AssetID = item.AssetID; | ||
926 | destinationItem.GroupID = item.GroupID; | ||
927 | destinationItem.GroupOwned = item.GroupOwned; | ||
928 | destinationItem.SalePrice = item.SalePrice; | ||
929 | destinationItem.SaleType = item.SaleType; | ||
930 | destinationItem.Flags = item.Flags; | ||
931 | destinationItem.CreationDate = item.CreationDate; | ||
932 | destinationItem.Folder = destinationFolder.ID; | ||
933 | ApplyNextOwnerPermissions(destinationItem); | ||
934 | |||
935 | m_InventoryService.AddItem(destinationItem); | ||
936 | m_log.DebugFormat("[USER ACCOUNT SERVICE]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); | ||
937 | |||
938 | // Wear item | ||
939 | newbasewearable.Add(destinationItem.ID,wearable.AssetID); | ||
940 | 909 | ||
941 | // Add to Current Outfit | 910 | if (item != null) |
942 | CreateCurrentOutfitLink((int)InventoryType.Wearable, item.Flags, item.Name, destinationItem.ID, destination, currentOutfitFolder.ID); | 911 | { |
943 | } | 912 | InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); |
944 | else | 913 | destinationItem.Name = item.Name; |
945 | { | 914 | destinationItem.Owner = destination; |
946 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); | 915 | destinationItem.Description = item.Description; |
916 | destinationItem.InvType = item.InvType; | ||
917 | destinationItem.CreatorId = item.CreatorId; | ||
918 | destinationItem.CreatorData = item.CreatorData; | ||
919 | destinationItem.NextPermissions = item.NextPermissions; | ||
920 | destinationItem.CurrentPermissions = item.CurrentPermissions; | ||
921 | destinationItem.BasePermissions = item.BasePermissions; | ||
922 | destinationItem.EveryOnePermissions = item.EveryOnePermissions; | ||
923 | destinationItem.GroupPermissions = item.GroupPermissions; | ||
924 | destinationItem.AssetType = item.AssetType; | ||
925 | destinationItem.AssetID = item.AssetID; | ||
926 | destinationItem.GroupID = item.GroupID; | ||
927 | destinationItem.GroupOwned = item.GroupOwned; | ||
928 | destinationItem.SalePrice = item.SalePrice; | ||
929 | destinationItem.SaleType = item.SaleType; | ||
930 | destinationItem.Flags = item.Flags; | ||
931 | destinationItem.CreationDate = item.CreationDate; | ||
932 | destinationItem.Folder = destinationFolder.ID; | ||
933 | ApplyNextOwnerPermissions(destinationItem); | ||
934 | |||
935 | m_InventoryService.AddItem(destinationItem); | ||
936 | m_log.DebugFormat("[USER ACCOUNT SERVICE]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); | ||
937 | |||
938 | // Wear item | ||
939 | newbasewearable.Add(destinationItem.ID,wearable.AssetID); | ||
940 | |||
941 | // Add to Current Outfit | ||
942 | CreateCurrentOutfitLink((int)InventoryType.Wearable, item.Flags, item.Name, destinationItem.ID, destination, currentOutfitFolder.ID); | ||
943 | } | ||
944 | else | ||
945 | { | ||
946 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); | ||
947 | } | ||
947 | } | 948 | } |
948 | } | 949 | } |
949 | avatarAppearance.SetWearable(i, newbasewearable); | 950 | avatarAppearance.SetWearable(i, newbasewearable); |