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