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

@ -153,7 +153,8 @@ namespace Server.Engines.ConPVP
ie.Refresh();
return;
}
else if ( ie.Expired )
if ( ie.Expired )
{
list.RemoveAt( i-- );
}

View file

@ -821,9 +821,9 @@ namespace Server.Engines.ConPVP
if ( a == null && b == null )
return 0;
else if ( a == null )
if ( a == null )
return -1;
else if ( b == null )
if ( b == null )
return +1;
return a.CompareTo( b );

View file

@ -44,21 +44,19 @@ namespace Server.Engines.ConPVP
from.SendMessage( 0x22, "You have recently been in combat with another player and cannot use this moongate." );
return false;
}
else if ( from.Spell != null )
if ( from.Spell != null )
{
from.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
return false;
}
else
{
from.CloseGump( typeof( ArenaGump ) );
from.SendGump( new ArenaGump( from, this ) );
from.CloseGump( typeof( ArenaGump ) );
from.SendGump( new ArenaGump( from, this ) );
if ( !from.Hidden || from.AccessLevel == AccessLevel.Player )
Effects.PlaySound( from.Location, from.Map, 0x20E );
if ( !from.Hidden || from.AccessLevel == AccessLevel.Player )
Effects.PlaySound( from.Location, from.Map, 0x20E );
return true;
}
return true;
}
public override void OnDoubleClick( Mobile from )
@ -288,4 +286,4 @@ namespace Server.Engines.ConPVP
m_ColumnX += width;
}
}
}
}

View file

@ -851,7 +851,7 @@ namespace Server.Engines.ConPVP
}
if ( hasWinner )
return winner == null ? (Participant) m_Participants[0] : winner;
return winner ?? (Participant) m_Participants[0];
return null;
}
@ -1851,11 +1851,11 @@ namespace Server.Engines.ConPVP
pack.DropItem( item );
if ( item is BaseWeapon )
mob.SendLocalizedMessage( 1062001, item.Name == null ? "#" + item.LabelNumber.ToString() : item.Name ); // You can no longer wield your ~1_WEAPON~
mob.SendLocalizedMessage( 1062001, item.Name ?? "#" + item.LabelNumber.ToString() ); // You can no longer wield your ~1_WEAPON~
else if ( item is BaseArmor && !(item is BaseShield) )
mob.SendLocalizedMessage( 1062002, item.Name == null ? "#" + item.LabelNumber.ToString() : item.Name ); // You can no longer wear your ~1_ARMOR~
mob.SendLocalizedMessage( 1062002, item.Name ?? "#" + item.LabelNumber.ToString() ); // You can no longer wear your ~1_ARMOR~
else
mob.SendLocalizedMessage( 1062003, item.Name == null ? "#" + item.LabelNumber.ToString() : item.Name ); // You can no longer equip your ~1_SHIELD~
mob.SendLocalizedMessage( 1062003, item.Name ?? "#" + item.LabelNumber.ToString() ); // You can no longer equip your ~1_SHIELD~
}
}
@ -2080,7 +2080,7 @@ namespace Server.Engines.ConPVP
if ( entry.Mobile == mob )
return entry;
else if ( entry.Expired )
if ( entry.Expired )
m_Entries.RemoveAt( i-- );
}
@ -2105,11 +2105,9 @@ namespace Server.Engines.ConPVP
return false;
}
else
{
m.SendLocalizedMessage( 1049383 ); // The teleporter doesn't seem to work for you.
return true;
}
m.SendLocalizedMessage( 1049383 ); // The teleporter doesn't seem to work for you.
return true;
}
public ExitTeleporter( Serial serial ) : base( serial )
@ -2319,8 +2317,7 @@ namespace Server.Engines.ConPVP
{
if ( m_Tournament == null )
return $"{dp.Mobile.Name} is dead";
else
dp.Mobile.Resurrect();
dp.Mobile.Resurrect();
}
if ( m_Tournament == null && CheckCombat( dp.Mobile ) )

View file

@ -778,10 +778,8 @@ namespace Server.Engines.ConPVP
return true;
}
else
{
return false;
}
return false;
}
}
@ -1158,9 +1156,6 @@ namespace Server.Engines.ConPVP
AddBorderedText( 235 + 15, 105 + ( i * 75 ), 250, 20, pl.Player.Name, 0xFFC000, BlackColor32 );
}
}
else
{
}
AddButton( 314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0 );
}
@ -1402,8 +1397,7 @@ namespace Server.Engines.ConPVP
{
if ( m_Name != null )
return $"({Name}) ...";
else
return "...";
return "...";
}
}

View file

@ -218,9 +218,6 @@ namespace Server.Engines.ConPVP
AddBorderedText( 235 + 15, 105 + ( i * 75 ), 250, 20, pl.Player.Name, 0xFFC000, BlackColor32 );
}
}
else
{
}
AddButton( 314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0 );
}
@ -449,7 +446,7 @@ namespace Server.Engines.ConPVP
else if ( passTeam == useTeam && passTo.PlaceInBackpack( this ) )
{
passTo.LocalOverheadMessage( MessageType.Regular, 0x59, false,
$"{@from.Name} has passed you the cookies!");
$"{from.Name} has passed you the cookies!");
}
else
{
@ -496,7 +493,7 @@ namespace Server.Engines.ConPVP
Mobile mob = FindOwner( parent );
if ( mob != null )
mob.SolidHueOverride = ( m_TeamInfo == null ? -1 : m_TeamInfo.Game.GetColor( mob ) );
mob.SolidHueOverride = m_TeamInfo?.Game.GetColor( mob ) ?? -1;
}
public CTFFlag( Serial serial )

View file

@ -214,9 +214,6 @@ namespace Server.Engines.ConPVP
AddBorderedText( 235 + 15, 105 + ( i * 75 ), 250, 20, pl.Player.Name, 0xFFC000, BlackColor32 );
}
}
else
{
}
AddButton( 314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0 );
}

View file

@ -83,10 +83,9 @@ namespace Server.Engines.ConPVP
{
get
{
if (m_KingTimer != null)
if (m_KingTimer != null)
return m_KingTimer.Captures;
else
return 0;
return 0;
}
}
@ -136,17 +135,15 @@ namespace Server.Engines.ConPVP
public override bool OnMoveOff(Mobile m)
{
if (base.OnMoveOff(m))
if (base.OnMoveOff(m))
{
if (m_King == m)
DeKingify();
return true;
}
else
{
return false;
}
return false;
}
public virtual void OnKingDied(Mobile king, KHTeamInfo kingTeam, Mobile killer, KHTeamInfo killerTeam)
@ -725,10 +722,9 @@ namespace Server.Engines.ConPVP
public override string ToString()
{
if (m_Name != null)
if (m_Name != null)
return $"({Name}) ...";
else
return "...";
return "...";
}
}

View file

@ -88,9 +88,9 @@ namespace Server.Engines.ConPVP
{
if ( xp >= 22500 )
return 50;
else if ( xp >= 2500 )
if ( xp >= 2500 )
return (10 + ((xp - 2500) / 500));
else if ( xp < 0 )
if ( xp < 0 )
xp = 0;
return m_ShortLevels[xp / 100];

View file

@ -601,7 +601,7 @@ namespace Server.Engines.ConPVP
case TournamentStage.Inactive:
{
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
0x35, false, "The tournament is closed.", @from.NetState );
0x35, false, "The tournament is closed.", from.NetState );
break;
}
@ -610,7 +610,7 @@ namespace Server.Engines.ConPVP
if ( m_Players.Count != tourny.PlayersPerParticipant )
{
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
0x35, false, "You have not yet chosen your team.", @from.NetState );
0x35, false, "You have not yet chosen your team.", from.NetState );
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
break;
@ -818,7 +818,7 @@ namespace Server.Engines.ConPVP
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
0x59, false,
$"As you command m'{(@from.Female ? "Lady" : "Lord")}. I've given your offer to {mob.Name}.", from.NetState );
$"As you command m'{(from.Female ? "Lady" : "Lord")}. I've given your offer to {mob.Name}.", from.NetState );
}
}
}
@ -961,7 +961,7 @@ namespace Server.Engines.ConPVP
AddBorderedText( 22, 22, 294, 20, Center( sb.ToString() ), LabelColor32, BlackColor32 );
AddBorderedText( 22, 50, 294, 40,
$"You have been asked to partner with {@from.Name} in a tournament. Do you accept?",
$"You have been asked to partner with {from.Name} in a tournament. Do you accept?",
0xB0C868, BlackColor32 );
AddImageTiled( 32, 88, 264, 1, 9107 );
@ -1157,7 +1157,7 @@ namespace Server.Engines.ConPVP
0x59, false, $"{mob.Name} has accepted your offer of partnership.", from.NetState );
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x59, false, $"You have accepted the partnership with {@from.Name}.", mob.NetState );
0x59, false, $"You have accepted the partnership with {from.Name}.", mob.NetState );
}
}
}
@ -1174,7 +1174,7 @@ namespace Server.Engines.ConPVP
0x22, false, $"{mob.Name} has declined your offer of partnership.", from.NetState );
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x22, false, $"You have declined the partnership with {@from.Name}.", mob.NetState );
0x22, false, $"You have declined the partnership with {from.Name}.", mob.NetState );
}
}
}
@ -3133,8 +3133,8 @@ namespace Server.Engines.ConPVP
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}", false, false );
AddHtml( 25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}", false, false );
AddHtml( 25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}", false, false );
AddHtml( 25, 133, 250, 20, $"Wins: {(entry == null ? 0 : entry.Wins):N0}", false, false );
AddHtml( 25, 153, 250, 20, $"Losses: {(entry == null ? 0 : entry.Losses):N0}", false, false );
AddHtml( 25, 133, 250, 20, $"Wins: {entry?.Wins ?? 0:N0}", false, false );
AddHtml( 25, 153, 250, 20, $"Losses: {entry?.Losses ?? 0:N0}", false, false );
break;
}