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

@ -34,9 +34,7 @@ namespace Server.Engines.Quests.Ambitious
{
this.Direction = GetDirectionTo( player );
AmbitiousQueenQuest qs = player.Quest as AmbitiousQueenQuest;
if ( qs != null && qs.RedSolen == this.RedSolen )
if ( player.Quest is AmbitiousQueenQuest qs && qs.RedSolen == this.RedSolen )
{
if ( qs.IsObjectiveInProgress( typeof( KillQueensObjective ) ) )
{
@ -56,9 +54,7 @@ namespace Server.Engines.Quests.Ambitious
}
else
{
GetRewardObjective lastObj = qs.FindObjective( typeof( GetRewardObjective ) ) as GetRewardObjective;
if ( lastObj != null && !lastObj.Completed )
if ( qs.FindObjective( typeof( GetRewardObjective ) ) is GetRewardObjective lastObj && !lastObj.Completed )
{
bool bagOfSending = lastObj.BagOfSending;
bool powderOfTranslocation = lastObj.PowderOfTranslocation;
@ -101,22 +97,16 @@ namespace Server.Engines.Quests.Ambitious
{
this.Direction = GetDirectionTo( from );
PlayerMobile player = from as PlayerMobile;
if ( player != null )
if ( from is PlayerMobile player )
{
AmbitiousQueenQuest qs = player.Quest as AmbitiousQueenQuest;
if ( qs != null && qs.RedSolen == this.RedSolen )
if ( player.Quest is AmbitiousQueenQuest qs && qs.RedSolen == this.RedSolen )
{
QuestObjective obj = qs.FindObjective( typeof( GatherFungiObjective ) );
if ( obj != null && !obj.Completed )
{
if ( dropped is ZoogiFungus )
if ( dropped is ZoogiFungus fungi )
{
ZoogiFungus fungi = (ZoogiFungus)dropped;
if ( fungi.Amount >= 50 )
{
obj.Complete();
@ -128,16 +118,12 @@ namespace Server.Engines.Quests.Ambitious
fungi.Delete();
return true;
}
else
{
return false;
}
}
else
{
SayTo( player, 1054072 ); // Our arrangement was for 50 of the zoogi fungus. Please return to me when you have that amount.
return false;
}
SayTo( player, 1054072 ); // Our arrangement was for 50 of the zoogi fungus. Please return to me when you have that amount.
return false;
}
}
}

View file

@ -22,21 +22,15 @@ namespace Server.Engines.Quests.Collector
public override bool CanDrop( PlayerMobile player )
{
CollectorQuest qs = player.Quest as CollectorQuest;
if ( qs == null )
return true;
return !(player.Quest is CollectorQuest);
/*return !( qs.IsObjectiveInProgress( typeof( CaptureImagesObjective ) )
|| qs.IsObjectiveInProgress( typeof( ReturnImagesObjective ) ) );*/
return false;
}
public override void OnDoubleClick( Mobile from )
{
PlayerMobile player = from as PlayerMobile;
if ( player != null )
if ( from is PlayerMobile player )
{
QuestSystem qs = player.Quest;
@ -70,22 +64,17 @@ namespace Server.Engines.Quests.Collector
if ( m_Paints.Deleted || !m_Paints.IsChildOf( from.Backpack ) )
return;
PlayerMobile player = from as PlayerMobile;
if ( player != null )
if ( from is PlayerMobile player )
{
QuestSystem qs = player.Quest;
if ( qs is CollectorQuest )
{
CaptureImagesObjective obj = qs.FindObjective( typeof( CaptureImagesObjective ) ) as CaptureImagesObjective;
if ( obj != null && !obj.Completed )
if ( qs.FindObjective( typeof( CaptureImagesObjective ) ) is CaptureImagesObjective obj && !obj.Completed )
{
if ( targeted is Mobile )
{
ImageType image;
CaptureResponse response = obj.CaptureImage(( targeted.GetType().Name=="GreaterMongbat" ? new Mongbat().GetType() : targeted.GetType() ), out image );
CaptureResponse response = obj.CaptureImage(( targeted.GetType().Name=="GreaterMongbat" ? new Mongbat().GetType() : targeted.GetType() ), out ImageType image );
switch ( response )
{
@ -138,4 +127,4 @@ namespace Server.Engines.Quests.Collector
int version = reader.ReadInt();
}
}
}
}

View file

@ -203,13 +203,11 @@ namespace Server.Engines.Quests.Collector
protected override void OnTarget( Mobile from, object targeted )
{
Item targ = targeted as Item;
if ( m_Obsidian.Deleted || m_Obsidian.Quantity >= Obsidian.m_Completed || targ == null )
if ( m_Obsidian.Deleted || m_Obsidian.Quantity >= Obsidian.m_Completed || !(targeted is Item targ) )
return;
if ( m_Obsidian.IsChildOf( from.Backpack ) && targ.IsChildOf( from.Backpack ) && targ is Obsidian && targ != m_Obsidian )
if ( m_Obsidian.IsChildOf( from.Backpack ) && targ.IsChildOf( from.Backpack ) && targ is Obsidian targObsidian && targ != m_Obsidian )
{
Obsidian targObsidian = (Obsidian)targ;
if ( targObsidian.Quantity < Obsidian.m_Completed )
{
if ( targObsidian.Quantity + m_Obsidian.Quantity <= Obsidian.m_Completed )

View file

@ -197,10 +197,10 @@ namespace Server.Engines.Quests.Collector
{
item = Loot.RandomArmorOrShieldOrJewelry();
if ( item is BaseArmor )
BaseRunicTool.ApplyAttributesTo( (BaseArmor)item, 2, 20, 30 );
else if ( item is BaseJewel )
BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, 2, 20, 30 );
if ( item is BaseArmor armor )
BaseRunicTool.ApplyAttributesTo( armor, 2, 20, 30 );
else if ( item is BaseJewel jewel )
BaseRunicTool.ApplyAttributesTo( jewel, 2, 20, 30 );
}
else
{

View file

@ -56,9 +56,7 @@ namespace Server.Engines.Quests.Collector
if ( qs is CollectorQuest )
{
FindSheetMusicObjective obj = qs.FindObjective( typeof( FindSheetMusicObjective ) ) as FindSheetMusicObjective;
if ( obj != null && !obj.Completed )
if ( qs.FindObjective( typeof( FindSheetMusicObjective ) ) is FindSheetMusicObjective obj && !obj.Completed )
{
Direction = GetDirectionTo( player );
@ -135,20 +133,14 @@ namespace Server.Engines.Quests.Collector
{
if ( info.ButtonID == 1 && info.IsSwitched( 1 ) )
{
PlayerMobile player = sender.Mobile as PlayerMobile;
if ( player != null )
if ( sender.Mobile is PlayerMobile player )
{
QuestSystem qs = player.Quest;
if ( qs is CollectorQuest )
{
FindSheetMusicObjective obj = qs.FindObjective( typeof( FindSheetMusicObjective ) ) as FindSheetMusicObjective;
if ( obj != null && !obj.Completed )
if ( qs.FindObjective( typeof( FindSheetMusicObjective ) ) is FindSheetMusicObjective obj && !obj.Completed )
{
if ( player.Backpack!= null && player.Backpack.ConsumeTotal( typeof( Gold ), 10 ) )
{
obj.Complete();
@ -160,7 +152,7 @@ namespace Server.Engines.Quests.Collector
{
obj.Complete();
}
else
{
player.SendLocalizedMessage( 1055108 ); // You don't have enough gold to buy the sheet music.
@ -172,4 +164,4 @@ namespace Server.Engines.Quests.Collector
}
}
}
}
}

View file

@ -21,8 +21,8 @@ namespace Server.Engines.Quests
{
Mobile from = Owner.From;
if ( from.CheckAlive() && from is PlayerMobile && m_Quester.CanTalkTo( (PlayerMobile)from ) )
m_Quester.OnTalk( (PlayerMobile)from, true );
if ( from.CheckAlive() && from is PlayerMobile mobile && m_Quester.CanTalkTo( mobile ) )
m_Quester.OnTalk( mobile, true );
}
}
@ -82,19 +82,17 @@ namespace Server.Engines.Quests
{
base.AddCustomContextEntries( from, list );
if ( from.Alive && from is PlayerMobile && TalkNumber > 0 && CanTalkTo( (PlayerMobile)from ) )
if ( from.Alive && from is PlayerMobile mobile && TalkNumber > 0 && CanTalkTo( mobile ) )
list.Add( new TalkEntry( this ) );
}
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( m.Alive && m is PlayerMobile )
if ( m.Alive && m is PlayerMobile pm )
{
PlayerMobile pm = (PlayerMobile)m;
int range = GetAutoTalkRange( pm );
if ( m.Alive && range >= 0 && InRange( m, range ) && !InRange( oldLocation, range ) && CanTalkTo( pm ) )
if ( pm.Alive && range >= 0 && InRange( m, range ) && !InRange( oldLocation, range ) && CanTalkTo( pm ) )
OnTalk( pm, false );
}
}

View file

@ -24,9 +24,7 @@ namespace Server.Engines.Quests
public override bool OnMoveOver( Mobile m )
{
PlayerMobile pm = m as PlayerMobile;
if ( pm != null )
if ( m is PlayerMobile pm )
{
Point3D loc = Point3D.Zero;
Map map = null;
@ -40,10 +38,8 @@ namespace Server.Engines.Quests
return false;
}
else
{
pm.SendLocalizedMessage( this.NotWorkingMessage );
}
pm.SendLocalizedMessage( this.NotWorkingMessage );
}
return base.OnMoveOver( m );

View file

@ -90,18 +90,15 @@ namespace Server.Engines.Quests
return false;
}
}
else
{
return ret;
}
return ret;
}
public override DeathMoveResult OnParentDeath( Mobile parent )
{
if ( parent is PlayerMobile && !CanDrop( (PlayerMobile)parent ) )
if ( parent is PlayerMobile mobile && !CanDrop( mobile ) )
return DeathMoveResult.MoveToBackpack;
else
return base.OnParentDeath( parent );
return base.OnParentDeath( parent );
}
public override void Serialize( GenericWriter writer )

View file

@ -403,9 +403,7 @@ namespace Server.Engines.Quests
{
inRestartPeriod = false;
PlayerMobile pm = check as PlayerMobile;
if ( pm == null )
if ( !(check is PlayerMobile pm) )
return false;
if ( pm.HasGump( typeof( QuestOfferGump ) ) )
@ -656,31 +654,19 @@ namespace Server.Engines.Quests
public static ArrayList BuildList( object obj )
{
ArrayList list = new ArrayList();
list.Add( obj );
return list;
return new ArrayList { obj };
}
public void AddHtmlObject( int x, int y, int width, int height, object message, int color, bool back, bool scroll )
{
if ( message is string )
{
string html = (string)message;
AddHtml( x, y, width, height, Color( html, C16232( color ) ), back, scroll );
}
else if ( message is int )
{
int html = (int)message;
if ( message is int html )
AddHtmlLocalized( x, y, width, height, html, C16216( color ), back, scroll );
}
else
AddHtml( x, y, width, height, Color( message.ToString(), C16232( color ) ), back, scroll );
}
public BaseQuestGump( int x, int y ) : base( x, y )
{
}
}
}
}

View file

@ -28,9 +28,7 @@ namespace Server.Engines.Quests
if ( m_Quest == null )
return true;
PlayerMobile player = m as PlayerMobile;
if ( player != null && player.Quest != null && player.Quest.GetType() == m_Quest )
if ( m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest )
{
if ( !player.HasGump( typeof( QuestCancelGump ) ) )
player.Quest.BeginCancelQuest();
@ -41,4 +39,4 @@ namespace Server.Engines.Quests
return true;
}
}
}
}

View file

@ -28,9 +28,7 @@ namespace Server.Engines.Quests
if ( m_Quest != null && m_Objective != null )
{
PlayerMobile player = m as PlayerMobile;
if ( player != null && player.Quest != null && player.Quest.GetType() == m_Quest )
if ( m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest )
{
QuestObjective obj = player.Quest.FindObjective( m_Objective );
@ -40,4 +38,4 @@ namespace Server.Engines.Quests
}
}
}
}
}

View file

@ -36,32 +36,23 @@ namespace Server.Engines.Quests
if ( m.AccessLevel > AccessLevel.Player )
return true;
if ( m is BaseCreature )
{
BaseCreature bc = m as BaseCreature;
if ( !bc.Controlled && !bc.Summoned )
return true;
}
if ( m is BaseCreature bc && !bc.Controlled && !bc.Summoned )
return true;
if ( m_Quest == null )
return true;
PlayerMobile player = m as PlayerMobile;
if ( player != null && player.Quest != null && player.Quest.GetType() == m_Quest
if ( m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest
&& ( m_MinObjective == null || player.Quest.FindObjective( m_MinObjective ) != null )
&& ( m_MaxObjective == null || player.Quest.FindObjective( m_MaxObjective ) == null ) )
{
return true;
}
else
{
if ( m_Message != 0 )
m.SendLocalizedMessage( m_Message );
return false;
}
if ( m_Message != 0 )
m.SendLocalizedMessage( m_Message );
return false;
}
}
}

View file

@ -24,9 +24,7 @@ namespace Server.Engines.Quests
if ( m_Quest == null )
return;
PlayerMobile player = m as PlayerMobile;
if ( player != null && player.Quest == null && QuestSystem.CanOfferQuest( m, m_Quest ) )
if ( m is PlayerMobile player && player.Quest == null && QuestSystem.CanOfferQuest( m, m_Quest ) )
{
try
{
@ -40,4 +38,4 @@ namespace Server.Engines.Quests
}
}
}
}
}

View file

@ -130,9 +130,7 @@ namespace Server.Engines.Quests.Necro
public static bool HasLostCallingScroll( Mobile from )
{
PlayerMobile pm = from as PlayerMobile;
if ( pm == null )
if ( !(from is PlayerMobile pm) )
return false;
QuestSystem qs = pm.Quest;
@ -141,9 +139,7 @@ namespace Server.Engines.Quests.Necro
{
if ( qs.IsObjectiveInProgress( typeof( FindMardothAboutKronusObjective ) ) || qs.IsObjectiveInProgress( typeof( FindWellOfTearsObjective ) ) || qs.IsObjectiveInProgress( typeof( UseCallingScrollObjective ) ) )
{
Container pack = from.Backpack;
return ( pack == null || pack.FindItemByType( typeof( KronusScroll ) ) == null );
return ( from.Backpack?.FindItemByType( typeof( KronusScroll ) ) == null );
}
}

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();
}
}
}
}

View file

@ -74,9 +74,8 @@ namespace Server.Engines.Quests.Necro
{
base.OnMovement( m, oldLocation );
if ( InRange( m.Location, 2 ) && !InRange( oldLocation, 2 ) && m is PlayerMobile )
if ( InRange( m.Location, 2 ) && !InRange( oldLocation, 2 ) && m is PlayerMobile pm )
{
PlayerMobile pm = (PlayerMobile)m;
QuestSystem qs = pm.Quest;
if ( qs is DarkTidesQuest )
@ -121,9 +120,7 @@ namespace Server.Engines.Quests.Necro
if ( from.Alive )
{
PlayerMobile pm = from as PlayerMobile;
if ( pm != null )
if ( from is PlayerMobile pm )
{
QuestSystem qs = pm.Quest;

View file

@ -27,20 +27,16 @@ namespace Server.Engines.Quests.Necro
public override bool OnDragDrop( Mobile from, Item dropped )
{
PlayerMobile player = from as PlayerMobile;
if ( player != null )
if ( from is PlayerMobile player )
{
QuestSystem qs = player.Quest;
if ( qs is DarkTidesQuest )
{
if ( dropped is DarkTidesHorn )
if ( dropped is DarkTidesHorn horn )
{
if ( player.Young )
{
DarkTidesHorn horn = (DarkTidesHorn)dropped;
if ( horn.Charges < 10 )
{
SayTo( from, 1049384 ); // I have recharged the item for you.
@ -93,9 +89,7 @@ namespace Server.Engines.Quests.Necro
public override bool CanTalkTo( PlayerMobile to )
{
DarkTidesQuest qs = to.Quest as DarkTidesQuest;
if ( qs == null )
if ( !(to.Quest is DarkTidesQuest qs) )
return ( to.Quest == null && QuestSystem.CanOfferQuest( to, typeof( DarkTidesQuest ) ) );
return ( qs.FindObjective( typeof( FindMardothAboutVaultObjective ) ) != null );

View file

@ -225,9 +225,7 @@ namespace Server.Engines.Quests.Necro
{
if ( System.From.Map == Map.Malas && System.From.InRange( new Point3D( 1076, 450, -84 ), 5 ) )
{
HordeMinionFamiliar hmf = Spells.Necromancy.SummonFamiliarSpell.Table[System.From] as HordeMinionFamiliar;
if ( hmf != null && hmf.InRange( System.From, 5 ) && hmf.TargetLocation == null )
if ( Spells.Necromancy.SummonFamiliarSpell.Table[System.From] is HordeMinionFamiliar hmf && hmf.InRange( System.From, 5 ) && hmf.TargetLocation == null )
{
System.From.SendLocalizedMessage( 1060113 ); // You instinctively will your familiar to fetch the scroll for you.
hmf.TargetLocation = new Point2D( 1076, 450 );

View file

@ -114,9 +114,7 @@ namespace Server.Engines.Quests.Ninja
public static bool HasLostNoteForZoel( Mobile from )
{
PlayerMobile pm = from as PlayerMobile;
if ( pm == null )
if ( !(from is PlayerMobile pm) )
return false;
QuestSystem qs = pm.Quest;
@ -125,9 +123,7 @@ namespace Server.Engines.Quests.Ninja
{
if ( qs.IsObjectiveInProgress( typeof( GiveZoelNoteObjective ) ) )
{
Container pack = from.Backpack;
return ( pack == null || pack.FindItemByType( typeof( NoteForZoel ) ) == null );
return ( from.Backpack?.FindItemByType( typeof( NoteForZoel ) ) == null );
}
}
@ -136,9 +132,7 @@ namespace Server.Engines.Quests.Ninja
public static bool HasLostEminosKatana( Mobile from )
{
PlayerMobile pm = from as PlayerMobile;
if ( pm == null )
if ( !(from is PlayerMobile pm) )
return false;
QuestSystem qs = pm.Quest;
@ -147,9 +141,7 @@ namespace Server.Engines.Quests.Ninja
{
if ( qs.IsObjectiveInProgress( typeof( GiveEminoSwordObjective ) ) )
{
Container pack = from.Backpack;
return ( pack == null || pack.FindItemByType( typeof( EminosKatana ) ) == null );
return ( from.Backpack?.FindItemByType( typeof( EminosKatana ) ) == null );
}
}

View file

@ -20,15 +20,11 @@ namespace Server.Engines.Quests.Ninja
public override bool CanDrop( PlayerMobile player )
{
EminosUndertakingQuest qs = player.Quest as EminosUndertakingQuest;
if ( qs == null )
return true;
return !(player.Quest is EminosUndertakingQuest);
/*return !qs.IsObjectiveInProgress( typeof( ReturnSwordObjective ) )
&& !qs.IsObjectiveInProgress( typeof( SlayHenchmenObjective ) )
&& !qs.IsObjectiveInProgress( typeof( GiveEminoSwordObjective ) );*/
return false;
}
public override void Serialize( GenericWriter writer )

View file

@ -41,9 +41,7 @@ namespace Server.Engines.Quests.Ninja
public override void OnDoubleClick( Mobile from )
{
PlayerMobile player = from as PlayerMobile;
if ( player != null && player.InRange( GetWorldLocation(), 2 ) )
if ( from is PlayerMobile player && player.InRange( GetWorldLocation(), 2 ) )
{
QuestSystem qs = player.Quest;
@ -100,13 +98,9 @@ namespace Server.Engines.Quests.Ninja
if ( from.AccessLevel >= AccessLevel.GameMaster )
return true;
PlayerMobile player = from as PlayerMobile;
if ( player != null && player.Quest is EminosUndertakingQuest )
if ( from is PlayerMobile player && player.Quest is EminosUndertakingQuest )
{
HallwayWalkObjective obj = player.Quest.FindObjective( typeof( HallwayWalkObjective ) ) as HallwayWalkObjective;
if ( obj != null )
if ( player.Quest.FindObjective( typeof( HallwayWalkObjective ) ) is HallwayWalkObjective obj )
{
if ( obj.StolenTreasure )
from.SendLocalizedMessage( 1063247 ); // The guard is watching you carefully! It would be unwise to remove another item from here.
@ -120,13 +114,9 @@ namespace Server.Engines.Quests.Ninja
public override void OnItemLifted( Mobile from, Item item )
{
PlayerMobile player = from as PlayerMobile;
if ( player != null && player.Quest is EminosUndertakingQuest )
if ( from is PlayerMobile player && player.Quest is EminosUndertakingQuest )
{
HallwayWalkObjective obj = player.Quest.FindObjective( typeof( HallwayWalkObjective ) ) as HallwayWalkObjective;
if ( obj != null )
if ( player.Quest.FindObjective( typeof( HallwayWalkObjective ) ) is HallwayWalkObjective obj )
obj.StolenTreasure = true;
}
}