diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs | 99 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 8 |
3 files changed, 97 insertions, 30 deletions
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs index 820a26b..b6c373c 100644 --- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs | |||
@@ -1,5 +1,6 @@ | |||
1 | using System; | 1 | using System; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using System.Collections.Generic; | ||
3 | using Nini.Config; | 4 | using Nini.Config; |
4 | using OpenSim.Framework; | 5 | using OpenSim.Framework; |
5 | using OpenSim.Framework.Communications.Cache; | 6 | using OpenSim.Framework.Communications.Cache; |
@@ -11,18 +12,30 @@ namespace OpenSim.Region.Environment.Modules | |||
11 | public class AvatarFactoryModule : IAvatarFactory | 12 | public class AvatarFactoryModule : IAvatarFactory |
12 | { | 13 | { |
13 | private Scene m_scene = null; | 14 | private Scene m_scene = null; |
15 | private Dictionary<LLUUID, AvatarWearing> m_avatarsClothes = new Dictionary<LLUUID, AvatarWearing>(); | ||
14 | 16 | ||
15 | public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, | 17 | public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, |
16 | out byte[] visualParams) | 18 | out byte[] visualParams) |
17 | { | 19 | { |
18 | GetDefaultAvatarAppearance(out wearables, out visualParams); | 20 | if (!m_avatarsClothes.ContainsKey(avatarId)) |
19 | return true; | 21 | { |
22 | GetDefaultAvatarAppearance(out wearables, out visualParams); | ||
23 | AvatarWearing wearing = new AvatarWearing(wearables); | ||
24 | m_avatarsClothes[avatarId] = wearing; | ||
25 | return true; | ||
26 | } | ||
27 | else | ||
28 | { | ||
29 | visualParams = SetDefaultVisualParams(); | ||
30 | wearables = m_avatarsClothes[avatarId].IsWearing; | ||
31 | return true; | ||
32 | } | ||
20 | } | 33 | } |
21 | 34 | ||
22 | public void Initialise(Scene scene, IConfigSource source) | 35 | public void Initialise(Scene scene, IConfigSource source) |
23 | { | 36 | { |
24 | scene.RegisterModuleInterface<IAvatarFactory>(this); | 37 | scene.RegisterModuleInterface<IAvatarFactory>(this); |
25 | // scene.EventManager.OnNewClient += NewClient; | 38 | scene.EventManager.OnNewClient += NewClient; |
26 | 39 | ||
27 | if (m_scene == null) | 40 | if (m_scene == null) |
28 | { | 41 | { |
@@ -50,43 +63,97 @@ namespace OpenSim.Region.Environment.Modules | |||
50 | 63 | ||
51 | public void NewClient(IClientAPI client) | 64 | public void NewClient(IClientAPI client) |
52 | { | 65 | { |
53 | // client.OnAvatarNowWearing += AvatarIsWearing; | 66 | client.OnAvatarNowWearing += AvatarIsWearing; |
54 | } | 67 | } |
55 | 68 | ||
56 | public void RemoveClient(IClientAPI client) | 69 | public void RemoveClient(IClientAPI client) |
57 | { | 70 | { |
58 | // client.OnAvatarNowWearing -= AvatarIsWearing; | 71 | // client.OnAvatarNowWearing -= AvatarIsWearing; |
59 | } | 72 | } |
60 | 73 | ||
61 | public void AvatarIsWearing(Object sender, AvatarWearingArgs e) | 74 | public void AvatarIsWearing(Object sender, AvatarWearingArgs e) |
62 | { | 75 | { |
63 | IClientAPI clientView = (IClientAPI) sender; | 76 | IClientAPI clientView = (IClientAPI)sender; |
64 | //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 |
65 | // then store assetid and itemId and wearable type in a database | 78 | // then store assetid and itemId and wearable type in a database |
66 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) | 79 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) |
67 | { | ||
68 | LLUUID assetId; | ||
69 | CachedUserInfo profile = m_scene.CommsManager.UserProfileCache.GetUserDetails(clientView.AgentId); | ||
70 | if (profile != null) | ||
71 | { | 80 | { |
72 | InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID); | 81 | if (wear.Type < 13) |
73 | if (baseItem != null) | ||
74 | { | 82 | { |
75 | assetId = baseItem.assetID; | 83 | LLUUID assetId; |
84 | CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); | ||
85 | if (profile != null) | ||
86 | { | ||
87 | InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID); | ||
88 | if (baseItem != null) | ||
89 | { | ||
90 | assetId = baseItem.assetID; | ||
91 | //Tempoaray dictionary storage. This is be storing to a database | ||
92 | if (m_avatarsClothes.ContainsKey(clientView.AgentId)) | ||
93 | { | ||
94 | AvatarWearing avWearing = m_avatarsClothes[clientView.AgentId]; | ||
95 | avWearing.IsWearing[wear.Type].AssetID = assetId; | ||
96 | avWearing.IsWearing[wear.Type].ItemID = wear.ItemID; | ||
97 | } | ||
98 | } | ||
99 | } | ||
76 | } | 100 | } |
77 | } | 101 | } |
78 | } | ||
79 | } | 102 | } |
80 | 103 | ||
81 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) | 104 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) |
82 | { | 105 | { |
106 | visualParams = SetDefaultVisualParams(); | ||
107 | |||
108 | wearables = AvatarWearable.DefaultWearables; | ||
109 | } | ||
110 | |||
111 | private static byte[] SetDefaultVisualParams() | ||
112 | { | ||
113 | byte[] visualParams; | ||
83 | visualParams = new byte[218]; | 114 | visualParams = new byte[218]; |
84 | for (int i = 0; i < 218; i++) | 115 | for (int i = 0; i < 218; i++) |
85 | { | 116 | { |
86 | visualParams[i] = 100; | 117 | visualParams[i] = 100; |
87 | } | 118 | } |
119 | return visualParams; | ||
120 | } | ||
88 | 121 | ||
89 | wearables = AvatarWearable.DefaultWearables; | 122 | public class AvatarWearing |
123 | { | ||
124 | public AvatarWearable[] IsWearing; | ||
125 | |||
126 | public AvatarWearing() | ||
127 | { | ||
128 | IsWearing = new AvatarWearable[13]; | ||
129 | for (int i = 0; i < 13; i++) | ||
130 | { | ||
131 | IsWearing[i] = new AvatarWearable(); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | public AvatarWearing(AvatarWearable[] wearing) | ||
136 | { | ||
137 | if (wearing.Length == 13) | ||
138 | { | ||
139 | IsWearing = new AvatarWearable[13]; | ||
140 | for (int i = 0; i < 13; i++) | ||
141 | { | ||
142 | IsWearing[i] = new AvatarWearable(); | ||
143 | IsWearing[i].AssetID = wearing[i].AssetID; | ||
144 | IsWearing[i].ItemID = wearing[i].ItemID; | ||
145 | } | ||
146 | } | ||
147 | else | ||
148 | { | ||
149 | IsWearing = new AvatarWearable[13]; | ||
150 | for (int i = 0; i < 13; i++) | ||
151 | { | ||
152 | IsWearing[i] = new AvatarWearable(); | ||
153 | } | ||
154 | } | ||
155 | } | ||
90 | } | 156 | } |
91 | } | 157 | } |
158 | |||
92 | } \ No newline at end of file | 159 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 759d070..6370bcb 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
53 | 53 | ||
54 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) | 54 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) |
55 | { | 55 | { |
56 | CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 56 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
57 | if (userInfo != null) | 57 | if (userInfo != null) |
58 | { | 58 | { |
59 | userInfo.AddItem(remoteClient.AgentId, item); | 59 | userInfo.AddItem(remoteClient.AgentId, item); |
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
75 | 75 | ||
76 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) | 76 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) |
77 | { | 77 | { |
78 | CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 78 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
79 | if (userInfo != null) | 79 | if (userInfo != null) |
80 | { | 80 | { |
81 | if (userInfo.RootFolder != null) | 81 | if (userInfo.RootFolder != null) |
@@ -109,7 +109,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
109 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, | 109 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, |
110 | LLUUID itemID) | 110 | LLUUID itemID) |
111 | { | 111 | { |
112 | CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 112 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
113 | if (userInfo != null) | 113 | if (userInfo != null) |
114 | { | 114 | { |
115 | if (userInfo.RootFolder != null) | 115 | if (userInfo.RootFolder != null) |
@@ -157,10 +157,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
157 | 157 | ||
158 | public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, string newName) | 158 | public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, string newName) |
159 | { | 159 | { |
160 | InventoryItemBase item = CommsManager.UserProfileCache.libraryRoot.HasItem(oldItemID); | 160 | InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(oldItemID); |
161 | if (item == null) | 161 | if (item == null) |
162 | { | 162 | { |
163 | CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(oldAgentID); | 163 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); |
164 | if (userInfo == null) | 164 | if (userInfo == null) |
165 | { | 165 | { |
166 | MainLog.Instance.Warn("INVENTORY", "Failed to find user " + oldAgentID.ToString()); | 166 | MainLog.Instance.Warn("INVENTORY", "Failed to find user " + oldAgentID.ToString()); |
@@ -212,7 +212,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
212 | private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, | 212 | private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, |
213 | AssetBase asset, uint nextOwnerMask) | 213 | AssetBase asset, uint nextOwnerMask) |
214 | { | 214 | { |
215 | CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 215 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
216 | if (userInfo != null) | 216 | if (userInfo != null) |
217 | { | 217 | { |
218 | InventoryItemBase item = new InventoryItemBase(); | 218 | InventoryItemBase item = new InventoryItemBase(); |
@@ -252,7 +252,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
252 | { | 252 | { |
253 | if (transActionID == LLUUID.Zero) | 253 | if (transActionID == LLUUID.Zero) |
254 | { | 254 | { |
255 | CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 255 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
256 | if (userInfo != null) | 256 | if (userInfo != null) |
257 | { | 257 | { |
258 | AssetBase asset = CreateAsset(name, description, invType, assetType, null); | 258 | AssetBase asset = CreateAsset(name, description, invType, assetType, null); |
@@ -320,7 +320,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
320 | 320 | ||
321 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) | 321 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) |
322 | { | 322 | { |
323 | CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 323 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
324 | LLUUID copyID = LLUUID.Random(); | 324 | LLUUID copyID = LLUUID.Random(); |
325 | if (userInfo != null) | 325 | if (userInfo != null) |
326 | { | 326 | { |
@@ -398,7 +398,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
398 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) | 398 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) |
399 | { | 399 | { |
400 | string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); | 400 | string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); |
401 | CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 401 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
402 | if (userInfo != null) | 402 | if (userInfo != null) |
403 | { | 403 | { |
404 | AssetBase asset = CreateAsset( | 404 | AssetBase asset = CreateAsset( |
@@ -454,7 +454,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
454 | 454 | ||
455 | public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) | 455 | public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) |
456 | { | 456 | { |
457 | CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 457 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
458 | if (userInfo != null) | 458 | if (userInfo != null) |
459 | { | 459 | { |
460 | if (userInfo.RootFolder != null) | 460 | if (userInfo.RootFolder != null) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ade0e35..19e0064 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -949,7 +949,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
949 | CreateAndAddScenePresence(client, child); | 949 | CreateAndAddScenePresence(client, child); |
950 | 950 | ||
951 | m_LandManager.sendParcelOverlay(client); | 951 | m_LandManager.sendParcelOverlay(client); |
952 | CommsManager.UserProfileCache.AddNewUser(client.AgentId); | 952 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); |
953 | CommsManager.TransactionsManager.AddUser(client.AgentId); | 953 | CommsManager.TransactionsManager.AddUser(client.AgentId); |
954 | } | 954 | } |
955 | 955 | ||
@@ -999,10 +999,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
999 | client.OnGodKickUser += handleGodlikeKickUser; | 999 | client.OnGodKickUser += handleGodlikeKickUser; |
1000 | 1000 | ||
1001 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; | 1001 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; |
1002 | client.OnCreateNewInventoryFolder += CommsManager.UserProfileCache.HandleCreateInventoryFolder; | 1002 | client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder; |
1003 | client.OnFetchInventoryDescendents += CommsManager.UserProfileCache.HandleFecthInventoryDescendents; | 1003 | client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFecthInventoryDescendents; |
1004 | client.OnRequestTaskInventory += RequestTaskInventory; | 1004 | client.OnRequestTaskInventory += RequestTaskInventory; |
1005 | client.OnFetchInventory += CommsManager.UserProfileCache.HandleFetchInventory; | 1005 | client.OnFetchInventory += CommsManager.UserProfileCacheService.HandleFetchInventory; |
1006 | client.OnUpdateInventoryItem += UDPUpdateInventoryItemAsset; | 1006 | client.OnUpdateInventoryItem += UDPUpdateInventoryItemAsset; |
1007 | client.OnCopyInventoryItem += CopyInventoryItem; | 1007 | client.OnCopyInventoryItem += CopyInventoryItem; |
1008 | client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest; | 1008 | client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest; |