Inventory redirects from CachedUserInfo to InventoryService COMPLETE!

This commit is contained in:
Diva Canto
2009-08-13 11:30:29 -07:00
parent 6a0f7c2275
commit 6b9cc6c48d
10 changed files with 144 additions and 388 deletions

View File

@@ -34,6 +34,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
{
@@ -115,9 +116,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
}
public void SetAppearanceAssets(CachedUserInfo profile, ref AvatarAppearance appearance)
public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
{
if (profile.RootFolder != null)
IInventoryService invService = m_scene.InventoryService;
if (invService.GetRootFolder(userID) != null)
{
for (int i = 0; i < 13; i++)
{
@@ -127,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
}
else
{
InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID);
InventoryItemBase baseItem = invService.QueryItem(new InventoryItemBase(appearance.Wearables[i].ItemID));
if (baseItem != null)
{
@@ -143,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
}
else
{
m_log.Error("[APPEARANCE]: you have no inventory, appearance stuff isn't going to work");
m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID);
}
}
@@ -163,8 +166,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
return;
}
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
AvatarAppearance avatAppearance = null;
if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance))
{
@@ -174,34 +175,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
//m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name);
if (profile != null)
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (profile.RootFolder != null)
if (wear.Type < 13)
{
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (wear.Type < 13)
{
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
}
}
SetAppearanceAssets(profile, ref avatAppearance);
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
}
}
SetAppearanceAssets(avatar.UUID, ref avatAppearance);
m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
avatar.Appearance = avatAppearance;
}
else
{
m_log.WarnFormat(
"[APPEARANCE]: Inventory has not yet been received for {0}, cannot set wearables",
clientView.Name);
}
}
else
{
m_log.WarnFormat("[APPEARANCE]: Cannot set wearables for {0}, no user profile found", clientView.Name);
}
m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
avatar.Appearance = avatAppearance;
}
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)