Fixes casting checks
This commit is contained in:
parent
7ea00fbf4f
commit
03dd5f1926
431 changed files with 5616 additions and 6250 deletions
|
|
@ -604,9 +604,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetTeamID( Mobile mob )
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(mob is PlayerMobile pm) )
|
||||
return -1;
|
||||
|
||||
if ( pm.DuelContext == null || pm.DuelContext != m_Context )
|
||||
|
|
@ -620,12 +618,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetColor( Mobile mob )
|
||||
{
|
||||
DDTeamInfo teamInfo = GetTeamInfo( mob );
|
||||
|
||||
if ( teamInfo != null )
|
||||
return teamInfo.Color;
|
||||
|
||||
return -1;
|
||||
return GetTeamInfo( mob )?.Color ?? -1;
|
||||
}
|
||||
|
||||
private void ApplyHues( Participant p, int hueOverride )
|
||||
|
|
@ -650,8 +643,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer dp = null;
|
||||
|
||||
if ( mob is PlayerMobile )
|
||||
dp = ( mob as PlayerMobile ).DuelPlayer;
|
||||
if ( mob is PlayerMobile mobile )
|
||||
dp = mobile.DuelPlayer;
|
||||
|
||||
m_Context.RemoveAggressions( mob );
|
||||
|
||||
|
|
@ -748,9 +741,7 @@ namespace Server.Engines.ConPVP
|
|||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color );
|
||||
|
||||
if ( m_FinishTimer != null )
|
||||
m_FinishTimer.Stop();
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
m_FinishTimer = Timer.DelayCall( m_Controller.Duration, new TimerCallback( Finish_Callback ) );
|
||||
}
|
||||
|
||||
|
|
@ -766,10 +757,7 @@ namespace Server.Engines.ConPVP
|
|||
teams.Add( teamInfo );
|
||||
}
|
||||
|
||||
teams.Sort( delegate( DDTeamInfo a, DDTeamInfo b )
|
||||
{
|
||||
return b.Score - a.Score;
|
||||
} );
|
||||
teams.Sort((a, b) => b.Score - a.Score);
|
||||
|
||||
Tournament tourny = m_Context.m_Tournament;
|
||||
|
||||
|
|
@ -897,7 +885,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DuelPlayer dp = p.Players[j];
|
||||
|
||||
if ( dp != null && dp.Mobile != null )
|
||||
if ( dp?.Mobile != null )
|
||||
{
|
||||
dp.Mobile.CloseGump( typeof( DDBoardGump ) );
|
||||
dp.Mobile.SendGump( new DDBoardGump( dp.Mobile, this ) );
|
||||
|
|
@ -952,9 +940,7 @@ namespace Server.Engines.ConPVP
|
|||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, -1 );
|
||||
|
||||
if ( m_FinishTimer != null )
|
||||
m_FinishTimer.Stop();
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
m_FinishTimer = null;
|
||||
}
|
||||
|
||||
|
|
@ -981,14 +967,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Alert( "Domination averted!" );
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
m_Controller.PointA.SetNonCaptureHue();
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
m_Controller.PointB.SetNonCaptureHue();
|
||||
|
||||
if ( m_CaptureTimer != null )
|
||||
m_CaptureTimer.Stop();
|
||||
m_Controller.PointA?.SetNonCaptureHue();
|
||||
m_Controller.PointB?.SetNonCaptureHue();
|
||||
m_CaptureTimer?.Stop();
|
||||
m_CaptureTimer = null;
|
||||
}
|
||||
|
||||
|
|
@ -1012,8 +993,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( team == null )
|
||||
{
|
||||
m_Capturable = true;
|
||||
if ( m_CaptureTimer != null )
|
||||
m_CaptureTimer.Stop();
|
||||
m_CaptureTimer?.Stop();
|
||||
m_CaptureTimer = null;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1022,11 +1002,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Alert( "{0} is dominating... {1}", team.Name, 10 - m_CapStage );
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
m_Controller.PointA.SetCaptureHue( m_CapStage );
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
m_Controller.PointB.SetCaptureHue( m_CapStage );
|
||||
m_Controller.PointA?.SetCaptureHue( m_CapStage );
|
||||
m_Controller.PointB?.SetCaptureHue( m_CapStage );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue