Removes redundant returns

This commit is contained in:
Kamron Batman 2018-09-14 15:40:02 -07:00
parent 06fa31a7bf
commit eeabc3d0e8
16 changed files with 77 additions and 106 deletions

View file

@ -33,7 +33,6 @@ namespace Server
op.WriteLine( "{0}\tPast IP limit threshold\t{1}", ip, DateTime.UtcNow );
e.AllowConnection = false;
return;
}
}
catch

View file

@ -41,10 +41,7 @@ namespace Server.Commands
{
BatchCommand bc = (BatchCommand)BatchCommands[i];
string commandString, argString;
string[] args;
bc.GetDetails( out commandString, out argString, out args );
bc.GetDetails( out string commandString, out string argString, out string[] args );
BaseCommand command = Scope.Commands[commandString];
@ -174,9 +171,7 @@ namespace Server.Commands
[Description( "Allows multiple commands to be run at the same time." )]
public static void Batch_OnCommand( CommandEventArgs e )
{
Batch batch = new Batch();
e.Mobile.SendGump( new BatchGump( e.Mobile, batch ) );
e.Mobile.SendGump( new BatchGump( e.Mobile, new Batch() ) );
}
}
@ -305,9 +300,7 @@ namespace Server.Commands
public override void OnResponse( NetState sender, RelayInfo info )
{
int type, index;
if ( !SplitButtonID( info.ButtonID, 1, out type, out index ) )
if ( !SplitButtonID( info.ButtonID, 1, out int type, out int index ) )
return;
TextRelay entry = info.GetTextEntry( 0 );
@ -405,9 +398,7 @@ namespace Server.Commands
public override void OnResponse( NetState sender, RelayInfo info )
{
int type, index;
if ( SplitButtonID( info.ButtonID, 1, out type, out index ) )
if ( SplitButtonID( info.ButtonID, 1, out int type, out int index ) )
{
switch ( type )
{

View file

@ -151,7 +151,6 @@ namespace Server.Engines.Quests.Samurai
player.AddToBackpack( armor );
obj.Complete();
return;
}
}
}

View file

@ -49,7 +49,6 @@ namespace Server.Items
{
Stop();
stew.Visible = true;
return;
}
}
}

View file

@ -335,7 +335,6 @@ namespace Server
public void OnSourceKilled()
{
return;
}
public void OnTargetKilled()

View file

@ -166,7 +166,6 @@ namespace Server.Guilds
{
guild.Charter = charter;
from.SendLocalizedMessage( 1070775 ); // You submit a new guild charter.
return;
}
}
@ -183,7 +182,6 @@ namespace Server.Guilds
{
guild.Website = site;
from.SendLocalizedMessage( 1070778 ); // You submit a new guild website.
return;
}
}
}

View file

@ -25,7 +25,6 @@ honor points on yourself?", true, false);
}
else
{
return;
}
}
}

View file

@ -325,7 +325,6 @@ namespace Server.Items
else if ( m_Map.m_Decoder != from && !m_Map.HasRequiredSkill( from ) )
{
from.SendLocalizedMessage( 503031 ); // You did not decode this map and have no clue where to look for the treasure.
return;
}
else if ( !from.CanBeginAction( typeof( TreasureMap ) ) )
{

View file

@ -1099,7 +1099,6 @@ namespace Server.Items
else
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
return;
}
}

View file

@ -90,7 +90,6 @@ namespace Server.Items
public override void OnChop( Mobile from )
{
from.SendLocalizedMessage( 500489 ); // You can't use an axe on that.
return;
}
public override void GetProperties( ObjectPropertyList list )

View file

@ -2659,7 +2659,6 @@ namespace Server.Mobiles
if (loc != Point3D.Zero)
{
m_Mobile.MoveToWorld(loc, se.Region.Map);
return;
}
}
}

View file

@ -130,7 +130,6 @@ namespace Server.Mobiles
SendLocalizedMessage(1112456);
break; // You cannot fly while recovering from a dismount maneuver.
}
return;
}
else if (Hits < 25) // TODO confirm
{

View file

@ -3519,7 +3519,6 @@ namespace Server.Multis
}
else if ( targeted is StaticTarget )
{
return;
}
else
{

View file

@ -180,7 +180,6 @@ namespace Server.Network {
}
length = (int)(pOutput - pOutputBuffer);
return;
}
}
}

View file

@ -891,7 +891,6 @@ namespace Server.Network {
Console.WriteLine( "Client: {0}: Disconnecting due to inactivity...", this );
Dispose();
return;
}
public static void TraceException( Exception ex ) {

View file

@ -205,8 +205,8 @@ namespace Server.Network
{
if ( packetID >= 0 && packetID < 0x100 )
return m_ExtendedHandlersLow[packetID];
PacketHandler handler;
m_ExtendedHandlersHigh.TryGetValue( packetID, out handler );
m_ExtendedHandlersHigh.TryGetValue( packetID, out PacketHandler handler );
return handler;
}
@ -230,8 +230,8 @@ namespace Server.Network
{
if ( packetID >= 0 && packetID < 0x100 )
return m_EncodedHandlersLow[packetID];
EncodedPacketHandler handler;
m_EncodedHandlersHigh.TryGetValue( packetID, out handler );
m_EncodedHandlersHigh.TryGetValue( packetID, out EncodedPacketHandler handler );
return handler;
}
@ -418,13 +418,14 @@ namespace Server.Network
return;
List<BuyItemResponse> buyList = new List<BuyItemResponse>( msgSize / 7 );
for ( ;msgSize>0;msgSize-=7)
while ( msgSize > 0 )
{
byte layer = pvSrc.ReadByte();
Serial serial = pvSrc.ReadInt32();
int amount = pvSrc.ReadInt16();
buyList.Add( new BuyItemResponse( serial, amount ) );
msgSize -= 7;
}
if ( buyList.Count > 0 && vendor is IVendor v && v.OnBuyItems( state.Mobile, buyList ) )
@ -768,9 +769,7 @@ namespace Server.Network
}
case 0x24: // Use skill
{
int skillIndex;
if ( !int.TryParse( command.Split( ' ' )[0], out skillIndex ) )
if ( !int.TryParse( command.Split( ' ' )[0], out int skillIndex ) )
break;
Skills.UseSkill( m, skillIndex );
@ -779,9 +778,7 @@ namespace Server.Network
}
case 0x43: // Open spellbook
{
int booktype;
if ( !int.TryParse( command, out booktype ) )
if ( !int.TryParse( command, out int booktype ) )
booktype = 1;
EventSink.InvokeOpenSpellbookRequest( new OpenSpellbookRequestEventArgs( m, booktype ) );
@ -1115,93 +1112,91 @@ namespace Server.Network
Target t = from.Target;
if ( t != null )
{
TargetProfile prof = TargetProfile.Acquire( t.GetType() );
if (t == null)
return;
prof?.Start();
TargetProfile prof = TargetProfile.Acquire( t.GetType() );
prof?.Start();
try {
if ( x == -1 && y == -1 && !serial.IsValid )
{
// User pressed escape
t.Cancel( from, TargetCancelType.Canceled );
}
else if ( Target.TargetIDValidation && t.TargetID != targetID )
{
// Sanity, prevent fake target
return;
}
else
{
object toTarget;
try {
if ( x == -1 && y == -1 && !serial.IsValid )
{
// User pressed escape
t.Cancel( from, TargetCancelType.Canceled );
}
else if ( Target.TargetIDValidation && t.TargetID != targetID )
{
// Sanity, prevent fake target
}
else
{
object toTarget;
if ( type == 1 )
if ( type == 1 )
{
if ( graphic == 0 )
{
if ( graphic == 0 )
toTarget = new LandTarget( new Point3D( x, y, z ), from.Map );
}
else
{
Map map = from.Map;
if ( map == null || map == Map.Internal )
{
toTarget = new LandTarget( new Point3D( x, y, z ), from.Map );
t.Cancel( from, TargetCancelType.Canceled );
return;
}
else
{
Map map = from.Map;
StaticTile[] tiles = map.Tiles.GetStaticTiles( x, y, !t.DisallowMultis );
if ( map == null || map == Map.Internal )
bool valid = false;
if ( state.HighSeas ) {
ItemData id = TileData.ItemTable[graphic&TileData.MaxItemValue];
if ( id.Surface ) {
z -= id.Height;
}
}
for ( int i = 0; !valid && i < tiles.Length; ++i )
{
if ( tiles[i].Z == z && tiles[i].ID == graphic )
valid = true;
}
if ( !valid )
{
t.Cancel( from, TargetCancelType.Canceled );
return;
}
else
{
StaticTile[] tiles = map.Tiles.GetStaticTiles( x, y, !t.DisallowMultis );
bool valid = false;
if ( state.HighSeas ) {
ItemData id = TileData.ItemTable[graphic&TileData.MaxItemValue];
if ( id.Surface ) {
z -= id.Height;
}
}
for ( int i = 0; !valid && i < tiles.Length; ++i )
{
if ( tiles[i].Z == z && tiles[i].ID == graphic )
valid = true;
}
if ( !valid )
{
t.Cancel( from, TargetCancelType.Canceled );
return;
}
else
{
toTarget = new StaticTarget( new Point3D( x, y, z ), graphic );
}
toTarget = new StaticTarget( new Point3D( x, y, z ), graphic );
}
}
}
else if ( serial.IsMobile )
{
toTarget = World.FindMobile( serial );
}
else if ( serial.IsItem )
{
toTarget = World.FindItem( serial );
}
else
{
t.Cancel( from, TargetCancelType.Canceled );
return;
}
t.Invoke( from, toTarget );
}
} finally
{
prof?.Finish();
else if ( serial.IsMobile )
{
toTarget = World.FindMobile( serial );
}
else if ( serial.IsItem )
{
toTarget = World.FindItem( serial );
}
else
{
t.Cancel( from, TargetCancelType.Canceled );
return;
}
t.Invoke( from, toTarget );
}
} finally
{
prof?.Finish();
}
}