Fixes more casting
This commit is contained in:
parent
61937d9c97
commit
e77d695684
91 changed files with 512 additions and 908 deletions
|
|
@ -128,9 +128,7 @@ namespace Server.Engines.Quests.Samurai
|
|||
|
||||
public static bool HasLostHaochisKatana( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return false;
|
||||
|
||||
QuestSystem qs = pm.Quest;
|
||||
|
|
@ -139,9 +137,7 @@ namespace Server.Engines.Quests.Samurai
|
|||
{
|
||||
if ( qs.IsObjectiveInProgress( typeof( FifthTrialReturnObjective ) ) )
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
return ( pack == null || pack.FindItemByType( typeof( HaochisKatana ) ) == null );
|
||||
return ( from.Backpack?.FindItemByType( typeof( HaochisKatana ) ) == null );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,13 +20,9 @@ namespace Server.Engines.Quests.Samurai
|
|||
|
||||
public override bool CanDrop( PlayerMobile player )
|
||||
{
|
||||
HaochisTrialsQuest qs = player.Quest as HaochisTrialsQuest;
|
||||
|
||||
if ( qs == null )
|
||||
return true;
|
||||
return !(player.Quest is HaochisTrialsQuest );
|
||||
|
||||
//return !qs.IsObjectiveInProgress( typeof( FifthTrialReturnObjective ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@ namespace Server.Engines.Quests.Samurai
|
|||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
PlayerMobile player = m as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( m is PlayerMobile player )
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,13 +53,9 @@ namespace Server.Engines.Quests.Samurai
|
|||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return true;
|
||||
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null && player.Quest is HaochisTrialsQuest )
|
||||
if ( from is PlayerMobile player && player.Quest is HaochisTrialsQuest )
|
||||
{
|
||||
FifthTrialIntroObjective obj = player.Quest.FindObjective( typeof( FifthTrialIntroObjective ) ) as FifthTrialIntroObjective;
|
||||
|
||||
if ( obj != null )
|
||||
if ( player.Quest.FindObjective( typeof( FifthTrialIntroObjective ) ) is FifthTrialIntroObjective obj )
|
||||
{
|
||||
if ( obj.StolenTreasure )
|
||||
from.SendLocalizedMessage( 1063247 ); // The guard is watching you carefully! It would be unwise to remove another item from here.
|
||||
|
|
@ -73,13 +69,9 @@ namespace Server.Engines.Quests.Samurai
|
|||
|
||||
public override void OnItemLifted( Mobile from, Item item )
|
||||
{
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null && player.Quest is HaochisTrialsQuest )
|
||||
if ( from is PlayerMobile player && player.Quest is HaochisTrialsQuest )
|
||||
{
|
||||
FifthTrialIntroObjective obj = player.Quest.FindObjective( typeof( FifthTrialIntroObjective ) ) as FifthTrialIntroObjective;
|
||||
|
||||
if ( obj != null )
|
||||
if ( player.Quest.FindObjective( typeof( FifthTrialIntroObjective ) ) is FifthTrialIntroObjective obj )
|
||||
obj.StolenTreasure = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,14 +31,12 @@ namespace Server.Engines.Quests.Samurai
|
|||
|
||||
if ( !wasBurning && Burning )
|
||||
{
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player == null )
|
||||
if ( !(from is PlayerMobile player) )
|
||||
return;
|
||||
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
if ( qs != null && qs is HaochisTrialsQuest )
|
||||
if ( qs is HaochisTrialsQuest )
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective( typeof( SixthTrialIntroObjective ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ namespace Server.Engines.Quests.Samurai
|
|||
{
|
||||
base.AggressiveAction( aggressor, criminal );
|
||||
|
||||
PlayerMobile player = aggressor as PlayerMobile;
|
||||
if ( player != null )
|
||||
if ( aggressor is PlayerMobile player )
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
if ( qs is HaochisTrialsQuest )
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ namespace Server.Engines.Quests.Samurai
|
|||
{
|
||||
base.AggressiveAction( aggressor, criminal );
|
||||
|
||||
PlayerMobile player = aggressor as PlayerMobile;
|
||||
if ( player != null )
|
||||
if ( aggressor is PlayerMobile player )
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
if ( qs is HaochisTrialsQuest )
|
||||
|
|
|
|||
|
|
@ -44,9 +44,7 @@ namespace Server.Engines.Quests.Samurai
|
|||
|
||||
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;
|
||||
|
||||
|
|
@ -56,9 +54,7 @@ namespace Server.Engines.Quests.Samurai
|
|||
|
||||
if ( obj != null && !obj.Completed )
|
||||
{
|
||||
Gold gold = dropped as Gold;
|
||||
|
||||
if ( gold != null )
|
||||
if ( dropped is Gold gold )
|
||||
{
|
||||
obj.Complete();
|
||||
qs.AddObjective( new FourthTrialReturnObjective( false ) );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue