Please disclose if your mod was created primarily 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 CoronerBiodiversity v0.0.0
Coroner - Biodiversity.dll
Decompiled 7 months agousing System; using System.Collections; using System.Collections.Generic; 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.Logging; using Biodiversity.Behaviours; using Biodiversity.Creatures.Aloe; using Biodiversity.Creatures.CoilCrab; using Biodiversity.Creatures.Ogopogo; using Coroner; using Coroner.Patch; using CoronerBiodiversity.Patch.Aloe; using GameNetcodeStuff; 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: IgnoresAccessChecksTo("com.github.biodiversitylc.Biodiversity")] [assembly: IgnoresAccessChecksTo("Coroner-publicized")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Turkeysteaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Provides integration between Coroner and Biodiversity.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Coroner - Biodiversity")] [assembly: AssemblyTitle("Coroner - Biodiversity")] [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 CoronerBiodiversity { public static class PluginInfo { public const string PLUGIN_ID = "coroner.biodiversity"; public const string PLUGIN_NAME = "Coroner - Biodiversity"; public const string PLUGIN_VERSION = "1.0.0"; public const string PLUGIN_GUID = "Turkeysteaks.coroner.biodiversity"; } [BepInPlugin("Turkeysteaks.coroner.biodiversity", "Coroner - Biodiversity", "1.0.0")] public class Plugin : BaseUnityPlugin { public ManualLogSource PluginLogger; public string ALOE_SLAP_KEY = "DeathEnemyAloeSlap"; public AdvancedCauseOfDeath ALOE_SLAP; public string ALOE_CRUSH_KEY = "DeathEnemyAloeCrush"; public AdvancedCauseOfDeath ALOE_CRUSH; public string ALOE_BLUDGEON_KEY = "DeathEnemyAloeBludgeon"; public AdvancedCauseOfDeath ALOE_BLUDGEON; public string COILCRAB_EXPLODE_KEY = "DeathEnemyCoilCrabExplosion"; public AdvancedCauseOfDeath COILCRAB_EXPLODE; public string OGOPOGO_GRAVITY_KEY = "DeathEnemyOgopogoGravity"; public AdvancedCauseOfDeath OGOPOGO_GRAVITY; public string OGOPOGO_DROWNING_KEY = "DeathEnemyOgopogoDrowned"; public AdvancedCauseOfDeath OGOPOGO_DROWNING; public string VERMIN_KEY = "DeathEnemyVermin"; public AdvancedCauseOfDeath VERMIN; public string PROTOTAX_KEY = "DeathEnemyPrototax"; public AdvancedCauseOfDeath PROTOTAX; public static Plugin Instance { get; private set; } private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) Instance = this; PluginLogger = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("Turkeysteaks.coroner.biodiversity"); val.PatchAll(); val.PatchAll(typeof(AloeSlapPatch)); val.PatchAll(typeof(AloeBludgeonPatch)); PluginLogger.LogInfo((object)"Plugin Coroner - Biodiversity (Turkeysteaks.coroner.biodiversity) is loaded!"); if (!API.IsRegistered(ALOE_SLAP_KEY)) { ALOE_SLAP = API.Register(ALOE_SLAP_KEY); } if (!API.IsRegistered(ALOE_CRUSH_KEY)) { ALOE_CRUSH = API.Register(ALOE_CRUSH_KEY); } if (!API.IsRegistered(ALOE_BLUDGEON_KEY)) { ALOE_BLUDGEON = API.Register(ALOE_BLUDGEON_KEY); } if (!API.IsRegistered(COILCRAB_EXPLODE_KEY)) { COILCRAB_EXPLODE = API.Register(COILCRAB_EXPLODE_KEY); } if (!API.IsRegistered(VERMIN_KEY)) { VERMIN = API.Register(VERMIN_KEY); } if (!API.IsRegistered(PROTOTAX_KEY)) { PROTOTAX = API.Register(PROTOTAX_KEY); } if (!API.IsRegistered(OGOPOGO_GRAVITY_KEY)) { OGOPOGO_GRAVITY = API.Register(OGOPOGO_GRAVITY_KEY); } if (!API.IsRegistered(OGOPOGO_DROWNING_KEY)) { OGOPOGO_DROWNING = API.Register(OGOPOGO_DROWNING_KEY); } } } } namespace CoronerBiodiversity.Patch.Ogopogo { [HarmonyPatch(typeof(OgopogoAI))] [HarmonyPatch("SetPlayerGrabbedClientRpc")] public class OgopogoPatch { public static List<PlayerControllerB> playersGrabbed = new List<PlayerControllerB>(); public static void Postfix(OgopogoAI __instance, int playerID) { try { PlayerControllerB component = ((Component)StartOfRound.Instance.allPlayerScripts[playerID]).gameObject.GetComponent<PlayerControllerB>(); Plugin.Instance.PluginLogger.LogDebug((object)$"Player {component} grabbed"); playersGrabbed.Add(component); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError((object)("Error in OgopogoPatch.Postfix: " + ex)); Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace); } } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyPatch("PlayerHitGroundEffects")] public class PlayerHitGroundEffectsPatch { public static void Postfix(PlayerControllerB __instance) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (__instance.isPlayerDead && OgopogoPatch.playersGrabbed.Contains(__instance)) { Plugin.Instance.PluginLogger.LogDebug((object)$"Player {__instance.playerClientId} was thrown to their death by the Ogopogo! Setting cause of death..."); API.SetCauseOfDeath(__instance, (AdvancedCauseOfDeath?)Plugin.Instance.OGOPOGO_GRAVITY); } } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyPatch("SetFaceUnderwaterFilters")] public class SetFaceUnderwaterFiltersPatch { public static void Postfix(PlayerControllerB __instance) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (__instance.isPlayerDead && OgopogoPatch.playersGrabbed.Contains(__instance)) { Plugin.Instance.PluginLogger.LogDebug((object)$"Player {__instance.playerClientId} was drowned by the Ogopogo! Setting cause of death..."); API.SetCauseOfDeath(__instance, (AdvancedCauseOfDeath?)Plugin.Instance.OGOPOGO_DROWNING); } } } [HarmonyPatch(typeof(VerminAI))] [HarmonyPatch("OnCollideWithPlayer")] public class VerminPatch { public static void Postfix(VerminAI __instance, Collider other) { try { HandleVerminKill(other); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError((object)("Error in VerminPatch.Postfix: " + ex)); Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace); } } private static void HandleVerminKill(Collider other) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) Plugin.Instance.PluginLogger.LogDebug((object)"Player was eaten by Vermin! Processing..."); PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if (component.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug((object)$"Player {component.playerClientId} was eaten by Vermin! Setting cause of death..."); API.SetCauseOfDeath(component, (AdvancedCauseOfDeath?)Plugin.Instance.VERMIN); } } } } namespace CoronerBiodiversity.Patch.Critters { [HarmonyPatch(typeof(CoilCrabAI))] [HarmonyPatch("SpawnExpolosionClientRpc")] public class CoilCrabPatch { private static Collider[] lastExplosionColliderArr = (Collider[])(object)new Collider[0]; public static List<PlayerControllerB> lastExplosionPlayerArr = new List<PlayerControllerB>(4); public static void Prefix(CoilCrabAI __instance, Vector3 explosionPosition, float killRange, float damageRange) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) try { lastExplosionColliderArr = Physics.OverlapSphere(explosionPosition, damageRange, 2621448, (QueryTriggerInteraction)2); lastExplosionPlayerArr.Clear(); Collider[] array = lastExplosionColliderArr; foreach (Collider val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null)) { PlayerControllerB component = ((Component)val).gameObject.GetComponent<PlayerControllerB>(); if (!((Object)(object)component == (Object)null)) { lastExplosionPlayerArr.Add(component); } } } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError((object)("Error in CoilCrabPatch.Prefix: " + ex)); Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace); } } } [HarmonyPatch(typeof(LandmineSpawnExplosionPatch))] [HarmonyPatch("RewriteCauseOfDeath")] public class LandmineSpawnExplosionPatchPatch { public static void Prefix(LandmineSpawnExplosionPatch __instance, PlayerControllerB targetPlayer, float killRange, float physicsForce) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) try { if (targetPlayer.isPlayerDead && CoilCrabPatch.lastExplosionPlayerArr.Contains(targetPlayer)) { Plugin.Instance.PluginLogger.LogDebug((object)$"Player {targetPlayer.playerClientId} was blown up by a CoilCrab! Setting cause of death..."); API.SetCauseOfDeath(targetPlayer, (AdvancedCauseOfDeath?)null); API.SetCauseOfDeath(targetPlayer, (AdvancedCauseOfDeath?)Plugin.Instance.COILCRAB_EXPLODE); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError((object)("Error in LandmineSpawnExplosionPatchPatch.Prefix: " + ex)); Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace); } } } [HarmonyPatch(typeof(DamageTrigger))] [HarmonyPatch("Update")] public class PrototaxPatch { private static PlayerControllerB player; public static void Postfix(DamageTrigger __instance, ref bool ___hitLocalPlayer) { try { if (___hitLocalPlayer) { HandleToxinKill(); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError((object)("Error in PrototaxPatch.Postfix: " + ex)); Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace); } } private static void HandleToxinKill() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) Plugin.Instance.PluginLogger.LogDebug((object)"Player was poisoned by a Prototax! Processing..."); player = GameNetworkManager.Instance.localPlayerController; if (player.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug((object)$"Player {player.playerClientId} was poisoned by a Prototax! Setting cause of death..."); API.SetCauseOfDeath(player, (AdvancedCauseOfDeath?)Plugin.Instance.PROTOTAX); } } } } namespace CoronerBiodiversity.Patch.Aloe { [HarmonyPatch(typeof(AloeClient))] [HarmonyPatch("HandleDamagePlayer")] internal class AloeBludgeonPatch { public static void Postfix(AloeClient __instance, ulong playerId, int damage) { try { HandleAloeKill(playerId); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError((object)("Error in AloeBludgeonPatch.Postfix: " + ex)); Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace); } } private static void HandleAloeKill(ulong playerId) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) Plugin.Instance.PluginLogger.LogDebug((object)"Player was bludgeoned to death by The Aloe! Processing..."); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; if (val.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug((object)$"Player {playerId} was bludgeoned to death by The Aloe! Setting cause of death..."); API.SetCauseOfDeath(val, (AdvancedCauseOfDeath?)Plugin.Instance.ALOE_BLUDGEON); } } } [HarmonyPatch(typeof(AloeClient))] [HarmonyPatch("CrushPlayerAnimation")] internal class AloeCrushPatch { public static void Postfix(AloeClient __instance, PlayerControllerB player, ref IEnumerator __result) { PlayerControllerB player2 = player; try { Action prefixAction = delegate { Console.WriteLine("--> beginning"); }; Action postfixAction = delegate { HandleAloeKill(player2); }; Action<object> preItemAction = delegate(object item) { Console.WriteLine($"--> before {item}"); }; Action<object> postItemAction = delegate(object item) { Console.WriteLine($"--> after {item}"); }; Func<object, object> itemAction = delegate(object item) { string text = item?.ToString() + "+"; Console.WriteLine($"--> item {item} => {text}"); return text; }; SimpleEnumerator simpleEnumerator = new SimpleEnumerator { enumerator = __result, prefixAction = prefixAction, postfixAction = postfixAction, preItemAction = preItemAction, postItemAction = postItemAction, itemAction = itemAction }; __result = simpleEnumerator.GetEnumerator(); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError((object)("Error in AloeSlapPatch.Postfix: " + ex)); Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace); } } private static void HandleAloeKill(PlayerControllerB player) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) Plugin.Instance.PluginLogger.LogDebug((object)"Player was crushed by The Aloe! Processing..."); Plugin.Instance.PluginLogger.LogDebug((object)$"Player {player.playerClientId} was crushed by The Aloe! Setting cause of death..."); API.SetCauseOfDeath(player, (AdvancedCauseOfDeath?)Plugin.Instance.ALOE_CRUSH); } } [HarmonyPatch(typeof(SlapCollisionDetection))] [HarmonyPatch("SlapPlayerServerRpc")] internal class AloeSlapPatch { public static void Postfix(SlapCollisionDetection __instance, ulong playerId) { try { HandleAloeKill(playerId); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError((object)("Error in AloeSlapPatch.Postfix: " + ex)); Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace); } } private static void HandleAloeKill(ulong playerId) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) Plugin.Instance.PluginLogger.LogDebug((object)"Player was slapped to death by The Aloe! Processing..."); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; if (val.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug((object)$"Player {playerId} was slapped to death by The Aloe! Setting cause of death..."); API.SetCauseOfDeath(val, (AdvancedCauseOfDeath?)Plugin.Instance.ALOE_SLAP); } } } public class SimpleEnumerator : IEnumerable { public IEnumerator enumerator; public Action prefixAction; public Action postfixAction; public Action<object> preItemAction; public Action<object> postItemAction; public Func<object, object> itemAction; IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public IEnumerator GetEnumerator() { prefixAction(); while (enumerator.MoveNext()) { object item = enumerator.Current; preItemAction(item); yield return itemAction(item); postItemAction(item); } postfixAction(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }