private void RezActualScript(AgentCircuit circuit, ObjectPart part, RezScript req, AssetData data) { if (!part.CheckPermissions(Owner, Group, InventoryPermissionsMask.Modify)) { var res = new AlertMessage { Message = "ALERT: NoPermModifyObject" }; circuit.SendMessage(res); return; } var item = new ObjectPartInventoryItem { Name = req.InventoryBlock.Name, AssetID = data.ID, Description = req.InventoryBlock.Description, AssetType = AssetType.LSLText, Creator = Owner, Owner = Owner, Flags = 0, Group = Group, IsGroupOwned = false, InventoryType = InventoryType.LSL, LastOwner = Owner, ParentFolderID = part.ID }; item.Permissions.Base = req.InventoryBlock.BaseMask; item.Permissions.Current = req.InventoryBlock.OwnerMask; item.Permissions.EveryOne = req.InventoryBlock.EveryoneMask; item.Permissions.Group = req.InventoryBlock.GroupMask; item.Permissions.NextOwner = req.InventoryBlock.NextOwnerMask; item.SaleInfo.Price = req.InventoryBlock.SalePrice; item.SaleInfo.Type = req.InventoryBlock.SaleType; part.Inventory.Add(item); part.SendObjectUpdate(); ScriptInstance instance; try { SceneInterface scene = part.ObjectGroup.Scene; instance = ScriptLoader.Load(part, item, item.Owner, data, CurrentCulture, openInclude: part.OpenScriptInclude); item.ScriptInstance = instance; item.ScriptInstance.IsRunningAllowed = scene.CanRunScript(item.Owner, part.ObjectGroup.GlobalPosition, item.AssetID); item.ScriptInstance.IsRunning = true; item.ScriptInstance.Reset(); part.ObjectGroup.Scene.SendObjectPropertiesToAgent(this, part); } catch { var res = new AlertMessage { Message = this.GetLanguageString(circuit.Agent.CurrentCulture, "CouldNotCompileScript", "Could not compile script") }; circuit.SendMessage(res); return; } }
private void UpdateTaskInventoryItem(UpdateTaskInventory req, IAgent agent, ObjectPart part) { ObjectPartInventoryItem item; if (!CanEdit(agent, part.ObjectGroup, part.ObjectGroup.GlobalPosition)) { return; } if (!part.Inventory.TryGetValue(req.ItemID, out item)) { return; } if (req.TransactionID != UUID.Zero) { if (item.AssetType == AssetType.LSLText || item.AssetType == AssetType.LSLBytecode || item.InventoryType == InventoryType.LSL) { /* do not allow editing scripts through this */ return; } /* asset upload follows */ agent.SetAssetUploadAsCompletionAction(req.TransactionID, req.CircuitSceneID, new UpdateTaskInventoryItemHandler { Agent = agent, ItemID = req.ItemID, Part = part, Scene = this }.OnCompletion); } else { /* no asset upload */ part.Inventory.Rename(req.Name, item.ID); item.Description = req.Description; if (agent.IsActiveGod) { item.Permissions.Base = req.BaseMask | InventoryPermissionsMask.Move; item.Permissions.Current = req.OwnerMask; item.Permissions.EveryOne = req.EveryoneMask; item.Permissions.Group = req.GroupMask; item.Permissions.NextOwner = req.NextOwnerMask; } else if (part.Owner.EqualsGrid(agent.Owner)) { item.Permissions.EveryOne = req.EveryoneMask & item.Permissions.Base; item.Permissions.Group = req.GroupMask & item.Permissions.Base; item.Permissions.Current = req.OwnerMask & item.Permissions.Base; item.Permissions.NextOwner = req.OwnerMask & item.Permissions.Base; } Interlocked.Increment(ref part.Inventory.InventorySerial); part.SendObjectUpdate(); SendObjectPropertiesToAgent(agent, part); } }
public void OnCompletion(UUID assetid) { ObjectPartInventoryItem item; if (Part.Inventory.TryGetValue(ItemID, out item)) { item.AssetID = assetid; Interlocked.Increment(ref Part.Inventory.InventorySerial); Part.SendObjectUpdate(); Scene.SendObjectPropertiesToAgent(Agent, Part); } }
private void AddTaskInventoryItem(UpdateTaskInventory req, IAgent agent, ObjectPart part) { switch (req.InvType) { case InventoryType.Animation: case InventoryType.Attachable: case InventoryType.CallingCard: case InventoryType.Gesture: case InventoryType.Landmark: case InventoryType.Notecard: case InventoryType.Object: case InventoryType.Snapshot: case InventoryType.Sound: case InventoryType.Texture: case InventoryType.Wearable: break; default: /* do not allow anything else than the ones above */ return; } switch (req.AssetType) { case AssetType.LSLText: case AssetType.LSLBytecode: case AssetType.Link: case AssetType.LinkFolder: /* no addition here of scripts, item links or folder links */ return; default: break; } if (part.IsAllowedDrop) { /* llAllowInventoryDrop active, so we can drop anything except scripts */ } else if (!CanEdit(agent, part.ObjectGroup, part.ObjectGroup.GlobalPosition)) { /* not allowed */ return; } InventoryItem agentItem; if (agent.InventoryService.Item.TryGetValue(agent.Owner.ID, req.ItemID, out agentItem) && agentItem.AssetType == req.AssetType && agentItem.InventoryType == req.InvType) { var item = new ObjectPartInventoryItem(UUID.Random, agentItem); AdjustPermissionsAccordingly(agent, part.Owner, item); item.LastOwner = item.Owner; item.Owner = part.Owner; if (AssetService.Exists(agentItem.AssetID)) { /* no need for an assettransferer here */ if ((item.Permissions.Base & InventoryPermissionsMask.Transfer) == 0) { part.OwnerMask &= ~InventoryPermissionsMask.Transfer; } if (item.AssetType.IsNoCopyAffectingContainingObject() && (item.Permissions.Base & InventoryPermissionsMask.Copy) == 0) { part.OwnerMask &= ~InventoryPermissionsMask.Copy; } part.Inventory.Add(item); part.SendObjectUpdate(); SendObjectPropertiesToAgent(agent, part); if (agentItem.CheckPermissions(agent.Owner, agent.Group, InventoryPermissionsMask.Copy)) { agent.InventoryService.Item.Delete(agent.Owner.ID, agentItem.ID); } } else { new AddToObjectTransferItem(agent, this, item.AssetID, part, item).QueueWorkItem(); } } }