示例#1
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
            m_PirateShip_Boat = reader.ReadItem() as PirateShip_Boat;
            boatspawn = reader.ReadBool();
			int version = reader.ReadInt();

        #region Pirate Can Say Random Phrases From A [.txt] File

            active = reader.ReadBool();

        #endregion Pirate Can Say Random Phrases From A [.txt] File

		}
示例#2
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
            m_PirateShip_Boat = reader.ReadItem() as PirateShip_Boat;
            boatspawn = reader.ReadBool();
			int version = reader.ReadInt();



		}
示例#3
0
		public override void OnThink()
		{

        #region Pirate Can Say Random Phrases From A [.txt] File

        if (DateTime.Now >= nextAbilityTime && Combatant == null && active == true)
        {
            nextAbilityTime = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(4, 6));

            if (text == null)
            {
                try
            {
                text = new StreamReader(path, System.Text.Encoding.Default, false);
            }
                catch { }
            }
                Talk();
                Emote();
            }

        #endregion Pirate Can Say Random Phrases From A [.txt] File

  		if(boatspawn == false)
  		{
			Map map = this.Map;
  			if ( map == null )
  				return;			
			this.Z = 0;
            m_PirateShip_Boat = new PirateShip_Boat();
  			Point3D loc = this.Location;
  			Point3D loccrew = this.Location;

			loc = new Point3D( this.X, this.Y-1, this.Z-5 );
			loccrew = new Point3D( this.X, this.Y-1, this.Z+1 );

            m_PirateShip_Boat.MoveToWorld(loc, map);
            boatspawn = true;
        
			for(int i = 0; i < 5; ++i)
			{
                PirateCrew m_PirateCrew = new PirateCrew();
                m_PirateCrew.MoveToWorld(loccrew, map); 
			}
		}
		
		base.OnThink();
		if ( DateTime.Now < m_NextPickup )
			return;

        if (m_PirateShip_Boat == null)
		{
			return;
		} 

		m_NextPickup = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 1, 2 ) );

        enemydirection = Direction.North;
		foreach ( Item enemy in this.GetItemsInRange( 200 ) )
		{
            if (enemy is BaseBoat && enemy != m_PirateShip_Boat && !(enemy is PirateShip_Boat))
			{
				List<Mobile> targets = new List<Mobile>();
				IPooledEnumerable eable = enemy.GetMobilesInRange( 16 );

				foreach ( Mobile m in eable )
				{
					if ( m is PlayerMobile )
						targets.Add( m );
				}
				eable.Free();
				if ( targets.Count > 0 )
				{
                    m_enemyboat = enemy as BaseBoat;
                    enemydirection = this.GetDirectionTo(m_enemyboat);
					break;
				}
			} 
		}
        if (m_enemyboat == null)
		{
			return;
		}

        if (m_PirateShip_Boat != null && m_enemyboat != null)
		{
            if (m_PirateShip_Boat != null && (enemydirection == Direction.North) && m_PirateShip_Boat.Facing != Direction.North)
			{
                m_PirateShip_Boat.Facing = Direction.North;
			}
            else if (m_PirateShip_Boat != null && (enemydirection == Direction.South) && m_PirateShip_Boat.Facing != Direction.South)
			{
                m_PirateShip_Boat.Facing = Direction.South;
			}
            else if (m_PirateShip_Boat != null && (enemydirection == Direction.East || enemydirection == Direction.Right || enemydirection == Direction.Down) && m_PirateShip_Boat.Facing != Direction.East)
			{
                m_PirateShip_Boat.Facing = Direction.East;
			}
            else if (m_PirateShip_Boat != null && (enemydirection == Direction.West || enemydirection == Direction.Left || enemydirection == Direction.Up) && m_PirateShip_Boat.Facing != Direction.West)   
			{
                m_PirateShip_Boat.Facing = Direction.West;
			}
            m_PirateShip_Boat.StartMove(Direction.North, true);

            if (m_PirateShip_Boat != null && this.InRange(m_enemyboat, 10) && m_PirateShip_Boat.IsMoving == true)
			{
                m_PirateShip_Boat.StopMove(false);
			}
		}
		else
		{
            if (m_PirateShip_Boat != null && m_PirateShip_Boat.IsMoving == true)
			{
                m_PirateShip_Boat.StopMove(false);
			}
		}
		}
示例#4
0
		public override void OnThink()
		{
  		    if(boatspawn == false)
  		    {
			    Map map = this.Map;
  			    if ( map == null )
  				    return;			
			    this.Z = 0;
                m_PirateShip_Boat = new PirateShip_Boat();
  			    Point3D loc = this.Location;
  			    Point3D loccrew = this.Location;

			    loc = new Point3D( this.X, this.Y-1, Map.GetAverageZ(this.X, this.Y));
         	            loccrew = new Point3D( this.X, this.Y-1, loc.Z+1 );

                m_PirateShip_Boat.MoveToWorld(loc, map);
                boatspawn = true;
        
			    for(int i = 0; i < 5; ++i)
			    {
                    PirateCrew m_PirateCrew = new PirateCrew();
                    m_PirateCrew.MoveToWorld(loccrew, map); 
			    }
		    }
		
		    base.OnThink();
		    if ( DateTime.UtcNow < m_NextPickup )
			    return;

            if (m_PirateShip_Boat == null)
		    {
			    return;
		    } 

		    m_NextPickup = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 1, 2 ) );

            enemydirection = Direction.North;
		    foreach ( Item enemy in this.GetItemsInRange( 200 ) )
		    {
                if (enemy is BaseBoat && enemy != m_PirateShip_Boat && !(enemy is PirateShip_Boat))
			    {
				    List<Mobile> targets = new List<Mobile>();
				    IPooledEnumerable eable = enemy.GetMobilesInRange( 16 );

				    foreach ( Mobile m in eable )
				    {
					    if ( m is PlayerMobile )
						    targets.Add( m );
				    }
				    eable.Free();
				    if ( targets.Count > 0 )
				    {
                        m_enemyboat = enemy as BaseBoat;
                        enemydirection = this.GetDirectionTo(m_enemyboat);
					    break;
				    }
			    } 
		    }
            if (m_enemyboat == null)
		    {
			    return;
		    }

            if (m_PirateShip_Boat != null && m_enemyboat != null)
		    {
                if (m_PirateShip_Boat != null && (enemydirection == Direction.North) && m_PirateShip_Boat.Facing != Direction.North)
			    {
                    m_PirateShip_Boat.Facing = Direction.North;
			    }
                else if (m_PirateShip_Boat != null && (enemydirection == Direction.South) && m_PirateShip_Boat.Facing != Direction.South)
			    {
                    m_PirateShip_Boat.Facing = Direction.South;
			    }
                else if (m_PirateShip_Boat != null && (enemydirection == Direction.East || enemydirection == Direction.Right || enemydirection == Direction.Down) && m_PirateShip_Boat.Facing != Direction.East)
			    {
                    m_PirateShip_Boat.Facing = Direction.East;
			    }
                else if (m_PirateShip_Boat != null && (enemydirection == Direction.West || enemydirection == Direction.Left || enemydirection == Direction.Up) && m_PirateShip_Boat.Facing != Direction.West)   
			    {
                    m_PirateShip_Boat.Facing = Direction.West;
			    }
                m_PirateShip_Boat.StartMove(Direction.North, true);

                if (m_PirateShip_Boat != null && this.InRange(m_enemyboat, 10) && m_PirateShip_Boat.IsMoving == true)
			    {
                    m_PirateShip_Boat.StopMove(false);
			    }
		    }
		    else
		    {
                if (m_PirateShip_Boat != null && m_PirateShip_Boat.IsMoving == true)
			    {
                    m_PirateShip_Boat.StopMove(false);
			    }
		    }
		}