本文整理汇总了C#中Server.Mobile.BeginTarget方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.BeginTarget方法的具体用法?C# Mobile.BeginTarget怎么用?C# Mobile.BeginTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Mobile
的用法示例。
在下文中一共展示了Mobile.BeginTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BondInfo_OnTarget
public static void BondInfo_OnTarget(Mobile from, object targeted)
{
var baseCreature = targeted as BaseCreature;
if (baseCreature != null)
{
if (baseCreature.ControlMaster == from)
{
if (baseCreature.BondingBegin == DateTime.MinValue)
{
from.SendMessage("Your pet hasn't started to bond yet, please feed it and try again.");
}
else
{
DateTime today = DateTime.UtcNow;
DateTime willbebonded = baseCreature.BondingBegin.AddDays(7);
TimeSpan daystobond = willbebonded - today;
string BondInfo = string.Format("The pet started bonding with you at {0}. Its {1} days, {2} hours and {3} minutes until it bonds.", baseCreature.BondingBegin, daystobond.Days, daystobond.Hours, daystobond.Minutes);
from.SendMessage(BondInfo);
}
}
else
{
from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(BondInfo_OnTarget));
from.SendMessage("That is not your pet!");
}
}
else
{
from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(BondInfo_OnTarget));
from.SendMessage("That is not a pet!");
}
}
示例2: OnTarget
public void OnTarget( Mobile from, object targeted, object state )
{
object[] states = (object[])state;
BaseCommand command = (BaseCommand)states[0];
string[] args = (string[])states[1];
if ( !BaseCommand.IsAccessible( from, targeted ) )
{
from.SendMessage( "That is not accessible." );
from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, new TargetStateCallback( OnTarget ), new object[]{ command, args } );
return;
}
switch ( command.ObjectTypes )
{
case ObjectTypes.Both:
{
if ( !(targeted is Item) && !(targeted is Mobile) )
{
from.SendMessage( "This command does not work on that." );
return;
}
break;
}
case ObjectTypes.Items:
{
if ( !(targeted is Item) )
{
from.SendMessage( "This command only works on items." );
return;
}
break;
}
case ObjectTypes.Mobiles:
{
if ( !(targeted is Mobile) )
{
from.SendMessage( "This command only works on mobiles." );
return;
}
break;
}
}
RunCommand( from, targeted, command, args );
from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, new TargetStateCallback( OnTarget ), new object[]{ command, args } );
}
示例3: OnSelectBuilding
public void OnSelectBuilding(Mobile from, object target, object state)
{
BattleBuilding bb = target as BattleBuilding;
ArrayList list = state as ArrayList;
if (bb == null)
{
from.SendAsciiMessage(0x25, "Select the building to add the items to!");
from.BeginTarget(18, false, TargetFlags.None, new TargetStateCallback(OnSelectBuilding), state);
return;
}
int count = 0;
foreach (Item i in list)
{
if (i != bb && !bb.Decorations.Contains(i))
{
bb.Decorations.Add(i);
count++;
}
}
from.SendAsciiMessage(count.ToString() + " items added to building.");
}
示例4: AllNames_OnTarget
private static void AllNames_OnTarget(Mobile from, object obj)
{
if (obj is AddressBook)
{
int count = 0;
AddressBook book = (AddressBook)obj;
if (book.Entries != null)
book.Entries.Clear();
else
book.Entries = new ArrayList();
foreach (Mobile m in World.Mobiles.Values)
{
PlayerMobile mp = m as PlayerMobile;
if (mp != null)
{
count += 1;
book.AddEntry(mp);
}
}
from.SendMessage("The Address Book has been filled with " + count + " entries");
CommandLogging.WriteLine(from, "{0} {1} filling Address Book {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(book));
}
else
{
from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(AllNames_OnTarget));
from.SendMessage("That is not a Address Book. Try again.");
}
}
示例5: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
from.BeginTarget(-1, false, TargetFlags.None, (m, targeted) =>
{
if (!IsChildOf(m.Backpack))
m.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
else if (targeted is BaseWeapon)
{
BaseWeapon wep = targeted as BaseWeapon;
if(!wep.IsChildOf(m.Backpack))
m.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
else if (wep.TimesImbued > 0)
m.SendLocalizedMessage(1046439); // Invalid target.
else if (wep.Attributes.WeaponDamage > 0)
{
wep.Attributes.WeaponDamage = 0;
m.SendLocalizedMessage(1151814); // You have removed the damage increase from this weapon.
this.Consume();
}
else
m.SendLocalizedMessage(1046439); // Invalid target.
}
else
m.SendLocalizedMessage(1046439); // Invalid target.
});
}
else
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
示例6: Process
public override void Process( Mobile from, BaseCommand command, string[] args )
{
if ( command.ValidateArgs( this, new CommandEventArgs( from, command.Commands[0], GenerateArgString( args ), args ) ) )
{
from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, new TargetStateCallback( OnTarget ), new object[] { command, args } );
}
}
示例7: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if ( !IsChildOf( from ) )
return;
if ( m_UsesRemaining < 1 )
{
// You have no fukiya darts!
from.SendLocalizedMessage( 1063325 );
}
else if ( m_Using )
{
// You are already using that fukiya.
from.SendLocalizedMessage( 1063326 );
}
else if ( !BasePotion.HasFreeHand( from ) )
{
// You must have a free hand to use a fukiya.
from.SendLocalizedMessage( 1063327 );
}
else
{
from.BeginTarget( 5, false, TargetFlags.Harmful, new TargetCallback( OnTarget ) );
}
}
示例8: AddNewOrder
public static void AddNewOrder( Mobile seller, MarketEntry entry )
{
seller.SendMessage("Select the object for this order.");
seller.BeginTarget(12, false, Server.Targeting.TargetFlags.None, new TargetCallback(
delegate( Mobile from, object targeted )
{
if( targeted is IEntity )
{
if( targeted is Mobile )
{
Mobile mob = (Mobile)targeted;
if( mob is BaseCreature && ((BaseCreature)mob).ControlMaster == from )
FinalizeNewOrder(seller, entry, mob);
else
from.SendMessage("You do not have the right to sell that.");
}
else if( targeted is Item )
{
Item item = (Item)targeted;
if( item.IsChildOf(from.Backpack) || item.RootParent == from )
FinalizeNewOrder(seller, entry, item);
else
from.SendMessage("You do not have the right to sell that.");
}
}
else
{
from.SendMessage("That is not a valid market entity.");
}
}));
}
示例9: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1042001 ); //That must be in your pack to use it.
}
else
{
if( from.Skills.Magery.Base < 85 )
{
from.SendMessage( "The scroll bursts into flame in your hands!" );
from.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Waist );
from.Damage( Utility.RandomMinMax( 40, 55 ) );
this.Delete();
}
else
{
from.Frozen = true;
from.PublicOverheadMessage( MessageType.Spell, from.SpeechHue, true, "In Kal Quas", false );
if( !from.Mounted && from.Body.IsHuman )
from.Animate( 206, 7, 1, true, false, 0 );
from.BeginTarget( 10, false, TargetFlags.None, new TargetCallback( BlessingOfKhopesh_OnTarget ) );
}
}
}
示例10: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if ( !IsChildOf( from.Backpack ) )
from.SendLocalizedMessage( 1042664 ); // You must have the object in your backpack to use it.
else
from.BeginTarget( 1, false, TargetFlags.None, new TargetCallback( BurnWeb_Callback ) );
}
示例11: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if( _owner == null )
_owner = from;
from.BeginTarget(1, false, TargetFlags.None, new TargetStateCallback(this_doorSelected), this);
from.SendMessage("Select the door to install this trap onto.");
}
示例12: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
if (from == null)
return;
from.RevealingAction();
from.BeginTarget(1, false, TargetFlags.None, new TargetCallback(ItemClaimer_OnTarget));
}
示例13: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
from.SendMessage("Target a corpse you'd like to net.");
from.BeginTarget(10, false, TargetFlags.None, new TargetCallback(Net_OnTarget));
}
}
示例14: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
if(ItemID == UnlitItemID)
{
from.SendMessage("Que voulez vous chauffer?");
from.BeginTarget(2, false, TargetFlags.None, new TargetCallback(OnTarget));
}
base.OnDoubleClick(from);
}
示例15: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if( IsAccessibleTo( from ) && from.InRange( GetWorldLocation(), 3 ) )
{
from.SendLocalizedMessage( 1070929 ); // Select the artifact or enhanced magic item to dye.
from.BeginTarget( 3, false, Server.Targeting.TargetFlags.None, new TargetStateCallback( InternalCallback ), this );
}
else
from.SendLocalizedMessage( 502436 ); // That is not accessible.
}