Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LethalWhoopieLandmine v1.1.6
BepInEx/plugins/WhoopieExplosion.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; 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("WhoopieExplosion")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WhoopieLandMine")] [assembly: AssemblyTitle("WhoopieExplosion")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 WhoopieLandMine { [BepInPlugin("WhoopieExplosion", "WhoopieLandMine", "1.0.0")] public class WhoopieLandMine : BaseUnityPlugin { public ConfigEntry<bool> explosionEffectConfig; public ConfigEntry<bool> goThroughCarConfig; public ConfigEntry<float> killRangeConfig; public ConfigEntry<float> physicsForceConfig; public ConfigEntry<float> damageRangeConfig; public ConfigEntry<int> nonLethalDamageConfig; public static WhoopieLandMine Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { explosionEffectConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "explosionEffectConfig", true, "Sets the explosion effect to active or disabled"); goThroughCarConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "goThroughCarConfig", false, "?"); killRangeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("General", "killRangeConfig", 1f, "Sets kill range"); physicsForceConfig = ((BaseUnityPlugin)this).Config.Bind<float>("General", "physicsForceConfig", 5f, "Sets knockback force"); damageRangeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("General", "damageRangeConfig", 10f, "Sets damage range"); nonLethalDamageConfig = ((BaseUnityPlugin)this).Config.Bind<int>("General", "nonLethalDamageConfig", 50, "Sets Non-Lethal damage"); Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); Logger.LogInfo((object)"WhoopieExplosion v1.0.0 has loaded!"); Logger.LogInfo((object)$"explosionEffectConfig: {explosionEffectConfig.Value}"); Logger.LogInfo((object)$"goThroughCarConfig: {goThroughCarConfig.Value}"); Logger.LogInfo((object)$"killRangeConfig: {killRangeConfig.Value}"); Logger.LogInfo((object)$"physicsForceConfig: {physicsForceConfig.Value}"); Logger.LogInfo((object)$"damageRangeConfig: {damageRangeConfig.Value}"); Logger.LogInfo((object)$"nonLethalDamageConfig: {nonLethalDamageConfig.Value}"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("WhoopieExplosion"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public class WhoopieEventArgs : EventArgs { public Collider collider { get; set; } } [HarmonyPatch(typeof(GrabbableObject))] public class WhoopieLandMinePatches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Postfix(GrabbableObject __instance) { Debug.Log((object)"GrabbableObject Patch Loading..."); if (!(__instance is WhoopieCushionItem)) { return; } Transform val = ((Component)__instance).transform.Find("Trigger"); if ((Object)(object)val != (Object)null) { GameObject gameObject = ((Component)val).gameObject; if ((Object)(object)gameObject.GetComponent<WhoopieScript>() == (Object)null) { gameObject.gameObject.AddComponent<WhoopieScript>(); Debug.Log((object)"WhoopieScript Attached to child"); } } else { Debug.LogError((object)"Child object named 'Trigger' not found"); } } } [HarmonyPatch(typeof(WhoopieCushionItem))] public static class WhoopieCushionItemPatch { public static event EventHandler<WhoopieEventArgs> OnWhoopieTrigger; [HarmonyPatch("ActivatePhysicsTrigger")] [HarmonyPostfix] private static void ActivatePhysicsTriggerPostfix(WhoopieCushionItem __instance, Collider other) { if (!((GrabbableObject)__instance).isHeld && (((Component)other).CompareTag("Player") || ((Component)other).CompareTag("Enemy"))) { Debug.Log((object)("[WhoopieCushionItemPatch] Whoopie cushion triggered by: " + ((Object)other).name)); WhoopieCushionItemPatch.OnWhoopieTrigger?.Invoke(__instance, new WhoopieEventArgs { collider = other }); } } } internal class WhoopieScript : NetworkBehaviour { private Vector3 whoopiePos; private GameObject parentWhoopieCushion; private bool explosionEffect; private float killRange; private float damageRange; private int nonLethalDamage; private float physicsForce; private bool goThroughCar; private void Awake() { explosionEffect = WhoopieLandMine.Instance.explosionEffectConfig.Value; goThroughCar = WhoopieLandMine.Instance.goThroughCarConfig.Value; killRange = WhoopieLandMine.Instance.killRangeConfig.Value; damageRange = WhoopieLandMine.Instance.damageRangeConfig.Value; physicsForce = WhoopieLandMine.Instance.physicsForceConfig.Value; nonLethalDamage = WhoopieLandMine.Instance.nonLethalDamageConfig.Value; Debug.Log((object)"[WhoopieScript] Awake: Configuration loaded."); } private void Start() { parentWhoopieCushion = ((Component)((Component)this).transform.parent).gameObject; Debug.Log((object)"[WhoopieScript] Start: Parent whoopie cushion assigned."); } private void Update() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) whoopiePos = ((Component)this).transform.position; } private void OnEnable() { WhoopieCushionItemPatch.OnWhoopieTrigger += WhoopieCushionTriggerPatch_OnWhoopieTrigger; Debug.Log((object)"[WhoopieScript] OnEnable: Subscribed to OnWhoopieTrigger event."); } private void OnDisable() { WhoopieCushionItemPatch.OnWhoopieTrigger -= WhoopieCushionTriggerPatch_OnWhoopieTrigger; Debug.Log((object)"[WhoopieScript] OnDisable: Unsubscribed from OnWhoopieTrigger event."); } private void WhoopieCushionTriggerPatch_OnWhoopieTrigger(object sender, WhoopieEventArgs e) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"[WhoopieScript] Whoopie cushion triggered. Sending explosion event to server."); TriggerExplosionServerRpc(whoopiePos, explosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, goThroughCar); } [ServerRpc(RequireOwnership = false)] private void TriggerExplosionServerRpc(Vector3 position, bool spawnExplosionEffect, float killRange, float damageRange, int nonLethalDamage, float physicsForce, bool goThroughCar) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"[ServerRpc] Explosion triggered on the server. Forwarding to clients via ClientRpc."); TriggerExplosionClientRpc(position, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, goThroughCar); } [ClientRpc] private void TriggerExplosionClientRpc(Vector3 position, bool spawnExplosionEffect, float killRange, float damageRange, int nonLethalDamage, float physicsForce, bool goThroughCar) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)$"[ClientRpc] Explosion triggered on client. Position: {position}, SpawnExplosionEffect: {spawnExplosionEffect}, KillRange: {killRange}, DamageRange: {damageRange}, NonLethalDamage: {nonLethalDamage}, PhysicsForce: {physicsForce}, GoThroughCar: {goThroughCar}"); Landmine.SpawnExplosion(position, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, (GameObject)null, goThroughCar); if ((Object)(object)parentWhoopieCushion != (Object)null) { Debug.Log((object)"[ClientRpc] Destroying whoopie cushion on client."); Object.Destroy((Object)(object)parentWhoopieCushion); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "WhoopieExplosion"; public const string PLUGIN_NAME = "WhoopieLandMine"; public const string PLUGIN_VERSION = "1.0.0"; } }