当前位置: 首页>>代码示例>>C#>>正文


C# Items.Key类代码示例

本文整理汇总了C#中Server.Items.Key的典型用法代码示例。如果您正苦于以下问题:C# Key类的具体用法?C# Key怎么用?C# Key使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Key类属于Server.Items命名空间,在下文中一共展示了Key类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add

        public void Add(Key key)
        {
            key.Internalize();
            this.m_Keys.Add(key);

            this.UpdateItemID();
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:7,代码来源:KeyRing.cs

示例2: KeyInfo

		public KeyInfo( Key key )
		{
			m_KeyVal = key.KeyValue;
			m_Description = key.Description;
			m_MaxRange = key.MaxRange;
			m_Link = key.Link;
			m_Type = (KeyType)key.ItemID;
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:8,代码来源:KeyRing.cs

示例3: GenerateLoot

        public override void GenerateLoot()
        {
            int phrase = Utility.Random(2);
            switch (phrase)
            {
                case 0: this.Say(true, "Bobs for Bob!"); break;
                case 1: this.Say(true, "Bob will rise!"); break;
            }

            // make the magic key
            Key key = new Key(KeyType.Magic);
            key.KeyValue = Key.RandomValue();

            // make the magic box
            MagicBox MagicBox = new MagicBox();
            MagicBox.Movable = true;
            MagicBox.KeyValue = key.KeyValue;
            MagicBox.DropItem(key);

            PackItem(MagicBox);

            // add bob's pillow
            Item pillow = new Item(Utility.RandomList(5029, 5030, 5031, 5032, 5033, 5034, 5035, 5036, 5037, 5038));
            pillow.Hue = 23;
            pillow.Name = "Pillow of The One Bob";
			pillow.Weight = 1.0; 

            PackItem(pillow);
        }
开发者ID:zerodowned,项目名称:angelisland,代码行数:29,代码来源:TheOneBob.cs

示例4: BindDoorTarget

 public BindDoorTarget(Key k)
     : base(10, false, TargetFlags.None)
 {
     m_Key = k;
 }
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:5,代码来源:KeysCommands.cs

示例5: OnTarget

			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( targeted == m_KeyRing )
				{
					from.SendLocalizedMessage( 501685 ); // You open the keyring.
					m_KeyRing.ItemID = 0x1011;

					foreach( KeyInfo k in m_KeyRing.Keys )
					{
						Key key = new Key( k.type, k.KeyValue, k.Link );
						key.Description = k.Description;
						from.AddToBackpack( key );
					}

					m_KeyRing.Keys.Clear();
				}
				else if ( targeted is ILockable )
				{
					ILockable o = (ILockable)targeted;
					bool KeyMatched = false;

					foreach( KeyInfo key in m_KeyRing.Keys )
					{
						if ( key.KeyValue == o.KeyValue )
						{
							KeyMatched = true;
							break;
						}
					}

					if ( KeyMatched )
					{
						if ( o is BaseDoor && !((BaseDoor)o).UseLocks() )
						{
							from.SendLocalizedMessage( 1008140 ); // You do not have a key for that.
						}
						else
						{
							o.Locked = !o.Locked;

							if ( o is LockableContainer )
							{
								LockableContainer cont = (LockableContainer)o;

								if ( cont.LockLevel == -255 )
									cont.LockLevel = cont.RequiredSkill - 10;
							}

							if ( targeted is Item )
							{
								Item item = (Item)targeted;

								if ( o.Locked )
									item.SendLocalizedMessageTo( from, 1048000 ); // You lock it
								else
									item.SendLocalizedMessageTo( from, 1048001 ); // You unlock it.
							}
						}
					}
					else
					{
						from.SendLocalizedMessage( 1008140 ); // You do not have a key for that.
					}
				}
				else
				{
					from.SendLocalizedMessage( 501666 ); // You can't unlock that!
				}
			}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:69,代码来源:KeyRing.cs

示例6: OnCraft

        public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
        {
            if ( from.CheckSkill( SkillName.Tinkering, -5.0, 15.0 ) )
            {
                from.SendAsciiMessage( "Your tinker skill was sufficient to make the item lockable." ); // Your tinker skill was sufficient to make the item lockable.

                Key key = new Key( KeyType.Copper, Key.RandomValue() );

                KeyValue = key.KeyValue;
                DropItem( key );

                double tinkering = from.Skills[SkillName.Tinkering].Value;
                int level = (int)(tinkering * 0.8);

                RequiredSkill = level - 4;
                LockLevel = level - 14;
                MaxLockLevel = level + 35;

                if ( LockLevel == 0 )
                    LockLevel = -1;
                else if ( LockLevel > 95 )
                    LockLevel = 95;

                if ( RequiredSkill > 95 )
                    RequiredSkill = 95;

                if ( MaxLockLevel > 95 )
                    MaxLockLevel = 95;
            }
            else
            {
                //from.SendAsciiMessage( "Your tinker skill was insufficient to make the item lockable." ); // Your tinker skill was insufficient to make the item lockable.
            }

            return 1;
        }
开发者ID:Godkong,项目名称:Origins,代码行数:36,代码来源:LockableContainer.cs

示例7: CreateKeys

		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;
		}
开发者ID:ITLongwell,项目名称:mondains-legacy,代码行数:25,代码来源:BaseHouse.cs

示例8: UnlockTarget

			public UnlockTarget( Key key ) : base( key.MaxRange, false, TargetFlags.None )
			{
				m_Key = key;
				CheckLOS = false;
			}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:5,代码来源:Key.cs

示例9: CreateTentKeys

        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;
        }
开发者ID:Godkong,项目名称:RunUO,代码行数:33,代码来源:BaseHouse.cs

示例10: CreateKeys

        public uint CreateKeys( Mobile m )
        {
            uint value = Key.RandomValue();

            Key packKey = new Key( KeyType.Gold, value, this );
            packKey.MaxRange = 10;
            packKey.Name = "a ship key";

            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;
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:15,代码来源:BaseBoat.cs

示例11: OnCraft

		public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
		{		
			Type resourceType = typeRes;

			if ( resourceType == null )
				resourceType = craftItem.Ressources.GetAt( 0 ).ItemType;

			Resource = CraftResources.GetFromType( resourceType );
			
			if ( from.CheckSkill( SkillName.Tinkering, -5.0, 15.0 ) )
			{
				from.SendLocalizedMessage( 500636 ); // Your tinker skill was sufficient to make the item lockable.

				Key key = new Key( KeyType.Copper, Key.RandomValue() );

				KeyValue = key.KeyValue;
				DropItem( key );

				double tinkering = from.Skills[SkillName.Tinkering].Value;
				int level = (int)(tinkering * 0.8);

				RequiredSkill = level - 4;
				LockLevel = level - 14;
				MaxLockLevel = level + 35;

				if ( LockLevel == 0 )
					LockLevel = -1;
				else if ( LockLevel > 95 )
					LockLevel = 95;

				if ( RequiredSkill > 95 )
					RequiredSkill = 95;

				if ( MaxLockLevel > 95 )
					MaxLockLevel = 95;
			}
			else
			{
				from.SendLocalizedMessage( 500637 ); // Your tinker skill was insufficient to make the item lockable.
			}

			return 1;
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:43,代码来源:LockableContainer.cs

示例12: TentSouthAddon

        public TentSouthAddon( Mobile from )
        {
            this.Owner = from;
            AddonComponent ac;
            ac = new AddonComponent( 734 );
            AddComponent( ac, 3, 3, 0 );
            ac = new AddonComponent( 735 );
            AddComponent( ac, 2, 3, 0 );
            ac = new AddonComponent( 736 );
            AddComponent( ac, 3, 2, 0 );
            ac = new AddonComponent( 736 );
            AddComponent( ac, 3, 1, 0 );
            ac = new AddonComponent( 736 );
            AddComponent( ac, 3, 0, 0 );
            ac = new AddonComponent( 739 );
            AddComponent( ac, 3, -2, 0 );
            ac = new AddonComponent( 740 );
            AddComponent( ac, 2, -2, 0 );
            ac = new AddonComponent( 743 );
            AddComponent( ac, 1, -2, 0 );
            ac = new AddonComponent( 743 );
            AddComponent( ac, -1, -2, 0 );
            ac = new AddonComponent( 737 );
            AddComponent( ac, -2, -2, 0 );
            ac = new AddonComponent( 742 );
            AddComponent( ac, -2, -1, 0 );
            ac = new AddonComponent( 742 );
            AddComponent( ac, -2, 0, 0 );
            ac = new AddonComponent( 742 );
            AddComponent( ac, -2, 1, 0 );
            ac = new AddonComponent( 1635 );
            ac.Hue = 1341;
            AddComponent( ac, 3, 3, 25 );
            ac = new AddonComponent( 1633 );
            ac.Hue = 1341;
            AddComponent( ac, 3, 1, 25 );
            ac = new AddonComponent( 1632 );
            ac.Hue = 1341;
            AddComponent( ac, 1, 3, 25 );
            ac = new AddonComponent( 1630 );
            ac.Hue = 1341;
            AddComponent( ac, 0, 1, 25 );
            ac = new AddonComponent( 1631 );
            ac.Hue = 1341;
            AddComponent( ac, 1, 0, 25 );
            ac = new AddonComponent( 1636 );
            ac.Hue = 1341;
            AddComponent( ac, 3, 0, 25 );
            ac = new AddonComponent( 1637 );
            ac.Hue = 1341;
            AddComponent( ac, 0, 0, 25 );
            ac = new AddonComponent( 1638 );
            ac.Hue = 1341;
            AddComponent( ac, 0, 3, 25 );
            ac = new AddonComponent( 743 );
            AddComponent( ac, 0, -2, 0 );
            ac = new AddonComponent( 742 );
            AddComponent( ac, -2, 2, 0 );
            ac = new AddonComponent( 736 );
            AddComponent( ac, 3, -1, 0 );
            ac = new AddonComponent( 735 );
            AddComponent( ac, -1, 3, 0 );
            ac = new AddonComponent( 738 );
            AddComponent( ac, -2, 3, 0 );
            ac = new AddonComponent( 1633 );
            ac.Hue = 1341;
            AddComponent( ac, 3, 2, 25 );
            ac = new AddonComponent( 1632 );
            ac.Hue = 1341;
            AddComponent( ac, 2, 3, 25 );
            ac = new AddonComponent( 1630 );
            ac.Hue = 1341;
            AddComponent( ac, 0, 2, 25 );
            ac = new AddonComponent( 1631 );
            ac.Hue = 1341;
            AddComponent( ac, 2, 0, 25 );
            ac = new AddonComponent( 1635 );
            ac.Hue = 1341;
            AddComponent( ac, 2, 2, 28 );
            ac = new AddonComponent( 1636 );
            ac.Hue = 1341;
            AddComponent( ac, 2, 1, 28 );
            ac = new AddonComponent( 1637 );
            ac.Hue = 1341;
            AddComponent( ac, 1, 1, 28 );
            ac = new AddonComponent( 1638 );
            ac.Hue = 1341;
            AddComponent( ac, 1, 2, 28 );
            ac = new AddonComponent( 4012 );
            ac.Light = LightType.Circle150;
            AddComponent( ac, 1, 5, 0 );

            uint keyvalue = Convert.ToUInt32( 2 * Utility.RandomMinMax( 1, 4999 ) );
            WoodenBox pack = new WoodenBox();
            pack.MoveToWorld( this.Owner.Location );
            pack.Map = this.Owner.Map;
            pack.Y -= 1;
            pack.X -= 1;
            pack.Movable = false;
            pack.KeyValue = keyvalue;
//.........这里部分代码省略.........
开发者ID:justdanofficial,项目名称:khaeros,代码行数:101,代码来源:TentSouthAddon.cs

示例13: OnDoubleClick

        public override void OnDoubleClick( Mobile from )
        {
            if( from == null || !from.InRange( this.Location, 2 ) || !from.InLOS( this.Location ) || !from.Alive || from.Paralyzed )
            {
                from.SendMessage( "You are too far away." );
                return;
            }

            if( m_Owner == null )
            {
                bool haschest = false;

                foreach( Item item in from.GetItemsInRange( 10 ) )
                {
                    if( item is BaseStorageContainer )
                    {
                        BaseStorageContainer cont = item as BaseStorageContainer;

                        if( cont.Owner == from )
                            haschest = true;
                    }
                }

                if( haschest )
                {
                    from.SendMessage( "You already have a storage box in this area." );
                    return;
                }

                Container pack = from.Backpack;

                if ( !pack.ConsumeTotal( typeof( Copper ), m_Price ) )
                {
                    from.SendMessage( "You need to be carrying " + m_Price + " copper coins in order to purchase this storage box." );
                }

                else
                {
                    m_Owner = from;
                    m_OwnersName = from.Name;

                    if( m_OwnersName.EndsWith( "s" ) )
                        m_OwnersName = m_OwnersName + "'";

                    else
                        m_OwnersName = m_OwnersName + "'s";

                    this.Name = "" + m_OwnersName + " Storage Box";

                    Key key = new Key();

                    uint newlock = Key.RandomValue();
                    this.KeyValue = newlock;
                    this.Locked = true;
                    key.KeyValue = newlock;
                    pack.DropItem( key );
                    this.LastRent = DateTime.Now;
                    from.SendMessage( "A key to the storage box has been placed in your backpack and " + m_Price + " copper coins have been charged from you." );

                    Copper copper = new Copper( m_Price );

                    if( this.Nation != Nation.None && this.AssignTreasury() )
                    {
                        if( this.Treasury is BaseContainer )
                            ( (BaseContainer)this.Treasury ).DropAndStack( copper );
                    }
                }
            }

            else
                base.OnDoubleClick( from );
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:72,代码来源:BaseStorageContainer.cs

示例14: CreateKeys

        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;
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:24,代码来源:BaseBoat.cs

示例15: OnTarget

            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( targeted == m_keyring )
                {
                    for( int i = 0; i < m_keyring.m_Keys.Count; i++ )
                    {
                        KeyringEntry entry = m_keyring.m_Keys[i] as KeyringEntry;
                        Key key = new Key();
                        key.KeyValue = entry.KeyValue;
                        key.Link = entry.Link;
                        key.MaxRange = entry.MaxRange;
                        key.ItemID = entry.ItemID;
                        key.LootType = entry.LootType;
                        key.Description = entry.Description;
                        from.AddToBackpack( key );
                        m_keyring.ItemID = 0x1011;
                        m_keyring.Weight = 1;
                    }
                    m_keyring.m_Keys.Clear();
                }
                else if ( targeted is ILockable )
                {
                    ILockable o = (ILockable)targeted;

                    for( int i = 0; i < m_keyring.m_Keys.Count; i++ )
                    {
                        KeyringEntry entry = m_keyring.m_Keys[i] as KeyringEntry;

                        if ( o.KeyValue == entry.KeyValue )
                        {
                            if ( o is BaseDoor && !((BaseDoor)o).UseLocks() )
                            {
                                from.SendAsciiMessage( "This key doesn't seem to unlock that." );
                            }
                            else
                            {
                                o.Locked = !o.Locked;
                                Didit = true;

                                if ( o is LockableContainer )
                                {
                                    LockableContainer cont = (LockableContainer)o;

                                    if ( cont.LockLevel == -255 )
                                        cont.LockLevel = cont.RequiredSkill - 10;
                                }

                                if ( targeted is Item )
                                {
                                    Item item = (Item)targeted;

                                    if ( o.Locked )
                                        item.SendAsciiMessageTo( from, "You lock it." );
                                    else
                                        item.SendAsciiMessageTo( from, "You unlock it." );
                                }
                            }
                        }
                    }

                    if ( !Didit )
                        from.SendAsciiMessage( "No key seems to unlock that." );
                }
                else
                {
                    from.SendAsciiMessage( "You can't unlock that!" );
                }
            }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:68,代码来源:Keyring.cs


注:本文中的Server.Items.Key类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。