using System;
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.Logging;
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("NoAbomination")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoAbomination")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("455c9416-1048-44be-96cf-cd45598d67b4")]
[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 NoAbomination;
[BepInPlugin("kumo.sulfur.no_abomination", "No Abomination", "1.1.0")]
public sealed class Plugin : BaseUnityPlugin
{
private static ManualLogSource Log;
private const string TargetTypeName = "PerfectRandom.Sulfur.Gameplay.CrawAbomination";
private static readonly string[] MethodsToBlock = new string[9] { "Start", "Update", "StartSummoning", "SummonTentacle", "ScreamAt", "DoneScreaming", "StopAttacking", "ToggleScreamEmission", "ApplySummonObjectShake" };
private void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("kumo.sulfur.no_abomination");
Type type = AccessTools.TypeByName("PerfectRandom.Sulfur.Gameplay.CrawAbomination");
if (type == null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Could not find type: PerfectRandom.Sulfur.Gameplay.CrawAbomination");
return;
}
HarmonyMethod val2 = new HarmonyMethod(typeof(Plugin).GetMethod("BlockCrawAbominationMethod", BindingFlags.Static | BindingFlags.NonPublic));
int num = 0;
MethodInfo[] methods = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (MethodInfo methodInfo in methods)
{
if (MethodsToBlock.Contains(methodInfo.Name))
{
try
{
val.Patch((MethodBase)methodInfo, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
num++;
((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched CrawAbomination method: " + methodInfo.Name));
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to patch method " + methodInfo.Name + ": " + ex.Message));
}
}
}
((BaseUnityPlugin)this).Logger.LogInfo((object)("No Abomination root blocker loaded. Patched methods: " + num));
}
private static bool BlockCrawAbominationMethod(object __instance)
{
try
{
Component val = (Component)((__instance is Component) ? __instance : null);
if ((Object)(object)val != (Object)null && (Object)(object)val.gameObject != (Object)null)
{
GameObject gameObject = val.gameObject;
if (gameObject.activeSelf)
{
gameObject.SetActive(false);
}
Object.Destroy((Object)(object)gameObject);
ManualLogSource log = Log;
if (log != null)
{
log.LogInfo((object)("Blocked CrawAbomination instance: " + ((Object)gameObject).name));
}
}
}
catch (Exception ex)
{
ManualLogSource log2 = Log;
if (log2 != null)
{
log2.LogWarning((object)("Failed to block CrawAbomination instance: " + ex.Message));
}
}
return false;
}
}