29 using System.Collections.Generic;
30 using System.Collections;
31 using System.Reflection;
33 using System.Threading;
37 using OpenMetaverse.Packets;
39 using OpenSim.Framework;
40 using OpenSim.Framework.Serialization.External;
41 using OpenSim.Region.Framework;
42 using OpenSim.Framework.Client;
43 using OpenSim.Region.Framework.Interfaces;
44 using OpenSim.Region.Framework.Scenes.Serialization;
45 using OpenSim.Services.Interfaces;
48 namespace OpenSim.
Region.Framework.Scenes
50 public partial class Scene
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
74 m_log.InfoFormat(
"[SCENE]: Initializing script instances in {0}", RegionInfo.RegionName);
76 int scriptsValidForStarting = 0;
78 EntityBase[] entities = Entities.GetEntities();
83 scriptsValidForStarting
84 += ((SceneObjectGroup) group).CreateScriptInstances(0,
false, DefaultScriptEngine, 0);
85 ((SceneObjectGroup) group).ResumeScripts();
90 "[SCENE]: Initialized {0} script instances in {1}",
91 scriptsValidForStarting, RegionInfo.RegionName);
93 return scriptsValidForStarting;
103 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
106 engine.StartProcessing();
114 money.ApplyUploadCharge(agentID, (int)cost,
"Asset upload");
117 AddInventoryItem(item);
122 if (AddInventoryItem(item))
127 "[AGENT INVENTORY]: Unable to add item {1} to agent {2} inventory", item.Name, AgentId);
135 return AddInventoryItem(item,
true);
144 if (item.
Folder !=
UUID.Zero && InventoryService.AddItem(item))
147 if (Permissions.IsGod(item.
Owner))
152 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.
AssetType, item.
AssetID, item.
Name, userlevel);
158 UUID originalFolder = item.Folder;
160 if (Enum.IsDefined(typeof(FolderType), (sbyte)item.
AssetType))
161 f = InventoryService.GetFolderForType(item.
Owner, (FolderType)item.
AssetType);
165 "[AGENT INVENTORY]: Found folder {0} type {1} for item {2}",
166 f.Name, (AssetType)f.
Type, item.
Name);
172 f = InventoryService.GetRootFolder(item.Owner);
180 "[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
181 item.Owner, item.Name);
186 if (InventoryService.AddItem(item))
189 if (Permissions.IsGod(item.
Owner))
194 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.
AssetType, item.
AssetID, item.
Name, userlevel);
196 if (originalFolder !=
UUID.Zero)
199 ChangePlacement(item, f);
207 "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
208 item.Owner, item.Name, item.ID);
227 parent = InventoryService.GetFolder(parent);
228 inv.SendRemoveInventoryItems(
new UUID[] { item.ID });
230 string message =
"The item was placed in folder " + f.Name;
232 message +=
" under " + parent.Name;
233 sp.ControllingClient.SendAgentAlertMessage(message,
false);
248 [Obsolete(
"Use AddInventoryItem(InventoryItemBase item) instead. This was deprecated in OpenSim 0.7.1")]
251 AddInventoryItem(item);
262 AddInventoryItem(item);
263 remoteClient.SendInventoryItemCreateUpdate(item, 0);
273 if (TryGetScenePresence(avatarId, out avatar))
276 if (invAccess != null)
277 return invAccess.CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data);
282 "[AGENT INVENTORY]: " +
283 "Avatar {0} cannot be found to update its inventory item asset",
299 UUID primId,
bool isScriptRunning, byte[] data)
301 if (!Permissions.CanEditScript(itemId, primId, remoteClient.
AgentId))
303 remoteClient.SendAgentAlertMessage(
"Insufficient permissions to edit script",
false);
304 return new ArrayList();
310 return new ArrayList();
320 "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for caps script update "
321 +
" but the item does not exist in this inventory",
322 itemId, part.Name, part.UUID);
324 return new ArrayList();
328 AssetService.Store(asset);
336 part.Inventory.RemoveScriptInstance(item.ItemID,
false);
340 item.AssetID = asset.FullID;
341 group.UpdateInventoryItem(item);
343 part.SendPropertiesToClient(remoteClient);
346 ArrayList errors =
new ArrayList();
352 errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0,
false, DefaultScriptEngine, 1);
356 EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID);
358 part.ParentGroup.ResumeScripts();
366 UUID primId,
bool isScriptRunning, byte[] data)
370 if (TryGetScenePresence(avatarId, out avatar))
372 return CapsUpdateTaskInventoryScriptAsset(
373 avatar.ControllingClient, itemId, primId, isScriptRunning, data);
378 "[PRIM INVENTORY]: " +
379 "Avatar {0} cannot be found to update its prim item asset",
381 return new ArrayList();
411 item = InventoryService.GetItem(item);
418 item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255);
419 item.Name = itemUpd.Name;
420 item.Description = itemUpd.Description;
427 bool sendUpdate =
false;
433 bool denyExportChange =
false;
439 denyExportChange =
true;
446 if (denyExportChange)
471 item.
Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
472 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
475 item.
Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
476 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
479 item.
Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
480 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
482 item.GroupID = itemUpd.GroupID;
483 item.GroupOwned = itemUpd.GroupOwned;
484 item.CreationDate = itemUpd.CreationDate;
488 item.CreationDate = Util.UnixTimeSinceEpoch();
490 item.CreationDate = itemUpd.CreationDate;
494 item.InvType = itemUpd.InvType;
498 item.Flags |= (uint)InventoryItemFlags.ObjectSlamSale;
502 if (item.
InvType == (
int)InventoryType.Wearable && (item.Flags & 0xf) == 0 && (itemUpd.
Flags & 0xf) != 0)
504 item.Flags = (uint)(item.
Flags & 0xfffffff0) | (itemUpd.Flags & 0xf);
508 InventoryService.UpdateItem(item);
511 if (
UUID.Zero != transactionID)
513 if (AgentTransactionsModule != null)
515 AgentTransactionsModule.HandleItemUpdateFromTransaction(remoteClient, transactionID, item);
527 remoteClient.SendBulkUpdateInventory(item);
533 "[AGENTINVENTORY]: Item id {0} not found for an inventory item update for {1}.",
534 itemID, remoteClient.Name);
548 if (itemCopy != null)
549 recipientClient.SendBulkUpdateInventory(itemCopy);
561 return GiveInventoryItem(recipient, senderId, itemId,
UUID.Zero, out message);
578 UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId, out
string message)
582 if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient))
584 message =
"Not allowed to transfer this item.";
589 item = InventoryService.GetItem(item);
594 "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient);
595 message = string.Format(
"Item not found: {0}.", itemId);
599 if (item.
Owner != senderId)
602 "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}",
603 item.Name, item.ID, recipient, senderId, item.Owner);
604 message =
"Sender did not match item owner.";
610 uman.AddUser(item.CreatorIdAsUuid, item.CreatorData);
612 if (!Permissions.BypassPermissions())
616 message =
"Item doesn't have the Transfer permission.";
623 itemCopy.Owner = recipient;
624 itemCopy.CreatorId = item.CreatorId;
625 itemCopy.CreatorData = item.CreatorData;
626 itemCopy.ID = UUID.Random();
627 itemCopy.AssetID = item.AssetID;
628 itemCopy.Description = item.Description;
629 itemCopy.Name = item.Name;
630 itemCopy.AssetType = item.AssetType;
631 itemCopy.InvType = item.InvType;
632 itemCopy.Folder = recipientFolderId;
634 if (Permissions.PropagatePermissions() && recipient != senderId)
651 (uint)PermissionMask.Transfer |
656 uint nextPerms = permsMask | (item.NextPermissions &
658 (uint)PermissionMask.Transfer |
667 if (nextPerms == permsMask)
679 (uint)PermissionMask.Move;
680 uint ownerPerms = item.CurrentPermissions;
685 if (item.
InvType == (
int)InventoryType.Object)
687 bool isRootMod = (item.CurrentPermissions &
692 PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref ownerPerms);
693 PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref basePerms);
702 basePerms |= (uint)PermissionMask.Modify;
709 ownerPerms &= nextPerms;
713 basePerms &= nextPerms;
717 itemCopy.BasePermissions = basePerms;
718 itemCopy.CurrentPermissions = ownerPerms;
719 itemCopy.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
734 itemCopy.CurrentPermissions = item.CurrentPermissions;
735 itemCopy.NextPermissions = item.NextPermissions;
736 itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions;
737 itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions;
738 itemCopy.BasePermissions = item.BasePermissions;
744 if (Enum.IsDefined(typeof(FolderType), (sbyte)item.
AssetType))
745 folder = InventoryService.GetFolderForType(recipient, (FolderType)itemCopy.
AssetType);
749 itemCopy.Folder = folder.ID;
757 itemCopy.Folder = root.ID;
761 message =
"Can't find a folder to add the item to.";
767 itemCopy.GroupID = UUID.Zero;
768 itemCopy.GroupOwned =
false;
769 itemCopy.Flags = item.Flags;
770 itemCopy.SalePrice = item.SalePrice;
771 itemCopy.SaleType = item.SaleType;
774 if (invAccess != null)
775 invAccess.TransferInventoryAssets(itemCopy, senderId, recipient);
776 AddInventoryItem(itemCopy,
false);
778 if (!Permissions.BypassPermissions())
782 List<UUID> items =
new List<UUID>();
784 InventoryService.DeleteItems(senderId, items);
807 UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
814 "[AGENT INVENTORY]: Could not find inventory folder {0} to give", folderId);
819 if (recipientParentFolderId ==
UUID.Zero)
822 if (recipientRootFolder != null)
823 recipientParentFolderId = recipientRootFolder.ID;
826 m_log.WarnFormat(
"[AGENT INVENTORY]: Unable to find root folder for receiving agent");
831 UUID newFolderId = UUID.Random();
834 newFolderId, folder.
Name, recipientId, folder.
Type, recipientParentFolderId, folder.
Version);
835 InventoryService.AddFolder(newFolder);
841 GiveInventoryFolder(client, recipientId, senderId, childFolder.
ID, newFolder.ID);
848 if (GiveInventoryItem(recipientId, senderId, item.
ID, newFolder.ID, out message) == null)
851 client.SendAgentAlertMessage(message,
false);
859 UUID newFolderID,
string newName)
862 "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}",
863 remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName);
866 if (LibraryService != null && LibraryService.LibraryRootFolder != null)
867 item = LibraryService.LibraryRootFolder.FindItem(oldItemID);
872 item = InventoryService.GetItem(item);
876 m_log.Error(
"[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
884 if (newName ==
String.Empty)
887 AssetBase asset = AssetService.Get(item.AssetID.ToString());
891 if (newName !=
String.Empty)
893 asset.Name = newName;
901 if (remoteClient.
AgentId == oldAgentID
902 || (LibraryService != null
903 && LibraryService.LibraryRootFolder != null
904 && oldAgentID == LibraryService.LibraryRootFolder.Owner))
907 remoteClient, item.CreatorId, item.CreatorData, newFolderID,
908 newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
909 item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
910 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(),
false);
915 if (((item.CurrentPermissions & (uint)
PermissionMask.Transfer) != 0)
916 && (m_permissions.BypassPermissions()
917 || m_permissions.CanCopyUserInventory(remoteClient.
AgentId, oldItemID)))
920 remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
921 item.AssetID, (sbyte)item.AssetType, (sbyte) item.InvType,
922 item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
923 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(),
false);
930 "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found",
931 item.Name, item.AssetID);
941 asset.Description = description;
942 asset.Data = (data == null) ?
new byte[1] : data;
952 List<InventoryItemBase> moveitems =
new List<InventoryItemBase>();
957 n.Folder = destfolder;
959 remoteClient.SendInventoryItemCreateUpdate(n, 0);
976 "[AGENT INVENTORY]: Moving {0} items for user {1}", items.Count, remoteClient.AgentId);
978 if (!InventoryService.MoveItems(remoteClient.
AgentId, items))
979 m_log.Warn(
"[AGENT INVENTORY]: Failed to move items for user " + remoteClient.
AgentId);
998 IClientAPI remoteClient,
string creatorID,
string creatorData, UUID folderID,
999 string name,
string description, uint flags, uint callbackID,
1000 UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask,
int creationDate)
1003 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType,
1005 creationDate,
true);
1028 IClientAPI remoteClient,
string creatorID,
string creatorData, UUID folderID,
1029 string name,
string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType,
1030 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask,
int creationDate,
1034 item.Owner = remoteClient.AgentId;
1035 item.CreatorId = creatorID;
1036 item.CreatorData = creatorData;
1037 item.ID = UUID.Random();
1038 item.AssetID = assetID;
1040 item.Description = description;
1042 item.AssetType = assetType;
1043 item.InvType = invType;
1044 item.Folder = folderID;
1045 item.CurrentPermissions = currentMask;
1046 item.NextPermissions = nextOwnerMask;
1047 item.EveryOnePermissions = everyoneMask;
1048 item.GroupPermissions = groupMask;
1049 item.BasePermissions = baseMask;
1050 item.CreationDate = creationDate;
1056 if (AddInventoryItem(item))
1058 remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
1062 m_dialogModule.SendAlertToUser(remoteClient,
"Failed to create item");
1064 "Failed to add item for {0} in CreateNewInventoryItem!",
1085 private void HandleLinkInventoryItem(
IClientAPI remoteClient, UUID transActionID, UUID folderID,
1086 uint callbackID,
string description,
string name,
1087 sbyte invType, sbyte type, UUID olditemID)
1093 if (!Permissions.CanCreateUserInventory(invType, remoteClient.
AgentId))
1096 ScenePresence presence;
1097 if (TryGetScenePresence(remoteClient.
AgentId, out presence))
1120 remoteClient, remoteClient.
AgentId.ToString(), string.Empty, folderID,
1121 name, description, 0, callbackID, olditemID, type, invType,
1123 (uint)PermissionMask.All | (uint)
PermissionMask.Export, (uint)PermissionMask.All | (uint)
PermissionMask.Export, Util.UnixTimeSinceEpoch(),
1129 "ScenePresence for agent uuid {0} unexpectedly not found in HandleLinkInventoryItem",
1130 remoteClient.AgentId);
1146 InventoryService.DeleteItems(remoteClient.AgentId, itemIDs);
1157 m_log.DebugFormat(
"[SCENE INVENTORY]: RemoveInventoryFolders count {0}", folderIDs.Count);
1158 InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs);
1172 if (XferManager != null)
1173 part.Inventory.RequestInventoryFile(remoteClient, XferManager);
1189 group = part.ParentGroup;
1191 if (part != null && group != null)
1193 if (!Permissions.CanEditObjectInventory(part.
UUID, remoteClient.
AgentId))
1200 InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, FolderType.Trash);
1207 InventoryItemBase item2 = MoveTaskInventoryItem(remoteClient, destFolder.
ID, part, itemID, out message);
1211 m_log.WarnFormat(
"[SCENE INVENTORY]: RemoveTaskInventory of item {0} failed: {1}", itemID, message);
1212 remoteClient.SendAgentAlertMessage(message,
false);
1218 if (item.
Type == 10)
1220 part.RemoveScriptEvents(itemID);
1221 EventManager.TriggerRemoveScript(localID, itemID);
1224 group.RemoveInventoryItem(localID, itemID);
1227 part.SendPropertiesToClient(remoteClient);
1239 if (null == taskItem)
1242 "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for creating an avatar"
1243 +
" inventory item from a prim's inventory item "
1244 +
" but the required item does not exist in the prim's inventory",
1245 itemId, part.Name, part.UUID);
1246 message =
"Item not found: " + itemId;
1250 if ((destAgent != taskItem.
OwnerID) && ((taskItem.CurrentPermissions & (uint)
PermissionMask.Transfer) == 0))
1252 message =
"Item doesn't have the Transfer permission.";
1258 agentItem.ID = UUID.Random();
1259 agentItem.CreatorId = taskItem.CreatorID.ToString();
1260 agentItem.CreatorData = taskItem.CreatorData;
1261 agentItem.Owner = destAgent;
1262 agentItem.AssetID = taskItem.AssetID;
1263 agentItem.Description = taskItem.Description;
1264 agentItem.Name = taskItem.Name;
1265 agentItem.AssetType = taskItem.Type;
1266 agentItem.InvType = taskItem.InvType;
1267 agentItem.Flags = taskItem.Flags;
1269 if ((part.
OwnerID != destAgent) && Permissions.PropagatePermissions())
1271 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)
PermissionMask.Move);
1272 if (taskItem.
InvType == (
int)InventoryType.Object)
1278 uint perms = taskItem.BasePermissions & taskItem.NextPermissions;
1279 PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
1287 agentItem.CurrentPermissions = agentItem.BasePermissions;
1289 agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1292 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
1296 agentItem.BasePermissions = taskItem.BasePermissions;
1297 agentItem.CurrentPermissions = taskItem.CurrentPermissions;
1298 agentItem.NextPermissions = taskItem.NextPermissions;
1299 agentItem.EveryOnePermissions = taskItem.EveryonePermissions;
1300 agentItem.GroupPermissions = taskItem.GroupPermissions;
1310 private void RemoveNonCopyTaskItemFromPrim(SceneObjectPart part, UUID itemId)
1313 if (taskItem == null)
1316 if (!Permissions.BypassPermissions())
1320 if (taskItem.
Type == (
int)AssetType.LSLText)
1322 part.RemoveScriptEvents(itemId);
1323 EventManager.TriggerRemoveScript(part.LocalId, itemId);
1326 part.Inventory.RemoveInventoryItem(itemId);
1341 "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}",
1342 itemId, part.Name, folderId, remoteClient.Name);
1345 if (agentItem == null)
1348 agentItem.Folder = folderId;
1349 AddInventoryItem(remoteClient, agentItem);
1351 RemoveNonCopyTaskItemFromPrim(part, itemId);
1369 if (itemId ==
UUID.Zero)
1375 "[PRIM INVENTORY]: " +
1376 "Move of inventory item {0} from prim with local id {1} failed because the prim could not be found",
1377 itemId, primLocalId);
1384 if (null == taskItem)
1386 m_log.WarnFormat(
"[PRIM INVENTORY]: Move of inventory item {0} from prim with local id {1} failed"
1387 +
" because the inventory item could not be found",
1388 itemId, primLocalId);
1397 if (!Permissions.CanEditObjectInventory(part.
UUID, remoteClient.
AgentId))
1404 if (!Permissions.CanDeleteObject(part.
UUID, remoteClient.
AgentId))
1409 InventoryItemBase item = MoveTaskInventoryItem(remoteClient, folderId, part, itemId, out message);
1412 remoteClient.SendAgentAlertMessage(message,
false);
1430 if (TryGetScenePresence(avatarId, out avatar))
1432 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId, out message);
1436 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId, out message);
1438 if (agentItem == null)
1441 agentItem.Folder = folderId;
1443 AddInventoryItem(agentItem);
1445 RemoveNonCopyTaskItemFromPrim(part, itemId);
1461 if (srcTaskItem == null)
1464 "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for moving"
1465 +
" but the item does not exist in this inventory",
1466 itemId, part.Name, part.UUID);
1473 if (destPart == null)
1476 "[PRIM INVENTORY]: " +
1477 "Could not find prim for ID {0}",
1487 bool overrideNoMod =
false;
1489 overrideNoMod =
true;
1500 if (((part.
OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod))
1507 destTaskItem.ItemID = UUID.Random();
1508 destTaskItem.CreatorID = srcTaskItem.CreatorID;
1509 destTaskItem.CreatorData = srcTaskItem.CreatorData;
1510 destTaskItem.AssetID = srcTaskItem.AssetID;
1511 destTaskItem.GroupID = destPart.GroupID;
1512 destTaskItem.OwnerID = destPart.OwnerID;
1513 destTaskItem.ParentID = destPart.UUID;
1514 destTaskItem.ParentPartID = destPart.UUID;
1516 destTaskItem.BasePermissions = srcTaskItem.BasePermissions;
1517 destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions;
1518 destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions;
1519 destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions;
1520 destTaskItem.NextPermissions = srcTaskItem.NextPermissions;
1521 destTaskItem.Flags = srcTaskItem.Flags;
1525 if (Permissions.PropagatePermissions())
1527 destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions &
1529 destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions &
1531 destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions &
1533 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1535 destTaskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
1539 destTaskItem.Description = srcTaskItem.Description;
1540 destTaskItem.Name = srcTaskItem.Name;
1541 destTaskItem.InvType = srcTaskItem.InvType;
1542 destTaskItem.Type = srcTaskItem.Type;
1544 destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID);
1547 part.Inventory.RemoveInventoryItem(itemId);
1551 if (TryGetScenePresence(srcTaskItem.
OwnerID, out avatar))
1553 destPart.SendPropertiesToClient(avatar.ControllingClient);
1562 if (TryGetScenePresence(destID, out avatar))
1563 remoteClient = avatar.ControllingClient;
1566 if (destPart != null)
1568 foreach(
UUID itemID
in items)
1569 MoveTaskInventoryItem(destID, host, itemID);
1576 UUID newFolderID = UUID.Random();
1579 InventoryService.AddFolder(newFolder);
1581 foreach (
UUID itemID
in items)
1584 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID, out message);
1586 if (agentItem != null)
1588 agentItem.Folder = newFolderID;
1590 AddInventoryItem(agentItem);
1592 RemoveNonCopyTaskItemFromPrim(host, itemID);
1596 if (remoteClient != null)
1597 remoteClient.SendAgentAlertMessage(message,
false);
1601 if (remoteClient != null)
1603 SendInventoryUpdate(remoteClient, rootFolder,
true,
false);
1604 SendInventoryUpdate(remoteClient, newFolder,
false,
true);
1619 if (LibraryService != null && LibraryService.LibraryRootFolder != null)
1621 if ((fold = LibraryService.LibraryRootFolder.
FindFolder(folder.
ID)) != null)
1623 client.SendInventoryFolderDetails(
1624 fold.Owner, folder.ID, fold.RequestListOfItems(),
1631 InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID);
1635 containingFolder = InventoryService.GetFolder(containingFolder);
1640 if (containingFolder != null)
1644 HashSet<UUID> linkedItemFolderIdsToSend =
new HashSet<UUID>();
1647 if (item.
AssetType == (
int)AssetType.Link)
1655 if (linkedItem != null && linkedItem.
AssetType != (
int)AssetType.Link)
1659 if (linkedItem.
Folder != containingFolder.ID)
1660 linkedItemFolderIdsToSend.Add(linkedItem.Folder);
1665 foreach (
UUID linkedItemFolderId
in linkedItemFolderIdsToSend)
1668 client.SendInventoryFolderDetails(
1669 client.AgentId, folder.ID, contents.Items, contents.Folders,
1670 containingFolder.Version, fetchFolders, fetchItems);
1685 UUID itemID = itemInfo.ItemID;
1693 bool allowInventoryDrop = (part.GetEffectiveObjectFlags()
1694 & (uint)PrimFlags.AllowInventoryDrop) != 0;
1700 if (!Permissions.CanEditObjectInventory(part.
UUID, remoteClient.
AgentId)
1701 && (currentItem != null || !allowInventoryDrop))
1704 if (currentItem == null)
1706 UUID copyID = UUID.Random();
1707 if (itemID !=
UUID.Zero)
1710 item = InventoryService.GetItem(item);
1713 if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
1715 item = LibraryService.LibraryRootFolder.FindItem(itemID);
1721 part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID);
1723 "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
1724 item.Name, primLocalID, remoteClient.Name);
1725 part.SendPropertiesToClient(remoteClient);
1726 if (!Permissions.BypassPermissions())
1730 List<UUID> uuids =
new List<UUID>();
1739 "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!",
1740 itemID, remoteClient.Name);
1753 if (transactionID !=
UUID.Zero && AgentTransactionsModule != null)
1755 AgentTransactionsModule.HandleTaskItemUpdateFromTransaction(
1756 remoteClient, part, transactionID, currentItem);
1772 if (!Permissions.IsGod(remoteClient.
AgentId))
1777 itemInfo.BasePermissions = currentItem.BasePermissions;
1778 itemInfo.EveryonePermissions = currentItem.EveryonePermissions;
1779 itemInfo.GroupPermissions = currentItem.GroupPermissions;
1780 itemInfo.NextPermissions = currentItem.NextPermissions;
1781 itemInfo.CurrentPermissions = currentItem.CurrentPermissions;
1787 itemInfo.BasePermissions = currentItem.BasePermissions;
1789 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
1791 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
1793 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
1795 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
1806 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase;
1808 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
1810 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
1812 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
1814 itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
1822 part.SendPropertiesToClient(remoteClient);
1829 "[PRIM INVENTORY]: " +
1830 "Update with item {0} requested of prim {1} for {2} but this prim does not exist",
1831 itemID, primLocalID, remoteClient.Name);
1846 if (itemBase.
ID !=
UUID.Zero)
1847 partWhereRezzed = RezScriptFromAgentInventory(remoteClient.
AgentId, itemBase.
ID, localID);
1849 partWhereRezzed = RezNewScript(remoteClient.
AgentId, itemBase);
1851 if (partWhereRezzed != null)
1852 partWhereRezzed.SendPropertiesToClient(remoteClient);
1864 UUID copyID = UUID.Random();
1866 item = InventoryService.GetItem(item);
1870 if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
1872 item = LibraryService.LibraryRootFolder.FindItem(fromItemID);
1880 if (!Permissions.CanEditObjectInventory(part.
UUID, agentID))
1883 part.ParentGroup.AddInventoryItem(agentID, localID, item, copyID);
1886 part.Inventory.CreateScriptInstance(copyID, 0,
false, DefaultScriptEngine, 0);
1889 EventManager.TriggerNewScript(agentID, part, copyID);
1895 part.ParentGroup.ResumeScripts();
1902 "[PRIM INVENTORY]: " +
1903 "Could not rez script {0} into prim local ID {1} for user {2}"
1904 +
" because the prim could not be found in the region!",
1905 item.Name, localID, agentID);
1911 "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!",
1912 fromItemID, agentID);
1926 return RezNewScript(
1929 "default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}");
1952 if (!Permissions.CanCreateObjectInventory(itemBase.
InvType, part.
UUID, agentID))
1965 Encoding.ASCII.GetBytes(scriptText),
1968 AssetService.Store(asset);
1972 taskItem.ResetIDs(itemBase.Folder);
1973 taskItem.ParentID = itemBase.Folder;
1975 taskItem.Name = itemBase.
Name;
1978 taskItem.InvType = itemBase.
InvType;
1979 taskItem.OwnerID = itemBase.
Owner;
1986 taskItem.GroupID = itemBase.
GroupID;
1987 taskItem.GroupPermissions = 0;
1988 taskItem.Flags = itemBase.
Flags;
1989 taskItem.PermsGranter =
UUID.Zero;
1990 taskItem.PermsMask = 0;
1991 taskItem.AssetID = asset.
FullID;
1994 part.Inventory.CreateScriptInstance(taskItem, 0,
false, DefaultScriptEngine, 0);
1997 EventManager.TriggerNewScript(agentID, part, taskItem.ItemID);
1999 part.ParentGroup.ResumeScripts();
2017 if (srcTaskItem == null)
2020 "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for rezzing a script but the "
2021 +
" item does not exist in this inventory",
2022 srcId, srcPart.Name, srcPart.UUID);
2029 if (destPart == null)
2032 "[PRIM INVENTORY]: Could not find part {0} to insert script item {1} from {2} {3} in {4}",
2033 destId, srcId, srcPart.Name, srcPart.UUID, Name);
2041 if ((destPart.
GroupID ==
UUID.Zero) || (destPart.GroupID != srcPart.GroupID) ||
2047 if ((destPart.
OwnerMask & (uint)PermissionMask.Modify) == 0)
2054 "[PRIM INVENTORY]: " +
2055 "Script in object {0} : {1}, attempted to load script {2} : {3} into object {4} : {5} with invalid pin {6}",
2056 srcPart.Name, srcId, srcTaskItem.Name, srcTaskItem.ItemID, destPart.Name, destId, pin);
2065 destTaskItem.ItemID = UUID.Random();
2066 destTaskItem.CreatorID = srcTaskItem.CreatorID;
2067 destTaskItem.CreatorData = srcTaskItem.CreatorData;
2068 destTaskItem.AssetID = srcTaskItem.AssetID;
2069 destTaskItem.GroupID = destPart.GroupID;
2070 destTaskItem.OwnerID = destPart.OwnerID;
2071 destTaskItem.ParentID = destPart.UUID;
2072 destTaskItem.ParentPartID = destPart.UUID;
2074 destTaskItem.BasePermissions = srcTaskItem.BasePermissions;
2075 destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions;
2076 destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions;
2077 destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions;
2078 destTaskItem.NextPermissions = srcTaskItem.NextPermissions;
2079 destTaskItem.Flags = srcTaskItem.Flags;
2083 if (Permissions.PropagatePermissions())
2085 destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions &
2086 srcTaskItem.NextPermissions;
2087 destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions &
2088 srcTaskItem.NextPermissions;
2089 destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions &
2090 srcTaskItem.NextPermissions;
2091 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
2092 srcTaskItem.NextPermissions;
2093 destTaskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
2097 destTaskItem.Description = srcTaskItem.Description;
2098 destTaskItem.Name = srcTaskItem.Name;
2099 destTaskItem.InvType = srcTaskItem.InvType;
2100 destTaskItem.Type = srcTaskItem.Type;
2102 destPart.Inventory.AddInventoryItemExclusive(destTaskItem,
false);
2106 destPart.Inventory.CreateScriptInstance(destTaskItem, start_param,
false, DefaultScriptEngine, 0);
2109 destPart.ParentGroup.ResumeScripts();
2113 if (TryGetScenePresence(srcTaskItem.
OwnerID, out avatar))
2115 destPart.SendPropertiesToClient(avatar.ControllingClient);
2135 List<uint> deleteIDs =
new List<uint>();
2136 List<SceneObjectGroup> deleteGroups =
new List<SceneObjectGroup>();
2137 List<SceneObjectGroup> takeGroups =
new List<SceneObjectGroup>();
2141 bool permissionToTake =
true;
2142 bool permissionToTakeCopy =
true;
2143 bool permissionToDelete =
true;
2145 foreach (uint localID
in localIDs)
2154 deleteIDs.Add(localID);
2162 deleteIDs.Add(localID);
2173 grp.AdjustChildPrimPermissions(
false);
2175 if (remoteClient == null)
2182 "[AGENT INVENTORY]: Ignoring attempt to {0} {1} {2} without a client",
2183 action, grp.Name, grp.UUID);
2187 permissionToTakeCopy =
false;
2193 if (!Permissions.CanTakeCopyObject(grp.
UUID, remoteClient.
AgentId))
2194 permissionToTakeCopy =
false;
2198 permissionToTakeCopy =
false;
2200 if (!Permissions.CanTakeObject(grp.
UUID, remoteClient.
AgentId))
2201 permissionToTake =
false;
2203 if (!Permissions.CanDeleteObject(grp.
UUID, remoteClient.
AgentId))
2204 permissionToDelete =
false;
2208 if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId))
2210 permissionToTake =
true;
2211 permissionToTakeCopy =
true;
2212 permissionToDelete =
true;
2216 if (action ==
DeRezAction.SaveToExistingUserInventoryItem)
2217 permissionToDelete =
false;
2227 if (!permissionToTakeCopy)
2229 remoteClient.SendAlertMessage(
"You don't have permission to take the object");
2233 permissionToTake =
true;
2235 permissionToDelete =
false;
2240 if (remoteClient != null)
2242 if (Permissions.CanReturnObjects(
2245 new List<SceneObjectGroup>() {grp}))
2247 permissionToTake =
true;
2248 permissionToDelete =
true;
2255 permissionToTake =
true;
2256 permissionToDelete =
true;
2260 if (permissionToTake && (!permissionToDelete))
2261 takeGroups.Add(grp);
2263 if (permissionToDelete)
2265 if (permissionToTake)
2266 deleteGroups.Add(grp);
2267 deleteIDs.Add(grp.LocalId);
2271 SendKillObject(deleteIDs);
2273 if (deleteGroups.Count > 0)
2276 deleteIDs.Remove(g.LocalId);
2278 m_asyncSceneObjectDeleter.DeleteToInventory(
2279 action, destinationID, deleteGroups, remoteClient,
2282 if (takeGroups.Count > 0)
2284 m_asyncSceneObjectDeleter.DeleteToInventory(
2285 action, destinationID, takeGroups, remoteClient,
2288 if (deleteIDs.Count > 0)
2290 foreach (SceneObjectGroup g
in deleteGroups)
2291 DeleteSceneObject(g,
true);
2300 Vector3 inventoryStoredPosition =
new Vector3(
2302 Math.Min(grp.AbsolutePosition.Y, RegionInfo.RegionSizeY - 6),
2305 Vector3 originalPosition = grp.AbsolutePosition;
2307 grp.AbsolutePosition = inventoryStoredPosition;
2309 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
2311 grp.AbsolutePosition = originalPosition;
2315 grp.GetPartDescription(grp.LocalId),
2316 (sbyte)AssetType.Object,
2317 Utils.StringToBytes(sceneObjectXml),
2319 AssetService.Store(asset);
2322 item.CreatorId = grp.RootPart.CreatorID.ToString();
2323 item.CreatorData = grp.RootPart.CreatorData;
2324 item.Owner = remoteClient.AgentId;
2325 item.ID = UUID.Random();
2326 item.AssetID = asset.FullID;
2327 item.Description = asset.Description;
2328 item.Name = asset.Name;
2329 item.AssetType = asset.Type;
2330 item.InvType = (int)InventoryType.Object;
2334 item.Folder = folder.ID;
2336 item.Folder = UUID.Zero;
2340 permsBase &= grp.RootPart.BaseMask;
2348 item.BasePermissions = permsBase & grp.RootPart.NextOwnerMask;
2349 item.CurrentPermissions = permsBase & grp.RootPart.NextOwnerMask;
2350 item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask;
2351 item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask;
2352 item.GroupPermissions = permsBase & grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask;
2356 item.BasePermissions = permsBase;
2357 item.CurrentPermissions = permsBase & grp.RootPart.OwnerMask;
2358 item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask;
2359 item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask;
2360 item.GroupPermissions = permsBase & grp.RootPart.GroupMask;
2362 item.CreationDate = Util.UnixTimeSinceEpoch();
2365 grp.FromItemID = item.ID;
2367 if (AddInventoryItem(item))
2370 m_dialogModule.SendAlertToUser(remoteClient,
"Operation failed");
2373 return item.AssetID;
2396 byte[] assetData,
bool isAttachment, out List<SceneObjectGroup> objlist, out List<Vector3> veclist,
2397 out Vector3 bbox, out
float offsetHeight)
2399 objlist =
new List<SceneObjectGroup>();
2400 veclist =
new List<Vector3>();
2401 bbox = Vector3.Zero;
2404 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(assetData));
2408 using (XmlTextReader wrappedReader =
new XmlTextReader(xmlData, XmlNodeType.Element, null))
2410 using (XmlReader reader = XmlReader.Create(wrappedReader,
new XmlReaderSettings() { IgnoreWhitespace =
true, ConformanceLevel = ConformanceLevel.Fragment }))
2413 bool isSingleObject = reader.Name !=
"CoalescedObject";
2415 if (isSingleObject || isAttachment)
2420 g = SceneObjectSerializer.FromOriginalXmlFormat(reader);
2424 m_log.Error(
"[AGENT INVENTORY]: Deserialization of xml failed ", e);
2425 Util.LogFailedXML(
"[AGENT INVENTORY]:", xmlData);
2432 veclist.Add(Vector3.Zero);
2433 bbox = g.GetAxisAlignedBoundingBox(out offsetHeight);
2440 XmlDocument doc =
new XmlDocument();
2441 doc.LoadXml(xmlData);
2442 XmlElement e = (XmlElement)doc.SelectSingleNode(
"/CoalescedObject");
2443 XmlElement coll = (XmlElement)e;
2444 float bx = Convert.ToSingle(coll.GetAttribute(
"x"));
2445 float by = Convert.ToSingle(coll.GetAttribute(
"y"));
2446 float bz = Convert.ToSingle(coll.GetAttribute(
"z"));
2447 bbox =
new Vector3(bx, by, bz);
2450 XmlNodeList groups = e.SelectNodes(
"SceneObjectGroup");
2451 foreach (XmlNode n
in groups)
2453 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
2458 XmlElement el = (XmlElement)n;
2459 string rawX = el.GetAttribute(
"offsetx");
2460 string rawY = el.GetAttribute(
"offsety");
2461 string rawZ = el.GetAttribute(
"offsetz");
2463 float x = Convert.ToSingle(rawX);
2464 float y = Convert.ToSingle(rawY);
2465 float z = Convert.ToSingle(rawZ);
2466 veclist.Add(
new Vector3(x, y, z));
2477 m_log.Error(
"[AGENT INVENTORY]: Deserialization of xml failed when looking for CoalescedObject tag ", e);
2478 Util.LogFailedXML(
"[AGENT INVENTORY]:", xmlData);
2501 UUID RayTargetID, byte BypassRayCast,
bool RayEndIsIntersection,
2502 bool RezSelected,
bool RemoveItem, UUID fromTaskID)
2508 if (fromTaskID ==
UUID.Zero)
2511 if (invAccess != null)
2512 invAccess.RezObject(
2513 remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
2514 RezSelected, RemoveItem, fromTaskID,
false);
2522 "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such scene object",
2523 remoteClient.Name, itemID, fromTaskID);
2532 "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such item",
2533 remoteClient.Name, itemID, fromTaskID);
2538 byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
2539 Vector3 scale =
new Vector3(0.5f, 0.5f, 0.5f);
2541 = GetNewRezLocation(
2542 RayStart, RayEnd, RayTargetID, Quaternion.Identity,
2543 BypassRayCast, bRayEndIsIntersection,
true, scale,
false);
2545 RezObject(part, item, pos, null, Vector3.Zero, 0,
false);
2566 List<SceneObjectGroup> objlist;
2567 List<Vector3> veclist;
2571 bool success = sourcePart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist,out bbox, out offsetHeight);
2578 totalPrims += group.PrimCount;
2580 if (!Permissions.CanRezObject(totalPrims, item.OwnerID, pos))
2583 if (!Permissions.BypassPermissions())
2586 sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
2591 bool fixrot =
false;
2592 Quaternion netRot = Quaternion.Identity;
2597 if (objlist.Count == 1)
2605 orot = sog.RootPart.GetWorldRotation();
2609 Vector3 off = sog.GetGeometricCenter();
2631 netRot = Quaternion.Conjugate(sog.RootPart.GetWorldRotation());
2632 netRot = netRot * rot.Value;
2644 for (
int i = 0; i < objlist.Count; i++)
2649 curpos = pos + veclist[i] * netRot;
2651 curpos = pos + veclist[i];
2655 group.RootPart.AttachedPos = group.AbsolutePosition;
2659 group.FromPartID = sourcePart.UUID;
2661 AddNewSceneObject(group,
true, curpos, rot, vel);
2664 Quaternion crot = objlist[i].RootPart.GetWorldRotation();
2669 AddNewSceneObject(group,
true, curpos, crot, vel);
2674 group.CreateScriptInstances(param,
true, DefaultScriptEngine, 3);
2676 group.ScheduleGroupForFullUpdate();
2685 List<uint> localIDs =
new List<uint>();
2690 "parcel owner return");
2691 localIDs.Add(grp.RootPart.LocalId);
2701 if (!Permissions.CanEditScript(itemID, objectID, controllingClient.
AgentId))
2709 EventManager.TriggerStartScript(part.LocalId, itemID);
2711 EventManager.TriggerStopScript(part.LocalId, itemID);
2716 EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID);
2721 if (!Permissions.IsGod(remoteClient.
AgentId))
2723 if (ownerID !=
UUID.Zero)
2726 if (!Permissions.CanDeedObject(remoteClient.
AgentId, groupID))
2730 List<SceneObjectGroup> groups =
new List<SceneObjectGroup>();
2732 foreach (uint localID
in localIDs)
2734 SceneObjectPart part = GetSceneObjectPart(localID);
2738 if (!groups.Contains(part.ParentGroup))
2739 groups.Add(part.ParentGroup);
2742 foreach (SceneObjectGroup sog
in groups)
2744 if (ownerID !=
UUID.Zero)
2746 sog.SetOwnerId(ownerID);
2747 sog.SetGroup(groupID, remoteClient);
2748 sog.ScheduleGroupForFullUpdate();
2750 SceneObjectPart[] partList = sog.Parts;
2752 foreach (SceneObjectPart child
in partList)
2754 child.Inventory.ChangeInventoryOwner(ownerID);
2755 child.TriggerScriptChangedEvent(Changed.OWNER);
2760 if (!Permissions.IsGod(remoteClient.
AgentId) && sog.OwnerID != remoteClient.AgentId)
2763 if (!Permissions.CanTransferObject(sog.UUID, groupID))
2766 if (sog.GroupID != groupID)
2769 SceneObjectPart[] partList = sog.Parts;
2771 foreach (SceneObjectPart child
in partList)
2773 child.LastOwnerID = child.OwnerID;
2774 child.Inventory.ChangeInventoryOwner(groupID);
2775 child.TriggerScriptChangedEvent(Changed.OWNER);
2778 sog.SetOwnerId(groupID);
2779 sog.ApplyNextOwnerPermissions();
2783 foreach (uint localID
in localIDs)
2785 SceneObjectPart part = GetSceneObjectPart(localID);
2788 part.SendPropertiesToClient(remoteClient);
2794 List<SceneObjectPart> parts =
new List<SceneObjectPart>();
2796 foreach (uint localID
in primIds)
2807 m_sceneGraph.DelinkObjects(parts);
2827 public void LinkObjects(UUID agentId, uint parentPrimId, List<uint> childPrimIds)
2829 List<UUID> owners =
new List<UUID>();
2831 List<SceneObjectPart> children =
new List<SceneObjectPart>();
2836 m_log.DebugFormat(
"[LINK]: Can't find linkset root prim {0}", parentPrimId);
2840 if (!Permissions.CanLinkObject(agentId, root.ParentGroup.RootPart.UUID))
2842 m_log.DebugFormat(
"[LINK]: Refusing link. No permissions on root prim");
2846 foreach (uint localID
in childPrimIds)
2853 if (!owners.Contains(part.
OwnerID))
2862 if (owners.Count > 1)
2864 m_log.DebugFormat(
"[LINK]: Refusing link. Too many owners");
2868 if (children.Count == 0)
2870 m_log.DebugFormat(
"[LINK]: Refusing link. No permissions to link any of the children");
2874 bool oldUsePhysics = (root.Flags & PrimFlags.Physics) != 0;
2875 m_sceneGraph.LinkObjects(root, children);
2878 if (TryGetScenePresence(agentId, out sp))
2880 root.SendPropertiesToClient(sp.ControllingClient);
2881 if (oldUsePhysics && (root.Flags &
PrimFlags.Physics) == 0)
2883 sp.ControllingClient.SendAlertMessage(
"Object physics canceled");
2888 private string PermissionString(uint permissions)
2895 return perms.ToString();
bool AddInventoryItem(InventoryItemBase item)
virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client, UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
Give an entire inventory folder from one user to another. The entire contents (including all descende...
virtual List< SceneObjectGroup > RezObject(SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion?rot, Vector3 vel, int param, bool atRoot)
Rez an object into the scene from a prim's inventory.
IClientAPI ControllingClient
delegate void RemoveInventoryItem(IClientAPI remoteClient, List< UUID > itemIDs)
IEntityInventory Inventory
This part's inventory
void AddInventoryItem(UUID AgentID, InventoryItemBase item)
Add the given inventory item to a user's inventory.
void ClientMoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, uint primLocalId, UUID itemId)
ClientMoveTaskInventoryItem
bool AddInventoryItem(InventoryItemBase item, bool trigger)
Add the given inventory item to a user's inventory.
void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId)
Copy a task (prim) inventory item to another task (prim)
Send FetchInventoryReply information to clients asynchronously on a single thread rather than asynchr...
List< InventoryFolderBase > RequestListOfFolders()
Return a copy of the list of child folders in this folder. The folders themselves are the originals...
UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID)
Create a new asset data structure.
void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID)
Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory ...
InventoryFolderImpl FindFolder(UUID folderID)
Returns the folder requested if it is this folder or is a descendent of this folder. The search is depth first.
void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
Send the details of a prim's inventory to the client.
delegate void RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID)
bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item)
uint RegionSizeX
X dimension of the region.
void MoveInventoryItem(IClientAPI remoteClient, List< InventoryItemBase > items)
Move an item within the agent's inventory.
virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId, out string message)
Give an inventory item from one user to another
Asynchronously derez objects. This is used to derez large number of objects to inventory without hold...
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
Represents an item in a task inventory
ArrayList CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId, UUID primId, bool isScriptRunning, byte[] data)
CapsUpdateTaskInventoryScriptAsset(IClientAPI, UUID, UUID, bool, byte[])
AsyncSceneObjectGroupDeleter m_asyncSceneObjectDeleter
Allows asynchronous derezzing of objects from the scene into a client's inventory.
SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase)
Rez a new script from nothing.
bool GetObjectsToRez(byte[] assetData, bool isAttachment, out List< SceneObjectGroup > objlist, out List< Vector3 > veclist, out Vector3 bbox, out float offsetHeight)
Returns the list of Scene Objects in an asset.
delegate void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, UUID oldAgentID, UUID oldItemID, UUID newFolderID, string newName)
virtual void RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID)
Event Handler Rez an object into a scene Calls the non-void event handler
virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId, out string message)
Give an inventory item from one user to another
virtual UUID Owner
The agent who's inventory this is contained by
void LinkObjects(IClientAPI client, uint parentPrimId, List< uint > childPrimIds)
Link the scene objects containing the indicated parts to a root object.
void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId, out string message)
Move the given item in the given prim to a folder in the client's inventory
bool UpdateInventoryItem(TaskInventoryItem item)
Update an existing inventory item.
ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId, UUID primId, bool isScriptRunning, byte[] data)
Capability originating call to update the asset of a script in a prim's (task's) inventory ...
List< InventoryItemBase > Items
bool IsDeleted
Signals whether this entity was in a scene but has since been removed from it.
Asset class. All Assets are reference by this class or a class derived from this class ...
UUID CapsUpdateInventoryItemAsset(UUID avatarId, UUID itemID, byte[] data)
CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])
static void enforceItemPermitions(InventoryItemBase it, bool IsCreator)
int CreateScriptInstances()
Creates all the scripts in the scene which should be started.
void UpdateTaskInventory(IClientAPI remoteClient, UUID transactionID, TaskInventoryItem itemInfo, uint primLocalID)
Update an item in a prim (task) inventory. This method does not handle scripts, RezScript(IClientAPI...
void StartScripts()
Lets the script engines start processing scripts.
void AddInventoryItem(TaskInventoryItem item, bool allowedDrop)
Add an item to this entity's inventory. If an item with the same name already exists, then an alternative name is chosen.
void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param)
Rez a script into a prim's inventory from another prim
void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, UUID oldAgentID, UUID oldItemID, UUID newFolderID, string newName)
uint AttachmentPoint
Attachment point of this scene object to an avatar.
Inventory Item - contains all the properties associated with an individual inventory piece...
void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, UUID itemID, InventoryItemBase itemUpd)
Update an item which is either already in the client's inventory or is within a transaction ...
TaskInventoryItem GetInventoryItem(uint primID, UUID itemID)
Returns an existing inventory item. Returns the original, so any changes will be live.
virtual void DeRezObjects(IClientAPI remoteClient, List< uint > localIDs, UUID groupID, DeRezAction action, UUID destinationID)
Derez one or more objects from the scene.
delegate void ObjectOwner(IClientAPI remoteClient, UUID ownerID, UUID groupID, List< uint > localIDs)
void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID)
Remove an item from a prim (task) inventory
string GetPartName(uint localID)
void DelinkObjects(List< uint > primIds, IClientAPI client)
delegate void MoveInventoryItem(IClientAPI remoteClient, List< InventoryItemBase > items)
void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List< InventoryItemBase > items, UUID destfolder)
Move an item within the agent's inventory, and leave a copy (used in making a new outfit) ...
delegate void LinkObjects(IClientAPI remoteClient, uint parent, List< uint > children)
void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId)
Tell the client that we have created the item it requested.
InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId, out string message)
MoveTaskInventoryItem
UUID ID
A UUID containing the ID for the inventory node itself
SceneObjectGroup ParentGroup
void LinkObjects(UUID agentId, uint parentPrimId, List< uint > childPrimIds)
Link the scene objects containing the indicated parts to a root object.
void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
Add an inventory item to an avatar's inventory.
void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running)
virtual string Name
The name of the node (64 characters or less)
UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List< UUID > items)
SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase, string scriptText)
Rez a new script from nothing with given script text.
override Vector3 AbsolutePosition
The absolute position of this scene object in the scene
OpenSim.Framework.PermissionMask PermissionMask
void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems)
void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item, uint cost)
delegate void RemoveInventoryFolder(IClientAPI remoteClient, List< UUID > folderIDs)
SceneObjectPart RezScriptFromAgentInventory(UUID agentID, UUID fromItemID, uint localID)
Rez a script into a prim from an agent inventory.
uint GetEffectiveObjectFlags()
override string Name
The name of an object grouping is always the same as its root part
This maintains the relationship between a UUID and a user name.
virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId)
void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate)
Create a new inventory item.
OpenSim.Region.Framework.Scenes.Animation.AnimationSet AnimationSet
AsyncInventorySender m_asyncInventorySender
Allows inventory details to be sent to clients asynchronously
Used to serialize a whole inventory for transfer over the network.
bool IsAttachment
Is this scene object acting as an attachment?
virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId, out string message)
Give an inventory item from one user to another
delegate void CreateNewInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask, int creationDate)