本文整理汇总了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();
}
示例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;
}
示例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);
}
示例4: BindDoorTarget
public BindDoorTarget(Key k)
: base(10, false, TargetFlags.None)
{
m_Key = k;
}
示例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!
}
}
示例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;
}
示例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;
}
示例8: UnlockTarget
public UnlockTarget( Key key ) : base( key.MaxRange, false, TargetFlags.None )
{
m_Key = key;
CheckLOS = false;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
//.........这里部分代码省略.........
示例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 );
}
示例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;
}
示例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!" );
}
}