Fixes implicit ternary expressions
This commit is contained in:
parent
c85b0a740c
commit
ff26dfa375
345 changed files with 1905 additions and 2336 deletions
|
|
@ -209,15 +209,15 @@ namespace Server.Multis
|
|||
|
||||
if ( percent >= 1000 ) // 100.0%
|
||||
return ( HasRentedVendors || VendorInventories.Count > 0 ) ? DecayLevel.DemolitionPending : DecayLevel.Collapsed;
|
||||
else if ( percent >= 950 ) // 95.0% - 99.9%
|
||||
if ( percent >= 950 ) // 95.0% - 99.9%
|
||||
return DecayLevel.IDOC;
|
||||
else if ( percent >= 750 ) // 75.0% - 94.9%
|
||||
if ( percent >= 750 ) // 75.0% - 94.9%
|
||||
return DecayLevel.Greatly;
|
||||
else if ( percent >= 500 ) // 50.0% - 74.9%
|
||||
if ( percent >= 500 ) // 50.0% - 74.9%
|
||||
return DecayLevel.Fairly;
|
||||
else if ( percent >= 250 ) // 25.0% - 49.9%
|
||||
if ( percent >= 250 ) // 25.0% - 49.9%
|
||||
return DecayLevel.Somewhat;
|
||||
else if ( percent >= 005 ) // 00.5% - 24.9%
|
||||
if ( percent >= 005 ) // 00.5% - 24.9%
|
||||
return DecayLevel.Slightly;
|
||||
|
||||
return DecayLevel.LikeNew;
|
||||
|
|
@ -1108,37 +1108,37 @@ namespace Server.Multis
|
|||
|
||||
if ( !IsLockedDown( item ) )
|
||||
return true;
|
||||
else if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return true;
|
||||
else if ( item is Runebook )
|
||||
if ( item is Runebook )
|
||||
return true;
|
||||
else if ( item is ISecurable )
|
||||
if ( item is ISecurable )
|
||||
return HasSecureAccess( from, ((ISecurable)item).Level );
|
||||
else if ( item is Container )
|
||||
if ( item is Container )
|
||||
return IsCoOwner( from );
|
||||
else if ( item.Stackable )
|
||||
if ( item.Stackable )
|
||||
return true;
|
||||
else if ( item is BaseLight )
|
||||
if ( item is BaseLight )
|
||||
return IsFriend( from );
|
||||
else if ( item is PotionKeg )
|
||||
if ( item is PotionKeg )
|
||||
return IsFriend( from );
|
||||
else if ( item is BaseBoard )
|
||||
if ( item is BaseBoard )
|
||||
return true;
|
||||
else if ( item is Dices )
|
||||
if ( item is Dices )
|
||||
return true;
|
||||
else if ( item is RecallRune )
|
||||
if ( item is RecallRune )
|
||||
return true;
|
||||
else if ( item is TreasureMap )
|
||||
if ( item is TreasureMap )
|
||||
return true;
|
||||
else if ( item is Clock )
|
||||
if ( item is Clock )
|
||||
return true;
|
||||
else if ( item is BaseInstrument )
|
||||
if ( item is BaseInstrument )
|
||||
return true;
|
||||
else if ( item is Dyes || item is DyeTub )
|
||||
if ( item is Dyes || item is DyeTub )
|
||||
return true;
|
||||
else if ( item is VendorRentalContract )
|
||||
if ( item is VendorRentalContract )
|
||||
return true;
|
||||
else if ( item is RewardBrazier )
|
||||
if ( item is RewardBrazier )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -1473,8 +1473,7 @@ namespace Server.Multis
|
|||
{
|
||||
if ( wood )
|
||||
return new DarkWoodHouseDoor( facing );
|
||||
else
|
||||
return new MetalHouseDoor( facing );
|
||||
return new MetalHouseDoor( facing );
|
||||
}
|
||||
|
||||
public void AddDoor( BaseDoor door, int xoff, int yoff, int zoff )
|
||||
|
|
@ -1663,7 +1662,7 @@ namespace Server.Multis
|
|||
|
||||
houseName = ( m_House == null ? "an unnamed house" : m_House.Sign.GetName() );
|
||||
|
||||
Mobile houseOwner = ( m_House == null ? null : m_House.Owner );
|
||||
Mobile houseOwner = m_House?.Owner;
|
||||
|
||||
if ( houseOwner == null )
|
||||
owner = "nobody";
|
||||
|
|
@ -1709,7 +1708,7 @@ namespace Server.Multis
|
|||
{
|
||||
if ( !base.AllowSecureTrade( from, to, newOwner, accepted ) )
|
||||
return false;
|
||||
else if ( !accepted )
|
||||
if ( !accepted )
|
||||
return true;
|
||||
|
||||
if ( Deleted || m_House == null || m_House.Deleted || !m_House.IsOwner( from ) || !from.CheckAlive() || !to.CheckAlive() )
|
||||
|
|
@ -1758,7 +1757,7 @@ namespace Server.Multis
|
|||
{
|
||||
bool isValid = true;
|
||||
Item sign = m_Sign;
|
||||
Point3D p = ( sign == null ? Point3D.Zero : sign.GetWorldLocation() );
|
||||
Point3D p = sign?.GetWorldLocation() ?? Point3D.Zero;
|
||||
|
||||
if ( from.Map != Map || to.Map != Map )
|
||||
isValid = false;
|
||||
|
|
@ -2945,7 +2944,7 @@ namespace Server.Multis
|
|||
|
||||
if ( info.Item.Deleted )
|
||||
continue;
|
||||
else if ( info.Item is StrongBox )
|
||||
if ( info.Item is StrongBox )
|
||||
count += 1;
|
||||
else
|
||||
count += 125;
|
||||
|
|
@ -2970,7 +2969,7 @@ namespace Server.Multis
|
|||
|
||||
if ( info.Item.Deleted )
|
||||
continue;
|
||||
else if ( !(info.Item is StrongBox) )
|
||||
if ( !(info.Item is StrongBox) )
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -649,7 +649,8 @@ namespace Server.Multis
|
|||
|
||||
return;
|
||||
}
|
||||
else if ( !from.Alive )
|
||||
|
||||
if ( !from.Alive )
|
||||
{
|
||||
m_TillerMan?.Say( 502582 ); // You appear to be dead.
|
||||
|
||||
|
|
@ -765,7 +766,8 @@ namespace Server.Multis
|
|||
|
||||
return;
|
||||
}
|
||||
else if ( !e.Mobile.Alive )
|
||||
|
||||
if ( !e.Mobile.Alive )
|
||||
{
|
||||
m_TillerMan?.Say( 502582 ); // You appear to be dead.
|
||||
|
||||
|
|
@ -819,7 +821,8 @@ namespace Server.Multis
|
|||
|
||||
return;
|
||||
}
|
||||
else if ( !m.Alive )
|
||||
|
||||
if ( !m.Alive )
|
||||
{
|
||||
m_TillerMan?.Say( 502582 ); // You appear to be dead.
|
||||
|
||||
|
|
@ -940,21 +943,22 @@ namespace Server.Multis
|
|||
|
||||
return false;
|
||||
}
|
||||
else if ( MapItem == null || MapItem.Deleted )
|
||||
|
||||
if ( MapItem == null || MapItem.Deleted )
|
||||
{
|
||||
if ( message )
|
||||
TillerMan?.Say( 502513 ); // I have seen no map, sir.
|
||||
|
||||
return false;
|
||||
}
|
||||
else if ( Map != MapItem.Map || !Contains( MapItem.GetWorldLocation() ) )
|
||||
if ( Map != MapItem.Map || !Contains( MapItem.GetWorldLocation() ) )
|
||||
{
|
||||
if ( message )
|
||||
TillerMan?.Say( 502514 ); // The map is too far away from me, sir.
|
||||
|
||||
return false;
|
||||
}
|
||||
else if ( ( Map != Map.Trammel && Map != Map.Felucca ) || NextNavPoint < 0 || NextNavPoint >= MapItem.Pins.Count )
|
||||
if ( ( Map != Map.Trammel && Map != Map.Felucca ) || NextNavPoint < 0 || NextNavPoint >= MapItem.Pins.Count )
|
||||
{
|
||||
if ( message )
|
||||
TillerMan?.Say( 1042551 ); // I don't see that navpoint, sir.
|
||||
|
|
@ -1055,24 +1059,22 @@ namespace Server.Multis
|
|||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
if ( m_MoveTimer != null && Order != BoatOrder.Move )
|
||||
{
|
||||
if ( m_MoveTimer != null && Order != BoatOrder.Move )
|
||||
{
|
||||
m_MoveTimer.Stop();
|
||||
m_MoveTimer = null;
|
||||
}
|
||||
|
||||
m_TurnTimer?.Stop();
|
||||
|
||||
m_TurnTimer = new TurnTimer( this, offset );
|
||||
m_TurnTimer.Start();
|
||||
|
||||
if ( message )
|
||||
TillerMan?.Say( 501429 ); // Aye aye sir.
|
||||
|
||||
return true;
|
||||
m_MoveTimer.Stop();
|
||||
m_MoveTimer = null;
|
||||
}
|
||||
|
||||
m_TurnTimer?.Stop();
|
||||
|
||||
m_TurnTimer = new TurnTimer( this, offset );
|
||||
m_TurnTimer.Start();
|
||||
|
||||
if ( message )
|
||||
TillerMan?.Say( 501429 ); // Aye aye sir.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Turn( int offset, bool message )
|
||||
|
|
@ -1093,17 +1095,15 @@ namespace Server.Multis
|
|||
|
||||
return false;
|
||||
}
|
||||
else if ( SetFacing( (Direction)(((int)m_Facing + offset) & 0x7) ) )
|
||||
|
||||
if ( SetFacing( (Direction)(((int)m_Facing + offset) & 0x7) ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( message )
|
||||
m_TillerMan.Say( 501423 ); // Ar, can't turn sir.
|
||||
if ( message )
|
||||
m_TillerMan.Say( 501423 ); // Ar, can't turn sir.
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private class TurnTimer : Timer
|
||||
|
|
@ -1239,7 +1239,7 @@ namespace Server.Multis
|
|||
|
||||
if ( x >= 0 && x < newComponents.Width && y >= 0 && y < newComponents.Height && newComponents.Tiles[x][y].Length == 0 )
|
||||
continue;
|
||||
else if ( Contains( item ) )
|
||||
if ( Contains( item ) )
|
||||
continue;
|
||||
|
||||
eable.Free();
|
||||
|
|
@ -1303,10 +1303,9 @@ namespace Server.Multis
|
|||
{
|
||||
if ( m == Map.Ilshenar )
|
||||
return m_IlshWrap;
|
||||
else if ( m == Map.Tokuno )
|
||||
if ( m == Map.Tokuno )
|
||||
return m_TokunoWrap;
|
||||
else
|
||||
return m_BritWrap;
|
||||
return m_BritWrap;
|
||||
}
|
||||
|
||||
public Direction GetMovementFor( int x, int y, out int maxSpeed )
|
||||
|
|
@ -1390,20 +1389,18 @@ namespace Server.Multis
|
|||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
NextNavPoint = -1;
|
||||
|
||||
if ( message && Order == BoatOrder.Course )
|
||||
TillerMan?.Say( 502515 ); // The course is completed, sir.
|
||||
NextNavPoint = -1;
|
||||
|
||||
return false;
|
||||
}
|
||||
if ( message && Order == BoatOrder.Course )
|
||||
TillerMan?.Say( 502515 ); // The course is completed, sir.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( dir == Left || dir == BackwardLeft || dir == Backward )
|
||||
return Turn( -2, true );
|
||||
else if ( dir == Right || dir == BackwardRight )
|
||||
if ( dir == Right || dir == BackwardRight )
|
||||
return Turn( 2, true );
|
||||
|
||||
speed = Math.Min( Speed, maxSpeed );
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ namespace Server.Multis
|
|||
{
|
||||
return;
|
||||
}
|
||||
else if ( !IsChildOf( from.Backpack ) )
|
||||
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
|
@ -182,4 +183,4 @@ namespace Server.Multis
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,8 @@ namespace Server.Multis
|
|||
{
|
||||
return;
|
||||
}
|
||||
else if ( !IsChildOf( from.Backpack ) )
|
||||
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
|
@ -193,4 +194,4 @@ namespace Server.Multis
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,10 +201,8 @@ namespace Server.Items
|
|||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CanClose()
|
||||
|
|
|
|||
|
|
@ -101,7 +101,9 @@ namespace Server.Misc
|
|||
|
||||
return (id >= 168 && id <= 171)
|
||||
|| (id >= 310 && id <= 311);
|
||||
} else if ( surface is StaticTile ) {
|
||||
}
|
||||
|
||||
if ( surface is StaticTile ) {
|
||||
int id = ((StaticTile)surface).ID;
|
||||
|
||||
return (id >= 0x1796 && id <= 0x17B2);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace Server.Items
|
|||
m_Boat.BeginRename( from );
|
||||
else
|
||||
{
|
||||
m_Boat?.BeginDryDock( @from );
|
||||
m_Boat?.BeginDryDock( from );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,4 +115,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -648,7 +648,9 @@ namespace Server.Multis
|
|||
{
|
||||
if ( !m.CheckAlive() ) {
|
||||
return;
|
||||
} else if ( SpellHelper.CheckCombat( m ) ) {
|
||||
}
|
||||
|
||||
if ( SpellHelper.CheckCombat( m ) ) {
|
||||
m.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
|
||||
return;
|
||||
}
|
||||
|
|
@ -1063,8 +1065,7 @@ namespace Server.Multis
|
|||
|
||||
if ( mcl.Width >= 14 || mcl.Height >= 14 )
|
||||
return 4;
|
||||
else
|
||||
return 3;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1121,7 +1122,7 @@ namespace Server.Multis
|
|||
|
||||
if ( !roof && ( TileData.ItemTable[itemID].Flags & TileFlag.Roof ) != 0 )
|
||||
return false;
|
||||
else if ( roof && ( TileData.ItemTable[itemID].Flags & TileFlag.Roof ) == 0 )
|
||||
if ( roof && ( TileData.ItemTable[itemID].Flags & TileFlag.Roof ) == 0 )
|
||||
return false;
|
||||
|
||||
return Verification.IsItemValid( itemID );
|
||||
|
|
@ -1853,62 +1854,62 @@ namespace Server.Multis
|
|||
{
|
||||
if ( itemID >= 0x675 && itemID < 0x6F5 )
|
||||
return true;
|
||||
else if ( itemID >= 0x314 && itemID < 0x364 )
|
||||
if ( itemID >= 0x314 && itemID < 0x364 )
|
||||
return true;
|
||||
else if ( itemID >= 0x824 && itemID < 0x834 )
|
||||
if ( itemID >= 0x824 && itemID < 0x834 )
|
||||
return true;
|
||||
else if ( itemID >= 0x839 && itemID < 0x849 )
|
||||
if ( itemID >= 0x839 && itemID < 0x849 )
|
||||
return true;
|
||||
else if ( itemID >= 0x84C && itemID < 0x85C )
|
||||
if ( itemID >= 0x84C && itemID < 0x85C )
|
||||
return true;
|
||||
else if ( itemID >= 0x866 && itemID < 0x876 )
|
||||
if ( itemID >= 0x866 && itemID < 0x876 )
|
||||
return true;
|
||||
else if ( itemID >= 0x0E8 && itemID < 0x0F8 )
|
||||
if ( itemID >= 0x0E8 && itemID < 0x0F8 )
|
||||
return true;
|
||||
else if ( itemID >= 0x1FED && itemID < 0x1FFD )
|
||||
if ( itemID >= 0x1FED && itemID < 0x1FFD )
|
||||
return true;
|
||||
else if ( itemID >= 0x181D && itemID < 0x1829 )
|
||||
if ( itemID >= 0x181D && itemID < 0x1829 )
|
||||
return true;
|
||||
else if ( itemID >= 0x241F && itemID < 0x2421 )
|
||||
if ( itemID >= 0x241F && itemID < 0x2421 )
|
||||
return true;
|
||||
else if ( itemID >= 0x2423 && itemID < 0x2425 )
|
||||
if ( itemID >= 0x2423 && itemID < 0x2425 )
|
||||
return true;
|
||||
else if ( itemID >= 0x2A05 && itemID < 0x2A1D )
|
||||
if ( itemID >= 0x2A05 && itemID < 0x2A1D )
|
||||
return true;
|
||||
else if ( itemID >= 0x319C && itemID < 0x31B0 )
|
||||
if ( itemID >= 0x319C && itemID < 0x31B0 )
|
||||
return true;
|
||||
// ML doors
|
||||
else if ( itemID == 0x2D46 ||itemID == 0x2D48 || itemID == 0x2FE2 || itemID == 0x2FE4 )
|
||||
if ( itemID == 0x2D46 ||itemID == 0x2D48 || itemID == 0x2FE2 || itemID == 0x2FE4 )
|
||||
return true;
|
||||
else if ( itemID >= 0x2D63 && itemID < 0x2D70 )
|
||||
if ( itemID >= 0x2D63 && itemID < 0x2D70 )
|
||||
return true;
|
||||
else if ( itemID >= 0x319C && itemID < 0x31AF )
|
||||
if ( itemID >= 0x319C && itemID < 0x31AF )
|
||||
return true;
|
||||
else if ( itemID >= 0x367B && itemID < 0x369B )
|
||||
if ( itemID >= 0x367B && itemID < 0x369B )
|
||||
return true;
|
||||
// SA doors
|
||||
else if ( itemID >= 0x409B && itemID < 0x40A3 )
|
||||
if ( itemID >= 0x409B && itemID < 0x40A3 )
|
||||
return true;
|
||||
else if ( itemID >= 0x410C && itemID < 0x4114 )
|
||||
if ( itemID >= 0x410C && itemID < 0x4114 )
|
||||
return true;
|
||||
else if ( itemID >= 0x41C2 && itemID < 0x41CA )
|
||||
if ( itemID >= 0x41C2 && itemID < 0x41CA )
|
||||
return true;
|
||||
else if ( itemID >= 0x41CF && itemID < 0x41D7 )
|
||||
if ( itemID >= 0x41CF && itemID < 0x41D7 )
|
||||
return true;
|
||||
else if ( itemID >= 0x436E && itemID < 0x437E )
|
||||
if ( itemID >= 0x436E && itemID < 0x437E )
|
||||
return true;
|
||||
else if ( itemID >= 0x46DD && itemID < 0x46E5 )
|
||||
if ( itemID >= 0x46DD && itemID < 0x46E5 )
|
||||
return true;
|
||||
else if ( itemID >= 0x4D22 && itemID < 0x4D2A )
|
||||
if ( itemID >= 0x4D22 && itemID < 0x4D2A )
|
||||
return true;
|
||||
else if ( itemID >= 0x50C8 && itemID < 0x50D8 )
|
||||
if ( itemID >= 0x50C8 && itemID < 0x50D8 )
|
||||
return true;
|
||||
else if ( itemID >= 0x5142 && itemID < 0x514A )
|
||||
if ( itemID >= 0x5142 && itemID < 0x514A )
|
||||
return true;
|
||||
// TOL doors
|
||||
else if ( itemID >= 0x9AD7 && itemID < 0x9AE7 )
|
||||
if ( itemID >= 0x9AD7 && itemID < 0x9AE7 )
|
||||
return true;
|
||||
else if ( itemID >= 0x9B3C && itemID < 0x9B4C )
|
||||
if ( itemID >= 0x9B3C && itemID < 0x9B4C )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
if ( !@from.CheckAlive() || @from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
if ( !from.CheckAlive() || from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
|
|
@ -260,7 +260,7 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
if ( !@from.CheckAlive() || @from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
if ( !from.CheckAlive() || from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
if ( !m_Placed )
|
||||
|
|
@ -332,7 +332,7 @@ namespace Server.Items
|
|||
|
||||
public void PlacementWarning_Callback( Mobile from, bool okay, object state )
|
||||
{
|
||||
if ( !@from.CheckAlive() || @from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
if ( !from.CheckAlive() || from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
PreviewHouse prevHouse = (PreviewHouse)state;
|
||||
|
|
@ -447,7 +447,7 @@ namespace Server.Items
|
|||
|
||||
public bool OnPlacement( Mobile from, Point3D p )
|
||||
{
|
||||
if ( !@from.CheckAlive() || @from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
if ( !from.CheckAlive() || from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return false;
|
||||
|
||||
ArrayList toMove;
|
||||
|
|
@ -569,7 +569,8 @@ namespace Server.Items
|
|||
{
|
||||
return ((HousePlacementEntry)obj);
|
||||
}
|
||||
else if ( obj is ArrayList )
|
||||
|
||||
if ( obj is ArrayList )
|
||||
{
|
||||
ArrayList list = (ArrayList)obj;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue