Decompiled source of BelmontModCompats v1.0.1

plugins/BelmontModdedCompats.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BelmontMod.Content.Survivors;
using BelmontMod.Modules;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[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: IgnoresAccessChecksTo("BelmontMod")]
[assembly: AssemblyCompany("BelmontModdedCompats")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BelmontModdedCompats")]
[assembly: AssemblyTitle("BelmontModdedCompats")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BelmontModdedCompats
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Vcr.BelmontMapCompats", "BelmontMapCompats", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class BelmontMapCompats : BaseUnityPlugin
	{
		public const string PluginGUID = "Vcr.BelmontMapCompats";

		public const string PluginAuthor = "Vcr";

		public const string PluginName = "BelmontMapCompats";

		public const string PluginVersion = "1.0.0";

		public void Awake()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			SceneDirector.Start += new hook_Start(SceneDirector_Start);
		}

		private void SceneDirector_Start(orig_Start orig, SceneDirector self)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (Helpers.isBelmontInPlay)
			{
				Scene activeScene = SceneManager.GetActiveScene();
				switch (((Scene)(ref activeScene)).name)
				{
				case "tropics_wormsworms":
					TrySpawnChest(new Vector3(-156f, 55.6f, -15f), new Vector3(340f, 170f, 350f));
					break;
				case "sunkentombs_wormsworms":
					TrySpawnChest(new Vector3(-50f, 19.1f, 114.4f), new Vector3(2.13f, 335f, 9.99f));
					break;
				case "snowtime_sandtrap":
					TrySpawnChest(new Vector3(-148f, -70.5f, -18f), new Vector3(30f, 50f, 350f));
					break;
				case "snowtime_highcharity":
					TrySpawnChest(new Vector3(191f, 62.5f, 76f), new Vector3(0f, 20f, 0f));
					break;
				case "repurposedcrater":
					TrySpawnChest(new Vector3(13f, 116.45f, -16.4f), new Vector3(-1f, 210f, 358f));
					break;
				case "BLANKTEMPLATE":
					TrySpawnChest(new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f));
					break;
				}
			}
		}

		private void TrySpawnChest(Vector3 position, Vector3 rotation)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			GameObject treasureChestPrefab = Belmont.treasureChestPrefab;
			if (NetworkServer.active)
			{
				GameObject val = Object.Instantiate<GameObject>(treasureChestPrefab, position, Quaternion.Euler(rotation));
				NetworkServer.Spawn(val);
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		private static string Format(object data, string file, int line)
		{
			string fileName = Path.GetFileName(file);
			return $"[{fileName}:{line}] {data}";
		}

		internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogDebug((object)Format(data, file, line));
		}

		internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogError((object)Format(data, file, line));
		}

		internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogFatal((object)Format(data, file, line));
		}

		internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogInfo((object)Format(data, file, line));
		}

		internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogMessage((object)Format(data, file, line));
		}

		internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogWarning((object)Format(data, file, line));
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}