aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs49
1 files changed, 24 insertions, 25 deletions
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
index 7adfdc2..c11e039 100644
--- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
@@ -14,20 +14,20 @@ namespace OpenSim.Region.Environment.Modules
14 private Scene m_scene = null; 14 private Scene m_scene = null;
15 private Dictionary<LLUUID, AvatarAppearance> m_avatarsClothes = new Dictionary<LLUUID, AvatarAppearance>(); 15 private Dictionary<LLUUID, AvatarAppearance> m_avatarsClothes = new Dictionary<LLUUID, AvatarAppearance>();
16 16
17 public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, 17 public bool TryGetInitialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
18 out byte[] visualParams) 18 out byte[] visualParams)
19 { 19 {
20 if (!m_avatarsClothes.ContainsKey(avatarId)) 20 if (m_avatarsClothes.ContainsKey(avatarId))
21 { 21 {
22 GetDefaultAvatarAppearance(out wearables, out visualParams); 22 visualParams = GetDefaultVisualParams();
23 AvatarAppearance wearing = new AvatarAppearance(wearables); 23 wearables = m_avatarsClothes[avatarId].IsWearing;
24 m_avatarsClothes[avatarId] = wearing;
25 return true; 24 return true;
26 } 25 }
27 else 26 else
28 { 27 {
29 visualParams = GetDefaultVisualParams(); 28 GetDefaultAvatarAppearance(out wearables, out visualParams);
30 wearables = m_avatarsClothes[avatarId].IsWearing; 29 AvatarAppearance wearing = new AvatarAppearance(wearables);
30 m_avatarsClothes[avatarId] = wearing;
31 return true; 31 return true;
32 } 32 }
33 } 33 }
@@ -76,29 +76,29 @@ namespace OpenSim.Region.Environment.Modules
76 IClientAPI clientView = (IClientAPI)sender; 76 IClientAPI clientView = (IClientAPI)sender;
77 //Todo look up the assetid from the inventory cache (or something) for each itemId that is in AvatarWearingArgs 77 //Todo look up the assetid from the inventory cache (or something) for each itemId that is in AvatarWearingArgs
78 // then store assetid and itemId and wearable type in a database 78 // then store assetid and itemId and wearable type in a database
79 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) 79 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
80 {
81 if (wear.Type < 13)
80 { 82 {
81 if (wear.Type < 13) 83 LLUUID assetId;
84 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
85 if (profile != null)
82 { 86 {
83 LLUUID assetId; 87 InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID);
84 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); 88 if (baseItem != null)
85 if (profile != null)
86 { 89 {
87 InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID); 90 assetId = baseItem.assetID;
88 if (baseItem != null) 91 //temporary dictionary storage. This should be storing to a database
92 if (m_avatarsClothes.ContainsKey(clientView.AgentId))
89 { 93 {
90 assetId = baseItem.assetID; 94 AvatarAppearance avWearing = m_avatarsClothes[clientView.AgentId];
91 //temporary dictionary storage. This should be storing to a database 95 avWearing.IsWearing[wear.Type].AssetID = assetId;
92 if (m_avatarsClothes.ContainsKey(clientView.AgentId)) 96 avWearing.IsWearing[wear.Type].ItemID = wear.ItemID;
93 {
94 AvatarAppearance avWearing = m_avatarsClothes[clientView.AgentId];
95 avWearing.IsWearing[wear.Type].AssetID = assetId;
96 avWearing.IsWearing[wear.Type].ItemID = wear.ItemID;
97 }
98 } 97 }
99 } 98 }
100 } 99 }
101 } 100 }
101 }
102 } 102 }
103 103
104 public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) 104 public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
@@ -155,5 +155,4 @@ namespace OpenSim.Region.Environment.Modules
155 } 155 }
156 } 156 }
157 } 157 }
158 158}
159} \ No newline at end of file