Decompiled source of CocomiHelp v1.2.0

CocomiHelp.dll

Decompiled 10 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("CocomiHelp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CocomiHelp")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c6ab6ccc-2d91-466f-b61a-b213bc199fbc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CocomiHelp
{
	[BepInPlugin("Tyler.CocomiHelp", "CocomiHelp", "1.0.0.0")]
	public class cocomiHelpbase : BaseUnityPlugin
	{
		private const string modGUID = "Tyler.CocomiHelp";

		private const string modName = "CocomiHelp mod";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Tyler.CocomiHelp");

		private static cocomiHelpbase Instance;

		internal ManualLogSource mls;

		public void Awake()
		{
			mls = Logger.CreateLogSource("Tyler.CocomiHelp");
			mls.LogInfo((object)"CocomiHelp loading...");
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			harmony.PatchAll();
			mls.LogInfo((object)"Loaded and patches applied.");
		}
	}
}
namespace CocomiHelp.Patches
{
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class CocomiAudioPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void cocomiAudioPatch(FlowermanAI __instance)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			if ((Object)(object)__instance != (Object)null)
			{
				ManualLogSource val = Logger.CreateLogSource("Tyler.CocomiHelp");
				val.LogInfo((object)"loading patch audio...");
				string text = "file://" + Paths.PluginPath + "\\Chinkosho-Cocomihelp\\cocomi_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. Error: " + audioClip.error));
				}
			}
		}
	}
}