Example #1
0
 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;
 }
Example #2
0
        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 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 );
		}
Example #5
0
        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 void Use( Mobile from, BaseWeapon weapon )
		{
			BeginSwing();

			from.Direction = from.GetDirectionTo( GetWorldLocation() );
			weapon.PlaySwingAnimation( from );

			from.CheckSkill( weapon.Skill, m_MinSkill, m_MaxSkill );
		}
Example #7
0
        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" );
					}
				}
			}
Example #9
0
		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 );
				}
			}
		}
Example #10
0
			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 );
			}
Example #11
0
			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 );
		}
Example #13
0
        /**
         * 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;
        }
Example #14
0
            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 );
            }
Example #15
0
        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.
			}
		}
Example #17
0
        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 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 ) );
			}
		}
Example #19
0
        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 ) );
        }
Example #20
0
        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));
            }
        }
Example #21
0
        /*
         *  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;
        }
Example #22
0
		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 ) );
			}
		}
Example #23
0
        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;
        }
Example #24
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 ) );
			}
		}
Example #25
0
        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 );
        }
Example #26
0
		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 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 ) );
        }
Example #28
0
			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.
				}
			}
Example #29
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 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." ); 
				} 
			}