Exemplo n.º 1
0
        public void WillFindTypeAnyGraphic()
        {
            Item container = new Item(0x40000000)
            {
                Container = new ItemCollection(0x40000000)
            };

            for (int i = 1; i < 11; i++)
            {
                container.Container.Add(new Item(0x40000000 + i, 0x40000000)
                {
                    ID = i
                });
            }

            Engine.Items.Add(container);
            ObjectCommands.ClearIgnoreList();

            int count = 0;

            while (ObjectCommands.FindType(-1, -1, 0x40000000))
            {
                ObjectCommands.IgnoreObject(AliasCommands.GetAlias("found"));
                count++;
            }

            Assert.AreEqual(10, count);

            Engine.Items.Remove(container);
            ObjectCommands.ClearIgnoreList();
        }
Exemplo n.º 2
0
        public void WillUseIgnoreListIfEnabledGetNextFriend()
        {
            Options.CurrentOptions.GetFriendEnemyUsesIgnoreList = true;

            Engine.Player = new PlayerMobile(0x01);
            Mobile mobile = new Mobile(0x02)
            {
                Notoriety = Notoriety.Murderer
            };

            Engine.Mobiles.Add(mobile);

            bool result = TargetCommands.GetFriend(new[] { Notoriety.Murderer.ToString() });

            Assert.IsTrue(result);
            Assert.AreEqual(mobile.Serial, AliasCommands.GetAlias("friend"));

            AliasCommands.UnsetAlias("enemy");
            ObjectCommands.IgnoreObject(mobile.Serial);

            result = TargetCommands.GetFriend(new[] { Notoriety.Murderer.ToString() });

            Assert.IsFalse(result);

            ObjectCommands.ClearIgnoreList();
            Engine.Mobiles.Clear();
            Engine.Player = null;
            AliasCommands.SetAlias("friend", -1);
        }
Exemplo n.º 3
0
        public void WontFindTypeOutsideSearchRange()
        {
            Engine.Player = new PlayerMobile(1);
            Item backpack = new Item(0x40000000)
            {
                Container = new ItemCollection(0x40000000)
            };
            Item subContainer = new Item(0x40000001, 0x40000000)
            {
                Container = new ItemCollection(0x40000001)
            };

            backpack.Container.Add(subContainer);
            AliasCommands.SetAlias("backpack", backpack.Serial);

            backpack.Container.Add(new Item(0x40000002, 0x40000000)
            {
                ID = 0xabcd
            });
            subContainer.Container.Add(new Item(0x40000003, 0x40000001)
            {
                ID = 0xabcd
            });

            Engine.Items.Add(backpack);

            int count = 0;

            while (ObjectCommands.FindType(0xabcd, 0, "backpack"))
            {
                Assert.AreNotEqual(AliasCommands.GetAlias("found"), 0x40000003);
                ObjectCommands.IgnoreObject(AliasCommands.GetAlias("found"));
                count++;
            }

            Assert.AreEqual(1, count);

            ObjectCommands.ClearIgnoreList();

            count = 0;

            while (ObjectCommands.FindType(0xabcd, 1, "backpack"))
            {
                ObjectCommands.IgnoreObject(AliasCommands.GetAlias("found"));
                count++;
            }

            Assert.AreEqual(2, count);

            ObjectCommands.ClearIgnoreList();
            Engine.Player = null;
            Engine.Items.Clear();
        }
Exemplo n.º 4
0
        public void WillIgnoreObject()
        {
            Engine.Mobiles.Add(new Mobile(0x02)
            {
                ID = 0x190, X = 5, Y = 5
            });

            bool result = ObjectCommands.FindType(0x190);

            Assert.IsTrue(result);

            ObjectCommands.IgnoreObject("found");

            result = ObjectCommands.FindType(0x190);

            Assert.IsFalse(result);

            Engine.Mobiles.Clear();
            ObjectCommands.ClearIgnoreList();
        }