Fixes implicit ternary expressions
This commit is contained in:
parent
c85b0a740c
commit
ff26dfa375
345 changed files with 1905 additions and 2336 deletions
|
|
@ -392,7 +392,7 @@ namespace Server
|
|||
|
||||
if ( delta < 0 )
|
||||
return false;
|
||||
else if ( delta == 0 )
|
||||
if ( delta == 0 )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ namespace Server.Items
|
|||
|
||||
if ( ItemID == 0x2375 )
|
||||
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // North wall
|
||||
else
|
||||
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // West wall
|
||||
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // West wall
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
@ -108,16 +107,12 @@ namespace Server.Items
|
|||
Hue = sender.DyedHue;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private class MistletoeAddonGump : Gump
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ namespace Server.Guilds
|
|||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
AllianceChat( from, (pm == null) ? 0x3B2 : pm.AllianceMessageHue, text );
|
||||
AllianceChat( from, pm?.AllianceMessageHue ?? 0x3B2, text );
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
@ -519,16 +519,16 @@ namespace Server.Guilds
|
|||
{
|
||||
if ( m_Kills > w.m_Kills )
|
||||
return WarStatus.Win;
|
||||
else if ( m_Kills < w.m_Kills )
|
||||
if ( m_Kills < w.m_Kills )
|
||||
return WarStatus.Lose;
|
||||
else
|
||||
return WarStatus.Draw;
|
||||
return WarStatus.Draw;
|
||||
}
|
||||
else if ( m_MaxKills > 0 )
|
||||
|
||||
if ( m_MaxKills > 0 )
|
||||
{
|
||||
if ( m_Kills >= m_MaxKills )
|
||||
return WarStatus.Win;
|
||||
else if ( w.m_Kills >= w.MaxKills )
|
||||
if ( w.m_Kills >= w.MaxKills )
|
||||
return WarStatus.Lose;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -378,10 +378,9 @@ namespace Server
|
|||
{
|
||||
if ( Core.ML )
|
||||
return Construct( m_NewWandTypes ) as BaseWand;
|
||||
else if ( Core.AOS )
|
||||
if ( Core.AOS )
|
||||
return Construct( m_WandTypes, m_NewWandTypes ) as BaseWand;
|
||||
else
|
||||
return Construct( m_OldWandTypes, m_WandTypes, m_NewWandTypes ) as BaseWand;
|
||||
return Construct( m_OldWandTypes, m_WandTypes, m_NewWandTypes ) as BaseWand;
|
||||
}
|
||||
|
||||
public static BaseClothing RandomClothing()
|
||||
|
|
|
|||
|
|
@ -594,18 +594,15 @@ namespace Server
|
|||
|
||||
if ( 50 > rnd )
|
||||
return 1;
|
||||
else
|
||||
rnd -= 50;
|
||||
rnd -= 50;
|
||||
|
||||
if ( 25 > rnd )
|
||||
return 2;
|
||||
else
|
||||
rnd -= 25;
|
||||
rnd -= 25;
|
||||
|
||||
if ( 14 > rnd )
|
||||
return 3;
|
||||
else
|
||||
rnd -= 14;
|
||||
rnd -= 14;
|
||||
|
||||
if ( 8 > rnd )
|
||||
return 4;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Server.Misc
|
|||
{
|
||||
if ( m.Guild == null )
|
||||
return GuildStatus.None;
|
||||
else if ( ((Guild)m.Guild).Enemies.Count == 0 && m.Guild.Type == GuildType.Regular )
|
||||
if ( ((Guild)m.Guild).Enemies.Count == 0 && m.Guild.Type == GuildType.Regular )
|
||||
return GuildStatus.Peaceful;
|
||||
|
||||
return GuildStatus.Waring;
|
||||
|
|
|
|||
|
|
@ -94,10 +94,9 @@ namespace Server.Misc
|
|||
{
|
||||
if ( hue < 1002 )
|
||||
return 1002;
|
||||
else if ( hue > 1058 )
|
||||
if ( hue > 1058 )
|
||||
return 1058;
|
||||
else
|
||||
return hue;
|
||||
return hue;
|
||||
}
|
||||
|
||||
public override int RandomSkinHue()
|
||||
|
|
@ -109,10 +108,9 @@ namespace Server.Misc
|
|||
{
|
||||
if ( hue < 1102 )
|
||||
return 1102;
|
||||
else if ( hue > 1149 )
|
||||
if ( hue > 1149 )
|
||||
return 1149;
|
||||
else
|
||||
return hue;
|
||||
return hue;
|
||||
}
|
||||
|
||||
public override int RandomHairHue()
|
||||
|
|
@ -226,63 +224,56 @@ namespace Server.Misc
|
|||
|
||||
public override bool ValidateHair(bool female, int itemID)
|
||||
{
|
||||
if (female == false)
|
||||
if (female == false)
|
||||
{
|
||||
return itemID >= 0x4258 && itemID <= 0x425F;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ((itemID == 0x4261 || itemID == 0x4262) || (itemID >= 0x4273 && itemID <= 0x4275) || (itemID == 0x42B0 || itemID == 0x42B1) || (itemID == 0x42AA || itemID == 0x42AB));
|
||||
}
|
||||
|
||||
return ((itemID == 0x4261 || itemID == 0x4262) || (itemID >= 0x4273 && itemID <= 0x4275) || (itemID == 0x42B0 || itemID == 0x42B1) || (itemID == 0x42AA || itemID == 0x42AB));
|
||||
}
|
||||
|
||||
public override int RandomHair(bool female)
|
||||
{
|
||||
if (Utility.Random(9) == 0)
|
||||
return 0;
|
||||
else if (!female)
|
||||
return 0x4258 + Utility.Random(8);
|
||||
else
|
||||
{
|
||||
switch (Utility.Random(9))
|
||||
{
|
||||
case 0:
|
||||
return 0x4261;
|
||||
case 1:
|
||||
return 0x4262;
|
||||
case 2:
|
||||
return 0x4273;
|
||||
case 3:
|
||||
return 0x4274;
|
||||
case 4:
|
||||
return 0x4275;
|
||||
case 5:
|
||||
return 0x42B0;
|
||||
case 6:
|
||||
return 0x42B1;
|
||||
case 7:
|
||||
return 0x42AA;
|
||||
case 8:
|
||||
return 0x42AB;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (!female)
|
||||
return 0x4258 + Utility.Random(8);
|
||||
switch (Utility.Random(9))
|
||||
{
|
||||
case 0:
|
||||
return 0x4261;
|
||||
case 1:
|
||||
return 0x4262;
|
||||
case 2:
|
||||
return 0x4273;
|
||||
case 3:
|
||||
return 0x4274;
|
||||
case 4:
|
||||
return 0x4275;
|
||||
case 5:
|
||||
return 0x42B0;
|
||||
case 6:
|
||||
return 0x42B1;
|
||||
case 7:
|
||||
return 0x42AA;
|
||||
case 8:
|
||||
return 0x42AB;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override bool ValidateFacialHair(bool female, int itemID)
|
||||
{
|
||||
if (female)
|
||||
if (female)
|
||||
return false;
|
||||
else
|
||||
return itemID >= 0x42AD && itemID <= 0x42B0;
|
||||
return itemID >= 0x42AD && itemID <= 0x42B0;
|
||||
}
|
||||
|
||||
public override int RandomFacialHair(bool female)
|
||||
{
|
||||
if (female)
|
||||
if (female)
|
||||
return 0;
|
||||
else
|
||||
return Utility.RandomList(0, 0x42AD, 0x42AE, 0x42AF, 0x42B0);
|
||||
return Utility.RandomList(0, 0x42AD, 0x42AE, 0x42AF, 0x42B0);
|
||||
}
|
||||
|
||||
// Todo Finish body hues
|
||||
|
|
|
|||
|
|
@ -630,7 +630,7 @@ namespace Server.Items
|
|||
{
|
||||
CraftResourceInfo info = GetInfo( resource );
|
||||
|
||||
return ( info == null ? 0 : info.Number );
|
||||
return info?.Number ?? 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -640,7 +640,7 @@ namespace Server.Items
|
|||
{
|
||||
CraftResourceInfo info = GetInfo( resource );
|
||||
|
||||
return ( info == null ? 0 : info.Hue );
|
||||
return info?.Hue ?? 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -660,30 +660,30 @@ namespace Server.Items
|
|||
{
|
||||
if ( info.Name.IndexOf( "Spined" ) >= 0 )
|
||||
return CraftResource.SpinedLeather;
|
||||
else if ( info.Name.IndexOf( "Horned" ) >= 0 )
|
||||
if ( info.Name.IndexOf( "Horned" ) >= 0 )
|
||||
return CraftResource.HornedLeather;
|
||||
else if ( info.Name.IndexOf( "Barbed" ) >= 0 )
|
||||
if ( info.Name.IndexOf( "Barbed" ) >= 0 )
|
||||
return CraftResource.BarbedLeather;
|
||||
else if ( info.Name.IndexOf( "Leather" ) >= 0 )
|
||||
if ( info.Name.IndexOf( "Leather" ) >= 0 )
|
||||
return CraftResource.RegularLeather;
|
||||
|
||||
if ( info.Level == 0 )
|
||||
return CraftResource.Iron;
|
||||
else if ( info.Level == 1 )
|
||||
if ( info.Level == 1 )
|
||||
return CraftResource.DullCopper;
|
||||
else if ( info.Level == 2 )
|
||||
if ( info.Level == 2 )
|
||||
return CraftResource.ShadowIron;
|
||||
else if ( info.Level == 3 )
|
||||
if ( info.Level == 3 )
|
||||
return CraftResource.Copper;
|
||||
else if ( info.Level == 4 )
|
||||
if ( info.Level == 4 )
|
||||
return CraftResource.Bronze;
|
||||
else if ( info.Level == 5 )
|
||||
if ( info.Level == 5 )
|
||||
return CraftResource.Gold;
|
||||
else if ( info.Level == 6 )
|
||||
if ( info.Level == 6 )
|
||||
return CraftResource.Agapite;
|
||||
else if ( info.Level == 7 )
|
||||
if ( info.Level == 7 )
|
||||
return CraftResource.Verite;
|
||||
else if ( info.Level == 8 )
|
||||
if ( info.Level == 8 )
|
||||
return CraftResource.Valorite;
|
||||
|
||||
return CraftResource.None;
|
||||
|
|
@ -699,11 +699,11 @@ namespace Server.Items
|
|||
{
|
||||
if ( info.Level == 0 )
|
||||
return CraftResource.RegularLeather;
|
||||
else if ( info.Level == 1 )
|
||||
if ( info.Level == 1 )
|
||||
return CraftResource.SpinedLeather;
|
||||
else if ( info.Level == 2 )
|
||||
if ( info.Level == 2 )
|
||||
return CraftResource.HornedLeather;
|
||||
else if ( info.Level == 3 )
|
||||
if ( info.Level == 3 )
|
||||
return CraftResource.BarbedLeather;
|
||||
|
||||
return CraftResource.None;
|
||||
|
|
|
|||
|
|
@ -157,16 +157,15 @@ namespace Server.Misc
|
|||
|
||||
if ( Utility.IPMatch( "192.168.*", ip ) )
|
||||
return true;
|
||||
else if ( Utility.IPMatch( "10.*", ip ) )
|
||||
if ( Utility.IPMatch( "10.*", ip ) )
|
||||
return true;
|
||||
else if ( Utility.IPMatch( "172.16-31.*", ip ) )
|
||||
if ( Utility.IPMatch( "172.16-31.*", ip ) )
|
||||
return true;
|
||||
else if ( Utility.IPMatch( "169.254.*", ip ) )
|
||||
if ( Utility.IPMatch( "169.254.*", ip ) )
|
||||
return true;
|
||||
else if ( Utility.IPMatch( "100.64-127.*", ip ) )
|
||||
if ( Utility.IPMatch( "100.64-127.*", ip ) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static IPAddress FindPublicAddress()
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ namespace Server.Misc
|
|||
|
||||
if ( value < minSkill )
|
||||
return false; // Too difficult
|
||||
else if ( value >= maxSkill )
|
||||
if ( value >= maxSkill )
|
||||
return true; // No challenge
|
||||
|
||||
double chance = (value - minSkill) / (maxSkill - minSkill);
|
||||
|
|
@ -108,7 +108,7 @@ namespace Server.Misc
|
|||
|
||||
if ( chance < 0.0 )
|
||||
return false; // Too difficult
|
||||
else if ( chance >= 1.0 )
|
||||
if ( chance >= 1.0 )
|
||||
return true; // No challenge
|
||||
|
||||
Point2D loc = new Point2D( from.Location.X / LocationSize, from.Location.Y / LocationSize );
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Server
|
|||
{
|
||||
if ( m_Number > 0 )
|
||||
return string.Concat( "#", m_Number.ToString() );
|
||||
else if ( m_String != null )
|
||||
if ( m_String != null )
|
||||
return m_String;
|
||||
|
||||
return "";
|
||||
|
|
@ -48,7 +48,7 @@ namespace Server
|
|||
{
|
||||
if ( m_Number > 0 )
|
||||
return string.Format( "{0} (0x{0:X})", m_Number );
|
||||
else if ( m_String != null )
|
||||
if ( m_String != null )
|
||||
return $"\"{m_String}\"";
|
||||
|
||||
return propsGump ? "-empty-" : "empty";
|
||||
|
|
@ -58,7 +58,7 @@ namespace Server
|
|||
{
|
||||
if ( m_Number > 0 )
|
||||
return m_Number.ToString();
|
||||
else if ( m_String != null )
|
||||
if ( m_String != null )
|
||||
return m_String;
|
||||
|
||||
return "";
|
||||
|
|
@ -208,8 +208,7 @@ namespace Server
|
|||
|
||||
if ( isInteger )
|
||||
return new TextDefinition( i );
|
||||
else
|
||||
return new TextDefinition( value );
|
||||
return new TextDefinition( value );
|
||||
}
|
||||
|
||||
public static bool IsNullOrEmpty( TextDefinition def )
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ namespace Server
|
|||
|
||||
if ( (landFlags & TileFlag.Impassable) != 0 && topZ > z && (z + 16) > lowZ )
|
||||
return false;
|
||||
else if ( (landFlags & TileFlag.Impassable) == 0 && z == avgZ && !lt.Ignored )
|
||||
if ( (landFlags & TileFlag.Impassable) == 0 && z == avgZ && !lt.Ignored )
|
||||
hasSurface = true;
|
||||
|
||||
StaticTile[] staticTiles = map.Tiles.GetStaticTiles( x, y );
|
||||
|
|
@ -478,7 +478,7 @@ namespace Server
|
|||
|
||||
if ( (surface || impassable) && (staticTiles[i].Z + id.CalcHeight) > z && (z + 16) > staticTiles[i].Z )
|
||||
return false;
|
||||
else if ( surface && !impassable && z == (staticTiles[i].Z + id.CalcHeight) )
|
||||
if ( surface && !impassable && z == (staticTiles[i].Z + id.CalcHeight) )
|
||||
hasSurface = true;
|
||||
}
|
||||
|
||||
|
|
@ -497,7 +497,7 @@ namespace Server
|
|||
|
||||
if ( (surface || impassable) && (item.Z + id.CalcHeight) > z && (z + 16) > item.Z )
|
||||
return false;
|
||||
else if ( surface && !impassable && z == (item.Z + id.CalcHeight) )
|
||||
if ( surface && !impassable && z == (item.Z + id.CalcHeight) )
|
||||
hasSurface = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue