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

@ -381,10 +381,8 @@ namespace Server.Engines.Plants
return;
}
else
{
m_Plant.LabelTo( from, message );
}
m_Plant.LabelTo( from, message );
}
from.SendGump( new MainPlantGump( m_Plant ) );

View file

@ -331,7 +331,8 @@ namespace Server.Items
item.MoveToWorld( new Point3D( x, y, Location.Z ), Map );
return true;
}
else if ( Map.CanFit( x, y, z, 1 ) )
if ( Map.CanFit( x, y, z, 1 ) )
{
item.MoveToWorld( new Point3D( x, y, z ), Map );
return true;
@ -355,7 +356,8 @@ namespace Server.Items
creature.Combatant = From;
return true;
}
else if ( Map.CanSpawnMobile( x, y, z ) )
if ( Map.CanSpawnMobile( x, y, z ) )
{
creature.MoveToWorld( new Point3D( x, y, z ), Map );
creature.Combatant = From;

View file

@ -70,8 +70,7 @@ namespace Server.Engines.Plants
{
if (m_Table.TryGetValue( plantHue, out PlantHueInfo info ))
return info;
else
return m_Table[PlantHue.Plain];
return m_Table[PlantHue.Plain];
}
public static PlantHue RandomFirstGeneration()

View file

@ -208,12 +208,11 @@ namespace Server.Engines.Plants
{
if ( m_PlantStatus >= PlantStatus.Plant )
return 1060812; // plant
else if ( m_PlantStatus >= PlantStatus.Sapling )
if ( m_PlantStatus >= PlantStatus.Sapling )
return 1023305; // sapling
else if ( m_PlantStatus >= PlantStatus.Seed )
if ( m_PlantStatus >= PlantStatus.Seed )
return 1060810; // seed
else
return 1026951; // dirt
return 1026951; // dirt
}
public int GetLocalizedContainerType()
@ -508,11 +507,9 @@ namespace Server.Engines.Plants
message = 1053065; // The plant is already soaked with this type of potion!
return false;
}
else
{
message = 1053067; // You pour the potion over the plant.
return true;
}
message = 1053067; // You pour the potion over the plant.
return true;
}
public override void Serialize( GenericWriter writer )

View file

@ -116,12 +116,11 @@ namespace Server.Engines.Plants
if ( perc < 33 )
return PlantHealth.Dying;
else if ( perc < 66 )
if ( perc < 66 )
return PlantHealth.Wilted;
else if ( perc < 100 )
if ( perc < 100 )
return PlantHealth.Healthy;
else
return PlantHealth.Vibrant;
return PlantHealth.Vibrant;
}
}
@ -261,8 +260,7 @@ namespace Server.Engines.Plants
{
if ( m_Pollinated )
return m_SeedType;
else
return m_Plant.PlantType;
return m_Plant.PlantType;
}
set => m_SeedType = value;
}
@ -273,8 +271,7 @@ namespace Server.Engines.Plants
{
if ( m_Pollinated )
return m_SeedHue;
else
return m_Plant.PlantHue;
return m_Plant.PlantHue;
}
set => m_SeedHue = value;
}
@ -346,12 +343,11 @@ namespace Server.Engines.Plants
{
if ( Water <= 1 )
return 1060826; // hard
else if ( Water <= 2 )
if ( Water <= 2 )
return 1060827; // soft
else if ( Water <= 3 )
if ( Water <= 3 )
return 1060828; // squishy
else
return 1060829; // sopping wet
return 1060829; // sopping wet
}
public int GetLocalizedHealth()

View file

@ -113,8 +113,7 @@ namespace Server.Engines.Plants
if ( index >= 0 && index < m_Table.Length )
return m_Table[index];
else
return m_Table[0];
return m_Table[0];
}
public static PlantType RandomFirstGeneration()
@ -206,20 +205,19 @@ namespace Server.Engines.Plants
if ( rand < 0.5 / exp4 )
return PlantType.CommonGreenBonsai;
else if ( rand < 1.0 / exp4 )
if ( rand < 1.0 / exp4 )
return PlantType.CommonPinkBonsai;
else if ( rand < (k1 * 0.5 + 1.0) / exp4 )
if ( rand < (k1 * 0.5 + 1.0) / exp4 )
return PlantType.UncommonGreenBonsai;
else if ( rand < exp1 / exp4 )
if ( rand < exp1 / exp4 )
return PlantType.UncommonPinkBonsai;
else if ( rand < (k2 * 0.5 + exp1) / exp4 )
if ( rand < (k2 * 0.5 + exp1) / exp4 )
return PlantType.RareGreenBonsai;
else if ( rand < exp2 / exp4 )
if ( rand < exp2 / exp4 )
return PlantType.RarePinkBonsai;
else if ( rand < exp3 / exp4 )
if ( rand < exp3 / exp4 )
return PlantType.ExceptionalBonsai;
else
return PlantType.ExoticBonsai;
return PlantType.ExoticBonsai;
}
public static bool IsCrossable( PlantType plantType )
@ -237,8 +235,7 @@ namespace Server.Engines.Plants
if ( firstIndex + 1 == secondIndex || firstIndex == secondIndex + 1 )
return Utility.RandomBool() ? first : second;
else
return (PlantType)( (firstIndex + secondIndex) / 2 );
return (PlantType)( (firstIndex + secondIndex) / 2 );
}
public static bool CanReproduce( PlantType plantType )
@ -261,8 +258,7 @@ namespace Server.Engines.Plants
if ( m_ContainsPlant )
return hueInfo.IsBright() ? 1060832 : 1060831; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~
else
return hueInfo.IsBright() ? 1061887 : 1061888; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ ~6_val~
return hueInfo.IsBright() ? 1061887 : 1061888; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ ~6_val~
}
public int GetPlantLabelFullGrown( PlantHueInfo hueInfo )
@ -272,8 +268,7 @@ namespace Server.Engines.Plants
if ( m_ContainsPlant )
return hueInfo.IsBright() ? 1061891 : 1061889; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~
else
return hueInfo.IsBright() ? 1061892 : 1061890; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~ plant
return hueInfo.IsBright() ? 1061892 : 1061890; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~ plant
}
public int GetPlantLabelDecorative( PlantHueInfo hueInfo )

View file

@ -109,25 +109,19 @@ namespace Server.Engines.Plants
args = $"#{title}\t#{typeInfo.Name}";
return typeInfo.GetSeedLabel( hueInfo );
}
else
{
args = $"#{title}";
return hueInfo.IsBright() ? 1060839 : 1060838; // [bright] ~1_val~ seed
}
args = $"#{title}";
return hueInfo.IsBright() ? 1060839 : 1060838; // [bright] ~1_val~ seed
}
else
if ( m_ShowType )
{
if ( m_ShowType )
{
args = $"{Amount}\t#{title}\t#{typeInfo.Name}";
return typeInfo.GetSeedLabelPlural( hueInfo );
}
else
{
args = $"{Amount}\t#{title}";
return hueInfo.IsBright() ? 1113491 : 1113490; // ~1_amount~ [bright] ~2_val~ seeds
}
args = $"{Amount}\t#{title}\t#{typeInfo.Name}";
return typeInfo.GetSeedLabelPlural( hueInfo );
}
args = $"{Amount}\t#{title}";
return hueInfo.IsBright() ? 1113491 : 1113490; // ~1_amount~ [bright] ~2_val~ seeds
}
public override void AddNameProperty( ObjectPropertyList list )