Fixes more casting

This commit is contained in:
Kamron Batman 2018-08-19 11:04:07 +08:00
parent 61937d9c97
commit e77d695684
91 changed files with 512 additions and 908 deletions

View file

@ -11,7 +11,7 @@ namespace Server.Engines.Quests.Ninja
public GuardianBarrier() : base( 0x3967 )
{
Movable = false;
Visible = false;
Visible = false;
}
public override bool OnMoveOver( Mobile m )
@ -23,28 +23,19 @@ namespace Server.Engines.Quests.Ninja
if ( this.Y >= m.Y )
return true;
if ( m is BaseCreature )
if ( m is BaseCreature creature )
{
Mobile master = ((BaseCreature)m).GetMaster();
Mobile master = creature.GetMaster();
// Allow creatures to cross from the south to the north only if their master is near to the north
if ( master != null && this.Y >= master.Y && master.InRange( this, 4 ) )
return true;
else
return false;
return master != null && this.Y >= master.Y && master.InRange(this, 4);
}
PlayerMobile pm = m as PlayerMobile;
if ( pm != null )
if ( m is PlayerMobile pm )
{
EminosUndertakingQuest qs = pm.Quest as EminosUndertakingQuest;
if ( qs != null )
if ( pm.Quest is EminosUndertakingQuest qs )
{
SneakPastGuardiansObjective obj = qs.FindObjective( typeof( SneakPastGuardiansObjective ) ) as SneakPastGuardiansObjective;
if ( obj != null )
if ( qs.FindObjective( typeof( SneakPastGuardiansObjective ) ) is SneakPastGuardiansObjective obj )
{
if ( m.Hidden )
return true; // Hidden ninjas can pass
@ -79,4 +70,4 @@ namespace Server.Engines.Quests.Ninja
int version = reader.ReadInt();
}
}
}
}

View file

@ -22,13 +22,9 @@ 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( GiveZoelNoteObjective ) );
return false;
}
public override void Serialize( GenericWriter writer )

View file

@ -148,8 +148,7 @@ namespace Server.Engines.Quests.Ninja
{
bool stolenTreasure = false;
HallwayWalkObjective walk = qs.FindObjective( typeof( HallwayWalkObjective ) ) as HallwayWalkObjective;
if ( walk != null )
if ( qs.FindObjective( typeof( HallwayWalkObjective ) ) is HallwayWalkObjective walk )
stolenTreasure = walk.StolenTreasure;
Kama kama = new Kama();

View file

@ -70,9 +70,7 @@ namespace Server.Engines.Quests.Ninja
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;