Part 1 of a commit. This revision will not compile, part 2 will be added in a couple of minutes that should fix that.

Some work towards persisting Avatar Appearance (what is being worn).
Added OnAvatarNowWearing event to IClientAPI that is triggered by AgentIsNowWearing packets.
stub code to subscribe to this event in AvatarFactoryModule. 
Todo: code needs to be added to AvatarFactoryModule to save the uuids to a database and then read them back when that modules TryGetIntialAvatarAppearance() method is called.
Done some changes to Scene to make it easier to subclass it: including changed some private fields to protected and made some methods virtual.
This commit is contained in:
MW
2007-12-01 14:20:37 +00:00
parent 6aef4a09f9
commit 27f182ac54
5 changed files with 104 additions and 32 deletions

View File

@@ -1,3 +1,4 @@
using System;
using libsecondlife;
using Nini.Config;
using OpenSim.Framework;
@@ -8,6 +9,8 @@ namespace OpenSim.Region.Environment.Modules
{
public class AvatarFactoryModule : IAvatarFactory
{
private Scene m_scene = null;
public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
out byte[] visualParams)
{
@@ -18,6 +21,12 @@ namespace OpenSim.Region.Environment.Modules
public void Initialise(Scene scene, IConfigSource source)
{
scene.RegisterModuleInterface<IAvatarFactory>(this);
// scene.EventManager.OnNewClient += NewClient;
if (m_scene == null)
{
m_scene = scene;
}
}
public void PostInitialise()
@@ -38,6 +47,27 @@ namespace OpenSim.Region.Environment.Modules
get { return true; }
}
public void NewClient(IClientAPI client)
{
// client.OnAvatarNowWearing += AvatarIsWearing;
}
public void RemoveClient(IClientAPI client)
{
// client.OnAvatarNowWearing -= AvatarIsWearing;
}
public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
{
IClientAPI clientView = (IClientAPI) sender;
//Todo look up the assetid from the inventory cache (or something) for each itemId that is in AvatarWearingArgs
// then store assetid and itemId and wearable type in a database
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
LLUUID assetID = m_scene.CommsManager.UserProfileCache.GetUserDetails(clientView.AgentId).RootFolder.HasItem(wear.ItemID).assetID;
}
}
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
{
visualParams = new byte[218];