Decompiled source of SneakySpawnAdjustment v1.0.0

SneakySpawnAdjustment.dll

Decompiled 4 hours 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 HG.Reflection;
using R2API;
using RoR2;
using RoR2.Navigation;
using Sandswept.Enemies;
using Sandswept.Enemies.CannonJellyfish;
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("SneakySpawnAdjustment")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SneakySpawnAdjustment")]
[assembly: AssemblyTitle("SneakySpawnAdjustment")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace SneakySpawnAdjustment
{
	[BepInPlugin("com.phreel.SneakySpawnAdjustment", "PlsDontTellHifuIDidThis", "1.0.0")]
	[BepInDependency("com.bepis.r2api", "5.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MoreVieldsOptions : BaseUnityPlugin
	{
		[StructLayout(LayoutKind.Sequential, Size = 1)]
		public struct CannonballJellyfishSpawning
		{
			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 CannonballJellyfishCard;

		public static DirectorCardHolder CannonballJellyfishDirectorCard;

		public static DirectorCardHolder CannonballJellyfishDirectorLoopCard;

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

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public void LoadCannonballJellyfish()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_008c: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			//IL_0111: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			CannonballJellyfishCard = ScriptableObject.CreateInstance<CharacterSpawnCard>();
			((Object)CannonballJellyfishCard).name = "cscSPACannonballJellyfish";
			((SpawnCard)CannonballJellyfishCard).prefab = ((EnemyBase)EnemyBase<CannonJellyfish>.Instance).prefabMaster;
			((SpawnCard)CannonballJellyfishCard).sendOverNetwork = true;
			((SpawnCard)CannonballJellyfishCard).hullSize = (HullClassification)0;
			((SpawnCard)CannonballJellyfishCard).nodeGraphType = (GraphType)1;
			((SpawnCard)CannonballJellyfishCard).requiredFlags = (NodeFlags)0;
			((SpawnCard)CannonballJellyfishCard).forbiddenFlags = (NodeFlags)2;
			((SpawnCard)CannonballJellyfishCard).directorCreditCost = 40;
			((SpawnCard)CannonballJellyfishCard).occupyPosition = false;
			CannonballJellyfishCard.loadout = new SerializableLoadout();
			CannonballJellyfishCard.noElites = false;
			CannonballJellyfishCard.forbiddenAsBoss = false;
			DirectorCard card = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)CannonballJellyfishCard,
				selectionWeight = 1,
				preventOverhead = false,
				minimumStageCompletions = 0,
				spawnDistance = (MonsterSpawnDistance)0
			};
			DirectorCardHolder cannonballJellyfishDirectorCard = new DirectorCardHolder
			{
				Card = card,
				MonsterCategory = (MonsterCategory)2
			};
			DirectorCard card2 = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)CannonballJellyfishCard,
				selectionWeight = 1,
				preventOverhead = false,
				minimumStageCompletions = 5,
				spawnDistance = (MonsterSpawnDistance)0
			};
			DirectorCardHolder cannonballJellyfishDirectorLoopCard = new DirectorCardHolder
			{
				Card = card2,
				MonsterCategory = (MonsterCategory)2
			};
			CannonballJellyfishDirectorCard = cannonballJellyfishDirectorCard;
			CannonballJellyfishDirectorLoopCard = cannonballJellyfishDirectorLoopCard;
			foreach (StageSpawnInfo stage in StageList)
			{
				DirectorCardHolder val = ((stage.GetMinStages() == 0) ? CannonballJellyfishDirectorCard : CannonballJellyfishDirectorLoopCard);
				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 RegisterCannonballJellyfish()
		{
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LoadCannonballJellyfish));
		}

		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"), "rootjungle, shipgraveyard, snowyforest - loop, dampcavesimple, lakes, lakesnight, village, villagenight, lemuriantemple, habitat, habitatfall, helminthroost, skymeadow, itskymeadow, itgolemplains, golemplains - loop, sulfurpools - loop, wispgraveyard - loop, catacombs_DS1_Catacombs - loop, FBLScene, slumberingsatellite, drybasin", 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));
			}
		}
	}
}
namespace MoreVieldsOptions
{
	internal class AdditionalSpawncards
	{
		public static CharacterSpawnCard LesserSoulCard;

		public static CharacterSpawnCard GreaterSoulCard;

		public static CharacterSpawnCard ArchaicSoulCard;
	}
}