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 );
|
||||
|
|
|
|||
|
|
@ -159,8 +159,7 @@ namespace Server.RemoteAdmin
|
|||
string user = pvSrc.ReadString( 30 );
|
||||
string pw = pvSrc.ReadString( 30 );
|
||||
|
||||
Account a = Accounts.GetAccount( user ) as Account;
|
||||
if ( a == null )
|
||||
if ( !(Accounts.GetAccount( user ) is Account a) )
|
||||
{
|
||||
state.Send( new Login( LoginResponse.NoUser ) );
|
||||
Console.WriteLine( "ADMIN: Invalid username '{0}' from {1}", user, state );
|
||||
|
|
|
|||
|
|
@ -90,9 +90,7 @@ namespace Server.Engines.Reports
|
|||
{
|
||||
for ( int j = 0; j < ss.Children.Count; ++j )
|
||||
{
|
||||
Report report = ss.Children[j] as Report;
|
||||
|
||||
if ( report == null || report.Name != reportName )
|
||||
if ( !(ss.Children[j] is Report report) || report.Name != reportName )
|
||||
continue;
|
||||
|
||||
for ( int k = 0; k < report.Items.Count; ++k )
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@ namespace Server.Engines.Reports
|
|||
{
|
||||
PersistableObject child = ip.GetChild();
|
||||
|
||||
if ( child is ReportColumn )
|
||||
m_Columns.Add( (ReportColumn) child );
|
||||
else if ( child is ReportItem )
|
||||
m_Items.Add( (ReportItem) child );
|
||||
if ( child is ReportColumn column )
|
||||
m_Columns.Add( column );
|
||||
else if ( child is ReportItem item )
|
||||
m_Items.Add( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Accounting;
|
||||
using Server.Engines;
|
||||
using Server.Engines.Help;
|
||||
|
||||
|
|
@ -192,15 +193,7 @@ namespace Server.Engines.Reports
|
|||
|
||||
public static string GetAccount( Mobile mob )
|
||||
{
|
||||
if ( mob == null )
|
||||
return null;
|
||||
|
||||
Accounting.Account acct = mob.Account as Accounting.Account;
|
||||
|
||||
if ( acct == null )
|
||||
return null;
|
||||
|
||||
return acct.Username;
|
||||
return mob?.Account is Account acct ? acct.Username : null;
|
||||
}
|
||||
|
||||
public PageInfo()
|
||||
|
|
|
|||
|
|
@ -51,12 +51,10 @@ namespace Server.Engines.Reports
|
|||
{
|
||||
lock ( RenderLock )
|
||||
{
|
||||
if ( account == null || account.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(account) )
|
||||
return null;
|
||||
|
||||
StaffInfo info = m_StaffInfo[account] as StaffInfo;
|
||||
|
||||
if ( info == null )
|
||||
if ( !(m_StaffInfo[account] is StaffInfo info) )
|
||||
m_StaffInfo[account] = info = new StaffInfo( account );
|
||||
|
||||
return info;
|
||||
|
|
@ -65,12 +63,10 @@ namespace Server.Engines.Reports
|
|||
|
||||
public UserInfo GetUserInfo( string account )
|
||||
{
|
||||
if ( account == null || account.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(account) )
|
||||
return null;
|
||||
|
||||
UserInfo info = m_UserInfo[account] as UserInfo;
|
||||
|
||||
if ( info == null )
|
||||
if ( !(m_UserInfo[account] is UserInfo info) )
|
||||
m_UserInfo[account] = info = new UserInfo( account );
|
||||
|
||||
return info;
|
||||
|
|
@ -123,10 +119,8 @@ namespace Server.Engines.Reports
|
|||
{
|
||||
PersistableObject obj = ip.GetChild();
|
||||
|
||||
if ( obj is PageInfo )
|
||||
if ( obj is PageInfo pageInfo )
|
||||
{
|
||||
PageInfo pageInfo = obj as PageInfo;
|
||||
|
||||
pageInfo.UpdateResolver();
|
||||
|
||||
if ( pageInfo.TimeSent >= min || pageInfo.TimeResolved >= min )
|
||||
|
|
@ -140,10 +134,8 @@ namespace Server.Engines.Reports
|
|||
pageInfo.Resolver = null;
|
||||
}
|
||||
}
|
||||
else if ( obj is QueueStatus )
|
||||
else if ( obj is QueueStatus queueStatus )
|
||||
{
|
||||
QueueStatus queueStatus = obj as QueueStatus;
|
||||
|
||||
if ( queueStatus.TimeStamp >= min )
|
||||
m_QueueStats.Add( queueStatus );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,10 +218,10 @@ namespace Server.Engines.Reports
|
|||
|
||||
private string FindNameFrom( PersistableObject obj )
|
||||
{
|
||||
if ( obj is Report )
|
||||
return (obj as Report).Name;
|
||||
else if ( obj is Chart )
|
||||
return (obj as Chart).Name;
|
||||
if ( obj is Report report )
|
||||
return report.Name;
|
||||
if ( obj is Chart chart )
|
||||
return chart.Name;
|
||||
|
||||
return "Invalid";
|
||||
}
|
||||
|
|
@ -266,12 +266,12 @@ namespace Server.Engines.Reports
|
|||
|
||||
public void RenderDirect( PersistableObject obj, HtmlTextWriter html )
|
||||
{
|
||||
if ( obj is Report )
|
||||
RenderReport( obj as Report, html );
|
||||
else if ( obj is BarGraph )
|
||||
RenderBarGraph( obj as BarGraph, html );
|
||||
else if ( obj is PieChart )
|
||||
RenderPieChart( obj as PieChart, html );
|
||||
if ( obj is Report report )
|
||||
RenderReport( report, html );
|
||||
else if ( obj is BarGraph graph )
|
||||
RenderBarGraph( graph, html );
|
||||
else if ( obj is PieChart chart )
|
||||
RenderPieChart( chart, html );
|
||||
}
|
||||
|
||||
private void RenderPieChart( PieChart chart, HtmlTextWriter html )
|
||||
|
|
@ -538,4 +538,4 @@ namespace Server.Engines.Reports
|
|||
html.RenderEndTag();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -485,16 +485,14 @@ namespace Server.Engines.Reports
|
|||
|
||||
string controller = "Unknown";
|
||||
|
||||
Mobile mob = sigil.RootParent as Mobile;
|
||||
|
||||
if ( mob != null )
|
||||
if ( sigil.RootParent is Mobile mob )
|
||||
{
|
||||
Faction faction = Faction.Find( mob );
|
||||
|
||||
if ( faction != null )
|
||||
controller = faction.Definition.FriendlyName;
|
||||
}
|
||||
else if ( sigil.LastMonolith != null && sigil.LastMonolith.Faction != null )
|
||||
else if ( sigil.LastMonolith?.Faction != null )
|
||||
{
|
||||
controller = sigil.LastMonolith.Faction.Definition.FriendlyName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,13 +94,8 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual bool ValidTrigger( Mobile m )
|
||||
{
|
||||
if ( m is BaseCreature )
|
||||
{
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if ( bc.IsDeadBondedPet || !(bc.Controlled || bc.Summoned) )
|
||||
return false;
|
||||
}
|
||||
if (m is BaseCreature bc && (bc.IsDeadBondedPet || !(bc.Controlled || bc.Summoned)))
|
||||
return false;
|
||||
|
||||
return m.AccessLevel == AccessLevel.Player && ( m.Player || ( m.Alive && !m.Hidden && m.CanBeDamaged() ) );
|
||||
}
|
||||
|
|
@ -120,8 +115,8 @@ namespace Server.Mobiles
|
|||
if ( m_InstantFlag )
|
||||
{
|
||||
foreach ( ISpawnable spawned in Spawned.Keys )
|
||||
if ( spawned is Mobile )
|
||||
((Mobile)spawned).Combatant = m;
|
||||
if ( spawned is Mobile mobile )
|
||||
mobile.Combatant = m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,9 +41,8 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
if ( newItem is Spawner )
|
||||
if ( newItem is Spawner newSpawner )
|
||||
{
|
||||
Spawner newSpawner = newItem as Spawner;
|
||||
for ( int i = 0; i < m_Entries.Count; i++ )
|
||||
newSpawner.AddEntry( m_Entries[i].SpawnedName, m_Entries[i].SpawnedProbability, m_Entries[i].SpawnedMaxCount, false );
|
||||
}
|
||||
|
|
@ -479,8 +478,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
flags = EntryFlags.InvalidProps;
|
||||
|
||||
if ( o is ISpawnable )
|
||||
((ISpawnable)o).Delete();
|
||||
if ( o is ISpawnable spawnable )
|
||||
spawnable.Delete();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -492,10 +491,8 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
if ( o is Mobile )
|
||||
if ( o is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)o;
|
||||
|
||||
m_Spawned.Add( m, entry );
|
||||
entry.Spawned.Add( m );
|
||||
|
||||
|
|
@ -506,10 +503,8 @@ namespace Server.Mobiles
|
|||
|
||||
m.MoveToWorld( loc, map );
|
||||
|
||||
if ( m is BaseCreature )
|
||||
if ( m is BaseCreature c )
|
||||
{
|
||||
BaseCreature c = (BaseCreature)m;
|
||||
|
||||
int walkrange = GetWalkingRange();
|
||||
|
||||
if ( walkrange >= 0 )
|
||||
|
|
@ -529,10 +524,8 @@ namespace Server.Mobiles
|
|||
m.Spawner = this;
|
||||
m.OnAfterSpawn();
|
||||
}
|
||||
else if ( o is Item )
|
||||
else if ( o is Item item )
|
||||
{
|
||||
Item item = (Item)o;
|
||||
|
||||
m_Spawned.Add( item, entry );
|
||||
entry.Spawned.Add( item );
|
||||
|
||||
|
|
@ -583,10 +576,8 @@ namespace Server.Mobiles
|
|||
|
||||
bool waterMob, waterOnlyMob;
|
||||
|
||||
if ( spawned is Mobile )
|
||||
if ( spawned is Mobile mob )
|
||||
{
|
||||
Mobile mob = (Mobile)spawned;
|
||||
|
||||
waterMob = mob.CanSwim;
|
||||
waterOnlyMob = ( mob.CanSwim && mob.CantWalk );
|
||||
}
|
||||
|
|
@ -958,12 +949,10 @@ namespace Server.Mobiles
|
|||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
ISpawnable e = reader.ReadEntity() as ISpawnable;
|
||||
|
||||
if ( e != null )
|
||||
if ( reader.ReadEntity() is ISpawnable e )
|
||||
{
|
||||
if ( e is BaseCreature )
|
||||
((BaseCreature)e).RemoveIfUntamed = true;
|
||||
if ( e is BaseCreature creature )
|
||||
creature.RemoveIfUntamed = true;
|
||||
|
||||
e.Spawner = this;
|
||||
|
||||
|
|
@ -1145,10 +1134,10 @@ namespace Server.Mobiles
|
|||
{
|
||||
object o = m_Spawned[i];
|
||||
|
||||
if ( o is Item )
|
||||
writer.Write( (Item)o );
|
||||
else if ( o is Mobile )
|
||||
writer.Write( (Mobile)o );
|
||||
if ( o is Item item )
|
||||
writer.Write( item );
|
||||
else if ( o is Mobile mobile )
|
||||
writer.Write( mobile );
|
||||
else
|
||||
writer.Write( Serial.MinusOne );
|
||||
}
|
||||
|
|
@ -1172,14 +1161,13 @@ namespace Server.Mobiles
|
|||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
//IEntity e = World.FindEntity( reader.ReadInt() );
|
||||
ISpawnable e = reader.ReadEntity() as ISpawnable;
|
||||
|
||||
if ( e != null )
|
||||
if ( reader.ReadEntity() is ISpawnable e )
|
||||
{
|
||||
e.Spawner = parent;
|
||||
|
||||
if ( e is BaseCreature )
|
||||
((BaseCreature)e).RemoveIfUntamed = true;
|
||||
if ( e is BaseCreature creature )
|
||||
creature.RemoveIfUntamed = true;
|
||||
|
||||
m_Spawned.Add( e );
|
||||
|
||||
|
|
@ -1196,23 +1184,17 @@ namespace Server.Mobiles
|
|||
ISpawnable e = m_Spawned[i];
|
||||
bool remove = false;
|
||||
|
||||
if ( e is Item )
|
||||
if ( e is Item item )
|
||||
{
|
||||
Item item = (Item)e;
|
||||
|
||||
if ( item.Deleted || item.RootParent is Mobile || item.IsLockedDown || item.IsSecure || item.Spawner == null )
|
||||
remove = true;
|
||||
}
|
||||
else if ( e is Mobile )
|
||||
else if ( e is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)e;
|
||||
|
||||
if ( m.Deleted )
|
||||
remove = true;
|
||||
else if ( m is BaseCreature )
|
||||
else if ( m is BaseCreature c )
|
||||
{
|
||||
BaseCreature c = (BaseCreature)m;
|
||||
|
||||
if ( c.Controlled || c.IsStabled )
|
||||
remove = true;
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -124,9 +124,7 @@ namespace Server.Items
|
|||
if ( pigment.Deleted || pigment.UsesRemaining <= 0 || !from.InRange( pigment.GetWorldLocation(), 3 ) || !pigment.IsAccessibleTo( from ))
|
||||
return;
|
||||
|
||||
Item i = targeted as Item;
|
||||
|
||||
if ( i == null )
|
||||
if ( !(targeted is Item i) )
|
||||
from.SendLocalizedMessage( 1070931 ); // You can only dye artifacts and enhanced magic items with this tub.
|
||||
else if ( !from.InRange( i.GetWorldLocation(), 3 ) || !IsAccessibleTo( from ) )
|
||||
from.SendLocalizedMessage( 502436 ); // That is not accessible.
|
||||
|
|
@ -165,12 +163,12 @@ namespace Server.Items
|
|||
|
||||
CraftResource resource = CraftResource.None;
|
||||
|
||||
if ( i is BaseWeapon )
|
||||
resource = ((BaseWeapon)i).Resource;
|
||||
else if ( i is BaseArmor )
|
||||
resource = ((BaseArmor)i).Resource;
|
||||
else if (i is BaseClothing)
|
||||
resource = ((BaseClothing)i).Resource;
|
||||
if ( i is BaseWeapon weapon )
|
||||
resource = weapon.Resource;
|
||||
else if ( i is BaseArmor armor )
|
||||
resource = armor.Resource;
|
||||
else if (i is BaseClothing clothing)
|
||||
resource = clothing.Resource;
|
||||
|
||||
if ( !CraftResources.IsStandard( resource ) )
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -815,10 +815,8 @@ namespace Server.Items
|
|||
int min = 20;
|
||||
int max = 80;
|
||||
|
||||
if ( item is BaseWeapon )
|
||||
if ( item is BaseWeapon weapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
|
||||
else
|
||||
|
|
@ -828,10 +826,8 @@ namespace Server.Items
|
|||
weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
if ( Core.AOS )
|
||||
BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
|
||||
else
|
||||
|
|
@ -840,10 +836,13 @@ namespace Server.Items
|
|||
armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
|
||||
}
|
||||
}
|
||||
else if ( item is BaseHat && Core.AOS )
|
||||
BaseRunicTool.ApplyAttributesTo( (BaseHat)item, attributeCount, min, max );
|
||||
else if ( item is BaseJewel && Core.AOS )
|
||||
BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );
|
||||
else if (Core.AOS)
|
||||
{
|
||||
if ( item is BaseHat hat )
|
||||
BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
|
||||
else if ( item is BaseJewel jewel )
|
||||
BaseRunicTool.ApplyAttributesTo( jewel, attributeCount, min, max );
|
||||
}
|
||||
|
||||
DropItem( item );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,10 +124,7 @@ namespace Server.Misc
|
|||
|
||||
public static void HandleKill( Mobile victim, Mobile killer )
|
||||
{
|
||||
PlayerMobile pm = killer as PlayerMobile;
|
||||
BaseCreature bc = victim as BaseCreature;
|
||||
|
||||
if ( DropEra == TreasuresOfTokunoEra.None || pm == null || bc == null || !CheckLocation( bc ) || !CheckLocation( pm )|| !killer.InRange( victim, 18 ))
|
||||
if ( DropEra == TreasuresOfTokunoEra.None || !(killer is PlayerMobile pm) || !(victim is BaseCreature bc) || !CheckLocation( bc ) || !CheckLocation( pm )|| !killer.InRange( victim, 18 ))
|
||||
return;
|
||||
|
||||
if ( bc.Controlled || bc.Owners.Count > 0 || bc.Fame <= 0 )
|
||||
|
|
@ -246,13 +243,11 @@ namespace Server.Mobiles
|
|||
|
||||
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 = 3;
|
||||
|
||||
if ( m.Alive && Math.Abs( Z - m.Z ) < 16 && InRange( m, range ) && !InRange( oldLocation, range ) )
|
||||
if ( pm.Alive && Math.Abs( Z - pm.Z ) < 16 && InRange( m, range ) && !InRange( oldLocation, range ) )
|
||||
{
|
||||
if ( pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward )
|
||||
{
|
||||
|
|
@ -323,13 +318,13 @@ namespace Server.Gumps
|
|||
for( int i = 0; i < items.Count; i++ )
|
||||
{
|
||||
Item item = (Item)items[i];
|
||||
if ( item is ChestOfHeirlooms && !((ChestOfHeirlooms)item).Locked )
|
||||
if ( item is ChestOfHeirlooms heirlooms && !heirlooms.Locked )
|
||||
continue;
|
||||
|
||||
if ( item is ChestOfHeirlooms && ((ChestOfHeirlooms)item).TrapLevel != 10 )
|
||||
if ( item is ChestOfHeirlooms ofHeirlooms && ofHeirlooms.TrapLevel != 10 )
|
||||
continue;
|
||||
|
||||
if ( item is PigmentsOfTokuno && ((PigmentsOfTokuno)item).Type != PigmentType.None )
|
||||
if ( item is PigmentsOfTokuno tokuno && tokuno.Type != PigmentType.None )
|
||||
continue;
|
||||
|
||||
buttons.Add( new ItemTileButtonInfo( item ) );
|
||||
|
|
@ -385,9 +380,7 @@ namespace Server.Gumps
|
|||
|
||||
public override void HandleCancel( NetState sender )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !pm.InRange( m_Collector.Location, 7 ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !pm.InRange( m_Collector.Location, 7 ) )
|
||||
return;
|
||||
|
||||
if ( pm.ToTItemsTurnedIn == 0 )
|
||||
|
|
@ -555,9 +548,7 @@ namespace Server.Gumps
|
|||
|
||||
public override void HandleButtonResponse( NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !pm.InRange( m_Collector.Location, 7 ) || !(pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !pm.InRange( m_Collector.Location, 7 ) || !(pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward) )
|
||||
return;
|
||||
|
||||
bool pigments = (buttonInfo is PigmentsTileButtonInfo);
|
||||
|
|
@ -566,7 +557,7 @@ namespace Server.Gumps
|
|||
|
||||
if ( pigments )
|
||||
{
|
||||
PigmentsTileButtonInfo p = buttonInfo as PigmentsTileButtonInfo;
|
||||
PigmentsTileButtonInfo p = (PigmentsTileButtonInfo) buttonInfo;
|
||||
|
||||
item = new PigmentsOfTokuno( p.Pigment );
|
||||
}
|
||||
|
|
@ -610,9 +601,7 @@ namespace Server.Gumps
|
|||
|
||||
public override void HandleCancel( NetState sender )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !pm.InRange( m_Collector.Location, 7 ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !pm.InRange( m_Collector.Location, 7 ) )
|
||||
return;
|
||||
|
||||
if ( pm.ToTItemsTurnedIn == 0 )
|
||||
|
|
|
|||
|
|
@ -498,9 +498,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
Account acct = from.Account as Account;
|
||||
|
||||
if ( acct != null && from.AccessLevel == AccessLevel.Player )
|
||||
if ( from.Account is Account acct && from.AccessLevel == AccessLevel.Player )
|
||||
{
|
||||
TimeSpan time = TimeSpan.FromDays( RewardSystem.RewardInterval.TotalDays * 6 ) - ( DateTime.UtcNow - acct.Created );
|
||||
|
||||
|
|
@ -585,12 +583,12 @@ namespace Server.Mobiles
|
|||
BaseHouse house = null;
|
||||
Point3D loc = new Point3D( p );
|
||||
|
||||
if ( targeted is Item && !((Item) targeted).IsLockedDown && !((Item) targeted).IsSecure && !(targeted is AddonComponent) )
|
||||
if ( targeted is Item item && !item.IsLockedDown && !item.IsSecure && !(item is AddonComponent) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1076191 ); // Statues can only be placed in houses.
|
||||
return;
|
||||
}
|
||||
else if ( from.IsBodyMod )
|
||||
if ( from.IsBodyMod )
|
||||
{
|
||||
from.SendLocalizedMessage( 1073648 ); // You may only proceed while in your original state...
|
||||
return;
|
||||
|
|
@ -605,8 +603,8 @@ namespace Server.Mobiles
|
|||
|
||||
house.Addons.Add( plinth );
|
||||
|
||||
if ( m_Maker is IRewardItem )
|
||||
statue.IsRewardItem = ( (IRewardItem) m_Maker).IsRewardItem;
|
||||
if ( m_Maker is IRewardItem rewardItem )
|
||||
statue.IsRewardItem = rewardItem.IsRewardItem;
|
||||
|
||||
statue.Plinth = plinth;
|
||||
plinth.MoveToWorld( loc, map );
|
||||
|
|
@ -638,10 +636,10 @@ namespace Server.Mobiles
|
|||
{
|
||||
if ( !map.CanFit( p.X, p.Y, p.Z, 20, true, true, true ) )
|
||||
return AddonFitResult.Blocked;
|
||||
else if ( !BaseAddon.CheckHouse( from, p, map, 20, ref house ) )
|
||||
if ( !BaseAddon.CheckHouse( from, p, map, 20, ref house ) )
|
||||
return AddonFitResult.NotInHouse;
|
||||
else
|
||||
return CheckDoors( p, 20, house );
|
||||
|
||||
return CheckDoors( p, 20, house );
|
||||
}
|
||||
|
||||
public static AddonFitResult CheckDoors( Point3D p, int height, BaseHouse house )
|
||||
|
|
|
|||
|
|
@ -133,9 +133,9 @@ namespace Server.Gumps
|
|||
|
||||
if ( info.ButtonID == (int) Buttons.Sculpt )
|
||||
{
|
||||
if ( m_Maker is CharacterStatueDeed )
|
||||
if ( m_Maker is CharacterStatueDeed deed )
|
||||
{
|
||||
CharacterStatue backup = ( (CharacterStatueDeed) m_Maker ).Statue;
|
||||
CharacterStatue backup = deed.Statue;
|
||||
|
||||
if ( backup != null )
|
||||
backup.Delete();
|
||||
|
|
@ -180,9 +180,9 @@ namespace Server.Gumps
|
|||
}
|
||||
else if ( info.ButtonID == (int) Buttons.Restore )
|
||||
{
|
||||
if ( m_Maker is CharacterStatueDeed )
|
||||
if ( m_Maker is CharacterStatueDeed deed )
|
||||
{
|
||||
CharacterStatue backup = ( (CharacterStatueDeed) m_Maker ).Statue;
|
||||
CharacterStatue backup = deed.Statue;
|
||||
|
||||
if ( backup != null )
|
||||
m_Statue.Restore( backup );
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.VeteranRewards
|
||||
|
|
@ -51,9 +52,9 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
if ( item != null )
|
||||
{
|
||||
if ( item is Server.Items.RedSoulstone )
|
||||
((Server.Items.RedSoulstone) item).Account = m_From.Account.Username;
|
||||
|
||||
if ( item is RedSoulstone soulstone )
|
||||
soulstone.Account = m_From.Account.Username;
|
||||
|
||||
if ( RewardSystem.ConsumeRewardPoint( m_From ) )
|
||||
m_From.AddToBackpack( item );
|
||||
else
|
||||
|
|
@ -69,4 +70,4 @@ namespace Server.Engines.VeteranRewards
|
|||
m_From.SendGump( new RewardNoticeGump( m_From ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ using Server.Multis;
|
|||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
{
|
||||
public class RewardDemolitionGump : Gump
|
||||
{
|
||||
private IAddon m_Addon;
|
||||
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Cancel,
|
||||
|
|
@ -27,9 +27,9 @@ namespace Server.Gumps
|
|||
|
||||
AddBackground( 0, 0, 220, 170, 0x13BE );
|
||||
AddBackground( 10, 10, 200, 150, 0xBB8 );
|
||||
|
||||
|
||||
AddHtmlLocalized( 20, 30, 180, 60, question, false, false ); // Do you wish to re-deed this decoration?
|
||||
|
||||
|
||||
AddHtmlLocalized( 55, 100, 150, 25, 1011011, false, false ); // CONTINUE
|
||||
AddButton( 20, 100, 0xFA5, 0xFA7, (int) Buttons.Confirm, GumpButtonType.Reply, 0 );
|
||||
|
||||
|
|
@ -39,27 +39,25 @@ namespace Server.Gumps
|
|||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
Item item = m_Addon as Item;
|
||||
|
||||
if ( item == null || item.Deleted )
|
||||
return;
|
||||
if ( !(m_Addon is Item item) || item.Deleted )
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == (int) Buttons.Confirm )
|
||||
{
|
||||
Mobile m = sender.Mobile;
|
||||
BaseHouse house = BaseHouse.FindHouseAt( m );
|
||||
|
||||
if ( house != null && house.IsOwner( m ) )
|
||||
BaseHouse house = BaseHouse.FindHouseAt( m );
|
||||
|
||||
if ( house?.IsOwner( m ) == true )
|
||||
{
|
||||
if ( m.InRange( item.Location, 2 ) )
|
||||
{
|
||||
Item deed = m_Addon.Deed;
|
||||
|
||||
|
||||
if ( deed != null )
|
||||
{
|
||||
m.AddToBackpack( deed );
|
||||
m.AddToBackpack( deed );
|
||||
house.Addons.Remove( item );
|
||||
item.Delete();
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ namespace Server.Engines.VeteranRewards
|
|||
{
|
||||
Item item = Activator.CreateInstance( m_ItemType, m_Args ) as Item;
|
||||
|
||||
if ( item is IRewardItem )
|
||||
((IRewardItem)item).IsRewardItem = true;
|
||||
if ( item is IRewardItem rewardItem )
|
||||
rewardItem.IsRewardItem = true;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
@ -78,4 +78,4 @@ namespace Server.Engines.VeteranRewards
|
|||
category.Entries.Add( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,9 +73,7 @@ namespace Server.Engines.VeteranRewards
|
|||
return false;
|
||||
}
|
||||
|
||||
Account acct = mob.Account as Account;
|
||||
|
||||
if ( acct == null )
|
||||
if ( !(mob.Account is Account acct) )
|
||||
{
|
||||
ts = TimeSpan.Zero;
|
||||
return false;
|
||||
|
|
@ -93,9 +91,7 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
public static int GetRewardLevel( Mobile mob )
|
||||
{
|
||||
Account acct = mob.Account as Account;
|
||||
|
||||
if ( acct == null )
|
||||
if ( !(mob.Account is Account acct) )
|
||||
return 0;
|
||||
|
||||
return GetRewardLevel( acct );
|
||||
|
|
@ -115,9 +111,7 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
public static bool HasHalfLevel( Mobile mob )
|
||||
{
|
||||
Account acct = mob.Account as Account;
|
||||
|
||||
if ( acct == null )
|
||||
if ( !(mob.Account is Account acct) )
|
||||
return false;
|
||||
|
||||
return HasHalfLevel( acct );
|
||||
|
|
@ -134,16 +128,12 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
public static bool ConsumeRewardPoint( Mobile mob )
|
||||
{
|
||||
int cur, max;
|
||||
|
||||
ComputeRewardInfo( mob, out cur, out max );
|
||||
ComputeRewardInfo( mob, out var cur, out var max );
|
||||
|
||||
if ( cur >= max )
|
||||
return false;
|
||||
|
||||
Account acct = mob.Account as Account;
|
||||
|
||||
if ( acct == null )
|
||||
if ( !(mob.Account is Account acct) )
|
||||
return false;
|
||||
|
||||
//if ( mob.AccessLevel < AccessLevel.GameMaster )
|
||||
|
|
@ -154,16 +144,12 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
public static void ComputeRewardInfo( Mobile mob, out int cur, out int max )
|
||||
{
|
||||
int level;
|
||||
|
||||
ComputeRewardInfo( mob, out cur, out max, out level );
|
||||
ComputeRewardInfo( mob, out cur, out max, out _ );
|
||||
}
|
||||
|
||||
public static void ComputeRewardInfo( Mobile mob, out int cur, out int max, out int level )
|
||||
{
|
||||
Account acct = mob.Account as Account;
|
||||
|
||||
if ( acct == null )
|
||||
if ( !(mob.Account is Account acct) )
|
||||
{
|
||||
cur = max = level = 0;
|
||||
return;
|
||||
|
|
@ -213,7 +199,7 @@ namespace Server.Engines.VeteranRewards
|
|||
{
|
||||
if ( (!isRelaxedRules || i > 0) && !HasAccess( from, list, out ts ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1008126, true, Math.Ceiling( ts.TotalDays / 30.0 ).ToString() ); // Your account is not old enough to use this item. Months until you can use this item :
|
||||
from.SendLocalizedMessage( 1008126, true, Math.Ceiling( ts.TotalDays / 30.0 ).ToString() ); // Your account is not old enough to use this item. Months until you can use this item :
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +217,7 @@ namespace Server.Engines.VeteranRewards
|
|||
{
|
||||
if ( (!isRelaxedRules || i > 0) && !HasAccess( from, list, out ts ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1008126, true, Math.Ceiling( ts.TotalDays / 30.0 ).ToString() ); // Your account is not old enough to use this item. Months until you can use this item :
|
||||
from.SendLocalizedMessage( 1008126, true, Math.Ceiling( ts.TotalDays / 30.0 ).ToString() ); // Your account is not old enough to use this item. Months until you can use this item :
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -427,17 +413,17 @@ namespace Server.Engines.VeteranRewards
|
|||
new RewardEntry( etherealSteeds, 1049748, typeof( EtherealBeetle ) ),
|
||||
new RewardEntry( houseAddOns, 1049739, typeof( StoneAnkhDeed ) ),
|
||||
new RewardEntry( houseAddOns, 1080384, typeof( BloodyPentagramDeed ), Expansion.ML )
|
||||
} ),
|
||||
} ),
|
||||
new RewardList( RewardInterval, 6, new RewardEntry[]
|
||||
{
|
||||
new RewardEntry( houseAddOns, 1076188, typeof( CharacterStatueMaker ), Expansion.ML, StatueType.Jade ),
|
||||
new RewardEntry( houseAddOns, 1076189, typeof( CharacterStatueMaker ), Expansion.ML, StatueType.Marble ),
|
||||
new RewardEntry( houseAddOns, 1076190, typeof( CharacterStatueMaker ), Expansion.ML, StatueType.Bronze ),
|
||||
new RewardEntry( houseAddOns, 1076190, typeof( CharacterStatueMaker ), Expansion.ML, StatueType.Bronze ),
|
||||
new RewardEntry( houseAddOns, 1080527, typeof( RewardBrazierDeed ), Expansion.ML )
|
||||
} ),
|
||||
} ),
|
||||
new RewardList( RewardInterval, 7, new RewardEntry[]
|
||||
{
|
||||
new RewardEntry( houseAddOns, 1076157, typeof( CannonDeed ), Expansion.ML ),
|
||||
new RewardEntry( houseAddOns, 1076157, typeof( CannonDeed ), Expansion.ML ),
|
||||
new RewardEntry( houseAddOns, 1080550, typeof( TreeStumpDeed ), Expansion.ML )
|
||||
} ),
|
||||
new RewardList( RewardInterval, 8, new RewardEntry[]
|
||||
|
|
@ -450,17 +436,17 @@ namespace Server.Engines.VeteranRewards
|
|||
new RewardEntry( houseAddOns, 1080549, typeof( WallBannerDeed ), Expansion.ML )
|
||||
} ),
|
||||
new RewardList( RewardInterval, 10, new RewardEntry[]
|
||||
{
|
||||
{
|
||||
new RewardEntry( monsterStatues, 1080520, typeof( MonsterStatuette ), Expansion.ML, MonsterStatuetteType.Harrower ),
|
||||
new RewardEntry( monsterStatues, 1080521, typeof( MonsterStatuette ), Expansion.ML, MonsterStatuetteType.Efreet ),
|
||||
|
||||
new RewardEntry( cloaksAndRobes, 1080382, typeof( RewardCloak ), Expansion.ML, Pink, 1080382 ),
|
||||
new RewardEntry( cloaksAndRobes, 1080380, typeof( RewardRobe ), Expansion.ML, Pink, 1080380 ),
|
||||
new RewardEntry( cloaksAndRobes, 1080380, typeof( RewardRobe ), Expansion.ML, Pink, 1080380 ),
|
||||
new RewardEntry( cloaksAndRobes, 1080378, typeof( RewardDress ), Expansion.ML, Pink, 1080378 ),
|
||||
new RewardEntry( cloaksAndRobes, 1080383, typeof( RewardCloak ), Expansion.ML, Crimson, 1080383 ),
|
||||
new RewardEntry( cloaksAndRobes, 1080381, typeof( RewardRobe ), Expansion.ML, Crimson, 1080381 ),
|
||||
new RewardEntry( cloaksAndRobes, 1080381, typeof( RewardRobe ), Expansion.ML, Crimson, 1080381 ),
|
||||
new RewardEntry( cloaksAndRobes, 1080379, typeof( RewardDress ), Expansion.ML, Crimson, 1080379 ),
|
||||
|
||||
|
||||
new RewardEntry( etherealSteeds, 1080386, typeof( EtherealCuSidhe ), Expansion.ML ),
|
||||
|
||||
new RewardEntry( houseAddOns, 1080548, typeof( MiningCartDeed ), Expansion.ML ),
|
||||
|
|
@ -506,10 +492,10 @@ namespace Server.Engines.VeteranRewards
|
|||
e.Mobile.SkillsCap = 7000;
|
||||
}
|
||||
|
||||
if ( Core.ML && e.Mobile is PlayerMobile && !((PlayerMobile)e.Mobile).HasStatReward && HasHalfLevel( e.Mobile ) )
|
||||
if ( Core.ML && e.Mobile is PlayerMobile mobile && !mobile.HasStatReward && HasHalfLevel( mobile ) )
|
||||
{
|
||||
((PlayerMobile)e.Mobile).HasStatReward = true;
|
||||
e.Mobile.StatCap += 5;
|
||||
mobile.HasStatReward = true;
|
||||
mobile.StatCap += 5;
|
||||
}
|
||||
|
||||
if ( cur < max )
|
||||
|
|
|
|||
|
|
@ -25,9 +25,7 @@ namespace Server
|
|||
|
||||
public static void CheckAtrophy( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
try
|
||||
|
|
@ -44,4 +42,4 @@ namespace Server
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,16 +35,15 @@ namespace Server
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
if ( targeted == pm )
|
||||
{
|
||||
EmbraceHonor( pm );
|
||||
}
|
||||
else if ( targeted is Mobile )
|
||||
Honor( pm, (Mobile) targeted );
|
||||
else if ( targeted is Mobile mobile )
|
||||
Honor( pm, mobile );
|
||||
}
|
||||
|
||||
protected override void OnTargetOutOfRange( Mobile from, object targeted )
|
||||
|
|
@ -145,8 +144,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
BaseCreature cret = target as BaseCreature;
|
||||
if ( target.Body.IsHuman && (cret == null || (!cret.AlwaysAttackable && !cret.AlwaysMurderer)) )
|
||||
if ( target.Body.IsHuman && (!(target is BaseCreature cret) || (!cret.AlwaysAttackable && !cret.AlwaysMurderer)) )
|
||||
{
|
||||
|
||||
if ( reg == null || reg.IsDisabled() )
|
||||
|
|
@ -170,8 +168,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
if ( source.SentHonorContext != null )
|
||||
source.SentHonorContext.Cancel();
|
||||
source.SentHonorContext?.Cancel();
|
||||
|
||||
new HonorContext( source, target );
|
||||
|
||||
|
|
@ -283,7 +280,7 @@ namespace Server
|
|||
m_HonorDamage += amount * 0.8;
|
||||
}
|
||||
}
|
||||
else if ( from is BaseCreature && ((BaseCreature)from).GetMaster() == m_Source )
|
||||
else if ( from is BaseCreature creature && creature.GetMaster() == m_Source )
|
||||
{
|
||||
m_HonorDamage += amount * 0.8;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,9 +47,7 @@ namespace Server
|
|||
if ( !from.CheckAlive() )
|
||||
return;
|
||||
|
||||
PlayerMobile protector = from as PlayerMobile;
|
||||
|
||||
if ( protector == null )
|
||||
if ( !(from is PlayerMobile protector) )
|
||||
return;
|
||||
|
||||
if ( !VirtueHelper.IsSeeker( protector, VirtueName.Justice ) )
|
||||
|
|
@ -159,17 +157,13 @@ namespace Server
|
|||
|
||||
public static void RejectDelay_Callback( object state )
|
||||
{
|
||||
Mobile m = state as Mobile;
|
||||
|
||||
if ( m != null )
|
||||
if ( state is Mobile m )
|
||||
m.EndAction( typeof( JusticeVirtue ) );
|
||||
}
|
||||
|
||||
public static void CheckAtrophy( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
try
|
||||
|
|
@ -207,7 +201,7 @@ namespace Server
|
|||
AddImageTiled( 15, 15, 365, 190, 2624 );
|
||||
AddAlphaRegion( 15, 15, 365, 190 );
|
||||
|
||||
AddHtmlLocalized( 30, 20, 360, 25, 1049365, 0x7FFF, false, false ); // Another player is offering you their <a href="?ForceTopic88">protection</a>:
|
||||
AddHtmlLocalized( 30, 20, 360, 25, 1049365, 0x7FFF, false, false ); // Another player is offering you their <a href="?ForceTopic88">protection</a>:
|
||||
AddLabel( 90, 55, 1153, protector.Name );
|
||||
|
||||
AddImage( 50, 45, 9005 );
|
||||
|
|
@ -247,4 +241,4 @@ namespace Server
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@ namespace Server
|
|||
|
||||
public static void CheckAtrophy( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
try
|
||||
|
|
@ -61,9 +59,7 @@ namespace Server
|
|||
if ( from.Alive )
|
||||
return;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
if ( from.Criminal )
|
||||
|
|
@ -94,14 +90,10 @@ namespace Server
|
|||
if ( !from.CheckAlive() )
|
||||
return;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
Mobile targ = targeted as Mobile;
|
||||
|
||||
if ( targ == null )
|
||||
if ( !(targeted is Mobile targ) )
|
||||
return;
|
||||
|
||||
if ( !ValidateCreature( targ ) )
|
||||
|
|
@ -173,7 +165,7 @@ namespace Server
|
|||
|
||||
public static bool ValidateCreature( Mobile m )
|
||||
{
|
||||
if ( m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned) )
|
||||
if ( m is BaseCreature creature && (creature.Controlled || creature.Summoned) )
|
||||
return false;
|
||||
|
||||
return ( m is Lich || m is Succubus || m is Daemon || m is EvilMage || m is EnslavedGargoyle || m is GargoyleEnforcer );
|
||||
|
|
|
|||
|
|
@ -30,9 +30,7 @@ namespace Server
|
|||
|
||||
public static void CheckAtrophy( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
try
|
||||
|
|
@ -52,9 +50,7 @@ namespace Server
|
|||
|
||||
public static void Valor( Mobile from, object targ )
|
||||
{
|
||||
IdolOfTheChampion idol = targ as IdolOfTheChampion;
|
||||
|
||||
if ( idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted )
|
||||
if ( !(targ is IdolOfTheChampion idol) || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted )
|
||||
from.SendLocalizedMessage( 1054035 ); // You must target a Champion Idol to challenge the Champion's spawn!
|
||||
else if ( from.Hidden )
|
||||
from.SendLocalizedMessage( 1052015 ); // You cannot do that while hidden.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue