本文整理汇总了C#中Server.Item.VerifyMove方法的典型用法代码示例。如果您正苦于以下问题:C# Item.VerifyMove方法的具体用法?C# Item.VerifyMove怎么用?C# Item.VerifyMove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Item
的用法示例。
在下文中一共展示了Item.VerifyMove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Lift
public virtual void Lift( Item item, int amount, out bool rejected, out LRReason reject )
{
rejected = true;
reject = LRReason.Inspecific;
if ( item == null )
return;
Mobile from = this;
NetState state = m_NetState;
if ( from.AccessLevel >= AccessLevel.GameMaster || Core.Now >= from.NextActionTime )
{
if ( from.CheckAlive() )
{
from.DisruptiveAction();
if ( from.Holding != null )
{
reject = LRReason.AreHolding;
}
else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( item.GetWorldLocation(), 2 ) )
{
reject = LRReason.OutOfRange;
}
else if ( !from.CanSee( item ) || !from.InLOS( item ) )
{
reject = LRReason.OutOfSight;
}
else if ( !item.VerifyMove( from ) )
{
reject = LRReason.CannotLift;
}
else if ( item.InSecureTrade || !item.IsAccessibleTo( from ) )
{
reject = LRReason.CannotLift;
}
else if ( !item.CheckLift( from, item ) )
{
reject = LRReason.Inspecific;
}
else
{
object root = item.RootParent;
if ( root != null && root is Mobile && !((Mobile)root).CheckNonlocalLift( from, item ) )
{
reject = LRReason.TryToSteal;
}
else if ( !from.OnDragLift( item ) || !item.OnDragLift( from ) )
{
reject = LRReason.Inspecific;
}
else if ( !from.CheckAlive() )
{
reject = LRReason.Inspecific;
}
else
{
item.SetLastMoved();
if ( amount == 0 )
amount = 1;
if ( amount > item.Amount )
amount = item.Amount;
int oldAmount = item.Amount;
item.Amount = amount;
if ( amount < oldAmount )
item.Dupe( oldAmount - amount );
Map map = from.Map;
if ( Mobile.DragEffects && map != null && (root == null || root is Item))
{
IPooledEnumerable eable = map.GetClientsInRange( from.Location );
Packet p = null;
foreach ( NetState ns in eable )
{
if ( ns.Mobile != from && ns.Mobile.CanSee( from ) )
{
if ( p == null )
{
IEntity src;
if ( root == null )
src = new Entity( Serial.Zero, item.Location, map );
else
src = new Entity( ((Item)root).Serial, ((Item)root).Location, map );
p = new DragEffect( src, from, item.ItemID, item.Hue, amount );
}
ns.Send( p );
}
}
//.........这里部分代码省略.........
示例2: TryDropItem
/// <summary>
/// Checks if the item dropped upon the crystal can be used to recharge it.
/// If it can, the item dropped is consumed and the crystal is charged
/// </summary>
/// <param name="from">Mobile dropping the item</param>
/// <param name="dropped">Item that is being dropped</param>
/// <param name="sendFullMessage">unused</param>
/// <returns></returns>
public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
{
if (Locked)
{
from.SendMessage("Dark energies repel the item.");
return false;
}
if (dropped != null && dropped.VerifyMove(from))
{
BarrierCrystalRechargeInfo info = BarrierCrystalRechargeInfo.Get(dropped.GetType(), Desecrated == Desecration.Desecrated);
if (info != null)
{
if (Charges >= MaxCharges)
{
from.SendLocalizedMessage(500678); // This crystal is already fully charged.
}
else
{
dropped.Consume();
if (Charges + info.Amount >= MaxCharges)
{
Charges = MaxCharges;
from.SendLocalizedMessage(500679); // You completely recharge the crystal.
}
else
{
Charges += info.Amount;
if (ItemID != 14284)
from.SendLocalizedMessage(500680); // You recharge the crystal.
else
from.SendMessage("The crystal reforms as it absorbs the gem.");
}
}
return true;
}
else if (dropped is Skull)
{
Skull sk = (Skull)dropped;
if (sk.Desecrated)
{
Desecrated = Desecration.Desecrated;
ToggleGuards(true);
sk.Consume();
from.SendMessage("The dark action poisons the crystal.");
from.SendMessage("The city guards vanish.");
return true;
}
}
else if (dropped is HugeSkull)
{
HugeSkull sk = (HugeSkull)dropped;
if (sk.Desecrated)
{
Desecrated = Desecration.Desecrated;
ToggleGuards(true);
sk.Consume();
from.SendMessage("The dark action poisons the crystal.");
from.SendMessage("The city guards vanish.");
return true;
}
}
}
from.SendLocalizedMessage(500681); // You cannot use this crystal on that.
return false;
}
示例3: Lift
public void Lift( Item item, int amount, out bool rejected, out LRReason reject )
{
rejected = true;
reject = LRReason.Inspecific;
if ( item == null )
return;
Mobile from = this;
GameClient state = m_Client;
if ( from.AccessLevel >= AccessLevel.GameMaster || DateTime.Now >= from.NextActionTime )
{
if ( from.CheckAlive() )
{
from.DisruptiveAction();
if ( from.Holding != null )
{
reject = LRReason.AreHolding;
}
else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( item.GetWorldLocation(), 2 ) )
{
reject = LRReason.OutOfRange;
}
else if ( !from.CanSee( item ) || !from.InLOS( item ) )
{
reject = LRReason.OutOfSight;
}
else if ( !item.VerifyMove( from ) )
{
reject = LRReason.CannotLift;
}
else if ( !item.IsAccessibleTo( from ) )
{
reject = LRReason.CannotLift;
}
else if ( item.CheckLift( from, item, ref reject ) )
{
object root = item.RootParent;
if ( root != null && root is Mobile && !( (Mobile) root ).CheckNonlocalLift( from, item ) )
{
reject = LRReason.TryToSteal;
}
else if ( !from.OnDragLift( item ) || !item.OnDragLift( from ) )
{
reject = LRReason.Inspecific;
}
else if ( !from.CheckAlive() )
{
reject = LRReason.Inspecific;
}
else
{
if ( item.Parent != null && item.Parent is Container )
( (Container) item.Parent ).FreePosition( item.GridLocation );
item.SetLastMoved();
if ( item.Spawner != null )
{
item.Spawner.Remove( item );
item.Spawner = null;
}
if ( amount == 0 )
amount = 1;
if ( amount > item.Amount )
amount = item.Amount;
int oldAmount = item.Amount;
//item.Amount = amount; //Set in LiftItemDupe
if ( amount < oldAmount )
LiftItemDupe( item, amount );
InvokeItemLifted( new ItemLiftedEventArgs( item, amount ) );
item.RecordBounce();
item.OnItemLifted( from, item );
item.Internalize();
from.Holding = item;
from.NextActionTime = DateTime.Now + TimeSpan.FromSeconds( 0.5 );
Point3D fixLoc = item.Location;
Map fixMap = item.Map;
bool shouldFix = ( item.Parent == null );
if ( fixMap != null && shouldFix )
fixMap.FixColumn( fixLoc.X, fixLoc.Y );
reject = LRReason.Inspecific;
rejected = false;
}
}
}
//.........这里部分代码省略.........