using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LC_LeMarchand;
using LeMarchandMod.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LC-LeMarchand")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC-LeMarchand")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("58abf852-4137-4077-833b-5ff825976454")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LeMarchandMod.Patches
{
[HarmonyPatch(typeof(FlowermanAI))]
internal class FlowermanPatch
{
public static bool isFix;
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void FlowermanAudioPatch(FlowermanAI __instance)
{
__instance.crackNeckSFX = LC_LeMarchandBase.newSFX;
__instance.creatureAngerVoice.clip = LC_LeMarchandBase.AngerVoice;
__instance.crackNeckAudio.clip = LC_LeMarchandBase.newSFX;
((EnemyAI)__instance).enemyBehaviourStates[1].VoiceClip = LC_LeMarchandBase.FoundVoice;
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
public static void FlowermanPitchFix(FlowermanAI __instance)
{
if (isFix)
{
__instance.creatureAngerVoice.pitch = 1f;
}
}
}
}
namespace LC_LeMarchand
{
[BepInPlugin("MrPicklees.LeMarchandMod", "Braken Le Marchand", "1.1.0")]
public class LC_LeMarchandBase : BaseUnityPlugin
{
private const string modGUID = "MrPicklees.LeMarchandMod";
private const string modName = "Braken Le Marchand";
private const string modVersion = "1.1.0";
private readonly Harmony harmony = new Harmony("MrPicklees.LeMarchandMod");
private static LC_LeMarchandBase 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()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
if ((Object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("MrPicklees.LeMarchandMod");
mls.LogWarning((object)"MrPicklees.LeMarchandMod is loading.");
ConfigFile();
string location = ((BaseUnityPlugin)Instance).Info.Location;
string text = "LC-LeMarchand.dll";
AssetBundle val = AssetBundle.LoadFromFile(location.TrimEnd(text.ToCharArray()) + "lc-lemarchand");
if ((Object)val == (Object)null)
{
mls.LogError((object)"Failed to load audio assets!");
return;
}
newSFX = val.LoadAsset<AudioClip>("Assets/MrPicklees/AudioClip/LC-Gay.mp3");
AngerVoice = val.LoadAsset<AudioClip>("Assets/MrPicklees/AudioClip/LC-Angered.mp3");
FoundVoice = val.LoadAsset<AudioClip>("Assets/MrPicklees/AudioClip/LC-Found01.mp3");
if (configState.Value)
{
mls.LogWarning((object)"MrPicklees.LeMarchandMod is patching.");
harmony.PatchAll(typeof(LC_LeMarchandBase));
harmony.PatchAll(typeof(FlowermanPatch));
if (!FlowermanPatch.isFix)
{
mls.LogWarning((object)"Warning ! Pitch Fix is DISABLED !");
}
mls.LogWarning((object)"MrPicklees.LeMarchandMod is loaded and patched. Gay!!!");
}
else
{
mls.LogError((object)"MrPicklees.LeMarchandMod 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;
}
}
}