using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Bracken_.Patches;
using GameNetcodeStuff;
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("Bracken+")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("Bracken+")]
[assembly: AssemblyCopyright("Copyright © HP 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7e6ebc3d-10bc-455d-8f3d-f2ef428da16a")]
[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 Bracken_
{
[BepInPlugin("NickBracken", "Bracken+", "1.0.0.0")]
public class BrackenBase : BaseUnityPlugin
{
private const string modGUID = "NickBracken";
private const string modName = "Bracken+";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("NickBracken");
private static BrackenBase Instance;
internal ManualLogSource mls;
internal static List<AudioClip> SoundFX;
internal static AssetBundle Bundle;
private ConfigEntry<bool> enableJesterRickroll;
private ConfigEntry<bool> enableShipRickroll;
private ConfigEntry<bool> enableInfiniteStamina;
private void Awake2()
{
enableJesterRickroll = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Toggle custom Jester music", true, "Enable or disable custom jester music.");
enableShipRickroll = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Toggle custom Ship music", true, "Enable or disable custom ship music at the start of a new file.");
enableInfiniteStamina = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Toggle custom Ship music", false, "Enable or disable Infinite speed.");
mls = Logger.CreateLogSource("NickBracken");
mls.LogInfo((object)"Started Config files.");
mls = ((BaseUnityPlugin)this).Logger;
if (enableJesterRickroll.Value)
{
harmony.PatchAll(typeof(JesterPatch));
}
if (enableShipRickroll.Value)
{
harmony.PatchAll(typeof(StartOfRoundPatch));
}
if (enableInfiniteStamina.Value)
{
harmony.PatchAll(typeof(PlayerControllerBPatch));
}
mls.LogInfo((object)"Finished loading Config files");
}
private void Update()
{
if (enableJesterRickroll.Value)
{
harmony.PatchAll(typeof(JesterPatch));
}
if (enableShipRickroll.Value)
{
harmony.PatchAll(typeof(StartOfRoundPatch));
}
if (enableInfiniteStamina.Value)
{
harmony.PatchAll(typeof(PlayerControllerBPatch));
}
}
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("NickBracken");
mls.LogInfo((object)"Loading Bracken+");
harmony.PatchAll(typeof(BrackenBase));
Awake2();
mls = ((BaseUnityPlugin)this).Logger;
SoundFX = new List<AudioClip>();
string location = ((BaseUnityPlugin)Instance).Info.Location;
location = location.TrimEnd("Bracken+.dll".ToCharArray());
Bundle = AssetBundle.LoadFromFile(location + "rick");
if ((Object)(object)Bundle != (Object)null)
{
mls.LogInfo((object)"Successfully loaded asset bundle");
SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
}
else
{
mls.LogError((object)"Failed to load asset bundle");
}
}
}
}
namespace Bracken_.Patches
{
[HarmonyPatch(typeof(JesterAI))]
internal class JesterPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void OverrideAudio(JesterAI __instance)
{
__instance.popGoesTheWeaselTheme = BrackenBase.SoundFX[0];
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class StartOfRoundPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void OverrideAudio(StartOfRound __instance)
{
__instance.shipIntroSpeechSFX = BrackenBase.SoundFX[0];
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void patchUpdate(ref float ___sprintMeter)
{
___sprintMeter = 1f;
}
private static void patchUpdateWeight(PlayerControllerB __instance)
{
__instance.carryWeight = 0f;
__instance.climbSpeed = 10f;
}
}
}