本文整理汇总了C#中Mobile.BeginAction方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.BeginAction方法的具体用法?C# Mobile.BeginAction怎么用?C# Mobile.BeginAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类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: OnUse
public static TimeSpan OnUse( Mobile m )
{
bool releaseLock = false;
if (m.BeginAction(typeof(IAction)))
{
releaseLock = true;
if (m.Skills[SkillName.Lockpicking].Value < 50)
m.SendLocalizedMessage(502366); // You do not know enough about locks. Become better at picking locks.
else if (m.Skills[SkillName.DetectHidden].Value < 50)
m.SendLocalizedMessage(502367); // You are not perceptive enough. Become better at detect hidden.
else
{
m.Target = new InternalTarget();
m.SendLocalizedMessage(502368); // Wich trap will you attempt to disarm?
}
}
else
m.SendAsciiMessage("You must wait to perform another action.");
if (releaseLock && m is PlayerMobile)
((PlayerMobile)m).EndPlayerAction();
return TimeSpan.Zero;
}
示例3: Carve
public void Carve(Mobile from, Item item)
{
if (from.BeginAction(typeof(IAction)))
{
bool releaseLock;
if (Summoned)
{
from.SendAsciiMessage("You cannot sheer summoned sheep.");
return;
}
if (Utility.Random(1000) <= 2)
AntiMacro.AntiMacroGump.SendGumpThreaded((PlayerMobile)from);
if (DateTime.Now < m_NextWoolTime)
{
//This sheep is not yet ready to be shorn.
PrivateOverheadMessage(MessageType.Regular, 0x3b2, 500449, from.NetState);
releaseLock = true;
return;
}
from.SendAsciiMessage("You begin sheering the sheep...");
new InternalTimer(from, this).Start();
releaseLock = false;
if (releaseLock && from is PlayerMobile)
((PlayerMobile)from).EndPlayerAction();
}
else
from.SendAsciiMessage("You must wait to perform another action.");
}
示例4: Polymorph
public void Polymorph( Mobile m )
{
if ( !m.CanBeginAction( typeof( PolymorphSpell ) ) || !m.CanBeginAction( typeof( IncognitoSpell ) ) || m.IsBodyMod )
return;
IMount mount = m.Mount;
if ( mount != null )
mount.Rider = null;
if ( m.Mounted )
return;
if ( m.BeginAction( typeof( PolymorphSpell ) ) )
{
Item disarm = m.FindItemOnLayer( Layer.OneHanded );
if ( disarm != null && disarm.Movable )
m.AddToBackpack( disarm );
disarm = m.FindItemOnLayer( Layer.TwoHanded );
if ( disarm != null && disarm.Movable )
m.AddToBackpack( disarm );
m.BodyMod = 39;
m.HueMod = 0;
new ExpirePolymorphTimer( m ).Start();
}
}
示例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 != this.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: Target
public void Target( Mobile tinker, Mobile assembly )
{
if ( Deleted || !tinker.CanSee( this ) )
return;
int number = -1;
if ( !tinker.CanSee( assembly ) )
{
number = 500237; // Target can not be seen.
}
else if ( assembly.Hits == assembly.HitsMax )
{
number = 1044281; // That being is not damaged!
}
else
{
if ( !tinker.BeginAction( typeof( AssemblyRepairKit ) ) )
{
number = 500310;// You are busy with something else
}
else
{
TimeSpan duration = TimeSpan.FromSeconds( 8 );
InternalTimer t = new InternalTimer( this, tinker, assembly, duration );
t.Start();
tinker.SendMessage( "You begin to repair the assembly" );
return;
}
}
tinker.SendLocalizedMessage( number );
}
示例7: 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 );
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.
}
}
示例8: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if (from.BeginAction(typeof(IAction)))
{
from.SendLocalizedMessage(502068); // What do you want to pick?
from.Target = new InternalTarget(this);
}
else
from.SendAsciiMessage("You must wait to perform another action.");
}
示例9: OnUse
public static TimeSpan OnUse( Mobile m )
{
if (m.BeginAction(typeof(IAction)))
{
m.RevealingAction();
BaseInstrument.PickInstrument(m, OnPickedInstrument);
}
else
m.SendAsciiMessage("You must wait to perform another action.");
return TimeSpan.FromSeconds( 1.0 ); // Cannot use another skill for 1 second
}
示例10: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
if (from.BeginAction(typeof(IAction)))
{
from.SendLocalizedMessage(502464); // Target the animal you wish to herd.
from.Target = new HerdingTarget(from);
base.OnDoubleClick(from);
}
else
from.SendAsciiMessage("You must wait to perform another action.");
}
示例11: OnBeforeSwing
public override bool OnBeforeSwing(Mobile attacker, Mobile defender)
{
bool valid = this.Validate(attacker) && this.CheckMana(attacker, true);
if (valid)
{
attacker.BeginAction(typeof(Stealth));
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction(typeof(Stealth)); });
}
return valid;
}
示例12: OnUse
public static TimeSpan OnUse( Mobile m )
{
if (m.BeginAction(typeof(IAction)))
{
m.Target = new InternalTargetPoison();
m.SendLocalizedMessage(502137); // Select the poison you wish to use
}
else
m.SendAsciiMessage("You must wait to perform another action.");
return TimeSpan.FromSeconds( 10.0 ); // 10 second delay before beign able to re-use a skill
}
示例13: OnUse
public static TimeSpan OnUse(Mobile m)
{
if (m.BeginAction(typeof(IAction)))
{
new InternalTimer(m).Start();
m.RevealingAction();
}
else
m.SendAsciiMessage("You must wait to perform another action.");
return TimeSpan.Zero;
}
示例14: OnBeforeSwing
public override bool OnBeforeSwing( Mobile attacker, Mobile defender )
{
bool valid = Validate( attacker ) && CheckMana( attacker, true );
if ( valid )
{
attacker.BeginAction( typeof( Stealth ) );
Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( Expire_Callback ), attacker );
}
return valid;
}
示例15: OnUse
public static TimeSpan OnUse(Mobile m)
{
if (m.BeginAction((typeof (IAction))))
{
m.Target = new InternalTarget();
m.SendLocalizedMessage(502807); // What would you like to taste?
}
else
m.SendAsciiMessage("You must wait to perform another action.");
return TimeSpan.Zero;
}