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. }
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; }
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 ); }
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 } ); } }
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(); } }
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."); }
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. } }
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."); }
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."); }
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; }
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 }
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; }
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 }
public static TimeSpan OnUse( Mobile from ) { if (from.BeginAction(typeof(IAction))) { from.SendLocalizedMessage(500343); // What do you wish to appraise and identify? from.Target = new InternalTarget(); } else from.SendAsciiMessage("You must wait to perform another action."); return TimeSpan.Zero; }
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; }
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; }
public static TimeSpan OnUse( Mobile m ) { if (m.BeginAction(typeof(IAction))) { m.Target = new ForensicTarget(); m.RevealingAction(); m.SendLocalizedMessage(500906); // What would you like to evaluate? } else m.SendAsciiMessage("You must wait to perform another action."); return TimeSpan.FromSeconds(0.0); }
public static TimeSpan OnUse(Mobile m) { if (m.BeginAction(typeof(IAction))) { m.RevealingAction(); m.Target = new InternalTarget(); m.SendLocalizedMessage(500906); // What do you wish to evaluate? } else m.SendAsciiMessage("You must wait to perform another action."); return TimeSpan.Zero; }
public static TimeSpan OnUse(Mobile m) { if (m.BeginAction(typeof(IAction))) { m.RevealingAction(); m.Target = new InternalTarget(); m.SendLocalizedMessage(502789); // Tame which animal? } else m.SendAsciiMessage("You must wait to perform another action."); return TimeSpan.Zero; }
public static TimeSpan OnUse(Mobile m) { if (m.BeginAction(typeof(IAction))) { m.RevealingAction(); m.SendAsciiMessage("What would you like to evaluate?"); m.Target = new InternalTarget(); } else m.SendAsciiMessage("You must wait to perform another action."); return TimeSpan.Zero; }
public override void OnDoubleClick( Mobile from ) { if (from.BeginAction(typeof(IAction))) { bool releaseLock = true; if (from.InRange(GetWorldLocation(), 2) && from.InLOS(this)) { if ( !VerifyMove( from ) ) return; Point3D fireLocation = GetFireLocation( from ); if ( fireLocation == Point3D.Zero ) { from.SendLocalizedMessage( 501695 ); // There is not a spot nearby to place your campfire. return; } else { new InternalTimer(from).Start(); releaseLock = false; if (!from.CheckSkill(SkillName.Camping, 0.0, 100.0)) { from.SendLocalizedMessage(501696); // You fail to ignite the campfire. } else { Consume(); if (!Deleted && Parent == null) from.PlaceInBackpack(this); new Campfire().MoveToWorld(fireLocation, from.Map); } } } else from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. if (releaseLock && from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } } else from.SendAsciiMessage("You must wait to perform another action."); }
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 ); }
public static TimeSpan OnUse(Mobile m) { bool releaseLock = true; if (m.BeginAction(typeof(IAction))) { int range = Math.Min((int)((100 - m.Skills[SkillName.Meditation].Value) / 2) + 8, 18); bool badCombat = (m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m)); foreach (Mobile check in m.GetMobilesInRange(range)) { if (check.InLOS(m) && check.Combatant == m) { badCombat = true; break; } } if (m.Mana >= m.ManaMax) m.SendLocalizedMessage(501846); // You are at peace. else if (badCombat || m.Warmode || (m is PlayerMobile && (((PlayerMobile)m).LastAttackTime + TimeSpan.FromSeconds(5.0)) >= DateTime.Now)) m.SendAsciiMessage("You are preoccupied with thoughts of battle."); else { new InternalTimer(m).Start(); m.RevealingAction(); m.SendAsciiMessage("You begin meditating..."); //m.SendLocalizedMessage(501851); // You enter a meditative trance. releaseLock = false; if (m.Player) m.PlaySound(0xF9); } } else { m.SendAsciiMessage("You must wait to perform another action."); releaseLock = false; } if (m is PlayerMobile && releaseLock) ((PlayerMobile)m).EndPlayerAction(); return TimeSpan.Zero; }
public virtual bool Apply( Mobile from ) { if (!from.CanBeginAction( typeof( BaseMega ) ) ) { from.SendLocalizedMessage( 502173 ); // You are already under a similar effect. return false; } bool applied = Spells.SpellHelper.AddStatOffset( from, Type, Bonus, TimeSpan.FromSeconds( 30 ) ); if ( applied ) from.BeginAction( typeof( BaseMega ) ); return true; }
public static void Container_Snoop( Container cont, Mobile from ) { if (from.BeginAction(typeof(IAction))) { bool releaseLock = true; bool canSnoop = true; if (from.AccessLevel > AccessLevel.Player || from.InRange(cont.GetWorldLocation(), 1)) { Mobile root = cont.RootParent as Mobile; if (root != null && !root.Alive) canSnoop = false; else if (root != null && root.AccessLevel > AccessLevel.Player && from.AccessLevel == AccessLevel.Player) { from.SendLocalizedMessage(500209); // You can not peek into the container. canSnoop = false; } else if (root != null && from.AccessLevel == AccessLevel.Player && !CheckSnoopAllowed(from, root)) { from.SendLocalizedMessage(1001018); // You cannot perform negative acts on your target. canSnoop = false; } if (canSnoop) { if (from.AccessLevel > AccessLevel.Player) cont.DisplayTo(from); else { new InternalTimer(from, cont).Start(); releaseLock = false; } } } else from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. if (releaseLock && from is PlayerMobile) ((PlayerMobile)from).EndPlayerAction(); } else from.SendAsciiMessage("You must wait to perform another action."); }
public override void OnDoubleClick( Mobile from ) { if ( !Movable ) return; if (from.BeginAction(typeof(IAction))) { bool releaseLock = true; from.SendAsciiMessage("What do you want to cook this on?"); from.Target = new InternalTarget(this); if (releaseLock && from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } } else from.SendAsciiMessage("You must wait to perform another action."); }
public override void OnDoubleClick( Mobile from ) { if ( !IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. } else { if ( from.BeginAction( typeof( MBoomerang ) ) ) { InternalTarget t = new InternalTarget( this ); from.Target = t; } else { from.SendMessage( "You cant use this now." ); } } }
public override void Drink( Mobile from ) { if ( from.BeginAction( typeof( LightCycle ) ) ) { new LightCycle.NightSightTimer( from ).Start(); from.LightLevel = LightCycle.DungeonLevel / 2; from.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist ); from.PlaySound( 0x1E3 ); BasePotion.PlayDrinkEffect( from ); Consume(); } else { from.SendMessage( "You already have nightsight." ); } }
public bool Gate(Mobile m) { if (m == null || m.Deleted) { return(false); } if (_Location.Internal || _Location.Zero) { m.SendMessage("That rune is blank."); return(false); } if (m.Player) { var t = GetType(); if (m.AccessLevel < AccessLevel.Counselor && !m.BeginAction(t)) { m.SendMessage("You must wait before using the rune codex again."); return(false); } GateTravelSpell spell = new GateTravelSpell( m, null, new RunebookEntry(_Location.Location, _Location.Map, _Description, null)); if (!spell.Cast()) { m.EndAction(t); return(false); } Timer.DelayCall(TimeSpan.FromSeconds(3), () => m.EndAction(t)); } else { _Location.MoveToWorld(m); } return(true); }
public override void Drink( Mobile from ) { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } if (from.BeginAction(typeof(BaseExplosionPotion))) { from.EndAction(typeof(BaseExplosionPotion)); //Timer should start when targeting ThrowTarget targ = from.Target as ThrowTarget; Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ != null && targ.Potion == this) return; from.RevealingAction(); if (m_Users == null) m_Users = new ArrayList(); if (!m_Users.Contains(from)) m_Users.Add(from); from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! //if (Core.ML) // m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5, new TimerStateCallback(Detonate_OnTick), new object[] {from, 3}); // 3.6 seconds explosion delay //else m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] {from, 3}); // 2.6 seconds explosion delay } } else from.SendAsciiMessage("You can't use another explosion potion yet!"); }
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 = 42; m.HueMod = 0; new ExpirePolymorphTimer(m).Start(); } }
protected override void OnTarget(Mobile from, object target) { if (target == from) { from.SendLocalizedMessage(1005576); // You can't throw this at yourself. } else if (target is Mobile) { Mobile targ = (Mobile)target; Container pack = targ.Backpack; if (pack != null && pack.FindItemByType(new Type[] { typeof(SnowPile), typeof(PileOfGlacialSnow) }) != null) { if (from.BeginAction(typeof(SnowPile))) { new InternalTimer(from).Start(); from.PlaySound(0x145); from.Animate(9, 1, 1, true, false, 0); targ.SendLocalizedMessage(1010572); // You have just been hit by a snowball! from.SendLocalizedMessage(1010573); // You throw the snowball and hit the target! Effects.SendMovingEffect(from, targ, 0x36E4, 7, 0, false, true, 0x47F, 0); } else { from.SendLocalizedMessage(1005574); // The snow is not ready to be packed yet. Keep trying. } } else { from.SendLocalizedMessage(1005577); // You can only throw a snowball at something that can throw one back. } } else { from.SendLocalizedMessage(1005577); // You can only throw a snowball at something that can throw one back. } }
public override void OnComponentUsed(AddonComponent c, Mobile from) { base.OnComponentUsed(c, from); if (!from.Alive) { return; } if (!from.CanBeginAction(typeof(StreamerFountainAddon))) { from.SendMessage("You must wait a few moments before attempting to use that again."); return; } from.BeginAction(typeof(StreamerFountainAddon)); Timer.DelayCall(TimeSpan.FromSeconds(1), delegate { if (from != null) { from.EndAction(typeof(StreamerFountainAddon)); } }); for (int a = 0; a < 3; a++) { TimedStatic water = new TimedStatic(Utility.RandomList(4650, 4651, 4653, 4654, 4655), 5); water.Name = "water"; water.Hue = 2580; Point3D waterLocation = new Point3D(c.X + Utility.RandomList(-1, 1), c.Y + Utility.RandomList(-1, 1), c.Z); SpellHelper.AdjustField(ref waterLocation, Map, 12, false); waterLocation.Z++; water.MoveToWorld(waterLocation, Map); } Effects.PlaySound(c.Location, c.Map, Utility.RandomList(0x027, 0x026, 0x025)); }
public override void OnDoubleClick(Mobile from) { //TODO: Checks if (Parent != from) { from.SendMessage("You must equip the item to use it"); } else if (!from.CanBeginAction(typeof(GoopyGauntlets))) { from.SendMessage("You have to wait a few moments before you can shoot more goop!"); // You have to wait a few moments before you can use another bola! } else if (!HasFreeHands(from)) { from.SendLocalizedMessage(1040015); // Your hands must be free to use this } else if (from.BeginAction(typeof(GoopyGauntlets))) { Timer.DelayCall(TimeSpan.FromSeconds(3.0), new TimerStateCallback(ReleaseGoopLock), from); from.Target = new InternalTarget(); } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042010); //You must have the object in your backpack to use it. return; } else { if (from.BeginAction(typeof(PumpkinheadSummoner))) { from.Target = new PumpkinheadTarget(from, this); new InternalTimer(from).Start(); } else { from.SendMessage("You cannot summon Pumpkinhead yet"); } } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Item.Deleted) { return; } if (CookableFood.IsHeatSource(targeted)) { if (from.BeginAction(typeof(CookableFood))) { from.PlaySound(0x225); m_Item.Consume(); InternalTimer t = new InternalTimer(from, targeted as IPoint3D, from.Map, m_Item); t.Start(); } else { from.SendLocalizedMessage(500119); } } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042010); //You must have the object in your backpack to use it. return; } else { if (from.BeginAction(typeof(Snowpile))) { from.Target = new SnowTarget(from); from.SendLocalizedMessage(1005575); // You carefully pack the snow into a ball... } else { from.SendLocalizedMessage(1005574); } } }
public override void OnDoubleClick(Mobile from) { if (!from.InRange(GetWorldLocation(), 1)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); } else if (!from.CanBeginAction(typeof(AppleBobbinBarrel))) { from.SendMessage("You already have your head under the water"); } else { from.BeginAction(typeof(AppleBobbinBarrel)); Timer.DelayCall(TimeSpan.FromSeconds(6.0), new TimerStateCallback(EndBobbing), from); from.SendMessage("You dunk your head in the water trying frantically to sink your teeth into an apple!"); from.CantWalk = true; from.Direction = from.GetDirectionTo(this); from.Animate(32, 5, 1, true, true, 0); from.PlaySound(37); } }
/* * protected override void OnTargetCancel( Mobile from, TargetCancelType cancelType ) * { * ReleaseIceLock( from ); * base.OnTargetCancel( from, cancelType ); * } */ protected override void OnTarget(Mobile from, object targeted) { bool success = false; if (m_Staff != null && !m_Staff.Deleted && m_Staff.UsesRemaining > 0 && from == m_Staff.Parent && targeted is Mobile) { Mobile to = (Mobile)targeted; m_To = to; m_From = from; if (!from.CanSee(to) || !from.InLOS(to)) { from.SendLocalizedMessage(500237); } else if (from.HarmfulCheck(to)) { switch (m_Staff.CurrentSpell) { case GlacialSpells.Freeze: success = DoFreeze(from, to); break; case GlacialSpells.IceStrike: success = DoIceStrike(from, to); break; case GlacialSpells.IceBall: success = DoIceBall(from, to); break; } if (success) { from.BeginAction(typeof(GlacialStaff)); Timer.DelayCall(TimeSpan.FromSeconds(7.0), new TimerCallback(ReleaseIceLock)); Timer.DelayCall <int>(TimeSpan.FromSeconds(1.5), new TimerStateCallback <int>(ReleaseHueMod), m_Staff.Hue); m_Staff.Hue = 1266; --m_Staff.UsesRemaining; if (m_Staff.UsesRemaining <= 0) { m_Staff.Delete(); //No message on OSI? } return; } } } }
public override void Drink(Mobile from) { PlayerMobile pm = from as PlayerMobile; if (from.Mana < from.ManaMax) { if (pm.Level >= RequiredLevel) { 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); 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.SendMessage("Your level isn't high enough to use this potion."); } } else { from.SendLocalizedMessage(1049547); // You decide against drinking this potion, as you are already at full health. } }
public override bool DoEffect(Mobile from, Mobile target) { if (target.BeginAction(typeof(LightCycle))) { new LightCycle.NightSightTimer(target).Start(); int level = (int)Math.Abs(LightCycle.DungeonLevel * (0.5 + Utility.RandomDouble() * 0.5)); if (level > 25 || level < 0) { level = 25; } target.LightLevel = level; target.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist); target.PlaySound(0x1E3); return(true); } return(false); }
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."); } }
public override void OnMovement(Mobile m, Point3D oldLocation) { base.OnMovement(m, oldLocation); var tourney = Tournament?.Tournament; if (InRange(m, 4) && !InRange(oldLocation, 4) && tourney != null && tourney.Stage == TournamentStage.Signup && m.CanBeginAction(this)) { var ladder = Ladder.Instance; var entry = ladder?.Find(m); if (entry != null && Ladder.GetLevel(entry.Experience) < tourney.LevelRequirement) { return; } if (tourney.IsFactionRestricted && Faction.Find(m) == null) { return; } if (tourney.HasParticipant(m)) { return; } PrivateOverheadMessage( MessageType.Regular, 0x35, false, $"Hello m'{(m.Female ? "Lady" : "Lord")}. Dost thou wish to enter this tournament? You need only to write your name in this book.", m.NetState ); m.BeginAction(this); Timer.DelayCall(TimeSpan.FromSeconds(10.0), ReleaseLock_Callback, m); } }
public void Target(Mobile m) { if (!Caster.CanSee(m)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (m.Blessed) { Caster.SendMessage("Vous ne pouvez pas cibler une créature invulnérable !"); } else if (CheckSequence()) { SpellHelper.Turn(Caster, m); if (m != Caster && m.BeginAction(typeof(ChampDeStaseSpell)) && m.AccessLevel <= Caster.AccessLevel) { double dur = durationMax * Spell.GetSpellScaling(Caster, Info.skillForCasting); TimeSpan duration = TimeSpan.FromSeconds(dur); m.Freeze(duration); m.Hidden = true; m.Blessed = true; Timer t = new InternalTimer(m, duration); m_Timers[m] = t; t.Start(); } else { Caster.SendMessage("Vous ne pouvez pas vous cibler vous-même !"); } } FinishSequence(); }
public void Target(Mobile m) { if (!m.CanSee(m) || m.Hidden) { m.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckBSequence(m)) { SpellHelper.Turn(Caster, m); int val = (int)(m.Skills[SkillName.Magery].Value / 10.0 + 1); if (m.BeginAction(typeof(ProtectionSpell))) { Caster.DoBeneficial(m); m.VirtualArmorMod += val; new InternalTimer(m, Caster, val).Start(); bool enhancedSpellcast = SpellHelper.IsEnhancedSpell(Caster, m, EnhancedSpellbookType.Wizard, false, true); int spellHue = Enhancements.GetMobileSpellHue(Caster, Enhancements.SpellType.Protection); if (enhancedSpellcast) { m.FixedParticles(0x375A, 9, 40, 5027, spellHue, 0, EffectLayer.Waist); m.PlaySound(0x1F7); } else { m.FixedParticles(0x375A, 9, 20, 5027, spellHue, 0, EffectLayer.Waist); m.PlaySound(0x1F7); } } } FinishSequence(); }
public override void Drink(Mobile from) { if (from.BeginAction(typeof(LightCycle))) { m_Time = IntensifiedTime ? 45 : 20; //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; drinker.Hunger = 0; } m_Time -= drinker.CalculateNightSightAddiction(this); } new LightCycle.PotionNightSightTimer(from, this).Start(); from.LightLevel = LightCycle.DungeonLevel / 2; from.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist); from.PlaySound(0x1E3); BasePotion.PlayDrinkEffect(from); if (!Engines.ConPVP.DuelContext.IsFreeConsume(from)) { this.Consume(); } } else { from.SendMessage("You already have nightsight."); } }
public void Target(Mobile targ) { SpellHelper.Turn(Caster, targ); targ.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist); targ.PlaySound(0x1E3); if (targ.BeginAction(typeof(LightCycle))) { new LightCycle.NightSightTimer(targ).Start(); int level = (int)(LightCycle.DungeonLevel * targ.Skills[SkillName.Magery].Value); if (level < 0) { level = 0; } targ.LightLevel = level; BuffInfo.AddBuff(targ, new BuffInfo(BuffIcon.NightSight, 1075643)); //Night Sight/You ignore lighting effects } }
public override void OnDoubleClick(Mobile from) { if (!Movable) { return; } if (from.BeginAction(typeof(IAction))) { bool releaseLock = true; from.Target = new InternalTarget(this); if (releaseLock && from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } } else { from.SendAsciiMessage("You must wait to perform another action."); } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (info.ButtonID == 2) { VendorSearchQueryGump.StartSearch(from, m_Criteria, m_Page + 1); return; } int index = info.ButtonID - 100; if (!from.BeginAction(typeof(ShopMap))) { from.SendLocalizedMessage(500119); // You must wait to perform another action return; } Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => from.EndAction(typeof(ShopMap))); if (index >= 0 && index < m_Items.Length) { IVendorSearchItem item = m_Items[index]; var mapItem = new ShopMap(item.Vendor, item.Container); if (from.AddToBackpack(mapItem)) { from.SendLocalizedMessage(1154690); // The vendor map has been placed in your backpack. } else { from.SendLocalizedMessage(502385); // Your pack cannot hold this item. mapItem.Delete(); } from.SendGump(new VendorSearchResultsGump(m_Items, m_Criteria, m_Page)); } }
public override void OnHit( Mobile attacker, Mobile defender, int damage ) { if ( !Validate( attacker ) ) return; if ( attacker.Mounted && !(defender.Weapon is Lance) ) // TODO: Should there be a message here? return; ClearCurrentAbility( attacker ); IMount mount = defender.Mount; if ( mount == null ) { attacker.SendLocalizedMessage( 1060848 ); // This attack only works on mounted targets return; } if ( !CheckMana( attacker, true ) ) return; attacker.SendLocalizedMessage( 1060082 ); // The force of your attack has dislodged them from their mount! if ( attacker.Mounted ) defender.SendLocalizedMessage( 1062315 ); // You fall off your mount! else defender.SendLocalizedMessage( 1060083 ); // You fall off of your mount and take damage! defender.PlaySound( 0x140 ); defender.FixedParticles( 0x3728, 10, 15, 9955, EffectLayer.Waist ); mount.Rider = null; defender.BeginAction( typeof( BaseMount ) ); Timer.DelayCall( BlockMountDuration, new TimerStateCallback( ReleaseMountLock ), defender ); if ( !attacker.Mounted ) AOS.Damage( defender, attacker, Utility.RandomMinMax( 15, 25 ), 100, 0, 0, 0, 0 ); }
public override void Drink(Mobile from) { if (from.BeginAction(typeof(LightCycle))) { new LightCycle.NightSightTimer(from).Start(); from.LightLevel = LightCycle.DungeonLevel / 2; from.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist); from.PlaySound(0x1E3); BasePotion.PlayDrinkEffect(from); if (!Engines.ConPVP.DuelContext.IsFreeConsume(from)) { this.Consume(); } } else { from.SendMessage("You already have nightsight."); } }
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(); } }
protected override void OnTarget(Mobile from, object o) { from.EndAction(typeof(Imbuing)); if (!(o is Container)) { from.SendLocalizedMessage(1080425); // You cannot magically unravel this item. return; } Container cont = o as Container; if (!cont.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used. from.EndAction(typeof(Imbuing)); } else if (cont == null) { from.SendLocalizedMessage(1111814, "0\t0"); // Unraveled: ~1_COUNT~/~2_NUM~ items from.EndAction(typeof(Imbuing)); } else { bool unraveled = cont.Items.FirstOrDefault(x => Imbuing.CanUnravelItem(from, x, false)) != null; if (unraveled) { from.BeginAction(typeof(Imbuing)); from.SendGump(new UnravelContainerGump(cont)); } else { TryUnravelContainer(from, cont); from.EndAction(typeof(Imbuing)); } } }
protected override void OnTarget(Mobile from, object targ) { if (targ is IPoint2D) { Point2D p = new Point2D((IPoint2D)targ); if (!from.CheckSkill(SkillName.Musicianship, 0.0, 120.0)) { from.SendLocalizedMessage(502472); // You don't seem to be able to persuade that to move. m_Flute.PlayInstrumentBadly(from); } else if (!m_Snake.InRange(p, 10)) { from.SendLocalizedMessage(500643); // Target is too far away. } else { m_Snake.BeginCharm(from, p); from.SendLocalizedMessage(502479); // The animal walks where it was instructed to. from.BeginAction(typeof(SnakeCharmerFlute)); Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback( delegate { from.EndAction(typeof(SnakeCharmerFlute)); })); m_Flute.PlayInstrumentWell(from); m_Flute.UsesRemaining--; if (m_Flute.UsesRemaining == 0) { from.SendLocalizedMessage(1112177); // You broke your snake charmer flute. m_Flute.Delete(); } } } }
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); }
public virtual void BeginThrow(Mobile m, TEntity target) { if (m == null || m.Deleted || target == null) { return; } if (!CanThrow(m, true) || !CanThrowAt(m, target, true) || (m.AccessLevel < AccessLevel.GameMaster && !m.BeginAction(GetType()))) { return; } User = m; OnBeforeThrownAt(m, target); var effect = EffectID > 0 ? EffectID : ItemID; var hue = EffectHue > 0 ? EffectHue : Hue; new MovingEffectInfo(m, target, target.Map, effect, hue, EffectSpeed, EffectRender).MovingImpact( () => FinishThrow(m, target)); }
public override void Drink(Mobile from) { if (from.Hits < from.HitsMax) { if (from.Poisoned || MortalStrike.IsWounded(from)) { // You can not heal yourself in your current state. from.LocalOverheadMessage(MessageType.Regular, 0x22, 1005000); } else { if (from.BeginAction <BaseHealPotion>()) { DoHeal(from); PlayDrinkEffect(from); if (!DuelContext.IsFreeConsume(from)) { Consume(); } Timer.StartTimer(TimeSpan.FromSeconds(Delay), from.EndAction <BaseHealPotion>); } else { // You must wait 10 seconds before using another healing potion. from.LocalOverheadMessage(MessageType.Regular, 0x22, 500235); } } } else { // You decide against drinking this potion, as you are already at full health. from.SendLocalizedMessage(1049547); } }
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.Flying) { m.ToggleFlying(); } if (m.Mounted) { return; } if (m.BeginAction(typeof(PolymorphSpell))) { m.BodyMod = 42; m.HueMod = 0; if (m == this) { m_SlayerVulnerabilities.Add("Vermin"); m_SlayerVulnerabilities.Add("Repond"); } new ExpirePolymorphTimer(m).Start(); } }
public override bool OnMoveOver(Mobile m) { if (Active) { if (!Creatures && !m.Player) { return(true); } Skill sk = m.Skills[m_Skill]; if (sk == null || sk.Base < m_Required) { if (m.BeginAction(this)) { if (m_MessageString != null) { //m.Send( new UnicodeMessage( Serial, ItemID, MessageType.Regular, 0x3B2, 3, "ENU", null, m_MessageString ) ); m.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", m_MessageString)); } else if (m_MessageNumber != 0) { m.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, m_MessageNumber, null, "")); } Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(EndMessageLock), m); } return(false); } StartTeleport(m); return(false); } return(true); }
private void OnTarget(Mobile from, object obj) { if (Deleted) { return; } IPoint3D p = obj as IPoint3D; if (p == null) { return; } if (!from.InRange(p, m_Range) || from.Location == p) { from.SendMessage("Target is out of range"); return; } from.Emote("*Hurls a heavy net*"); this.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); this.ItemID = 7845; m_EndX = p.X; m_EndY = p.Y; int countX = Math.Abs(this.X - m_EndX); int countY = Math.Abs(this.Y - m_EndY); int count = countX; if (countX < countY) { count = countY; } Timer.DelayCall(TimeSpan.FromMilliseconds(m_Speed), TimeSpan.FromMilliseconds(m_Speed), count, new TimerStateCallback(MoveNet), new object[] { this, from }); Timer.DelayCall(TimeSpan.FromMinutes(15.0), new TimerStateCallback(TAVUtilities.EndCooldown), new object[] { from, typeof(BattleNet) }); from.BeginAction(typeof(BattleNet)); }