aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
authorlbsa712007-09-19 00:30:55 +0000
committerlbsa712007-09-19 00:30:55 +0000
commit8f0b03597b0bc8ea6873af9a55495407fae1ec56 (patch)
treef9f4de38379aebf2223ad4cb10a3d9ebcfa52a4f /OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
parent* Moved SendLogoutPacket back to IClientAPI. (diff)
downloadopensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.zip
opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.gz
opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.bz2
opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.xz
* Modernized ScriptManager to new interface-based module calls.
* 'remove redundant this qualifier' ftw
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs134
1 files changed, 71 insertions, 63 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index a259dd0..048d2b4 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1,15 +1,13 @@
1using System; 1using Axiom.Math;
2using System.IO; 2using libsecondlife;
3using System.Collections.Generic; 3using libsecondlife.Packets;
4using libsecondlife; 4using OpenSim.Framework.Communications.Caches;
5using libsecondlife.Packets; 5using OpenSim.Framework.Data;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Framework.Communications.Caches; 8using OpenSim.Framework.Utilities;
9using OpenSim.Framework.Data; 9using OpenSim.Region.Physics.Manager;
10using OpenSim.Framework.Utilities; 10
11using OpenSim.Region.Physics.Manager;
12
13namespace OpenSim.Region.Environment.Scenes 11namespace OpenSim.Region.Environment.Scenes
14{ 12{
15 public partial class Scene 13 public partial class Scene
@@ -19,9 +17,9 @@ namespace OpenSim.Region.Environment.Scenes
19 17
20 public void AddInventoryItem(LLUUID userID, InventoryItemBase item) 18 public void AddInventoryItem(LLUUID userID, InventoryItemBase item)
21 { 19 {
22 if (this.Avatars.ContainsKey(userID)) 20 if (Avatars.ContainsKey(userID))
23 { 21 {
24 this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); 22 AddInventoryItem(Avatars[userID].ControllingClient, item);
25 } 23 }
26 } 24 }
27 25
@@ -37,9 +35,9 @@ namespace OpenSim.Region.Environment.Scenes
37 35
38 public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) 36 public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data)
39 { 37 {
40 if (this.Avatars.ContainsKey(userID)) 38 if (Avatars.ContainsKey(userID))
41 { 39 {
42 return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); 40 return CapsUpdateInventoryItemAsset(Avatars[userID].ControllingClient, itemID, data);
43 } 41 }
44 return LLUUID.Zero; 42 return LLUUID.Zero;
45 } 43 }
@@ -57,8 +55,8 @@ namespace OpenSim.Region.Environment.Scenes
57 AssetBase asset; 55 AssetBase asset;
58 asset = new AssetBase(); 56 asset = new AssetBase();
59 asset.FullID = LLUUID.Random(); 57 asset.FullID = LLUUID.Random();
60 asset.Type = (sbyte)item.assetType; 58 asset.Type = (sbyte) item.assetType;
61 asset.InvType = (sbyte)item.invType; 59 asset.InvType = (sbyte) item.invType;
62 asset.Name = item.inventoryName; 60 asset.Name = item.inventoryName;
63 asset.Data = data; 61 asset.Data = data;
64 commsManager.AssetCache.AddAsset(asset); 62 commsManager.AssetCache.AddAsset(asset);
@@ -83,7 +81,8 @@ namespace OpenSim.Region.Environment.Scenes
83 return LLUUID.Zero; 81 return LLUUID.Zero;
84 } 82 }
85 83
86 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID) 84 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
85 LLUUID itemID)
87 { 86 {
88 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 87 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
89 if (userInfo != null) 88 if (userInfo != null)
@@ -93,7 +92,8 @@ namespace OpenSim.Region.Environment.Scenes
93 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 92 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
94 if (item != null) 93 if (item != null)
95 { 94 {
96 AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); 95 AgentAssetTransactions transactions =
96 commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
97 if (transactions != null) 97 if (transactions != null)
98 { 98 {
99 AssetBase asset = null; 99 AssetBase asset = null;
@@ -112,8 +112,8 @@ namespace OpenSim.Region.Environment.Scenes
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)
@@ -143,7 +143,9 @@ namespace OpenSim.Region.Environment.Scenes
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,
147 uint callbackID, string description, string name, sbyte invType, sbyte type,
148 byte wearableType, uint nextOwnerMask)
147 { 149 {
148 if (transActionID == LLUUID.Zero) 150 if (transActionID == LLUUID.Zero)
149 { 151 {
@@ -157,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes
157 asset.Type = type; 159 asset.Type = type;
158 asset.FullID = LLUUID.Random(); 160 asset.FullID = LLUUID.Random();
159 asset.Data = new byte[1]; 161 asset.Data = new byte[1];
160 this.commsManager.AssetCache.AddAsset(asset); 162 commsManager.AssetCache.AddAsset(asset);
161 163
162 InventoryItemBase item = new InventoryItemBase(); 164 InventoryItemBase item = new InventoryItemBase();
163 item.avatarID = remoteClient.AgentId; 165 item.avatarID = remoteClient.AgentId;
@@ -178,7 +180,9 @@ namespace OpenSim.Region.Environment.Scenes
178 } 180 }
179 else 181 else
180 { 182 {
181 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); 183 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID,
184 callbackID, description, name, invType,
185 type, wearableType, nextOwnerMask);
182 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); 186 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
183 } 187 }
184 } 188 }
@@ -195,15 +199,15 @@ namespace OpenSim.Region.Environment.Scenes
195 { 199 {
196 if (ent is SceneObjectGroup) 200 if (ent is SceneObjectGroup)
197 { 201 {
198 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 202 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
199 if (hasPrim != false) 203 if (hasPrim != false)
200 { 204 {
201 bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); 205 bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
202 if (fileChange) 206 if (fileChange)
203 { 207 {
204 if (this.XferManager != null) 208 if (XferManager != null)
205 { 209 {
206 ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager); 210 ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
207 } 211 }
208 } 212 }
209 break; 213 break;
@@ -219,14 +223,14 @@ namespace OpenSim.Region.Environment.Scenes
219 { 223 {
220 if (ent is SceneObjectGroup) 224 if (ent is SceneObjectGroup)
221 { 225 {
222 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 226 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
223 if (hasPrim != false) 227 if (hasPrim != false)
224 { 228 {
225 int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID); 229 int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
226 ((SceneObjectGroup)ent).GetProperites(remoteClient); 230 ((SceneObjectGroup) ent).GetProperites(remoteClient);
227 if (type == 10) 231 if (type == 10)
228 { 232 {
229 this.EventManager.TriggerRemoveScript(localID, itemID); 233 EventManager.TriggerRemoveScript(localID, itemID);
230 } 234 }
231 } 235 }
232 } 236 }
@@ -255,7 +259,7 @@ namespace OpenSim.Region.Environment.Scenes
255 { 259 {
256 string script = Util.FieldToString(rezAsset.Data); 260 string script = Util.FieldToString(rezAsset.Data);
257 //Console.WriteLine("rez script "+script); 261 //Console.WriteLine("rez script "+script);
258 this.EventManager.TriggerRezScript(localID, copyID, script); 262 EventManager.TriggerRezScript(localID, copyID, script);
259 rezzed = true; 263 rezzed = true;
260 } 264 }
261 else 265 else
@@ -266,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
266 { 270 {
267 string script = Util.FieldToString(rezAsset.Data); 271 string script = Util.FieldToString(rezAsset.Data);
268 // Console.WriteLine("rez script " + script); 272 // Console.WriteLine("rez script " + script);
269 this.EventManager.TriggerRezScript(localID, copyID, script); 273 EventManager.TriggerRezScript(localID, copyID, script);
270 rezzed = true; 274 rezzed = true;
271 } 275 }
272 } 276 }
@@ -278,12 +282,13 @@ namespace OpenSim.Region.Environment.Scenes
278 { 282 {
279 if (ent is SceneObjectGroup) 283 if (ent is SceneObjectGroup)
280 { 284 {
281 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 285 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
282 if (hasPrim != false) 286 if (hasPrim != false)
283 { 287 {
284 288 bool added =
285 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); 289 ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
286 ((SceneObjectGroup)ent).GetProperites(remoteClient); 290 copyID);
291 ((SceneObjectGroup) ent).GetProperites(remoteClient);
287 } 292 }
288 } 293 }
289 } 294 }
@@ -300,7 +305,7 @@ namespace OpenSim.Region.Environment.Scenes
300 /// <param name="simClient"></param> 305 /// <param name="simClient"></param>
301 public void DeRezObject(Packet packet, IClientAPI remoteClient) 306 public void DeRezObject(Packet packet, IClientAPI remoteClient)
302 { 307 {
303 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 308 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
304 309
305 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 310 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
306 { 311 {
@@ -312,7 +317,7 @@ namespace OpenSim.Region.Environment.Scenes
312 { 317 {
313 EntityBase selectedEnt = null; 318 EntityBase selectedEnt = null;
314 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); 319 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
315 foreach (EntityBase ent in this.Entities.Values) 320 foreach (EntityBase ent in Entities.Values)
316 { 321 {
317 if (ent.LocalId == Data.ObjectLocalID) 322 if (ent.LocalId == Data.ObjectLocalID)
318 { 323 {
@@ -322,15 +327,16 @@ namespace OpenSim.Region.Environment.Scenes
322 } 327 }
323 if (selectedEnt != null) 328 if (selectedEnt != null)
324 { 329 {
325 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID)) 330 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
326 { 331 {
327 string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString(); 332 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
328 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 333 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
329 if (userInfo != null) 334 if (userInfo != null)
330 { 335 {
331 AssetBase asset = new AssetBase(); 336 AssetBase asset = new AssetBase();
332 asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId); 337 asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
333 asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId); 338 asset.Description =
339 ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
334 asset.InvType = 6; 340 asset.InvType = 6;
335 asset.Type = 6; 341 asset.Type = 6;
336 asset.FullID = LLUUID.Random(); 342 asset.FullID = LLUUID.Random();
@@ -355,21 +361,23 @@ namespace OpenSim.Region.Environment.Scenes
355 remoteClient.SendInventoryItemUpdate(item); 361 remoteClient.SendInventoryItemUpdate(item);
356 } 362 }
357 363
358 SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID); 364 SceneObjectPart rootPart =
365 ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID);
359 if (rootPart.PhysActor != null) 366 if (rootPart.PhysActor != null)
360 { 367 {
361 this.phyScene.RemovePrim(rootPart.PhysActor); 368 phyScene.RemovePrim(rootPart.PhysActor);
362 rootPart.PhysActor = null; 369 rootPart.PhysActor = null;
363 } 370 }
364 371
365 storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); 372 storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID,
366 ((SceneObjectGroup)selectedEnt).DeleteGroup(); 373 m_regInfo.SimUUID);
374 ((SceneObjectGroup) selectedEnt).DeleteGroup();
367 375
368 lock (Entities) 376 lock (Entities)
369 { 377 {
370 Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); 378 Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
371 } 379 }
372 ((SceneObjectGroup)selectedEnt).DeleteParts(); 380 ((SceneObjectGroup) selectedEnt).DeleteParts();
373 } 381 }
374 } 382 }
375 } 383 }
@@ -389,7 +397,7 @@ namespace OpenSim.Region.Environment.Scenes
389 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 397 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
390 if (rezAsset != null) 398 if (rezAsset != null)
391 { 399 {
392 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); 400 AddRezObject(Util.FieldToString(rezAsset.Data), pos);
393 userInfo.DeleteItem(remoteClient.AgentId, item); 401 userInfo.DeleteItem(remoteClient.AgentId, item);
394 remoteClient.SendRemoveInventoryItem(itemID); 402 remoteClient.SendRemoveInventoryItem(itemID);
395 } 403 }
@@ -399,7 +407,7 @@ namespace OpenSim.Region.Environment.Scenes
399 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 407 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
400 if (rezAsset != null) 408 if (rezAsset != null)
401 { 409 {
402 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); 410 AddRezObject(Util.FieldToString(rezAsset.Data), pos);
403 userInfo.DeleteItem(remoteClient.AgentId, item); 411 userInfo.DeleteItem(remoteClient.AgentId, item);
404 remoteClient.SendRemoveInventoryItem(itemID); 412 remoteClient.SendRemoveInventoryItem(itemID);
405 } 413 }
@@ -411,17 +419,17 @@ namespace OpenSim.Region.Environment.Scenes
411 419
412 private void AddRezObject(string xmlData, LLVector3 pos) 420 private void AddRezObject(string xmlData, LLVector3 pos)
413 { 421 {
414 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); 422 SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
415 this.AddEntity(group); 423 AddEntity(group);
416 group.AbsolutePosition = pos; 424 group.AbsolutePosition = pos;
417 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 425 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
418 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 426 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
419 rootPart.PhysActor = phyScene.AddPrim( 427 rootPart.PhysActor = phyScene.AddPrim(
420 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 428 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
429 rootPart.AbsolutePosition.Z),
421 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 430 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
422 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 431 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
423 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 432 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
424 } 433 }
425 } 434 }
426 435} \ No newline at end of file
427}