本文整理匯總了C#中Server.Mobile.BeginAction方法的典型用法代碼示例。如果您正苦於以下問題:C# Mobile.BeginAction方法的具體用法?C# Mobile.BeginAction怎麽用?C# Mobile.BeginAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Mobile
的用法示例。
在下文中一共展示了Mobile.BeginAction方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if ( from.BeginAction( typeof( RejuvinationAddonComponent ) ) )
{
from.FixedEffect( 0x373A, 1, 16 );
int random = Utility.Random( 1, 4 );
if ( random == 1 || random == 4 )
{
from.Hits = from.HitsMax;
SendLocalizedMessageTo( from, 500801 ); // A sense of warmth fills your body!
}
if ( random == 2 || random == 4 )
{
from.Mana = from.ManaMax;
SendLocalizedMessageTo( from, 500802 ); // A feeling of power surges through your veins!
}
if ( random == 3 || random == 4 )
{
from.Stam = from.StamMax;
SendLocalizedMessageTo( from, 500803 ); // You feel as though you've slept for days!
}
Timer.DelayCall( TimeSpan.FromHours( 2.0 ), new TimerStateCallback( ReleaseUseLock_Callback ), new object[]{ from, random } );
}
}
示例2: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if( !IsChildOf( from.Backpack ) )
from.SendLocalizedMessage( 1042001 );
else if( this.UsesRemaining < 1 )
{
from.SendMessage( "There is no more use for this item." );
this.Delete();
}
else if( from.BeginAction( typeof( DaemonBait ) ) )
{
new InternalTimer( from ).Start();
SpawnDaemon( from );
Effects.SendLocationEffect( new Point3D( from.X, from.Y, from.Z + 1 ), from.Map, 0x37B9, 13 );
Effects.SendLocationEffect( new Point3D( from.X, from.Y, from.Z ), from.Map, 0x37C3, 13 );
this.UsesRemaining -= 1;
if( this.UsesRemaining <= 0 )
this.Delete();
}
else
from.SendMessage( "You must wait before another daemon is ready to be called forth." );
}
示例3: Drink
public override void Drink( Mobile from )
{
if ( from.Hits < from.HitsMax )
{
if ( from.Poisoned || MortalStrike.IsWounded( from ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x22, 1005000 ); // You can not heal yourself in your current state.
}
else
{
if ( from.BeginAction( typeof( BaseHealPotion ) ) )
{
DoHeal( from );
PlayDrinkEffect( from );
this.Consume();
Timer.DelayCall( TimeSpan.FromSeconds( Delay ), new TimerStateCallback( ReleaseHealLock ), from );
}
else
{
from.LocalOverheadMessage( MessageType.Regular, 0x22, 500235 ); // You must wait 10 seconds before using another healing potion.
}
}
}
else
{
from.SendLocalizedMessage( 1049547 ); // You decide against drinking this potion, as you are already at full health.
}
}
示例4: OnUse
public static TimeSpan OnUse( Mobile m )
{
m.BeginAction( typeof( Engines.Imbuing.Imbuing ) );
m.SendGump( new Engines.Imbuing.ImbuingMainGump() );
return TimeSpan.FromSeconds( 1.0 );
}
示例5: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if ( !from.InRange( this.GetWorldLocation(), 1 ) )
{
from.SendLocalizedMessage( 502138 ); // That is too far away for you to use
return;
}
else if ( from != m_Caster )
{
// from.SendLocalizedMessage( ); //
return;
}
BaseWeapon weapon = from.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;
if ( weapon == null )
weapon = from.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;
if ( weapon != null )
{
from.SendLocalizedMessage( 1080116 ); // You must have a free hand to use a Healing Stone.
}
else if ( from.BeginAction( typeof( BaseHealPotion ) ) )
{
from.Heal( Utility.RandomMinMax( BasePotion.Scale( from, 13 ) , BasePotion.Scale( from, 16 ) ) );
this.Consume();
Timer.DelayCall( TimeSpan.FromSeconds( 8.0 ), new TimerStateCallback( ReleaseHealLock ), from );
}
else
from.SendLocalizedMessage( 1095172 ); // You must wait a few seconds before using another Healing Stone.
}
示例6: Drink
public override bool Drink( Mobile from )
{
if ( from.Mana < from.ManaMax )
{
if ( from.BeginAction( typeof( BaseManaRefreshPotion ) ) )
{
from.Mana += Scale( from, (int)(Refresh * from.ManaMax) );
BasePotion.PlayDrinkEffect( from );
Delete();
Timer.DelayCall<Mobile>( TimeSpan.FromSeconds( 20.0 ), new TimerStateCallback<Mobile>( ReleaseManaLock ), from );
return true;
}
else
from.LocalOverheadMessage( MessageType.Regular, 0x22, false, "You must wait 20 seconds before using another mana refresh potion." );
}
else
from.SendMessage( "You decide against drinking this potion, as you already have full mana." );
return false;
}
示例7: Drink
public override void Drink( Mobile from )
{
if ( from.BeginAction( typeof( BaseMaskOfDeathPotion ) ) )
{
if ( !UnderEffect( from ) )
{
Timer t = (Timer)m_Table[from];
if ( t != null )
t.Stop();
m_Table[from] = t = Timer.DelayCall( Duration, new TimerStateCallback( Expire_Callback ), from );
//Effects.SendPacket( from, from.Map, new GraphicalEffect( EffectType.FixedFrom, from.Serial, Serial.Zero, 0x375A, from.Location, from.Location, 10, 15, true, false ) );//Default
from.FixedParticles( 0x3779, 10, 15, 5002, EffectLayer.Head );
from.FixedParticles( 0x376A, 9, 32, 5008, EffectLayer.Waist );
from.FixedParticles( 0x3778, 10, 30, 5010, EffectLayer.Head );
from.SendLocalizedMessage( 503326 ); // You are now ignored by monsters.
Delete();
}
Timer.DelayCall( TimeSpan.FromMinutes( Delay ),new TimerStateCallback( Release ), from );
}
else
{
from.SendMessage("You must wait 30 minutes to use this potion" );
}
}
示例8: Drink
public override void Drink( Mobile from )
{
if ( from.BeginAction( typeof( LightCycle ) ) )
{
new LightCycle.NightSightTimer( from ).Start();
if( Server.Utilities.StartupSettings.LightingChanged )
from.LightLevel = 15;
else if( from.Map != Map.Trammel )
from.LightLevel = LightCycle.DungeonLevel / 2;
else
from.LightLevel = 6;
from.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist );
from.PlaySound( 0x1E3 );
BasePotion.PlayDrinkEffect( from );
this.Consume();
}
else
{
from.SendMessage( "You already have nightsight." );
}
}
示例9: Drink
public override void Drink( Mobile from )
{
if (from.Mana < from.ManaMax)
{
if (MortalStrike.IsWounded(from)) // if (from.Poisoned || MortalStrike.IsWounded(from))
{
from.LocalOverheadMessage(MessageType.Regular, 0x22, 1005000); // You can not heal yourself in your current state.
}
else
{
if (from.BeginAction(typeof(BaseHealPotion)))
{
DoMana(from);
BasePotion.PlayDrinkEffect(from);
this.Consume(); // this.Consume();
Timer.DelayCall(TimeSpan.FromSeconds(Delay), new TimerStateCallback(ReleaseManaLock), from);
}
else
{
from.SendMessage(0x22, "Voce nao pode usar outra potion em tao pouco tempo");
//from.LocalOverheadMessage(MessageType.Regular, 0x22, 500235); // You must wait 10 seconds before using another healing potion.
}
}
}
else
{
from.SendMessage(0x22, "Voce decide nao usar a potion, pois esta com Mana cheia");
//from.SendLocalizedMessage( 1049547 ); // You decide against drinking this potion, as you are already at full health.
}
}
示例10: Drink
public override bool Drink( Mobile from )
{
if ( from.RawStr > 10 )
{
if ( from.BeginAction( typeof( BaseCripplePotion ) ) )
{
DoStatLoss( from );
BasePotion.PlayDrinkEffect( from );
this.Consume();
new DelayTimer( from ).Start();
return true;
}
else
from.LocalOverheadMessage( MessageType.Regular, 0x22, true, "You must wait for your body to adjust to the potion." );
}
else
{
from.SendMessage( "You decide against drinking this potion, as you are already fairly crippled." );
}
return false;
}
示例11: Drink
public override void Drink( Mobile from )
{
if ( from.Mana < from.ManaMax )
{
if ( from.Poisoned || MortalStrike.IsWounded( from ) )
{
from.SendMessage( "You cannot use this in your current state." );
}
else
{
if ( from.BeginAction( typeof( BaseManaPotion ) ) )
{
DoMana( from );
BasePotion.PlayDrinkEffect( from );
this.Consume();
Timer.DelayCall( TimeSpan.FromSeconds( Delay ), new TimerStateCallback( ReleaseManaLock ), from );
}
else
{
from.SendMessage( "You must wait to use another mana potion." );
}
}
}
else
{
from.SendMessage( "You are already at full mana." );
}
}
示例12: Use
public override bool Use( Mobile from ) {
if ( from.BeginAction( typeof( ClarityPotion ) ) ) {
int amount = Utility.Dice( 3, 3, 3 );
int time = Utility.RandomMinMax( 5, 30 );
from.PlaySound( 0x2D6 );
if ( from.Body.IsHuman ) {
from.Animate( 34, 5, 1, true, false, 0 );
}
from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head );
from.PlaySound( 0x1EB );
StatMod mod = from.GetStatMod( "Concussion" );
if ( mod != null ) {
from.RemoveStatMod( "Concussion" );
from.Mana -= mod.Offset;
}
from.PlaySound( 0x1EE );
from.AddStatMod( new StatMod( StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes( time ) ) );
Timer.DelayCall( TimeSpan.FromMinutes( time ), delegate() {
from.EndAction( typeof( ClarityPotion ) );
} );
return true;
}
return false;
}
示例13: OnTarget
protected override void OnTarget( Mobile from, object o )
{
IPoint3D ip = o as IPoint3D;
if ( ip != null )
{
if ( ip is Item )
ip = ((Item)ip).GetWorldTop();
Point3D p = new Point3D( ip );
Region reg = Region.Find( new Point3D( p ), from.Map );
if ( from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing( from, p ) )
m_Deed.OnPlacement( from, p );
else if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) )
from.SendLocalizedMessage( 501270 ); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
else if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( HouseRegion ) ) )
from.SendLocalizedMessage( 1043287 ); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
else
from.SendLocalizedMessage( 501265 ); // Housing can not be created in this area.
if (HouseSystemController._MaxPlaceDelay > 0)
{
from.BeginAction(typeof(HouseDeed));
Timer.DelayCall<Mobile>(TimeSpan.FromSeconds(Utility.RandomMinMax(HouseSystemController._MinPlaceDelay, HouseSystemController._MaxPlaceDelay)), new TimerStateCallback<Mobile>(ReleasePlacementLock), from);
}
from.RevealingAction();
}
}
示例14: Drink
public override void Drink(Mobile from)
{
if (from.Hits < from.HitsMax)
{
if (from.Poisoned || MortalStrike.IsWounded(from))
{
from.LocalOverheadMessage(MessageType.Regular, 0x22, 1005000); // You can not heal yourself in your current state.
}
else
{
if (from.BeginAction(typeof(BaseHealPotion)))
{
//Plume : Addiction
if (from is PlayerMobile)
{
PlayerMobile drinker = from as PlayerMobile;
double Addiction = drinker.CalculateHealAddiction(this);
if(Addiction > 100)
{
drinker.SendMessage("Votre corps ne supporte plus ce traitement");
drinker.Poison = Poison.Lesser;
}
else
{
double HealScalar = Addiction/100 * 0.95;
DoHeal(from, HealScalar);
}
drinker.IncAddiction(this);
}
else
DoHeal(from);
BasePotion.PlayDrinkEffect(from);
if (!Engines.ConPVP.DuelContext.IsFreeConsume(from))
this.Consume();
Timer.DelayCall(TimeSpan.FromSeconds(Delay), new TimerStateCallback(ReleaseHealLock), from);
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x22, 500235); // You must wait 10 seconds before using another healing potion.
}
}
}
else
{
from.SendLocalizedMessage(1049547); // You decide against drinking this potion, as you are already at full health.
}
}
示例15: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if ( from.CanBeginAction( this ) )
{
from.BeginAction( this );
Timer.DelayCall<Mobile>( m_ShoutCooldown, EndLock, from );
}
MLQuestSystem.TurnToFace( this, from );
from.SendGump( m_Gump );
// Paperdoll doesn't open
//base.OnDoubleClick( from );
}