Decompiled source of BlueDevilBracken v1.1.0

BlueDevilBracken.dll

Decompiled 11 months 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 BepInEx;
using HarmonyLib;
using LC_API.BundleAPI;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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: AssemblyCompany("BlueDevilBracken")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod that replaces the Bracken with a PNG of the Blue Devil from UW-Stout")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("BlueDevilBracken")]
[assembly: AssemblyTitle("BlueDevilBracken")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BlueDevilBracken
{
	[HarmonyPatch(typeof(FlowermanAI), "Start")]
	public static class BlueDevilPatch
	{
		private const int AUDIO_COUNT = 4;

		private static AudioClip GetRandomAudio()
		{
			int num = Random.Range(1, 5);
			string text = $"assets/Lethal/bluedevil-audio{num}.mp3";
			return BundleLoader.GetLoadedAsset<AudioClip>(text);
		}

		public static void Postfix(FlowermanAI __instance)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			AudioClip randomAudio = GetRandomAudio();
			__instance.creatureAngerVoice.clip = BundleLoader.GetLoadedAsset<AudioClip>("assets/Lethal/bluedevil-megalovania.mp3");
			__instance.crackNeckSFX = randomAudio;
			__instance.crackNeckAudio.clip = randomAudio;
			Object.Destroy((Object)(object)((Component)((Component)__instance).gameObject.transform.Find("FlowermanModel/LOD1")).gameObject.GetComponent<SkinnedMeshRenderer>());
			((Component)((Component)__instance).gameObject.transform.Find("FlowermanModel/AnimContainer/metarig")).gameObject.SetActive(false);
			GameObject loadedAsset = BundleLoader.GetLoadedAsset<GameObject>("assets/Lethal/bluedevil-prefab.prefab");
			GameObject val = Object.Instantiate<GameObject>(loadedAsset, ((Component)__instance).transform);
			val.transform.localPosition = new Vector3(0f, 1.5f, 0f);
		}
	}
	[BepInPlugin("BlueDevilBracken", "BlueDevilBracken", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public Harmony harmony;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmony = new Harmony("BlueDevilBracken");
			harmony.PatchAll();
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			BundleLoader.LoadAssetBundle(Path.Combine(directoryName, "./bluedevil"), true);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BlueDevilBracken loaded.");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BlueDevilBracken";

		public const string PLUGIN_NAME = "BlueDevilBracken";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}