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 KickstartMyJesterMod.Patches;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("KickstartMyJester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KickstartMyJester")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8bd73c4e-c69e-4b87-8f5a-a8839f679c09")]
[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 KickstartMyJesterMod
{
[BepInPlugin("phoeles.KickstartMyJester", "Kickstart My Jester", "1.0.4")]
public class KickstartMyJester : BaseUnityPlugin
{
private const string modGUID = "phoeles.KickstartMyJester";
private const string modName = "Kickstart My Jester";
private const string modVersion = "1.0.4";
public static AudioClip Audio1;
public static AudioClip Audio2;
public static AudioClip Audio3;
private readonly Harmony harmony = new Harmony("phoeles.KickstartMyJester");
private static KickstartMyJester Instance;
internal ManualLogSource mls;
private void Awake()
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Invalid comparison between Unknown and I4
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Invalid comparison between Unknown and I4
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Invalid comparison between Unknown and I4
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("phoeles.KickstartMyJester");
harmony.PatchAll(typeof(KickstartMyJester));
string text = ((BaseUnityPlugin)this).Info.Location.TrimEnd("KickstartMyJester.dll".ToCharArray());
UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("File://" + text + "Starting.mp3", (AudioType)13);
audioClip.SendWebRequest();
while (!audioClip.isDone)
{
}
if ((int)audioClip.result == 1)
{
Audio1 = DownloadHandlerAudioClip.GetContent(audioClip);
mls.LogInfo((object)"Audio(1/3) has loaded!");
}
else
{
mls.LogError((object)"Failed to load Audio(1/3)");
}
UnityWebRequest audioClip2 = UnityWebRequestMultimedia.GetAudioClip("File://" + text + "PoppingUp.mp3", (AudioType)13);
audioClip2.SendWebRequest();
while (!audioClip2.isDone)
{
}
if ((int)audioClip2.result == 1)
{
Audio2 = DownloadHandlerAudioClip.GetContent(audioClip2);
mls.LogInfo((object)"Audio(2/3) has loaded!");
}
else
{
mls.LogError((object)"Failed to load Audio(2/3)");
}
UnityWebRequest audioClip3 = UnityWebRequestMultimedia.GetAudioClip("File://" + text + "Singing.mp3", (AudioType)13);
audioClip3.SendWebRequest();
while (!audioClip3.isDone)
{
}
if ((int)audioClip3.result == 1)
{
Audio3 = DownloadHandlerAudioClip.GetContent(audioClip3);
mls.LogInfo((object)"Audio(3/3) has loaded!");
}
else
{
mls.LogError((object)"Failed to load Audio(3/3)");
}
new Harmony("KickstartMyJester").PatchAll(typeof(JesterAIPatch));
}
}
}
namespace KickstartMyJesterMod.Patches
{
[HarmonyPatch(typeof(JesterAI))]
internal class JesterAIPatch
{
[HarmonyPatch("SetJesterInitialValues")]
[HarmonyPostfix]
private static void TimerPatch(ref float ___popUpTimer)
{
___popUpTimer = 40.5f;
}
[HarmonyPatch("SetJesterInitialValues")]
[HarmonyPostfix]
private static void CrankSpeedMultiplierPatch(JesterAI __instance)
{
((EnemyAI)__instance).creatureAnimator.SetFloat("CrankSpeedMultiplier", ((EnemyAI)__instance).creatureAnimator.GetFloat("CrankSpeedMultiplier") * 2.5f);
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void CrankSpeedMultiplierUpdatePatch(JesterAI __instance)
{
float num = ((EnemyAI)__instance).creatureAnimator.GetFloat("CrankSpeedMultiplier") * 2.5f;
((EnemyAI)__instance).creatureAnimator.SetFloat("CrankSpeedMultiplier", num);
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void Audio1Patch(ref AudioClip ___popGoesTheWeaselTheme)
{
___popGoesTheWeaselTheme = KickstartMyJester.Audio1;
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void Audio2Patch(ref AudioClip ___popUpSFX)
{
___popUpSFX = KickstartMyJester.Audio2;
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void Audio3Patch(ref AudioClip ___screamingSFX)
{
___screamingSFX = KickstartMyJester.Audio3;
}
}
}