Decompiled source of DLCSpawnPoolFixer v1.1.1

SotsSpawnPoolFixer.dll

Decompiled a week ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HG;
using On.RoR2;
using R2API.Utils;
using RoR2;
using RoR2.ExpansionManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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("SotsSpawnPoolFixer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+99fbf36eab41e48d0b9a5ef12ef5ac1498ef78f3")]
[assembly: AssemblyProduct("SotsSpawnPoolFixer")]
[assembly: AssemblyTitle("SotsSpawnPoolFixer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace SotsSpawnPoolFixer;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Wolfo.DLCSpawnPoolFixer", "DLCSpawnPoolFixer", "1.1.1")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class SotsSpawnPoolFix : BaseUnityPlugin
{
	public void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: 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)
		ClassicStageInfo.Start += new hook_Start(RunsAlways_ClassicStageInfo_Start);
		FixSotsSpawnpools();
		DccsPool.AreConditionsMet += new hook_AreConditionsMet(DccsPool_AreConditionsMet);
		SceneCollection val = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/sgStage1.asset").WaitForCompletion();
		((SceneEntry)(ref val._sceneEntries[0])).weight = 0.75f;
		((SceneEntry)(ref val._sceneEntries[1])).weight = 0.75f;
		((SceneEntry)(ref val._sceneEntries[2])).weight = 0.75f;
		((SceneEntry)(ref val._sceneEntries[3])).weight = 0.75f;
		SceneCollection val2 = Addressables.LoadAssetAsync<SceneCollection>((object)"RoR2/Base/SceneGroups/loopSgStage1.asset").WaitForCompletion();
		((SceneEntry)(ref val2._sceneEntries[0])).weight = 0.75f;
		((SceneEntry)(ref val2._sceneEntries[1])).weight = 0.75f;
		((SceneEntry)(ref val2._sceneEntries[2])).weight = 0.75f;
		((SceneEntry)(ref val2._sceneEntries[3])).weight = 0.75f;
	}

	private static bool DccsPool_AreConditionsMet(orig_AreConditionsMet orig, DccsPool self, ConditionalPoolEntry entry)
	{
		if (Object.op_Implicit((Object)(object)((PoolEntry)entry).dccs) && ((Object)((PoolEntry)entry).dccs).name.EndsWith("Standard"))
		{
			if (entry.requiredExpansions.Length == 1)
			{
				if (((Object)entry.requiredExpansions[0]).name.Equals("DLC2"))
				{
					((PoolEntry)entry).weight = 1000f;
				}
				else
				{
					((PoolEntry)entry).weight = 1f;
				}
			}
			else if (entry.requiredExpansions.Length == 2)
			{
				((PoolEntry)entry).weight = 1000000f;
			}
		}
		return orig.Invoke(self, entry);
	}

	private static void RunsAlways_ClassicStageInfo_Start(orig_Start orig, ClassicStageInfo self)
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)Run.instance) && Object.op_Implicit((Object)(object)SceneInfo.instance) && SceneInfo.instance.sceneDef.cachedName.Equals("villagenight"))
		{
			self.interactableDccsPool = null;
			self.interactableCategories = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/villagenight/dccsVillagenightInteractablesDLC2.asset").WaitForCompletion();
		}
		orig.Invoke(self);
	}

	public static void FixSotsSpawnpools()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Expected O, but got Unknown
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Expected O, but got Unknown
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Expected O, but got Unknown
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Expected O, but got Unknown
		//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Expected O, but got Unknown
		//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Expected O, but got Unknown
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_032e: Unknown result type (might be due to invalid IL or missing references)
		//IL_033b: Expected O, but got Unknown
		//IL_0356: Unknown result type (might be due to invalid IL or missing references)
		//IL_035b: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0370: Unknown result type (might be due to invalid IL or missing references)
		//IL_037b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0380: Unknown result type (might be due to invalid IL or missing references)
		//IL_0388: Unknown result type (might be due to invalid IL or missing references)
		//IL_038f: Unknown result type (might be due to invalid IL or missing references)
		//IL_039c: Expected O, but got Unknown
		//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fd: Expected O, but got Unknown
		//IL_0418: Unknown result type (might be due to invalid IL or missing references)
		//IL_041d: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0442: Unknown result type (might be due to invalid IL or missing references)
		//IL_044a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0451: Unknown result type (might be due to invalid IL or missing references)
		//IL_045e: Expected O, but got Unknown
		//IL_0479: Unknown result type (might be due to invalid IL or missing references)
		//IL_047e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0503: Unknown result type (might be due to invalid IL or missing references)
		//IL_050e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0513: Unknown result type (might be due to invalid IL or missing references)
		//IL_051b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0522: Unknown result type (might be due to invalid IL or missing references)
		//IL_052f: Expected O, but got Unknown
		Debug.Log((object)"Gearbox Games");
		ExpansionDef val = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC2/Common/DLC2.asset").WaitForCompletion();
		ExpansionDef[] requiredExpansions = (ExpansionDef[])(object)new ExpansionDef[1] { val };
		DccsPool val2 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/frozenwall/dpFrozenWallInteractables.asset").WaitForCompletion();
		DccsPool val3 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/wispgraveyard/dpWispGraveyardInteractables.asset").WaitForCompletion();
		DccsPool val4 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC1/sulfurpools/dpSulfurPoolsInteractables.asset").WaitForCompletion();
		DccsPool val5 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC2/habitatfall/dpHabitatfallInteractables.asset").WaitForCompletion();
		DccsPool val6 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/dampcave/dpDampCaveInteractables.asset").WaitForCompletion();
		DccsPool val7 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/shipgraveyard/dpShipgraveyardInteractables.asset").WaitForCompletion();
		DccsPool val8 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/rootjungle/dpRootJungleInteractables.asset").WaitForCompletion();
		DccsPool val9 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/skymeadow/dpSkyMeadowInteractables.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsFrozenWallInteractablesDLC2.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs2 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsWispGraveyardInteractablesDLC2.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs3 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsSulfurPoolsInteractablesDLC2.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs4 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/habitatfall/dccsHabitatfallInteractables.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs5 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsDampCaveInteractablesDLC2.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs6 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsShipgraveyardInteractablesDLC2.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs7 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsRootJungleInteractablesDLC2.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs8 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsSkyMeadowInteractablesDLC2.asset").WaitForCompletion();
		DccsPool val10 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC2/artifactworld02/dpArtifactWorld02Monsters.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs9 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/artifactworld02/dccsArtifactWorld02Monsters_DLC1.asset").WaitForCompletion();
		((PoolEntry)val10.poolCategories[0].includedIfConditionsMet[0]).dccs = dccs9;
		((PoolEntry)val5.poolCategories[0].includedIfConditionsMet[0]).dccs = dccs4;
		ConditionalPoolEntry val11 = new ConditionalPoolEntry
		{
			dccs = dccs,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val2.poolCategories[0].includedIfConditionsMet, ref val11);
		val11 = new ConditionalPoolEntry
		{
			dccs = dccs2,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val3.poolCategories[0].includedIfConditionsMet, ref val11);
		val11 = new ConditionalPoolEntry
		{
			dccs = dccs3,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val4.poolCategories[0].includedIfConditionsMet, ref val11);
		val11 = new ConditionalPoolEntry
		{
			dccs = dccs5,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val6.poolCategories[0].includedIfConditionsMet, ref val11);
		val11 = new ConditionalPoolEntry
		{
			dccs = dccs6,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val7.poolCategories[0].includedIfConditionsMet, ref val11);
		val11 = new ConditionalPoolEntry
		{
			dccs = dccs7,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val8.poolCategories[0].includedIfConditionsMet, ref val11);
		val11 = new ConditionalPoolEntry
		{
			dccs = dccs8,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val9.poolCategories[0].includedIfConditionsMet, ref val11);
		DccsPool val12 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC2/lakes/dpLakesMonsters.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs10 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/lakes/dccsLakesMonstersDLC2.asset").WaitForCompletion();
		val11 = new ConditionalPoolEntry
		{
			dccs = dccs10,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val12.poolCategories[0].includedIfConditionsMet, ref val11);
		DccsPool val13 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC1/snowyforest/dpSnowyForestMonsters.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs11 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsSnowyForestMonstersDLC2.asset").WaitForCompletion();
		val11 = new ConditionalPoolEntry
		{
			dccs = dccs11,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val13.poolCategories[0].includedIfConditionsMet, ref val11);
		DccsPool val14 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/golemplains/dpGolemplainsMonsters.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs12 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsGolemplainsMonstersDLC2.asset").WaitForCompletion();
		val11 = new ConditionalPoolEntry
		{
			dccs = dccs12,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val14.poolCategories[0].includedIfConditionsMet, ref val11);
		DirectorCardCategorySelection val15 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/habitat/dccsHabitatInteractables.asset").WaitForCompletion();
		val15.categories[4].cards[0].forbiddenUnlockableDef = Addressables.LoadAssetAsync<UnlockableDef>((object)"RoR2/DLC2/habitat/Logs.Stages.habitat.asset").WaitForCompletion();
		DirectorCardCategorySelection val16 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/village/dccsVillageInteractablesDLC1.asset").WaitForCompletion();
		val16.categories[5].cards[3].minimumStageCompletions = 1;
		DccsPool val17 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC1/ancientloft/dpAncientLoftMonsters.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs13 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsAncientLoftMonstersDLC2.asset").WaitForCompletion();
		val11 = new ConditionalPoolEntry
		{
			dccs = dccs13,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val17.poolCategories[0].includedIfConditionsMet, ref val11);
	}
}