using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("GxneClone")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GxneClone")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b44a75d9-66c2-455b-88b7-43ec66d3371b")]
[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 GxneClone;
[BepInPlugin("Gxneclone", "Gxneclone", "1.0.0")]
public class GxneClone : BaseUnityPlugin
{
[HarmonyPatch(typeof(GrabbableObject))]
internal class PipePatch
{
private static List<string> audios = new List<string> { "Gxneclone.mp3" };
private static List<AudioClip> clips = new List<AudioClip>();
private static string uPath = Path.Combine(Paths.PluginPath + "\\Thesonz-Gxneclone\\");
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void AudioPatch(GrabbableObject __instance)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
ManualLogSource val = Logger.CreateLogSource("Gxneclone");
for (int i = 0; i < audios.Count; i++)
{
LoadAudioClip(uPath + audios[i]);
}
if ((Object)__instance != (Object)null && (Object)((Component)__instance).GetComponent<NoisemakerProp>() != (Object)null && ((Object)__instance.itemProperties).name == "ClownHorn")
{
val.LogMessage((object)"We found an Clownhorn!!");
((Component)__instance).GetComponent<NoisemakerProp>().noiseSFX[0] = clips[0];
((Component)__instance).GetComponent<NoisemakerProp>().noiseSFXFar[0] = clips[1];
val.LogMessage((object)((Object)((Component)__instance).GetComponent<NoisemakerProp>().noiseSFX[0]).name);
val.LogMessage((object)((Object)((Component)__instance).GetComponent<NoisemakerProp>().noiseSFXFar[0]).name);
}
}
private static void LoadAudioClip(string filepath)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Invalid comparison between Unknown and I4
ManualLogSource val = Logger.CreateLogSource("Gxneclone");
UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(filepath, (AudioType)13);
audioClip.SendWebRequest();
while (!audioClip.isDone)
{
}
if (audioClip.error != null)
{
val.LogError((object)("Error loading sounds: " + filepath + "\n" + audioClip.error));
}
AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
if (Object.op_Implicit(Object.Instantiate((Object)content)) && (int)content.loadState == 2)
{
val.LogInfo((object)("Loaded " + filepath));
((Object)content).name = Path.GetFileName(filepath);
clips.Add(content);
}
}
}
private const string modGUID = "Gxneclone";
private const string modVersion = "1.0.0";
private const string modName = "Gxneclone";
private readonly Harmony harmony = new Harmony("Gxneclone");
private static GxneClone Instance;
internal ManualLogSource mls;
private void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
mls = Logger.CreateLogSource("Gxneclone");
mls.LogInfo((object)"The GxneClone is Loading");
if ((Object)Instance == (Object)null)
{
Instance = this;
}
harmony.PatchAll();
mls.LogInfo((object)"Loaded The GxneClone Successfully");
}
}