Fixes casting checks
This commit is contained in:
parent
7ea00fbf4f
commit
03dd5f1926
431 changed files with 5616 additions and 6250 deletions
|
|
@ -21,10 +21,8 @@ namespace Server.Commands
|
|||
|
||||
public static void OnLogin( LoginEventArgs e )
|
||||
{
|
||||
if ( e.Mobile is PlayerMobile )
|
||||
if ( e.Mobile is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)e.Mobile;
|
||||
|
||||
pm.VisibilityList.Clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -44,9 +42,8 @@ namespace Server.Commands
|
|||
[Description( "Shows the names of everyone in your visibility list." )]
|
||||
public static void VisList_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
if ( e.Mobile is PlayerMobile )
|
||||
if ( e.Mobile is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)e.Mobile;
|
||||
List<Mobile> list = pm.VisibilityList;
|
||||
|
||||
if ( list.Count > 0 )
|
||||
|
|
@ -67,11 +64,10 @@ namespace Server.Commands
|
|||
[Description( "Removes everyone from your visibility list." )]
|
||||
public static void VisClear_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
if ( e.Mobile is PlayerMobile )
|
||||
if ( e.Mobile is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)e.Mobile;
|
||||
List<Mobile> list = new List<Mobile>( pm.VisibilityList );
|
||||
|
||||
|
||||
pm.VisibilityList.Clear();
|
||||
pm.SendMessage( "Your visibility list has been cleared." );
|
||||
|
||||
|
|
@ -93,24 +89,21 @@ namespace Server.Commands
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( from is PlayerMobile && targeted is Mobile )
|
||||
if ( from is PlayerMobile pm && targeted is Mobile targ )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)from;
|
||||
Mobile targ = (Mobile)targeted;
|
||||
|
||||
if ( targ.AccessLevel <= from.AccessLevel )
|
||||
if ( targ.AccessLevel <= pm.AccessLevel )
|
||||
{
|
||||
List<Mobile> list = pm.VisibilityList;
|
||||
|
||||
if ( list.Contains( targ ) )
|
||||
{
|
||||
list.Remove( targ );
|
||||
from.SendMessage( "{0} has been removed from your visibility list.", targ.Name );
|
||||
pm.SendMessage( "{0} has been removed from your visibility list.", targ.Name );
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add( targ );
|
||||
from.SendMessage( "{0} has been added to your visibility list.", targ.Name );
|
||||
pm.SendMessage( "{0} has been added to your visibility list.", targ.Name );
|
||||
}
|
||||
|
||||
if ( Utility.InUpdateRange( targ, from ) )
|
||||
|
|
@ -118,28 +111,28 @@ namespace Server.Commands
|
|||
NetState ns = targ.NetState;
|
||||
|
||||
if ( ns != null ) {
|
||||
if ( targ.CanSee( from ) )
|
||||
if ( targ.CanSee( pm ) )
|
||||
{
|
||||
ns.Send(MobileIncoming.Create(ns, targ, from));
|
||||
ns.Send(MobileIncoming.Create(ns, targ, pm));
|
||||
|
||||
if ( ObjectPropertyList.Enabled )
|
||||
{
|
||||
ns.Send( from.OPLPacket );
|
||||
ns.Send( pm.OPLPacket );
|
||||
|
||||
foreach ( Item item in from.Items )
|
||||
foreach ( Item item in pm.Items )
|
||||
ns.Send( item.OPLPacket );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ns.Send( from.RemovePacket );
|
||||
ns.Send( pm.RemovePacket );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "They can already see you!" );
|
||||
pm.SendMessage( "They can already see you!" );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue