using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using R2API.Utils;
using RoR2;
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+f24ab5549193ab114dd3b00c0b24ef91d0aa4ce8")]
[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.2.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class SotsSpawnPoolFix : BaseUnityPlugin
{
public void Awake()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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_0080: Unknown result type (might be due to invalid IL or missing references)
FixSotsSpawnpools();
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;
SceneDirector.onGenerateInteractableCardSelection += FixWrongRadarTowers;
}
private void FixWrongRadarTowers(SceneDirector scene, DirectorCardCategorySelection dccs)
{
string cachedName = SceneInfo.instance.sceneDef.cachedName;
if (!cachedName.StartsWith("villag") && !cachedName.StartsWith("habitat") && !cachedName.StartsWith("helm"))
{
return;
}
UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef("Logs.Stages." + cachedName);
Debug.Log((object)("Trying to fix Radar Scanner for " + (object)unlockableDef));
if (!Object.op_Implicit((Object)(object)unlockableDef))
{
Debug.Log((object)"No unlockableDef");
return;
}
int num = dccs.FindCategoryIndexByName("Rare");
if (num <= 0)
{
return;
}
for (int i = 0; i < dccs.categories[num].cards.Length; i++)
{
if (Object.op_Implicit((Object)(object)dccs.categories[num].cards[i].forbiddenUnlockableDef))
{
dccs.categories[num].cards[i].forbiddenUnlockableDef = unlockableDef;
}
}
}
public static void FixSotsSpawnpools()
{
//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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
DccsPool val = Addressables.LoadAssetAsync<DccsPool>((object)"RoR2/DLC2/artifactworld02/dpArtifactWorld02Monsters.asset").WaitForCompletion();
DirectorCardCategorySelection dccs = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/artifactworld02/dccsArtifactWorld02Monsters_DLC1.asset").WaitForCompletion();
((PoolEntry)val.poolCategories[0].includedIfConditionsMet[0]).dccs = dccs;
DirectorCardCategorySelection val2 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/village/dccsVillageInteractables_DLC2.asset").WaitForCompletion();
val2.categories[5].cards[3].minimumStageCompletions = 1;
}
}