llGiveInventory() 공개 메소드

public llGiveInventory ( string destination, string inventory ) : void
destination string
inventory string
리턴 void
예제 #1
0
        public void TestLlGiveInventoryO2ODifferentOwners()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            UUID user1Id = TestHelpers.ParseTail(0x1);
            UUID user2Id = TestHelpers.ParseTail(0x2);
            string inventoryItemName = "item1";

            SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
            m_scene.AddSceneObject(so1);
            LSL_Api api = new LSL_Api();
            api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);

            // Create an object embedded inside the first
            UUID itemId = TestHelpers.ParseTail(0x20);
            TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);

            // Create a second object
            SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
            m_scene.AddSceneObject(so2);
            LSL_Api api2 = new LSL_Api();
            api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, so2.RootPart.UUID);

            // *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
            api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);

            {
                // Item has copy permissions so original should stay intact.
                List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
                Assert.That(originalItems.Count, Is.EqualTo(1));

                // Should have not copied
                List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
                Assert.That(copiedItems.Count, Is.EqualTo(0));
            }

            // *** Secondly, we turn on allow inventory drop in the target and retest. ***
            api2.llAllowInventoryDrop(1);
            api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);

            {
                // Item has copy permissions so original should stay intact.
                List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
                Assert.That(originalItems.Count, Is.EqualTo(1));
    
                // Should now have copied.
                List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
                Assert.That(copiedItems.Count, Is.EqualTo(1));
                Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
            }
        }
예제 #2
0
        public void TestLlGiveInventoryO2OSameOwner()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            UUID userId = TestHelpers.ParseTail(0x1);
            string inventoryItemName = "item1";

            SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, userId, "so1", 0x10);
            m_scene.AddSceneObject(so1);

            // Create an object embedded inside the first
            UUID itemId = TestHelpers.ParseTail(0x20);
            TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId);

            LSL_Api api = new LSL_Api();
            api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);

            // Create a second object
            SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
            m_scene.AddSceneObject(so2);

            api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);

            // Item has copy permissions so original should stay intact.
            List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
            Assert.That(originalItems.Count, Is.EqualTo(1));

            List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
            Assert.That(copiedItems.Count, Is.EqualTo(1));
            Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
        }
예제 #3
0
        public void TestLlGiveInventoryO2DifferentAvatarNoMod()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            UUID user1Id = TestHelpers.ParseTail(0x1);
            UUID user2Id = TestHelpers.ParseTail(0x2);
            string inventoryItemName = "item1";

            SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
            m_scene.AddSceneObject(so1);
            LSL_Api api = new LSL_Api();
            api.Initialize(m_engine, so1.RootPart, null);

            // Create an object embedded inside the first
            UUID itemId = TestHelpers.ParseTail(0x20);
            TaskInventoryItem tii 
                = TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id);
            tii.NextPermissions &= ~((uint)PermissionMask.Modify);

            UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);

            api.llGiveInventory(user2Id.ToString(), inventoryItemName);

            InventoryItemBase receivedItem 
                = UserInventoryHelpers.GetInventoryItem(
                    m_scene.InventoryService, user2Id, string.Format("Objects/{0}", inventoryItemName));

            Assert.IsNotNull(receivedItem);
            Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify);
        }