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 EarlyMoon v1.0.2
EarlyMoon.dll
Decompiled a month agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates.MeridianEvent; using HG.Reflection; using Logger; using Microsoft.CodeAnalysis; using On.EntityStates.MeridianEvent; using On.RoR2; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.ContentManagement; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EarlyMoon")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+216fbdd9927d9460910a609ebaa044591fa29017")] [assembly: AssemblyProduct("EarlyMoon")] [assembly: AssemblyTitle("EarlyMoon")] [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 Logger { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } } namespace EarlyMoon { [BepInDependency(/*Could not decode attribute arguments.*/)] internal static class Options { public static bool IsEnabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); public static void Init() { EarlyMoon.moonTpStage = ((BaseUnityPlugin)EarlyMoon.Instance).Config.Bind<int>("General", "Stages until Lunar Tp", 5, "The number of stages you have to beat between each occurence of a lunar teleporters, vanilla is 5"); if (IsEnabled) { RiskOfOptionsConfig(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void RiskOfOptionsConfig() { //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) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) ModSettingsManager.AddOption((BaseOption)new IntSliderOption(EarlyMoon.moonTpStage, new IntSliderConfig { min = 1, max = 10 }), "Onyx.EarlyMoon", "EarlyMoon"); ModSettingsManager.SetModDescription("Options for EarlyMoon", "Onyx.EarlyMoon", "EarlyMoon"); FileInfo fileInfo = null; DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); do { FileInfo[] files = directoryInfo.GetFiles("icon.png", SearchOption.TopDirectoryOnly); if (files != null && files.Length != 0) { fileInfo = files[0]; break; } directoryInfo = directoryInfo.Parent; } while (directoryInfo != null && directoryInfo.Exists && !string.Equals(directoryInfo.Name, "plugins", StringComparison.OrdinalIgnoreCase)); if (fileInfo != null) { Texture2D val = new Texture2D(256, 256); if (ImageConversion.LoadImage(val, File.ReadAllBytes(fileInfo.FullName))) { Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); ((Object)val2).name = "EarlyMoonIcon"; ModSettingsManager.SetModIcon(val2, "Onyx.EarlyMoon", "EarlyMoon"); } } } } [BepInPlugin("Onyx.EarlyMoon", "EarlyMoon", "1.0.2")] public sealed class EarlyMoon : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<AsyncOperationHandle<InteractableSpawnCard>> <>9__15_0; public static Action<AsyncOperationHandle<InteractableSpawnCard>> <>9__15_1; public static hook_PlaceTeleporter <>9__15_4; public static Action<Stage> <>9__15_6; public static hook_SpawnExitPortal <>9__15_7; public static hook_OnEnter <>9__15_8; internal void <Awake>b__15_0(AsyncOperationHandle<InteractableSpawnCard> x) { defaultTp = x.Result; } internal void <Awake>b__15_1(AsyncOperationHandle<InteractableSpawnCard> x) { moonTp = x.Result; } internal void <Awake>b__15_4(orig_PlaceTeleporter orig, SceneDirector self) { if (!Object.op_Implicit((Object)(object)self.teleporterSpawnCard)) { orig.Invoke(self); return; } if (currentStage % moonTpStage.Value == 0) { self.teleporterSpawnCard = (SpawnCard)(object)moonTp; } else { self.teleporterSpawnCard = (SpawnCard)(object)defaultTp; } orig.Invoke(self); } internal void <Awake>b__15_6(Stage stage) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I8 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if ((long)DirectorAPI.GetStageEnumFromSceneDef(stage.sceneDef) == 4398046511104L) { <Awake>g__trySpawnMoonPortal|15_5(new Vector3(5f, -11f, -55f), Quaternion.identity); } } internal void <Awake>b__15_7(orig_SpawnExitPortal orig, SolusWebMissionController self) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); <Awake>g__trySpawnMoonPortal|15_5(new Vector3(39f, -226f, 0f), Quaternion.Euler(0f, 90f, 0f)); } internal void <Awake>b__15_8(orig_OnEnter orig, MeridianEventCleared self) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); <Awake>g__trySpawnMoonPortal|15_5(new Vector3(152f, 146f, -85f), Quaternion.Euler(0f, 58f, 0f)); } } public const string PluginGUID = "Onyx.EarlyMoon"; public const string PluginAuthor = "Onyx"; public const string PluginName = "EarlyMoon"; public const string PluginVersion = "1.0.2"; public static EarlyMoon Instance; private static InteractableSpawnCard defaultTp; private static InteractableSpawnCard moonTp; private static GameObject moonPortal; private static int lastStage; public static ConfigEntry<int> moonTpStage { get; set; } private static int currentStage { get { SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); int stageOrder = sceneDefForCurrentScene.stageOrder; if (stageOrder > 5) { stageOrder = lastStage; } lastStage = stageOrder; return Run.instance.loopClearCount * 5 + stageOrder; } } public void Awake() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); Instance = SingletonHelper.Assign<EarlyMoon>(Instance, this); Options.Init(); AssetReferenceT<InteractableSpawnCard> val = new AssetReferenceT<InteractableSpawnCard>(RoR2_Base_Teleporters.iscTeleporter_asset); AsyncOperationHandle<InteractableSpawnCard> val2 = AssetAsyncReferenceManager<InteractableSpawnCard>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle<InteractableSpawnCard> x) { defaultTp = x.Result; }; val = new AssetReferenceT<InteractableSpawnCard>(RoR2_Base_Teleporters.iscLunarTeleporter_asset); val2 = AssetAsyncReferenceManager<InteractableSpawnCard>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle<InteractableSpawnCard> x) { moonTp = x.Result; }; SceneDef moonScene = null; AssetReferenceT<SceneDef> val3 = new AssetReferenceT<SceneDef>(RoR2_Base_moon2.moon2_asset); AsyncOperationHandle<SceneDef> val4 = AssetAsyncReferenceManager<SceneDef>.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2); val4.Completed += delegate(AsyncOperationHandle<SceneDef> x) { moonScene = x.Result; }; AssetReferenceT<GameObject> val5 = new AssetReferenceT<GameObject>(RoR2_Base_PortalShop.PortalShop_prefab); AsyncOperationHandle<GameObject> val6 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val5, (AsyncReferenceHandleUnloadType)2); val6.Completed += delegate(AsyncOperationHandle<GameObject> x) { moonPortal = PrefabAPI.InstantiateClone(x.Result, "moonPortal"); moonPortal.GetComponent<SceneExitController>().destinationScene = moonScene; moonPortal.GetComponent<GenericDisplayNameProvider>().SetDisplayToken("Moon Portal"); moonPortal.GetComponent<GenericInteraction>().contextToken = "Moon Portal"; }; object obj = <>c.<>9__15_4; if (obj == null) { hook_PlaceTeleporter val7 = delegate(orig_PlaceTeleporter orig, SceneDirector self) { if (!Object.op_Implicit((Object)(object)self.teleporterSpawnCard)) { orig.Invoke(self); } else { if (currentStage % moonTpStage.Value == 0) { self.teleporterSpawnCard = (SpawnCard)(object)moonTp; } else { self.teleporterSpawnCard = (SpawnCard)(object)defaultTp; } orig.Invoke(self); } }; <>c.<>9__15_4 = val7; obj = (object)val7; } SceneDirector.PlaceTeleporter += (hook_PlaceTeleporter)obj; Stage.onServerStageBegin += delegate(Stage stage) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I8 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if ((long)DirectorAPI.GetStageEnumFromSceneDef(stage.sceneDef) == 4398046511104L) { trySpawnMoonPortal(new Vector3(5f, -11f, -55f), Quaternion.identity); } }; object obj2 = <>c.<>9__15_7; if (obj2 == null) { hook_SpawnExitPortal val8 = delegate(orig_SpawnExitPortal orig, SolusWebMissionController self) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); trySpawnMoonPortal(new Vector3(39f, -226f, 0f), Quaternion.Euler(0f, 90f, 0f)); }; <>c.<>9__15_7 = val8; obj2 = (object)val8; } SolusWebMissionController.SpawnExitPortal += (hook_SpawnExitPortal)obj2; object obj3 = <>c.<>9__15_8; if (obj3 == null) { hook_OnEnter val9 = delegate(orig_OnEnter orig, MeridianEventCleared self) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); trySpawnMoonPortal(new Vector3(152f, 146f, -85f), Quaternion.Euler(0f, 58f, 0f)); }; <>c.<>9__15_8 = val9; obj3 = (object)val9; } MeridianEventCleared.OnEnter += (hook_OnEnter)obj3; static void trySpawnMoonPortal(Vector3 position, Quaternion rotation) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (currentStage % moonTpStage.Value == 0) { GameObject val10 = Object.Instantiate<GameObject>(moonPortal, position, rotation); NetworkServer.Spawn(val10); } } } [CompilerGenerated] internal static void <Awake>g__trySpawnMoonPortal|15_5(Vector3 position, Quaternion rotation) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (currentStage % moonTpStage.Value == 0) { GameObject val = Object.Instantiate<GameObject>(moonPortal, position, rotation); NetworkServer.Spawn(val); } } } }