Fixes more casting
This commit is contained in:
parent
61937d9c97
commit
e77d695684
91 changed files with 512 additions and 908 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ) );
|
||||
|
|
|
|||
|
|
@ -37,18 +37,14 @@ namespace Server.Engines.Quests.Matriarch
|
|||
if ( SolenMatriarchQuest.IsFriend( to, this.RedSolen ) )
|
||||
return true;
|
||||
|
||||
SolenMatriarchQuest qs = to.Quest as SolenMatriarchQuest;
|
||||
|
||||
return qs != null && qs.RedSolen == this.RedSolen;
|
||||
return to.Quest is SolenMatriarchQuest qs && qs.RedSolen == this.RedSolen;
|
||||
}
|
||||
|
||||
public override void OnTalk( PlayerMobile player, bool contextMenu )
|
||||
{
|
||||
this.Direction = GetDirectionTo( player );
|
||||
|
||||
SolenMatriarchQuest qs = player.Quest as SolenMatriarchQuest;
|
||||
|
||||
if ( qs != null && qs.RedSolen == this.RedSolen )
|
||||
if ( player.Quest is SolenMatriarchQuest qs && qs.RedSolen == this.RedSolen )
|
||||
{
|
||||
if ( qs.IsObjectiveInProgress( typeof( KillInfiltratorsObjective ) ) )
|
||||
{
|
||||
|
|
@ -114,15 +110,11 @@ namespace Server.Engines.Quests.Matriarch
|
|||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( from is PlayerMobile player )
|
||||
{
|
||||
if ( dropped is Seed )
|
||||
{
|
||||
SolenMatriarchQuest qs = player.Quest as SolenMatriarchQuest;
|
||||
|
||||
if ( qs != null && qs.RedSolen == this.RedSolen )
|
||||
if ( player.Quest is SolenMatriarchQuest qs && qs.RedSolen == this.RedSolen )
|
||||
{
|
||||
SayTo( player, 1054080 ); // Thank you for that plant seed. Those have such wonderful flavor.
|
||||
}
|
||||
|
|
@ -143,11 +135,11 @@ namespace Server.Engines.Quests.Matriarch
|
|||
dropped.Delete();
|
||||
return true;
|
||||
}
|
||||
else if ( dropped is ZoogiFungus )
|
||||
if ( dropped is ZoogiFungus fungus )
|
||||
{
|
||||
OnGivenFungi( player, (ZoogiFungus)dropped );
|
||||
OnGivenFungi( player, fungus );
|
||||
|
||||
return dropped.Deleted;
|
||||
return fungus.Deleted;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -160,13 +152,9 @@ namespace Server.Engines.Quests.Matriarch
|
|||
|
||||
if ( from.Alive )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm != null )
|
||||
if ( from is PlayerMobile pm )
|
||||
{
|
||||
SolenMatriarchQuest qs = pm.Quest as SolenMatriarchQuest;
|
||||
|
||||
if ( qs != null && qs.RedSolen == this.RedSolen )
|
||||
if ( pm.Quest is SolenMatriarchQuest qs && qs.RedSolen == this.RedSolen )
|
||||
{
|
||||
if ( qs.IsObjectiveInProgress( typeof( ProcessFungiObjective ) ) )
|
||||
{
|
||||
|
|
@ -213,12 +201,10 @@ namespace Server.Engines.Quests.Matriarch
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is ZoogiFungus )
|
||||
if ( targeted is ZoogiFungus fungus )
|
||||
{
|
||||
ZoogiFungus fungus = (ZoogiFungus)targeted;
|
||||
|
||||
if ( fungus.IsChildOf( m_From.Backpack ) )
|
||||
m_Matriarch.OnGivenFungi( m_From, (ZoogiFungus)targeted );
|
||||
m_Matriarch.OnGivenFungi( m_From, fungus );
|
||||
else
|
||||
m_From.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
|
@ -229,9 +215,7 @@ namespace Server.Engines.Quests.Matriarch
|
|||
{
|
||||
this.Direction = GetDirectionTo( player );
|
||||
|
||||
SolenMatriarchQuest qs = player.Quest as SolenMatriarchQuest;
|
||||
|
||||
if ( qs != null && qs.RedSolen == this.RedSolen )
|
||||
if ( player.Quest is SolenMatriarchQuest qs && qs.RedSolen == this.RedSolen )
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective( typeof( ProcessFungiObjective ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -38,13 +38,9 @@ namespace Server.Engines.Quests.Naturalist
|
|||
|
||||
public override void OnTalk( PlayerMobile player, bool contextMenu )
|
||||
{
|
||||
StudyOfSolenQuest qs = player.Quest as StudyOfSolenQuest;
|
||||
|
||||
if ( qs != null && qs.Naturalist == this )
|
||||
if ( player.Quest is StudyOfSolenQuest qs && qs.Naturalist == this )
|
||||
{
|
||||
StudyNestsObjective study = qs.FindObjective( typeof( StudyNestsObjective ) ) as StudyNestsObjective;
|
||||
|
||||
if ( study != null )
|
||||
if ( qs.FindObjective( typeof( StudyNestsObjective ) ) is StudyNestsObjective study )
|
||||
{
|
||||
if ( !study.Completed )
|
||||
{
|
||||
|
|
@ -155,4 +151,4 @@ namespace Server.Engines.Quests.Naturalist
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,9 +72,7 @@ namespace Server.Engines.Quests.Zento
|
|||
|
||||
if ( Utility.RandomBool() )
|
||||
{
|
||||
BaseWeapon weapon = Loot.Construct( Loot.SEWeaponTypes ) as BaseWeapon;
|
||||
|
||||
if ( weapon != null )
|
||||
if ( Loot.Construct( Loot.SEWeaponTypes ) is BaseWeapon weapon )
|
||||
{
|
||||
BaseRunicTool.ApplyAttributesTo( weapon, 3, 10, 30 );
|
||||
cont.DropItem( weapon );
|
||||
|
|
@ -82,9 +80,7 @@ namespace Server.Engines.Quests.Zento
|
|||
}
|
||||
else
|
||||
{
|
||||
BaseArmor armor = Loot.Construct( Loot.SEArmorTypes ) as BaseArmor;
|
||||
|
||||
if ( armor != null )
|
||||
if ( Loot.Construct( Loot.SEArmorTypes ) is BaseArmor armor )
|
||||
{
|
||||
BaseRunicTool.ApplyAttributesTo( armor, 1, 10, 20 );
|
||||
cont.DropItem( armor );
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ namespace Server.Engines.Quests.Doom
|
|||
{
|
||||
foreach ( Item item in GetItemsInRange( AltarRange ) )
|
||||
{
|
||||
if ( item is SummoningAltar )
|
||||
if ( item is SummoningAltar altar )
|
||||
{
|
||||
m_Altar = (SummoningAltar)item;
|
||||
m_Altar = altar;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -79,18 +79,14 @@ namespace Server.Engines.Quests.Doom
|
|||
|
||||
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 TheSummoningQuest )
|
||||
{
|
||||
if ( dropped is DaemonBone )
|
||||
if ( dropped is DaemonBone bones )
|
||||
{
|
||||
DaemonBone bones = (DaemonBone)dropped;
|
||||
|
||||
QuestObjective obj = qs.FindObjective( typeof( CollectBonesObjective ) );
|
||||
|
||||
if ( obj != null && !obj.Completed )
|
||||
|
|
|
|||
|
|
@ -152,8 +152,8 @@ namespace Server.Engines.Quests.Haven
|
|||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public MilitiaCanoneer Canoneer
|
||||
{
|
||||
get { return Addon is Cannon ? ((Cannon)Addon).Canoneer : null; }
|
||||
set { if ( Addon is Cannon ) ((Cannon)Addon).Canoneer = value; }
|
||||
get { return Addon is Cannon cannon ? cannon.Canoneer : null; }
|
||||
set { if ( Addon is Cannon cannon ) cannon.Canoneer = value; }
|
||||
}
|
||||
|
||||
public CannonComponent( int itemID ) : base( itemID )
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
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;
|
||||
|
||||
|
|
@ -69,4 +67,4 @@ namespace Server.Engines.Quests.Haven
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,13 +19,9 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public override bool CanDrop( PlayerMobile player )
|
||||
{
|
||||
UzeraanTurmoilQuest qs = player.Quest as UzeraanTurmoilQuest;
|
||||
|
||||
if ( qs == null )
|
||||
return true;
|
||||
return !(player.Quest is UzeraanTurmoilQuest);
|
||||
|
||||
/*return !qs.IsObjectiveInProgress( typeof( ReturnDaemonBloodObjective ) );*/
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
@ -42,4 +38,4 @@ namespace Server.Engines.Quests.Haven
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,13 +19,9 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public override bool CanDrop( PlayerMobile player )
|
||||
{
|
||||
UzeraanTurmoilQuest qs = player.Quest as UzeraanTurmoilQuest;
|
||||
|
||||
if ( qs == null )
|
||||
return true;
|
||||
return !(player.Quest is UzeraanTurmoilQuest);
|
||||
|
||||
//return !qs.IsObjectiveInProgress( typeof( ReturnDaemonBoneObjective ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
@ -42,4 +38,4 @@ namespace Server.Engines.Quests.Haven
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,13 +19,9 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public override bool CanDrop( PlayerMobile player )
|
||||
{
|
||||
UzeraanTurmoilQuest qs = player.Quest as UzeraanTurmoilQuest;
|
||||
|
||||
if ( qs == null )
|
||||
return true;
|
||||
return !(player.Quest is UzeraanTurmoilQuest);
|
||||
|
||||
//return !qs.IsObjectiveInProgress( typeof( ReturnFertileDirtObjective ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
@ -42,4 +38,4 @@ namespace Server.Engines.Quests.Haven
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,9 +128,7 @@ namespace Server.Engines.Quests.Haven
|
|||
if ( !from.InRange( this.GetWorldLocation(), 2 ) )
|
||||
return;
|
||||
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( from is PlayerMobile player )
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
|
|
@ -202,4 +200,4 @@ namespace Server.Engines.Quests.Haven
|
|||
m_Lantern = (Lantern)reader.ReadItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,8 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public override bool CanDrop( PlayerMobile player )
|
||||
{
|
||||
UzeraanTurmoilQuest qs = player.Quest as UzeraanTurmoilQuest;
|
||||
|
||||
if ( qs == null )
|
||||
return true;
|
||||
|
||||
return !qs.IsObjectiveInProgress( typeof( ReturnScrollOfPowerObjective ) );
|
||||
return !(player.Quest is UzeraanTurmoilQuest qs &&
|
||||
qs.IsObjectiveInProgress(typeof(ReturnScrollOfPowerObjective)));
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
|
|||
|
|
@ -10,9 +10,7 @@ namespace Server.Engines.Quests.Haven
|
|||
{
|
||||
public override bool ValidateUse( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
return ( pm != null && pm.Quest is UzeraanTurmoilQuest );
|
||||
return ( from is PlayerMobile pm && pm.Quest is UzeraanTurmoilQuest );
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
|
|
@ -40,4 +38,4 @@ namespace Server.Engines.Quests.Haven
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,9 +67,7 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public override bool CanTalkTo( PlayerMobile to )
|
||||
{
|
||||
UzeraanTurmoilQuest qs = to.Quest as UzeraanTurmoilQuest;
|
||||
|
||||
return ( qs != null && qs.FindObjective( typeof( FindDryadObjective ) ) != null );
|
||||
return ( to.Quest is UzeraanTurmoilQuest qs && qs.FindObjective( typeof( FindDryadObjective ) ) != null );
|
||||
}
|
||||
|
||||
public override void OnTalk( PlayerMobile player, bool contextMenu )
|
||||
|
|
@ -114,13 +112,9 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( from is PlayerMobile player )
|
||||
{
|
||||
UzeraanTurmoilQuest qs = player.Quest as UzeraanTurmoilQuest;
|
||||
|
||||
if ( qs != null && dropped is Apple && UzeraanTurmoilQuest.HasLostFertileDirt( from ) )
|
||||
if ( player.Quest is UzeraanTurmoilQuest qs && dropped is Apple && UzeraanTurmoilQuest.HasLostFertileDirt( from ) )
|
||||
{
|
||||
FocusTo( from );
|
||||
|
||||
|
|
@ -132,12 +126,10 @@ namespace Server.Engines.Quests.Haven
|
|||
player.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dropped.Consume();
|
||||
qs.AddConversation( new DryadAppleConversation() );
|
||||
return dropped.Deleted;
|
||||
}
|
||||
|
||||
dropped.Consume();
|
||||
qs.AddConversation( new DryadAppleConversation() );
|
||||
return dropped.Deleted;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,10 +64,8 @@ namespace Server.Engines.Quests.Haven
|
|||
if ( m.Player || m is BaseVendor )
|
||||
return false;
|
||||
|
||||
if ( m is BaseCreature )
|
||||
if ( m is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
Mobile master = bc.GetMaster();
|
||||
if ( master != null )
|
||||
return IsEnemy( master );
|
||||
|
|
|
|||
|
|
@ -62,10 +62,8 @@ namespace Server.Engines.Quests.Haven
|
|||
if ( m.Player || m is BaseVendor )
|
||||
return false;
|
||||
|
||||
if ( m is BaseCreature )
|
||||
if ( m is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
Mobile master = bc.GetMaster();
|
||||
if ( master != null )
|
||||
return IsEnemy( master );
|
||||
|
|
|
|||
|
|
@ -54,9 +54,7 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public override bool CanTalkTo( PlayerMobile to )
|
||||
{
|
||||
UzeraanTurmoilQuest qs = to.Quest as UzeraanTurmoilQuest;
|
||||
|
||||
return ( qs != null && qs.FindObjective( typeof( FindSchmendrickObjective ) ) != null );
|
||||
return ( to.Quest is UzeraanTurmoilQuest qs && qs.FindObjective( typeof( FindSchmendrickObjective ) ) != null );
|
||||
}
|
||||
|
||||
public override void OnTalk( PlayerMobile player, bool contextMenu )
|
||||
|
|
|
|||
|
|
@ -198,20 +198,16 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
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 UzeraanTurmoilQuest )
|
||||
{
|
||||
if ( dropped is UzeraanTurmoilHorn )
|
||||
if ( dropped is UzeraanTurmoilHorn horn )
|
||||
{
|
||||
if ( player.Young )
|
||||
{
|
||||
UzeraanTurmoilHorn horn = (UzeraanTurmoilHorn)dropped;
|
||||
|
||||
if ( horn.Charges < 10 )
|
||||
{
|
||||
SayTo( from, 1049384 ); // I have recharged the item for you.
|
||||
|
|
@ -248,12 +244,10 @@ namespace Server.Engines.Quests.Haven
|
|||
player.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dropped.Delete();
|
||||
obj.Complete();
|
||||
return true;
|
||||
}
|
||||
|
||||
dropped.Delete();
|
||||
obj.Complete();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( dropped is QuestFertileDirt )
|
||||
|
|
@ -293,12 +287,10 @@ namespace Server.Engines.Quests.Haven
|
|||
player.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dropped.Delete();
|
||||
obj.Complete();
|
||||
return true;
|
||||
}
|
||||
|
||||
dropped.Delete();
|
||||
obj.Complete();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( dropped is QuestDaemonBlood )
|
||||
|
|
@ -353,12 +345,10 @@ namespace Server.Engines.Quests.Haven
|
|||
player.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dropped.Delete();
|
||||
obj.Complete();
|
||||
return true;
|
||||
}
|
||||
|
||||
dropped.Delete();
|
||||
obj.Complete();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( dropped is QuestDaemonBone )
|
||||
|
|
@ -377,12 +367,10 @@ namespace Server.Engines.Quests.Haven
|
|||
player.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dropped.Delete();
|
||||
obj.Complete();
|
||||
return true;
|
||||
}
|
||||
|
||||
dropped.Delete();
|
||||
obj.Complete();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,9 +143,7 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public static bool HasLostScrollOfPower( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return false;
|
||||
|
||||
QuestSystem qs = pm.Quest;
|
||||
|
|
@ -154,9 +152,7 @@ namespace Server.Engines.Quests.Haven
|
|||
{
|
||||
if ( qs.IsObjectiveInProgress( typeof( ReturnScrollOfPowerObjective ) ) )
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
return ( pack == null || pack.FindItemByType( typeof( SchmendrickScrollOfPower ) ) == null );
|
||||
return ( from.Backpack?.FindItemByType( typeof( SchmendrickScrollOfPower ) ) == null );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -165,9 +161,7 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public static bool HasLostFertileDirt( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return false;
|
||||
|
||||
QuestSystem qs = pm.Quest;
|
||||
|
|
@ -176,9 +170,7 @@ namespace Server.Engines.Quests.Haven
|
|||
{
|
||||
if ( qs.IsObjectiveInProgress( typeof( ReturnFertileDirtObjective ) ) )
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
return ( pack == null || pack.FindItemByType( typeof( QuestFertileDirt ) ) == null );
|
||||
return ( from.Backpack?.FindItemByType( typeof( QuestFertileDirt ) ) == null );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -187,9 +179,7 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public static bool HasLostDaemonBlood( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return false;
|
||||
|
||||
QuestSystem qs = pm.Quest;
|
||||
|
|
@ -198,9 +188,7 @@ namespace Server.Engines.Quests.Haven
|
|||
{
|
||||
if ( qs.IsObjectiveInProgress( typeof( ReturnDaemonBloodObjective ) ) )
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
return ( pack == null || pack.FindItemByType( typeof( QuestDaemonBlood ) ) == null );
|
||||
return ( from.Backpack?.FindItemByType( typeof( QuestDaemonBlood ) ) == null );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -209,9 +197,7 @@ namespace Server.Engines.Quests.Haven
|
|||
|
||||
public static bool HasLostDaemonBone( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return false;
|
||||
|
||||
QuestSystem qs = pm.Quest;
|
||||
|
|
@ -220,9 +206,7 @@ namespace Server.Engines.Quests.Haven
|
|||
{
|
||||
if ( qs.IsObjectiveInProgress( typeof( ReturnDaemonBoneObjective ) ) )
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
return ( pack == null || pack.FindItemByType( typeof( QuestDaemonBone ) ) == null );
|
||||
return ( from.Backpack?.FindItemByType( typeof( QuestDaemonBone ) ) == null );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -427,9 +427,7 @@ namespace Server.Engines.Quests.Hag
|
|||
|
||||
public override void OnRead()
|
||||
{
|
||||
FindIngredientObjective obj = System.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective;
|
||||
|
||||
if ( obj != null )
|
||||
if ( System.FindObjective( typeof( FindIngredientObjective ) ) is FindIngredientObjective obj )
|
||||
System.AddObjective( new FindIngredientObjective( obj.Ingredients, true ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -627,9 +625,7 @@ namespace Server.Engines.Quests.Hag
|
|||
|
||||
public override void OnRead()
|
||||
{
|
||||
FindIngredientObjective obj = System.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective;
|
||||
|
||||
if ( obj != null )
|
||||
if ( System.FindObjective( typeof( FindIngredientObjective ) ) is FindIngredientObjective obj )
|
||||
obj.NextStep();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,17 +62,13 @@ namespace Server.Engines.Quests.Hag
|
|||
if ( !from.InRange( this.GetWorldLocation(), 2 ) )
|
||||
return;
|
||||
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( from is PlayerMobile player )
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
if ( qs is WitchApprenticeQuest )
|
||||
{
|
||||
FindApprenticeObjective obj = qs.FindObjective( typeof( FindApprenticeObjective ) ) as FindApprenticeObjective;
|
||||
|
||||
if ( obj != null && !obj.Completed )
|
||||
if ( qs.FindObjective( typeof( FindApprenticeObjective ) ) is FindApprenticeObjective obj && !obj.Completed )
|
||||
{
|
||||
if ( obj.Corpse == this )
|
||||
{
|
||||
|
|
@ -106,4 +102,4 @@ namespace Server.Engines.Quests.Hag
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,17 +25,13 @@ namespace Server.Engines.Quests.Hag
|
|||
|
||||
from.PlaySound( 0x3D );
|
||||
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null )
|
||||
if ( from is PlayerMobile player )
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
if ( qs is WitchApprenticeQuest )
|
||||
{
|
||||
FindZeefzorpulObjective obj = qs.FindObjective( typeof( FindZeefzorpulObjective ) ) as FindZeefzorpulObjective;
|
||||
|
||||
if ( obj != null && !obj.Completed )
|
||||
if ( qs.FindObjective( typeof( FindZeefzorpulObjective ) ) is FindZeefzorpulObjective obj && !obj.Completed )
|
||||
{
|
||||
if ( ( player.Map != Map.Trammel && player.Map != Map.Felucca ) || !player.InRange( obj.ImpLocation, 8 ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,9 +58,7 @@ namespace Server.Engines.Quests.Hag
|
|||
|
||||
if ( qs is WitchApprenticeQuest )
|
||||
{
|
||||
FindIngredientObjective obj = qs.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective;
|
||||
|
||||
if ( obj != null && !obj.Completed && obj.Ingredient == Ingredient.Whiskey )
|
||||
if ( qs.FindObjective( typeof( FindIngredientObjective ) ) is FindIngredientObjective obj && !obj.Completed && obj.Ingredient == Ingredient.Whiskey )
|
||||
{
|
||||
PlaySound( Utility.RandomBool() ? 0x42E : 0x43F );
|
||||
|
||||
|
|
@ -71,10 +69,7 @@ namespace Server.Engines.Quests.Hag
|
|||
{
|
||||
obj.Complete();
|
||||
|
||||
if ( obj.BlackheartMet )
|
||||
qs.AddConversation( new BlackheartPirateConversation( false ) );
|
||||
else
|
||||
qs.AddConversation( new BlackheartPirateConversation( true ) );
|
||||
qs.AddConversation( new BlackheartPirateConversation( !obj.BlackheartMet ) );
|
||||
}
|
||||
else if ( !obj.BlackheartMet )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -138,10 +138,10 @@ namespace Server.Engines.Quests.Hag
|
|||
{
|
||||
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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -75,9 +75,7 @@ namespace Server.Engines.Quests.Hag
|
|||
|
||||
private void DeleteImp( object imp )
|
||||
{
|
||||
Mobile m = imp as Mobile;
|
||||
|
||||
if ( m != null && !m.Deleted )
|
||||
if ( imp is Mobile m && !m.Deleted )
|
||||
{
|
||||
Effects.SendLocationEffect( m.Location, m.Map, 0x3728, 10, 10 );
|
||||
Effects.PlaySound( m.Location, m.Map, 0x1FE );
|
||||
|
|
@ -269,9 +267,7 @@ namespace Server.Engines.Quests.Hag
|
|||
|
||||
private void DeleteImp( object imp )
|
||||
{
|
||||
Mobile m = imp as Mobile;
|
||||
|
||||
if ( m != null && !m.Deleted )
|
||||
if ( imp is Mobile m && !m.Deleted )
|
||||
{
|
||||
Effects.SendLocationEffect( m.Location, m.Map, 0x3728, 10, 10 );
|
||||
Effects.PlaySound( m.Location, m.Map, 0x1FE );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue