Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ImpactDisturbance v0.1.0
ImpactDisturbance.dll
Decompiled 5 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [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 Prototype { [BepInPlugin("prototype.stage4.variant", "Prototype", "0.1.0")] internal class ImpactDisturbance : BaseUnityPlugin { public const string version = "0.1.0"; public const string identifier = "prototype.stage4.variant"; private static AsyncOperationHandle<SceneCollection> one; private static AsyncOperationHandle<SceneCollection> four; private static AsyncOperationHandle<SceneCollection> five; private static AsyncOperationHandle<SceneCollection> loop; private static AsyncOperationHandle<SceneDef> original; private static AsyncOperationHandle<SceneDef> variant; protected void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) one = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage1.asset"); four = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage4.asset"); five = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage5.asset"); loop = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/loopSgStage1.asset"); original = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/village/village.asset"); variant = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/villagenight/villagenight.asset"); Initialize(); Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null); } [HarmonyPatch(typeof(Run), "Start")] [HarmonyPrefix] private static void Initialize(Run __instance = null) { SceneDef stage = variant.WaitForCompletion(); SceneCollection collection = five.WaitForCompletion(); stage.isLockedBeforeLooping = false; stage.stageOrder = 4; stage.destinationsGroup = collection; stage.shouldUpdateSceneCollectionAfterLooping = false; collection = four.WaitForCompletion(); add(); collection = loop.WaitForCompletion(); remove(); stage = original.WaitForCompletion(); add(); collection = one.WaitForCompletion(); remove(); void add() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) SceneEntry[] sceneEntries2 = collection._sceneEntries; SceneEntry val = default(SceneEntry); ((SceneEntry)(ref val)).weight = 1f; val.sceneDef = stage; SceneEntry val2 = val; int num = 0; while (!((Object)(object)sceneEntries2[num].sceneDef == (Object)(object)stage)) { if (++num >= sceneEntries2.Length) { SceneCollection val3 = collection; SceneEntry[] array = sceneEntries2; int num2 = 0; SceneEntry[] array2 = (SceneEntry[])(object)new SceneEntry[1 + array.Length]; SceneEntry[] array3 = array; for (int j = 0; j < array3.Length; j++) { val = (array2[num2] = array3[j]); num2++; } array2[num2] = val2; num2++; val3._sceneEntries = array2; break; } } } void remove() { SceneEntry[] sceneEntries = collection._sceneEntries; for (int i = 0; i < sceneEntries.Length; i++) { ref SceneEntry reference = ref sceneEntries[i]; if ((Object)(object)reference.sceneDef == (Object)(object)stage) { ((SceneEntry)(ref reference)).weight = 0f; } } } } [HarmonyPatch(typeof(ClassicStageInfo), "Awake")] [HarmonyPrefix] private static void Initialize(ClassicStageInfo __instance) { SceneInfo component = ((Component)__instance).GetComponent<SceneInfo>(); SceneDef obj = ((component != null) ? component.sceneDef : null); if (((obj != null) ? obj.cachedName : null) == "villagenight") { __instance.sceneDirectorInteractibleCredits = 370; } } } }