Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of JKConfig v1.0.0
JKConfig.dll
Decompiled 20 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using JKConfig.ContentCfg; using JLL.API; using JLL.ScriptableObjects; using LethalLevelLoader; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("JLL")] [assembly: IgnoresAccessChecksTo("JLLItemsModule")] [assembly: IgnoresAccessChecksTo("LethalLevelLoader")] [assembly: IgnoresAccessChecksTo("LethalLevelLoader.Patcher")] [assembly: IgnoresAccessChecksTo("WesleyMoonScripts")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("JKConfig")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+dd72ca3dc0350ddf0a2595a947cfb05f050b1ba8")] [assembly: AssemblyProduct("JKConfig")] [assembly: AssemblyTitle("JKConfig")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace JKConfig { public static class ConfigFilesLoader { public static void LoadConfigs() { Plugin.mls.LogInfo((object)$"Applying configs for {Plugin.configFiles.Count} JKConfig files"); try { foreach (JKConfigFile configFile in Plugin.configFiles) { configFile.ApplyConfigs(); } } catch (Exception arg) { Plugin.mls.LogError((object)$"Whoopsie bad happened: {arg}"); } } } [CreateAssetMenu(menuName = "JLL/Addon/JKConfig")] public class JKConfigFile : JLLAddon { private ConfigFile File; public List<ItemContentConfig> Items = new List<ItemContentConfig>(); public List<EnemyContentConfig> Enemies = new List<EnemyContentConfig>(); public override void Init(JLLMod parent) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown File = new ConfigFile(Path.Combine(Paths.ConfigPath, "JKConfig", parent.GUID() + ".cfg"), true); Plugin.configFiles.Add(this); } internal void ApplyConfigs() { int num = 0; foreach (ItemContentConfig item in Items) { if (item.Load(File)) { num++; } } foreach (EnemyContentConfig enemy in Enemies) { if (enemy.Load(File)) { num++; } } File.Save(); Plugin.mls.LogInfo((object)$"Applied {num}: {File.ConfigFilePath}"); } } [BepInPlugin("rectorado.JKConfig", "JKConfig", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static UnityAction <0>__LoadConfigs; } private const string modGUID = "rectorado.JKConfig"; private const string modName = "JKConfig"; private const string modVersion = "1.0.0"; internal static ManualLogSource mls; internal static List<JKConfigFile> configFiles = new List<JKConfigFile>(); public void Awake() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown mls = Logger.CreateLogSource("rectorado.JKConfig"); UnityEvent onJLLBundlesLoaded = JFileHelper.OnJLLBundlesLoaded; object obj = <>O.<0>__LoadConfigs; if (obj == null) { UnityAction val = ConfigFilesLoader.LoadConfigs; <>O.<0>__LoadConfigs = val; obj = (object)val; } onJLLBundlesLoaded.AddListener((UnityAction)obj); mls.LogInfo((object)"This thing has loaded supposedly!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "JKConfig"; public const string PLUGIN_NAME = "JKConfig"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace JKConfig.ContentCfg { public abstract class BaseContentConfig<T> where T : ExtendedContent { public T Content; private ConfigFile _file; public bool Load(ConfigFile file) { if ((Object)(object)Content == (Object)null) { return false; } _file = file; bool value = GetValue("Enabled", defaultValue: false, "Enables configuration of this content's properties."); LoadCfg(value); return value; } protected abstract void LoadCfg(bool isEnabled); public bool GetValue(string propertyName, bool defaultValue, string description = "") { return _file.Bind<bool>(((Object)(object)Content).name, propertyName, defaultValue, description).Value; } public int GetValue(string propertyName, int defaultValue, string description = "") { return _file.Bind<int>(((Object)(object)Content).name, propertyName, defaultValue, description).Value; } public float GetValue(string propertyName, float defaultValue, string description = "") { return _file.Bind<float>(((Object)(object)Content).name, propertyName, defaultValue, description).Value; } public string Stringify(IEnumerable<StringWithRarity> properties) { return string.Join(',', properties.Select((StringWithRarity x) => $"{x.Name}:{x.Rarity}")); } public IEnumerable<StringWithRarity> ParseSwr(string config) { string[] split = config.Split(','); string[] array = split; foreach (string s in array) { string[] v = s.Trim().Split(':'); if (v.Length > 1 && int.TryParse(v[1], out var rarity)) { yield return new StringWithRarity(v[0].Trim(), rarity); } } } public IEnumerable<StringWithRarity> GetValue(string propertyName, IEnumerable<StringWithRarity> defaultValue, string description = "") { return ParseSwr(_file.Bind<string>(((Object)(object)Content).name, propertyName, Stringify(defaultValue), description).Value); } public string Stringify(IEnumerable<Vector2WithRarity> properties) { return string.Join(',', properties.Select((Vector2WithRarity x) => $"{x.Min}-{x.Max}:{x.Rarity}")); } public IEnumerable<Vector2WithRarity> ParseV2wr(string config) { string[] split = config.Split(','); string[] array = split; foreach (string s in array) { string[] v = s.Trim().Split(':'); string[] minMax = v[0].Trim().Split('-'); if (v.Length > 1 && float.TryParse(minMax[0], out var x) && float.TryParse(minMax[1], out var y) && int.TryParse(v[1], out var rarity)) { yield return new Vector2WithRarity(x, y, rarity); } } } public IEnumerable<Vector2WithRarity> GetValue(string propertyName, IEnumerable<Vector2WithRarity> defaultValue, string description = "") { return ParseV2wr(_file.Bind<string>(((Object)(object)Content).name, propertyName, Stringify(defaultValue), description).Value); } } [Serializable] public class EnemyContentConfig : BaseContentConfig<ExtendedEnemyType> { private List<StringWithRarity> levelTags = new List<StringWithRarity>(); private List<Vector2WithRarity> currentRoutePrice = new List<Vector2WithRarity>(); private List<StringWithRarity> currentWeather = new List<StringWithRarity>(); private List<StringWithRarity> planetNames = new List<StringWithRarity>(); private float PowerLevel; private int MaxCount; protected override void LoadCfg(bool isEnabled) { PowerLevel = GetValue("PowerLevel", Content.EnemyType.PowerLevel, "The power level for the enemy."); MaxCount = GetValue("MaxCount", Content.EnemyType.MaxCount, "The maximum count for the enemy."); ExtendedEnemyType content = Content; LevelMatchingProperties val = ((content != null) ? content.OutsideLevelMatchingProperties : null); IEnumerable<StringWithRarity> enumerable = val?.levelTags; levelTags = GetValue("OutsideLevelSettingsByLevelTags", enumerable ?? Enumerable.Empty<StringWithRarity>(), "Add this Enemy to an Outside Level's randomisation pool based on matching Tag Names. (Minimum: 0, Maximum: 9999)").ToList(); IEnumerable<Vector2WithRarity> enumerable2 = val?.currentRoutePrice; currentRoutePrice = GetValue("OutsideLevelSettingsByCurrentRoutePrice", enumerable2 ?? Enumerable.Empty<Vector2WithRarity>(), "Add this Enemy to an Outside Level's randomisation pool based on matching Route Prices. (Minimum: 0, Maximum: 9999)").ToList(); enumerable = val?.currentWeather; currentWeather = GetValue("OutsideLevelSettingsByCurrentWeather", enumerable ?? Enumerable.Empty<StringWithRarity>(), "Add this Enemy to an Outside Level's randomisation pool based on matching Weather Conditions. (Minimum: 0, Maximum: 9999)").ToList(); enumerable = val?.planetNames; planetNames = GetValue("OutsideLevelSettingsByPlanetNames", enumerable ?? Enumerable.Empty<StringWithRarity>(), "Add this Enemy to an Outside Level's randomisation pool based on matching Level Names. (Minimum: 0, Maximum: 9999)").ToList(); ExtendedEnemyType content2 = Content; LevelMatchingProperties val2 = ((content2 != null) ? content2.DaytimeLevelMatchingProperties : null); enumerable = val2?.levelTags; List<StringWithRarity> source = GetValue("DaytimeLevelSettingsByLevelTags", enumerable ?? Enumerable.Empty<StringWithRarity>(), "Add this Enemy to a Daytime Level's randomisation pool based on matching Tag Names. (Minimum: 0, Maximum: 9999)").ToList(); enumerable2 = val2?.currentRoutePrice; List<Vector2WithRarity> source2 = GetValue("DaytimeLevelSettingsByCurrentRoutePrice", enumerable2 ?? Enumerable.Empty<Vector2WithRarity>(), "Add this Enemy to a Daytime Level's randomisation pool based on matching Route Prices. (Minimum: 0, Maximum: 9999)").ToList(); enumerable = val2?.currentWeather; List<StringWithRarity> source3 = GetValue("DaytimeLevelSettingsByCurrentWeather", enumerable ?? Enumerable.Empty<StringWithRarity>(), "Add this Enemy to a Daytime Level's randomisation pool based on matching Weather Conditions. (Minimum: 0, Maximum: 9999)").ToList(); enumerable = val2?.planetNames; List<StringWithRarity> source4 = GetValue("DaytimeLevelSettingsByPlanetNames", enumerable ?? Enumerable.Empty<StringWithRarity>(), "Add this Enemy to a Daytime Level's randomisation pool based on matching Level Names. (Minimum: 0, Maximum: 9999)").ToList(); ExtendedEnemyType content3 = Content; LevelMatchingProperties val3 = ((content3 != null) ? content3.InsideLevelMatchingProperties : null); enumerable = val3?.levelTags; List<StringWithRarity> source5 = GetValue("InsideLevelSettingsByLevelTags", enumerable ?? Enumerable.Empty<StringWithRarity>(), "Add this Enemy to an Inside Level's randomisation pool based on matching Tag Names. (Minimum: 0, Maximum: 9999)").ToList(); enumerable2 = val3?.currentRoutePrice; List<Vector2WithRarity> source6 = GetValue("InsideLevelSettingsByCurrentRoutePrice", enumerable2 ?? Enumerable.Empty<Vector2WithRarity>(), "Add this Enemy to an Inside Level's randomisation pool based on matching Route Prices. (Minimum: 0, Maximum: 9999)").ToList(); enumerable = val3?.currentWeather; List<StringWithRarity> source7 = GetValue("InsideLevelSettingsByCurrentWeather", enumerable ?? Enumerable.Empty<StringWithRarity>(), "Add this Enemy to an Inside Level's randomisation pool based on matching Weather Conditions. (Minimum: 0, Maximum: 9999)").ToList(); enumerable = val3?.planetNames; List<StringWithRarity> source8 = GetValue("InsideLevelSettingsByPlanetNames", enumerable ?? Enumerable.Empty<StringWithRarity>(), "Add this Enemy to an Inside Level's randomisation pool based on matching Level Names. (Minimum: 0, Maximum: 9999)").ToList(); if (isEnabled) { ExtendedEnemyType content4 = Content; if ((Object)(object)((content4 != null) ? content4.OutsideLevelMatchingProperties : null) != (Object)null) { Content.OutsideLevelMatchingProperties.ApplyValues((List<StringWithRarity>)null, (List<StringWithRarity>)null, levelTags.ToList(), currentRoutePrice.ToList(), currentWeather.ToList(), planetNames.ToList()); } ExtendedEnemyType content5 = Content; if ((Object)(object)((content5 != null) ? content5.DaytimeLevelMatchingProperties : null) != (Object)null) { Content.DaytimeLevelMatchingProperties.ApplyValues((List<StringWithRarity>)null, (List<StringWithRarity>)null, source.ToList(), source2.ToList(), source3.ToList(), source4.ToList()); } ExtendedEnemyType content6 = Content; if ((Object)(object)((content6 != null) ? content6.InsideLevelMatchingProperties : null) != (Object)null) { Content.InsideLevelMatchingProperties.ApplyValues((List<StringWithRarity>)null, (List<StringWithRarity>)null, source5.ToList(), source6.ToList(), source7.ToList(), source8.ToList()); Content.EnemyType.PowerLevel = PowerLevel; Content.EnemyType.MaxCount = MaxCount; } } } } [Serializable] public class ItemContentConfig : BaseContentConfig<ExtendedItem> { private List<StringWithRarity> levelTags = new List<StringWithRarity>(); private List<Vector2WithRarity> currentRoutePrice = new List<Vector2WithRarity>(); private List<StringWithRarity> currentWeather = new List<StringWithRarity>(); private List<StringWithRarity> planetNames = new List<StringWithRarity>(); private int minValue; private int maxValue; private float weight; private bool twoHanded; private bool isConductiveMetal; protected override void LoadCfg(bool isEnabled) { minValue = GetValue("MinValue", Content.Item.minValue, "The minimum value for the item. In-game it'll show the value multiplied by 0.4."); maxValue = GetValue("MaxValue", Content.Item.maxValue, "The maximum value for the item. In-game it'll show the value multiplied by 0.4."); weight = GetValue("Weight", Content.Item.weight, "The weight for the item."); twoHanded = GetValue("TwoHanded", Content.Item.twoHanded, "Indicates if the item is two-handed."); isConductiveMetal = GetValue("IsConductive", Content.Item.isConductiveMetal, "Indicates if the item is conductive."); levelTags = GetValue("ItemInjectionSettingsByLevelTags", Content.LevelMatchingProperties.levelTags, "Add this Item to a Level's randomisation pool based on matching Tag Names. (Minimum: 0, Maximum: 9999)").ToList(); currentRoutePrice = GetValue("ItemInjectionSettingsByCurrentRoutePrice", Content.LevelMatchingProperties.currentRoutePrice, "Add this Item to a Level's randomisation pool based on matching Route Prices. (Minimum: 0, Maximum: 9999)").ToList(); currentWeather = GetValue("ItemInjectionSettingsByCurrentWeather", Content.LevelMatchingProperties.currentWeather, "Add this Item to a Level's randomisation pool based on matching Weather Conditions. (Minimum: 0, Maximum: 9999)").ToList(); planetNames = GetValue("ItemInjectionSettingsByPlanetNames", Content.LevelMatchingProperties.planetNames, "Add this Item to a Level's randomisation pool based on matching Level Names. (Minimum: 0, Maximum: 9999)").ToList(); if (isEnabled) { Content.LevelMatchingProperties.ApplyValues((List<StringWithRarity>)null, (List<StringWithRarity>)null, levelTags.ToList(), currentRoutePrice.ToList(), currentWeather.ToList(), planetNames.ToList()); Content.Item.minValue = minValue; Content.Item.maxValue = maxValue; Content.Item.weight = weight; Content.Item.twoHanded = twoHanded; Content.Item.isConductiveMetal = isConductiveMetal; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }