Exemplo n.º 1
0
        public static void RemoveKeys(Container cont, uint keyValue)
        {
            if (cont == null || keyValue == 0)
            {
                return;
            }

            Item[] items = cont.FindItemsByType(new Type[] { typeof(Key), typeof(KeyRing) });

            foreach (Item item in items)
            {
                if (item is Key)
                {
                    Key key = (Key)item;

                    if (key.KeyValue == keyValue)
                    {
                        key.Delete();
                    }
                }
                else
                {
                    KeyRing keyRing = (KeyRing)item;

                    keyRing.RemoveKeys(keyValue);
                }
            }
        }
Exemplo n.º 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack))
                {
                    //from.SendLocalizedMessage( 501661 ); // That key is unreachable.
                    from.SendAsciiMessage("That key is unreachable.");
                    return;
                }

                //int number;

                if (targeted is Key)
                {
                    Key k = (Key)targeted;

                    if (k.m_KeyVal == 0)
                    {
                        //number = 501675; // This key is also blank.
                        from.SendAsciiMessage("This key is also blank.");
                    }
                    else if (from.CheckTargetSkill(SkillName.Tinkering, k, 0, 75.0))
                    {
                        //number = 501676; // You make a copy of the key.
                        from.SendAsciiMessage("You make a copy of the key.");

                        m_Key.Description = k.Description;
                        m_Key.KeyValue    = k.KeyValue;
                        m_Key.Link        = k.Link;
                        m_Key.MaxRange    = k.MaxRange;
                    }
                    else if (Utility.RandomDouble() <= 0.1)                       // 10% chance to destroy the key
                    {
                        //from.SendLocalizedMessage( 501677 ); // You fail to make a copy of the key.
                        from.SendAsciiMessage("You fail to make a copy of the key.");

                        //number = 501678; // The key was destroyed in the attempt.
                        from.SendAsciiMessage("The key was destroyed in the attempt.");

                        m_Key.Delete();
                    }
                    else
                    {
                        //number = 501677; // You fail to make a copy of the key.
                        from.SendAsciiMessage("You fail to make a copy of the key.");
                    }
                }
                else
                {
                    //number = 501688; // Not a key.
                    from.SendAsciiMessage("That is not a key.");
                }

                //from.SendLocalizedMessage( number );
            }
Exemplo n.º 3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int number;

                if (targeted is Key)
                {
                    Key k = (Key)targeted;

                    if (!k.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("The key to be copied must be in your backpack.");
                        return;
                    }

                    if (k.Type == KeyType.Magic)
                    {
                        from.SendLocalizedMessage(501677);                         // You fail to make a copy of the key.
                        return;
                    }

                    if (k.m_KeyVal == 0)
                    {
                        number = 501675;                         // This key is also blank.
                    }
                    else if (from.CheckTargetSkill(SkillName.Tinkering, k, 0, 75.0))
                    {
                        number = 501676;                         // You make a copy of the key.

                        m_Key.Description = k.Description;
                        m_Key.KeyValue    = k.KeyValue;
                        m_Key.Link        = k.Link;
                        m_Key.MaxRange    = k.MaxRange;
                    }
                    else if (Utility.RandomDouble() <= 0.1)      // 10% chance to destroy the key
                    {
                        from.SendLocalizedMessage(501677);       // You fail to make a copy of the key.

                        number = 501678;                         // The key was destroyed in the attempt.

                        m_Key.Delete();
                    }
                    else
                    {
                        number = 501677;                         // You fail to make a copy of the key.
                    }
                }
                else
                {
                    number = 501688;                     // Not a key.
                }

                from.SendLocalizedMessage(number);
            }
Exemplo n.º 4
0
        public BaseTreasureChestMod(int itemID) : base(itemID)
        {
            Locked  = true;
            Movable = false;

            Key key = (Key)FindItemByType(typeof(Key));

            if (key != null)
            {
                key.Delete();
            }
        }
Exemplo n.º 5
0
        public BaseTreasureChestMod(int itemID) : base(itemID)
        {
            Locked  = true;
            Movable = false;

            Key key = (Key)FindItemByType(typeof(Key));

            if (key != null)
            {
                key.Delete();
            }

            RefinementComponent.Roll(this, 1, 0.08);
        }
Exemplo n.º 6
0
        public void RemoveKeys(uint keyValue)
        {
            for (int i = m_Keys.Count - 1; i >= 0; i--)
            {
                Key key = m_Keys[i];

                if (key.KeyValue == keyValue)
                {
                    key.Delete();
                    m_Keys.RemoveAt(i);
                }
            }

            UpdateItemID();
        }
Exemplo n.º 7
0
        public BaseTreasureChest(int itemID) : base(itemID)
        {
            m_TreasureLevel = TreasureLevel.Level2;
            Locked          = true;
            Movable         = false;

            Key key = (Key)FindItemByType(typeof(Key));

            if (key != null)
            {
                key.Delete();
            }

            SetLockLevel();
            GenerateTreasure();
        }
        protected override void OnTarget(Mobile from, object target)         // Override the protected OnTarget() for our feature
        {
            if (target is BaseDoor)
            {
                BaseDoor  door = target as BaseDoor;
                BaseHouse h1   = BaseHouse.FindHouseAt(door);
                BaseHouse h2   = BaseHouse.FindHouseAt(from);
                if (h1 == null || h1 != h2)
                {
                    from.SendLocalizedMessage(502094);                     // You must be in your house to do this.
                    return;
                }
                else if (h1.IsOwner(from) == false)
                {
                    from.SendLocalizedMessage(501303);                     // Only the house owner may change the house locks.
                    return;
                }

                // don't remove old keys because you will endup removing the main house keys
                //  we need to single this door out somehow
                // Key.RemoveKeys( from, oldKeyValue );

                // make the keys
                uint keyValue = Key.RandomValue();
                Key  packKey  = new Key(KeyType.Gold);
                Key  bankKey  = new Key(KeyType.Gold);
                packKey.KeyValue = keyValue;
                bankKey.KeyValue = keyValue;
                BankBox box = from.BankBox;
                if (box == null || !box.TryDropItem(from, bankKey, false))
                {
                    bankKey.Delete();
                }
                from.AddToBackpack(packKey);

                // rekey door
                door.KeyValue = keyValue;

                from.SendMessage("The lock on this door has been changed, and new master key has been placed in your bank and your backpack.");
                m_Deed.Delete();                 // Delete the deed
            }
            else
            {
                from.SendMessage("That is not a door.");
            }
        }
Exemplo n.º 9
0
        public BaseTreasureChest(int itemID) : base(itemID)
        {
            Movable             = false;
            MaxLockLevel        = 100;
            m_TreasureLocations = new ArrayList();
            Delay = 20;

            Key key = (Key)FindItemByType(typeof(Key));

            GenBag();

            if (key != null)
            {
                key.Delete();
            }

            Reset(true, false);
        }
Exemplo n.º 10
0
        public BaseTreasureChest(int itemID) : base(itemID)
        {
            m_TreasureLevel = TreasureLevel.Level2;
            Locked          = true;
            Movable         = false;
            SetLockedName();

            Key key = (Key)FindItemByType(typeof(Key));

            if (key != null)
            {
                key.Delete();
            }

            if (this is WoodenTreasureChest || this is MetalTreasureChest || this is MetalGoldenTreasureChest)
            {
                SetLockLevel();
                GenerateTreasure();
            }
        }
Exemplo n.º 11
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                string number;

                if (targeted is Key)
                {
                    Key k = (Key)targeted;

                    if (k.m_KeyVal == 0)
                    {
                        number = "This key is also blank.";
                    }
                    else if (from.CheckTargetSkill(SkillName.Tinkering, k, 0, 75.0))
                    {
                        number = "You make a copy of the key.";

                        m_Key.Description = k.Description;
                        m_Key.KeyValue    = k.KeyValue;
                        m_Key.Link        = k.Link;
                        m_Key.MaxRange    = k.MaxRange;
                    }
                    else if (Utility.RandomDouble() <= 0.1)                       // 10% chance to destroy the key
                    {
                        from.SendAsciiMessage("You fail to make a copy of the key.");

                        number = "The key was destroyed in the attempt.";

                        m_Key.Delete();
                    }
                    else
                    {
                        number = "You fail to make a copy of the key.";
                    }
                }
                else
                {
                    number = "Not a key.";
                }

                from.SendAsciiMessage(number);
            }
Exemplo n.º 12
0
        protected override void OnTarget(Mobile from, object target) // Override the protected OnTarget() for our feature
        {
            if (target is BaseDoor)
            {
                BaseDoor door = target as BaseDoor;
                BaseHouse h1 = BaseHouse.FindHouseAt(door);
                BaseHouse h2 = BaseHouse.FindHouseAt(from);
                if (h1 == null || h1 != h2)
                {
                    from.SendLocalizedMessage(502094); // You must be in your house to do this.
                    return;
                }
                else if (h1.IsOwner(from) == false)
                {
                    from.SendLocalizedMessage(501303); // Only the house owner may change the house locks.
                    return;
                }

                // don't remove old keys because you will endup removing the main house keys
                //  we need to single this door out somehow
                // Key.RemoveKeys( from, oldKeyValue );

                // make the keys
                uint keyValue = Key.RandomValue();
                Key packKey = new Key(KeyType.Gold);
                Key bankKey = new Key(KeyType.Gold);
                packKey.KeyValue = keyValue;
                bankKey.KeyValue = keyValue;
                BankBox box = from.BankBox;
                if (box == null || !box.TryDropItem(from, bankKey, false))
                    bankKey.Delete();
                from.AddToBackpack(packKey);

                // rekey door
                door.KeyValue = keyValue;

                from.SendMessage("The lock on this door has been changed, and new master key has been placed in your bank and your backpack.");
                m_Deed.Delete(); // Delete the deed                
            }
            else
            {
                from.SendMessage("That is not a door.");
            }
        }
Exemplo n.º 13
0
		public uint CreateKeys( Mobile m )
		{
			uint value = Key.RandomValue();

			if ( !IsAosRules )
			{
				Key packKey = new Key( KeyType.Gold );
				Key bankKey = new Key( KeyType.Gold );

				packKey.KeyValue = value;
				bankKey.KeyValue = value;

				packKey.LootType = LootType.Newbied;
				bankKey.LootType = LootType.Newbied;

				BankBox box = m.BankBox;

				if ( !box.TryDropItem( m, bankKey, false ) )
					bankKey.Delete();

				m.AddToBackpack( packKey );
			}

			return value;
		}
Exemplo n.º 14
0
		public uint CreateKeys( Mobile m )
		{
			uint value = Key.RandomValue();

			Key packKey = new Key( KeyType.Gold, value, this );
			Key bankKey = new Key( KeyType.Gold, value, this );

			packKey.MaxRange = 10;
			bankKey.MaxRange = 10;

			packKey.Name = "a ship key";
			bankKey.Name = "a ship key";

			BankBox box = m.BankBox;

			if ( !box.TryDropItem( m, bankKey, false ) )
				bankKey.Delete();
			else
				m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502484 ); // A ship's key is now in my safety deposit box.

			if ( m.AddToBackpack( packKey ) )
				m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502485 ); // A ship's key is now in my backpack.
			else
				m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502483 ); // A ship's key is now at my feet.

			return value;
		}
Exemplo n.º 15
0
        public uint CreateKeys( Mobile m )
        {
            uint value = Key.RandomValue();

            Key packKey = new Key( KeyType.Gold, value, this );
            Key bankKey = new Key( KeyType.Gold, value, this );

            packKey.MaxRange = 10;
            bankKey.MaxRange = 10;

            BankBox box = m.BankBox;

            if ( box == null || !box.TryDropItem( m, bankKey, false ) )
                bankKey.Delete();
            else
                m.SendLocalizedMessage( 502484 ); // A ship's key is now in my safety deposit box.

            if ( m.AddToBackpack( packKey ) )
                m.SendLocalizedMessage( 502485 ); // A ship's key is now in my backpack.
            else
                m.SendLocalizedMessage( 502483 ); // A ship's key is now at my feet.

            return value;
        }
Exemplo n.º 16
0
        public uint CreateTentKeys(Mobile m)
        {
            uint value = Key.RandomValue();

            m_KeyOwner = value;

            if (!IsAosRules)
            {

                Key packKey = new Key(KeyType.Iron);
                Key bankKey = new Key(KeyType.Iron);

                packKey.KeyValue = value;
                bankKey.KeyValue = value;

                packKey.LootType = LootType.Regular;
                bankKey.LootType = LootType.Regular;

                BankBox box = m.BankBox;

                if (box == null || !box.TryDropItem(m, bankKey, false))
                    bankKey.Delete();
                else
                    m.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "A house key is now in my safety deposit box."); // A ship's key is now in my safety deposit box.

                if (m.AddToBackpack(packKey))
                    m.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "A house key is now in my backpack."); // A ship's key is now in my backpack.
                else
                    m.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "A house key is now at my feet."); // A ship's key is now at my feet.
            }

            return value;
        }
Exemplo n.º 17
0
        public uint CreateKeys(Mobile m)
        {
            uint value = Key.RandomValue();

            Key packKey = new Key(KeyType.Copper);
            Key bankKey = new Key(KeyType.Copper);

            packKey.KeyValue = value;
            bankKey.KeyValue = value;

            m_HouseKeyVal = value;

            packKey.LootType = LootType.Regular;
            bankKey.LootType = LootType.Regular;

            BankBox box = m.BankBox;

            if (!box.TryDropItem(m, bankKey, false))
                bankKey.Delete();

            m.AddToBackpack(packKey);

            return value;
        }