本文整理汇总了C#中TaskInventoryItem类的典型用法代码示例。如果您正苦于以下问题:C# TaskInventoryItem类的具体用法?C# TaskInventoryItem怎么用?C# TaskInventoryItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskInventoryItem类属于命名空间,在下文中一共展示了TaskInventoryItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ProcessTIOldItemID
private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader)
{
//Disable this, if we are rezzing from inventory, we want to get a new ItemID for next time
//item.OldItemID = ReadUUID (reader, "OldItemID");
ReadUUID(reader, "OldItemID");
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:6,代码来源:SceneObjectSerializer.cs
示例2: UpdateTaskInventory
/// <summary>
/// Update an item in a prim (task) inventory.
/// This method does not handle scripts, <see>RezScript(IClientAPI, UUID, unit)</see>
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="transactionID"></param>
/// <param name="itemInfo"></param>
/// <param name="primLocalID"></param>
protected void UpdateTaskInventory(IClientAPI remoteClient, UUID transactionID, TaskInventoryItem itemInfo,
uint primLocalID)
{
UUID itemID = itemInfo.ItemID;
// Find the prim we're dealing with
ISceneChildEntity part = m_scene.GetSceneObjectPart (primLocalID);
if (part != null)
{
TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID);
bool allowInventoryDrop = (part.GetEffectiveObjectFlags()
& (uint)PrimFlags.AllowInventoryDrop) != 0;
// Explicity allow anyone to add to the inventory if the
// AllowInventoryDrop flag has been set. Don't however let
// them update an item unless they pass the external checks
//
if (!m_scene.Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)
&& (currentItem != null || !allowInventoryDrop))
return;
if (currentItem == null)
{
UUID copyID = UUID.Random();
if (itemID != UUID.Zero)
{
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_scene.InventoryService.GetItem(item);
// If we've found the item in the user's inventory or in the library
if (item != null)
{
part.ParentEntity.AddInventoryItem (remoteClient, primLocalID, item, copyID);
MainConsole.Instance.InfoFormat(
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
item.Name, primLocalID, remoteClient.Name);
part.GetProperties(remoteClient);
if (!m_scene.Permissions.BypassPermissions())
{
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
{
List<UUID> uuids = new List<UUID> {itemID};
RemoveInventoryItem(remoteClient, uuids);
}
}
}
else
{
MainConsole.Instance.ErrorFormat(
"[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!",
itemID, remoteClient.Name);
}
}
}
else // Updating existing item with new perms etc
{
// Base ALWAYS has move
currentItem.BasePermissions |= (uint)PermissionMask.Move;
// Check if we're allowed to mess with permissions
if (!m_scene.Permissions.IsGod(remoteClient.AgentId)) // Not a god
{
if (remoteClient.AgentId != part.OwnerID) // Not owner
{
// Friends and group members can't change any perms
itemInfo.BasePermissions = currentItem.BasePermissions;
itemInfo.EveryonePermissions = currentItem.EveryonePermissions;
itemInfo.GroupPermissions = currentItem.GroupPermissions;
itemInfo.NextPermissions = currentItem.NextPermissions;
itemInfo.CurrentPermissions = currentItem.CurrentPermissions;
}
else
{
// Owner can't change base, and can change other
// only up to base
itemInfo.BasePermissions = currentItem.BasePermissions;
itemInfo.EveryonePermissions &= currentItem.BasePermissions;
itemInfo.GroupPermissions &= currentItem.BasePermissions;
itemInfo.CurrentPermissions &= currentItem.BasePermissions;
itemInfo.NextPermissions &= currentItem.BasePermissions;
}
}
// Next ALWAYS has move
itemInfo.NextPermissions |= (uint)PermissionMask.Move;
if (part.Inventory.UpdateInventoryItem(itemInfo))
{
part.GetProperties(remoteClient);
}
//.........这里部分代码省略.........
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:101,代码来源:LLClientInventory.cs
示例3: RezScript
/// <summary>
/// Rez a script into a prim's inventory from another prim
/// This is used for the LSL function llRemoteLoadScriptPin and requires a valid pin to be used
/// </summary>
/// <param name="srcId">The UUID of the script that is going to be copied</param>
/// <param name="srcPart">The prim that the script that is going to be copied from</param>
/// <param name="destId">The UUID of the prim that the </param>
/// <param name="pin">The ScriptAccessPin of the prim</param>
/// <param name="running">Whether the script should be running when it is started</param>
/// <param name="start_param">The start param to pass to the script</param>
public void RezScript (UUID srcId, ISceneChildEntity srcPart, UUID destId, int pin, int running, int start_param)
{
TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId);
if (srcTaskItem == null)
{
MainConsole.Instance.ErrorFormat(
"[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for rezzing a script but the "
+ " item does not exist in this inventory",
srcId, srcPart.Name, srcPart.UUID);
return;
}
ISceneChildEntity destPart = m_scene.GetSceneObjectPart (destId);
if (destPart == null)
{
MainConsole.Instance.ErrorFormat(
"[PRIM INVENTORY]: " +
"Could not find script for ID {0}",
destId);
return;
}
// Must own the object, and have modify rights
if (srcPart.OwnerID != destPart.OwnerID)
{
// Group permissions
if ((destPart.GroupID == UUID.Zero) || (destPart.GroupID != srcPart.GroupID) ||
((destPart.GroupMask & (uint)PermissionMask.Modify) == 0))
return;
}
else
{
if ((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0)
return;
}
if (destPart.ScriptAccessPin != pin)
{
MainConsole.Instance.WarnFormat(
"[PRIM INVENTORY]: " +
"Script in object {0} : {1}, attempted to load script {2} : {3} into object {4} : {5} with invalid pin {6}",
srcPart.Name, srcId, srcTaskItem.Name, srcTaskItem.ItemID, destPart.Name, destId, pin);
// the LSL Wiki says we are supposed to shout on the DEBUG_CHANNEL -
// "Object: Task Object trying to illegally load script onto task Other_Object!"
// How do we shout from in here?
return;
}
TaskInventoryItem destTaskItem = new TaskInventoryItem
{
ItemID = UUID.Random(),
CreatorID = srcTaskItem.CreatorID,
CreatorData = srcTaskItem.CreatorData,
AssetID = srcTaskItem.AssetID,
GroupID = destPart.GroupID,
OwnerID = destPart.OwnerID,
ParentID = destPart.UUID,
ParentPartID = destPart.UUID,
BasePermissions = srcTaskItem.BasePermissions,
EveryonePermissions = srcTaskItem.EveryonePermissions,
GroupPermissions = srcTaskItem.GroupPermissions,
CurrentPermissions = srcTaskItem.CurrentPermissions,
NextPermissions = srcTaskItem.NextPermissions,
Flags = srcTaskItem.Flags,
SalePrice = srcTaskItem.SalePrice,
SaleType = srcTaskItem.SaleType
};
if (destPart.OwnerID != srcPart.OwnerID)
{
if (m_scene.Permissions.PropagatePermissions())
{
destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions &
srcTaskItem.NextPermissions;
destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions &
srcTaskItem.NextPermissions;
destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions &
srcTaskItem.NextPermissions;
destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
srcTaskItem.NextPermissions;
destTaskItem.CurrentPermissions |= 16; // Slam!
}
}
destTaskItem.Description = srcTaskItem.Description;
destTaskItem.Name = srcTaskItem.Name;
//.........这里部分代码省略.........
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:101,代码来源:LLClientInventory.cs
示例4: rez_scripts
/// <summary>
/// Start multiple scripts in the object
/// </summary>
/// <param name = "part"></param>
/// <param name = "items"></param>
/// <param name = "startParam"></param>
/// <param name = "postOnRez"></param>
/// <param name = "engine"></param>
/// <param name = "stateSource"></param>
/// <param name = "RezzedFrom"></param>
public void rez_scripts(ISceneChildEntity part, TaskInventoryItem[] items,
int startParam, bool postOnRez, StateSource stateSource, UUID RezzedFrom)
{
#if (!ISWIN)
List<LUStruct> ItemsToStart = new List<LUStruct>();
foreach (TaskInventoryItem item in items)
{
LUStruct itemToQueue = m_scriptEngine.StartScript(part, item.ItemID, startParam, postOnRez, stateSource, RezzedFrom);
if (itemToQueue.Action != LUType.Unknown) ItemsToStart.Add(itemToQueue);
}
#else
List<LUStruct> ItemsToStart = items.Select(item => m_scriptEngine.StartScript(part, item.ItemID, startParam, postOnRez, stateSource, RezzedFrom)).Where(itemToQueue => itemToQueue.Action != LUType.Unknown).ToList();
#endif
if (ItemsToStart.Count != 0)
m_scriptEngine.MaintenanceThread.AddScriptChange(ItemsToStart.ToArray(), LoadPriority.FirstStart);
}
开发者ID:EnricoNirvana,项目名称:Aurora-Sim,代码行数:26,代码来源:EventManager.cs
示例5: RequestUpdateTaskInventoryItem
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
ISceneChildEntity part, UUID transactionID,
TaskInventoryItem item)
{
AssetXferUploader uploader = RequestXferUploader(transactionID);
uploader.RequestUpdateTaskInventoryItem(remoteClient, item);
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:8,代码来源:AgentAssetsTransactions.cs
示例6: UpdateInventoryItem
public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents)
{
TaskInventoryItem it = GetInventoryItem(item.ItemID);
if (it != null)
{
item.ParentID = m_part.UUID;
item.ParentPartID = m_part.UUID;
item.Flags = m_items[item.ItemID].Flags;
// If group permissions have been set on, check that the groupID is up to date in case it has
// changed since permissions were last set.
if (item.GroupPermissions != (uint)PermissionMask.None)
item.GroupID = m_part.GroupID;
if (item.AssetID == UUID.Zero)
item.AssetID = it.AssetID;
lock (m_itemsLock)
{
m_items[item.ItemID] = item;
m_inventorySerial++;
}
if (fireScriptEvents)
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
HasInventoryChanged = true;
return true;
}
MainConsole.Instance.ErrorFormat(
"[PRIM INVENTORY]: " +
"Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
item.ItemID, m_part.Name, m_part.UUID,
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
return false;
}
开发者ID:andsim,项目名称:Aurora-Sim,代码行数:36,代码来源:SceneObjectPartInventory.cs
示例7: UpdateInventoryItem
/// <summary>
/// Update an existing inventory item.
/// </summary>
/// <param name = "item">The updated item. An item with the same id must already exist
/// in this prim's inventory</param>
/// <returns>false if the item did not exist, true if the update occurred succesfully</returns>
public bool UpdateInventoryItem(TaskInventoryItem item)
{
SceneObjectPart part = (SceneObjectPart) GetChildPart(item.ParentPartID);
if (part != null)
{
part.Inventory.UpdateInventoryItem(item);
return true;
}
MainConsole.Instance.ErrorFormat(
"[PRIM INVENTORY]: " +
"Couldn't find prim ID {0} to update item {1}, {2}",
item.ParentPartID, item.Name, item.ItemID);
return false;
}
开发者ID:Gnu32,项目名称:Silverfin,代码行数:22,代码来源:SceneObjectGroup.Inventory.cs
示例8: ProcessTIPermsMask
private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader)
{
item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty);
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:4,代码来源:SceneObjectSerializer.cs
示例9: ProcessTIType
private static void ProcessTIType(TaskInventoryItem item, XmlTextReader reader)
{
item.Type = reader.ReadElementContentAsInt("Type", String.Empty);
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:4,代码来源:SceneObjectSerializer.cs
示例10: ProcessTIParentPartID
private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader)
{
item.ParentPartID = ReadUUID(reader, "ParentPartID");
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:4,代码来源:SceneObjectSerializer.cs
示例11: ProcessTIPermsGranter
private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader)
{
item.PermsGranter = ReadUUID(reader, "PermsGranter");
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:4,代码来源:SceneObjectSerializer.cs
示例12: ProcessTICurrentPermissions
private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader)
{
item.CurrentPermissions = uint.Parse(reader.ReadElementContentAsString("CurrentPermissions", String.Empty));
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:4,代码来源:SceneObjectSerializer.cs
示例13: ProcessTIOwnerID
private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader)
{
item.OwnerID = ReadUUID(reader, "OwnerID");
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:4,代码来源:SceneObjectSerializer.cs
示例14: ProcessTIName
private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader)
{
item.Name = reader.ReadElementContentAsString("Name", String.Empty);
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:4,代码来源:SceneObjectSerializer.cs
示例15: GetRezReadySceneObject
public ISceneEntity GetRezReadySceneObject(TaskInventoryItem item)
{
AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
if (null == rezAsset)
{
MainConsole.Instance.WarnFormat(
"[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}",
item.AssetID, item.Name, m_part.Name);
return null;
}
string xmlData = Utils.BytesToString(rezAsset.Data);
SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData, m_part.ParentGroup.Scene);
if (group == null)
return null;
group.IsDeleted = false;
group.m_isLoaded = true;
foreach (SceneObjectPart part in group.ChildrenList)
{
part.IsLoading = false;
}
//Reset IDs, etc
m_part.ParentGroup.Scene.SceneGraph.PrepPrimForAdditionToScene(group);
SceneObjectPart rootPart = (SceneObjectPart)group.GetChildPart(group.UUID);
// Since renaming the item in the inventory does not affect the name stored
// in the serialization, transfer the correct name from the inventory to the
// object itself before we rez.
rootPart.Name = item.Name;
rootPart.Description = item.Description;
SceneObjectPart[] partList = group.Parts;
group.SetGroup(m_part.GroupID, group.OwnerID, false);
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
{
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
{
foreach (SceneObjectPart part in partList)
{
part.EveryoneMask = item.EveryonePermissions;
part.NextOwnerMask = item.NextPermissions;
}
group.ApplyNextOwnerPermissions();
}
}
foreach (SceneObjectPart part in partList)
{
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
{
part.LastOwnerID = part.OwnerID;
part.OwnerID = item.OwnerID;
part.Inventory.ChangeInventoryOwner(item.OwnerID);
}
part.EveryoneMask = item.EveryonePermissions;
part.NextOwnerMask = item.NextPermissions;
}
rootPart.TrimPermissions();
return group;
}
开发者ID:andsim,项目名称:Aurora-Sim,代码行数:69,代码来源:SceneObjectPartInventory.cs
示例16: ProcessTIOwnerChanged
private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader)
{
item.OwnerChanged = reader.ReadElementContentAsBoolean("OwnerChanged", String.Empty);
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:4,代码来源:SceneObjectSerializer.cs
示例17: ReadTaskInventory
private static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name)
{
TaskInventoryDictionary tinv = new TaskInventoryDictionary();
reader.ReadStartElement(name, String.Empty);
if (reader.IsEmptyElement)
{
reader.Read();
return tinv;
}
while (reader.Name == "TaskInventoryItem")
{
reader.ReadStartElement("TaskInventoryItem", String.Empty); // TaskInventory
TaskInventoryItem item = new TaskInventoryItem();
while (reader.NodeType != XmlNodeType.EndElement)
{
TaskInventoryXmlProcessor p = null;
try
{
if (m_TaskInventoryXmlProcessors.TryGetValue(reader.Name, out p))
p(item, reader);
else
{
//MainConsole.Instance.DebugFormat("[SceneObjectSerializer]: caught unknown element in TaskInventory {0}, {1}", reader.Name, reader.Value);
reader.ReadOuterXml();
}
}
catch (Exception e)
{
MainConsole.Instance.DebugFormat("[SceneObjectSerializer]: exception while parsing Inventory Items {0}: {1}",
reader.Name, e);
}
}
reader.ReadEndElement(); // TaskInventoryItem
tinv.Add(item.ItemID, item);
}
if (reader.NodeType == XmlNodeType.EndElement)
reader.ReadEndElement(); // TaskInventory
return tinv;
}
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:45,代码来源:SceneObjectSerializer.cs
示例18: RezObject
/// <summary>
/// Rez an object into the scene from a prim's inventory.
/// </summary>
/// <param name="sourcePart"></param>
/// <param name="item"></param>
/// <param name="pos"></param>
/// <param name="rot"></param>
/// <param name="vel"></param>
/// <param name="param"></param>
/// <param name="RezzedFrom"></param>
/// <param name="RezObjectAtRoot"></param>
/// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns>
public ISceneEntity RezObject(
ISceneChildEntity sourcePart, TaskInventoryItem item,
Vector3 pos, Quaternion rot, Vector3 vel, int param, UUID RezzedFrom, bool RezObjectAtRoot)
{
if (item != null)
{
UUID ownerID = item.OwnerID;
AssetBase rezAsset = World.AssetService.Get(item.AssetID.ToString());
if (rezAsset != null)
{
string xmlData = Utils.BytesToString(rezAsset.Data);
SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData, World);
if (group == null)
return null;
string reason;
if (!World.Permissions.CanRezObject(group.ChildrenList.Count, ownerID, pos, out reason))
{
World.GetScenePresence(ownerID).ControllingClient.SendAlertMessage("You do not have permission to rez objects here: " + reason);
return null;
}
List<ISceneChildEntity> partList = group.ChildrenEntities();
// we set it's position in world.
// llRezObject sets the whole group at the position, while llRezAtRoot rezzes the group based on the root prim's position
// See: http://lslwiki.net/lslwiki/wakka.php?wakka=llRezAtRoot
// Shorthand: llRezAtRoot rezzes the root prim of the group at the position
// llRezObject rezzes the center of group at the position
if (RezObjectAtRoot)
//This sets it right...
group.AbsolutePosition = pos;
else
{
// center is on average of all positions
// less root prim position
#if (!ISWIN)
Vector3 offset = Vector3.Zero;
foreach (ISceneChildEntity child in partList)
{
offset += child.AbsolutePosition;
}
#else
Vector3 offset = partList.Aggregate(Vector3.Zero, (current, child) => current + child.AbsolutePosition);
#endif
offset /= partList.Count;
offset -= group.AbsolutePosition;
offset += pos;
group.AbsolutePosition = offset;
}
ISceneChildEntity rootPart = group.GetChildPart(group.UUID);
// Since renaming the item in the inventory does not affect the name stored
// in the serialization, transfer the correct name from the inventory to the
// object itself before we rez.
rootPart.Name = item.Name;
rootPart.Description = item.Description;
group.SetGroup(sourcePart.GroupID, group.OwnerID);
if (rootPart.OwnerID != item.OwnerID)
{
if (World.Permissions.PropagatePermissions())
{
if ((item.CurrentPermissions & 8) != 0)
{
foreach(ISceneChildEntity part in partList)
{
part.EveryoneMask = item.EveryonePermissions;
part.NextOwnerMask = item.NextPermissions;
}
}
group.ApplyNextOwnerPermissions();
}
}
foreach (ISceneChildEntity part in partList)
{
if (part.OwnerID != item.OwnerID)
{
part.LastOwnerID = part.OwnerID;
part.OwnerID = item.OwnerID;
part.Inventory.ChangeInventoryOwner(item.OwnerID);
}
else if ((item.CurrentPermissions & 8) != 0) // Slam!
{
//.........这里部分代码省略.........
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:101,代码来源:LSL_Api.cs
示例19: AddInventoryItem
/// <summary>
/// Add an item to this prim's inventory.
/// </summary>
/// <param name="name">The name that the new item should have.</param>
/// <param name="item">
/// The item itself. The name within this structure is ignored in favour of the name
/// given in this method's arguments
/// </param>
/// <param name="allowedDrop">
/// Item was only added to inventory because AllowedDrop is set
/// </param>
protected void AddInventoryItem(string name, TaskInventoryItem item, bool allowedDrop)
{
name = FindAvailableInventoryName(name);
if (name == String.Empty)
return;
item.ParentID = m_part.UUID;
item.ParentPartID = m_part.UUID;
item.Name = name;
item.GroupID = m_part.GroupID;
lock (m_itemsLock)
{
m_items.Add (item.ItemID, item);
}
m_part.TriggerScriptChangedEvent(allowedDrop ? Changed.ALLOWED_DROP : Changed.INVENTORY);
m_inventorySerial++;
//m_inventorySerial += 2;
HasInventoryChanged = true;
}
开发者ID:andsim,项目名称:Aurora-Sim,代码行数:33,代码来源:SceneObjectPartInventory.cs
示例20: AddInventoryItem
/// <summary>
/// Add an inventory item to a prim in this group.
/// </summary>
/// <param name = "remoteClient"></param>
/// <param name = "localID"></param>
/// <param name = "item"></param>
/// <param name = "copyItemID">The item UUID that should be used by the new item.</param>
/// <returns></returns>
public bool AddInventoryItem(IClientAPI remoteClient, uint localID,
InventoryItemBase item, UUID copyItemID)
{
UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID;
SceneObjectPart part = (SceneObjectPart) GetChildPart(localID);
if (part != null)
{
TaskInventoryItem taskItem = new TaskInventoryItem
{
ItemID = newItemId,
AssetID = item.AssetID,
Name = item.Name,
Description = item.Description,
OwnerID = part.OwnerID,
CreatorID = item.CreatorIdAsUuid,
Type = item.AssetType,
InvType = item.InvType
};
// Transfer ownership
if (remoteClient != null &&
remoteClient.AgentId != part.OwnerID &&
m_scene.Permissions.PropagatePermissions())
{
taskItem.BasePermissions = item.BasePermissions &
item.NextPermissions;
taskItem.CurrentPermissions = item.CurrentPermissions &
item.NextPermissions;
taskItem.EveryonePermissions = item.EveryOnePermissions &
item.NextPermissions;
taskItem.GroupPermissions = item.GroupPermissions &
item.NextPermissions;
taskItem.NextPermissions = item.NextPermissions;
// We're adding this to a prim we don't own. Force
// owner change
taskItem.CurrentPermissions |= 16; // Slam
}
else
{
taskItem.BasePermissions = item.BasePermissions;
taskItem.CurrentPermissions = item.CurrentPermissions;
taskItem.EveryonePermissions = item.EveryOnePermissions;
taskItem.GroupPermissions = item.GroupPermissions;
taskItem.NextPermissions = item.NextPermissions;
}
taskItem.Flags = item.Flags;
taskItem.SalePrice = item.SalePrice;
taskItem.SaleType = item.SaleType;
taskItem.CreationDate = (uint) item.CreationDate;
bool addFromAllowedDrop = false;
if (remoteClient != null)
{
addFromAllowedDrop = remoteClient.AgentId != part.OwnerID;
}
part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
return true;
}
MainConsole.Instance.ErrorFormat(
"[PRIM INVENTORY]: " +
"Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
localID, Name, UUID, newItemId);
return false;
}
开发者ID:Gnu32,项目名称:Silverfin,代码行数:78,代码来源:SceneObjectGroup.Inventory.cs
注:本文中的TaskInventoryItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论