Decompiled source of SanctumWispSpawnFix v1.0.1

SanctumWispSpawnFix.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using FRCSharp;
using HG.Reflection;
using R2API;
using RoR2;
using RoR2.Navigation;
using UnityEngine;

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

[BepInPlugin("com.phreel.SanctumWispSpawning", "SanctumWispSpawnFix", "1.0.1")]
[BepInDependency("com.bepis.r2api", "5.1.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MoreVieldsOptions : BaseUnityPlugin
{
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	public struct SanctumWispSpawning
	{
		public static ConfigEntry<int> SelectionWeight;

		public static ConfigEntry<int> MinimumStageCount;

		public static ConfigEntry<string> SpawnCustomStages;
	}

	public class StageSpawnInfo
	{
		private string stageName;

		private int minStages;

		public StageSpawnInfo(string stageName, int minStages)
		{
			this.stageName = stageName;
			this.minStages = minStages;
		}

		public string GetStageName()
		{
			return stageName;
		}

		public int GetMinStages()
		{
			return minStages;
		}
	}

	public static List<StageSpawnInfo> StageList = new List<StageSpawnInfo>();

	public static CharacterSpawnCard SanctumWispCard;

	public static DirectorCardHolder SanctumWispDirectorCard;

	public static DirectorCardHolder SanctumWispDirectorLoopCard;

	public void Awake()
	{
		ReadConfig();
		RegisterSanctumWisp();
	}

	[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
	public void LoadSanctumWisp()
	{
		//IL_003b: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: 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)
		//IL_008a: Expected O, but got Unknown
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Expected O, but got Unknown
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Expected O, but got Unknown
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: 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_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Expected O, but got Unknown
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: 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)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Expected O, but got Unknown
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		SanctumWispCard = ScriptableObject.CreateInstance<CharacterSpawnCard>();
		((Object)SanctumWispCard).name = "cscMVOSanctumWisp";
		((SpawnCard)SanctumWispCard).prefab = VF2ContentPackProvider.sanctumWispMaster;
		((SpawnCard)SanctumWispCard).sendOverNetwork = true;
		((SpawnCard)SanctumWispCard).hullSize = (HullClassification)1;
		((SpawnCard)SanctumWispCard).nodeGraphType = (GraphType)1;
		((SpawnCard)SanctumWispCard).requiredFlags = (NodeFlags)0;
		((SpawnCard)SanctumWispCard).forbiddenFlags = (NodeFlags)2;
		((SpawnCard)SanctumWispCard).directorCreditCost = 200;
		((SpawnCard)SanctumWispCard).occupyPosition = false;
		SanctumWispCard.loadout = new SerializableLoadout();
		SanctumWispCard.noElites = false;
		SanctumWispCard.forbiddenAsBoss = false;
		DirectorCard card = new DirectorCard
		{
			spawnCard = (SpawnCard)(object)SanctumWispCard,
			selectionWeight = 1,
			preventOverhead = false,
			minimumStageCompletions = 0,
			spawnDistance = (MonsterSpawnDistance)0
		};
		DirectorCardHolder sanctumWispDirectorCard = new DirectorCardHolder
		{
			Card = card,
			MonsterCategory = (MonsterCategory)3
		};
		DirectorCard card2 = new DirectorCard
		{
			spawnCard = (SpawnCard)(object)SanctumWispCard,
			selectionWeight = 1,
			preventOverhead = false,
			minimumStageCompletions = 5,
			spawnDistance = (MonsterSpawnDistance)0
		};
		DirectorCardHolder sanctumWispDirectorLoopCard = new DirectorCardHolder
		{
			Card = card2,
			MonsterCategory = (MonsterCategory)3
		};
		SanctumWispDirectorCard = sanctumWispDirectorCard;
		SanctumWispDirectorLoopCard = sanctumWispDirectorLoopCard;
		foreach (StageSpawnInfo stage in StageList)
		{
			DirectorCardHolder val = ((stage.GetMinStages() == 0) ? SanctumWispDirectorCard : SanctumWispDirectorLoopCard);
			SceneDef val2 = ScriptableObject.CreateInstance<SceneDef>();
			val2.baseSceneNameOverride = stage.GetStageName();
			Helpers.AddNewMonsterToStage(val, false, DirectorAPI.GetStageEnumFromSceneDef(val2), stage.GetStageName());
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
	public void RegisterSanctumWisp()
	{
		RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LoadSanctumWisp));
	}

	public void ReadConfig()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		//IL_0030: Expected O, but got Unknown
		string value = ((BaseUnityPlugin)this).Config.Bind<string>(new ConfigDefinition("Spawns", "Stage List"), "arena, ancientloft, itancientloft, itgoolake, dampcavesimple, goolake, lakes, skymeadow, sulfurpools, wispgraveyard, catacombs_DS1_Catacombs", new ConfigDescription("What stages the monster will show up on. Add a '- loop' after the stagename to make it only spawn after looping. List of stage names can be found at https://github.com/risk-of-thunder/R2Wiki/wiki/List-of-scene-names", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		value = new string((from c in value.ToCharArray()
			where !char.IsWhiteSpace(c)
			select c).ToArray());
		string[] array = value.Split(',');
		string[] array2 = array;
		foreach (string text in array2)
		{
			string[] array3 = text.Split('-');
			string stageName = array3[0];
			int minStages = 0;
			if (array3.Length > 1)
			{
				minStages = 5;
			}
			StageList.Add(new StageSpawnInfo(stageName, minStages));
		}
	}
}