Adds settings (#126)

This commit is contained in:
Kamron Batman 2020-05-02 23:41:30 -07:00 committed by GitHub
parent 8028a85ffe
commit f336a56364
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 229 additions and 99 deletions

View file

@ -9,7 +9,7 @@ namespace Server.Ethics
{
public abstract class Ethic
{
public static readonly bool Enabled = false;
public static bool Enabled { get; private set; }
public static readonly Ethic Hero = new HeroEthic();
public static readonly Ethic Evil = new EvilEthic();
@ -98,6 +98,8 @@ namespace Server.Ethics
public static void Initialize()
{
Enabled = ServerConfiguration.GetOrUpdateSetting("ethics.enabled", false);
if (Enabled)
EventSink.Speech += EventSink_Speech;
}

View file

@ -22,9 +22,10 @@ namespace Server.Engines.MLQuests
public static readonly bool Debug = false;
public static readonly List<MLQuest> EmptyList = new List<MLQuest>();
private static readonly List<MLQuest> m_EligiblePool = new List<MLQuest>();
public static bool Enabled { get; private set; }
static MLQuestSystem()
{
Quests = new Dictionary<Type, MLQuest>();
@ -94,8 +95,6 @@ namespace Server.Engines.MLQuests
}
}
public static bool Enabled => Core.ML;
public static Dictionary<Type, MLQuest> Quests { get; }
public static Dictionary<Type, List<MLQuest>> QuestGivers { get; }
@ -125,6 +124,8 @@ namespace Server.Engines.MLQuests
public static void Initialize()
{
Enabled = ServerConfiguration.GetOrUpdateSetting("questSystem.enableMLQuests", Core.ML);
if (!Enabled)
return;

View file

@ -5,9 +5,7 @@ namespace Server
{
public class PathFollower
{
// Should we use pathfinding? 'false' for not
private static readonly bool Enabled = true;
private static bool Enabled;
private static readonly TimeSpan RepathDelay = TimeSpan.FromSeconds(2.0);
private readonly Mobile m_From;
@ -16,6 +14,11 @@ namespace Server
private Point3D m_Next, m_LastGoalLoc;
private MovementPath m_Path;
public static void Initialize()
{
Enabled = ServerConfiguration.GetOrUpdateSetting("pathfinding.enabled", true);
}
public PathFollower(Mobile from, IPoint3D goal)
{
m_From = from;

View file

@ -11,11 +11,10 @@ namespace Server.Engines.VeteranRewards
private static RewardCategory[] m_Categories;
private static RewardList[] m_Lists;
public static bool Enabled = true; // change to true to enable vet rewards
public static bool Enabled { get; private set; }
public static bool
SkillCapRewards =
true; // assuming vet rewards are enabled, should total skill cap bonuses be awarded? (720 skills total at 4th level)
// assuming vet rewards are enabled, should total skill cap bonuses be awarded? (720 skills total at 4th level)
public static bool SkillCapRewards { get; private set; }
public static TimeSpan RewardInterval = TimeSpan.FromDays(30.0);
@ -173,16 +172,13 @@ namespace Server.Engines.VeteranRewards
public static bool CheckIsUsableBy(Mobile from, Item item, object[] args = null)
{
if (m_Lists == null)
SetupRewardTables();
bool isRelaxedRules = item is DyeTub || item is MonsterStatuette;
Type type = item.GetType();
for (int i = 0; i < m_Lists.Length; ++i)
for (int i = 0; i < Lists.Length; ++i)
{
RewardList list = m_Lists[i];
RewardList list = Lists[i];
RewardEntry[] entries = list.Entries;
for (int j = 0; j < entries.Length; ++j)
@ -235,14 +231,11 @@ namespace Server.Engines.VeteranRewards
public static int GetRewardYear(Item item, object[] args)
{
if (m_Lists == null)
SetupRewardTables();
Type type = item.GetType();
for (int i = 0; i < m_Lists.Length; ++i)
for (int i = 0; i < Lists.Length; ++i)
{
RewardList list = m_Lists[i];
RewardList list = Lists[i];
RewardEntry[] entries = list.Entries;
for (int j = 0; j < entries.Length; ++j)
@ -462,6 +455,9 @@ namespace Server.Engines.VeteranRewards
public static void Initialize()
{
Enabled = ServerConfiguration.GetOrUpdateSetting("vetRewards.enabled", true);
SkillCapRewards = ServerConfiguration.GetOrUpdateSetting("vetReards.skillCapRewards", true);
if (Enabled)
EventSink.Login += EventSink_Login;
}