本文整理汇总了C#中Item.IsChildOf方法的典型用法代码示例。如果您正苦于以下问题:C# Item.IsChildOf方法的具体用法?C# Item.IsChildOf怎么用?C# Item.IsChildOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item.IsChildOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Dye
public override bool Dye( Mobile from, Item item )
{
bool okay = ( item.IsChildOf( from.Backpack ) );
if ( !okay )
{
if ( item.RootParent == null )
{
BaseHouse house = BaseHouse.FindHouseAt( item );
if ( house == null || ( !house.IsLockedDown( item ) && !house.IsSecure( item ) ) )
from.SendLocalizedMessage( 501022 ); // Furniture must be locked down to paint it.
else if ( !house.IsCoOwner( from ) )
from.SendLocalizedMessage( 501023 ); // You must be the owner to use this item.
else
okay = true;
}
else
from.SendLocalizedMessage( 1048135 ); // The furniture must be in your backpack to be painted.
}
if ( okay && item.Dye( from, this ) )
{
from.PlaySound( 0x23E );
return true;
}
return false;
}
示例2: OnItemLifted
public override void OnItemLifted( Mobile from, Item item )
{
if( item.IsChildOf( from.Backpack) )
{
from.Str -= 5;
isactive = false;
}
base.OnItemLifted(from,item);
}
示例3: AddContextMenuEntries
public static void AddContextMenuEntries(Mobile from, Item item, List<ContextMenuEntry> list)
{
if (!item.IsChildOf(from.Backpack) && item.Parent != from)
return;
PlayerMobile pm = from as PlayerMobile;
if (pm == null)
return;
list.Add(new ToggleClippings(pm, true, false, false, 1112282)); //Set to clip plants
list.Add(new ToggleClippings(pm, false, true, false, 1112283)); //Set to cut reeds
list.Add(new ToggleClippings(pm, false, false, true, 1150660)); //Set to cut topiaries
}
示例4: OnSpunLoop
public static void OnSpunLoop(ISpinningWheel wheel, Mobile from, int hue, Item cotton)
{
Item item = new SpoolOfThread(3);
item.Hue = hue;
from.AddToBackpack(item);
SpinningWheelQuotaAttachment att = (SpinningWheelQuotaAttachment)XmlAttach.FindAttachment(from, typeof(SpinningWheelQuotaAttachment));
if (att == null)
{
att = new SpinningWheelQuotaAttachment();
XmlAttach.AttachTo(from, att);
}
att.RemoveWheels((Item)wheel);
if (from.NetState == null) // player logged off
return;
if (cotton.Deleted || cotton.Amount < 1 || !(cotton is Flax))
from.SendMessage("You finished processing all the flax.");
else if (!cotton.IsChildOf(from.Backpack))
from.SendMessage("You can not continue without the flax in your backpack.");
else if (wheel is Item)
{
Item wheel1 = (Item)wheel;
if (wheel1.Deleted)
from.SendMessage("Where did the spinning wheel go?");
else if (!from.InRange(wheel1.GetWorldLocation(), 3))
from.SendMessage("You are too far away from the spinning wheel to continue your work.");
else if (wheel.Spinning)
from.SendLocalizedMessage(502656); // That spinning wheel is being used.
else
{
if (att.getNumWheels() < SpinningWheelQuotaAttachment.m_WheelQuotaCap)
{
att.AddWheels(wheel1);
if (Utility.Random(6 * att.getNumWheels()) < 1)
from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*spinning*");
cotton.Consume();
wheel.BeginSpin(new SpinCallback(Flax.OnSpunLoop), from, cotton.Hue, cotton);
return;
}
else
from.SendMessage("You are too occupied with the " + SpinningWheelQuotaAttachment.m_WheelQuotaCap.ToString() + " spinning wheels you are running.");
}
}
from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
}
示例5: ConsumeRelic
public void ConsumeRelic(Mobile m, Item item)
{
if (!item.IsChildOf(m.Backpack))
{
m.SendMessage(54, "The relic must be in your backpack for you to use it!");
return;
}
if (item is BaseMetaRelic)
{
var relic = item as BaseMetaRelic;
relic.GetMeta(m, Pet);
}
else
{
m.SendMessage(54, "You must use this on a relic!");
}
}
示例6: 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;
}
示例7: OnSubItemAdded
public override void OnSubItemAdded( Item item )
{
if ( AccessLevel < AccessLevel.GameMaster && item.IsChildOf( this.Backpack ) )
{
int maxWeight = WeightOverloading.GetMaxWeight( this );
int curWeight = Mobile.BodyWeight + this.TotalWeight;
if ( curWeight > maxWeight )
this.SendLocalizedMessage( 1019035, true, String.Format( " : {0} / {1}", curWeight, maxWeight ) );
}
}
示例8: AddContextMenuEntries
public static void AddContextMenuEntries(Mobile from, Item item, List<ContextMenuEntry> list)
{
if (!item.IsChildOf(from.Backpack) && item.Parent != from)
return;
PlayerMobile pm = from as PlayerMobile;
if (pm == null)
return;
int typeentry = 0;
if (pm.ToggleCutClippings)
typeentry = 1112282;
if (pm.ToggleCutReeds)
typeentry = 1112283;
ContextMenuEntry clippingEntry = new ContextMenuEntry(typeentry);
clippingEntry.Color = 0x421F;
//list.Add( clippingEntry );
list.Add(new ToggleClippings(pm, true, false, 1112282)); //set to clip plants
list.Add(new ToggleClippings(pm, false, true, 1112283)); //Set to cut reeds
}
示例9: ToggleItemInsurance_Callback
private void ToggleItemInsurance_Callback(Mobile from, Item item, bool target)
{
if (item == null || !item.IsChildOf(this))
{
if (target)
BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback));
SendLocalizedMessage(1060871, "", 0x23); // You can only insure items that you have equipped or that are in your backpack
}
else if (item.Insured)
{
item.Insured = false;
SendLocalizedMessage(1060874, "", 0x35); // You cancel the insurance on the item
if (target)
{
BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback));
SendLocalizedMessage(1060868, "", 0x23); // Target the item you wish to toggle insurance status on <ESC> to cancel
}
}
else if (!CanInsure(item))
{
if (target)
BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback));
SendLocalizedMessage(1060869, "", 0x23); // You cannot insure that
}
else
{
if (!item.PayedInsurance)
{
int cost = GetInsuranceCost(item);
if (Banker.Withdraw(from, cost))
{
SendLocalizedMessage(1060398, cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
item.PayedInsurance = true;
}
else
{
SendLocalizedMessage(1061079, "", 0x23); // You lack the funds to purchase the insurance
return;
}
}
item.Insured = true;
SendLocalizedMessage(1060873, "", 0x23); // You have insured the item
if (target)
{
BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback));
SendLocalizedMessage(1060868, "", 0x23); // Target the item you wish to toggle insurance status on <ESC> to cancel
}
}
}
示例10: CheckNonlocalLift
public override bool CheckNonlocalLift( Mobile from, Item item )
{
if ( item.IsChildOf( this.Backpack ) )
{
if ( IsOwner( from ) )
{
return true;
}
else
{
SayTo( from, 503223 ); // If you'd like to purchase an item, just ask.
return false;
}
}
return base.CheckNonlocalLift( from, item );
}
示例11: CheckNonlocalLift
public override bool CheckNonlocalLift(Mobile from, Item item)
{
if (item.IsChildOf(Backpack))
{
if (IsOwner(from))
{
return true;
}
SayTo(from, 503223); // If you'd like to purchase an item, just ask.
return false;
}
if (BaseHouse.NewVendorSystem && IsOwner(from))
{
return true;
}
return base.CheckNonlocalLift(from, item);
}
示例12: CheckAccessible
public static bool CheckAccessible(Item tool, Mobile m)
{
return (tool.IsChildOf(m) || tool.Parent == m);
}
示例13: AddContextMenuEntries
public static void AddContextMenuEntries( Mobile from, Item item, List<ContextMenuEntry> list, HarvestSystem system )
{
if ( system != Mining.System )
return;
if ( !item.IsChildOf( from.Backpack ) && item.Parent != from )
return;
PlayerMobile pm = from as PlayerMobile;
if ( pm == null )
return;
ContextMenuEntry miningEntry = new ContextMenuEntry( pm.ToggleMiningStone ? 6179 : 6178 );
miningEntry.Color = 0x421F;
list.Add( miningEntry );
list.Add( new ToggleMiningStoneEntry( pm, false, 6176 ) );
list.Add( new ToggleMiningStoneEntry( pm, true, 6177 ) );
}
示例14: OnSubItemAdded
public override void OnSubItemAdded(Item item)
{
if (AccessLevel >= AccessLevel.GameMaster || !item.IsChildOf(Backpack))
{
return;
}
int maxWeight = WeightOverloading.GetMaxWeight(this);
int curWeight = BodyWeight + TotalWeight;
if (curWeight > maxWeight)
{
SendLocalizedMessage(1019035, true, String.Format(" : {0} / {1}", curWeight, maxWeight));
}
}
示例15: OnDroppedOnto
public override bool OnDroppedOnto( Mobile from, Item target )
{
if( target != null && !target.Deleted && target is CustomSpellBook && target.IsChildOf(from) )
{
CustomSpellBook book = target as CustomSpellBook;
if( Spell.CustomName == null || Spell.CustomName.Length < 1 )
from.SendMessage( "A spell scroll can only be copied onto a spell book after the spell has been properly named." );
else if( book.ContainsSpell(Spell.CustomName) )
from.SendMessage( "That spell book already contains a spell with the same name as the one on the scroll." );
else
{
book.Spells.Add( DupeCustomMageSpell(Spell) );
from.SendMessage( "You successfully copy the spell onto the book." );
}
}
return base.OnDroppedOnto( from, target );
}