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 HaydoMod.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("HaydoMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HaydoMod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("23ba47f4-c018-457a-bb40-40080181b6bf")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HaydoMod
{
[BepInPlugin("EyupKeyif.HaydoMod", "LC Haydo Mod", "1.0.0.0")]
public class HaydoModBase : BaseUnityPlugin
{
private const string modGUID = "EyupKeyif.HaydoMod";
private const string modName = "LC Haydo Mod";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("EyupKeyif.HaydoMod");
private static HaydoModBase instance;
internal ManualLogSource mls;
internal static AudioClip[] giantVoiceClip;
internal static AudioClip[] bugVoiceClip;
internal static AudioClip[] crawlerVoiceClip;
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("EyupKeyif.HaydoMod");
mls.LogInfo((object)"Haydo mod has awaken");
giantVoiceClip = GetAudioClip("haydogiant", "Assets/Voices/GelLanBuraya.mp3");
bugVoiceClip = GetAudioClip("haydobug", "Assets/Voices/Karabiber.mp3");
crawlerVoiceClip = GetAudioClip("haydothumper", "Assets/Voices/NerdenCiktin.mp3");
harmony.PatchAll(typeof(HaydoModBase));
harmony.PatchAll(typeof(ForestGiantAIPatch));
harmony.PatchAll(typeof(HoarderBugAIPatch));
harmony.PatchAll(typeof(CrawlerAIPatch));
}
private AudioClip[] GetAudioClip(string voiceName, string voicePath)
{
string text = ((BaseUnityPlugin)instance).Info.Location.TrimEnd("HaydoMod.dll".ToCharArray()) + voiceName;
AssetBundle val = AssetBundle.LoadFromFile(text);
return val.LoadAssetWithSubAssets<AudioClip>(voicePath);
}
}
}
namespace HaydoMod.Patches
{
[HarmonyPatch(typeof(ForestGiantAI))]
internal class ForestGiantAIPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void ForestGiantVoicePatch(ref EnemyBehaviourState[] ___enemyBehaviourStates)
{
AudioClip val = HaydoModBase.giantVoiceClip[0];
if ((Object)(object)val != (Object)null)
{
___enemyBehaviourStates[1].VoiceClip = val;
}
}
}
[HarmonyPatch(typeof(HoarderBugAI))]
internal class HoarderBugAIPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void HoarderBugVoicePatch(ref AudioClip[] ___chitterSFX)
{
AudioClip[] bugVoiceClip = HaydoModBase.bugVoiceClip;
if (bugVoiceClip.Length != 0)
{
___chitterSFX = bugVoiceClip;
}
}
}
[HarmonyPatch(typeof(CrawlerAI))]
internal class CrawlerAIPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void CrawlerVoicePatch(ref EnemyBehaviourState[] ___enemyBehaviourStates)
{
AudioClip val = HaydoModBase.crawlerVoiceClip[0];
if ((Object)(object)val != (Object)null)
{
___enemyBehaviourStates[1].VoiceClip = val;
}
}
}
}