Decompiled source of Tyler1Bracken v1.1.0

Tyler1Bracken.dll

Decompiled 11 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Tyler1Bracken")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tyler1Bracken")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9d426624-dc22-4a43-898c-22e980a41a73")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Tyler1Bracken;

[BepInPlugin("SteamBlizzard.Tyler1Bracken", "Tyler1Bracken", "1.0.0.0")]
public class T1BrackenBase : BaseUnityPlugin
{
	private const string modGUID = "SteamBlizzard.Tyler1Bracken";

	private const string modName = "Tyler1Bracken";

	private const string modVersion = "1.0.0.0";

	private static T1BrackenBase Instance;

	private readonly Harmony harmony = new Harmony("SteamBlizzard.Tyler1Bracken");

	internal ManualLogSource mls;

	public void Awake()
	{
		mls = Logger.CreateLogSource("SteamBlizzard.Tyler1Bracken");
		mls.LogInfo((object)"Tyler1Bracken loading...");
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		harmony.PatchAll();
		mls.LogInfo((object)"Loaded and patches applied.");
	}
}
[HarmonyPatch(typeof(FlowermanAI))]
internal class T1BrackenPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void AudioPatch(FlowermanAI __instance)
	{
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Invalid comparison between Unknown and I4
		if ((Object)(object)__instance != (Object)null)
		{
			ManualLogSource val = Logger.CreateLogSource("SteamBlizzard.Tyler1Items");
			val.LogInfo((object)"Patching audio...");
			string text = "file://" + Paths.PluginPath + "\\SteamBlizzard-Tyler1Bracken\\tyler1_help.mp3";
			UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)13);
			audioClip.SendWebRequest();
			val.LogMessage((object)"Accessing...");
			while (!audioClip.isDone)
			{
			}
			val.LogMessage((object)"Accessed.");
			if ((int)audioClip.result == 1)
			{
				__instance.crackNeckSFX = DownloadHandlerAudioClip.GetContent(audioClip);
				val.LogMessage((object)"Audio clip assigned to drop SFX.");
				__instance.crackNeckAudio.rolloffMode = (AudioRolloffMode)1;
				__instance.crackNeckAudio.maxDistance = 30f;
				__instance.crackNeckAudio.minDistance = 1f;
			}
			else
			{
				val.LogError((object)"Failed to access audio clip.");
			}
		}
	}
}