Decompiled source of TestMission v1.0.3

plugins/TestMission.dll

Decompiled 2 weeks ago
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using MissionLoader;
using TestMission.Resources;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Jamesthe1")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Two test missions for House of the Dying Sun.")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("Test Mission")]
[assembly: AssemblyTitle("TestMission")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
namespace TestMission
{
	public static class AssetManager
	{
		private static List<Object> LoadBundle(ManualLogSource logger, AssetBundle bundle)
		{
			if ((Object)(object)bundle == (Object)null)
			{
				logger.LogError((object)"Asset bundle could not be loaded!");
				return null;
			}
			List<Object> result = new List<Object>(bundle.LoadAllAssets());
			bundle.Unload(false);
			logger.LogInfo((object)"All assets are loaded!");
			return result;
		}

		public static List<Object> LoadAssets(ManualLogSource logger, string src)
		{
			logger.LogInfo((object)"Loading asset bundles from file...");
			AssetBundle bundle = AssetBundle.LoadFromFile(src);
			return LoadBundle(logger, bundle);
		}

		public static List<Object> LoadAssets(ManualLogSource logger, byte[] data)
		{
			logger.LogInfo((object)"Loading asset bundles from memory...");
			AssetBundle bundle = AssetBundle.LoadFromMemory(data);
			return LoadBundle(logger, bundle);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("TestMission", "Test Mission", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			NodeSpawner.SceneReady += new SceneReadyDelegate(SpawnOnLoaded);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Initial loading done!");
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Current directory: " + Directory.GetCurrentDirectory()));
		}

		private void SpawnOnLoaded()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			NodeSpawner.SceneReady -= new SceneReadyDelegate(SpawnOnLoaded);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading objects from assets");
			List<Object> list = AssetManager.LoadAssets(((BaseUnityPlugin)this).Logger, AssetBundleRsrc.testmission);
			if (list == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Failed to load objects, check Unity logs for details");
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Readying node data...");
			NodeSpawner.FindAndReadyNodes(new List<NamedNodeDatum>
			{
				new NamedNodeDatum("MISSION_TEST_001", new List<string> { "NODE_BOARDING_001", "NODE_BRAWL_003" }, "NODE_MIXUP"),
				new NamedNodeDatum("MISSION_TEST_002", new List<string> { "NODE_BOARDING_001", "NODE_ROYALGUARD_003" }, "")
			}, list);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TestMission";

		public const string PLUGIN_NAME = "Test Mission";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace TestMission.Resources
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class AssetBundleRsrc
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("TestMission.Resources.AssetBundleRsrc", typeof(AssetBundleRsrc).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] testmission => (byte[])ResourceManager.GetObject("testmission", resourceCulture);

		internal AssetBundleRsrc()
		{
		}
	}
}