Come more cleanup before finishing for the day.

This commit is contained in:
Kamron Batman 2018-09-09 09:00:25 -07:00
parent d6c0bf2d4c
commit 067dca8393
6 changed files with 109 additions and 156 deletions

View file

@ -16,9 +16,7 @@ namespace Server
{
EventSink.ClientVersionReceived += new ClientVersionReceivedHandler( delegate( ClientVersionReceivedArgs args )
{
PlayerMobile pm = args.State.Mobile as PlayerMobile;
if ( pm != null )
if ( args.State.Mobile is PlayerMobile pm )
Timer.DelayCall( TimeSpan.Zero, pm.ResendBuffs );
} );
}
@ -79,9 +77,7 @@ namespace Server
m_Timer = Timer.DelayCall( length, new TimerCallback(
delegate
{
PlayerMobile pm = m as PlayerMobile;
if ( pm == null )
if ( !(m is PlayerMobile pm) )
return;
pm.RemoveBuff( this );
@ -150,25 +146,19 @@ namespace Server
#region Convenience Methods
public static void AddBuff( Mobile m, BuffInfo b )
{
PlayerMobile pm = m as PlayerMobile;
if ( pm != null )
if ( m is PlayerMobile pm )
pm.AddBuff( b );
}
public static void RemoveBuff( Mobile m, BuffInfo b )
{
PlayerMobile pm = m as PlayerMobile;
if ( pm != null )
if ( m is PlayerMobile pm )
pm.RemoveBuff( b );
}
public static void RemoveBuff( Mobile m, BuffIcon b )
{
PlayerMobile pm = m as PlayerMobile;
if ( pm != null )
if ( m is PlayerMobile pm )
pm.RemoveBuff( b );
}
#endregion