From 27f182ac54ffee16da730b2053480944f9ca5412 Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 1 Dec 2007 14:20:37 +0000 Subject: 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. --- .../Environment/Modules/AvatarFactoryModule.cs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'OpenSim/Region/Environment/Modules') diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs index 4bb0638..d8a90c5 100644 --- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs @@ -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(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]; -- cgit v1.1