using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalKCF.Patches;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Dbn.LethalKCF")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalKCF")]
[assembly: AssemblyTitle("Dbn.LethalKCF")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace LethalKCF
{
[BepInPlugin("Dbn.LethalKCF", "Braken KCF", "1.1.1")]
public class LethalKCFBase : BaseUnityPlugin
{
private const string modGUID = "Dbn.LethalKCF";
private const string modName = "Braken KCF";
private const string modVersion = "1.1.1";
private readonly Harmony harmony = new Harmony("Dbn.LethalKCF");
private static LethalKCFBase Instance;
internal ManualLogSource mls;
internal static AudioClip newSFX;
internal static AudioClip AngerVoice;
internal static AudioClip FoundVoice;
private ConfigEntry<bool> configPitch;
private ConfigEntry<bool> configState;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Dbn.LethalKCF");
mls.LogWarning((object)"Dbn.LethalKCF is loading.");
ConfigFile();
string location = ((BaseUnityPlugin)Instance).Info.Location;
string text = "LethalKCF.dll";
AssetBundle val = AssetBundle.LoadFromFile(location.TrimEnd(text.ToCharArray()) + "lethal-kcf");
if ((Object)(object)val == (Object)null)
{
mls.LogError((object)"Failed to load audio assets!");
return;
}
mls.LogInfo((object)"Sucessfully loaded asset bundle");
newSFX = val.LoadAsset<AudioClip>("Assets/beau_clean.mp3");
AngerVoice = val.LoadAsset<AudioClip>("Assets/jtm_clean.mp3");
FoundVoice = val.LoadAsset<AudioClip>("Assets/fololo_clean.mp3");
if (configState.Value)
{
mls.LogWarning((object)"Dbn.LethalKCF is patching.");
harmony.PatchAll(typeof(LethalKCFBase));
harmony.PatchAll(typeof(FlowermanPatch));
if (!FlowermanPatch.isFix)
{
mls.LogWarning((object)"Warning ! Pitch Fix is DISABLED !");
}
mls.LogWarning((object)"Dbn.LethalKCF is loaded and patched. Kevin Gillet is Ready!!!");
}
else
{
mls.LogError((object)"Dbn.LethalKCF NOT PATCHED !!!");
mls.LogError((object)"Enable Mod is set to false in config file !!!");
}
}
private void ConfigFile()
{
configState = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Mod", true, "Enable or disable the mod.");
configPitch = ((BaseUnityPlugin)this).Config.Bind<bool>("General.Patching", "Enable Pitch Fix", true, "Enable or not the Pitch Fix. By default the game randomly change the pitch of the Bracken sound effects");
FlowermanPatch.isFix = configPitch.Value;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Dbn.LethalKCF";
public const string PLUGIN_NAME = "LethalKCF";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LethalKCF.Patches
{
[HarmonyPatch(typeof(FlowermanAI))]
internal class FlowermanPatch
{
public static bool isFix;
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void FlowermanAudioPatch(FlowermanAI __instance)
{
__instance.crackNeckSFX = LethalKCFBase.newSFX;
__instance.creatureAngerVoice.clip = LethalKCFBase.AngerVoice;
__instance.crackNeckAudio.clip = LethalKCFBase.newSFX;
((EnemyAI)__instance).enemyBehaviourStates[1].VoiceClip = LethalKCFBase.FoundVoice;
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
public static void FlowermanPitchFix(FlowermanAI __instance)
{
if (isFix)
{
__instance.creatureAngerVoice.pitch = 1f;
}
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class StartOfRoundPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void OverrideAudio(StartOfRound __instance)
{
__instance.shipIntroSpeechSFX = LethalKCFBase.newSFX;
}
}
}