Decompiled source of LaSoireedu8 v0.1.0

LSD8/LSD8.dll

Decompiled 4 days ago
using System;
using System.Collections;
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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("LSD8")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("LSD8 (\"La soirée du 8\" in French) is a custom mod created for streamer Reven_vl's special event. Unless you're participating, this mod will likely not interest you, as it adds Easter eggs specifically for the event.")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("La Soirée du 8")]
[assembly: AssemblyTitle("LSD8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 LSD8
{
	[BepInPlugin("LSD8", "La Soirée du 8", "0.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class LSD8 : BaseUnityPlugin
	{
		private AssetBundle? _bundle;

		private GameObject? _logoPrefab;

		public static LSD8 Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Logger.LogInfo((object)"Loading LSD8 v0.1.0...");
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lsd8");
			_bundle = AssetBundle.LoadFromFile(text);
			if ((Object)(object)_bundle == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			_logoPrefab = _bundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/LSD8/Prefabs/LSD8Plane.prefab");
			Item val = _bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/LSD8/ScriptableObject/TheBig8.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			Items.RegisterScrap(val, 20, (LevelTypes)(-1));
			SceneManager.sceneLoaded += OnSceneLoaded;
			Patch();
			Logger.LogInfo((object)"LSD8 v0.1.0 has loaded!");
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (((Scene)(ref scene)).name == "SampleSceneRelay" || ((Scene)(ref scene)).name == "MainGame")
			{
				Logger.LogInfo((object)("Scene " + ((Scene)(ref scene)).name + " loaded, try placing the logo..."));
				((MonoBehaviour)this).StartCoroutine(PlaceLSD8LogoWhenShipLoad());
			}
		}

		private IEnumerator PlaceLSD8LogoWhenShipLoad()
		{
			yield return (object)new WaitForSeconds(2f);
			GameObject val = GameObject.Find("WallIn");
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)"Room not found or MelanieShip not installed! Skip logo init.");
				yield break;
			}
			if ((Object)(object)_logoPrefab == (Object)null)
			{
				Logger.LogError((object)"Logo prefab not found! Skip logo init.");
				yield break;
			}
			GameObject val2 = Object.Instantiate<GameObject>(_logoPrefab, val.transform);
			val2.transform.position = new Vector3(-1.2f, 7.4f, -9.7752f);
			val2.transform.localRotation = Quaternion.Euler(270f, 180f, 0f);
			val2.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);
			Logger.LogInfo((object)"Logo initialized!");
		}

		internal static void Patch()
		{
			//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_0017: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("LSD8");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LSD8";

		public const string PLUGIN_NAME = "La Soirée du 8";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace LSD8.Patches
{
	[HarmonyPatch(typeof(TVScript))]
	public class ExampleTVPatch
	{
		[HarmonyPatch("SwitchTVLocalClient")]
		[HarmonyPrefix]
		private static void SwitchTVPrefix(TVScript __instance)
		{
			StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}