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

@ -47,7 +47,7 @@ namespace Server.Factions
set
{
m_Faction = value;
Hue = ( m_Faction == null ? 0 : m_Faction.Definition.HuePrimary );
Hue = m_Faction?.Definition.HuePrimary ?? 0;
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Factions
{
m_Faction = value;
AssignName( m_Faction == null ? null : m_Faction.Definition.FactionStoneName );
AssignName( m_Faction?.Definition.FactionStoneName );
}
}

View file

@ -15,8 +15,8 @@ namespace Server.Factions
{
m_Faction = value;
Hue = ( m_Faction == null ? 0 : m_Faction.Definition.HueJoin );
AssignName( m_Faction == null ? null : m_Faction.Definition.SignupName );
Hue = m_Faction?.Definition.HueJoin ?? 0;
AssignName( m_Faction?.Definition.SignupName );
}
}

View file

@ -30,11 +30,11 @@ namespace Server {
from.AddStatMod( new StatMod( StatType.All, "blood-rose", amount, TimeSpan.FromMinutes( time ) ) );
return true;
} else {
from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
return false;
}
from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
return false;
}
public override void Serialize( GenericWriter writer ) {
@ -49,4 +49,4 @@ namespace Server {
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -73,7 +73,8 @@ namespace Server {
weight = Utility.Random( weight );
foreach ( WeightedItem item in _items ) {
foreach ( WeightedItem item in _items )
{
if ( weight < item.Weight ) {
Item obj = item.Construct();
@ -95,9 +96,9 @@ namespace Server {
}
break;
} else {
weight -= item.Weight;
}
weight -= item.Weight;
}
}
}

View file

@ -103,7 +103,7 @@ namespace Server.Factions
public void Update()
{
ItemID = ( m_Town == null ? 0x1869 : m_Town.Definition.SigilID );
ItemID = m_Town?.Definition.SigilID ?? 0x1869;
if ( m_Town == null )
AssignName( null );

View file

@ -29,10 +29,9 @@ namespace Server.Factions
{
if ( Amount <= 1 )
return 0x2E4;
else if ( Amount <= 5 )
if ( Amount <= 5 )
return 0x2E5;
else
return 0x2E6;
return 0x2E6;
}
public override void Serialize( GenericWriter writer )

View file

@ -6,7 +6,7 @@ namespace Server.Factions
public override void OnTownChanged()
{
AssignName( Town == null ? null : Town.Definition.StrongholdMonolithName );
AssignName( Town?.Definition.StrongholdMonolithName );
}
public StrongholdMonolith() : this( null, null )

View file

@ -6,7 +6,7 @@ namespace Server.Factions
public override void OnTownChanged()
{
AssignName( Town == null ? null : Town.Definition.TownMonolithName );
AssignName( Town?.Definition.TownMonolithName );
}
public TownMonolith() : this( null )

View file

@ -14,7 +14,7 @@ namespace Server.Factions
{
m_Town = value;
AssignName( m_Town == null ? null : m_Town.Definition.TownStoneName );
AssignName( m_Town?.Definition.TownStoneName );
}
}

View file

@ -93,7 +93,7 @@ namespace Server.Factions
if ( from.Alive )
m_Placer.SendMessage( "You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name );
else
m_Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{@from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
m_Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
}
victimState.OnGivenSilverTo( m_Placer );