diff options
author | MW | 2007-08-22 14:37:54 +0000 |
---|---|---|
committer | MW | 2007-08-22 14:37:54 +0000 |
commit | b5921e2b95305d2918f94f52a560f8c004b8bcb4 (patch) | |
tree | 7deec09890e710941ec1a9d9a9f258f5ae8d1c26 /OpenSim | |
parent | Fix for un-encrypted master avatar password in user database (diff) | |
download | opensim-SC-b5921e2b95305d2918f94f52a560f8c004b8bcb4.zip opensim-SC-b5921e2b95305d2918f94f52a560f8c004b8bcb4.tar.gz opensim-SC-b5921e2b95305d2918f94f52a560f8c004b8bcb4.tar.bz2 opensim-SC-b5921e2b95305d2918f94f52a560f8c004b8bcb4.tar.xz |
Start of Task Inventory (ie prim's inventory). For now, you can only move scripts into a prim (from your user inventory) and although the script will now show up in the prims inventory, you can't make any changes to it (or delete it). Also a prim's inventory is currently not saved between restarts.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/General/Interfaces/IClientAPI.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/General/NullClientAPI.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 39 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 173 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 1 |
9 files changed, 203 insertions, 57 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index e30a49c..24ab47a 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs | |||
@@ -93,6 +93,7 @@ namespace OpenSim.Framework.Interfaces | |||
93 | public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data); | 93 | public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data); |
94 | public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); | 94 | public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); |
95 | public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); | 95 | public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); |
96 | public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); | ||
96 | 97 | ||
97 | public interface IClientAPI | 98 | public interface IClientAPI |
98 | { | 99 | { |
@@ -147,6 +148,7 @@ namespace OpenSim.Framework.Interfaces | |||
147 | event UDPAssetUploadRequest OnAssetUploadRequest; | 148 | event UDPAssetUploadRequest OnAssetUploadRequest; |
148 | event XferReceive OnXferReceive; | 149 | event XferReceive OnXferReceive; |
149 | event RequestXfer OnRequestXfer; | 150 | event RequestXfer OnRequestXfer; |
151 | event ConfirmXfer OnConfirmXfer; | ||
150 | event RezScript OnRezScript; | 152 | event RezScript OnRezScript; |
151 | 153 | ||
152 | event UUIDNameRequest OnNameFromUUIDRequest; | 154 | event UUIDNameRequest OnNameFromUUIDRequest; |
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs index 55a3f0b..74be103 100644 --- a/OpenSim/Framework/General/NullClientAPI.cs +++ b/OpenSim/Framework/General/NullClientAPI.cs | |||
@@ -62,6 +62,7 @@ namespace OpenSim.Framework | |||
62 | public event UDPAssetUploadRequest OnAssetUploadRequest; | 62 | public event UDPAssetUploadRequest OnAssetUploadRequest; |
63 | public event XferReceive OnXferReceive; | 63 | public event XferReceive OnXferReceive; |
64 | public event RequestXfer OnRequestXfer; | 64 | public event RequestXfer OnRequestXfer; |
65 | public event ConfirmXfer OnConfirmXfer; | ||
65 | public event RezScript OnRezScript; | 66 | public event RezScript OnRezScript; |
66 | 67 | ||
67 | public event UUIDNameRequest OnNameFromUUIDRequest; | 68 | public event UUIDNameRequest OnNameFromUUIDRequest; |
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index cee18fe..029b948 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -91,6 +91,7 @@ namespace OpenSim.Region.ClientStack | |||
91 | public event UDPAssetUploadRequest OnAssetUploadRequest; | 91 | public event UDPAssetUploadRequest OnAssetUploadRequest; |
92 | public event XferReceive OnXferReceive; | 92 | public event XferReceive OnXferReceive; |
93 | public event RequestXfer OnRequestXfer; | 93 | public event RequestXfer OnRequestXfer; |
94 | public event ConfirmXfer OnConfirmXfer; | ||
94 | public event RezScript OnRezScript; | 95 | public event RezScript OnRezScript; |
95 | 96 | ||
96 | public event UUIDNameRequest OnNameFromUUIDRequest; | 97 | public event UUIDNameRequest OnNameFromUUIDRequest; |
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 579b824..c17f453 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -383,6 +383,13 @@ namespace OpenSim.Region.ClientStack | |||
383 | OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); | 383 | OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); |
384 | } | 384 | } |
385 | break; | 385 | break; |
386 | case PacketType.ConfirmXferPacket: | ||
387 | ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack; | ||
388 | if (OnConfirmXfer != null) | ||
389 | { | ||
390 | OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); | ||
391 | } | ||
392 | break; | ||
386 | case PacketType.CreateInventoryFolder: | 393 | case PacketType.CreateInventoryFolder: |
387 | if (this.OnCreateNewInventoryFolder != null) | 394 | if (this.OnCreateNewInventoryFolder != null) |
388 | { | 395 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 765fafc..bf7bb7e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -189,7 +189,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
189 | /// <param name="primLocalID"></param> | 189 | /// <param name="primLocalID"></param> |
190 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | 190 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) |
191 | { | 191 | { |
192 | |||
193 | bool hasPrim = false; | 192 | bool hasPrim = false; |
194 | foreach (EntityBase ent in Entities.Values) | 193 | foreach (EntityBase ent in Entities.Values) |
195 | { | 194 | { |
@@ -198,7 +197,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
198 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); | 197 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); |
199 | if (hasPrim != false) | 198 | if (hasPrim != false) |
200 | { | 199 | { |
201 | ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); | 200 | bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); |
201 | if (fileChange) | ||
202 | { | ||
203 | ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, xferManager); | ||
204 | } | ||
202 | break; | 205 | break; |
203 | } | 206 | } |
204 | } | 207 | } |
@@ -216,6 +219,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
216 | if (item != null) | 219 | if (item != null) |
217 | { | 220 | { |
218 | bool isTexture = false; | 221 | bool isTexture = false; |
222 | bool rezzed = false; | ||
219 | if (item.invType == 0) | 223 | if (item.invType == 0) |
220 | { | 224 | { |
221 | isTexture = true; | 225 | isTexture = true; |
@@ -226,6 +230,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
226 | string script = Util.FieldToString(rezAsset.Data); | 230 | string script = Util.FieldToString(rezAsset.Data); |
227 | //Console.WriteLine("rez script "+script); | 231 | //Console.WriteLine("rez script "+script); |
228 | this.EventManager.TriggerRezScript(localID, script); | 232 | this.EventManager.TriggerRezScript(localID, script); |
233 | rezzed = true; | ||
229 | } | 234 | } |
230 | else | 235 | else |
231 | { | 236 | { |
@@ -236,8 +241,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
236 | string script = Util.FieldToString(rezAsset.Data); | 241 | string script = Util.FieldToString(rezAsset.Data); |
237 | // Console.WriteLine("rez script " + script); | 242 | // Console.WriteLine("rez script " + script); |
238 | this.EventManager.TriggerRezScript(localID, script); | 243 | this.EventManager.TriggerRezScript(localID, script); |
244 | rezzed = true; | ||
239 | } | 245 | } |
240 | } | 246 | } |
247 | |||
248 | if (rezzed) | ||
249 | { | ||
250 | bool hasPrim = false; | ||
251 | foreach (EntityBase ent in Entities.Values) | ||
252 | { | ||
253 | if (ent is SceneObjectGroup) | ||
254 | { | ||
255 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); | ||
256 | if (hasPrim != false) | ||
257 | { | ||
258 | bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item); | ||
259 | if (added) | ||
260 | { | ||
261 | userInfo.DeleteItem(remoteClient.AgentId, item); | ||
262 | remoteClient.SendRemoveInventoryItem(itemID); | ||
263 | } | ||
264 | } | ||
265 | } | ||
266 | } | ||
267 | |||
268 | } | ||
241 | } | 269 | } |
242 | } | 270 | } |
243 | } | 271 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d625dec..d3aafcc 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -77,6 +77,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
77 | protected AgentCircuitManager authenticateHandler; | 77 | protected AgentCircuitManager authenticateHandler; |
78 | protected RegionCommsListener regionCommsHost; | 78 | protected RegionCommsListener regionCommsHost; |
79 | protected CommunicationsManager commsManager; | 79 | protected CommunicationsManager commsManager; |
80 | protected XferManagaer xferManager; | ||
80 | 81 | ||
81 | protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); | 82 | protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); |
82 | protected BaseHttpServer httpListener; | 83 | protected BaseHttpServer httpListener; |
@@ -163,6 +164,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
163 | m_scriptManager = new ScriptManager(this); | 164 | m_scriptManager = new ScriptManager(this); |
164 | m_eventManager = new EventManager(); | 165 | m_eventManager = new EventManager(); |
165 | m_permissionManager = new PermissionManager(this); | 166 | m_permissionManager = new PermissionManager(this); |
167 | xferManager = new XferManagaer(); | ||
166 | 168 | ||
167 | m_eventManager.OnParcelPrimCountAdd += | 169 | m_eventManager.OnParcelPrimCountAdd += |
168 | m_LandManager.addPrimToLandPrimCounts; | 170 | m_LandManager.addPrimToLandPrimCounts; |
@@ -711,6 +713,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
711 | client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; | 713 | client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; |
712 | client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; | 714 | client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; |
713 | // client.OnRequestXfer += RequestXfer; | 715 | // client.OnRequestXfer += RequestXfer; |
716 | client.OnRequestXfer += xferManager.RequestXfer; | ||
717 | client.OnConfirmXfer += xferManager.AckPacket; | ||
714 | client.OnRezScript += RezScript; | 718 | client.OnRezScript += RezScript; |
715 | 719 | ||
716 | client.OnRequestAvatarProperties += RequestAvatarProperty; | 720 | client.OnRequestAvatarProperties += RequestAvatarProperty; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 2151ded..219de84 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -10,6 +10,7 @@ using libsecondlife.Packets; | |||
10 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Types; | 11 | using OpenSim.Framework.Types; |
12 | using OpenSim.Physics.Manager; | 12 | using OpenSim.Physics.Manager; |
13 | using OpenSim.Framework.Data; | ||
13 | 14 | ||
14 | namespace OpenSim.Region.Environment.Scenes | 15 | namespace OpenSim.Region.Environment.Scenes |
15 | { | 16 | { |
@@ -518,7 +519,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
518 | proper.ObjectData[0].FolderID = LLUUID.Zero; | 519 | proper.ObjectData[0].FolderID = LLUUID.Zero; |
519 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | 520 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; |
520 | proper.ObjectData[0].GroupID = LLUUID.Zero; | 521 | proper.ObjectData[0].GroupID = LLUUID.Zero; |
521 | proper.ObjectData[0].InventorySerial = 0; | 522 | proper.ObjectData[0].InventorySerial = (short) this.m_rootPart.InventorySerial; |
522 | proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; | 523 | proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; |
523 | proper.ObjectData[0].ObjectID = this.UUID; | 524 | proper.ObjectData[0].ObjectID = this.UUID; |
524 | proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; | 525 | proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; |
@@ -601,27 +602,45 @@ namespace OpenSim.Region.Environment.Scenes | |||
601 | /// </summary> | 602 | /// </summary> |
602 | /// <param name="remoteClient"></param> | 603 | /// <param name="remoteClient"></param> |
603 | /// <param name="localID"></param> | 604 | /// <param name="localID"></param> |
604 | public void GetPartInventoryFileName(IClientAPI remoteClient, uint localID) | 605 | public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) |
605 | { | 606 | { |
606 | SceneObjectPart part = this.GetChildPrim(localID); | 607 | SceneObjectPart part = this.GetChildPrim(localID); |
607 | if (part != null) | 608 | if (part != null) |
608 | { | 609 | { |
609 | part.GetInventoryFileName(remoteClient, localID); | 610 | return part.GetInventoryFileName(remoteClient, localID); |
610 | } | 611 | } |
612 | return false; | ||
611 | } | 613 | } |
612 | 614 | ||
613 | /// <summary> | 615 | public string RequestInventoryFile(uint localID, XferManagaer xferManager) |
614 | /// | 616 | { |
615 | /// </summary> | 617 | SceneObjectPart part = this.GetChildPrim(localID); |
616 | /// <param name="remoteClient"></param> | 618 | if (part != null) |
617 | /// <param name="partID"></param> | 619 | { |
618 | public void RequestInventoryFile(IClientAPI remoteClient, uint localID, ulong xferID) | 620 | return part.RequestInventoryFile(xferManager); |
621 | } | ||
622 | return ""; | ||
623 | } | ||
624 | |||
625 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item) | ||
619 | { | 626 | { |
620 | SceneObjectPart part = this.GetChildPrim(localID); | 627 | SceneObjectPart part = this.GetChildPrim(localID); |
621 | if (part != null) | 628 | if (part != null) |
622 | { | 629 | { |
623 | part.RequestInventoryFile(remoteClient, xferID); | 630 | SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); |
631 | taskItem.item_id = item.inventoryID; | ||
632 | taskItem.asset_id = item.assetID; | ||
633 | taskItem.name = item.inventoryName; | ||
634 | taskItem.desc = item.inventoryDescription; | ||
635 | taskItem.owner_id = item.avatarID; | ||
636 | taskItem.creator_id = item.creatorsID; | ||
637 | taskItem.type = taskItem.AssetTypes[item.assetType]; | ||
638 | taskItem.inv_type = taskItem.AssetTypes[item.invType]; | ||
639 | part.AddInventoryItem(taskItem); | ||
640 | return true; | ||
624 | } | 641 | } |
642 | return false; | ||
643 | |||
625 | } | 644 | } |
626 | 645 | ||
627 | /// <summary> | 646 | /// <summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 904b158..5fa79fb 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -10,6 +10,7 @@ using libsecondlife.Packets; | |||
10 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Types; | 11 | using OpenSim.Framework.Types; |
12 | using OpenSim.Region.Environment.Scenes.Scripting; | 12 | using OpenSim.Region.Environment.Scenes.Scripting; |
13 | using OpenSim.Framework.Utilities; | ||
13 | 14 | ||
14 | namespace OpenSim.Region.Environment.Scenes | 15 | namespace OpenSim.Region.Environment.Scenes |
15 | { | 16 | { |
@@ -18,6 +19,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
18 | { | 19 | { |
19 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | 20 | private const uint FULL_MASK_PERMISSIONS = 2147483647; |
20 | 21 | ||
22 | private string m_inventoryFileName = ""; | ||
23 | private LLUUID m_folderID = LLUUID.Zero; | ||
24 | |||
25 | protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); | ||
21 | 26 | ||
22 | public LLUUID CreatorID; | 27 | public LLUUID CreatorID; |
23 | public LLUUID OwnerID; | 28 | public LLUUID OwnerID; |
@@ -43,6 +48,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
43 | 48 | ||
44 | #region Properties | 49 | #region Properties |
45 | 50 | ||
51 | /// <summary> | ||
52 | /// Serial count for inventory file , used to tell if inventory has changed | ||
53 | /// no need for this to be part of Database backup | ||
54 | /// </summary> | ||
55 | protected uint m_inventorySerial = 0; | ||
56 | public uint InventorySerial | ||
57 | { | ||
58 | get { return m_inventorySerial; } | ||
59 | } | ||
60 | |||
46 | protected LLUUID m_uuid; | 61 | protected LLUUID m_uuid; |
47 | public LLUUID UUID | 62 | public LLUUID UUID |
48 | { | 63 | { |
@@ -221,6 +236,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
221 | this.AngularVelocity = new LLVector3(0, 0, 0); | 236 | this.AngularVelocity = new LLVector3(0, 0, 0); |
222 | this.Acceleration = new LLVector3(0, 0, 0); | 237 | this.Acceleration = new LLVector3(0, 0, 0); |
223 | 238 | ||
239 | m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString(); | ||
240 | m_folderID = LLUUID.Random(); | ||
224 | 241 | ||
225 | //temporary code just so the m_flags field doesn't give a compiler warning | 242 | //temporary code just so the m_flags field doesn't give a compiler warning |
226 | if (m_flags == LLObject.ObjectFlags.AllowInventoryDrop) | 243 | if (m_flags == LLObject.ObjectFlags.AllowInventoryDrop) |
@@ -396,9 +413,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
396 | #endregion | 413 | #endregion |
397 | 414 | ||
398 | #region Inventory | 415 | #region Inventory |
399 | public void AddInventoryItem() | 416 | public void AddInventoryItem(TaskInventoryItem item) |
400 | { | 417 | { |
401 | 418 | item.parent_id = m_folderID; | |
419 | item.creation_date = 1000; | ||
420 | this.TaskInventory.Add(item.item_id, item); | ||
421 | this.m_inventorySerial++; | ||
402 | } | 422 | } |
403 | 423 | ||
404 | public void RemoveInventoryItem() | 424 | public void RemoveInventoryItem() |
@@ -410,54 +430,63 @@ namespace OpenSim.Region.Environment.Scenes | |||
410 | /// </summary> | 430 | /// </summary> |
411 | /// <param name="client"></param> | 431 | /// <param name="client"></param> |
412 | /// <param name="localID"></param> | 432 | /// <param name="localID"></param> |
413 | public void GetInventoryFileName(IClientAPI client, uint localID) | 433 | public bool GetInventoryFileName(IClientAPI client, uint localID) |
414 | { | 434 | { |
415 | if (localID == this.m_localID) | 435 | if (localID == this.m_localID) |
416 | { | 436 | { |
437 | if (this.m_inventorySerial > 0) | ||
438 | { | ||
439 | client.SendTaskInventory(this.m_uuid, (short)m_inventorySerial, Helpers.StringToField(m_inventoryFileName)); | ||
440 | return true; | ||
441 | } | ||
442 | else | ||
443 | { | ||
444 | client.SendTaskInventory(this.m_uuid, 0, new byte[0]); | ||
445 | return false; | ||
446 | } | ||
417 | //client.SendTaskInventory(this.m_uuid, 1, Helpers.StringToField("primInventory2")); | 447 | //client.SendTaskInventory(this.m_uuid, 1, Helpers.StringToField("primInventory2")); |
418 | client.SendTaskInventory(this.m_uuid, 0, new byte[0]); | 448 | //client.SendTaskInventory(this.m_uuid, 0, new byte[0]); |
419 | } | 449 | } |
450 | return false; | ||
420 | } | 451 | } |
421 | 452 | ||
422 | /// <summary> | 453 | public string RequestInventoryFile(XferManagaer xferManager) |
423 | /// | 454 | { |
424 | /// </summary> | 455 | byte[] fileData = new byte[0]; |
425 | /// <param name="client"></param> | 456 | InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, this.UUID); |
426 | /// <param name="xferID"></param> | 457 | foreach (TaskInventoryItem item in this.TaskInventory.Values) |
427 | public void RequestInventoryFile(IClientAPI client, ulong xferID) | 458 | { |
428 | { | 459 | invString.AddItemStart(); |
429 | // a test item | 460 | invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated()); |
430 | InventoryStringBuilder invString = new InventoryStringBuilder(); | 461 | invString.AddNameValueLine("parent_id", item.parent_id.ToStringHyphenated()); |
431 | invString.AddItemStart(); | 462 | |
432 | invString.AddNameValueLine("item_id", LLUUID.Random().ToStringHyphenated()); | 463 | invString.AddPermissionsStart(); |
433 | invString.AddNameValueLine("parent_id", LLUUID.Zero.ToStringHyphenated()); | 464 | invString.AddNameValueLine("base_mask", "0x7FFFFFFF"); |
434 | 465 | invString.AddNameValueLine("owner_mask", "0x7FFFFFFF"); | |
435 | invString.AddPermissionsStart(); | 466 | invString.AddNameValueLine("group_mask", "0x7FFFFFFF"); |
436 | invString.AddNameValueLine("base_mask", "0x7FFFFFFF"); | 467 | invString.AddNameValueLine("everyone_mask", "0x7FFFFFFF"); |
437 | invString.AddNameValueLine("owner_mask", "0x7FFFFFFF"); | 468 | invString.AddNameValueLine("next_owner_mask", "0x7FFFFFFF"); |
438 | invString.AddNameValueLine("group_mask", "0x7FFFFFFF"); | 469 | invString.AddNameValueLine("creator_id", item.creator_id.ToStringHyphenated()); |
439 | invString.AddNameValueLine("everyone_mask", "0x7FFFFFFF"); | 470 | invString.AddNameValueLine("owner_id", item.owner_id.ToStringHyphenated()); |
440 | invString.AddNameValueLine("next_owner_mask", "0x7FFFFFFF"); | 471 | invString.AddNameValueLine("last_owner_id", item.last_owner_id.ToStringHyphenated()); |
441 | invString.AddNameValueLine("creator_id", client.AgentId.ToStringHyphenated()); | 472 | invString.AddNameValueLine("group_id", item.group_id.ToStringHyphenated()); |
442 | invString.AddNameValueLine("owner_id", client.AgentId.ToStringHyphenated()); | 473 | invString.AddSectionEnd(); |
443 | invString.AddNameValueLine("last_owner_id", LLUUID.Zero.ToStringHyphenated()); | 474 | |
444 | invString.AddNameValueLine("group_id", LLUUID.Zero.ToStringHyphenated()); | 475 | invString.AddNameValueLine("asset_id", item.asset_id.ToStringHyphenated()); |
445 | invString.AddSectionEnd(); | 476 | invString.AddNameValueLine("type", item.type); |
446 | 477 | invString.AddNameValueLine("inv_type", item.inv_type); | |
447 | invString.AddNameValueLine("asset_id", "00000000-0000-2222-3333-000000000001"); | 478 | invString.AddNameValueLine("flags", "0x00"); |
448 | invString.AddNameValueLine("type", "lsltext"); | 479 | invString.AddNameValueLine("name", item.name + "|"); |
449 | invString.AddNameValueLine("inv_type", "lsltext"); | 480 | invString.AddNameValueLine("desc", item.desc + "|"); |
450 | invString.AddNameValueLine("flags", "0x00"); | 481 | invString.AddNameValueLine("creation_date", item.creation_date.ToString()); |
451 | invString.AddNameValueLine("name", "Test inventory" + "|"); | 482 | invString.AddSectionEnd(); |
452 | invString.AddNameValueLine("desc", "test description" + "|"); | 483 | } |
453 | invString.AddNameValueLine("creation_date", "10000"); | 484 | fileData = Helpers.StringToField(invString.BuildString); |
454 | invString.AddSectionEnd(); | 485 | if (fileData.Length > 2) |
455 | 486 | { | |
456 | byte[] fileInv = Helpers.StringToField(invString.BuildString); | 487 | xferManager.AddNewFile(m_inventoryFileName, fileData); |
457 | byte[] data = new byte[fileInv.Length + 4]; | 488 | } |
458 | Array.Copy(Helpers.IntToBytes(fileInv.Length), 0, data, 0, 4); | 489 | return ""; |
459 | Array.Copy(fileInv, 0, data, 4, fileInv.Length); | ||
460 | client.SendXferPacket(xferID, 0 + 0x80000000, data); | ||
461 | } | 490 | } |
462 | #endregion | 491 | #endregion |
463 | 492 | ||
@@ -643,9 +672,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
643 | { | 672 | { |
644 | public string BuildString = ""; | 673 | public string BuildString = ""; |
645 | 674 | ||
646 | public InventoryStringBuilder() | 675 | public InventoryStringBuilder(LLUUID folderID, LLUUID parentID) |
647 | { | 676 | { |
648 | 677 | BuildString += "\tinv_object\t0\n\t{\n"; | |
678 | this.AddNameValueLine("obj_id", folderID.ToStringHyphenated()); | ||
679 | this.AddNameValueLine("parent_id", parentID.ToStringHyphenated()); | ||
680 | this.AddNameValueLine("type", "category"); | ||
681 | this.AddNameValueLine("name", "Contents"); | ||
682 | this.AddSectionEnd(); | ||
649 | } | 683 | } |
650 | 684 | ||
651 | public void AddItemStart() | 685 | public void AddItemStart() |
@@ -676,6 +710,55 @@ namespace OpenSim.Region.Environment.Scenes | |||
676 | BuildString += name + "\t"; | 710 | BuildString += name + "\t"; |
677 | BuildString += value + "\n"; | 711 | BuildString += value + "\n"; |
678 | } | 712 | } |
713 | |||
714 | public void Close() | ||
715 | { | ||
716 | } | ||
717 | } | ||
718 | |||
719 | public class TaskInventoryItem | ||
720 | { | ||
721 | public string[] AssetTypes = new string[] | ||
722 | { | ||
723 | "texture", | ||
724 | "sound", | ||
725 | "", | ||
726 | "", | ||
727 | "", | ||
728 | "", | ||
729 | "", | ||
730 | "", | ||
731 | "", | ||
732 | "", | ||
733 | "lsltext", | ||
734 | "" | ||
735 | }; | ||
736 | public LLUUID item_id = LLUUID.Zero; | ||
737 | public LLUUID parent_id = LLUUID.Zero; | ||
738 | |||
739 | public uint base_mask = FULL_MASK_PERMISSIONS; | ||
740 | public uint owner_mask = FULL_MASK_PERMISSIONS; | ||
741 | public uint group_mask = FULL_MASK_PERMISSIONS; | ||
742 | public uint everyone_mask = FULL_MASK_PERMISSIONS; | ||
743 | public uint next_owner_mask = FULL_MASK_PERMISSIONS; | ||
744 | public LLUUID creator_id = LLUUID.Zero; | ||
745 | public LLUUID owner_id = LLUUID.Zero; | ||
746 | public LLUUID last_owner_id = LLUUID.Zero; | ||
747 | public LLUUID group_id = LLUUID.Zero; | ||
748 | |||
749 | public LLUUID asset_id = LLUUID.Zero; | ||
750 | public string type = ""; | ||
751 | public string inv_type = ""; | ||
752 | public uint flags = 0; | ||
753 | public string name = ""; | ||
754 | public string desc = ""; | ||
755 | public uint creation_date = 0; | ||
756 | public string FileName = ""; | ||
757 | |||
758 | public TaskInventoryItem() | ||
759 | { | ||
760 | FileName = "taskItem" + LLUUID.Random().ToString(); | ||
761 | } | ||
679 | } | 762 | } |
680 | } | 763 | } |
681 | } | 764 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 4a9e652..12d19e6 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -76,6 +76,7 @@ namespace SimpleApp | |||
76 | public event UDPAssetUploadRequest OnAssetUploadRequest; | 76 | public event UDPAssetUploadRequest OnAssetUploadRequest; |
77 | public event XferReceive OnXferReceive; | 77 | public event XferReceive OnXferReceive; |
78 | public event RequestXfer OnRequestXfer; | 78 | public event RequestXfer OnRequestXfer; |
79 | public event ConfirmXfer OnConfirmXfer; | ||
79 | public event RezScript OnRezScript; | 80 | public event RezScript OnRezScript; |
80 | 81 | ||
81 | public event UUIDNameRequest OnNameFromUUIDRequest; | 82 | public event UUIDNameRequest OnNameFromUUIDRequest; |