aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs854
1 files changed, 427 insertions, 427 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 70b34cf..a259dd0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1,427 +1,427 @@
1using System; 1using System;
2using System.IO; 2using System.IO;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using libsecondlife; 4using libsecondlife;
5using libsecondlife.Packets; 5using libsecondlife.Packets;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Framework.Communications.Caches; 8using OpenSim.Framework.Communications.Caches;
9using OpenSim.Framework.Data; 9using OpenSim.Framework.Data;
10using OpenSim.Framework.Utilities; 10using OpenSim.Framework.Utilities;
11using OpenSim.Region.Physics.Manager; 11using OpenSim.Region.Physics.Manager;
12 12
13namespace OpenSim.Region.Environment.Scenes 13namespace OpenSim.Region.Environment.Scenes
14{ 14{
15 public partial class Scene 15 public partial class Scene
16 { 16 {
17 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete 17 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
18 // or at least some of they can be moved somewhere else 18 // or at least some of they can be moved somewhere else
19 19
20 public void AddInventoryItem(LLUUID userID, InventoryItemBase item) 20 public void AddInventoryItem(LLUUID userID, InventoryItemBase item)
21 { 21 {
22 if (this.Avatars.ContainsKey(userID)) 22 if (this.Avatars.ContainsKey(userID))
23 { 23 {
24 this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); 24 this.AddInventoryItem(this.Avatars[userID].ControllingClient, item);
25 } 25 }
26 } 26 }
27 27
28 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) 28 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
29 { 29 {
30 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 30 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
31 if (userInfo != null) 31 if (userInfo != null)
32 { 32 {
33 userInfo.AddItem(remoteClient.AgentId, item); 33 userInfo.AddItem(remoteClient.AgentId, item);
34 remoteClient.SendInventoryItemUpdate(item); 34 remoteClient.SendInventoryItemUpdate(item);
35 } 35 }
36 } 36 }
37 37
38 public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) 38 public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data)
39 { 39 {
40 if (this.Avatars.ContainsKey(userID)) 40 if (this.Avatars.ContainsKey(userID))
41 { 41 {
42 return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); 42 return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data);
43 } 43 }
44 return LLUUID.Zero; 44 return LLUUID.Zero;
45 } 45 }
46 46
47 public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) 47 public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
48 { 48 {
49 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 49 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
50 if (userInfo != null) 50 if (userInfo != null)
51 { 51 {
52 if (userInfo.RootFolder != null) 52 if (userInfo.RootFolder != null)
53 { 53 {
54 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 54 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
55 if (item != null) 55 if (item != null)
56 { 56 {
57 AssetBase asset; 57 AssetBase asset;
58 asset = new AssetBase(); 58 asset = new AssetBase();
59 asset.FullID = LLUUID.Random(); 59 asset.FullID = LLUUID.Random();
60 asset.Type = (sbyte)item.assetType; 60 asset.Type = (sbyte)item.assetType;
61 asset.InvType = (sbyte)item.invType; 61 asset.InvType = (sbyte)item.invType;
62 asset.Name = item.inventoryName; 62 asset.Name = item.inventoryName;
63 asset.Data = data; 63 asset.Data = data;
64 commsManager.AssetCache.AddAsset(asset); 64 commsManager.AssetCache.AddAsset(asset);
65 65
66 item.assetID = asset.FullID; 66 item.assetID = asset.FullID;
67 userInfo.UpdateItem(remoteClient.AgentId, item); 67 userInfo.UpdateItem(remoteClient.AgentId, item);
68 68
69 // remoteClient.SendInventoryItemUpdate(item); 69 // remoteClient.SendInventoryItemUpdate(item);
70 if (item.invType == 7) 70 if (item.invType == 7)
71 { 71 {
72 //do we want to know about updated note cards? 72 //do we want to know about updated note cards?
73 } 73 }
74 else if (item.invType == 10) 74 else if (item.invType == 10)
75 { 75 {
76 // do we want to know about updated scripts 76 // do we want to know about updated scripts
77 } 77 }
78 78
79 return (asset.FullID); 79 return (asset.FullID);
80 } 80 }
81 } 81 }
82 } 82 }
83 return LLUUID.Zero; 83 return LLUUID.Zero;
84 } 84 }
85 85
86 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID) 86 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID)
87 { 87 {
88 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 88 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
89 if (userInfo != null) 89 if (userInfo != null)
90 { 90 {
91 if (userInfo.RootFolder != null) 91 if (userInfo.RootFolder != null)
92 { 92 {
93 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 93 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
94 if (item != null) 94 if (item != null)
95 { 95 {
96 AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); 96 AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
97 if (transactions != null) 97 if (transactions != null)
98 { 98 {
99 AssetBase asset = null; 99 AssetBase asset = null;
100 bool addToCache = false; 100 bool addToCache = false;
101 101
102 asset = commsManager.AssetCache.GetAsset(assetID); 102 asset = commsManager.AssetCache.GetAsset(assetID);
103 if (asset == null) 103 if (asset == null)
104 { 104 {
105 asset = transactions.GetTransactionAsset(transactionID); 105 asset = transactions.GetTransactionAsset(transactionID);
106 addToCache = true; 106 addToCache = true;
107 } 107 }
108 108
109 if (asset != null) 109 if (asset != null)
110 { 110 {
111 if (asset.FullID == assetID) 111 if (asset.FullID == assetID)
112 { 112 {
113 asset.Name = item.inventoryName; 113 asset.Name = item.inventoryName;
114 asset.Description = item.inventoryDescription; 114 asset.Description = item.inventoryDescription;
115 asset.InvType = (sbyte)item.invType; 115 asset.InvType = (sbyte)item.invType;
116 asset.Type = (sbyte)item.assetType; 116 asset.Type = (sbyte)item.assetType;
117 item.assetID = asset.FullID; 117 item.assetID = asset.FullID;
118 118
119 if (addToCache) 119 if (addToCache)
120 { 120 {
121 commsManager.AssetCache.AddAsset(asset); 121 commsManager.AssetCache.AddAsset(asset);
122 } 122 }
123 123
124 userInfo.UpdateItem(remoteClient.AgentId, item); 124 userInfo.UpdateItem(remoteClient.AgentId, item);
125 } 125 }
126 } 126 }
127 } 127 }
128 } 128 }
129 } 129 }
130 } 130 }
131 } 131 }
132 132
133 /// <summary> 133 /// <summary>
134 /// temporary method to test out creating new inventory items 134 /// temporary method to test out creating new inventory items
135 /// </summary> 135 /// </summary>
136 /// <param name="remoteClient"></param> 136 /// <param name="remoteClient"></param>
137 /// <param name="transActionID"></param> 137 /// <param name="transActionID"></param>
138 /// <param name="folderID"></param> 138 /// <param name="folderID"></param>
139 /// <param name="callbackID"></param> 139 /// <param name="callbackID"></param>
140 /// <param name="description"></param> 140 /// <param name="description"></param>
141 /// <param name="name"></param> 141 /// <param name="name"></param>
142 /// <param name="invType"></param> 142 /// <param name="invType"></param>
143 /// <param name="type"></param> 143 /// <param name="type"></param>
144 /// <param name="wearableType"></param> 144 /// <param name="wearableType"></param>
145 /// <param name="nextOwnerMask"></param> 145 /// <param name="nextOwnerMask"></param>
146 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) 146 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask)
147 { 147 {
148 if (transActionID == LLUUID.Zero) 148 if (transActionID == LLUUID.Zero)
149 { 149 {
150 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 150 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
151 if (userInfo != null) 151 if (userInfo != null)
152 { 152 {
153 AssetBase asset = new AssetBase(); 153 AssetBase asset = new AssetBase();
154 asset.Name = name; 154 asset.Name = name;
155 asset.Description = description; 155 asset.Description = description;
156 asset.InvType = invType; 156 asset.InvType = invType;
157 asset.Type = type; 157 asset.Type = type;
158 asset.FullID = LLUUID.Random(); 158 asset.FullID = LLUUID.Random();
159 asset.Data = new byte[1]; 159 asset.Data = new byte[1];
160 this.commsManager.AssetCache.AddAsset(asset); 160 this.commsManager.AssetCache.AddAsset(asset);
161 161
162 InventoryItemBase item = new InventoryItemBase(); 162 InventoryItemBase item = new InventoryItemBase();
163 item.avatarID = remoteClient.AgentId; 163 item.avatarID = remoteClient.AgentId;
164 item.creatorsID = remoteClient.AgentId; 164 item.creatorsID = remoteClient.AgentId;
165 item.inventoryID = LLUUID.Random(); 165 item.inventoryID = LLUUID.Random();
166 item.assetID = asset.FullID; 166 item.assetID = asset.FullID;
167 item.inventoryDescription = description; 167 item.inventoryDescription = description;
168 item.inventoryName = name; 168 item.inventoryName = name;
169 item.assetType = invType; 169 item.assetType = invType;
170 item.invType = invType; 170 item.invType = invType;
171 item.parentFolderID = folderID; 171 item.parentFolderID = folderID;
172 item.inventoryCurrentPermissions = 2147483647; 172 item.inventoryCurrentPermissions = 2147483647;
173 item.inventoryNextPermissions = nextOwnerMask; 173 item.inventoryNextPermissions = nextOwnerMask;
174 174
175 userInfo.AddItem(remoteClient.AgentId, item); 175 userInfo.AddItem(remoteClient.AgentId, item);
176 remoteClient.SendInventoryItemUpdate(item); 176 remoteClient.SendInventoryItemUpdate(item);
177 } 177 }
178 } 178 }
179 else 179 else
180 { 180 {
181 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); 181 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask);
182 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); 182 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
183 } 183 }
184 } 184 }
185 185
186 /// <summary> 186 /// <summary>
187 /// 187 ///
188 /// </summary> 188 /// </summary>
189 /// <param name="remoteClient"></param> 189 /// <param name="remoteClient"></param>
190 /// <param name="primLocalID"></param> 190 /// <param name="primLocalID"></param>
191 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) 191 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
192 { 192 {
193 bool hasPrim = false; 193 bool hasPrim = false;
194 foreach (EntityBase ent in Entities.Values) 194 foreach (EntityBase ent in Entities.Values)
195 { 195 {
196 if (ent is SceneObjectGroup) 196 if (ent is SceneObjectGroup)
197 { 197 {
198 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 198 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID);
199 if (hasPrim != false) 199 if (hasPrim != false)
200 { 200 {
201 bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); 201 bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID);
202 if (fileChange) 202 if (fileChange)
203 { 203 {
204 if (this.XferManager != null) 204 if (this.XferManager != null)
205 { 205 {
206 ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager); 206 ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager);
207 } 207 }
208 } 208 }
209 break; 209 break;
210 } 210 }
211 } 211 }
212 } 212 }
213 } 213 }
214 214
215 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) 215 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
216 { 216 {
217 bool hasPrim = false; 217 bool hasPrim = false;
218 foreach (EntityBase ent in Entities.Values) 218 foreach (EntityBase ent in Entities.Values)
219 { 219 {
220 if (ent is SceneObjectGroup) 220 if (ent is SceneObjectGroup)
221 { 221 {
222 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 222 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
223 if (hasPrim != false) 223 if (hasPrim != false)
224 { 224 {
225 int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID); 225 int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID);
226 ((SceneObjectGroup)ent).GetProperites(remoteClient); 226 ((SceneObjectGroup)ent).GetProperites(remoteClient);
227 if (type == 10) 227 if (type == 10)
228 { 228 {
229 this.EventManager.TriggerRemoveScript(localID, itemID); 229 this.EventManager.TriggerRemoveScript(localID, itemID);
230 } 230 }
231 } 231 }
232 } 232 }
233 } 233 }
234 } 234 }
235 235
236 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) 236 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
237 { 237 {
238 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 238 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
239 LLUUID copyID = LLUUID.Random(); 239 LLUUID copyID = LLUUID.Random();
240 if (userInfo != null) 240 if (userInfo != null)
241 { 241 {
242 if (userInfo.RootFolder != null) 242 if (userInfo.RootFolder != null)
243 { 243 {
244 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 244 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
245 if (item != null) 245 if (item != null)
246 { 246 {
247 bool isTexture = false; 247 bool isTexture = false;
248 bool rezzed = false; 248 bool rezzed = false;
249 if (item.invType == 0) 249 if (item.invType == 0)
250 { 250 {
251 isTexture = true; 251 isTexture = true;
252 } 252 }
253 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); 253 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
254 if (rezAsset != null) 254 if (rezAsset != null)
255 { 255 {
256 string script = Util.FieldToString(rezAsset.Data); 256 string script = Util.FieldToString(rezAsset.Data);
257 //Console.WriteLine("rez script "+script); 257 //Console.WriteLine("rez script "+script);
258 this.EventManager.TriggerRezScript(localID, copyID, script); 258 this.EventManager.TriggerRezScript(localID, copyID, script);
259 rezzed = true; 259 rezzed = true;
260 } 260 }
261 else 261 else
262 { 262 {
263 //lets try once more incase the asset cache is being slow getting the asset from server 263 //lets try once more incase the asset cache is being slow getting the asset from server
264 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); 264 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
265 if (rezAsset != null) 265 if (rezAsset != null)
266 { 266 {
267 string script = Util.FieldToString(rezAsset.Data); 267 string script = Util.FieldToString(rezAsset.Data);
268 // Console.WriteLine("rez script " + script); 268 // Console.WriteLine("rez script " + script);
269 this.EventManager.TriggerRezScript(localID, copyID, script); 269 this.EventManager.TriggerRezScript(localID, copyID, script);
270 rezzed = true; 270 rezzed = true;
271 } 271 }
272 } 272 }
273 273
274 if (rezzed) 274 if (rezzed)
275 { 275 {
276 bool hasPrim = false; 276 bool hasPrim = false;
277 foreach (EntityBase ent in Entities.Values) 277 foreach (EntityBase ent in Entities.Values)
278 { 278 {
279 if (ent is SceneObjectGroup) 279 if (ent is SceneObjectGroup)
280 { 280 {
281 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 281 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
282 if (hasPrim != false) 282 if (hasPrim != false)
283 { 283 {
284 284
285 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); 285 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID);
286 ((SceneObjectGroup)ent).GetProperites(remoteClient); 286 ((SceneObjectGroup)ent).GetProperites(remoteClient);
287 } 287 }
288 } 288 }
289 } 289 }
290 } 290 }
291 } 291 }
292 } 292 }
293 } 293 }
294 } 294 }
295 295
296 /// <summary> 296 /// <summary>
297 /// 297 ///
298 /// </summary> 298 /// </summary>
299 /// <param name="packet"></param> 299 /// <param name="packet"></param>
300 /// <param name="simClient"></param> 300 /// <param name="simClient"></param>
301 public void DeRezObject(Packet packet, IClientAPI remoteClient) 301 public void DeRezObject(Packet packet, IClientAPI remoteClient)
302 { 302 {
303 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 303 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
304 304
305 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 305 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
306 { 306 {
307 //currently following code not used (or don't know of any case of destination being zero 307 //currently following code not used (or don't know of any case of destination being zero
308 } 308 }
309 else 309 else
310 { 310 {
311 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) 311 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
312 { 312 {
313 EntityBase selectedEnt = null; 313 EntityBase selectedEnt = null;
314 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); 314 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
315 foreach (EntityBase ent in this.Entities.Values) 315 foreach (EntityBase ent in this.Entities.Values)
316 { 316 {
317 if (ent.LocalId == Data.ObjectLocalID) 317 if (ent.LocalId == Data.ObjectLocalID)
318 { 318 {
319 selectedEnt = ent; 319 selectedEnt = ent;
320 break; 320 break;
321 } 321 }
322 } 322 }
323 if (selectedEnt != null) 323 if (selectedEnt != null)
324 { 324 {
325 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID)) 325 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID))
326 { 326 {
327 string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString(); 327 string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString();
328 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 328 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
329 if (userInfo != null) 329 if (userInfo != null)
330 { 330 {
331 AssetBase asset = new AssetBase(); 331 AssetBase asset = new AssetBase();
332 asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId); 332 asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId);
333 asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId); 333 asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId);
334 asset.InvType = 6; 334 asset.InvType = 6;
335 asset.Type = 6; 335 asset.Type = 6;
336 asset.FullID = LLUUID.Random(); 336 asset.FullID = LLUUID.Random();
337 asset.Data = Helpers.StringToField(sceneObjectXml); 337 asset.Data = Helpers.StringToField(sceneObjectXml);
338 commsManager.AssetCache.AddAsset(asset); 338 commsManager.AssetCache.AddAsset(asset);
339 339
340 340
341 InventoryItemBase item = new InventoryItemBase(); 341 InventoryItemBase item = new InventoryItemBase();
342 item.avatarID = remoteClient.AgentId; 342 item.avatarID = remoteClient.AgentId;
343 item.creatorsID = remoteClient.AgentId; 343 item.creatorsID = remoteClient.AgentId;
344 item.inventoryID = LLUUID.Random(); 344 item.inventoryID = LLUUID.Random();
345 item.assetID = asset.FullID; 345 item.assetID = asset.FullID;
346 item.inventoryDescription = asset.Description; 346 item.inventoryDescription = asset.Description;
347 item.inventoryName = asset.Name; 347 item.inventoryName = asset.Name;
348 item.assetType = asset.Type; 348 item.assetType = asset.Type;
349 item.invType = asset.InvType; 349 item.invType = asset.InvType;
350 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; 350 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
351 item.inventoryCurrentPermissions = 2147483647; 351 item.inventoryCurrentPermissions = 2147483647;
352 item.inventoryNextPermissions = 2147483647; 352 item.inventoryNextPermissions = 2147483647;
353 353
354 userInfo.AddItem(remoteClient.AgentId, item); 354 userInfo.AddItem(remoteClient.AgentId, item);
355 remoteClient.SendInventoryItemUpdate(item); 355 remoteClient.SendInventoryItemUpdate(item);
356 } 356 }
357 357
358 SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID); 358 SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID);
359 if (rootPart.PhysActor != null) 359 if (rootPart.PhysActor != null)
360 { 360 {
361 this.phyScene.RemovePrim(rootPart.PhysActor); 361 this.phyScene.RemovePrim(rootPart.PhysActor);
362 rootPart.PhysActor = null; 362 rootPart.PhysActor = null;
363 } 363 }
364 364
365 storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); 365 storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID);
366 ((SceneObjectGroup)selectedEnt).DeleteGroup(); 366 ((SceneObjectGroup)selectedEnt).DeleteGroup();
367 367
368 lock (Entities) 368 lock (Entities)
369 { 369 {
370 Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); 370 Entities.Remove(((SceneObjectGroup)selectedEnt).UUID);
371 } 371 }
372 ((SceneObjectGroup)selectedEnt).DeleteParts(); 372 ((SceneObjectGroup)selectedEnt).DeleteParts();
373 } 373 }
374 } 374 }
375 } 375 }
376 } 376 }
377 } 377 }
378 378
379 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) 379 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
380 { 380 {
381 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 381 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
382 if (userInfo != null) 382 if (userInfo != null)
383 { 383 {
384 if (userInfo.RootFolder != null) 384 if (userInfo.RootFolder != null)
385 { 385 {
386 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 386 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
387 if (item != null) 387 if (item != null)
388 { 388 {
389 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 389 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
390 if (rezAsset != null) 390 if (rezAsset != null)
391 { 391 {
392 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); 392 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
393 userInfo.DeleteItem(remoteClient.AgentId, item); 393 userInfo.DeleteItem(remoteClient.AgentId, item);
394 remoteClient.SendRemoveInventoryItem(itemID); 394 remoteClient.SendRemoveInventoryItem(itemID);
395 } 395 }
396 else 396 else
397 { 397 {
398 //lets try once more incase the asset cache is being slow getting the asset from server 398 //lets try once more incase the asset cache is being slow getting the asset from server
399 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 399 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
400 if (rezAsset != null) 400 if (rezAsset != null)
401 { 401 {
402 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); 402 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
403 userInfo.DeleteItem(remoteClient.AgentId, item); 403 userInfo.DeleteItem(remoteClient.AgentId, item);
404 remoteClient.SendRemoveInventoryItem(itemID); 404 remoteClient.SendRemoveInventoryItem(itemID);
405 } 405 }
406 } 406 }
407 } 407 }
408 } 408 }
409 } 409 }
410 } 410 }
411 411
412 private void AddRezObject(string xmlData, LLVector3 pos) 412 private void AddRezObject(string xmlData, LLVector3 pos)
413 { 413 {
414 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); 414 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData);
415 this.AddEntity(group); 415 this.AddEntity(group);
416 group.AbsolutePosition = pos; 416 group.AbsolutePosition = pos;
417 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 417 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
418 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 418 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
419 rootPart.PhysActor = phyScene.AddPrim( 419 rootPart.PhysActor = phyScene.AddPrim(
420 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 420 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z),
421 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 421 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
422 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 422 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
423 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 423 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
424 } 424 }
425 } 425 }
426 426
427} 427}