Exemplo n.º 1
0
		public void Finish( Participant winner )
		{
			if ( m_Finished )
				return;

			EndAutoTie();
			StopSDTimers();

			m_Finished = true;

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

				if ( pl != null && !pl.Eliminated )
					DelayBounce( TimeSpan.FromSeconds( 8.0 ), pl.Mobile, null );
			}

			winner.Broadcast( 0x59, null, winner.Players.Length == 1 ? "{0} has won the duel." : "{0} and {1} team have won the duel.", winner.Players.Length == 1 ? "You have won the duel." : "Your team has won the duel." );

			if ( m_Tournament != null && winner.TournyPart != null )
			{
				m_Match.Winner = winner.TournyPart;
				winner.TournyPart.WonMatch( m_Match );
				m_Tournament.HandleWon( m_Arena, m_Match, winner.TournyPart );
			}

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

				if ( loser != winner )
				{
					loser.Broadcast( 0x22, null, loser.Players.Length == 1 ? "{0} has lost the duel." : "{0} and {1} team have lost the duel.", loser.Players.Length == 1 ? "You have lost the duel." : "Your team has lost the duel." );

					if ( m_Tournament != null && loser.TournyPart != null )
						loser.TournyPart.LostMatch( m_Match );
				}

				for ( int j = 0; j < loser.Players.Length; ++j )
				{
					if ( loser.Players[j] != null )
					{
						RemoveAggressions( loser.Players[j].Mobile );
						loser.Players[j].Mobile.Delta( MobileDelta.Noto );
						loser.Players[j].Mobile.CloseGump( typeof( BeginGump ) );

						if ( m_Tournament != null )
							loser.Players[j].Mobile.SendEverything();
					}
				}
			}

			if ( IsOneVsOne )
			{
				DuelPlayer dp1 = ((Participant)m_Participants[0]).Players[0];
				DuelPlayer dp2 = ((Participant)m_Participants[1]).Players[0];

				if ( dp1 != null && dp2 != null )
				{
					Award( dp1.Mobile, dp2.Mobile, dp1.Participant == winner );
					Award( dp2.Mobile, dp1.Mobile, dp2.Participant == winner );
				}
			}

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

			Timer.DelayCall( TimeSpan.FromSeconds( 9.0 ), new TimerCallback( UnregisterRematch ) );
		}