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
|
|
@ -23,23 +23,19 @@ namespace Server.Engines.MLQuests
|
|||
public static readonly bool AutoGenerateNew = true;
|
||||
public static readonly bool Debug = false;
|
||||
|
||||
private static Dictionary<Type, MLQuest> m_Quests;
|
||||
private static Dictionary<Type, List<MLQuest>> m_QuestGivers;
|
||||
private static Dictionary<PlayerMobile, MLQuestContext> m_Contexts;
|
||||
|
||||
public static readonly List<MLQuest> EmptyList = new List<MLQuest>();
|
||||
|
||||
public static Dictionary<Type, MLQuest> Quests => m_Quests;
|
||||
public static Dictionary<Type, MLQuest> Quests { get; }
|
||||
|
||||
public static Dictionary<Type, List<MLQuest>> QuestGivers => m_QuestGivers;
|
||||
public static Dictionary<Type, List<MLQuest>> QuestGivers { get; }
|
||||
|
||||
public static Dictionary<PlayerMobile, MLQuestContext> Contexts => m_Contexts;
|
||||
public static Dictionary<PlayerMobile, MLQuestContext> Contexts { get; }
|
||||
|
||||
static MLQuestSystem()
|
||||
{
|
||||
m_Quests = new Dictionary<Type, MLQuest>();
|
||||
m_QuestGivers = new Dictionary<Type, List<MLQuest>>();
|
||||
m_Contexts = new Dictionary<PlayerMobile, MLQuestContext>();
|
||||
Quests = new Dictionary<Type, MLQuest>();
|
||||
QuestGivers = new Dictionary<Type, List<MLQuest>>();
|
||||
Contexts = new Dictionary<PlayerMobile, MLQuestContext>();
|
||||
|
||||
string cfgPath = Path.Combine( Core.BaseDirectory, Path.Combine( "Data", "MLQuests.cfg" ) );
|
||||
|
||||
|
|
@ -103,13 +99,13 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
private static void Register( Type type, MLQuest quest )
|
||||
{
|
||||
m_Quests[type] = quest;
|
||||
Quests[type] = quest;
|
||||
}
|
||||
|
||||
private static void RegisterQuestGiver( MLQuest quest, Type questerType )
|
||||
{
|
||||
if (!m_QuestGivers.TryGetValue( questerType, out List<MLQuest> questList ))
|
||||
m_QuestGivers[questerType] = questList = new List<MLQuest>();
|
||||
if (!QuestGivers.TryGetValue( questerType, out List<MLQuest> questList ))
|
||||
QuestGivers[questerType] = questList = new List<MLQuest>();
|
||||
|
||||
questList.Add( quest );
|
||||
}
|
||||
|
|
@ -129,7 +125,7 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
if ( AutoGenerateNew )
|
||||
{
|
||||
foreach ( MLQuest quest in m_Quests.Values )
|
||||
foreach ( MLQuest quest in Quests.Values )
|
||||
{
|
||||
if ( quest != null && !quest.Deserialized )
|
||||
quest.Generate();
|
||||
|
|
@ -157,14 +153,14 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
if ( e.Length == 0 )
|
||||
{
|
||||
m.SendMessage( "Quest table length: {0}", m_Quests.Count );
|
||||
m.SendMessage( "Quest table length: {0}", Quests.Count );
|
||||
return;
|
||||
}
|
||||
|
||||
Type index = ScriptCompiler.FindTypeByName( e.GetString( 0 ) );
|
||||
MLQuest quest;
|
||||
|
||||
if ( index == null || !m_Quests.TryGetValue( index, out quest ) )
|
||||
if ( index == null || !Quests.TryGetValue( index, out quest ) )
|
||||
{
|
||||
m.SendMessage( "Invalid quest type name." );
|
||||
return;
|
||||
|
|
@ -238,7 +234,7 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
Type index = ScriptCompiler.FindTypeByName( e.GetString( 0 ) );
|
||||
|
||||
if ( index == null || !m_Quests.TryGetValue( index, out MLQuest quest ) )
|
||||
if ( index == null || !Quests.TryGetValue( index, out MLQuest quest ) )
|
||||
{
|
||||
m.SendMessage( "Invalid quest type name." );
|
||||
return;
|
||||
|
|
@ -267,7 +263,7 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
bool enable = ( e.Length == 1 ) ? e.GetBoolean( 0 ) : true;
|
||||
|
||||
foreach ( MLQuest quest in m_Quests.Values )
|
||||
foreach ( MLQuest quest in Quests.Values )
|
||||
quest.SaveEnabled = enable;
|
||||
|
||||
m.SendMessage( "Serialization for all quests is now {0}.", enable ? "enabled" : "disabled" );
|
||||
|
|
@ -561,15 +557,15 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
public static MLQuestContext GetContext( PlayerMobile pm )
|
||||
{
|
||||
m_Contexts.TryGetValue( pm, out MLQuestContext context );
|
||||
Contexts.TryGetValue( pm, out MLQuestContext context );
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
public static MLQuestContext GetOrCreateContext( PlayerMobile pm )
|
||||
{
|
||||
if (!m_Contexts.TryGetValue( pm, out MLQuestContext context ))
|
||||
m_Contexts[pm] = context = new MLQuestContext( pm );
|
||||
if (!Contexts.TryGetValue( pm, out MLQuestContext context ))
|
||||
Contexts[pm] = context = new MLQuestContext( pm );
|
||||
|
||||
return context;
|
||||
}
|
||||
|
|
@ -588,7 +584,7 @@ namespace Server.Engines.MLQuests
|
|||
if ( context != null )
|
||||
{
|
||||
context.HandleDeletion();
|
||||
m_Contexts.Remove( pm );
|
||||
Contexts.Remove( pm );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -725,14 +721,14 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
public static MLQuest FindQuest( Type questType )
|
||||
{
|
||||
m_Quests.TryGetValue( questType, out MLQuest result );
|
||||
Quests.TryGetValue( questType, out MLQuest result );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<MLQuest> FindQuestList( Type questerType )
|
||||
{
|
||||
return m_QuestGivers.TryGetValue(questerType, out List<MLQuest> result) ? result : EmptyList;
|
||||
return QuestGivers.TryGetValue(questerType, out List<MLQuest> result) ? result : EmptyList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue