diff options
author | Diva Canto | 2009-08-13 11:30:29 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-13 11:30:29 -0700 |
commit | 6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75 (patch) | |
tree | 82b2f99cb17b12d2bae173e33065170200b49eae /OpenSim/Region/CoreModules/Avatar/AvatarFactory | |
parent | Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.zip opensim-SC_OLD-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.tar.gz opensim-SC_OLD-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.tar.bz2 opensim-SC_OLD-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.tar.xz |
Inventory redirects from CachedUserInfo to InventoryService COMPLETE!
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 33dc7a5..547f923 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -34,6 +34,7 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | ||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | 39 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory |
39 | { | 40 | { |
@@ -115,9 +116,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
115 | } | 116 | } |
116 | 117 | ||
117 | 118 | ||
118 | public void SetAppearanceAssets(CachedUserInfo profile, ref AvatarAppearance appearance) | 119 | public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) |
119 | { | 120 | { |
120 | if (profile.RootFolder != null) | 121 | IInventoryService invService = m_scene.InventoryService; |
122 | |||
123 | if (invService.GetRootFolder(userID) != null) | ||
121 | { | 124 | { |
122 | for (int i = 0; i < 13; i++) | 125 | for (int i = 0; i < 13; i++) |
123 | { | 126 | { |
@@ -127,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
127 | } | 130 | } |
128 | else | 131 | else |
129 | { | 132 | { |
130 | InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID); | 133 | InventoryItemBase baseItem = invService.QueryItem(new InventoryItemBase(appearance.Wearables[i].ItemID)); |
131 | 134 | ||
132 | if (baseItem != null) | 135 | if (baseItem != null) |
133 | { | 136 | { |
@@ -143,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
143 | } | 146 | } |
144 | else | 147 | else |
145 | { | 148 | { |
146 | m_log.Error("[APPEARANCE]: you have no inventory, appearance stuff isn't going to work"); | 149 | m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID); |
147 | } | 150 | } |
148 | } | 151 | } |
149 | 152 | ||
@@ -163,8 +166,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
163 | return; | 166 | return; |
164 | } | 167 | } |
165 | 168 | ||
166 | CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); | ||
167 | |||
168 | AvatarAppearance avatAppearance = null; | 169 | AvatarAppearance avatAppearance = null; |
169 | if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) | 170 | if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) |
170 | { | 171 | { |
@@ -174,34 +175,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
174 | 175 | ||
175 | //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); | 176 | //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); |
176 | 177 | ||
177 | if (profile != null) | 178 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) |
178 | { | 179 | { |
179 | if (profile.RootFolder != null) | 180 | if (wear.Type < 13) |
180 | { | 181 | { |
181 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) | 182 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; |
182 | { | ||
183 | if (wear.Type < 13) | ||
184 | { | ||
185 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | SetAppearanceAssets(profile, ref avatAppearance); | ||
190 | |||
191 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance); | ||
192 | avatar.Appearance = avatAppearance; | ||
193 | } | ||
194 | else | ||
195 | { | ||
196 | m_log.WarnFormat( | ||
197 | "[APPEARANCE]: Inventory has not yet been received for {0}, cannot set wearables", | ||
198 | clientView.Name); | ||
199 | } | 183 | } |
200 | } | 184 | } |
201 | else | 185 | |
202 | { | 186 | SetAppearanceAssets(avatar.UUID, ref avatAppearance); |
203 | m_log.WarnFormat("[APPEARANCE]: Cannot set wearables for {0}, no user profile found", clientView.Name); | 187 | |
204 | } | 188 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance); |
189 | avatar.Appearance = avatAppearance; | ||
205 | } | 190 | } |
206 | 191 | ||
207 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) | 192 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) |