diff --git a/BetterTaxes.cs b/BetterTaxes.cs index a733a10..184fd57 100644 --- a/BetterTaxes.cs +++ b/BetterTaxes.cs @@ -130,13 +130,13 @@ public override void PostSetupContent() { ModWorld thoriumWorld = thoriumMod.GetModWorld("ThoriumWorld"); Call("AddList", "Thorium"); - Call("AddKey", "Thorium", "ragnarok", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedRealityBreaker").GetValue(thoriumWorld); }); - Call("AddKey", "Thorium", "patchwerk", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedPatchwerk").GetValue(thoriumWorld); }); - Call("AddKey", "Thorium", "bloom", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedBloom").GetValue(thoriumWorld); }); - Call("AddKey", "Thorium", "strider", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedStrider").GetValue(thoriumWorld); }); - Call("AddKey", "Thorium", "coznix", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedFallenBeholder").GetValue(thoriumWorld); }); - Call("AddKey", "Thorium", "lich", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedLich").GetValue(thoriumWorld); }); - Call("AddKey", "Thorium", "abyssion", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedDepthBoss").GetValue(thoriumWorld); }); + Call("AddKey", "Thorium", "ragnarok", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedRealityBreaker").GetValue(thoriumWorld); }, -1); + Call("AddKey", "Thorium", "patchwerk", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedPatchwerk").GetValue(thoriumWorld); }, -1); + Call("AddKey", "Thorium", "bloom", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedBloom").GetValue(thoriumWorld); }, -1); + Call("AddKey", "Thorium", "strider", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedStrider").GetValue(thoriumWorld); }, -1); + Call("AddKey", "Thorium", "coznix", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedFallenBeholder").GetValue(thoriumWorld); }, -1); + Call("AddKey", "Thorium", "lich", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedLich").GetValue(thoriumWorld); }, -1); + Call("AddKey", "Thorium", "abyssion", (Func)delegate () { return (bool)thoriumWorld.GetType().GetField("downedDepthBoss").GetValue(thoriumWorld); }, -1); } // HERO's Mod support diff --git a/BetterTaxesConfig.cs b/BetterTaxesConfig.cs index 5de151e..5bc7ca5 100644 --- a/BetterTaxesConfig.cs +++ b/BetterTaxesConfig.cs @@ -270,7 +270,7 @@ public Dictionary GetTaxDefaults() { Dictionary result = StaticConstants.TaxRatesDefaults.ToDictionary(i => i.Key, i => i.Value); - // Here we go ahead and put every single new field we know about into the config and their recommended values, if they exist + // Here we go ahead and put every single new field we know about into the config with their recommended values, if they exist (because otherwise how are you supposed to know about them?) foreach (KeyValuePair>> entry in ModHandler.delegates) { if (entry.Key == "Calamity" || entry.Key == "Thorium") continue; // We already have hardcoded recommended values for these lists @@ -278,7 +278,7 @@ public Dictionary GetTaxDefaults() { string statement = entry.Key + "." + entry2.Key; ModHandler.customStatements.TryGetValue(statement, out int determinedValue); - if (determinedValue > -1) result.Add(statement, determinedValue); + if (!result.ContainsKey(statement) && determinedValue > -1) result.Add(statement, determinedValue); } } @@ -291,6 +291,7 @@ internal void OnDeserializedMethod(StreamingContext context) if (TaxRates == null || TaxRates.Count == 0) TaxRates = GetTaxDefaults(); if (MoneyCap > 2000000000) MoneyCap = 2000000000; + // We always sort the config file so that it follows the actual progression of the game, just looks nice var sortedResults = from entry in TaxRates orderby entry.Value ascending select entry; TaxRates = sortedResults.ToDictionary(pair => pair.Key, pair => pair.Value); } diff --git a/GateParser.cs b/GateParser.cs index 3dafb5e..f8b75cd 100644 --- a/GateParser.cs +++ b/GateParser.cs @@ -14,7 +14,7 @@ public int CalculateRate() { if (entry.Value > taxRate && Interpret(entry.Key)) taxRate = entry.Value; } - if (taxRate == -1) throw new InvalidConfigException("No statement evaluated to true. To avoid this error, you should map the statement \"Base.always\" to a value to fall back on"); + if (taxRate < 1) throw new InvalidConfigException("No statement evaluated to true. To avoid this error, you should map the statement \"Base.always\" to a positive value to fall back on"); if (Main.expertMode && TaxWorld.serverConfig.ExpertModeBoost >= 0) taxRate = (int)(taxRate * TaxWorld.serverConfig.ExpertModeBoost); // Expert mode boost if (Main.xMas) taxRate = (int)(taxRate * 1.1); // Christmas boost diff --git a/ModHandler.cs b/ModHandler.cs index 841f742..5f3f2c1 100644 --- a/ModHandler.cs +++ b/ModHandler.cs @@ -7,24 +7,6 @@ namespace BetterTaxes { public class ModHandler { - /*public static readonly Dictionary legacyLists = new Dictionary { - { "Thorium", new string[7] { "downedRealityBreaker", "downedPatchwerk", "downedBloom", "downedStrider", "downedFallenBeholder", "downedLich", "downedDepthBoss" } } - }; - - public static readonly Dictionary legacySynonyms = new Dictionary { - { "ragnarok", "downedRealityBreaker" }, - { "patchwerk", "downedPatchwerk" }, - { "bloom", "downedBloom" }, - { "strider", "downedStrider" }, - { "coznix", "downedFallenBeholder" }, - { "lich", "downedLich" }, - { "abyssion", "downedDepthBoss" } - }; - - public static readonly Dictionary legacyMods = new Dictionary { - { "Thorium", new string[2] { "ThoriumMod", "ThoriumWorld" } } - };*/ - internal static Dictionary>> delegates = new Dictionary>>(); public static GateParser parser;