Example #1
0
        public void TestLoadAppearance()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            SetUpScene();

            UUID userId = TestHelpers.ParseTail(0x1);

            UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
            ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);

            UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);

            // Now add the attachment to the original avatar and use that to load a new appearance
            // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here
            UUID   attItemId  = TestHelpers.ParseTail(0x2);
            UUID   attAssetId = TestHelpers.ParseTail(0x3);
            string attName    = "att";

            UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);

            m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);

            m_npcMod.SetNPCAppearance(npcId, sp.Appearance, m_scene);

            ScenePresence npc = m_scene.GetScenePresence(npcId);

            // Check scene presence status
            Assert.That(npc.HasAttachments(), Is.True);
            List <SceneObjectGroup> attachments = npc.GetAttachments();

            Assert.That(attachments.Count, Is.EqualTo(1));
            SceneObjectGroup attSo = attachments[0];

            // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item
            // name.  TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC.
//            Assert.That(attSo.Name, Is.EqualTo(attName));

            Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
            Assert.That(attSo.IsAttachment);
            Assert.That(attSo.UsesPhysics, Is.False);
            Assert.That(attSo.IsTemporary, Is.False);
            Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID));
        }
Example #2
0
        private void changeAppearance(UUID uuid, string appearanceNotecard)
        {
            AvatarAppearance appearance = loadAvatarAppearance(appearanceNotecard);

            npc.SetNPCAppearance(actors[uuid].UUID, appearance, m_scene);
        }