Example #1
0
		public void SendReadyGump( int count )
		{
			if ( !m_Registered )
				return;

			if ( count != -1 )
				m_StartedReadyCountdown = true;

			m_ReadyCount = count;

			if ( count == 0 )
			{
				string error = ValidateStart();

				if ( error != null )
				{
					for ( int i = 0; i < m_Participants.Count; ++i )
					{
						Participant p = (Participant)m_Participants[i];

						for ( int j = 0; j < p.Players.Length; ++j )
						{
							DuelPlayer dp = p.Players[j];

							if ( dp != null )
								dp.Mobile.SendMessage( "The duel could not be started because {0}.", error );
						}
					}

					StartCountdown( 10, new CountdownCallback( SendReadyGump ) );

					return;
				}

				m_ReadyWait = false;

				List<Mobile> players = new List<Mobile>();

				for ( int i = 0; i < m_Participants.Count; ++i )
				{
					Participant p = (Participant)m_Participants[i];

					for ( int j = 0; j < p.Players.Length; ++j )
					{
						DuelPlayer dp = p.Players[j];

						if ( dp != null )
							players.Add( dp.Mobile );
					}
				}

				Arena arena = m_OverrideArena;
				
				if ( arena == null )
					arena = Arena.FindArena( players );

				if ( arena == null )
				{
					for ( int i = 0; i < m_Participants.Count; ++i )
					{
						Participant p = (Participant)m_Participants[i];

						for ( int j = 0; j < p.Players.Length; ++j )
						{
							DuelPlayer dp = p.Players[j];

							if ( dp != null )
								dp.Mobile.SendMessage( "The duel could not be started because there are no arenas. If you want to stop waiting for a free arena, yield the duel." );
						}
					}

					StartCountdown( 10, new CountdownCallback( SendReadyGump ) );
					return;
				}

				if ( !arena.IsOccupied )
				{
					m_Arena = arena;

					if ( m_Initiator.Map == Map.Internal )
					{
						m_GatePoint = m_Initiator.LogoutLocation;
						m_GateFacet = m_Initiator.LogoutMap;
					}
					else
					{
						m_GatePoint = m_Initiator.Location;
						m_GateFacet = m_Initiator.Map;
					}

					ExitTeleporter tp = arena.Teleporter as ExitTeleporter;

					if ( tp == null )
					{
						arena.Teleporter = tp = new ExitTeleporter();
						tp.MoveToWorld( arena.GateOut == Point3D.Zero ? arena.Outside : arena.GateOut, arena.Facet );
					}

					ArenaMoongate mg = new ArenaMoongate( arena.GateIn == Point3D.Zero ? arena.Outside : arena.GateIn, arena.Facet, tp );

					m_StartedBeginCountdown = true;

					for ( int i = 0; i < m_Participants.Count; ++i )
					{
						Participant p = (Participant)m_Participants[i];

						for ( int j = 0; j < p.Players.Length; ++j )
						{
							DuelPlayer pl = p.Players[j];

							if ( pl == null )
								continue;

							tp.Register( pl.Mobile );

							pl.Mobile.Frozen = false; // reset timer just in case
							pl.Mobile.Frozen = true;

							Debuff( pl.Mobile );
							CancelSpell( pl.Mobile );

							pl.Mobile.Delta( MobileDelta.Noto );
						}

						arena.MoveInside( p.Players, i );
					}

					if ( m_EventGame != null )
						m_EventGame.OnStart();

					StartCountdown( 10, new CountdownCallback( SendBeginGump ) );

					mg.Appear( m_GatePoint, m_GateFacet );
				}
				else
				{
					for ( int i = 0; i < m_Participants.Count; ++i )
					{
						Participant p = (Participant)m_Participants[i];

						for ( int j = 0; j < p.Players.Length; ++j )
						{
							DuelPlayer dp = p.Players[j];

							if ( dp != null )
								dp.Mobile.SendMessage( "The duel could not be started because all arenas are full. If you want to stop waiting for a free arena, yield the duel." );
						}
					}

					StartCountdown( 10, new CountdownCallback( SendReadyGump ) );
				}

				return;
			}

			m_ReadyWait = true;

			bool isAllReady = true;

			Type[] types = new Type[]{ typeof( ReadyGump ) };

			for ( int i = 0; i < m_Participants.Count; ++i )
			{
				Participant p = (Participant)m_Participants[i];

				for ( int j = 0; j < p.Players.Length; ++j )
				{
					DuelPlayer pl = p.Players[j];

					if ( pl == null )
						continue;

					Mobile mob = pl.Mobile;

					if ( pl.Ready )
					{
						if ( m_Tournament == null )
							CloseAndSendGump( mob, new ReadyGump( mob, this, count ), types );
					}
					else
					{
						isAllReady = false;
					}
				}
			}

			if ( count == -1 && isAllReady )
				StartCountdown( 3, new CountdownCallback( SendReadyGump ) );
		}
Example #2
0
			public ArenaMoongate( Point3D target, Map map, ExitTeleporter tp ) : base( target, map )
			{
				m_Teleporter = tp;

				ItemID = 0x1FD4;
				Dispellable = false;

				GumpWidth = 300;
				GumpHeight = 150;
				MessageColor = 0xFFC000;
				MessageString = "Are you sure you wish to spectate this duel?";
				TitleColor = 0x7800;
				TitleNumber = 1062051; // Gate Warning

				Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), new TimerCallback( Delete ) );
			}