Fixes more casting and other formatting issues.

This commit is contained in:
Kamron Batman 2018-08-19 10:14:40 +08:00
parent 03dd5f1926
commit 61937d9c97
67 changed files with 325 additions and 570 deletions

View file

@ -25,9 +25,7 @@ namespace Server.Engines.Quests.Necro
if ( m is BaseCreature )
m = ((BaseCreature)m).ControlMaster;
PlayerMobile pm = m as PlayerMobile;
if ( pm != null )
if ( m is PlayerMobile pm )
{
QuestSystem qs = pm.Quest;
@ -69,4 +67,4 @@ namespace Server.Engines.Quests.Necro
int version = reader.ReadInt();
}
}
}
}

View file

@ -11,9 +11,7 @@ namespace Server.Engines.Quests.Necro
{
public override bool ValidateUse( Mobile from )
{
PlayerMobile pm = from as PlayerMobile;
return ( pm != null && pm.Quest is DarkTidesQuest );
return ( from is PlayerMobile pm && pm.Quest is DarkTidesQuest );
}
[Constructible]
@ -41,4 +39,4 @@ namespace Server.Engines.Quests.Necro
int version = reader.ReadInt();
}
}
}
}

View file

@ -23,16 +23,12 @@ namespace Server.Engines.Quests.Necro
public override bool CanDrop( PlayerMobile player )
{
DarkTidesQuest qs = player.Quest as DarkTidesQuest;
if ( qs == null )
return true;
return !(player.Quest is DarkTidesQuest);
/*return !( qs.IsObjectiveInProgress( typeof( FindCallingScrollObjective ) )
|| qs.IsObjectiveInProgress( typeof( FindMardothAboutKronusObjective ) )
|| qs.IsObjectiveInProgress( typeof( FindWellOfTearsObjective ) )
|| qs.IsObjectiveInProgress( typeof( UseCallingScrollObjective ) ) );*/
return false;
}
private static readonly Rectangle2D m_WellOfTearsArea = new Rectangle2D( 2080, 1346, 10, 10 );
@ -43,9 +39,7 @@ namespace Server.Engines.Quests.Necro
if ( !IsChildOf( from ) )
return;
PlayerMobile pm = from as PlayerMobile;
if ( pm != null )
if ( from is PlayerMobile pm )
{
QuestSystem qs = pm.Quest;

View file

@ -27,9 +27,7 @@ namespace Server.Engines.Quests.Necro
public override void OnDoubleClick( Mobile from )
{
PlayerMobile pm = from as PlayerMobile;
if ( pm != null && pm.InRange( GetWorldLocation(), 2 ) )
if ( from is PlayerMobile pm && pm.InRange( GetWorldLocation(), 2 ) )
{
QuestSystem qs = pm.Quest;
@ -74,4 +72,4 @@ namespace Server.Engines.Quests.Necro
int version = reader.ReadInt();
}
}
}
}

View file

@ -107,8 +107,8 @@ namespace Server.Engines.Quests.Necro
[CommandProperty( AccessLevel.GameMaster )]
public Point3D SpawnLocation
{
get { return Addon is MaabusCoffin ? ((MaabusCoffin)Addon).SpawnLocation : Point3D.Zero; }
set { if ( Addon is MaabusCoffin ) ((MaabusCoffin)Addon).SpawnLocation = value; }
get { return Addon is MaabusCoffin coffin ? coffin.SpawnLocation : Point3D.Zero; }
set { if ( Addon is MaabusCoffin coffin ) coffin.SpawnLocation = value; }
}
public MaabusCoffinComponent( int itemID ) : this( itemID, itemID )

View file

@ -20,22 +20,16 @@ namespace Server.Engines.Quests.Necro
public override bool CanDrop( PlayerMobile player )
{
DarkTidesQuest qs = player.Quest as DarkTidesQuest;
if ( qs == null )
return true;
return !(player.Quest is DarkTidesQuest);
//return !( qs.IsObjectiveInProgress( typeof( RetrieveAbraxusScrollObjective ) ) || qs.IsObjectiveInProgress( typeof( ReadAbraxusScrollObjective ) ) );
return false;
}
public override void OnAdded(IEntity parent)
{
base.OnAdded( parent );
PlayerMobile pm = RootParent as PlayerMobile;
if ( pm != null )
if ( RootParent is PlayerMobile pm )
{
QuestSystem qs = pm.Quest;
@ -55,9 +49,7 @@ namespace Server.Engines.Quests.Necro
{
from.SendGump( new ScrollOfAbraxusGump() );
PlayerMobile pm = from as PlayerMobile;
if ( pm != null )
if ( from is PlayerMobile pm )
{
QuestSystem qs = pm.Quest;

View file

@ -21,9 +21,7 @@ namespace Server.Engines.Quests.Necro
if ( m.AccessLevel > AccessLevel.Player )
return true;
PlayerMobile pm = m as PlayerMobile;
if ( pm != null && pm.Profession == 4 )
if ( m is PlayerMobile pm && pm.Profession == 4 )
{
m.SendLocalizedMessage( 1060188, "", 0x24 ); // The wicked may not enter!
return false;
@ -50,4 +48,4 @@ namespace Server.Engines.Quests.Necro
int version = reader.ReadInt();
}
}
}
}