本文整理汇总了C#中TaskInventoryItem类的典型用法代码示例。如果您正苦于以下问题:C# TaskInventoryItem类的具体用法?C# TaskInventoryItem怎么用?C# TaskInventoryItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskInventoryItem类属于命名空间,在下文中一共展示了TaskInventoryItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
示例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);
}
//.........这里部分代码省略.........
示例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;
//.........这里部分代码省略.........
示例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);
}
示例5: RequestUpdateTaskInventoryItem
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
ISceneChildEntity part, UUID transactionID,
TaskInventoryItem item)
{
AssetXferUploader uploader = RequestXferUploader(transactionID);
uploader.RequestUpdateTaskInventoryItem(remoteClient, item);
}
示例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;
}
示例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;
}
示例8: ProcessTIPermsMask
private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader)
{
item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty);
}
示例9: ProcessTIType
private static void ProcessTIType(TaskInventoryItem item, XmlTextReader reader)
{
item.Type = reader.ReadElementContentAsInt("Type", String.Empty);
}
示例10: ProcessTIParentPartID
private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader)
{
item.ParentPartID = ReadUUID(reader, "ParentPartID");
}
示例11: ProcessTIPermsGranter
private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader)
{
item.PermsGranter = ReadUUID(reader, "PermsGranter");
}
示例12: ProcessTICurrentPermissions
private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader)
{
item.CurrentPermissions = uint.Parse(reader.ReadElementContentAsString("CurrentPermissions", String.Empty));
}
示例13: ProcessTIOwnerID
private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader)
{
item.OwnerID = ReadUUID(reader, "OwnerID");
}
示例14: ProcessTIName
private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader)
{
item.Name = reader.ReadElementContentAsString("Name", String.Empty);
}
示例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;
}