using System;
using System.Collections;
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 NoMoreHornets.Patches;
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("NoMoreHornets")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoMoreHornets")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e66c71b1-0a40-4b0b-9dfc-f7c8d9a9634b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoMoreHornets
{
[BepInPlugin("Socrates.NoMoreHornets", "No More Hornets", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private const string modGUID = "Socrates.NoMoreHornets";
private const string modName = "No More Hornets";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Socrates.NoMoreHornets");
private static Plugin instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("Socrates.NoMoreHornets");
mls.LogInfo((object)"BEGONE HORNETS.");
harmony.PatchAll(typeof(Plugin));
harmony.PatchAll(typeof(Cohost));
}
}
}
namespace NoMoreHornets.Patches
{
[HarmonyPatch(typeof(ButlerEnemyAI), "KillEnemy")]
public class ButlerKillEnemyPatch
{
[HarmonyPostfix]
public static void PostfixKillEnemy(ButlerEnemyAI __instance)
{
__instance.ambience1.Stop();
__instance.ambience2.Stop();
}
}
[HarmonyPatch]
internal class Cohost
{
private static MethodBase TargetMethod()
{
return AccessTools.Method(typeof(ButlerEnemyAI), "ButlerBlowUpAndPop", (Type[])null, (Type[])null);
}
[HarmonyPrefix]
private static bool PrefixSpawn(ButlerEnemyAI __instance)
{
((EnemyAI)__instance).creatureAnimator.SetTrigger("Popping");
((EnemyAI)__instance).creatureAnimator.SetLayerWeight(1, 0f);
__instance.popAudio.PlayOneShot(((EnemyAI)__instance).enemyType.audioClips[3]);
((MonoBehaviour)__instance).StartCoroutine(WaitAndFinishAnimation(__instance));
return false;
}
private static IEnumerator WaitAndFinishAnimation(ButlerEnemyAI __instance)
{
yield return (object)new WaitForSeconds(1.1f);
((EnemyAI)__instance).creatureAnimator.SetBool("popFinish", true);
__instance.popAudio.Play();
__instance.popAudioFar.Play();
__instance.popParticle.Play(true);
float distance = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)__instance).transform.position);
if (distance < 8f)
{
Landmine.SpawnExplosion(((Component)__instance).transform.position + Vector3.up * 0.15f, false, 0f, 2f, 30, 80f, (GameObject)null);
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
SoundManager.Instance.earsRingingTimer = 0.8f;
}
}
}
}