using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
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("CentipedeCatLaugh")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("CentipedeCatLaugh")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace CentipedeCatLaugh
{
[BepInPlugin("frare.CentipedeCatLaugh", "Centipede laughing cat grab", "1.0.0")]
public class CentipedeCatLaughBase : BaseUnityPlugin
{
internal const string PLUGIN_GUID = "frare.CentipedeCatLaugh";
internal const string PLUGIN_NAME = "Centipede laughing cat grab";
internal const string PLUGIN_VERSION = "1.0.0";
internal static CentipedeCatLaughBase Instance;
internal ManualLogSource logger;
private readonly Harmony harmony = new Harmony("frare.CentipedeCatLaugh");
internal AudioClip snareClip;
public static AudioClip SnareClip
{
get
{
return Instance.snareClip;
}
private set
{
}
}
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
logger = Logger.CreateLogSource("frare.CentipedeCatLaugh");
logger.LogInfo((object)"Mod started! :)");
LoadAssets();
harmony.PatchAll();
logger.LogInfo((object)"Mod finished loading!");
}
private void LoadAssets()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(directoryName, "modaudio"));
if ((Object)(object)val == (Object)null)
{
logger.LogError((object)"Failed to load custom audio");
return;
}
string text = val.GetAllAssetNames()[0];
snareClip = val.LoadAsset<AudioClip>(text);
if ((Object)(object)snareClip == (Object)null)
{
logger.LogError((object)"Failed to load custom audio");
}
else
{
logger.LogDebug((object)"Custom audio loaded!");
}
}
public static void LogMessage(string message, LogLevel logLevel = 32)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
Instance.logger.Log(logLevel, (object)message);
}
}
}
namespace CentipedeCatLaugh.Patches
{
[HarmonyPatch(typeof(CentipedeAI))]
internal static class CentipedeAIPatch
{
[HarmonyPatch("ClingToPlayerClientRpc")]
[HarmonyPostfix]
internal static void ClingToPlayerClientRpcPostfix(ref CentipedeAI __instance)
{
CentipedeCatLaughBase.LogMessage("Patching \"CentipedeAI ClingToPlayerClientRpc\"... for gameObject " + ((Object)((Component)__instance).gameObject).name, (LogLevel)32);
((EnemyAI)__instance).creatureSFX.PlayOneShot(CentipedeCatLaughBase.SnareClip);
CentipedeCatLaughBase.LogMessage("Done!", (LogLevel)32);
}
}
}