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 ); op.WriteLine( "{0}\tPast IP limit threshold\t{1}", ip, DateTime.UtcNow );
e.AllowConnection = false; e.AllowConnection = false;
return;
} }
} }
catch catch

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -325,7 +325,6 @@ namespace Server.Items
else if ( m_Map.m_Decoder != from && !m_Map.HasRequiredSkill( from ) ) 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. 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 ) ) ) else if ( !from.CanBeginAction( typeof( TreasureMap ) ) )
{ {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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