Fixes implicit ternary expressions

This commit is contained in:
Kamron Batman 2018-09-14 14:56:48 -07:00
parent c85b0a740c
commit ff26dfa375
345 changed files with 1905 additions and 2336 deletions

View file

@ -472,10 +472,9 @@ namespace Server.Regions
{
if ( Name != null )
return Name;
else if ( RuneName != null )
if ( RuneName != null )
return RuneName;
else
return GetType().Name;
return GetType().Name;
}
public BaseRegion( string name, Map map, int priority, params Rectangle2D[] area ) : base( name, map, priority, area )

View file

@ -16,8 +16,7 @@ namespace Server.Regions
{
if ( from.AccessLevel == AccessLevel.Player )
return false;
else
return base.AllowHousing( from, p );
return base.AllowHousing( from, p );
}
public override bool OnBeginSpellCast( Mobile m, ISpell s )
@ -27,10 +26,8 @@ namespace Server.Regions
m.SendMessage( "You cannot cast that spell here." );
return false;
}
else
{
return base.OnBeginSpellCast( m, s );
}
return base.OnBeginSpellCast( m, s );
}
}
}

View file

@ -117,8 +117,7 @@ namespace Server.Regions
{
if ( Map == Map.Ilshenar || Map == Map.Malas )
return typeof( ArcherGuard );
else
return typeof( WarriorGuard );
return typeof( WarriorGuard );
}
}
@ -280,7 +279,7 @@ namespace Server.Regions
foreach ( Mobile v in m.GetMobilesInRange( 8 ) )
{
if ( !v.Player && v != m && !IsGuardCandidate( v ) && ((v is BaseCreature)? ((BaseCreature)v).IsHumanInTown() : (v.Body.IsHuman && v.Region.IsPartOf( this ))) )
if ( !v.Player && v != m && !IsGuardCandidate( v ) && ((v as BaseCreature)?.IsHumanInTown() ?? (v.Body.IsHuman && v.Region.IsPartOf( this ))) )
{
double dist = m.GetDistanceToSqrt( v );

View file

@ -176,7 +176,7 @@ namespace Server.Regions
{
HouseFoundation foundation = m_House as HouseFoundation;
if ( foundation?.Customizer != null && foundation.Customizer != @from && m_House.IsInside( newLocation, 16 ) )
if ( foundation?.Customizer != null && foundation.Customizer != from && m_House.IsInside( newLocation, 16 ) )
return false;
}
@ -198,8 +198,7 @@ namespace Server.Regions
{
if ( (m_House.IsLockedDown( item ) || m_House.IsSecure( item )) && m_House.IsInside( item ) )
return false;
else
return base.OnDecay(item );
return base.OnDecay(item );
}
public static TimeSpan CombatHeatDelay = TimeSpan.FromSeconds( 30.0 );
@ -263,7 +262,7 @@ namespace Server.Regions
if ( !m_House.IsInside( from ) || !m_House.IsActive )
return;
else if ( e.HasKeyword( 0x33 ) ) // remove thyself
if ( e.HasKeyword( 0x33 ) ) // remove thyself
{
if ( isFriend )
{

View file

@ -32,15 +32,13 @@ namespace Server.Regions
{
return SpawnMobile.Get( type );
}
else if ( typeof( Item ).IsAssignableFrom( type ) )
if ( typeof( Item ).IsAssignableFrom( type ) )
{
return SpawnItem.Get( type );
}
else
{
Console.WriteLine( "Invalid type '{0}' in a SpawnDefinition", type.FullName );
return null;
}
Console.WriteLine( "Invalid type '{0}' in a SpawnDefinition", type.FullName );
return null;
}
case "group":
{
@ -55,10 +53,8 @@ namespace Server.Regions
Console.WriteLine( "Could not find group '{0}' in a SpawnDefinition", group );
return null;
}
else
{
return def;
}
return def;
}
case "treasureChest":
{