public static void Target( Mobile from, object target, ACreedJinBori jinbori ) { if ( from == null || jinbori.Parent != from ) return; Mobile to = target as Mobile; if ( to == null ) return; int delay = 11; delay -= (from.Dex / 30); if ( delay < 6 ) delay = 6; jinbori.ThrowDelay = DateTime.Now + TimeSpan.FromSeconds( delay ); --jinbori.m_Ammo; from.Direction = from.GetDirectionTo( to ); from.Animate( 31, 5, 1, true, false, 0 ); // SendMovingEffect( IEntity from, IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes ) Effects.SendMovingEffect( from, to, 0xF51, 10, 1, false, false ); Timer.DelayCall( TimeSpan.FromSeconds( 1 ), new TimerStateCallback( jinbori.ACreedDaggerDamage_CallBack ), to ); }
public override void Abrir( Mobile from ) { PlagueBeastLord m = RootParent as PlagueBeastLord; if ( m == null ) return; from.Direction = from.GetDirectionTo( m ); if ( Abierto ) { from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, Plague_Texts.Line[21] ); } else { from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, Plague_Texts.Line[22] ); from.PlaySound( 0x248 ); from.PlaySound( 0x2AC ); Agujero.Visible = true; base.Abrir( from ); //Si no hay cerebro, la herida empieza a sangrar directamente if ( HoldBrain == BrainTypes.Brain_None ) { PlagueBrain pb = Mybrain as PlagueBrain; pb.Sangrar( from ); } } }
public static string GetDirection(Mobile from, Point3D p) { Direction d = from.GetDirectionTo(p); string direction = "... You can't tell in what direction it lies."; switch (d) { case Direction.Down: direction = "South East"; break; case Direction.East: direction = "East"; break; case Direction.Left: direction = "South West"; break; case Direction.North: direction = "North"; break; case Direction.Right: direction = "North East"; break; case Direction.South: direction = "South"; break; case Direction.Up: direction = "North West"; break; case Direction.West: direction = "West"; break; } return direction; }
public static void FireWall( Mobile from, Mobile target ) { Effects.SendPacket( from.Location, from.Map, new FlashEffect( FlashType.LightFlash ) ); Effects.PlaySound( from.Location, from.Map, 0x44B ); Direction d = from.GetDirectionTo( target ); int dx, dy; bool diagonal; GetDirectionOffset( d, out dx, out dy, out diagonal ); int length = 1 + (int) Math.Min( from.GetDistanceToSqrt( target ), 10 ); for ( int i = 0; i < length; i++ ) { int x = from.Location.X + ( dx * i ); int y = from.Location.Y + ( dy * i ); Point3D loc = new Point3D( x, y, from.Location.Z ); TimeSpan duration = TimeSpan.FromSeconds( 100.0 - ( i * 9.0 ) ); if ( d == Direction.West || d == Direction.East || diagonal ) new FireFieldItem( from, loc, from.Map, 0x398C, duration ); if ( d == Direction.North || d == Direction.South || diagonal ) new FireFieldItem( from, loc, from.Map, 0x3996, duration ); } }
public override void OnDoubleClick( Mobile from ) { Direction dir; if ( from.Location != this.Location ) dir = from.GetDirectionTo( this ); else if ( this.East ) dir = Direction.West; else dir = Direction.North; from.Direction = dir; bool canThrow = true; if ( !from.InRange( this, 4 ) || !from.InLOS( this ) ) canThrow = false; else if ( this.East ) canThrow = ( dir == Direction.Left || dir == Direction.West || dir == Direction.Up ); else canThrow = ( dir == Direction.Up || dir == Direction.North || dir == Direction.Right ); if ( canThrow ) Throw( from ); else from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. }
public void Use( Mobile from, BaseWeapon weapon ) { BeginSwing(); from.Direction = from.GetDirectionTo( GetWorldLocation() ); weapon.PlaySwingAnimation( from ); from.CheckSkill( weapon.Skill, m_MinSkill, m_MaxSkill ); }
public void OnMine(Mobile from, Item tool) { if (tool is IUsesRemaining && ((IUsesRemaining)tool).UsesRemaining < 1) return; from.Direction = from.GetDirectionTo(this.Location); from.Animate(11, 5, 1, true, false, 0); Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(DoMine), new object[] { from, tool }); }
protected override void OnTarget( Mobile from, object obj ) { if ( m_BaseThrowingItem.Deleted || m_BaseThrowingItem.Map == Map.Internal) return; if ( obj is Mobile ) { Mobile to = (Mobile)obj; if ( !from.CanBeHarmful( to ) ) { } else { from.Direction = from.GetDirectionTo( to ); from.Animate( 11, 5, 1, true, false, 0 ); from.MovingEffect( to, m_BaseThrowingItem.ItemID, 10, 0, false, false ); Timer.DelayCall<ThrowInfo>( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback<ThrowInfo>( FinishThrow ), new ThrowInfo( from, to, m_DamageMin, m_DamageMax, m_Break, m_BaseThrowingItem ) ); if ( m_DeleteOnThrow || m_Break ) m_BaseThrowingItem.Delete(); } } else { IPoint3D p = obj as IPoint3D; if ( p == null ) return; Map map = from.Map; if ( map == null ) return; IEntity to; to = new Entity( Serial.Zero, new Point3D( p ), map ); from.Direction = from.GetDirectionTo( to ); Effects.SendMovingEffect( from, to, m_BaseThrowingItem.ItemID & 0x3FFF, 7, 0, false, false, m_BaseThrowingItem.Hue, 0 ); from.Animate( 11, 5, 1, true, false, 0 ); if ( m_DeleteOnThrow ) { m_BaseThrowingItem.Delete(); from.SendMessage( "You miss the target and the {0} is wasted", m_BaseThrowingItem.Name ); } else { Timer.DelayCall<object[]>( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback<object[]>( FinishMiss ), new object[]{ to, map, m_BaseThrowingItem } ); from.SendMessage( "You miss the target" ); } } }
public virtual void OnDoubleClick( Mobile from, bool createWeedsAndDelete ) { if( !from.CanSee( this ) ) { from.SendMessage( "You cannot see that." ); } else if( !(this is HarvestableTree) && !from.InRange( this, 1 ) ) { from.SendLocalizedMessage( CommonLocs.YouTooFar ); } else if( this is HarvestableTree && !from.InRange( this, 2 ) ) { from.SendLocalizedMessage( CommonLocs.YouTooFar ); } else if( (Sower != null && from != m_Sower) && !(this is HarvestableTree) ) { from.SendMessage( "You cannot harvest any of this crop." ); } else if( from.Mounted ) { from.SendMessage( "You cannot do this while riding a mount." ); } else { int calcYield = CalculateYield( from ); Item crop = null; try { crop = CreateCrop( calcYield ); } catch( Exception e ) { Server.Utilities.ExceptionManager.LogException( "BaseGrownCrop.cs", e ); } if( crop == null ) { from.SendMessage( "You are unable to harvest any of this crop!" ); } else { from.AddToBackpack( crop ); from.Direction = from.GetDirectionTo( this ); from.Animate( AnimationFrame, 5, 1, true, false, 0 ); from.PlaySound( 0x133 ); from.SendMessage( "You successfully harvest the crop!" ); } if( createWeedsAndDelete ) { new Weeds().MoveToWorld( this.Location, this.Map ); this.Delete(); } else { OnHarvest( from ); } } }
protected override void OnTarget( Mobile from, object targeted ) { from.RevealingAction(); IEntity entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Begging, from.Skills[SkillName.Begging].Value)) { return; } int number = -1; if ( targeted is Mobile ) { Mobile targ = (Mobile)targeted; if ( targ.Player ) // We can't beg from players number = 500398; // Perhaps just asking would work better. else if ( !targ.Body.IsHuman ) // Make sure the NPC is human number = 500399; // There is little chance of getting money from that! else if ( !from.InRange( targ, 2 ) ) { if ( !(targ is IBegged) ) number = 500403; // That's too far away. You couldn't beg from it anyway. else if ( targ.Female ) number = 500402; // You are too far away to beg from her. else number = 500401; // You are too far away to beg from him. } else if ( from.Mounted ) // If we're on a mount, who would give us money? number = 500404; // They seem unwilling to give you any money. else if ( targ is IBegged ) { // Face eachother from.Direction = from.GetDirectionTo( targ ); targ.Direction = targ.GetDirectionTo( from ); from.Animate( 32, 5, 1, true, false, 0 ); // Bow new InternalTimer( from, (IBegged)targ ).Start(); m_SetSkillTime = false; } else number = 500404; // They seem unwilling to give you any money. } else // Not a Mobile number = 500399; // There is little chance of getting money from that! if ( number != -1 ) from.SendLocalizedMessage( number ); }
protected override void OnTarget( Mobile from, object targeted ) { from.RevealingAction(); int number = -1; if ( targeted is Mobile ) { Mobile targ = (Mobile)targeted; if ( targ.Player ) // We can't beg from players { number = 500398; // Perhaps just asking would work better. } else if ( !targ.Body.IsHuman ) // Make sure the NPC is human { number = 500399; // There is little chance of getting money from that! } else if ( !from.InRange( targ, 2 ) ) { if ( !targ.Female ) number = 500401; // You are too far away to beg from him. else number = 500402; // You are too far away to beg from her. } else if ( !Core.ML && from.Mounted ) // If we're on a mount, who would give us money? TODO: guessed it's removed since ML { number = 500404; // They seem unwilling to give you any money. } else { // Face eachother from.Direction = from.GetDirectionTo( targ ); targ.Direction = targ.GetDirectionTo( from ); from.Animate( 32, 5, 1, true, false, 0 ); // Bow new InternalTimer( from, targ ).Start(); m_SetSkillTime = false; } } else // Not a Mobile { number = 500399; // There is little chance of getting money from that! } if ( number != -1 ) from.SendLocalizedMessage( number ); }
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus ) { if ( attacker.FindItemOnLayer( Layer.Arms ) is ACreedBoneArms ) { if ( defender.Hits < (defender.HitsMax/10) ) damageBonus += 1.5; // +150% } // Back Attack if ( attacker.GetDirectionTo( defender.Location ) == defender.Direction ) damageBonus += 1.0; // +100% base.OnHit( attacker, defender, damageBonus ); }
protected override void OnTarget( Mobile from, object targeted ) { from.RevealingAction(); int number = -1; if ( targeted is Mobile ) { Mobile targ = (Mobile)targeted; if ( targ.Player ) { number = 500398; // Perhaps just asking would work better. } else if ( !targ.Body.IsHuman ) { number = 500399; // There is little chance of getting money from that! } else if ( !from.InRange( targ, 2 ) ) { if ( !targ.Female ) number = 500401; // You are too far away to beg from him. else number = 500402; // You are too far away to beg from her. } else { // Face eachother from.Direction = from.GetDirectionTo( targ ); targ.Direction = targ.GetDirectionTo( from ); from.Animate( 32, 5, 1, true, false, 0 ); // Bow new InternalTimer( from, targ ).Start(); m_SetSkillTime = false; } } else // Not a Mobile { number = 500399; // There is little chance of getting money from that! } if ( number != -1 ) from.SendLocalizedMessage( number ); }
/** * Verifica se o observador esta no arco de visão do alvo. */ public bool estaNoArcoDeVisao(Mobile observador, Mobile alvo) { Direction direcaoObservador = observador.Direction; Direction direcaoNecessaria = observador.GetDirectionTo(alvo.Location); int intDirObervador = (int)direcaoObservador; int intDirNecessaria = (int)direcaoNecessaria; if (intDirNecessaria == intDirObervador || intDirNecessaria == intDirObervador + 1 || intDirNecessaria == intDirObervador - 1) { return true; } return false; }
public override void Abrir( Mobile from ) { PlagueBeastLord m = RootParent as PlagueBeastLord; if ( m == null ) return; from.Direction = from.GetDirectionTo( m ); if ( Abierto ) { from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, Plague_Texts.Line[21] ); } else { from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, Plague_Texts.Line[22] ); from.PlaySound( 0x248 ); from.PlaySound( 0x2AC ); Gland_Recpt.Visible = true; Glandula.Visible = true; } }
public void Use( Mobile from ) { from.Direction = from.GetDirectionTo( GetWorldLocation() ); Effects.PlaySound( GetWorldLocation(), Map, 0x4F ); if ( from.CheckSkill( SkillName.Stealing, m_MinSkill, m_MaxSkill ) ) { SendLocalizedMessageTo( from, 501834 ); // You successfully avoid disturbing the dip while searching it. } else { Effects.PlaySound( GetWorldLocation(), Map, 0x390 ); BeginSwing(); ProcessDelta(); SendLocalizedMessageTo( from, 501831 ); // You carelessly bump the dip and start it swinging. } }
public override bool CheckItemUse( Mobile from, Item item ) { PlagueBeastLord m = RootParent as PlagueBeastLord; if ( m == null ) return false; from.RevealingAction(); from.Direction = from.GetDirectionTo( m ); if ( Abierto ) { from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, Plague_Texts.Line[21] ); } else { ItemID = 4682; base.Abrir( from ); from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, Plague_Texts.Line[22] ); from.PlaySound( 0x2AC ); } return true; }
public static string GetDirection(Mobile from, Point3D p) { Direction d = from.GetDirectionTo(p); string direction = "... You can't tell in what direction it lies."; switch (d) { case Direction.Down: direction = "South East"; break; case Direction.East: direction = "East"; break; case Direction.Left: direction = "South West"; break; case Direction.North: direction = "North"; break; case Direction.Right: direction = "North East"; break; case Direction.South: direction = "South"; break; case Direction.Up: direction = "North West"; break; case Direction.West: direction = "West"; break; } return(direction); }
public void Shoot( Mobile from, Mobile target ) { if ( from == target ) return; if ( m_UsesRemaining < 1 ) { // You have no shuriken in your ninja belt! from.SendLocalizedMessage( 1063297 ); } else if ( m_Using ) { // You cannot throw another shuriken yet. from.SendLocalizedMessage( 1063298 ); } else if ( !BasePotion.HasFreeHand( from ) ) { // You must have a free hand to throw shuriken. from.SendLocalizedMessage( 1063299 ); } else if ( from.InRange( target, 2 ) ) { from.SendLocalizedMessage( 1063303 ); // Your target is too close! } else if ( from.CanBeHarmful( target ) ) { m_Using = true; from.Direction = from.GetDirectionTo( target ); from.RevealingAction(); if ( from.Body.IsHuman ) from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 ); from.PlaySound( 0x23A ); from.MovingEffect( target, 0x27AC, 1, 0, false, false ); if ( from.CheckSkill( SkillName.Ninjitsu, -10.0, 65.0 ) ) Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( OnShurikenHit ), new object[]{ from, target } ); else ConsumeUse(); Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) ); } }
public static void DrunkardThrowBottle(Mobile from) { if (from == null) { return; } Point3D location = from.Location; Map map = from.Map; int throwSound = 0x5D3; int itemId = Utility.RandomList(2459, 2463, 2503); int itemHue = 0; int hitSound = Utility.RandomList(0x38D, 0x38E, 0x38F, 0x390); bool foundLocation = false; Point3D targetLocation = new Point3D(); List <Point3D> m_ValidLocations = SpecialAbilities.GetSpawnableTiles(from.Location, true, false, from.Location, from.Map, 1, 25, 2, 8, true); if (m_ValidLocations.Count > 0) { targetLocation = m_ValidLocations[Utility.RandomMinMax(0, m_ValidLocations.Count - 1)]; foundLocation = true; from.Direction = from.GetDirectionTo(targetLocation); Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } from.Animate(31, 7, 1, true, false, 0); //Throw Bottle from.PublicOverheadMessage(MessageType.Regular, 0, false, "*drunkenly throws bottle*"); }); } if (!foundLocation) { from.PublicOverheadMessage(MessageType.Regular, 0, false, "*drops bottle*"); TimedStatic bottle = new TimedStatic(Utility.RandomList(0x38D, 0x38E, 0x38F, 0x390), 1); bottle.Name = "a drunkard's bottle"; bottle.MoveToWorld(from.Location, from.Map); Effects.PlaySound(targetLocation, map, hitSound); return; } Timer.DelayCall(TimeSpan.FromSeconds(.75), delegate { if (from == null) { return; } if (!from.Alive) { return; } if (foundLocation) { Effects.PlaySound(from.Location, from.Map, throwSound); IEntity startLocation = new Entity(Serial.Zero, new Point3D(from.Location.X, from.Location.Y, from.Location.Z + 10), from.Map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z + 5), from.Map); Direction direction = from.GetDirectionTo(targetLocation); double speedModifier = .66; Effects.SendMovingEffect(startLocation, endLocation, itemId, (int)(15 * speedModifier), 0, true, false, itemHue, 0); double distance = from.GetDistanceToSqrt(targetLocation); double destinationDelay = (double)distance * .08 * (.5 / speedModifier); Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { Effects.PlaySound(targetLocation, map, hitSound); }); } }); }
public void Fire( Mobile from ) { BaseRanged bow = from.Weapon as BaseRanged; if ( bow == null ) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You must practice with ranged weapons on this."); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if ( DateTime.Now < (m_LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); if ( FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You would do better to stand in front of the archery butte." ); // You would do better to stand in front of the archery butte. return; } if ( FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You aren't properly lined up with the archery butte to get an accurate shot." ); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if ( !from.InRange( worldLoc, 6 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You are too far away from the archery butte to get an accurate shot." ); // You are too far away from the archery butte to get an accurate shot. return; } else if ( from.InRange( worldLoc, 4 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You are too close to the target." ); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = ( ammoType == typeof( Arrow ) ); bool isBolt = ( ammoType == typeof( Bolt ) ); bool isKnown = ( isArrow || isBolt ); if ( pack == null || !pack.ConsumeTotal( ammoType, 1 ) ) { if ( isArrow ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You do not have any arrows with which to practice." ); // You do not have any arrows with which to practice. else if ( isBolt ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You do not have any crossbow bolts with which to practice." ); // You do not have any crossbow bolts with which to practice. else from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = DateTime.Now; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); from.MovingEffect( this, bow.EffectID, 18, 1, false, false ); ScoreEntry se = GetEntryFor( from ); if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) { from.PlaySound( bow.MissSound ); PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} misses the target altogether.", from.Name)); //PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. se.Record( 0 ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.",se.Total.ToString() )); else PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); if (0.4 >= Utility.RandomDouble()) { if (isArrow) { Item Ammo = new Arrow(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } else if (isBolt) { Item Ammo = new Bolt(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } } return; } Effects.PlaySound( Location, Map, /*0x2B1*/ 564 ); double rand = Utility.RandomDouble(); int area, score, splitScore; if ( 0.10 > rand ) { area = 0; // bullseye score = 50; splitScore = 100; } else if ( 0.25 > rand ) { area = 1; // inner ring score = 10; splitScore = 20; } else if ( 0.50 > rand ) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble() ); if ( split ) { if (isArrow) { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the outer ring.", from.Name)); break; } } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the outer ring.", from.Name)); break; } } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name ); } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the outer ring.", from.Name)); break; } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if ( isArrow ) ++m_Arrows; else if ( isBolt ) ++m_Bolts; } se.Record( split ? splitScore : score ); /*if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );*/ if (se.Count == 1) PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString())); else PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); }
/* * Walk at range distance from mobile * * iSteps : Number of steps * bRun : Do we run * iWantDistMin : The minimum distance we want to be * iWantDistMax : The maximum distance we want to be * */ public virtual bool WalkMobileRange( Mobile m, int iSteps, bool bRun, int iWantDistMin, int iWantDistMax ) { if( m_Mobile.Deleted || m_Mobile.DisallowAllMoves ) return false; if( m != null ) { for( int i=0; i<iSteps; i++ ) { // Get the curent distance int iCurrDist = (int)m_Mobile.GetDistanceToSqrt( m ); if( iCurrDist < iWantDistMin || iCurrDist > iWantDistMax ) { bool needCloser = (iCurrDist > iWantDistMax); bool needFurther = !needCloser; if( needCloser && m_Path != null && m_Path.Goal == m ) { if( m_Path.Follow( bRun, 1 ) ) m_Path = null; } else { Direction dirTo; if( iCurrDist > iWantDistMax ) dirTo = m_Mobile.GetDirectionTo( m ); else dirTo = m.GetDirectionTo( m_Mobile ); // Add the run flag if( bRun ) dirTo = dirTo | Direction.Running; if( !DoMove( dirTo, true ) && needCloser ) { m_Path = new PathFollower( m_Mobile, m ); m_Path.Mover = new MoveMethod( DoMoveImpl ); if( m_Path.Follow( bRun, 1 ) ) m_Path = null; } else { m_Path = null; } } } else { return true; } } // Get the curent distance int iNewDist = (int)m_Mobile.GetDistanceToSqrt( m ); if( iNewDist >= iWantDistMin && iNewDist <= iWantDistMax ) return true; else return false; } return false; }
public static void TossBola(Mobile from) { if (from == null) return; var target = from.Combatant; if (target == null) return; if (!target.Mounted) return; from.NonlocalOverheadMessage(MessageType.Emote, 0x3B2, 1049633, from.Name); // ~1_NAME~ begins to menacingly swing a bola... from.Direction = from.GetDirectionTo(target); from.Animate(11, 5, 1, true, false, 0); from.MovingEffect(target, 0x26AC, 10, 0, false, false); var mt = target.Mount; if (mt != null) { mt.Rider = null; target.SendLocalizedMessage(1040023); // You have been knocked off of your mount! BaseMount.SetMountPrevention(target, BlockMountType.Dazed, TimeSpan.FromSeconds(3.0)); } }
public bool Follow(bool run, int range) { Point3D goal = GetGoalLocation(); Direction d; if (Check(m_From.Location, goal, range)) { return(true); } bool repathed = CheckPath(); if (!Enabled || !m_Path.Success) { d = m_From.GetDirectionTo(goal); if (run) { d |= Direction.Running; } m_From.SetDirection(d); Move(d); return(Check(m_From.Location, goal, range)); } d = m_From.GetDirectionTo(m_Next); if (run) { d |= Direction.Running; } m_From.SetDirection(d); MoveResult res = Move(d); if (res == MoveResult.Blocked) { if (repathed) { return(false); } m_Path = null; CheckPath(); if (!m_Path.Success) { d = m_From.GetDirectionTo(goal); if (run) { d |= Direction.Running; } m_From.SetDirection(d); Move(d); return(Check(m_From.Location, goal, range)); } d = m_From.GetDirectionTo(m_Next); if (run) { d |= Direction.Running; } m_From.SetDirection(d); res = Move(d); if (res == MoveResult.Blocked) { return(false); } } if (m_From.X == m_Next.X && m_From.Y == m_Next.Y) { if (m_From.Z == m_Next.Z) { ++m_Index; Advance(ref m_Next, m_Index); } else { m_Path = null; } } return(Check(m_From.Location, goal, range)); }
public static void Honor(Mobile from, object targeted) { if (!from.CheckAlive()) { return; } Mobile targ = targeted as Mobile; if (targ == null) { return; } VirtueLevel level = VirtueHelper.GetLevel(from, VirtueName.Honor); if (targ == from) { if (CantEmbrace(from)) { from.SendLocalizedMessage(1063230); // You must wait awhile before you can embrace honor again. return; } if (level < VirtueLevel.Seeker) { from.SendLocalizedMessage(1063234); // You do not have enough honor to do that return; } Timer t = (Timer)m_Table[from]; if (t != null) { t.Stop(); } Timer t2 = (Timer)m_Table2[from]; if (t2 != null) { t.Stop(); } double delay = 0; switch (level) { case VirtueLevel.Seeker: delay = 60.0; break; case VirtueLevel.Follower: delay = 90.0; break; case VirtueLevel.Knight: delay = 120.0; break; } m_Table[from] = t = Timer.DelayCall(TimeSpan.FromSeconds(delay), new TimerStateCallback(Expire_Callback), from); m_Table2[from] = t2 = Timer.DelayCall(TimeSpan.FromMinutes(5.0), new TimerStateCallback(Expire_Callback2), from); from.SendLocalizedMessage(1063235); // You embrace your honor if (VirtueHelper.Atrophy(from, VirtueName.Honor)) { from.SendLocalizedMessage(1063227); // You have lost some Honor. } } else { if (targ is BaseCreature) { BaseCreature cr = targ as BaseCreature; if (cr.HonorOpponent != null && cr.HonorOpponent != from) { from.SendLocalizedMessage(1063233); // Somebody else is honoring this opponent return; } } if (targ is PlayerMobile) { PlayerMobile pm = targ as PlayerMobile; if (pm.HonorOpponent != null && pm.HonorOpponent != from) { from.SendLocalizedMessage(1063233); // Somebody else is honoring this opponent return; } } if (VirtueHelper.IsHighestPath(from, VirtueName.Honor)) { from.SendLocalizedMessage(1063228); // You cannot gain more Honor. return; } if (!from.InRange(targ.Location, 5)) { from.SendLocalizedMessage(1063232); // You are too far away to honor your opponent return; } if (((targ.Hits * 100) / Math.Max(targ.HitsMax, 1)) < 85) { from.SendLocalizedMessage(1063166); // You cannot honor this monster because it is too damaged. return; } if (!NotorietyHandlers.Mobile_AllowHarmful(from, targ)) { return; } if (!from.CanSee(targ) || !from.InLOS(targ)) { return; } from.Direction = from.GetDirectionTo(targ.Location); from.Animate(32, 5, 1, true, false, 0); from.Say(1063231); // I honor you PlayerMobile player = from as PlayerMobile; player.HonorOpponent = targ; if (targ is BaseCreature) { ((BaseCreature)targ).HonorOpponent = player; } if (targ is PlayerMobile) { ((PlayerMobile)targ).HonorOpponent = player; } player.SpotHonor = player.Location; player.Perfection = 0; } }
public void Shoot( Mobile from, Mobile target ) { if ( from == target ) 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 if ( from.CanBeHarmful( target ) ) { m_Using = true; from.Direction = from.GetDirectionTo( target ); from.RevealingAction(); if ( from.Body.IsHuman && !from.Mounted ) from.Animate( 33, 2, 1, true, true, 0 ); from.PlaySound( 0x223 ); from.MovingEffect( target, 0x2804, 5, 0, false, false ); if ( from.CheckSkill( SkillName.Ninjitsu, -10.0, 50.0 ) ) Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( OnDartHit ), new object[]{ from, target } ); else ConsumeUse(); Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) ); } }
public static void Turn( Mobile from, object to ) { IPoint3D target = to as IPoint3D; if( target == null ) return; if( target is Item ) { Item item = (Item)target; if( item.RootParent != from ) from.Direction = from.GetDirectionTo( item.GetWorldLocation() ); } else if( from != target ) { from.Direction = from.GetDirectionTo( target ); } }
public override void OnDoubleClick(Mobile from) { if ( from.Mounted && !CropHelper.CanWorkMounted ) { from.SendMessage( "You cannot pull up a weed while mounted." ); return; } if ( from.InRange( this.GetWorldLocation(), 1 ) ) { if (( from == m_sower ) || ( DateTime.Now >= planted.AddDays(3) )) { from.Direction = from.GetDirectionTo( this ); from.Animate( from.Mounted ? 29:32, 5, 1, true, false, 0 ); from.SendMessage("You pull up the weed."); this.Delete(); } else from.SendMessage("The weed is still too tough to pull."); } else { from.SendMessage( "You are too far away to harvest anything." ); } }
protected override void OnTarget( Mobile from, object obj ) { if ( m_Bola.Deleted ) return; if ( obj is Mobile ) { Mobile to = (Mobile)obj; if ( !m_Bola.IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it. } else if ( !Core.AOS && (from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null) ) { from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this } else if ( from.Mounted ) { from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount } else if ( Server.Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) ) { from.SendLocalizedMessage( 1070902 ); // You can't use this while in an animal form! } else if ( !to.Mounted ) { from.SendLocalizedMessage( 1049628 ); // You have no reason to throw a bola at that. } else if ( !from.CanBeHarmful( to ) ) { } else if ( from.BeginAction( typeof( Bola ) ) ) { EtherealMount.StopMounting( from ); Item one = from.FindItemOnLayer( Layer.OneHanded ); Item two = from.FindItemOnLayer( Layer.TwoHanded ); if ( one != null ) from.AddToBackpack( one ); if ( two != null ) from.AddToBackpack( two ); from.DoHarmful( to ); if ( Core.AOS ) BaseMount.SetMountPrevention( from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds( 3.0 ) ); m_Bola.Consume(); from.Direction = from.GetDirectionTo( to ); from.Animate( 11, 5, 1, true, false, 0 ); from.MovingEffect( to, 0x26AC, 10, 0, false, false ); Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } ); } else { from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola! } } else { from.SendLocalizedMessage( 1049629 ); // You cannot throw a bola at that. } }
public PathFollowerResult Follow(bool run, int range) { Point3D goal = GetGoalLocation(); Direction d; if (Check(m_From.Location, goal, range)) { return(PathFollowerResult.ReachedDestination); } bool repathed = CheckPath(); if (!Enabled || !m_Path.Success) { d = m_From.GetDirectionTo(goal); if (run) { d |= Direction.Running; } m_From.SetDirection(d); Move(d); if (Check(m_From.Location, goal, range)) { return(PathFollowerResult.ReachedDestination); } } d = m_From.GetDirectionTo(m_Next); if (run) { d |= Direction.Running; } m_From.SetDirection(d); MoveResult res = Move(d); if (m_From is PathTester) { m_From.Say("Move attempt: " + res); } // If blocked or change direction because blocked then need to repath if (res == MoveResult.Blocked || res == MoveResult.SuccessAutoTurn) { if (repathed) { return(PathFollowerResult.UnableToFindPath); } m_Path = null; CheckPath(); if (!m_Path.Success) { d = m_From.GetDirectionTo(goal); if (run) { d |= Direction.Running; } m_From.SetDirection(d); Move(d); if (Check(m_From.Location, goal, range)) { return(PathFollowerResult.ReachedDestination); } } d = m_From.GetDirectionTo(m_Next); if (run) { d |= Direction.Running; } m_From.SetDirection(d); res = Move(d); if (res == MoveResult.Blocked) { return(PathFollowerResult.UnableToFindPath); } } if (m_From.X == m_Next.X && m_From.Y == m_Next.Y) { if (m_From.Z == m_Next.Z) { ++m_Index; Advance(ref m_Next, m_Index); if (Check(m_From.Location, goal, range)) { return(PathFollowerResult.ReachedDestination); } else { return(PathFollowerResult.FollowingPath); } } else { m_Path = null; if (Check(m_From.Location, goal, range)) { return(PathFollowerResult.ReachedDestination); } else { return(PathFollowerResult.UnableToFindPath); } } } if (Check(m_From.Location, goal, range)) { return(PathFollowerResult.ReachedDestination); } else { return(PathFollowerResult.UnableToFindPath); } }
public static void FocusTo( Mobile who, Mobile to ) { if ( Utility.RandomBool() ) { who.Animate( 17, 7, 1, true, false, 0 ); } else { switch ( Utility.Random( 3 ) ) { case 0: who.Animate( 32, 7, 1, true, false, 0 ); break; case 1: who.Animate( 33, 7, 1, true, false, 0 ); break; case 2: who.Animate( 34, 7, 1, true, false, 0 ); break; } } who.Direction = who.GetDirectionTo( to ); }
public bool OnSpeech( Mobile mob, Mobile speaker, string text ) { if ( ( m_Flags & IHSFlags.OnSpeech ) == 0 || m_Keywords == null || m_Responses == null || m_KeywordHash == null ) return false; // not enabled if ( !speaker.Alive ) return false; if ( !speaker.InRange( mob, 3 ) ) return false; if ( ( speaker.Direction & Direction.Mask ) != speaker.GetDirectionTo( mob ) ) return false; if ( ( mob.Direction & Direction.Mask ) != mob.GetDirectionTo( speaker ) ) return false; string[] split = text.Split( ' ' ); List<string> keywordsFound = new List<string>(); for ( int i = 0; i < split.Length; ++i ) { string keyword; m_KeywordHash.TryGetValue( split[i], out keyword ); if ( keyword != null ) keywordsFound.Add( keyword ); } if ( keywordsFound.Count > 0 ) { string responseWord; if ( Utility.RandomBool() ) responseWord = GetRandomResponseWord( keywordsFound ); else responseWord = keywordsFound[Utility.Random( keywordsFound.Count )]; string secondResponseWord = GetRandomResponseWord( keywordsFound ); StringBuilder response = new StringBuilder(); switch ( Utility.Random( 6 ) ) { default: case 0: { response.Append( "Me " ).Append( responseWord ).Append( '?' ); break; } case 1: { response.Append( responseWord ).Append( " thee!" ); response.Replace( responseWord[0], Char.ToUpper( responseWord[0] ), 0, 1 ); break; } case 2: { response.Append( responseWord ).Append( '?' ); response.Replace( responseWord[0], Char.ToUpper( responseWord[0] ), 0, 1 ); break; } case 3: { response.Append( responseWord ).Append( "! " ).Append( secondResponseWord ).Append( '.' ); response.Replace( responseWord[0], Char.ToUpper( responseWord[0] ), 0, 1 ); response.Replace( secondResponseWord[0], Char.ToUpper( secondResponseWord[0] ), responseWord.Length + 2, 1 ); break; } case 4: { response.Append( responseWord ).Append( '.' ); response.Replace( responseWord[0], Char.ToUpper( responseWord[0] ), 0, 1 ); break; } case 5: { response.Append( responseWord ).Append( "? " ).Append( secondResponseWord ).Append( '.' ); response.Replace( responseWord[0], Char.ToUpper( responseWord[0] ), 0, 1 ); response.Replace( secondResponseWord[0], Char.ToUpper( secondResponseWord[0] ), responseWord.Length + 2, 1 ); break; } } int maxWords = ( split.Length / 2 ) + 1; if ( maxWords < 2 ) maxWords = 2; else if ( maxWords > 6 ) maxWords = 6; SaySentance( mob, Utility.RandomMinMax( 2, maxWords ) ); mob.Say( response.ToString() ); return true; } return false; }
public void Fire( Mobile from ) { BaseRanged bow = from.Weapon as BaseRanged; if ( bow == null ) { SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if ( Core.Now < (m_LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); if ( FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500596 ); // You would do better to stand in front of the archery butte. return; } if ( FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500597 ); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if ( !from.InRange( worldLoc, 6 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500598 ); // You are too far away from the archery butte to get an accurate shot. return; } else if ( from.InRange( worldLoc, 4 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500599 ); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = ( ammoType == typeof( Arrow ) ); bool isBolt = ( ammoType == typeof( Bolt ) ); bool isKnown = ( isArrow || isBolt ); if ( pack == null || !pack.ConsumeTotal( ammoType, 1 ) ) { if ( isArrow ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500594 ); // You do not have any arrows with which to practice. else if ( isBolt ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500595 ); // You do not have any crossbow bolts with which to practice. else SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = Core.Now; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); from.MovingEffect( this, bow.EffectID, 18, 1, false, false ); ScoreEntry se = GetEntryFor( from ); if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) { from.PlaySound( bow.MissSound ); PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. se.Record( 0 ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); return; } Effects.PlaySound( Location, Map, 0x2B1 ); double rand = Utility.RandomDouble(); int area, score, splitScore; if ( 0.10 > rand ) { area = 0; // bullseye score = 50; splitScore = 100; } else if ( 0.25 > rand ) { area = 1; // inner ring score = 10; splitScore = 20; } else if ( 0.50 > rand ) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble() ); if ( split ) { PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name ); } else { PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if ( isArrow ) ++m_Arrows; else if ( isBolt ) ++m_Bolts; } se.Record( split ? splitScore : score ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); }
public virtual void EndSummon( Mobile from ) { if ( m_Chyloth != null && !m_Chyloth.Deleted ) { from.SendLocalizedMessage( 1050010 ); // The ferry man has already been summoned. There is no need to ring for him again. } else if ( m_Dragon != null && !m_Dragon.Deleted ) { from.SendLocalizedMessage( 1050017 ); // The ferryman has recently been summoned already. You decide against ringing the bell again so soon. } else if ( m_Summoning ) { m_Summoning = false; Point3D loc = GetWorldLocation(); loc.Z -= 16; Effects.SendLocationParticles( EffectItem.Create( loc, Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 0, 0, 2023, 0 ); Effects.PlaySound( loc, Map, 0x1FE ); m_Chyloth = new Chyloth(); m_Chyloth.Direction = (Direction)(7 & (4 + (int)from.GetDirectionTo( loc ))); m_Chyloth.MoveToWorld( loc, Map ); m_Chyloth.Bell = this; m_Chyloth.AngryAt = from; m_Chyloth.BeginGiveWarning(); m_Chyloth.BeginRemove( TimeSpan.FromSeconds( 40.0 ) ); } }
public virtual void DoHarvestingEffect( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc ) { from.Direction = from.GetDirectionTo( loc ); if ( !from.Mounted ) from.Animate( Utility.RandomList( def.EffectActions ), 5, 1, true, false, 0 ); }
public void Update() { int xOffset = 0; int yOffset = 0; int zOffset = (int)System.Math.Round((double)m_Target.Z / 10); if (zOffset > 0) { zOffset -= 1; } else if (zOffset < 0) { zOffset += 1; } Point2D fakeTarget = new Point2D(m_Target.X - zOffset, m_Target.Y - zOffset); Direction direction = m_Mobile.GetDirectionTo(m_Target.X - zOffset, m_Target.Y - zOffset); if (m_Mobile.InRange(fakeTarget, 2)) { direction = Direction.Up; } switch (direction) { case Direction.North: xOffset = 0; yOffset = 1; break; case Direction.Right: xOffset = -1; yOffset = 1; break; case Direction.East: xOffset = -1; yOffset = 0; break; case Direction.Down: xOffset = -1; yOffset = -1; break; case Direction.South: xOffset = 0; yOffset = -1; break; case Direction.Left: xOffset = 1; yOffset = -1; break; case Direction.West: xOffset = 1; yOffset = 0; break; case Direction.Up: xOffset = 1; yOffset = 1; break; default: break; } xOffset -= zOffset + 1; yOffset -= zOffset + 1; Update(m_Target.X + xOffset, m_Target.Y + yOffset); }