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.
|
||||
|
|
|
|||
|
|
@ -180,14 +180,12 @@ namespace Server.Gumps
|
|||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
|
||||
if ( p != null )
|
||||
if ( o is IPoint3D p )
|
||||
{
|
||||
if ( p is Item )
|
||||
p = ((Item)p).GetWorldTop();
|
||||
else if ( p is Mobile )
|
||||
p = ((Mobile)p).Location;
|
||||
if ( p is Item item )
|
||||
p = item.GetWorldTop();
|
||||
else if ( p is Mobile m )
|
||||
p = m.Location;
|
||||
|
||||
Server.Commands.Add.Invoke( from, new Point3D( p ), new Point3D( p ), new string[]{ m_Type.Name } );
|
||||
|
||||
|
|
@ -254,4 +252,4 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -543,9 +543,7 @@ namespace Server.Gumps
|
|||
|
||||
for ( int i = 0, index = (listPage * 12); i < 12 && index >= 0 && index < m_List.Count; ++i, ++index )
|
||||
{
|
||||
NetState ns = m_List[index] as NetState;
|
||||
|
||||
if ( ns == null )
|
||||
if ( !(m_List[index] is NetState ns) )
|
||||
continue;
|
||||
|
||||
Mobile m = ns.Mobile;
|
||||
|
|
@ -575,9 +573,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.ClientInfo:
|
||||
{
|
||||
Mobile m = state as Mobile;
|
||||
|
||||
if ( m == null )
|
||||
if ( !(state is Mobile m) )
|
||||
break;
|
||||
|
||||
AddClientHeader();
|
||||
|
|
@ -764,17 +760,12 @@ namespace Server.Gumps
|
|||
|
||||
for ( int i = 0, index = (listPage * 12); i < 12 && index >= 0 && index < m_List.Count; ++i, ++index )
|
||||
{
|
||||
Account a = m_List[index] as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_List[index] is Account a) )
|
||||
continue;
|
||||
|
||||
int offset = 140 + (i * 20);
|
||||
|
||||
AccessLevel accessLevel;
|
||||
bool online;
|
||||
|
||||
GetAccountInfo( a, out accessLevel, out online );
|
||||
GetAccountInfo( a, out var accessLevel, out var online );
|
||||
|
||||
if ( rads == null )
|
||||
{
|
||||
|
|
@ -811,9 +802,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_ChangePassword:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Change Password" ), LabelColor32 ), false, false );
|
||||
|
|
@ -833,9 +822,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_ChangeAccess:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Change Access Level" ), LabelColor32 ), false, false );
|
||||
|
|
@ -868,9 +855,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Information:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
int charCount = 0;
|
||||
|
|
@ -892,10 +877,7 @@ namespace Server.Gumps
|
|||
AddLabel( 20, 190, LabelHue, "Status:" );
|
||||
AddLabel( 200, 190, a.Banned ? RedHue : GreenHue, a.Banned ? "Banned" : "Active" );
|
||||
|
||||
DateTime banTime;
|
||||
TimeSpan banDuration;
|
||||
|
||||
if ( a.Banned && a.GetBanTags( out banTime, out banDuration ) )
|
||||
if ( a.Banned && a.GetBanTags( out var banTime, out var banDuration ) )
|
||||
{
|
||||
if ( banDuration == TimeSpan.MaxValue )
|
||||
{
|
||||
|
|
@ -956,9 +938,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Access:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Access" ), LabelColor32 ), false, false );
|
||||
|
|
@ -970,9 +950,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Access_ClientIPs:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
if ( m_List == null )
|
||||
|
|
@ -1017,9 +995,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Access_Restrictions:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
if ( m_List == null )
|
||||
|
|
@ -1061,9 +1037,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Characters:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Characters" ), LabelColor32 ), false, false );
|
||||
|
|
@ -1103,9 +1077,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Comments:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Comments" ), LabelColor32 ), false, false );
|
||||
|
|
@ -1133,9 +1105,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case AdminGumpPage.AccountDetails_Tags:
|
||||
{
|
||||
Account a = state as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(state is Account a) )
|
||||
break;
|
||||
|
||||
AddHtml( 10, 125, 400, 20, Color( Center( "Tags" ), LabelColor32 ), false, false );
|
||||
|
|
@ -1215,8 +1185,11 @@ namespace Server.Gumps
|
|||
{
|
||||
m_List = new ArrayList();
|
||||
|
||||
foreach ( Account acct in Accounts.GetAccounts() )
|
||||
foreach ( IAccount ia in Accounts.GetAccounts() )
|
||||
{
|
||||
if (!(ia is Account acct))
|
||||
continue;
|
||||
|
||||
IPAddress[] loginList = acct.LoginIPs;
|
||||
|
||||
bool contains = false;
|
||||
|
|
@ -1256,10 +1229,7 @@ namespace Server.Gumps
|
|||
|
||||
int offset = 200 + (i * 20);
|
||||
|
||||
AccessLevel accessLevel;
|
||||
bool online;
|
||||
|
||||
GetAccountInfo( a, out accessLevel, out online );
|
||||
GetAccountInfo( a, out var accessLevel, out var online );
|
||||
|
||||
AddLabelCropped( 12, offset, 120, 20, LabelHue, a.Username );
|
||||
AddLabelCropped( 132, offset, 120, 20, LabelHue, FormatAccessLevel( accessLevel ) );
|
||||
|
|
@ -1671,9 +1641,8 @@ namespace Server.Gumps
|
|||
if ( m_PageType == AdminGumpPage.Accounts )
|
||||
{
|
||||
ArrayList list = m_List;
|
||||
ArrayList rads = m_State as ArrayList;
|
||||
|
||||
if ( list != null && rads != null )
|
||||
if ( list != null && m_State is ArrayList rads )
|
||||
{
|
||||
for ( int i = 0, v = m_ListPage*12; i < 12 && v < list.Count; ++i, ++v )
|
||||
{
|
||||
|
|
@ -1780,10 +1749,9 @@ namespace Server.Gumps
|
|||
case 210:
|
||||
case 211:
|
||||
{
|
||||
TextRelay relay = info.GetTextEntry( 0 );
|
||||
string text = ( relay == null ? null : relay.Text.Trim() );
|
||||
string text = info.GetTextEntry( 0 )?.Text.Trim();
|
||||
|
||||
if ( text == null || text.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(text) )
|
||||
{
|
||||
notice = "You must enter text to broadcast it.";
|
||||
}
|
||||
|
|
@ -1956,11 +1924,10 @@ namespace Server.Gumps
|
|||
|
||||
ArrayList results = new ArrayList();
|
||||
|
||||
TextRelay matchEntry = info.GetTextEntry( 0 );
|
||||
string match = ( matchEntry == null ? null : matchEntry.Text.Trim().ToLower() );
|
||||
string match = info.GetTextEntry( 0 )?.Text.Trim().ToLower();
|
||||
string notice = null;
|
||||
|
||||
if ( match == null || match.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(match) )
|
||||
{
|
||||
notice = String.Format( "You must enter {0} to search.", forName ? "a name" : "an ip address" );
|
||||
}
|
||||
|
|
@ -2022,9 +1989,7 @@ namespace Server.Gumps
|
|||
|
||||
if ( m_List != null && index >= 0 && index < m_List.Count )
|
||||
{
|
||||
NetState ns = m_List[index] as NetState;
|
||||
|
||||
if ( ns == null )
|
||||
if ( !(m_List[index] is NetState ns) )
|
||||
break;
|
||||
|
||||
Mobile m = ns.Mobile;
|
||||
|
|
@ -2057,20 +2022,17 @@ namespace Server.Gumps
|
|||
case 5: from.Prompt = new AddTagNamePrompt( m_State as Account ); from.SendMessage( "Enter the new tag name." ); break;
|
||||
case 6:
|
||||
{
|
||||
TextRelay unEntry = info.GetTextEntry( 0 );
|
||||
TextRelay pwEntry = info.GetTextEntry( 1 );
|
||||
|
||||
string un = ( unEntry == null ? null : unEntry.Text.Trim() );
|
||||
string pw = ( pwEntry == null ? null : pwEntry.Text.Trim() );
|
||||
string un = info.GetTextEntry( 0 )?.Text.Trim();
|
||||
string pw = info.GetTextEntry( 1 )?.Text.Trim();
|
||||
|
||||
Account dispAccount = null;
|
||||
string notice;
|
||||
|
||||
if ( un == null || un.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(un) )
|
||||
{
|
||||
notice = "You must enter a username to add an account.";
|
||||
}
|
||||
else if ( pw == null || pw.Length == 0 )
|
||||
else if ( string.IsNullOrEmpty(pw) )
|
||||
{
|
||||
notice = "You must enter a password to add an account.";
|
||||
}
|
||||
|
|
@ -2098,10 +2060,10 @@ namespace Server.Gumps
|
|||
ArrayList results;
|
||||
|
||||
TextRelay matchEntry = info.GetTextEntry( 0 );
|
||||
string match = ( matchEntry == null ? null : matchEntry.Text.Trim().ToLower() );
|
||||
string match = matchEntry?.Text.Trim().ToLower();
|
||||
string notice = null;
|
||||
|
||||
if ( match == null || match.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(match) )
|
||||
{
|
||||
results = new ArrayList( (ICollection)Accounts.GetAccounts() );
|
||||
results.Sort( AccountComparer.Instance );
|
||||
|
|
@ -2110,10 +2072,10 @@ namespace Server.Gumps
|
|||
else
|
||||
{
|
||||
results = new ArrayList();
|
||||
foreach ( Account check in Accounts.GetAccounts() )
|
||||
foreach ( IAccount acct in Accounts.GetAccounts() )
|
||||
{
|
||||
if ( check.Username.ToLower().IndexOf( match ) >= 0 )
|
||||
results.Add( check );
|
||||
if ( acct.Username.ToLower().IndexOf( match ) >= 0 )
|
||||
results.Add( acct );
|
||||
}
|
||||
|
||||
results.Sort( AccountComparer.Instance );
|
||||
|
|
@ -2130,9 +2092,7 @@ namespace Server.Gumps
|
|||
case 9: from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_ChangeAccess, 0, null, null, m_State ) ); break;
|
||||
case 10: case 11:
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
a.SetUnspecifiedBan( from );
|
||||
|
|
@ -2147,21 +2107,19 @@ namespace Server.Gumps
|
|||
}
|
||||
case 12:
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
TextRelay passwordEntry = info.GetTextEntry( 0 );
|
||||
TextRelay confirmEntry = info.GetTextEntry( 1 );
|
||||
|
||||
string password = ( passwordEntry == null ? null : passwordEntry.Text.Trim() );
|
||||
string confirm = ( confirmEntry == null ? null : confirmEntry.Text.Trim() );
|
||||
string password = passwordEntry?.Text.Trim();
|
||||
string confirm = confirmEntry?.Text.Trim();
|
||||
|
||||
string notice;
|
||||
AdminGumpPage page = AdminGumpPage.AccountDetails_ChangePassword;
|
||||
|
||||
if ( password == null || password.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(password) )
|
||||
{
|
||||
notice = "You must enter the password.";
|
||||
}
|
||||
|
|
@ -2183,9 +2141,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case 16: // view shared
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
ArrayList list = GetSharedAccounts( a.LoginIPs );
|
||||
|
|
@ -2207,9 +2163,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case 17: // ban shared
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
ArrayList list = GetSharedAccounts( a.LoginIPs );
|
||||
|
|
@ -2238,9 +2192,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case 18: // firewall all
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
if ( a.LoginIPs.Length > 0 )
|
||||
|
|
@ -2256,17 +2208,15 @@ namespace Server.Gumps
|
|||
}
|
||||
case 19: // add
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
TextRelay entry = info.GetTextEntry( 0 );
|
||||
string ip = ( entry == null ? null : entry.Text.Trim() );
|
||||
string ip = entry?.Text.Trim();
|
||||
|
||||
string notice;
|
||||
|
||||
if ( ip == null || ip.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(ip) )
|
||||
{
|
||||
notice = "You must enter an address to add.";
|
||||
}
|
||||
|
|
@ -2307,9 +2257,7 @@ namespace Server.Gumps
|
|||
case 23:
|
||||
case 24:
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
AccessLevel newLevel;
|
||||
|
|
@ -2338,9 +2286,7 @@ namespace Server.Gumps
|
|||
}
|
||||
case 25:
|
||||
{
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a == null )
|
||||
if ( !(m_State is Account a) )
|
||||
break;
|
||||
|
||||
from.SendGump( new WarningGump( 1060635, 30720, String.Format( "<center>Account of {0}</center><br>You are about to <em><basefont color=red>permanently delete</basefont></em> the account. Likewise, all characters on the account will be deleted, including equipped, inventory, and banked items. Any houses tied to the account will be demolished.<br><br>Do you wish to continue?", a.Username ), 0xFFC000, 420, 280, new WarningGumpCallback( AccountDelete_Callback ), m_State ) );
|
||||
|
|
@ -2354,9 +2300,8 @@ namespace Server.Gumps
|
|||
case 27: // Ban marked
|
||||
{
|
||||
ArrayList list = m_List;
|
||||
ArrayList rads = m_State as ArrayList;
|
||||
|
||||
if ( list == null || rads == null )
|
||||
if ( list == null || !(m_State is ArrayList rads) )
|
||||
break;
|
||||
|
||||
if ( rads.Count > 0 )
|
||||
|
|
@ -2369,9 +2314,8 @@ namespace Server.Gumps
|
|||
case 28: // Delete marked
|
||||
{
|
||||
ArrayList list = m_List;
|
||||
ArrayList rads = m_State as ArrayList;
|
||||
|
||||
if ( list == null || rads == null )
|
||||
if ( list == null || !(m_State is ArrayList rads) )
|
||||
break;
|
||||
|
||||
if ( rads.Count > 0 )
|
||||
|
|
@ -2384,9 +2328,8 @@ namespace Server.Gumps
|
|||
case 29: // Mark all
|
||||
{
|
||||
ArrayList list = m_List;
|
||||
ArrayList rads = m_State as ArrayList;
|
||||
|
||||
if ( list == null || rads == null )
|
||||
if ( list == null || !(m_State is ArrayList rads) )
|
||||
break;
|
||||
|
||||
from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, m_ListPage, m_List, null, new ArrayList( list ) ) );
|
||||
|
|
@ -2397,7 +2340,7 @@ namespace Server.Gumps
|
|||
{
|
||||
ArrayList results = new ArrayList();
|
||||
|
||||
foreach ( Account acct in Accounts.GetAccounts() )
|
||||
foreach ( IAccount acct in Accounts.GetAccounts() )
|
||||
{
|
||||
bool empty = true;
|
||||
|
||||
|
|
@ -2419,9 +2362,9 @@ namespace Server.Gumps
|
|||
{
|
||||
ArrayList results = new ArrayList();
|
||||
|
||||
foreach ( Account acct in Accounts.GetAccounts() )
|
||||
foreach ( IAccount acct in Accounts.GetAccounts() )
|
||||
{
|
||||
if ( acct.Inactive )
|
||||
if ((acct as Account)?.Inactive == true )
|
||||
results.Add( acct );
|
||||
}
|
||||
|
||||
|
|
@ -2436,9 +2379,9 @@ namespace Server.Gumps
|
|||
{
|
||||
ArrayList results = new ArrayList();
|
||||
|
||||
foreach ( Account acct in Accounts.GetAccounts() )
|
||||
foreach ( IAccount acct in Accounts.GetAccounts() )
|
||||
{
|
||||
if ( acct.Banned )
|
||||
if ((acct as Account)?.Banned == true )
|
||||
results.Add( acct );
|
||||
}
|
||||
|
||||
|
|
@ -2500,9 +2443,7 @@ namespace Server.Gumps
|
|||
{
|
||||
index -= 50;
|
||||
|
||||
Account a = m_State as Account;
|
||||
|
||||
if ( a != null && index >= 0 && index < a.Length )
|
||||
if ( m_State is Account a && index >= 0 && index < a.Length )
|
||||
{
|
||||
Mobile m = a[index];
|
||||
|
||||
|
|
@ -2535,12 +2476,12 @@ namespace Server.Gumps
|
|||
case 0:
|
||||
{
|
||||
TextRelay matchEntry = info.GetTextEntry( 0 );
|
||||
string match = ( matchEntry == null ? null : matchEntry.Text.Trim() );
|
||||
string match = matchEntry?.Text.Trim();
|
||||
|
||||
string notice = null;
|
||||
ArrayList results = new ArrayList();
|
||||
|
||||
if ( match == null || match.Length == 0 )
|
||||
if ( string.IsNullOrEmpty(match) )
|
||||
{
|
||||
notice = "You must enter a username to search.";
|
||||
}
|
||||
|
|
@ -2676,17 +2617,14 @@ namespace Server.Gumps
|
|||
}
|
||||
case 3:
|
||||
{
|
||||
Account a = m.Account as Account;
|
||||
|
||||
if ( a != null )
|
||||
if ( m.Account is Account a )
|
||||
{
|
||||
CommandLogging.WriteLine( from, "{0} {1} {2} {3}", from.AccessLevel, CommandLogging.Format( from ), "banning", CommandLogging.Format( m ) );
|
||||
a.Banned = true;
|
||||
|
||||
NetState ns = m.NetState;
|
||||
|
||||
if ( ns != null )
|
||||
ns.Dispose();
|
||||
ns?.Dispose();
|
||||
|
||||
notice = "They have been banned.";
|
||||
}
|
||||
|
|
@ -2758,9 +2696,7 @@ namespace Server.Gumps
|
|||
{
|
||||
case 3:
|
||||
{
|
||||
Account a = m.Account as Account;
|
||||
|
||||
if ( a != null )
|
||||
if ( m.Account is Account a )
|
||||
from.SendGump( new BanDurationGump( a ) );
|
||||
|
||||
break;
|
||||
|
|
@ -2976,15 +2912,12 @@ namespace Server.Gumps
|
|||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
else if ( x == null )
|
||||
if ( x == null )
|
||||
return -1;
|
||||
else if ( y == null )
|
||||
if ( y == null )
|
||||
return 1;
|
||||
|
||||
NetState a = x as NetState;
|
||||
NetState b = y as NetState;
|
||||
|
||||
if ( a == null || b == null )
|
||||
if ( !(x is NetState a) || !(y is NetState b) )
|
||||
throw new ArgumentException();
|
||||
|
||||
Mobile aMob = a.Mobile;
|
||||
|
|
@ -2992,17 +2925,16 @@ namespace Server.Gumps
|
|||
|
||||
if ( aMob == null && bMob == null )
|
||||
return 0;
|
||||
else if ( aMob == null )
|
||||
if ( aMob == null )
|
||||
return 1;
|
||||
else if ( bMob == null )
|
||||
if ( bMob == null )
|
||||
return -1;
|
||||
|
||||
if ( aMob.AccessLevel > bMob.AccessLevel )
|
||||
return -1;
|
||||
else if ( aMob.AccessLevel < bMob.AccessLevel )
|
||||
if ( aMob.AccessLevel < bMob.AccessLevel )
|
||||
return 1;
|
||||
else
|
||||
return Insensitive.Compare( aMob.Name, bMob.Name );
|
||||
return Insensitive.Compare( aMob.Name, bMob.Name );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3018,33 +2950,26 @@ namespace Server.Gumps
|
|||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
else if ( x == null )
|
||||
if ( x == null )
|
||||
return -1;
|
||||
else if ( y == null )
|
||||
if ( y == null )
|
||||
return 1;
|
||||
|
||||
Account a = x as Account;
|
||||
Account b = y as Account;
|
||||
|
||||
if ( a == null || b == null )
|
||||
if ( !(x is Account a) || !(y is Account b) )
|
||||
throw new ArgumentException();
|
||||
|
||||
AccessLevel aLevel, bLevel;
|
||||
bool aOnline, bOnline;
|
||||
|
||||
GetAccountInfo( a, out aLevel, out aOnline );
|
||||
GetAccountInfo( b, out bLevel, out bOnline );
|
||||
GetAccountInfo( a, out var aLevel, out var aOnline );
|
||||
GetAccountInfo( b, out var bLevel, out var bOnline );
|
||||
|
||||
if ( aOnline && !bOnline )
|
||||
return -1;
|
||||
else if ( bOnline && !aOnline )
|
||||
if ( bOnline && !aOnline )
|
||||
return 1;
|
||||
else if ( aLevel > bLevel )
|
||||
if ( aLevel > bLevel )
|
||||
return -1;
|
||||
else if ( aLevel < bLevel )
|
||||
if ( aLevel < bLevel )
|
||||
return 1;
|
||||
else
|
||||
return Insensitive.Compare( a.Username, b.Username );
|
||||
return Insensitive.Compare( a.Username, b.Username );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,9 +315,8 @@ namespace Server.Gumps
|
|||
|
||||
AddButton( x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 4, GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( node is CAGObject )
|
||||
if ( node is CAGObject obj )
|
||||
{
|
||||
CAGObject obj = (CAGObject)node;
|
||||
int itemID = obj.ItemID;
|
||||
|
||||
Rectangle2D bounds = ItemBounds.Table[itemID];
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@ namespace Server.Gumps
|
|||
|
||||
private static void OnTarget( Mobile from, object target )
|
||||
{
|
||||
Mobile m = target as Mobile;
|
||||
if ( m == null || !m.Player )
|
||||
if ( !(target is Mobile m) || !m.Player )
|
||||
{
|
||||
from.SendMessage( "You must target a player." );
|
||||
return;
|
||||
|
|
@ -53,7 +52,7 @@ namespace Server.Gumps
|
|||
int x = 205 - ((title.Length / 2) * 7);
|
||||
if ( x < 120 )
|
||||
x = 120;
|
||||
AddLabel( x, 12, 2100, title );
|
||||
AddLabel( x, 12, 2100, title );
|
||||
|
||||
AddPage( 1 );
|
||||
AddButton( 12, 12, 0xFA8, 0xFAA, 0x7F, GumpButtonType.Reply, 0 );
|
||||
|
|
@ -97,7 +96,7 @@ namespace Server.Gumps
|
|||
public class CommentPrompt : Prompt
|
||||
{
|
||||
private Account m_Acct;
|
||||
public CommentPrompt( Account acct )
|
||||
public CommentPrompt( Account acct )
|
||||
{
|
||||
m_Acct = acct;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ namespace Server.Gumps
|
|||
|
||||
if ( box.TryDropItem( m_Mobile, toGive, false ) )
|
||||
{
|
||||
if ( toGive is BankCheck )
|
||||
m_Mobile.SendLocalizedMessage( 1060397, ( (BankCheck)toGive ).Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
if ( toGive is BankCheck check )
|
||||
m_Mobile.SendLocalizedMessage( 1060397, check.Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
|
||||
m_House.RemoveKeys( m_Mobile );
|
||||
new TempNoHousingRegion( m_House, m_Mobile );
|
||||
|
|
|
|||
|
|
@ -177,10 +177,10 @@ namespace Server.Gumps
|
|||
object child = node.Children[index];
|
||||
string name = "";
|
||||
|
||||
if ( child is ParentNode )
|
||||
name = ((ParentNode)child).Name;
|
||||
else if ( child is ChildNode )
|
||||
name = ((ChildNode)child).Name;
|
||||
if ( child is ParentNode parentNode )
|
||||
name = parentNode.Name;
|
||||
else if ( child is ChildNode childNode )
|
||||
name = childNode.Name;
|
||||
|
||||
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
|
||||
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, name );
|
||||
|
|
@ -229,16 +229,10 @@ namespace Server.Gumps
|
|||
{
|
||||
object o = m_Node.Children[index];
|
||||
|
||||
if ( o is ParentNode )
|
||||
{
|
||||
from.SendGump( new GoGump( 0, from, m_Tree, (ParentNode)o ) );
|
||||
}
|
||||
if ( o is ParentNode node )
|
||||
from.SendGump( new GoGump( 0, from, m_Tree, node ) );
|
||||
else
|
||||
{
|
||||
ChildNode n = (ChildNode)o;
|
||||
|
||||
from.MoveToWorld( n.Location, m_Tree.Map );
|
||||
}
|
||||
from.MoveToWorld(((ChildNode)o).Location, m_Tree.Map );
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ namespace Server.Gumps
|
|||
|
||||
if ( Guild.NewGuildSystem )
|
||||
{
|
||||
if ( m_Mobile is PlayerMobile )
|
||||
m_Mobile.SendGump( new GuildInfoGump( (PlayerMobile)m_Mobile, m_Guild ) );
|
||||
if ( m_Mobile is PlayerMobile mobile )
|
||||
mobile.SendGump( new GuildInfoGump( mobile, m_Guild ) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,9 +51,7 @@ namespace Server.Guilds
|
|||
{
|
||||
base.OnResponse( sender, info );
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
|
||||
GuildDisplayType display = m_Display;
|
||||
|
|
|
|||
|
|
@ -139,9 +139,7 @@ namespace Server.Guilds
|
|||
{
|
||||
base.OnResponse( sender, info );
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
|
||||
int id = info.ButtonID;
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ namespace Server.Guilds
|
|||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || pm.Guild != null )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || pm.Guild != null )
|
||||
return; //Sanity
|
||||
|
||||
switch( info.ButtonID )
|
||||
|
|
|
|||
|
|
@ -272,9 +272,7 @@ namespace Server.Guilds
|
|||
{
|
||||
base.OnResponse( sender, info );
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
|
||||
if ( AllowAdvancedSearch && info.ButtonID == 8 )
|
||||
|
|
|
|||
|
|
@ -62,9 +62,7 @@ namespace Server.Guilds
|
|||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) || !IsMember( m_Member, guild ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) || !IsMember( m_Member, guild ) )
|
||||
return;
|
||||
|
||||
RankDefinition playerRank = pm.GuildRank;
|
||||
|
|
@ -192,15 +190,10 @@ namespace Server.Guilds
|
|||
|
||||
public void SetTitle_Callback( Mobile from, string text )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
PlayerMobile targ = m_Member;
|
||||
|
||||
if ( pm == null || targ == null )
|
||||
if (!(from is PlayerMobile pm) || m_Member == null )
|
||||
return;
|
||||
|
||||
Guild g = targ.Guild as Guild;
|
||||
|
||||
if ( g == null || !IsMember( pm, g ) || !(pm.GuildRank.GetFlag( RankFlags.CanSetGuildTitle ) && (pm.GuildRank.Rank > targ.GuildRank.Rank || pm == targ)) )
|
||||
if ( !(m_Member.Guild is Guild g) || !IsMember( pm, g ) || !(pm.GuildRank.GetFlag( RankFlags.CanSetGuildTitle ) && (pm.GuildRank.Rank > m_Member.GuildRank.Rank || pm == m_Member)) )
|
||||
{
|
||||
if ( m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0 )
|
||||
pm.SendLocalizedMessage( 1070746 ); // You don't have the permission to set that member's guild title.
|
||||
|
|
@ -220,11 +213,11 @@ namespace Server.Guilds
|
|||
else
|
||||
{
|
||||
if ( Insensitive.Equals( title, "none" ) )
|
||||
targ.GuildTitle = null;
|
||||
m_Member.GuildTitle = null;
|
||||
else
|
||||
targ.GuildTitle = title;
|
||||
m_Member.GuildTitle = title;
|
||||
|
||||
pm.SendLocalizedMessage( 1063156, targ.Name ); // The guild information for ~1_val~ has been updated.
|
||||
pm.SendLocalizedMessage( 1063156, m_Member.Name ); // The guild information for ~1_val~ has been updated.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,9 +182,7 @@ namespace Server.Guilds
|
|||
{
|
||||
base.OnResponse( sender, info );
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) )
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 8 )
|
||||
|
|
|
|||
|
|
@ -22,15 +22,13 @@ namespace Server.Gumps
|
|||
if ( GuildGump.BadMember( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
|
||||
if ( targeted is Mobile )
|
||||
if ( targeted is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)targeted;
|
||||
|
||||
PlayerState guildState = PlayerState.Find( m_Guild.Leader );
|
||||
PlayerState targetState = PlayerState.Find( m );
|
||||
|
||||
Faction guildFaction = ( guildState == null ? null : guildState.Faction );
|
||||
Faction targetFaction = ( targetState == null ? null : targetState.Faction );
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = targetState?.Faction;
|
||||
|
||||
if ( !m.Player )
|
||||
{
|
||||
|
|
@ -92,4 +90,4 @@ namespace Server.Gumps
|
|||
m_Mobile.SendGump( new GuildGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,13 +115,15 @@ namespace Server.Gumps
|
|||
toGive = new BankCheck( m_House.Price );
|
||||
}
|
||||
|
||||
if (AccountGold.Enabled && toGive is BankCheck)
|
||||
BankCheck check = toGive as BankCheck;
|
||||
|
||||
if (AccountGold.Enabled && check != null)
|
||||
{
|
||||
var worth = ((BankCheck)toGive).Worth;
|
||||
var worth = check.Worth;
|
||||
|
||||
if (m_Mobile.Account != null && m_Mobile.Account.DepositGold(worth))
|
||||
{
|
||||
toGive.Delete();
|
||||
check.Delete();
|
||||
|
||||
m_Mobile.SendLocalizedMessage(1060397, worth.ToString("#,0"));
|
||||
// ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
|
|
@ -138,8 +140,8 @@ namespace Server.Gumps
|
|||
|
||||
if ( box.TryDropItem( m_Mobile, toGive, false ) )
|
||||
{
|
||||
if ( toGive is BankCheck )
|
||||
m_Mobile.SendLocalizedMessage( 1060397, ( (BankCheck)toGive ).Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
if ( check != null )
|
||||
m_Mobile.SendLocalizedMessage( 1060397, check.Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
|
||||
m_House.RemoveKeys( m_Mobile );
|
||||
m_House.Delete();
|
||||
|
|
|
|||
|
|
@ -127,10 +127,8 @@ namespace Server.Gumps
|
|||
string name;
|
||||
int labelHue = LabelHue;
|
||||
|
||||
if ( m is PlayerVendor )
|
||||
if ( m is PlayerVendor vendor )
|
||||
{
|
||||
PlayerVendor vendor = (PlayerVendor) m;
|
||||
|
||||
name = vendor.ShopName;
|
||||
|
||||
if ( vendor.IsOwner( from ) )
|
||||
|
|
@ -763,10 +761,10 @@ namespace Server.Gumps
|
|||
|
||||
foreach ( Mobile mobile in newHouse.InternalizedVendors )
|
||||
{
|
||||
if ( mobile is PlayerVendor )
|
||||
((PlayerVendor)mobile).House = newHouse;
|
||||
else if ( mobile is PlayerBarkeeper )
|
||||
((PlayerBarkeeper)mobile).House = newHouse;
|
||||
if ( mobile is PlayerVendor vendor )
|
||||
vendor.House = newHouse;
|
||||
else if ( mobile is PlayerBarkeeper barkeeper )
|
||||
barkeeper.House = newHouse;
|
||||
}
|
||||
|
||||
if ( house.MovingCrate != null )
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ namespace Server.Gumps
|
|||
AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
|
||||
AddAlphaRegion( 10, 40, width - 20, height - 80 );
|
||||
|
||||
if ( content is int )
|
||||
AddHtmlLocalized( 10, 40, width - 20, height - 80, (int)content, contentColor, false, true );
|
||||
if ( content is int i )
|
||||
AddHtmlLocalized( 10, 40, width - 20, height - 80, i, contentColor, false, true );
|
||||
else if ( content is string )
|
||||
AddHtml( 10, 40, width - 20, height - 80, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", contentColor, content ), false, true );
|
||||
|
||||
|
|
@ -41,8 +41,8 @@ namespace Server.Gumps
|
|||
|
||||
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 1 && m_Callback != null )
|
||||
m_Callback( sender.Mobile, m_State );
|
||||
if ( info.ButtonID == 1 )
|
||||
m_Callback?.Invoke( sender.Mobile, m_State );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace Server.Gumps
|
|||
|
||||
if ( from.Backpack != null )
|
||||
totalGold += from.Backpack.GetAmount( typeof( Gold ) );
|
||||
|
||||
|
||||
totalGold += Banker.GetBalance( from );
|
||||
|
||||
if ( totalGold < m_VI.Price )
|
||||
|
|
@ -132,9 +132,9 @@ namespace Server.Gumps
|
|||
|
||||
double days = (m_Vendor.HoldGold + m_Vendor.BankAccount) / ((double)perDay);
|
||||
|
||||
AddHtmlLocalized( 40, 25, 260, 20, 1038318, false, false ); // Amount of days I can work:
|
||||
AddHtmlLocalized( 40, 25, 260, 20, 1038318, false, false ); // Amount of days I can work:
|
||||
AddLabel( 300, 25, 0, ((int)days).ToString() );
|
||||
AddHtmlLocalized( 40, 48, 260, 20, 1038319, false, false ); // Earth days:
|
||||
AddHtmlLocalized( 40, 48, 260, 20, 1038319, false, false ); // Earth days:
|
||||
AddLabel( 300, 48, 0, ((int)(days / 12.0)).ToString() );
|
||||
}
|
||||
|
||||
|
|
@ -188,30 +188,29 @@ namespace Server.Gumps
|
|||
{
|
||||
int goldNeeded = perRealWorldDay - goldHeld;
|
||||
|
||||
AddHtmlLocalized( 40, 35, 260, 20, 1038320, 0x7FFF, false, false ); // Gold needed for 1 day of vendor salary:
|
||||
AddHtmlLocalized( 40, 35, 260, 20, 1038320, 0x7FFF, false, false ); // Gold needed for 1 day of vendor salary:
|
||||
AddLabel( 300, 35, 0x1F, goldNeeded.ToString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
int days = goldHeld / perRealWorldDay;
|
||||
|
||||
AddHtmlLocalized( 40, 35, 260, 20, 1038318, 0x7FFF, false, false ); // # of days Vendor salary is paid for:
|
||||
AddHtmlLocalized( 40, 35, 260, 20, 1038318, 0x7FFF, false, false ); // # of days Vendor salary is paid for:
|
||||
AddLabel( 300, 35, 0x480, days.ToString() );
|
||||
}
|
||||
|
||||
AddHtmlLocalized( 40, 58, 260, 20, 1038324, 0x7FFF, false, false ); // My charge per real world day is:
|
||||
AddHtmlLocalized( 40, 58, 260, 20, 1038324, 0x7FFF, false, false ); // My charge per real world day is:
|
||||
AddLabel( 300, 58, 0x480, perRealWorldDay.ToString() );
|
||||
|
||||
AddHtmlLocalized( 40, 82, 260, 20, 1038322, 0x7FFF, false, false ); // Gold held in my account:
|
||||
AddHtmlLocalized( 40, 82, 260, 20, 1038322, 0x7FFF, false, false ); // Gold held in my account:
|
||||
AddLabel( 300, 82, 0x480, goldHeld.ToString() );
|
||||
|
||||
AddHtmlLocalized( 40, 108, 260, 20, 1062509, 0x7FFF, false, false ); // Shop Name:
|
||||
AddLabel( 140, 106, 0x66D, vendor.ShopName );
|
||||
|
||||
if ( vendor is RentedVendor )
|
||||
if ( vendor is RentedVendor rentedVendor )
|
||||
{
|
||||
int days, hours;
|
||||
((RentedVendor)vendor).ComputeRentalExpireDelay( out days, out hours );
|
||||
rentedVendor.ComputeRentalExpireDelay( out var days, out var hours );
|
||||
|
||||
AddLabel( 38, 132, 0x480, String.Format( "Location rental will expire in {0} day{1} and {2} hour{3}.", days, days != 1 ? "s" : "", hours, hours != 1 ? "s" : "" ) );
|
||||
}
|
||||
|
|
@ -342,7 +341,7 @@ namespace Server.Gumps
|
|||
return null;
|
||||
|
||||
Item i = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
ConstructorInfo ctor = m_Type.GetConstructor( new Type[0] );
|
||||
|
|
@ -352,7 +351,7 @@ namespace Server.Gumps
|
|||
catch
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
@ -544,10 +543,10 @@ namespace Server.Gumps
|
|||
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if ( m_Vendor is PlayerVendor && !((PlayerVendor)m_Vendor).CanInteractWith( from, true ) )
|
||||
if ( m_Vendor is PlayerVendor vendor && !vendor.CanInteractWith( from, true ) )
|
||||
return;
|
||||
|
||||
if ( m_Vendor is PlayerBarkeeper && !((PlayerBarkeeper)m_Vendor).IsOwner( from ) )
|
||||
if ( m_Vendor is PlayerBarkeeper barkeeper && !barkeeper.IsOwner( from ) )
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 0 )
|
||||
|
|
@ -738,10 +737,10 @@ namespace Server.Gumps
|
|||
if ( m_Item.Deleted )
|
||||
return;
|
||||
|
||||
if ( m_Vendor is PlayerVendor && !((PlayerVendor)m_Vendor).CanInteractWith( m_Mob, true ) )
|
||||
if ( m_Vendor is PlayerVendor vendor && !vendor.CanInteractWith( m_Mob, true ) )
|
||||
return;
|
||||
|
||||
if ( m_Vendor is PlayerBarkeeper && !((PlayerBarkeeper)m_Vendor).IsOwner( m_Mob ) )
|
||||
if ( m_Vendor is PlayerBarkeeper barkeeper && !barkeeper.IsOwner( m_Mob ) )
|
||||
return;
|
||||
|
||||
m_Item.Hue = hue;
|
||||
|
|
@ -767,10 +766,10 @@ namespace Server.Gumps
|
|||
if ( m_Vendor.Deleted )
|
||||
return;
|
||||
|
||||
if ( m_Vendor is PlayerVendor && !((PlayerVendor)m_Vendor).CanInteractWith( m_Mob, true ) )
|
||||
if ( m_Vendor is PlayerVendor vendor && !vendor.CanInteractWith( m_Mob, true ) )
|
||||
return;
|
||||
|
||||
if ( m_Vendor is PlayerBarkeeper && !((PlayerBarkeeper)m_Vendor).IsOwner( m_Mob ) )
|
||||
if ( m_Vendor is PlayerBarkeeper barkeeper && !barkeeper.IsOwner( m_Mob ) )
|
||||
return;
|
||||
|
||||
if ( m_FacialHair )
|
||||
|
|
|
|||
|
|
@ -205,10 +205,8 @@ namespace Server.Gumps
|
|||
{
|
||||
AddImageTiled( x - OffsetSize, y, TotalWidth, EntryHeight, BackGumpID + 4 );
|
||||
}
|
||||
else if ( o is Type )
|
||||
else if ( o is Type type )
|
||||
{
|
||||
Type type = (Type)o;
|
||||
|
||||
AddImageTiled( x, y, TypeWidth, EntryHeight, EntryGumpID );
|
||||
AddLabelCropped( x + TextOffsetX, y, TypeWidth - TextOffsetX, EntryHeight, TextHue, type.Name );
|
||||
x += TypeWidth + OffsetSize;
|
||||
|
|
@ -216,10 +214,8 @@ namespace Server.Gumps
|
|||
if ( SetGumpID != 0 )
|
||||
AddImageTiled( x, y, SetWidth, EntryHeight, SetGumpID );
|
||||
}
|
||||
else if ( o is PropertyInfo )
|
||||
else if ( o is PropertyInfo prop )
|
||||
{
|
||||
PropertyInfo prop = (PropertyInfo)o;
|
||||
|
||||
AddImageTiled( x, y, NameWidth, EntryHeight, EntryGumpID );
|
||||
AddLabelCropped( x + TextOffsetX, y, NameWidth - TextOffsetX, EntryHeight, TextHue, prop.Name );
|
||||
x += NameWidth + OffsetSize;
|
||||
|
|
@ -321,10 +317,10 @@ namespace Server.Gumps
|
|||
from.SendGump( new SetListOptionGump( prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames, m_PoisonValues ) );
|
||||
else if ( IsType( type, typeofMap ) )
|
||||
from.SendGump( new SetListOptionGump( prop, from, m_Object, m_Stack, m_Page, m_List, Map.GetMapNames(), Map.GetMapValues() ) );
|
||||
else if ( IsType( type, typeofSkills ) && m_Object is Mobile )
|
||||
else if ( IsType( type, typeofSkills ) && m_Object is Mobile mobile )
|
||||
{
|
||||
from.SendGump( new PropertiesGump( from, m_Object, m_Stack, m_List, m_Page ) );
|
||||
from.SendGump( new SkillsGump( from, (Mobile)m_Object ) );
|
||||
from.SendGump( new PropertiesGump( from, mobile, m_Stack, m_List, m_Page ) );
|
||||
from.SendGump( new SkillsGump( from, mobile ) );
|
||||
}
|
||||
else if ( HasAttribute( type, typeofPropertyObject, true ) )
|
||||
{
|
||||
|
|
@ -378,9 +374,7 @@ namespace Server.Gumps
|
|||
if ( attrs.Length == 0 )
|
||||
return new string[0];
|
||||
|
||||
CustomEnumAttribute ce = attrs[0] as CustomEnumAttribute;
|
||||
|
||||
if ( ce == null )
|
||||
if ( !(attrs[0] is CustomEnumAttribute ce) )
|
||||
return new string[0];
|
||||
|
||||
return ce.Names;
|
||||
|
|
@ -465,60 +459,56 @@ namespace Server.Gumps
|
|||
{
|
||||
return "-null-";
|
||||
}
|
||||
else if ( o is string )
|
||||
if ( o is string s )
|
||||
{
|
||||
return String.Format( "\"{0}\"", (string)o );
|
||||
return String.Format( "\"{0}\"", s );
|
||||
}
|
||||
else if ( o is bool )
|
||||
if ( o is bool )
|
||||
{
|
||||
return o.ToString();
|
||||
}
|
||||
else if ( o is char )
|
||||
if ( o is char c )
|
||||
{
|
||||
return String.Format( "0x{0:X} '{1}'", (int)(char)o, (char)o );
|
||||
return String.Format( "0x{0:X} '{1}'", (int)c, c );
|
||||
}
|
||||
else if ( o is Serial )
|
||||
if ( o is Serial serial )
|
||||
{
|
||||
Serial s = (Serial)o;
|
||||
|
||||
if ( s.IsValid )
|
||||
if ( serial.IsValid )
|
||||
{
|
||||
if ( s.IsItem )
|
||||
if ( serial.IsItem )
|
||||
{
|
||||
return String.Format( "(I) 0x{0:X}", s.Value );
|
||||
return String.Format( "(I) 0x{0:X}", serial.Value );
|
||||
}
|
||||
else if ( s.IsMobile )
|
||||
if ( serial.IsMobile )
|
||||
{
|
||||
return String.Format( "(M) 0x{0:X}", s.Value );
|
||||
return String.Format( "(M) 0x{0:X}", serial.Value );
|
||||
}
|
||||
}
|
||||
|
||||
return String.Format( "(?) 0x{0:X}", s.Value );
|
||||
return String.Format( "(?) 0x{0:X}", serial.Value );
|
||||
}
|
||||
else if ( o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong )
|
||||
if ( o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong )
|
||||
{
|
||||
return String.Format( "{0} (0x{0:X})", o );
|
||||
}
|
||||
else if ( o is Mobile )
|
||||
if ( o is Mobile mobile )
|
||||
{
|
||||
return String.Format( "(M) 0x{0:X} \"{1}\"", ((Mobile)o).Serial.Value, ((Mobile)o).Name );
|
||||
return String.Format( "(M) 0x{0:X} \"{1}\"", mobile.Serial.Value, mobile.Name );
|
||||
}
|
||||
else if ( o is Item )
|
||||
if ( o is Item item )
|
||||
{
|
||||
return String.Format( "(I) 0x{0:X}", ((Item)o).Serial.Value );
|
||||
return String.Format( "(I) 0x{0:X}", item.Serial.Value );
|
||||
}
|
||||
else if ( o is Type )
|
||||
if ( o is Type type )
|
||||
{
|
||||
return ((Type)o).Name;
|
||||
return type.Name;
|
||||
}
|
||||
else if ( o is TextDefinition )
|
||||
if ( o is TextDefinition definition )
|
||||
{
|
||||
return ((TextDefinition)o).Format( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
return o.ToString();
|
||||
return definition.Format( true );
|
||||
}
|
||||
|
||||
return o.ToString();
|
||||
}
|
||||
|
||||
private ArrayList BuildList()
|
||||
|
|
@ -653,56 +643,52 @@ namespace Server.Gumps
|
|||
{
|
||||
return "-null-";
|
||||
}
|
||||
else if ( o is string )
|
||||
if ( o is string s )
|
||||
{
|
||||
return String.Format( "\"{0}\"", (string)o );
|
||||
return String.Format( "\"{0}\"", s );
|
||||
}
|
||||
else if ( o is bool )
|
||||
if ( o is bool )
|
||||
{
|
||||
return o.ToString();
|
||||
}
|
||||
else if ( o is char )
|
||||
if ( o is char c )
|
||||
{
|
||||
return String.Format( "0x{0:X} '{1}'", (int)(char)o, (char)o );
|
||||
return String.Format( "0x{0:X} '{1}'", (int)c, c );
|
||||
}
|
||||
else if ( o is Serial )
|
||||
if ( o is Serial serial )
|
||||
{
|
||||
Serial s = (Serial)o;
|
||||
|
||||
if ( s.IsValid )
|
||||
if ( serial.IsValid )
|
||||
{
|
||||
if ( s.IsItem )
|
||||
if ( serial.IsItem )
|
||||
{
|
||||
return String.Format( "(I) 0x{0:X}", s.Value );
|
||||
return String.Format( "(I) 0x{0:X}", serial.Value );
|
||||
}
|
||||
else if ( s.IsMobile )
|
||||
if ( serial.IsMobile )
|
||||
{
|
||||
return String.Format( "(M) 0x{0:X}", s.Value );
|
||||
return String.Format( "(M) 0x{0:X}", serial.Value );
|
||||
}
|
||||
}
|
||||
|
||||
return String.Format( "(?) 0x{0:X}", s.Value );
|
||||
return String.Format( "(?) 0x{0:X}", serial.Value );
|
||||
}
|
||||
else if ( o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong )
|
||||
if ( o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong )
|
||||
{
|
||||
return String.Format( "{0} (0x{0:X})", o );
|
||||
}
|
||||
else if ( o is Mobile )
|
||||
if ( o is Mobile mobile )
|
||||
{
|
||||
return String.Format( "(M) 0x{0:X} \"{1}\"", ((Mobile)o).Serial.Value, ((Mobile)o).Name );
|
||||
return String.Format( "(M) 0x{0:X} \"{1}\"", mobile.Serial.Value, mobile.Name );
|
||||
}
|
||||
else if ( o is Item )
|
||||
if ( o is Item item )
|
||||
{
|
||||
return String.Format( "(I) 0x{0:X}", ((Item)o).Serial.Value );
|
||||
return String.Format( "(I) 0x{0:X}", item.Serial.Value );
|
||||
}
|
||||
else if ( o is Type )
|
||||
if ( o is Type type )
|
||||
{
|
||||
return ((Type)o).Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return o.ToString();
|
||||
return type.Name;
|
||||
}
|
||||
|
||||
return o.ToString();
|
||||
}
|
||||
|
||||
private class PropertySorter : IComparer
|
||||
|
|
@ -717,9 +703,9 @@ namespace Server.Gumps
|
|||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
else if ( x == null )
|
||||
if ( x == null )
|
||||
return -1;
|
||||
else if ( y == null )
|
||||
if ( y == null )
|
||||
return 1;
|
||||
|
||||
PropertyInfo a = x as PropertyInfo;
|
||||
|
|
@ -759,9 +745,9 @@ namespace Server.Gumps
|
|||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
else if ( x == null )
|
||||
if ( x == null )
|
||||
return -1;
|
||||
else if ( y == null )
|
||||
if ( y == null )
|
||||
return 1;
|
||||
|
||||
if ( !(x is DictionaryEntry) || !(y is DictionaryEntry) )
|
||||
|
|
@ -770,10 +756,7 @@ namespace Server.Gumps
|
|||
DictionaryEntry de1 = (DictionaryEntry)x;
|
||||
DictionaryEntry de2 = (DictionaryEntry)y;
|
||||
|
||||
Type a = (Type)de1.Key;
|
||||
Type b = (Type)de2.Key;
|
||||
|
||||
return GetDistance( a ).CompareTo( GetDistance( b ) );
|
||||
return GetDistance( (Type)de1.Key ).CompareTo( GetDistance( (Type)de2.Key ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ namespace Server.Gumps
|
|||
|
||||
if ( val == null )
|
||||
initialText = "";
|
||||
else if ( val is TextDefinition )
|
||||
initialText = ((TextDefinition)val).GetValue();
|
||||
else if ( val is TextDefinition definition )
|
||||
initialText = definition.GetValue();
|
||||
else
|
||||
initialText = val.ToString();
|
||||
|
||||
|
|
@ -279,4 +279,4 @@ namespace Server.Gumps
|
|||
m_Mobile.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,9 +148,7 @@ namespace Server.Gumps
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p != null )
|
||||
if ( targeted is IPoint3D p )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -235,4 +233,4 @@ namespace Server.Gumps
|
|||
m_Mobile.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,9 +153,7 @@ namespace Server.Gumps
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p != null )
|
||||
if ( targeted is IPoint3D p )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -241,4 +239,4 @@ namespace Server.Gumps
|
|||
m_Mobile.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Server.Gumps
|
|||
Titles.AwardKarma( g, karmaAward, true );
|
||||
}
|
||||
|
||||
if ( m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild )
|
||||
if ( m is PlayerMobile mobile && mobile.NpcGuild == NpcGuild.ThievesGuild )
|
||||
return;
|
||||
|
||||
if ( killers.Count > 0 )
|
||||
|
|
@ -164,9 +164,8 @@ namespace Server.Gumps
|
|||
Timer.DelayCall(TimeSpan.FromMinutes(10), new TimerStateCallback(ReportedListExpiry_Callback), new object[] { from, killer });
|
||||
}
|
||||
|
||||
if (killer is PlayerMobile)
|
||||
if (killer is PlayerMobile pk)
|
||||
{
|
||||
PlayerMobile pk = (PlayerMobile)killer;
|
||||
pk.ResetKillTime();
|
||||
pk.SendLocalizedMessage(1049067);//You have been reported for murder!
|
||||
|
||||
|
|
@ -193,4 +192,4 @@ namespace Server.Gumps
|
|||
from.SendGump( new ReportMurdererGump( from, m_Killers, m_Idx ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,12 +192,12 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_FromSacrifice && from is PlayerMobile )
|
||||
if ( m_FromSacrifice && from is PlayerMobile mobile )
|
||||
{
|
||||
((PlayerMobile)from).AvailableResurrects -= 1;
|
||||
mobile.AvailableResurrects -= 1;
|
||||
|
||||
Container pack = from.Backpack;
|
||||
Container corpse = from.Corpse;
|
||||
Container pack = mobile.Backpack;
|
||||
Container corpse = mobile.Corpse;
|
||||
|
||||
if ( pack != null && corpse != null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -325,9 +325,7 @@ namespace Server.Gumps
|
|||
if ( !m_Contract.IsUsableBy( from, true, false, true, true ) )
|
||||
return;
|
||||
|
||||
Mobile mob = targeted as Mobile;
|
||||
|
||||
if ( mob == null || !mob.Player || !mob.Alive || mob == from )
|
||||
if ( !(targeted is Mobile mob) || !mob.Player || !mob.Alive || mob == from )
|
||||
{
|
||||
from.SendLocalizedMessage(1071984); //That is not a valid target for a rental contract!
|
||||
}
|
||||
|
|
@ -555,7 +553,7 @@ namespace Server.Gumps
|
|||
|
||||
/* The landlord for this vendor is offering you a partial refund of your rental fee
|
||||
* in exchange for immediate termination of your rental contract.<BR><BR>
|
||||
*
|
||||
*
|
||||
* If you accept this offer, the vendor will be immediately dismissed. You will then
|
||||
* be able to claim the inventory and any funds the vendor may be holding for you via
|
||||
* a context menu on the house sign for this house.
|
||||
|
|
@ -613,4 +611,4 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ namespace Server.Gumps
|
|||
|
||||
public static void ViewHouses_OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is Mobile )
|
||||
from.SendGump( new ViewHousesGump( from, GetHouses( (Mobile)targeted ), null ) );
|
||||
if ( targeted is Mobile mobile )
|
||||
from.SendGump( new ViewHousesGump( from, GetHouses( mobile ), null ) );
|
||||
}
|
||||
|
||||
private class HouseComparer : IComparer<BaseHouse>
|
||||
|
|
@ -44,9 +44,7 @@ namespace Server.Gumps
|
|||
{
|
||||
List<BaseHouse> list = new List<BaseHouse>();
|
||||
|
||||
Account acct = owner.Account as Account;
|
||||
|
||||
if ( acct == null )
|
||||
if ( !(owner.Account is Account acct) )
|
||||
{
|
||||
list.AddRange( BaseHouse.GetHouses( owner ) );
|
||||
}
|
||||
|
|
@ -114,21 +112,21 @@ namespace Server.Gumps
|
|||
|
||||
AddHtml( 15, 40 + ((i % 15) * 20), 20, 20, Color( String.Format( "{0}.", i+1 ), White ), false, false );
|
||||
|
||||
if ( name is int )
|
||||
AddHtmlLocalized( 35, 40 + ((i % 15) * 20), 160, 20, (int)name, White16, false, false );
|
||||
else if ( name is string )
|
||||
AddHtml( 35, 40 + ((i % 15) * 20), 160, 20, Color( (string)name, White ), false, false );
|
||||
if ( name is int nameInt )
|
||||
AddHtmlLocalized( 35, 40 + ((i % 15) * 20), 160, 20, nameInt, White16, false, false );
|
||||
else
|
||||
AddHtml( 35, 40 + ((i % 15) * 20), 160, 20, Color( name.ToString(), White ), false, false );
|
||||
|
||||
AddButton( 198, 39 + ((i % 15) * 20), 4005, 4007, i+1, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string houseName, owner, location;
|
||||
string location;
|
||||
Map map = sel.Map;
|
||||
|
||||
houseName = (sel.Sign == null) ? "An Unnamed House" : sel.Sign.GetName();
|
||||
owner = (sel.Owner == null) ? "nobody" : sel.Owner.Name;
|
||||
var houseName = (sel.Sign == null) ? "An Unnamed House" : sel.Sign.GetName();
|
||||
var owner = (sel.Owner == null) ? "nobody" : sel.Owner.Name;
|
||||
|
||||
int xLong = 0, yLat = 0, xMins = 0, yMins = 0;
|
||||
bool xEast = false, ySouth = false;
|
||||
|
|
@ -136,7 +134,7 @@ namespace Server.Gumps
|
|||
bool valid = Sextant.Format( sel.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth );
|
||||
|
||||
if ( valid )
|
||||
location = String.Format( "{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
|
||||
location = String.Format( "{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
|
||||
else
|
||||
location = "unknown";
|
||||
|
||||
|
|
@ -300,4 +298,4 @@ namespace Server.Gumps
|
|||
AddAlphaRegion( x, y, width, height );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ namespace Server.Gumps
|
|||
AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
|
||||
AddAlphaRegion( 10, 40, width - 20, height - 80 );
|
||||
|
||||
if ( content is int )
|
||||
AddHtmlLocalized( 10, 40, width - 20, height - 80, (int)content, contentColor, false, true );
|
||||
if ( content is int i )
|
||||
AddHtmlLocalized( 10, 40, width - 20, height - 80, i, contentColor, false, true );
|
||||
else if ( content is string )
|
||||
AddHtml( 10, 40, width - 20, height - 80, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", contentColor, content ), false, true );
|
||||
|
||||
|
|
@ -55,10 +55,13 @@ namespace Server.Gumps
|
|||
|
||||
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 1 && m_Callback != null )
|
||||
if (m_Callback == null)
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 1)
|
||||
m_Callback( sender.Mobile, true, m_State );
|
||||
else if ( m_Callback != null )
|
||||
m_Callback( sender.Mobile, false, m_State );
|
||||
else
|
||||
m_Callback.Invoke( sender.Mobile, false, m_State );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ namespace Server.Gumps
|
|||
{
|
||||
Mobile m = states[i].Mobile;
|
||||
|
||||
if ( m != null && (m == owner || !m.Hidden || owner.AccessLevel >= m.AccessLevel || (m is PlayerMobile && ((PlayerMobile)m).VisibilityList.Contains( owner ) ) ) )
|
||||
if ( m != null && (m == owner || !m.Hidden || owner.AccessLevel >= m.AccessLevel || (m is PlayerMobile mobile && mobile.VisibilityList.Contains( owner ) ) ) )
|
||||
{
|
||||
if ( filter != null && ( m.Name == null || m.Name.ToLower().IndexOf( filter ) < 0 ) )
|
||||
continue;
|
||||
|
|
@ -281,7 +281,7 @@ namespace Server.Gumps
|
|||
from.SendMessage( "That player is no longer online." );
|
||||
from.SendGump( new WhoGump( from, m_Mobiles, m_Page ) );
|
||||
}
|
||||
else if ( m == from || !m.Hidden || from.AccessLevel >= m.AccessLevel || (m is PlayerMobile && ((PlayerMobile)m).VisibilityList.Contains( from )))
|
||||
else if ( m == from || !m.Hidden || from.AccessLevel >= m.AccessLevel || (m is PlayerMobile mobile && mobile.VisibilityList.Contains( from )))
|
||||
{
|
||||
from.SendGump( new ClientGump( from, m.NetState ) );
|
||||
}
|
||||
|
|
@ -297,4 +297,4 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,11 +59,11 @@ namespace Server.Gumps
|
|||
|
||||
/* As a 'Young' player, you are currently under a system of protection that prevents
|
||||
* you from being attacked by other players and certain monsters.<br><br>
|
||||
*
|
||||
*
|
||||
* If you choose to renounce your status as a 'Young' player, you will lose this protection.
|
||||
* You will become vulnerable to other players, and many monsters that had only glared
|
||||
* at you menacingly before will now attack you on sight!<br><br>
|
||||
*
|
||||
*
|
||||
* Select OKAY now if you wish to renounce your status as a 'Young' player, otherwise
|
||||
* press CANCEL.
|
||||
*/
|
||||
|
|
@ -82,9 +82,7 @@ namespace Server.Gumps
|
|||
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
Account acc = from.Account as Account;
|
||||
|
||||
if ( acc != null )
|
||||
if ( from.Account is Account acc )
|
||||
{
|
||||
acc.RemoveYoungStatus( 502085 ); // You have chosen to renounce your `Young' player status.
|
||||
}
|
||||
|
|
@ -95,4 +93,4 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,18 +69,8 @@ namespace Server.Engines.Events
|
|||
|
||||
public static void EventSink_PlayerDeath( PlayerDeathEventArgs e )
|
||||
{
|
||||
if ( e.Mobile != null && !e.Mobile.Deleted ) /* not sure .. better safe than sorry? */
|
||||
{
|
||||
if ( e.Mobile is PlayerMobile )
|
||||
{
|
||||
PlayerMobile player = e.Mobile as PlayerMobile;
|
||||
|
||||
if ( m_Timer.Running && !m_DeathQueue.Contains( player ) && m_DeathQueue.Count < m_DeathQueueLimit )
|
||||
{
|
||||
m_DeathQueue.Add( player );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( e.Mobile is PlayerMobile player && !player.Deleted && m_Timer.Running && !m_DeathQueue.Contains( player ) && m_DeathQueue.Count < m_DeathQueueLimit )
|
||||
m_DeathQueue.Add( player );
|
||||
}
|
||||
|
||||
private static void Clear_Callback()
|
||||
|
|
|
|||
|
|
@ -84,10 +84,8 @@ namespace Server.Items
|
|||
if ( IsSigned || !IsChildOf( from.Backpack ) )
|
||||
return;
|
||||
|
||||
if ( targeted is Mobile )
|
||||
if ( targeted is Mobile m )
|
||||
{
|
||||
Mobile m = (Mobile)targeted;
|
||||
|
||||
if ( !m.Alive )
|
||||
{
|
||||
from.SendLocalizedMessage( 1152269 ); // That target is dead and even Cupid's arrow won't make them love you.
|
||||
|
|
|
|||
|
|
@ -134,9 +134,7 @@ namespace Server.Items
|
|||
|
||||
public void Fire( Mobile from )
|
||||
{
|
||||
BaseRanged bow = from.Weapon as BaseRanged;
|
||||
|
||||
if ( bow == null )
|
||||
if ( !(from.Weapon is BaseRanged bow) )
|
||||
{
|
||||
SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this.
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue