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 Wayfaring2 v3.0.0
Wayfaring2.dll
Decompiled 4 months agousing System; using System.Collections.Generic; 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 Microsoft.CodeAnalysis; 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.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Wayfaring2")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Wayfaring2")] [assembly: AssemblyTitle("Wayfaring2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 Wayfaring2 { [BepInPlugin("GiGaGon.Wayfaring2", "Wayfaring2", "3.0.0")] public class Wayfaring2 : BaseUnityPlugin { internal class ModConfig { public static ConfigEntry<KeyboardShortcut> reloadKeyBind; public static ConfigEntry<int> stagesForLoop; public static ConfigEntry<int> bracketLengthDefault; public static ConfigEntry<string> brackets; public static void InitConfig(ConfigFile config) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) reloadKeyBind = config.Bind<KeyboardShortcut>("General", "Reload Button", new KeyboardShortcut((KeyCode)287, Array.Empty<KeyCode>()), "Button to reload the stage list with new values from config"); stagesForLoop = config.Bind<int>("General", "Stages For Loop", 5, "How many stages before the game considers the run to have \"looped\""); bracketLengthDefault = config.Bind<int>("General", "Default Bracket Length", 1, "Defualt for how many stages to choose per bracket. Set to -1 for all stages in every bracket"); brackets = config.Bind<string>("General", "Brackets", "blackbeach,golemplains,snowyforest-goolake,foggyswamp,ancientloft-frozenwall,wispgraveyard,sulfurpools-dampcavesimple,shipgraveyard,rootjungle-skymeadow", "Default is a normal ror2 game. Explained on mod website."); } } internal class Rng { public static Random rng = new Random(); } internal class Brackets { public static List<Tuple<int, List<string>>> brackets = new List<Tuple<int, List<string>>>(); public static Stack<string> stages = new Stack<string>(); public static void SetBrackets(string value) { brackets.Clear(); string[] array = value.Split('-'); foreach (string text in array) { if (text.Contains(':')) { string[] array2 = text.Split(':'); brackets.Add(new Tuple<int, List<string>>(int.Parse(array2[0]), array2[1].Split(',').ToList())); } else { int value2 = ModConfig.bracketLengthDefault.Value; string[] array3 = text.Split(','); brackets.Add(new Tuple<int, List<string>>((value2 != -1) ? value2 : array3.Length, array3.ToList())); } } } public static void ChooseStages(List<Tuple<int, List<string>>> value) { stages.Clear(); foreach (Tuple<int, List<string>> item in value) { List<string> list = item.Item2.Shuffle().Take(item.Item1).ToList(); foreach (string item2 in list) { stages.Push(item2); } } stages = new Stack<string>(stages); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_SetUpSeerStations <>9__6_3; public static hook_ShouldBeginLoop <>9__6_4; internal void <Awake>b__6_3(orig_SetUpSeerStations orig, BazaarController self) { SeerStationController[] seerStations = self.seerStations; foreach (SeerStationController val in seerStations) { ((Component)val).GetComponent<PurchaseInteraction>().SetAvailable(false); } } internal bool <Awake>b__6_4(orig_ShouldBeginLoop orig, Run self, SceneDef scene) { return scene.stageOrder == ModConfig.stagesForLoop.Value; } } public const string PluginGUID = "GiGaGon.Wayfaring2"; public const string PluginAuthor = "GiGaGon"; public const string PluginName = "Wayfaring2"; public const string PluginVersion = "3.0.0"; public void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown ModConfig.InitConfig(((BaseUnityPlugin)this).Config); Brackets.SetBrackets(ModConfig.brackets.Value); string next_stage = ""; bool calling_from_OnServerSceneChanged = false; Run.Start += (hook_Start)delegate(orig_Start orig, Run self) { Rng.rng = new Random((int)Run.instance.seed); Brackets.ChooseStages(Brackets.brackets); next_stage = Brackets.stages.Pop(); if (Brackets.stages.Count == 0) { Brackets.ChooseStages(Brackets.brackets); } if (next_stage == "blackbeach" && Rng.rng.Next(1) == 1) { next_stage = "blackbeach2"; } if (next_stage == "golemplains" && Rng.rng.Next(1) == 1) { next_stage = "golemplains2"; } orig.Invoke(self); }; Run.PickNextStageScene += (hook_PickNextStageScene)delegate(orig_PickNextStageScene orig, Run self, WeightedSelection<SceneDef> choices) { orig.Invoke(self, choices); if (calling_from_OnServerSceneChanged) { next_stage = Brackets.stages.Pop(); if (Brackets.stages.Count == 0) { Brackets.ChooseStages(Brackets.brackets); } if (next_stage == "blackbeach" && Rng.rng.Next(1) == 1) { next_stage = "blackbeach2"; } if (next_stage == "golemplains" && Rng.rng.Next(1) == 1) { next_stage = "golemplains2"; } calling_from_OnServerSceneChanged = false; } Run.instance.nextStageScene = SceneCatalog.FindSceneDef(next_stage); }; Run.OnServerSceneChanged += (hook_OnServerSceneChanged)delegate(orig_OnServerSceneChanged orig, Run self, string sceneName) { orig.Invoke(self, sceneName); if ((Object)(object)TeleporterInteraction.instance == (Object)null) { calling_from_OnServerSceneChanged = true; Run.instance.PickNextStageScene(new WeightedSelection<SceneDef>(8)); } }; object obj = <>c.<>9__6_3; if (obj == null) { hook_SetUpSeerStations val = delegate(orig_SetUpSeerStations orig, BazaarController self) { SeerStationController[] seerStations = self.seerStations; foreach (SeerStationController val3 in seerStations) { ((Component)val3).GetComponent<PurchaseInteraction>().SetAvailable(false); } }; <>c.<>9__6_3 = val; obj = (object)val; } BazaarController.SetUpSeerStations += (hook_SetUpSeerStations)obj; object obj2 = <>c.<>9__6_4; if (obj2 == null) { hook_ShouldBeginLoop val2 = (orig_ShouldBeginLoop orig, Run self, SceneDef scene) => scene.stageOrder == ModConfig.stagesForLoop.Value; <>c.<>9__6_4 = val2; obj2 = (object)val2; } Run.ShouldBeginLoop += (hook_ShouldBeginLoop)obj2; } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = ModConfig.reloadKeyBind.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { ((BaseUnityPlugin)this).Config.Reload(); Brackets.SetBrackets(ModConfig.brackets.Value); Brackets.ChooseStages(Brackets.brackets); } } } internal static class ShuffleHelper { public static List<T> Shuffle<T>(this List<T> list) { int num = list.Count; while (num > 1) { num--; int num2 = Wayfaring2.Rng.rng.Next(num + 1); int index = num; int index2 = num2; T val = list[num2]; T val2 = list[num]; T val4 = (list[index] = val); val4 = (list[index2] = val2); } return list; } } }