本文整理汇总了C#中Item.GetBounce方法的典型用法代码示例。如果您正苦于以下问题:C# Item.GetBounce方法的具体用法?C# Item.GetBounce怎么用?C# Item.GetBounce使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item.GetBounce方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckNonlocalDrop
public override bool CheckNonlocalDrop( Mobile from, Item item, Item target )
{
if ( !base.CheckNonlocalDrop( from, item, target ) )
return false;
if ( from.AccessLevel >= AccessLevel.GameMaster )
return true;
Container pack = this.Backpack;
if ( from == this && this.HasTrade && ( target == pack || target.IsChildOf( pack ) ) )
{
BounceInfo bounce = item.GetBounce();
if ( bounce != null && bounce.m_Parent is Item )
{
Item parent = (Item) bounce.m_Parent;
if ( parent == pack || parent.IsChildOf( pack ) )
return true;
}
SendLocalizedMessage( 1004041 ); // You can't do that while you have a trade pending.
return false;
}
return true;
}
示例2: OnDroppedItemToWorld
public override bool OnDroppedItemToWorld( Item item, Point3D location )
{
if ( !base.OnDroppedItemToWorld( item, location ) )
return false;
IPooledEnumerable mobiles = Map.GetMobilesInRange( location, 0 );
foreach ( Mobile m in mobiles )
{
if ( m.Z >= location.Z && m.Z < location.Z + 16 )
{
mobiles.Free();
return false;
}
}
mobiles.Free();
BounceInfo bi = item.GetBounce();
if ( bi != null )
{
Type type = item.GetType();
if ( type.IsDefined( typeof( FurnitureAttribute ), true ) || type.IsDefined( typeof( DynamicFlipingAttribute ), true ) )
{
object[] objs = type.GetCustomAttributes( typeof( FlipableAttribute ), true );
if ( objs != null && objs.Length > 0 )
{
FlipableAttribute fp = objs[0] as FlipableAttribute;
if ( fp != null )
{
int[] itemIDs = fp.ItemIDs;
Point3D oldWorldLoc = bi.m_WorldLoc;
Point3D newWorldLoc = location;
if ( oldWorldLoc.X != newWorldLoc.X || oldWorldLoc.Y != newWorldLoc.Y )
{
Direction dir = GetDirection4( oldWorldLoc, newWorldLoc );
if ( itemIDs.Length == 2 )
{
switch ( dir )
{
case Direction.North:
case Direction.South: item.ItemID = itemIDs[0]; break;
case Direction.East:
case Direction.West: item.ItemID = itemIDs[1]; break;
}
}
else if ( itemIDs.Length == 4 )
{
switch ( dir )
{
case Direction.South: item.ItemID = itemIDs[0]; break;
case Direction.East: item.ItemID = itemIDs[1]; break;
case Direction.North: item.ItemID = itemIDs[2]; break;
case Direction.West: item.ItemID = itemIDs[3]; break;
}
}
}
}
}
}
}
return true;
}
示例3: OnSubItemRemoved
public override void OnSubItemRemoved(Item item)
{
base.OnSubItemRemoved(item);
if (item.GetBounce() == null)
{
RemoveVendorItem(item);
}
}
示例4: CheckEquip
public override bool CheckEquip( Item item )
{
if ( !base.CheckEquip( item ) )
return false;
#region Factions
FactionItem factionItem = FactionItem.Find( item );
if ( factionItem != null )
{
Faction faction = Faction.Find( this );
if ( faction == null )
{
SendLocalizedMessage( 1010371 ); // You cannot equip a faction item!
return false;
}
else if ( faction != factionItem.Faction )
{
SendLocalizedMessage( 1010372 ); // You cannot equip an opposing faction's item!
return false;
}
else
{
int maxWearables = FactionItem.GetMaxWearables( this );
for ( int i = 0; i < Items.Count; ++i )
{
Item equiped = Items[i];
if ( item != equiped && FactionItem.Find( equiped ) != null )
{
if ( --maxWearables == 0 )
{
SendLocalizedMessage( 1010373 ); // You do not have enough rank to equip more faction items!
return false;
}
}
}
}
}
#endregion
if ( this.AccessLevel < AccessLevel.GameMaster && item.Layer != Layer.Mount && this.HasTrade )
{
BounceInfo bounce = item.GetBounce();
if ( bounce != null )
{
if ( bounce.m_Parent is Item )
{
Item parent = (Item) bounce.m_Parent;
if ( parent == this.Backpack || parent.IsChildOf( this.Backpack ) )
return true;
}
else if ( bounce.m_Parent == this )
{
return true;
}
}
SendLocalizedMessage( 1004042 ); // You can only equip what you are already carrying while you have a trade pending.
return false;
}
return true;
}
示例5: CheckEquip
public override bool CheckEquip( Item item )
{
if( !base.CheckEquip(item) )
return false;
if( this.AccessLevel < AccessLevel.GameMaster && item.Layer != Layer.Mount && this.HasTrade )
{
BounceInfo bounce = item.GetBounce();
if( bounce != null )
{
if( bounce.m_Parent is Item )
{
Item parent = (Item)bounce.m_Parent;
if( parent == this.Backpack || parent.IsChildOf(this.Backpack) )
return true;
}
else if( bounce.m_Parent == this )
{
return true;
}
}
SendLocalizedMessage(1004042); // You can only equip what you are already carrying while you have a trade pending.
return false;
}
return true;
}
示例6: OnDroppedItemToWorld
public override bool OnDroppedItemToWorld(Item item, Point3D location)
{
if (!base.OnDroppedItemToWorld(item, location))
{
return false;
}
IPooledEnumerable mobiles = Map.GetMobilesInRange(location, 0);
if (mobiles.OfType<Mobile>().Any(m => m.Z >= location.Z && m.Z < location.Z + 16))
{
mobiles.Free();
return false;
}
mobiles.Free();
if (XmlScript.HasTrigger(item, TriggerName.onDropToWorld) &&
UberScriptTriggers.Trigger(item, this, TriggerName.onDropToWorld, item))
{
return false;
}
BounceInfo bi = item.GetBounce();
if (bi == null)
{
return true;
}
Type type = item.GetType();
if (!type.IsDefined(typeof(FurnitureAttribute), true) && !type.IsDefined(typeof(DynamicFlipingAttribute), true))
{
return true;
}
object[] objs = type.GetCustomAttributes(typeof(FlipableAttribute), true);
if (objs.Length == 0)
{
return true;
}
var fp = objs[0] as FlipableAttribute;
if (fp == null)
{
return true;
}
int[] itemIDs = fp.ItemIDs;
Point3D oldWorldLoc = bi.m_WorldLoc;
Point3D newWorldLoc = location;
if (oldWorldLoc.X == newWorldLoc.X && oldWorldLoc.Y == newWorldLoc.Y)
{
return true;
}
Direction dir = GetDirection4(oldWorldLoc, newWorldLoc);
switch (itemIDs.Length)
{
case 2:
{
switch (dir)
{
case Direction.North:
case Direction.South:
item.ItemID = itemIDs[0];
break;
case Direction.East:
case Direction.West:
item.ItemID = itemIDs[1];
break;
}
}
break;
case 4:
{
switch (dir)
{
case Direction.South:
item.ItemID = itemIDs[0];
break;
case Direction.East:
item.ItemID = itemIDs[1];
break;
case Direction.North:
item.ItemID = itemIDs[2];
break;
case Direction.West:
item.ItemID = itemIDs[3];
break;
}
}
break;
}
//.........这里部分代码省略.........
示例7: CheckEquip
public override bool CheckEquip(Item item)
{
if (!base.CheckEquip(item))
{
return false;
}
#region Dueling
if (DuelContext != null && !DuelContext.AllowItemEquip(this, item))
{
return false;
}
#endregion
#region Factions
FactionItem factionItem = FactionItem.Find(item);
if (factionItem != null)
{
Faction faction = Faction.Find(this);
if (faction == null)
{
SendLocalizedMessage(1010371); // You cannot equip a faction item!
return false;
}
if (faction != factionItem.Faction)
{
SendLocalizedMessage(1010372); // You cannot equip an opposing faction's item!
return false;
}
int maxWearables = FactionItem.GetMaxWearables(this);
if (Items.Any(equipped => item != equipped && FactionItem.Find(equipped) != null && --maxWearables == 0))
{
SendLocalizedMessage(1010373); // You do not have enough rank to equip more faction items!
return false;
}
}
#endregion
if (AccessLevel < AccessLevel.GameMaster && item.Layer != Layer.Mount && HasTrade)
{
BounceInfo bounce = item.GetBounce();
if (bounce != null)
{
if (bounce.m_Parent is Item)
{
var parent = (Item)bounce.m_Parent;
if (parent == Backpack || parent.IsChildOf(Backpack))
{
return true;
}
}
else if (bounce.m_Parent == this)
{
return true;
}
}
// You can only equip what you are already carrying while you have a trade pending.
SendLocalizedMessage(1004042);
return false;
}
return true;
}
示例8: CheckEquip
public override bool CheckEquip( Item item )
{
if ( !base.CheckEquip( item ) )
return false;
#region Factions
FactionItem factionItem = FactionItem.Find( item );
if ( factionItem != null )
{
Faction faction = Faction.Find( this );
if ( faction == null )
{
SendLocalizedMessage( 1010371 ); // You cannot equip a faction item!
return false;
}
else if ( faction != factionItem.Faction )
{
SendLocalizedMessage( 1010372 ); // You cannot equip an opposing faction's item!
return false;
}
else
{
int maxWearables = FactionItem.GetMaxWearables( this );
var wearables = this.GetEquippedItems()
.Where( equipped => FactionItem.Find( equipped ) != null )
.Count();
if ( wearables > maxWearables )
{
SendLocalizedMessage( 1010373 ); // You do not have enough rank to equip more faction items!
return false;
}
}
}
if ( item is IFactionArtifact )
{
PlayerState playerState = PlayerState.Find( this );
IFactionArtifact artifact = item as IFactionArtifact;
if ( playerState == null )
{
SendLocalizedMessage( 1010371 ); // You cannot equip a faction item!
return false;
}
else if ( artifact.Owner != this )
{
SendLocalizedMessage( 500364, null, 0x23 ); // You can't use that, it belongs to someone else.
return false;
}
}
#endregion
if ( this.AccessLevel < AccessLevel.GameMaster && item.Layer != Layer.Mount && this.HasTrade )
{
BounceInfo bounce = item.GetBounce();
if ( bounce != null )
{
if ( bounce.m_Parent is Item )
{
Item parent = (Item) bounce.m_Parent;
if ( parent == this.Backpack || parent.IsChildOf( this.Backpack ) )
return true;
}
else if ( bounce.m_Parent == this )
{
return true;
}
}
SendLocalizedMessage( 1004042 ); // You can only equip what you are already carrying while you have a trade pending.
return false;
}
return true;
}
示例9: OnItemRemoved
public override void OnItemRemoved( Item item )
{
base.OnItemRemoved( item );
if ( item.GetBounce() == null && TotalItems == 0 )
Delete();
}