Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -5,9 +5,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public class AreaCommandImplementor : BaseCommandImplementor
|
||||
{
|
||||
private static AreaCommandImplementor m_Instance;
|
||||
|
||||
public static AreaCommandImplementor Instance => m_Instance;
|
||||
public static AreaCommandImplementor Instance { get; private set; }
|
||||
|
||||
public AreaCommandImplementor()
|
||||
{
|
||||
|
|
@ -18,7 +16,7 @@ namespace Server.Commands.Generic
|
|||
Usage = "Area <command> [condition]";
|
||||
Description = "Invokes the command on all appropriate objects in a targeted area. Optional condition arguments can further restrict the set of objects.";
|
||||
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public override void Process( Mobile from, BaseCommand command, string[] args )
|
||||
|
|
|
|||
|
|
@ -47,55 +47,23 @@ namespace Server.Commands.Generic
|
|||
Register( new FacetCommandImplementor() );
|
||||
}
|
||||
|
||||
private string[] m_Accessors;
|
||||
private AccessLevel m_AccessLevel;
|
||||
private CommandSupport m_SupportRequirement;
|
||||
private Dictionary<string, BaseCommand> m_Commands;
|
||||
private string m_Usage;
|
||||
private string m_Description;
|
||||
private bool m_SupportsConditionals;
|
||||
public bool SupportsConditionals { get; set; }
|
||||
|
||||
public bool SupportsConditionals
|
||||
{
|
||||
get => m_SupportsConditionals;
|
||||
set => m_SupportsConditionals = value;
|
||||
}
|
||||
public string[] Accessors { get; set; }
|
||||
|
||||
public string[] Accessors
|
||||
{
|
||||
get => m_Accessors;
|
||||
set => m_Accessors = value;
|
||||
}
|
||||
public string Usage { get; set; }
|
||||
|
||||
public string Usage
|
||||
{
|
||||
get => m_Usage;
|
||||
set => m_Usage = value;
|
||||
}
|
||||
public string Description { get; set; }
|
||||
|
||||
public string Description
|
||||
{
|
||||
get => m_Description;
|
||||
set => m_Description = value;
|
||||
}
|
||||
public AccessLevel AccessLevel { get; set; }
|
||||
|
||||
public AccessLevel AccessLevel
|
||||
{
|
||||
get => m_AccessLevel;
|
||||
set => m_AccessLevel = value;
|
||||
}
|
||||
public CommandSupport SupportRequirement { get; set; }
|
||||
|
||||
public CommandSupport SupportRequirement
|
||||
{
|
||||
get => m_SupportRequirement;
|
||||
set => m_SupportRequirement = value;
|
||||
}
|
||||
|
||||
public Dictionary<string, BaseCommand> Commands => m_Commands;
|
||||
public Dictionary<string, BaseCommand> Commands { get; }
|
||||
|
||||
public BaseCommandImplementor()
|
||||
{
|
||||
m_Commands = new Dictionary<string, BaseCommand>( StringComparer.OrdinalIgnoreCase );
|
||||
Commands = new Dictionary<string, BaseCommand>( StringComparer.OrdinalIgnoreCase );
|
||||
}
|
||||
|
||||
public virtual void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
|
||||
|
|
@ -106,7 +74,7 @@ namespace Server.Commands.Generic
|
|||
public virtual void Register( BaseCommand command )
|
||||
{
|
||||
for ( int i = 0; i < command.Commands.Length; ++i )
|
||||
m_Commands[command.Commands[i]] = command;
|
||||
Commands[command.Commands[i]] = command;
|
||||
}
|
||||
|
||||
public bool CheckObjectTypes( Mobile from, BaseCommand command, Extensions ext, out bool items, out bool mobiles )
|
||||
|
|
@ -274,7 +242,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
if ( e.Length >= 1 )
|
||||
{
|
||||
m_Commands.TryGetValue( e.GetString( 0 ), out BaseCommand command );
|
||||
Commands.TryGetValue( e.GetString( 0 ), out BaseCommand command );
|
||||
|
||||
if ( command == null )
|
||||
{
|
||||
|
|
@ -303,11 +271,11 @@ namespace Server.Commands.Generic
|
|||
|
||||
public void Register()
|
||||
{
|
||||
if ( m_Accessors == null )
|
||||
if ( Accessors == null )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < m_Accessors.Length; ++i )
|
||||
CommandSystem.Register( m_Accessors[i], m_AccessLevel, Execute );
|
||||
for ( int i = 0; i < Accessors.Length; ++i )
|
||||
CommandSystem.Register( Accessors[i], AccessLevel, Execute );
|
||||
}
|
||||
|
||||
public static void Register( BaseCommandImplementor impl )
|
||||
|
|
|
|||
|
|
@ -9,17 +9,15 @@ namespace Server.Commands.Generic
|
|||
private static readonly Type typeofItem = typeof( Item );
|
||||
private static readonly Type typeofMobile = typeof( Mobile );
|
||||
|
||||
private Type m_ObjectType;
|
||||
|
||||
private ICondition[][] m_Conditions;
|
||||
|
||||
private IConditional[] m_Conditionals;
|
||||
|
||||
public Type Type => m_ObjectType;
|
||||
public Type Type { get; }
|
||||
|
||||
public bool IsItem => ( m_ObjectType == null || m_ObjectType == typeofItem || m_ObjectType.IsSubclassOf( typeofItem ) );
|
||||
public bool IsItem => ( Type == null || Type == typeofItem || Type.IsSubclassOf( typeofItem ) );
|
||||
|
||||
public bool IsMobile => ( m_ObjectType == null || m_ObjectType == typeofMobile || m_ObjectType.IsSubclassOf( typeofMobile ) );
|
||||
public bool IsMobile => ( Type == null || Type == typeofMobile || Type.IsSubclassOf( typeofMobile ) );
|
||||
|
||||
public static readonly ObjectConditional Empty = new ObjectConditional( null, null );
|
||||
|
||||
|
|
@ -33,12 +31,12 @@ namespace Server.Commands.Generic
|
|||
m_Conditionals = new IConditional[m_Conditions.Length];
|
||||
|
||||
for ( int i = 0; i < m_Conditionals.Length; ++i )
|
||||
m_Conditionals[i] = ConditionalCompiler.Compile( emitter, m_ObjectType, m_Conditions[i], i );
|
||||
m_Conditionals[i] = ConditionalCompiler.Compile( emitter, Type, m_Conditions[i], i );
|
||||
}
|
||||
|
||||
public bool CheckCondition( object obj )
|
||||
{
|
||||
if ( m_ObjectType == null )
|
||||
if ( Type == null )
|
||||
return true; // null type means no condition
|
||||
|
||||
if ( !HasCompiled )
|
||||
|
|
@ -243,7 +241,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public ObjectConditional( Type objectType, ICondition[][] conditions )
|
||||
{
|
||||
m_ObjectType = objectType;
|
||||
Type = objectType;
|
||||
m_Conditions = conditions;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public class RangeCommandImplementor : BaseCommandImplementor
|
||||
{
|
||||
private static RangeCommandImplementor m_Instance;
|
||||
|
||||
public static RangeCommandImplementor Instance => m_Instance;
|
||||
public static RangeCommandImplementor Instance { get; private set; }
|
||||
|
||||
public RangeCommandImplementor()
|
||||
{
|
||||
|
|
@ -15,7 +13,7 @@ namespace Server.Commands.Generic
|
|||
Usage = "Range <range> <command> [condition]";
|
||||
Description = "Invokes the command on all appropriate objects within a specified range of you. Optional condition arguments can further restrict the set of objects.";
|
||||
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public override void Execute( CommandEventArgs e )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue