Decompiled source of DLCSpawnPoolFixer v1.0.0

SotsSpawnPoolFixer.dll

Decompiled 9 hours 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 = "")]
[assembly: AssemblyCompany("SotsSpawnPoolFixer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[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.0.0")]
[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
		ClassicStageInfo.Start += new hook_Start(RunsAlways_ClassicStageInfo_Start);
		FixSotsSpawnpools();
		DccsPool.AreConditionsMet += new hook_AreConditionsMet(DccsPool_AreConditionsMet);
	}

	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("Family"))
		{
			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_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: 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)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: 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))
		{
			switch (SceneInfo.instance.sceneDef.cachedName)
			{
			case "foggyswamp":
				self.interactableDccsPool = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/foggyswamp/dpFoggySwampInteractables.asset").WaitForCompletion();
				self.monsterDccsPool = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/foggyswamp/dpFoggySwampMonsters.asset").WaitForCompletion();
				break;
			case "blackbeach2":
				self.interactableDccsPool = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/blackbeach/dpBlackBeachInteractables.asset").WaitForCompletion();
				self.monsterDccsPool = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/blackbeach/dpBlackBeachMonsters.asset").WaitForCompletion();
				break;
			case "habitatfall":
				self.interactableDccsPool = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC2/habitatfall/dpHabitatfallInteractables.asset").WaitForCompletion();
				self.monsterDccsPool = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC2/habitatfall/dpHabitatfallMonsters.asset").WaitForCompletion();
				break;
			case "villagenight":
				self.interactableDccsPool = null;
				self.interactableCategories = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/villagenight/dccsVillagenightInteractablesDLC2.asset").WaitForCompletion();
				break;
			}
		}
		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_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Expected O, but got Unknown
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Expected O, but got Unknown
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Expected O, but got Unknown
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d6: Expected O, but got Unknown
		//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0300: Unknown result type (might be due to invalid IL or missing references)
		//IL_030d: Expected O, but got Unknown
		//IL_0323: Unknown result type (might be due to invalid IL or missing references)
		//IL_0328: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_0337: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: Expected O, but got Unknown
		//IL_035a: Unknown result type (might be due to invalid IL or missing references)
		//IL_035f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_037b: Expected O, but got Unknown
		//IL_0396: Unknown result type (might be due to invalid IL or missing references)
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dc: Expected O, but got Unknown
		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0411: Unknown result type (might be due to invalid IL or missing references)
		//IL_041c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Unknown result type (might be due to invalid IL or missing references)
		//IL_0430: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Expected O, but got Unknown
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_045d: Unknown result type (might be due to invalid IL or missing references)
		//IL_046d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0472: Unknown result type (might be due to invalid IL or missing references)
		//IL_047d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0482: Unknown result type (might be due to invalid IL or missing references)
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0491: Unknown result type (might be due to invalid IL or missing references)
		//IL_049e: Expected O, but got Unknown
		//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04be: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
		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();
		DccsPool val10 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC2/artifactworld02/dpArtifactWorld02Monsters.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();
		DirectorCardCategorySelection dccs9 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/artifactworld02/dccsArtifactWorld02Monsters_DLC1.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs10 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC1/itdampcave/dccsITDampCaveMonstersDLC2.asset").WaitForCompletion();
		DccsPool val11 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC1/itdampcave/dpITDampCaveMonsters.asset").WaitForCompletion();
		((PoolEntry)val11.poolCategories[0].includedIfConditionsMet[0]).dccs = dccs10;
		((PoolEntry)val10.poolCategories[0].includedIfConditionsMet[0]).dccs = dccs9;
		((PoolEntry)val5.poolCategories[0].includedIfConditionsMet[0]).dccs = dccs4;
		ConditionalPoolEntry val12 = new ConditionalPoolEntry
		{
			dccs = dccs,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val2.poolCategories[0].includedIfConditionsMet, ref val12);
		val12 = new ConditionalPoolEntry
		{
			dccs = dccs2,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val3.poolCategories[0].includedIfConditionsMet, ref val12);
		val12 = new ConditionalPoolEntry
		{
			dccs = dccs3,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val4.poolCategories[0].includedIfConditionsMet, ref val12);
		val12 = new ConditionalPoolEntry
		{
			dccs = dccs5,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val6.poolCategories[0].includedIfConditionsMet, ref val12);
		val12 = new ConditionalPoolEntry
		{
			dccs = dccs6,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val7.poolCategories[0].includedIfConditionsMet, ref val12);
		val12 = new ConditionalPoolEntry
		{
			dccs = dccs7,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val8.poolCategories[0].includedIfConditionsMet, ref val12);
		val12 = new ConditionalPoolEntry
		{
			dccs = dccs8,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val9.poolCategories[0].includedIfConditionsMet, ref val12);
		DccsPool val13 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC2/lakes/dpLakesMonsters.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs11 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/lakes/dccsLakesMonstersDLC2.asset").WaitForCompletion();
		val12 = new ConditionalPoolEntry
		{
			dccs = dccs11,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val13.poolCategories[0].includedIfConditionsMet, ref val12);
		DccsPool val14 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC1/snowyforest/dpSnowyForestMonsters.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs12 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsSnowyForestMonstersDLC2.asset").WaitForCompletion();
		val12 = new ConditionalPoolEntry
		{
			dccs = dccs12,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val14.poolCategories[0].includedIfConditionsMet, ref val12);
		DccsPool val15 = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/Base/golemplains/dpGolemplainsMonsters.asset").WaitForCompletion();
		DirectorCardCategorySelection dccs13 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/dccsGolemplainsMonstersDLC2.asset").WaitForCompletion();
		val12 = new ConditionalPoolEntry
		{
			dccs = dccs13,
			requiredExpansions = requiredExpansions,
			weight = 1f
		};
		ArrayUtils.ArrayAppend<ConditionalPoolEntry>(ref val15.poolCategories[0].includedIfConditionsMet, ref val12);
		DirectorCardCategorySelection val16 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/habitat/dccsHabitatInteractables.asset").WaitForCompletion();
		val16.categories[4].cards[0].forbiddenUnlockableDef = Addressables.LoadAssetAsync<UnlockableDef>((object)"RoR2/DLC2/habitat/Logs.Stages.habitat.asset").WaitForCompletion();
		DirectorCardCategorySelection val17 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/village/dccsVillageInteractablesDLC1.asset").WaitForCompletion();
		val17.categories[5].cards[3].minimumStageCompletions = 1;
	}
}