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

@ -151,7 +151,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
m_Addon?.OnComponentUsed( this, @from );
m_Addon?.OnComponentUsed( this, from );
}
public void OnChop( Mobile from )

View file

@ -60,7 +60,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
m_Addon?.OnComponentUsed( this, @from );
m_Addon?.OnComponentUsed( this, from );
}
public override void OnLocationChange( Point3D old )
@ -71,7 +71,7 @@ namespace Server.Items
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
m_Addon?.GetContextMenuEntries( @from, list );
m_Addon?.GetContextMenuEntries( from, list );
}
public override void OnMapChange()

View file

@ -165,7 +165,8 @@ namespace Server.Items
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500598 ); // You are too far away from the archery butte to get an accurate shot.
return;
}
else if ( from.InRange( worldLoc, 4 ) )
if ( from.InRange( worldLoc, 4 ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500599 ); // You are too close to the target.
return;
@ -250,7 +251,7 @@ namespace Server.Items
if ( split )
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + area,
$"{@from.Name}\t{(isArrow ? "arrow" : "bolt")}");
$"{from.Name}\t{(isArrow ? "arrow" : "bolt")}");
}
else
{

View file

@ -168,7 +168,7 @@ namespace Server.Items
if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, ( c.Z == 0 ) ) )
return AddonFitResult.Blocked;
else if ( !BaseAddon.CheckHouse( from, p3D, map, c.ItemData.Height, ref house ) )
if ( !BaseAddon.CheckHouse( from, p3D, map, c.ItemData.Height, ref house ) )
return AddonFitResult.NotInHouse;
if ( c.NeedsWall )
@ -184,7 +184,7 @@ namespace Server.Items
if ( !map.CanFit( p3.X, p3.Y, p3.Z, ItemData.Height, false, true, ( Z == 0 ) ) )
return AddonFitResult.Blocked;
else if ( !BaseAddon.CheckHouse( from, p3, map, ItemData.Height, ref house ) )
if ( !BaseAddon.CheckHouse( from, p3, map, ItemData.Height, ref house ) )
return AddonFitResult.NotInHouse;
if ( NeedsWall )

View file

@ -77,7 +77,7 @@ namespace Server.Items
}
}
callback?.Invoke( this, @from, hue );
callback?.Invoke( this, from, hue );
}
private class SpinTimer : Timer

View file

@ -79,7 +79,7 @@ namespace Server.Items
}
}
callback?.Invoke( this, @from, hue );
callback?.Invoke( this, from, hue );
}
private class SpinTimer : Timer

View file

@ -22,7 +22,7 @@ namespace Server.Items
{
from.MoveToWorld( new Point3D( 5922, 2024, 0 ), map );
PublicOverheadMessage( MessageType.Regular, 0x3B2, true,
$"* {@from.Name} dives into the hole and disappears!*");
$"* {from.Name} dives into the hole and disappears!*");
}
}
else

View file

@ -87,7 +87,7 @@ namespace Server.Items
}
}
callback?.Invoke( this, @from, hue );
callback?.Invoke( this, from, hue );
}
private class SpinTimer : Timer

View file

@ -79,7 +79,7 @@ namespace Server.Items
}
}
callback?.Invoke( this, @from, hue );
callback?.Invoke( this, from, hue );
}
private class SpinTimer : Timer

View file

@ -110,8 +110,7 @@ namespace Server.Items
{
if ( ItemID == 0x3062 )
return new AquariumEastDeed();
else
return new AquariumNorthDeed();
return new AquariumNorthDeed();
}
}
@ -167,7 +166,7 @@ namespace Server.Items
{
if ( from == null || from.Deleted )
return false;
else if ( from.AccessLevel >= AccessLevel.GameMaster )
if ( from.AccessLevel >= AccessLevel.GameMaster )
return true;
BaseHouse house = BaseHouse.FindHouseAt( this );
@ -822,7 +821,7 @@ namespace Server.Items
if ( IsFull || m_LiveCreatures >= MaxLiveCreatures || fish.Dead )
{
@from?.SendLocalizedMessage( 1073633 ); // The aquarium can not hold the creature.
from?.SendLocalizedMessage( 1073633 ); // The aquarium can not hold the creature.
return false;
}
@ -832,7 +831,7 @@ namespace Server.Items
m_LiveCreatures += 1;
@from?.SendLocalizedMessage( 1073632, $"#{fish.LabelNumber}"); // You add the following creature to your aquarium: ~1_FISH~
from?.SendLocalizedMessage( 1073632, $"#{fish.LabelNumber}"); // You add the following creature to your aquarium: ~1_FISH~
InvalidateProperties();
return true;
@ -874,7 +873,7 @@ namespace Server.Items
#region Static members
public static FishBowl GetEmptyBowl( Mobile from )
{
if ( @from?.Backpack == null )
if ( from?.Backpack == null )
return null;
Item[] items = from.Backpack.FindItemsByType( typeof( FishBowl ) );

View file

@ -38,24 +38,20 @@ namespace Server.Items
Delete();
return;
}
else
if ( from.PlaceInBackpack( fish ) )
{
if ( from.PlaceInBackpack( fish ) )
{
from.PlaySound( 0x5A2 );
from.SendLocalizedMessage( 1074490 ); // A live creature flops around in your pack before running out of air.
from.PlaySound( 0x5A2 );
from.SendLocalizedMessage( 1074490 ); // A live creature flops around in your pack before running out of air.
fish.Kill();
Delete();
return;
}
else
{
fish.Delete();
from.SendLocalizedMessage( 1074488 ); // You could not hold the creature.
}
fish.Kill();
Delete();
return;
}
fish.Delete();
from.SendLocalizedMessage( 1074488 ); // You could not hold the creature.
}
InUse = false;

View file

@ -368,10 +368,9 @@ namespace Server.Items
{
if ( type == StatType.Str )
return StrBonus + Attributes.BonusStr;
else if ( type == StatType.Dex )
if ( type == StatType.Dex )
return DexBonus + Attributes.BonusDex;
else
return IntBonus + Attributes.BonusInt;
return IntBonus + Attributes.BonusInt;
}
[CommandProperty( AccessLevel.GameMaster )]
@ -1141,7 +1140,8 @@ namespace Server.Items
return false;
}
else if ( !AllowMaleWearer && !from.Female )
if ( !AllowMaleWearer && !from.Female )
{
if ( AllowFemaleWearer )
from.SendLocalizedMessage( 1010388 ); // Only females can wear this.
@ -1150,7 +1150,7 @@ namespace Server.Items
return false;
}
else if ( !AllowFemaleWearer && from.Female )
if ( !AllowFemaleWearer && from.Female )
{
if ( AllowMaleWearer )
from.SendLocalizedMessage( 1063343 ); // Only males can wear this.
@ -1159,27 +1159,25 @@ namespace Server.Items
return false;
}
else
{
int strBonus = ComputeStatBonus( StatType.Str ), strReq = ComputeStatReq( StatType.Str );
int dexBonus = ComputeStatBonus( StatType.Dex ), dexReq = ComputeStatReq( StatType.Dex );
int intBonus = ComputeStatBonus( StatType.Int ), intReq = ComputeStatReq( StatType.Int );
int strBonus = ComputeStatBonus( StatType.Str ), strReq = ComputeStatReq( StatType.Str );
int dexBonus = ComputeStatBonus( StatType.Dex ), dexReq = ComputeStatReq( StatType.Dex );
int intBonus = ComputeStatBonus( StatType.Int ), intReq = ComputeStatReq( StatType.Int );
if ( from.Dex < dexReq || (from.Dex + dexBonus) < 1 )
{
from.SendLocalizedMessage( 502077 ); // You do not have enough dexterity to equip this item.
return false;
}
else if ( from.Str < strReq || (from.Str + strBonus) < 1 )
{
from.SendLocalizedMessage( 500213 ); // You are not strong enough to equip that.
return false;
}
else if ( from.Int < intReq || (from.Int + intBonus) < 1 )
{
from.SendMessage( "You are not smart enough to equip that." );
return false;
}
if ( from.Dex < dexReq || (from.Dex + dexBonus) < 1 )
{
from.SendLocalizedMessage( 502077 ); // You do not have enough dexterity to equip this item.
return false;
}
if ( from.Str < strReq || (from.Str + strBonus) < 1 )
{
from.SendLocalizedMessage( 500213 ); // You are not strong enough to equip that.
return false;
}
if ( from.Int < intReq || (from.Int + intBonus) < 1 )
{
from.SendMessage( "You are not smart enough to equip that." );
return false;
}
}

View file

@ -163,10 +163,10 @@ namespace Server.Items
SaveFlags flags = SaveFlags.None;
if ( m_Title != ( content == null ? null : content.Title ) )
if ( m_Title != content?.Title )
flags |= SaveFlags.Title;
if ( m_Author != ( content == null ? null : content.Author ) )
if ( m_Author != content?.Author )
flags |= SaveFlags.Author;
if ( m_Writable )
@ -489,8 +489,8 @@ namespace Server.Items
{
public BookHeader( Mobile from, BaseBook book ) : base ( 0xD4 )
{
string title = book.Title == null ? "" : book.Title;
string author = book.Author == null ? "" : book.Author;
string title = book.Title ?? "";
string author = book.Author ?? "";
byte[] titleBuffer = Utility.UTF8.GetBytes( title );
byte[] authorBuffer = Utility.UTF8.GetBytes( author );

View file

@ -43,7 +43,8 @@ namespace Server.Items
{
return false;
}
else if ( a != b )
if ( a != b )
{
for ( int j = 0; j < a.Length; ++j )
{

View file

@ -191,7 +191,8 @@ namespace Server.Items
return false;
}
else if ( !AllowMaleWearer && !from.Female )
if ( !AllowMaleWearer && !from.Female )
{
if ( AllowFemaleWearer )
from.SendLocalizedMessage( 1010388 ); // Only females can wear this.
@ -200,7 +201,7 @@ namespace Server.Items
return false;
}
else if ( !AllowFemaleWearer && from.Female )
if ( !AllowFemaleWearer && from.Female )
{
if ( AllowMaleWearer )
from.SendLocalizedMessage( 1063343 ); // Only males can wear this.
@ -209,16 +210,13 @@ namespace Server.Items
return false;
}
else
{
int strBonus = ComputeStatBonus( StatType.Str );
int strReq = ComputeStatReq( StatType.Str );
int strBonus = ComputeStatBonus( StatType.Str );
int strReq = ComputeStatReq( StatType.Str );
if ( from.Str < strReq || (from.Str + strBonus) < 1 )
{
from.SendLocalizedMessage( 500213 ); // You are not strong enough to equip that.
return false;
}
if ( from.Str < strReq || (from.Str + strBonus) < 1 )
{
from.SendLocalizedMessage( 500213 ); // You are not strong enough to equip that.
return false;
}
}
@ -249,10 +247,9 @@ namespace Server.Items
{
if ( type == StatType.Str )
return BaseStrBonus + Attributes.BonusStr;
else if ( type == StatType.Dex )
if ( type == StatType.Dex )
return BaseDexBonus + Attributes.BonusDex;
else
return BaseIntBonus + Attributes.BonusInt;
return BaseIntBonus + Attributes.BonusInt;
}
public virtual void AddStatBonuses( Mobile parent )
@ -912,7 +909,7 @@ namespace Server.Items
{
if ( Deleted )
return false;
else if ( RootParent is Mobile && from != RootParent )
if ( RootParent is Mobile && from != RootParent )
return false;
Hue = sender.DyedHue;

View file

@ -83,8 +83,7 @@ namespace Server.Items
{
if ( m_House != null && m_Owner != null && !m_Owner.Deleted )
return !m_House.IsCoOwner( m_Owner );
else
return true;
return true;
}
}

View file

@ -300,10 +300,8 @@ namespace Server.Items
LockPick( from );
return false;
}
else
{
return base.CheckLocked( from );
}
return base.CheckLocked( from );
}
private List<Item> m_Lifted = new List<Item>();

View file

@ -105,7 +105,7 @@ namespace Server.Items
Mobile m = sender.Mobile;
TextRelay nameEntry = info.GetTextEntry( 0 );
string newName = ( nameEntry == null ? null : nameEntry.Text.Trim() );
string newName = nameEntry?.Text.Trim();
if ( !NameVerification.Validate( newName, 2, 16, true, false, true, 1, NameVerification.SpaceDashPeriodQuote ) )
@ -113,13 +113,11 @@ namespace Server.Items
m.SendMessage( "That name is unacceptable." );
return;
}
else
{
m.RawName = newName;
m.SendMessage( "Your name has been changed!" );
m.SendMessage($"You are now known as {newName}");
m_Sender.Delete();
}
m.RawName = newName;
m.SendMessage( "Your name has been changed!" );
m.SendMessage($"You are now known as {newName}");
m_Sender.Delete();
}
}
}

View file

@ -161,7 +161,7 @@ namespace Server.Items
{
if ( ItemID >= 0x995 && ItemID <= 0x999 )
return ItemID;
else if ( ItemID == 0x9CA )
if ( ItemID == 0x9CA )
return ItemID;
return 0x995;
@ -648,12 +648,11 @@ namespace Server.Items
if ( perc <= 0 )
return 1042975; // It's empty.
else if ( perc <= 33 )
if ( perc <= 33 )
return 1042974; // It's nearly empty.
else if ( perc <= 66 )
if ( perc <= 66 )
return 1042973; // It's half full.
else
return 1042972; // It's full.
return 1042972; // It's full.
}
public override void GetProperties( ObjectPropertyList list )

View file

@ -66,15 +66,13 @@ namespace Server.Items
Delete();
return false;
}
else if ( !IsChildOf( m_Board ) )
if ( !IsChildOf( m_Board ) )
{
m_Board.DropItem( this );
return false;
}
else
{
return true;
}
return true;
}
public override bool CanTarget => false;

View file

@ -33,7 +33,7 @@ namespace Server.Items
public void Roll( Mobile from )
{
PublicOverheadMessage( MessageType.Regular, 0, false,
$"*{@from.Name} rolls {Utility.Random(1, 6)}, {Utility.Random(1, 6)}*");
$"*{from.Name} rolls {Utility.Random(1, 6)}, {Utility.Random(1, 6)}*");
}
public override void Serialize( GenericWriter writer )
@ -48,4 +48,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -6,8 +6,7 @@ namespace Server.Engines.Mahjong
{
if ( direction == MahjongPieceDirection.Up || direction == MahjongPieceDirection.Down )
return new MahjongPieceDim( position, 40, 20 );
else
return new MahjongPieceDim( position, 20, 40 );
return new MahjongPieceDim( position, 20, 40 );
}
private MahjongGame m_Game;

View file

@ -25,7 +25,7 @@ namespace Server.Engines.Mahjong
m_Game.Players.SendGeneralPacket( true, true );
if ( from != null )
m_Game.Players.SendLocalizedMessage( 1062695, $"{@from.Name}\t{m_First}\t{m_Second}"); // ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~!
m_Game.Players.SendLocalizedMessage( 1062695, $"{from.Name}\t{m_First}\t{m_Second}"); // ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~!
}
public void Save( GenericWriter writer )

View file

@ -19,10 +19,8 @@ namespace Server.Engines.Mahjong
{
return m_SubCommandDelegates[cmd];
}
else
{
return null;
}
return null;
}
public static void Initialize()

View file

@ -35,8 +35,7 @@ namespace Server.Engines.Mahjong
{
if ( index < 0 || index >= m_Players.Length )
return null;
else
return m_Players[index];
return m_Players[index];
}
public int GetPlayerIndex( Mobile mobile )
@ -53,16 +52,14 @@ namespace Server.Engines.Mahjong
{
if ( Dealer != mobile )
return false;
else
return m_InGame[m_DealerPosition];
return m_InGame[m_DealerPosition];
}
public bool IsInGamePlayer( int index )
{
if ( index < 0 || index >= m_Players.Length || m_Players[index] == null )
return false;
else
return m_InGame[index];
return m_InGame[index];
}
public bool IsInGamePlayer( Mobile mobile )
@ -81,16 +78,14 @@ namespace Server.Engines.Mahjong
{
if ( index < 0 || index >= m_Scores.Length )
return 0;
else
return m_Scores[index];
return m_Scores[index];
}
public bool IsPublic( int index )
{
if ( index < 0 || index >= m_PublicHand.Length )
return false;
else
return m_PublicHand[index];
return m_PublicHand[index];
}
public void SetPublic( int index, bool value )
@ -264,10 +259,8 @@ namespace Server.Engines.Mahjong
return true;
}
else
{
return false;
}
return false;
}
private void AddPlayer( Mobile player, int index, bool sendJoinGame )
@ -378,7 +371,7 @@ namespace Server.Engines.Mahjong
to.Send( new MahjongPlayersInfo( m_Game, to ) );
}
SendLocalizedMessage( 1062774, $"{@from.Name}\t{to.Name}\t{amount}"); // ~1_giver~ gives ~2_receiver~ ~3_number~ points.
SendLocalizedMessage( 1062774, $"{from.Name}\t{to.Name}\t{amount}"); // ~1_giver~ gives ~2_receiver~ ~3_number~ points.
}
public void OpenSeat( int index )

View file

@ -6,8 +6,7 @@ namespace Server.Engines.Mahjong
{
if ( direction == MahjongPieceDirection.Up || direction == MahjongPieceDirection.Down )
return new MahjongPieceDim( position, 20, 30 );
else
return new MahjongPieceDim( position, 30, 20 );
return new MahjongPieceDim( position, 30, 20 );
}
private MahjongGame m_Game;

View file

@ -194,8 +194,8 @@ namespace Server.Items
PlayerState guildState = PlayerState.Find( m_Guild.Leader );
PlayerState targetState = PlayerState.Find( from );
Faction guildFaction = (guildState == null ? null : guildState.Faction);
Faction targetFaction = (targetState == null ? null : targetState.Faction);
Faction guildFaction = guildState?.Faction;
Faction targetFaction = targetState?.Faction;
if ( guildFaction != targetFaction || (targetState != null && targetState.IsLeaving) )
return;

View file

@ -59,8 +59,8 @@ namespace Server.Items
{
return m_End - DateTime.UtcNow;
}
else
return m_Duration;
return m_Duration;
}
set => m_Duration = value;

View file

@ -11,8 +11,7 @@ namespace Server.Items
{
if ( ItemID == 0x24C2 )
return 0x24C1;
else
return 0x24C3;
return 0x24C3;
}
}
@ -22,8 +21,7 @@ namespace Server.Items
{
if ( ItemID == 0x24C1 )
return 0x24C2;
else
return 0x24C4;
return 0x24C4;
}
}

View file

@ -11,8 +11,7 @@ namespace Server.Items
{
if ( ItemID == 0x9FB )
return 0x9FD;
else
return 0xA02;
return 0xA02;
}
}
@ -22,8 +21,7 @@ namespace Server.Items
{
if ( ItemID == 0x9FD )
return 0x9FB;
else
return 0xA00;
return 0xA00;
}
}

View file

@ -11,8 +11,7 @@ namespace Server.Items
{
if ( ItemID == 0xA05 )
return 0xA07;
else
return 0xA0C;
return 0xA0C;
}
}
@ -22,8 +21,7 @@ namespace Server.Items
{
if ( ItemID == 0xA07 )
return 0xA05;
else
return 0xA0A;
return 0xA0A;
}
}

View file

@ -11,8 +11,7 @@ namespace Server.Items
{
if ( ItemID == 0x24C6 )
return 0x24C5;
else
return 0x24C7;
return 0x24C7;
}
}
@ -22,8 +21,7 @@ namespace Server.Items
{
if ( ItemID == 0x24C5 )
return 0x24C6;
else
return 0x24C8;
return 0x24C8;
}
}

View file

@ -109,7 +109,7 @@ namespace Server.Items
{
if ( !ValidateEdit( from ) )
return;
else if ( m_Pins.Count >= MaxUserPins )
if ( m_Pins.Count >= MaxUserPins )
return;
Validate( ref x, ref y );
@ -137,7 +137,7 @@ namespace Server.Items
{
if ( !ValidateEdit( from ) )
return;
else if ( m_Pins.Count >= MaxUserPins )
if ( m_Pins.Count >= MaxUserPins )
return;
Validate( ref x, ref y );
@ -182,9 +182,9 @@ namespace Server.Items
{
if ( !from.CanSee( this ) || from.Map != Map || !from.Alive || InSecureTrade )
return false;
else if ( from.AccessLevel >= AccessLevel.GameMaster )
if ( from.AccessLevel >= AccessLevel.GameMaster )
return true;
else if ( !Movable || m_Protected || !from.InRange( GetWorldLocation(), 2 ) )
if ( !Movable || m_Protected || !from.InRange( GetWorldLocation(), 2 ) )
return false;
object root = RootParent;

View file

@ -802,13 +802,12 @@ namespace Server.Items
{
if ( m_Level == 6 )
return 1063453;
else
return 1041516 + m_Level;
return 1041516 + m_Level;
}
else if ( m_Level == 6 )
if ( m_Level == 6 )
return 1063452;
else
return 1041510 + m_Level;
return 1041510 + m_Level;
}
}

View file

@ -37,7 +37,7 @@ namespace Server.Items
if ( v < 16 )
return 16;
else if ( v > 24 )
if ( v > 24 )
return 24;
return v;

View file

@ -70,10 +70,9 @@ namespace Server.Items
if ( minutes != 0 && seconds != 0 )
return $"{minutes} minute{(minutes == 1 ? "" : "s")} and {seconds} second{(seconds == 1 ? "" : "s")}";
else if ( minutes != 0 )
if ( minutes != 0 )
return $"{minutes} minute{(minutes == 1 ? "" : "s")}";
else
return $"{seconds} second{(seconds == 1 ? "" : "s")}";
return $"{seconds} second{(seconds == 1 ? "" : "s")}";
}
public virtual void Cleanup()

View file

@ -33,7 +33,8 @@ namespace Server.Items
from.SendMessage( "You must have at least 60.0 skill in tinkering to construct a golem." );
return;
}
else if ( (from.Followers + 4) > from.FollowersMax )
if ( (from.Followers + 4) > from.FollowersMax )
{
from.SendLocalizedMessage( 1049607 ); // You have too many followers to control that creature.
return;
@ -126,4 +127,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -358,7 +358,7 @@ namespace Server.Items
if ( !Active )
return;
string text = $"{@from.Name} says {message}";
string text = $"{from.Name} says {message}";
if ( RootParent is Mobile mobile )
{

View file

@ -601,7 +601,7 @@ namespace Server.Items
writer.WriteDeltaTime( m_TimeOfDeath );
List<KeyValuePair<Item, Point3D>> list = ( m_RestoreTable == null ? null : new List<KeyValuePair<Item, Point3D>>( m_RestoreTable ) );
int count = ( list == null ? 0 : list.Count );
int count = list?.Count ?? 0;
writer.Write( count );
@ -971,7 +971,8 @@ namespace Server.Items
return false;
}
else if ( IsCriminalAction( from ) )
if ( IsCriminalAction( from ) )
{
if ( m_Owner == null || !m_Owner.Player )
from.SendLocalizedMessage( 1005036 ); // Looting this monster corpse will be a criminal act!

View file

@ -163,7 +163,7 @@ namespace Server.Items
if ( Map.CanSpawnMobile( new Point2D( x, y ), Z ) )
return new Point3D( x, y, Z );
else if ( Map.CanSpawnMobile( new Point2D( x, y ), z ) )
if ( Map.CanSpawnMobile( new Point2D( x, y ), z ) )
return new Point3D( x, y, z );
}

View file

@ -33,10 +33,9 @@ namespace Server.Items
{
if ( Amount <= 1 )
return 0x2E4;
else if ( Amount <= 5 )
if ( Amount <= 5 )
return 0x2E5;
else
return 0x2E6;
return 0x2E6;
}
protected override void OnAmountChange( int oldValue )

View file

@ -147,7 +147,8 @@ namespace Server.Items
Stop();
return;
}
else if ( !m_TargetMap.CanFit( m_Location, 16 ) )
if ( !m_TargetMap.CanFit( m_Location, 16 ) )
{
m_Stone.Movable = true;
m_Caster.AddToBackpack( m_Stone );

View file

@ -224,17 +224,18 @@ namespace Server.Items
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
return;
}
else if ( !from.InRange( board.GetWorldLocation(), 2 ) || !from.InLOS( board ) )
if ( !from.InRange( board.GetWorldLocation(), 2 ) || !from.InLOS( board ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
return;
}
else if ( !CheckAccess( house, from ) )
if ( !CheckAccess( house, from ) )
{
from.SendLocalizedMessage( 1062398 ); // You are not allowed to post to this bulletin board.
return;
}
else if ( m_Greeting && !house.IsOwner( from ) )
if ( m_Greeting && !house.IsOwner( from ) )
{
return;
}
@ -299,12 +300,13 @@ namespace Server.Items
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
return;
}
else if ( !from.InRange( board.GetWorldLocation(), 2 ) || !from.InLOS( board ) )
if ( !from.InRange( board.GetWorldLocation(), 2 ) || !from.InLOS( board ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
return;
}
else if ( !CheckAccess( house, from ) )
if ( !CheckAccess( house, from ) )
{
from.SendLocalizedMessage( 1062398 ); // You are not allowed to post to this bulletin board.
return;
@ -405,12 +407,13 @@ namespace Server.Items
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
return;
}
else if ( !from.InRange( board.GetWorldLocation(), 2 ) || !from.InLOS( board ) )
if ( !from.InRange( board.GetWorldLocation(), 2 ) || !from.InLOS( board ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
return;
}
else if ( !BasePlayerBB.CheckAccess( house, from ) )
if ( !BasePlayerBB.CheckAccess( house, from ) )
{
from.SendLocalizedMessage( 1062398 ); // You are not allowed to post to this bulletin board.
return;
@ -604,7 +607,7 @@ namespace Server.Items
AddHtml( 255, 180, 150, 20, message.Time.ToString( "yyyy-MM-dd HH:mm:ss" ), false, false );
Mobile poster = message.Poster;
string name = ( poster == null ? null : poster.Name );
string name = poster?.Name;
if ( name == null || (name = name.Trim()).Length == 0 )
name = "Someone";

View file

@ -61,26 +61,24 @@ namespace Server.Items
m.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
return false;
}
else if ( SpellHelper.CheckCombat( m ) )
if ( SpellHelper.CheckCombat( m ) )
{
m.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
return false;
}
else if ( m.Spell != null )
if ( m.Spell != null )
{
m.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
return false;
}
else
{
m.CloseGump( typeof( MoongateGump ) );
m.SendGump( new MoongateGump( m, this ) );
m.CloseGump( typeof( MoongateGump ) );
m.SendGump( new MoongateGump( m, this ) );
if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
Effects.PlaySound( m.Location, m.Map, 0x20E );
if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
Effects.PlaySound( m.Location, m.Map, 0x20E );
return true;
}
return true;
}
public override void Serialize( GenericWriter writer )
@ -366,7 +364,7 @@ namespace Server.Items
{
if ( info.ButtonID == 0 ) // Cancel
return;
else if ( m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null )
if ( m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null )
return;
int[] switches = info.Switches;

View file

@ -160,12 +160,13 @@ namespace Server.Items
{
return false;
}
else if (m_CriminalCheck && m.Criminal)
if (m_CriminalCheck && m.Criminal)
{
m.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
return false;
}
else if (m_CombatCheck && SpellHelper.CheckCombat(m))
if (m_CombatCheck && SpellHelper.CheckCombat(m))
{
m.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
return false;
@ -617,7 +618,8 @@ namespace Server.Items
int h = (int)Math.Round(ts.TotalHours);
return $"{h} hour{((h == 1) ? "" : "s")}";
}
else if (ts.TotalMinutes >= 1)
if (ts.TotalMinutes >= 1)
{
int m = (int)Math.Round(ts.TotalMinutes);
return $"{m} minute{((m == 1) ? "" : "s")}";
@ -653,10 +655,8 @@ namespace Server.Items
return;
}
else
{
info.Timer.Stop();
}
info.Timer.Stop();
}
if (m_StartMessage != null)

View file

@ -157,7 +157,8 @@ namespace Server.Items
return false;
}
else if ( checkItems )
if ( checkItems )
return false;
Item ammo = Ammo;

View file

@ -69,12 +69,11 @@ namespace Server.Items
if ( rand < 0.12 )
return 0x19B7;
else if ( rand < 0.18 )
if ( rand < 0.18 )
return 0x19B8;
else if ( rand < 0.25 )
if ( rand < 0.25 )
return 0x19BA;
else
return 0x19B9;
return 0x19B9;
}
public BaseOre( CraftResource resource ) : this( resource, 1 )

View file

@ -50,8 +50,7 @@ namespace Server.Items
if ( m != null )
return ( ( m.Skills[SkillName.Parry].Value * ar ) / 200.0 ) + 1.0;
else
return ar;
return ar;
}
}

View file

@ -251,8 +251,7 @@ namespace Server.Items
if ( ItemID == m_NorthID )
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 )

View file

@ -95,7 +95,8 @@ namespace Server.Items
from.SendLocalizedMessage( 1049048 ); // You cannot use your prospector tool on that.
return;
}
else if ( vein != defaultVein )
if ( vein != defaultVein )
{
from.SendLocalizedMessage( 1049049 ); // That ore looks to be prospected already.
return;

View file

@ -90,10 +90,10 @@ namespace Server.Items
public virtual bool TryCreateBoards( Mobile from, double skill, Item item )
{
if ( Deleted || !from.CanSee( this ) )
if ( Deleted || !from.CanSee( this ) )
return false;
else if ( from.Skills.Carpentry.Value < skill &&
from.Skills.Lumberjacking.Value < skill )
if ( from.Skills.Carpentry.Value < skill &&
from.Skills.Lumberjacking.Value < skill )
{
item.Delete();
from.SendLocalizedMessage( 1072652 ); // You cannot work this strange and unusual wood.
@ -107,7 +107,7 @@ namespace Server.Items
{
if ( !TryCreateBoards( from , 0, new Board() ) )
return false;
return true;
}
}
@ -118,7 +118,7 @@ namespace Server.Items
{
}
[Constructible]
public HeartwoodLog( int amount )
public HeartwoodLog( int amount )
: base( CraftResource.Heartwood, amount )
{
}
@ -352,4 +352,4 @@ namespace Server.Items
return true;
}
}
}
}

View file

@ -98,7 +98,7 @@ namespace Server.Items
public virtual void UseGate( Mobile m )
{
ClientFlags flags = m.NetState == null ? ClientFlags.None : m.NetState.Flags;
ClientFlags flags = m.NetState?.Flags ?? ClientFlags.None;
if ( Factions.Sigil.ExistsOn( m ) )
{

View file

@ -191,10 +191,6 @@ namespace Server.Items
pot.Delete();
}
}
else
{
// TODO: Target a bottle
}
}
else
{

View file

@ -315,7 +315,7 @@ namespace Server.Items
if ( (m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != from) && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) )
{
@from?.DoHarmful( m );
from?.DoHarmful( m );
AOS.Damage( m, from, m_Item.GetDamage(), 0, 100, 0, 0, 0 );
m.PlaySound( 0x208 );

View file

@ -104,7 +104,7 @@ namespace Server.Items
Spellbook book = Find( from, -1, type );
book?.DisplayTo( @from );
book?.DisplayTo( from );
}
private static void EventSink_CastSpellRequest( CastSpellRequestEventArgs e )
@ -150,17 +150,17 @@ namespace Server.Items
{
if ( spellID >= 0 && spellID < 64 )
return SpellbookType.Regular;
else if ( spellID >= 100 && spellID < 117 )
if ( spellID >= 100 && spellID < 117 )
return SpellbookType.Necromancer;
else if ( spellID >= 200 && spellID < 210 )
if ( spellID >= 200 && spellID < 210 )
return SpellbookType.Paladin;
else if ( spellID >= 400 && spellID < 406 )
if ( spellID >= 400 && spellID < 406 )
return SpellbookType.Samurai;
else if ( spellID >= 500 && spellID < 508 )
if ( spellID >= 500 && spellID < 508 )
return SpellbookType.Ninja;
else if ( spellID >= 600 && spellID < 617 )
if ( spellID >= 600 && spellID < 617 )
return SpellbookType.Arcanist;
else if ( spellID >= 677 && spellID < 693 )
if ( spellID >= 677 && spellID < 693 )
return SpellbookType.Mystic;
return SpellbookType.Invalid;
@ -333,7 +333,8 @@ namespace Server.Items
{
return false;
}
else if ( !from.CanBeginAction( typeof( BaseWeapon ) ) )
if ( !from.CanBeginAction( typeof( BaseWeapon ) ) )
{
return false;
}

View file

@ -205,16 +205,14 @@ namespace Server.Items
{
if ( !m.Player && (m.Body.IsMonster || m.Body.IsAnimal) )
return SkillName.Veterinary;
else
return SkillName.Healing;
return SkillName.Healing;
}
public static SkillName GetSecondarySkill( Mobile m )
{
if ( !m.Player && (m.Body.IsMonster || m.Body.IsAnimal) )
return SkillName.AnimalLore;
else
return SkillName.Anatomy;
return SkillName.Anatomy;
}
public void EndHeal()

View file

@ -158,7 +158,7 @@ namespace Server.Items
if ( skill >= 11 )
return (1062008 + skill-11);
else if ( skill >=5 )
if ( skill >=5 )
return (1061123 + skill-5);
switch( skill )

View file

@ -153,7 +153,7 @@ namespace Server.Items
}
else
{
@from?.SendLocalizedMessage( 502079 ); // The instrument played its last tune.
from?.SendLocalizedMessage( 502079 ); // The instrument played its last tune.
Delete();
}
@ -186,7 +186,7 @@ namespace Server.Items
if ( instrument != null )
{
callback?.Invoke( @from, instrument );
callback?.Invoke( from, instrument );
}
else
{

View file

@ -179,10 +179,8 @@ namespace Server.Items
{
return true;
}
else
{
from.SendLocalizedMessage(weapon.NoFreeHandMessage);
}
from.SendLocalizedMessage(weapon.NoFreeHandMessage);
}
else
{

View file

@ -112,11 +112,9 @@ namespace Server.Items
return allow;
}
else
{
from.SendLocalizedMessage( 1075209 ); // Only bandages may be dropped into the fountain.
return false;
}
from.SendLocalizedMessage( 1075209 ); // Only bandages may be dropped into the fountain.
return false;
}
public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
@ -130,11 +128,9 @@ namespace Server.Items
return allow;
}
else
{
from.SendLocalizedMessage( 1075209 ); // Only bandages may be dropped into the fountain.
return false;
}
from.SendLocalizedMessage( 1075209 ); // Only bandages may be dropped into the fountain.
return false;
}
public override void AddNameProperties( ObjectPropertyList list )

View file

@ -31,8 +31,7 @@ namespace Server.Items
if ( ItemID == 0x232C )
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 WreathAddonGump : Gump

View file

@ -188,18 +188,16 @@ namespace Server.Items
"This deed functions as a recall rune marked for the location of the plot it represents." +
"</bodytextblack>";
}
else
{
int daysLeft = (int)Math.Ceiling( ( deed.Stone.Started + deed.Stone.Duration + HouseRaffleStone.ExpirationTime - DateTime.UtcNow ).TotalDays );
return "<bodytextblack>" + "This deed entitles the bearer to build a house on the plot of land " +
$"located at {HouseRaffleStone.FormatLocation(deed.PlotLocation, deed.PlotFacet, false)} on the {deed.PlotFacet} facet.<br><br>" +
$"The deed will expire after {daysLeft} more day{((daysLeft == 1) ? "" : "s")} have passed, and at that time the right to place " +
"a house reverts to normal house construction rules.<br><br>" +
"This deed functions as a recall rune marked for the location of the plot it represents.<br><br>" +
"To place a house on the deeded plot, you must simply have this deed in your backpack " +
"or bank box when using a House Placement Tool there." + "</bodytextblack>";
}
int daysLeft = (int)Math.Ceiling( ( deed.Stone.Started + deed.Stone.Duration + HouseRaffleStone.ExpirationTime - DateTime.UtcNow ).TotalDays );
return "<bodytextblack>" + "This deed entitles the bearer to build a house on the plot of land " +
$"located at {HouseRaffleStone.FormatLocation(deed.PlotLocation, deed.PlotFacet, false)} on the {deed.PlotFacet} facet.<br><br>" +
$"The deed will expire after {daysLeft} more day{((daysLeft == 1) ? "" : "s")} have passed, and at that time the right to place " +
"a house reverts to normal house construction rules.<br><br>" +
"This deed functions as a recall rune marked for the location of the plot it represents.<br><br>" +
"To place a house on the deeded plot, you must simply have this deed in your backpack " +
"or bank box when using a House Placement Tool there." + "</bodytextblack>";
}
}
}

View file

@ -241,17 +241,16 @@ namespace Server.Gumps
if ( xIsNull && yIsNull )
return 0;
else if ( xIsNull )
if ( xIsNull )
return -1;
else if ( yIsNull )
if ( yIsNull )
return 1;
int result = Insensitive.Compare( x.From.Name, y.From.Name );
if ( result == 0 )
return x.Date.CompareTo( y.Date );
else
return result;
return result;
}
}
@ -270,9 +269,9 @@ namespace Server.Gumps
if ( xIsNull && yIsNull )
return 0;
else if ( xIsNull )
if ( xIsNull )
return -1;
else if ( yIsNull )
if ( yIsNull )
return 1;
Account a = x.From.Account as Account;
@ -280,17 +279,16 @@ namespace Server.Gumps
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;
int result = Insensitive.Compare( a.Username, b.Username );
if ( result == 0 )
return x.Date.CompareTo( y.Date );
else
return result;
return result;
}
}
@ -309,9 +307,9 @@ namespace Server.Gumps
if ( xIsNull && yIsNull )
return 0;
else if ( xIsNull )
if ( xIsNull )
return -1;
else if ( yIsNull )
if ( yIsNull )
return 1;
byte[] a = x.Address.GetAddressBytes();

View file

@ -362,7 +362,7 @@ namespace Server.Items
{
int x = m_Bounds.X + m_Bounds.Width / 2;
int y = m_Bounds.Y + m_Bounds.Height / 2;
int z = ( m_Facet == null ) ? 0 : m_Facet.GetAverageZ( x, y );
int z = m_Facet?.GetAverageZ( x, y ) ?? 0;
return new Point3D( x, y, z );
}
@ -379,8 +379,7 @@ namespace Server.Items
{
if ( m_TicketPrice == 0 )
return "FREE";
else
return $"{m_TicketPrice} gold";
return $"{m_TicketPrice} gold";
}
public override void GetProperties( ObjectPropertyList list )

View file

@ -54,7 +54,7 @@ namespace Server.Items
for ( int i = 0; i < pack.Items.Count; i++ )
{
if ( pack.Items[ i ] is PlagueBeastMainOrgan main && main.Complete )
main.FinishOpening( @from );
main.FinishOpening( from );
}
}

View file

@ -71,8 +71,8 @@ namespace Server.Items
scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071897 ); // You carefully cut into the organ.
return true;
}
else
scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071898 ); // You have already cut this organ open.
scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071898 ); // You have already cut this organ open.
}
return false;
@ -378,7 +378,8 @@ namespace Server.Items
AddComponent( new PlagueBeastBlood(), 47, 72 );
return true;
}
else if ( c.IsGland )
if ( c.IsGland )
{
m_Gland = null;
return true;

View file

@ -26,8 +26,8 @@ namespace Server.Items
scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071899 ); // You begin cutting through the vein.
return true;
}
else
scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071900 ); // // This vein has already been cut.
scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071900 ); // // This vein has already been cut.
}
return false;

View file

@ -247,76 +247,74 @@ namespace Server.Items
from.SendLocalizedMessage( 1054005 ); // The bracelet glows black. It must be charged before it can be used again.
return false;
}
else if ( from.FindItemOnLayer( Layer.Bracelet ) != this )
if ( from.FindItemOnLayer( Layer.Bracelet ) != this )
{
from.SendLocalizedMessage( 1054004 ); // You must equip the bracelet in order to use its power.
return false;
}
else if ( boundRoot?.NetState == null || boundRoot.FindItemOnLayer( Layer.Bracelet ) != bound )
if ( boundRoot?.NetState == null || boundRoot.FindItemOnLayer( Layer.Bracelet ) != bound )
{
from.SendLocalizedMessage( 1054006 ); // The bracelet emits a red glow. The bracelet's twin is not available for transport.
return false;
}
else if ( !Core.AOS && from.Map != boundRoot.Map )
if ( !Core.AOS && from.Map != boundRoot.Map )
{
from.SendLocalizedMessage( 1054014 ); // The bracelet glows black. The bracelet's target is on another facet.
return false;
}
else if ( Factions.Sigil.ExistsOn( from ) )
if ( Factions.Sigil.ExistsOn( from ) )
{
from.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
return false;
}
else if ( !SpellHelper.CheckTravel( from, TravelCheckType.RecallFrom ) )
if ( !SpellHelper.CheckTravel( from, TravelCheckType.RecallFrom ) )
{
return false;
}
else if ( !SpellHelper.CheckTravel( from, boundRoot.Map, boundRoot.Location, TravelCheckType.RecallTo ) )
if ( !SpellHelper.CheckTravel( from, boundRoot.Map, boundRoot.Location, TravelCheckType.RecallTo ) )
{
return false;
}
else if ( boundRoot.Map == Map.Felucca && from is PlayerMobile mobile && mobile.Young )
if ( boundRoot.Map == Map.Felucca && from is PlayerMobile mobile && mobile.Young )
{
mobile.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young.
return false;
}
else if ( from.Kills >= 5 && boundRoot.Map != Map.Felucca )
if ( from.Kills >= 5 && boundRoot.Map != Map.Felucca )
{
from.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
return false;
}
else if ( from.Criminal )
if ( from.Criminal )
{
from.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
return false;
}
else if ( SpellHelper.CheckCombat( from ) )
if ( SpellHelper.CheckCombat( from ) )
{
from.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
return false;
}
else if ( Misc.WeightOverloading.IsOverloaded( from ) )
if ( Misc.WeightOverloading.IsOverloaded( from ) )
{
from.SendLocalizedMessage( 502359, "", 0x22 ); // Thou art too encumbered to move.
return false;
}
else if ( from.Region.IsPartOf( typeof( Regions.Jail ) ) )
if ( from.Region.IsPartOf( typeof( Regions.Jail ) ) )
{
from.SendLocalizedMessage( 1114345, "", 0x35 ); // You'll need a better jailbreak plan than that!
return false;
}
else if ( boundRoot.Region.IsPartOf( typeof( Regions.Jail ) ) )
if ( boundRoot.Region.IsPartOf( typeof( Regions.Jail ) ) )
{
from.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
return false;
}
else
{
if ( successMessage )
from.SendLocalizedMessage( 1054015 ); // The bracelet's twin is available for transport.
if ( successMessage )
from.SendLocalizedMessage( 1054015 ); // The bracelet's twin is available for transport.
return true;
}
return true;
}
public void Bind( Mobile from )

View file

@ -162,52 +162,53 @@ namespace Server.Items
{
return false;
}
else if ( from.Map != Map || !from.InRange( GetWorldLocation(), 2 ) )
if ( from.Map != Map || !from.InRange( GetWorldLocation(), 2 ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
return false;
}
else if ( Account != null && ( !(from.Account is Account) || from.Account.Username != Account ) )
if ( Account != null && ( !(from.Account is Account) || from.Account.Username != Account ) )
{
from.SendLocalizedMessage( 1070714 ); // This is an Account Bound Soulstone, and your character is not bound to it. You cannot use this Soulstone.
return false;
}
else if ( CheckCombat( from, TimeSpan.FromMinutes( 2.0 ) ) )
if ( CheckCombat( from, TimeSpan.FromMinutes( 2.0 ) ) )
{
from.SendLocalizedMessage( 1070727 ); // You must wait two minutes after engaging in combat before you can use a Soulstone.
return false;
}
else if ( from.Criminal )
if ( from.Criminal )
{
from.SendLocalizedMessage( 1070728 ); // You must wait two minutes after committing a criminal act before you can use a Soulstone.
return false;
}
else if ( from.Region.GetLogoutDelay( from ) > TimeSpan.Zero )
if ( from.Region.GetLogoutDelay( from ) > TimeSpan.Zero )
{
from.SendLocalizedMessage( 1070729 ); // In order to use your Soulstone, you must be in a safe log-out location.
return false;
}
else if ( !from.Alive )
if ( !from.Alive )
{
from.SendLocalizedMessage( 1070730 ); // You may not use a Soulstone while your character is dead.
return false;
}
else if ( Factions.Sigil.ExistsOn( from ) )
if ( Factions.Sigil.ExistsOn( from ) )
{
from.SendLocalizedMessage( 1070731 ); // You may not use a Soulstone while your character has a faction town sigil.
return false;
}
else if ( from.Spell != null && from.Spell.IsCasting )
if ( from.Spell != null && from.Spell.IsCasting )
{
from.SendLocalizedMessage( 1070733 ); // You may not use a Soulstone while your character is casting a spell.
return false;
}
else if ( from.Poisoned )
if ( from.Poisoned )
{
from.SendLocalizedMessage( 1070734 ); // You may not use a Soulstone while your character is poisoned.
return false;
}
else if ( from.Paralyzed )
if ( from.Paralyzed )
{
from.SendLocalizedMessage( 1070735 ); // You may not use a Soulstone while your character is paralyzed.
return false;
@ -221,10 +222,7 @@ namespace Server.Items
}
#endregion
else
{
return true;
}
return true;
}
public override void OnDoubleClick( Mobile from )

View file

@ -60,8 +60,7 @@ namespace Server.Items
if ( index >= 0 && index < table.Length )
return table[index].Name.ToLower();
else
return "???";
return "???";
}
public virtual bool CanUse( Mobile from )

View file

@ -46,7 +46,7 @@ namespace Server.Items
public override void AddNameProperty(ObjectPropertyList list)
{
list.Add(m_LabelNumber, $"{((m_To != null) ? m_To : Unsigned)}\t{((m_From != null) ? m_From : Unsigned)}");
list.Add(m_LabelNumber, $"{m_To ?? Unsigned}\t{m_From ?? Unsigned}");
}
public override void OnSingleClick( Mobile from )
@ -54,7 +54,7 @@ namespace Server.Items
base.OnSingleClick( from );
LabelTo( from, m_LabelNumber,
$"{((m_To != null) ? m_To : Unsigned)}\t{((m_From != null) ? m_From : Unsigned)}");
$"{m_To ?? Unsigned}\t{m_From ?? Unsigned}");
}
public override void OnDoubleClick(Mobile from)

View file

@ -104,8 +104,7 @@ namespace Server.Items
if ( FacingSouth )
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
}
}

View file

@ -172,9 +172,9 @@ namespace Server.Items
{
if ( keg.Type == PotionEffect.ExplosionLesser )
return 5;
else if ( keg.Type == PotionEffect.Explosion )
if ( keg.Type == PotionEffect.Explosion )
return 10;
else if ( keg.Type == PotionEffect.ExplosionGreater )
if ( keg.Type == PotionEffect.ExplosionGreater )
return 15;
}

View file

@ -107,8 +107,7 @@ namespace Server.Items
if ( FacingSouth )
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
}
}

View file

@ -99,9 +99,9 @@ namespace Server.Items
if ( Type == StoneFaceTrapType.NorthWestWall )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ) && BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // north and west wall
else if ( Type == StoneFaceTrapType.NorthWall )
if ( Type == StoneFaceTrapType.NorthWall )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall
else if ( Type == StoneFaceTrapType.WestWall )
if ( Type == StoneFaceTrapType.WestWall )
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall
return false;

View file

@ -109,8 +109,7 @@ namespace Server.Items
if ( FacingSouth )
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
}
}

View file

@ -168,7 +168,7 @@ namespace Server.Items
public static WeaponEngravingTool Find( Mobile from )
{
return @from.Backpack?.FindItemByType( typeof( WeaponEngravingTool ) ) as WeaponEngravingTool;
return from.Backpack?.FindItemByType( typeof( WeaponEngravingTool ) ) as WeaponEngravingTool;
}
private class TargetWeapon : Target

View file

@ -818,8 +818,7 @@ namespace Server.Items
if (num > 14)
return new TalismanAttribute(m_Summons[num], m_SummonLabels[num], 10);
else
return new TalismanAttribute(m_Summons[num], m_SummonLabels[num]);
return new TalismanAttribute(m_Summons[num], m_SummonLabels[num]);
}
return new TalismanAttribute();

View file

@ -38,11 +38,8 @@ namespace Server.Items
{
if ( from.Mounted )
return true;
else
{
from.SendLocalizedMessage( 1070770 ); // You can only execute this attack while mounted!
ClearCurrentAbility( from );
}
from.SendLocalizedMessage( 1070770 ); // You can only execute this attack while mounted!
ClearCurrentAbility( from );
}
return false;

View file

@ -45,7 +45,7 @@ namespace Server.Items
if ( weapon != null && weapon.PrimaryAbility == this )
return 70.0;
else if ( weapon != null && weapon.SecondaryAbility == this )
if ( weapon != null && weapon.SecondaryAbility == this )
return 90.0;
return 200.0;

View file

@ -88,7 +88,8 @@ namespace Server.Items
from.LocalOverheadMessage( MessageType.Regular, 0x3E9, 1019045 ); // I can't reach that
return;
}
else if ( !IsAccessibleTo( from ) )
if ( !IsAccessibleTo( from ) )
{
PublicOverheadMessage( MessageType.Regular, 0x3E9, 1061637 ); // You are not allowed to access this.
return;

View file

@ -364,7 +364,7 @@ namespace Server.Items
if ( Core.ML )
return MlSpeed;
else if ( Core.AOS )
if ( Core.AOS )
return AosSpeed;
return OldSpeed;
@ -540,7 +540,8 @@ namespace Server.Items
m.SendLocalizedMessage( 500214 ); // You already have something in both hands.
return true;
}
else if ( Layer == Layer.OneHanded && layer == Layer.TwoHanded && !(item is BaseShield) && !(item is BaseEquipableLight) )
if ( Layer == Layer.OneHanded && layer == Layer.TwoHanded && !(item is BaseShield) && !(item is BaseEquipableLight) )
{
m.SendLocalizedMessage( 500215 ); // You can only wield one weapon at a time.
return true;
@ -1525,7 +1526,7 @@ namespace Server.Items
damageGiven = AOS.Damage( defender, attacker, damage, ignoreArmor, phys, fire, cold, pois, nrgy, chaos, direct, false, this is BaseRanged, false );
double propertyBonus = ( move == null ) ? 1.0 : move.GetPropertyBonus( attacker );
double propertyBonus = move?.GetPropertyBonus( attacker ) ?? 1.0;
if ( Core.AOS )
{
@ -1866,7 +1867,8 @@ namespace Server.Items
{
continue;
}
else if ( scalar < 1.0 )
if ( scalar < 1.0 )
{
damage *= ( 11 - from.GetDistanceToSqrt( m ) ) / 10;
}

View file

@ -56,8 +56,7 @@ namespace Server.Items
if ( wresValue > incrValue )
return wresValue;
else
return incrValue;
return incrValue;
}
private void CheckPreAOSMoves( Mobile attacker, Mobile defender )

View file

@ -91,12 +91,10 @@ namespace Server.Items
return GetDelay( attacker );
}
else
{
attacker.RevealingAction();
return TimeSpan.FromSeconds( 0.25 );
}
attacker.RevealingAction();
return TimeSpan.FromSeconds( 0.25 );
}
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1)