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 ModularEclipse v1.1.1
ModularEclipse.dll
Decompiled 4 months agousing System; using System.Collections.ObjectModel; using System.Diagnostics; 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 On.RoR2; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ModularEclipse")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ModularEclipse")] [assembly: AssemblyTitle("ModularEclipse")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ModularEclipse; [BepInPlugin("com.HouseOfFruits.ModularEclipse", "ModularEclipse", "1.1.0")] public class ModularEclipsePlugin : BaseUnityPlugin { public const string guid = "com.HouseOfFruits.ModularEclipse"; public const string teamName = "HouseOfFruits"; public const string modName = "ModularEclipse"; public const string version = "1.1.0"; internal static string[] DefaultWhitelistedArtifactNames = new string[14] { "Bomb", "EliteOnly", "Enigma", "FriendlyFire", "Glass", "MixEnemy", "MonsterTeamGainsItems", "Prestige", "RandomSurvivorOnRespawn", "ShadowClone", "Swarms", "TeamDeath", "WeakAssKnees", "WispOnDeath" }; public static PluginInfo PInfo { get; private set; } internal static ConfigFile ArtifactWhitelistConfig { get; set; } public static void SetArtifactDefaultWhitelist(ArtifactDef artifactDef, bool defaultValue) { string cachedName = artifactDef.cachedName; if (cachedName == "") { Debug.LogError((object)("Artifact " + artifactDef.nameToken + " has no cached name! The Eclipse rule choice selection will not work for it.")); } else { GetArtifactWhitelist(cachedName, defaultValue); } } public static bool GetArtifactWhitelist(string cachedName, bool defaultValue) { if (DefaultWhitelistedArtifactNames.Contains(cachedName)) { defaultValue = true; } return ArtifactWhitelistConfig.Bind<bool>("Eclipse: Whitelisted Artifacts", cachedName, defaultValue, "If true, this artifact will be *allowed* for use in the Eclipse gamemode. Recommended only difficulty artifacts should be enabled.").Value; } private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown ArtifactWhitelistConfig = new ConfigFile(Paths.ConfigPath + "\\ModularEclipse.cfg", true); EclipseRun.OverrideRuleChoices += new hook_OverrideRuleChoices(EclipseRuleChoices); } private void EclipseRuleChoices(orig_OverrideRuleChoices orig, EclipseRun self, RuleChoiceMask mustInclude, RuleChoiceMask mustExclude, ulong runSeed) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) int num = 0; ReadOnlyCollection<NetworkUser> readOnlyInstancesList = NetworkUser.readOnlyInstancesList; for (int i = 0; i < readOnlyInstancesList.Count; i++) { NetworkUser val = readOnlyInstancesList[i]; SurvivorDef survivorPreference = val.GetSurvivorPreference(); if (Object.op_Implicit((Object)(object)survivorPreference)) { int num2 = EclipseRun.GetNetworkUserSurvivorCompletedEclipseLevel(val, survivorPreference) + 1; num = ((num > 0) ? Math.Min(num, num2) : num2); } } num = Math.Min(num, EclipseRun.maxEclipseLevel); DifficultyIndex eclipseDifficultyIndex = EclipseRun.GetEclipseDifficultyIndex(num); RuleDef val2 = RuleCatalog.FindRuleDef("Difficulty"); foreach (RuleChoiceDef choice in val2.choices) { if (choice.excludeByDefault && choice.difficultyIndex <= eclipseDifficultyIndex) { if (choice.difficultyIndex == eclipseDifficultyIndex) { val2.defaultChoiceIndex = choice.localIndex; } ((SerializableBitArray)mustInclude)[choice.globalIndex] = true; ((SerializableBitArray)mustExclude)[choice.globalIndex] = false; } else { ((SerializableBitArray)mustInclude)[choice.globalIndex] = false; ((SerializableBitArray)mustExclude)[choice.globalIndex] = true; } } ((Run)self).ForceChoice(mustInclude, mustExclude, "Items." + ((Object)Items.LunarTrinket).name + ".Off"); for (int j = 0; j < ArtifactCatalog.artifactCount; j++) { ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef((ArtifactIndex)j); string cachedName = artifactDef.cachedName; if (cachedName == "") { Debug.LogError((object)("Artifact " + artifactDef.nameToken + " has no cached name! The Eclipse rule choice selection will not work for it.")); } else if (!GetArtifactWhitelist(artifactDef.cachedName, defaultValue: false)) { RuleDef val3 = RuleCatalog.FindRuleDef("Artifacts." + cachedName); ((Run)self).ForceChoice(mustInclude, mustExclude, val3.FindChoice("Off")); } } } }