本文整理汇总了C#中Server.Item.IsAccessibleTo方法的典型用法代码示例。如果您正苦于以下问题:C# Item.IsAccessibleTo方法的具体用法?C# Item.IsAccessibleTo怎么用?C# Item.IsAccessibleTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Item
的用法示例。
在下文中一共展示了Item.IsAccessibleTo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDroppedOnto
public virtual bool OnDroppedOnto( Mobile from, Item target )
{
if ( Deleted || from.Deleted || target.Deleted || from.Map != target.Map || from.Map == null || target.Map == null )
return false;
else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( target.GetWorldLocation(), 2 ) )
return false;
else if ( !from.CanSee( target ) || !from.InLOS( target ) )
return false;
else if ( !target.IsAccessibleTo( from ) )
return false;
else if ( !from.OnDroppedItemOnto( this, target ) )
return false;
else
return target.OnDragDrop( from, this );
}
示例2: Use
public virtual void Use( Item item )
{
if ( item == null || item.Deleted )
return;
DisruptiveAction();
if ( m_Spell != null && !m_Spell.OnCasterUsingObject( item ) )
return;
object root = item.RootParent;
bool okay = false;
if ( !Utility.InUpdateRange( this, item.GetWorldLocation() ) )
item.OnDoubleClickOutOfRange( this );
else if ( !CanSee( item ) )
item.OnDoubleClickCantSee( this );
else if ( !item.IsAccessibleTo( this ) )
{
Region reg = Region.Find( item.GetWorldLocation(), item.Map );
if ( reg == null || !reg.SendInaccessibleMessage( item, this ) )
item.OnDoubleClickNotAccessible( this );
}
else if ( !CheckAlive( false ) )
item.OnDoubleClickDead( this );
else if ( item.InSecureTrade )
item.OnDoubleClickSecureTrade( this );
else if ( !AllowItemUse( item ) )
okay = false;
else if ( !item.CheckItemUse( this, item ) )
okay = false;
else if ( root != null && root is Mobile && ((Mobile)root).IsSnoop( this ) )
item.OnSnoop( this );
else if ( m_Region.OnDoubleClick( this, item ) )
okay = true;
if ( okay )
{
if ( !item.Deleted )
item.OnItemUsed( this, item );
if ( !item.Deleted )
item.OnDoubleClick( this );
}
}
示例3: DropToItem
public virtual bool DropToItem( Mobile from, Item target, Point3D p )
{
if ( Deleted || from.Deleted || target.Deleted || from.Map != target.Map || from.Map == null || target.Map == null )
return false;
object root = target.RootParent;
if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( target.GetWorldLocation(), 2 ) )
return false;
else if ( !from.CanSee( target ) || !from.InLOS( target ) )
return false;
else if ( !target.IsAccessibleTo( from ) )
return false;
else if ( root is Mobile && !((Mobile)root).CheckNonlocalDrop( from, this, target ) )
return false;
else if ( !from.OnDroppedItemToItem( this, target, p ) )
return false;
else if ( target is Container && p.m_X != -1 && p.m_Y != -1 )
return OnDroppedInto( from, (Container)target, p );
else
return OnDroppedOnto( from, target );
}
示例4: 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;
}
}
}
//.........这里部分代码省略.........
示例5: 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 );
}
}
//.........这里部分代码省略.........
示例6: CanTrash
public virtual bool CanTrash(Mobile from, Item trash, bool message = true)
{
if (trash == null || trash.Deleted || !trash.Movable || !trash.IsAccessibleTo(from) ||
!TrashCollection.CMOptions.ModuleEnabled)
{
return false;
}
return TrashCollection.Handlers.Values.Any(h => h != null && h.CanTrash(@from, trash, message));
}
示例7: CanTrash
public virtual bool CanTrash(Mobile from, Item trash, bool message = true)
{
if (!Enabled || trash == null || trash.Deleted || !trash.Movable || !trash.IsAccessibleTo(from))
{
return false;
}
Type iType = trash.GetType();
if (!IsAccepted(from, iType) || IsIgnored(from, iType))
{
return false;
}
if (trash is Container)
{
Container c = (Container)trash;
bool trashThis = c.FindItemsByType<Item>().All(ci => CanTrash(from, ci));
if (!trashThis)
{
return false;
}
}
return true;
}
示例8: OnDroppedOnto
public virtual bool OnDroppedOnto( Mobile from, Item target )
{
if ( IsUnderYourFeet( from, target ) )
{
from.SendMessage( "No puedes mover eso, ¡estás pisando la bolsa!" );
return false;
}
else if ( Deleted || from.Deleted || target.Deleted || from.Map != target.Map || from.Map == null || target.Map == null )
return false;
else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( target.GetWorldLocation(), 2 ) )
return false;
else if ( !from.CanSee( target ) || !from.InLOS( target ) )
return false;
else if ( !target.IsAccessibleTo( from ) )
return false;
else if ( !from.OnDroppedItemOnto( this, target ) )
return false;
else if ( NonTransferable && from.IsPlayer && from.AccessLevel <= AccessLevel.GameMaster )
{
HandleInvalidTransfer( from );
return false;
}
else
return target.OnDragDrop( from, this );
}
示例9: Add
public bool Add(Mobile m, Item item, RuneCodexCategory cat, bool message)
{
if (m == null || m.Deleted || item == null || item.Deleted || !item.IsAccessibleTo(m))
{
return false;
}
if (item is RecallRune)
{
return AddRune(m, (RecallRune)item, cat, message);
}
if (item is Runebook)
{
return AddRunebook(m, (Runebook)item, cat, message);
}
#region Master Runebook Support
//Using Reflection for shards that don't have it installed.
Type t = item.GetType();
if (Insensitive.Equals(t.Name, "MasterRunebook"))
{
var pi = t.GetProperty("Books");
if (pi != null && pi.CanRead)
{
var obj = pi.GetValue(item, null);
if (obj is ICollection)
{
var ex = new Queue<Runebook>(((ICollection)obj).OfType<Runebook>().Where(r => r.Entries.Count > 0));
if (ex.Count == 0)
{
if (message)
{
m.SendMessage("That master rune book is empty.");
}
return false;
}
if (Categories.Count + ex.Count > Categories.Capacity)
{
if (message)
{
m.SendMessage("That master rune book won't fit in this rune codex.");
}
return false;
}
int extracted = 0;
while (ex.Count > 0)
{
var b = ex.Dequeue();
if (AddRunebook(m, b, cat, message))
{
++extracted;
}
}
if (extracted > 0)
{
if (message)
{
m.SendMessage(
"You extract {0:#,0} book{1} from the master rune book and add them to the codex.",
extracted,
extracted != 1 ? "s" : String.Empty);
}
return true;
}
if (message)
{
m.SendMessage("There was nothing in the master rune book to extract.");
}
}
}
return false;
}
#endregion Master Runebook Support
if (AddCharges(m, item, message))
{
return item.Deleted;
}
if (message)
{
m.SendMessage("Drop a rune book or recall rune on the codex to add them.");
}
return false;
//.........这里部分代码省略.........
示例10: AddCharges
public virtual bool AddCharges(Mobile m, Item item, bool message)
{
if (m == null || m.Deleted || item == null || item.Deleted || !item.IsAccessibleTo(m))
{
return false;
}
int cost;
if (!CanChargeWith(m, item, out cost, message))
{
return false;
}
if (item.Amount < cost)
{
if (message)
{
m.SendMessage("One charge costs {0:#,0} {1}.", cost, item.ResolveName(m));
}
return false;
}
int c = (int)Math.Min((long)(Charges + (int)Math.Floor(item.Amount / (double)cost)), Int32.MaxValue) - Charges;
if (c <= 0)
{
return false;
}
int con = c * cost;
item.Consume(con);
Charges += c;
if (message)
{
m.SendMessage(
"You added {0:#,0} charge{1} to the codex and consumed {2:#,0} {3}.",
c,
c != 1 ? "s" : String.Empty,
con,
item.ResolveName());
}
InvalidateProperties();
return true;
}
示例11: CanChargeWith
public virtual bool CanChargeWith(Mobile m, Item item, out int cost, bool message)
{
cost = 0;
if (m == null || m.Deleted || item == null || item.Deleted || !item.IsAccessibleTo(m))
{
return false;
}
Type t = item.GetType();
if (ChargeTypes.ContainsKey(t))
{
cost = ChargeTypes[t];
return true;
}
if (message)
{
m.SendMessage("That item is not accepted for charging this codex.");
}
return false;
}
示例12: CanTrash
public virtual bool CanTrash(Mobile from, Item trash, bool message = true)
{
if (!Enabled || trash == null || trash.Deleted || !trash.Movable || !trash.IsAccessibleTo(from))
{
return false;
}
if (IgnoreInsured && trash.Insured)
{
return false;
}
if (IgnoreBlessed && (trash.LootType == LootType.Blessed || trash.BlessedFor != null))
{
return false;
}
var iType = trash.GetType();
return IsAccepted(from, iType) && !IsIgnored(from, iType);
}