Decompiled source of TsundereBracken v1.0.0

LC_TsundereBracken.dll

Decompiled 9 hours ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LC_TsundereBracken")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC_TsundereBracken")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c4fccb21-8a64-4521-a634-6841d9680f4b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LC_MyEnemySound;

[HarmonyPatch(typeof(FlowermanAI))]
internal class FlowermanAIPatch
{
	private static readonly HashSet<int> logged = new HashSet<int>();

	[HarmonyPrefix]
	[HarmonyPatch("Update")]
	[HarmonyPatch("KillEnemy")]
	private static void Update_Prefix(FlowermanAI __instance)
	{
		List<AudioClip> soundFX = Plugin.SoundFX;
		if (soundFX != null && soundFX.Count != 0)
		{
			__instance.creatureAngerVoice.clip = Plugin.SoundFX[5];
			int index = Random.Range(0, soundFX.Count - 1);
			__instance.crackNeckSFX = soundFX[index];
			int instanceID = ((Object)__instance).GetInstanceID();
			if (!logged.Contains(instanceID))
			{
				logged.Add(instanceID);
				Plugin.Log.LogInfo((object)"Bracken anger about to play. Assigned clip");
			}
		}
	}
}
[BepInPlugin("REV310.TsundereBraken", "TsundereBraken", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string ModGuid = "REV310.TsundereBraken";

	public const string ModName = "TsundereBraken";

	public const string ModVersion = "1.0.0";

	internal static ManualLogSource Log;

	internal static List<AudioClip> SoundFX = new List<AudioClip>();

	internal static AssetBundle Bundle;

	private void Awake()
	{
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"Loading TsundereBraken...");
		string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
		string text = Path.Combine(directoryName, "tsunderesounds");
		Bundle = AssetBundle.LoadFromFile(text);
		if ((Object)(object)Bundle == (Object)null)
		{
			Log.LogError((object)("Failed to load AssetBundle: " + text));
			return;
		}
		SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
		Log.LogInfo((object)$"Loaded AssetBundle. Audio clips found: {SoundFX.Count}");
		new Harmony("REV310.TsundereBraken").PatchAll();
		Log.LogInfo((object)"Patches applied.");
	}
}