using 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.Bootstrap;
using BepInEx.Logging;
using Biodiversity.Behaviours;
using Biodiversity.Creatures.Aloe;
using Biodiversity.Creatures.CoilCrab;
using Biodiversity.Creatures.Ogopogo;
using Coroner;
using Coroner.Patch;
using CoronerIntegrations.Patch.BiodiversityIntegration;
using CoronerIntegrations.Patch.BiodiversityIntegration.Aloe;
using CoronerIntegrations.Patch.BiodiversityIntegration.Critters;
using CoronerIntegrations.Patch.BiodiversityIntegration.Ogopogo;
using CoronerIntegrations.Patch.LockerIntegration;
using CoronerIntegrations.Patch.ScopophobiaIntegration;
using CoronerIntegrations.Patch.SirenHeadIntegration;
using CoronerIntegrations.Patch.TheCabinetIntegration;
using GameNetcodeStuff;
using HarmonyLib;
using LethalSirenHead.Enemy;
using Locker;
using Locker.MonoBehaviours;
using Microsoft.CodeAnalysis;
using ShyGuy.AI;
using TheCabinet;
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: IgnoresAccessChecksTo("Locker")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Turkeysteaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Provides integration between Coroner and many mods.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Coroner - Integrations")]
[assembly: AssemblyTitle("Coroner - Integrations")]
[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 CoronerIntegrations
{
public static class PluginInfo
{
public const string PLUGIN_ID = "coroner.integrations";
public const string PLUGIN_NAME = "Coroner - Integrations";
public const string PLUGIN_VERSION = "1.0.0";
public const string PLUGIN_GUID = "Turkeysteaks.coroner.integrations";
}
[BepInPlugin("Turkeysteaks.coroner.integrations", "Coroner - Integrations", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public ManualLogSource PluginLogger;
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
Instance = this;
PluginLogger = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("Turkeysteaks.coroner.integrations");
PluginLogger.LogInfo((object)"Plugin Coroner - Integrations (Turkeysteaks.coroner.integrations) is loaded!");
PluginLogger.LogInfo((object)$"Biodiversity Found: {BiodiversitySoftDep.enabled}");
if (BiodiversitySoftDep.enabled)
{
val.PatchAll(typeof(AloeBludgeonPatch));
val.PatchAll(typeof(AloeCrushPatch));
val.PatchAll(typeof(AloeSlapPatch));
val.PatchAll(typeof(CoilCrabPatch));
val.PatchAll(typeof(LandmineSpawnExplosionPatchPatch));
val.PatchAll(typeof(PrototaxPatch));
val.PatchAll(typeof(OgopogoPatch));
val.PatchAll(typeof(VerminPatch));
BiodiversitySoftDep.CoronerRegister();
}
PluginLogger.LogInfo((object)$"Scopophobia Found: {ScopophobiaSoftDep.enabled}");
if (ScopophobiaSoftDep.enabled)
{
val.PatchAll(typeof(KillPlayerAnimationPatch));
ScopophobiaSoftDep.CoronerRegister();
}
PluginLogger.LogInfo((object)$"LethalSirenHead Found: {SirenHeadSoftDep.enabled}");
if (SirenHeadSoftDep.enabled)
{
val.PatchAll(typeof(SirenHeadEatPlayerPatch));
SirenHeadSoftDep.CoronerRegister();
}
PluginLogger.LogInfo((object)$"The Cabinet Found: {TheCabinetSoftDep.enabled}");
if (TheCabinetSoftDep.enabled)
{
val.PatchAll(typeof(CoronerIntegrations.Patch.TheCabinetIntegration.KillPlayerPatch));
TheCabinetSoftDep.CoronerRegister();
}
PluginLogger.LogInfo((object)$"Locker Found: {LockerSoftDep.enabled}");
if (LockerSoftDep.enabled)
{
val.PatchAll(typeof(CoronerIntegrations.Patch.LockerIntegration.KillPlayerPatch));
val.PatchAll(typeof(ExplodePatch));
LockerSoftDep.CoronerRegister();
}
}
}
}
namespace CoronerIntegrations.Patch
{
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 CoronerIntegrations.Patch.TheCabinetIntegration
{
[HarmonyPatch(typeof(TheCabinetAI))]
[HarmonyPatch("KillPlayer")]
internal class KillPlayerPatch
{
public static void Postfix(TheCabinetAI __instance, ulong playerId, ref IEnumerator __result)
{
try
{
Action prefixAction = delegate
{
Console.WriteLine("--> beginning");
};
Action postfixAction = delegate
{
HandleCabinetKill(playerId);
};
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 KillPlayerPatch.Postfix: " + ex));
Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
}
}
private static void HandleCabinetKill(ulong playerId)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
Plugin.Instance.PluginLogger.LogDebug((object)"Player was killed by The Cabinet! Processing...");
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId];
Plugin.Instance.PluginLogger.LogDebug((object)$"Player {playerId} was killed by The Cabinet! Setting cause of death...");
API.SetCauseOfDeath(val, (AdvancedCauseOfDeath?)TheCabinetSoftDep.CABINET);
}
}
public class TheCabinetSoftDep
{
private static bool? _enabled;
public static string CABINET_KEY = "DeathEnemyCabinet";
public static AdvancedCauseOfDeath CABINET;
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("VectorV.TheCabinet");
}
return _enabled.Value;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void CoronerRegister()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (!API.IsRegistered(CABINET_KEY))
{
CABINET = API.Register(CABINET_KEY);
}
}
}
}
namespace CoronerIntegrations.Patch.SirenHeadIntegration
{
[HarmonyPatch(typeof(SirenHeadAI))]
[HarmonyPatch("EatPlayer")]
internal class SirenHeadEatPlayerPatch
{
private static ulong playerID;
public static void Postfix(SirenHeadAI __instance, ulong player, ref IEnumerator __result)
{
playerID = player;
}
[HarmonyPostfix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static void Postfix_MoveNext(bool __result)
{
try
{
if (!__result)
{
HandleSirenHeadKill(playerID);
}
}
catch (Exception ex)
{
Plugin.Instance.PluginLogger.LogError((object)("Error in SirenHeadEatPlayerPatch: " + ex));
Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
}
}
private static void HandleSirenHeadKill(ulong playerId)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
Plugin.Instance.PluginLogger.LogDebug((object)"Player was killed by Siren Head! Processing...");
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId];
Plugin.Instance.PluginLogger.LogDebug((object)$"Player {playerId} was killed by Siren Head! Setting cause of death...");
API.SetCauseOfDeath(val, (AdvancedCauseOfDeath?)SirenHeadSoftDep.SIREN_HEAD);
playerID = 100000uL;
}
}
public class SirenHeadSoftDep
{
private static bool? _enabled;
public static string SIREN_HEAD_KEY = "DeathEnemySirenHead";
public static AdvancedCauseOfDeath SIREN_HEAD;
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("Ccode.SirenHead");
}
return _enabled.Value;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void CoronerRegister()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (!API.IsRegistered(SIREN_HEAD_KEY))
{
SIREN_HEAD = API.Register(SIREN_HEAD_KEY);
}
}
}
}
namespace CoronerIntegrations.Patch.ScopophobiaIntegration
{
[HarmonyPatch(typeof(ShyGuyAI))]
[HarmonyPatch("killPlayerAnimation")]
internal class KillPlayerAnimationPatch
{
public static void Postfix(ShyGuyAI __instance, ulong playerId, ref IEnumerator __result)
{
try
{
Action prefixAction = delegate
{
Console.WriteLine("--> beginning");
};
Action postfixAction = delegate
{
HandleShyGuyKill(playerId);
};
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 KillPlayerAnimationPatch.Postfix: " + ex));
Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
}
}
private static void HandleShyGuyKill(ulong playerId)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
Plugin.Instance.PluginLogger.LogDebug((object)"Player was killed by Shy Guy! Processing...");
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId];
Plugin.Instance.PluginLogger.LogDebug((object)$"Player {playerId} was killed by Shy Guy! Setting cause of death...");
API.SetCauseOfDeath(val, (AdvancedCauseOfDeath?)ScopophobiaSoftDep.SHY_GUY);
}
}
public class ScopophobiaSoftDep
{
private static bool? _enabled;
public static string SHY_GUY_KEY = "DeathEnemyShyGuy";
public static AdvancedCauseOfDeath SHY_GUY;
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("Scopophobia");
}
return _enabled.Value;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void CoronerRegister()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (!API.IsRegistered(SHY_GUY_KEY))
{
SHY_GUY = API.Register(SHY_GUY_KEY);
}
}
}
}
namespace CoronerIntegrations.Patch.LockerIntegration
{
[HarmonyPatch(typeof(Utilities))]
[HarmonyPatch("Explode")]
public class ExplodePatch
{
private static Collider[] colliderArray = (Collider[])(object)new Collider[16];
public static void Postfix(Utilities __instance, Vector3 position, float minRange, float maxRange)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
int num = Physics.OverlapSphereNonAlloc(position, maxRange, colliderArray, 2621448, (QueryTriggerInteraction)2);
for (int i = 0; i < num; i++)
{
if (((Component)colliderArray[i]).gameObject.layer == 3)
{
PlayerControllerB component = ((Component)colliderArray[i]).gameObject.GetComponent<PlayerControllerB>();
if (!((Object)(object)component == (Object)null) && component.isPlayerDead)
{
HandleLockerExplode(component);
}
}
}
}
private static void HandleLockerExplode(PlayerControllerB player)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
Plugin.Instance.PluginLogger.LogDebug((object)"Player was killed by colliding Lockers! Processing...");
if (player.isPlayerDead)
{
Plugin.Instance.PluginLogger.LogDebug((object)$"Player {player.actualClientId} was killed by colliding Lockers! Setting cause of death...");
API.SetCauseOfDeath(player, (AdvancedCauseOfDeath?)LockerSoftDep.LOCKER_EXPLODE);
}
}
}
[HarmonyPatch(typeof(LockerAI))]
[HarmonyPatch("KillPlayer")]
internal class KillPlayerPatch
{
public static void Postfix(LockerAI __instance, ulong id, ref IEnumerator __result)
{
try
{
Action prefixAction = delegate
{
Console.WriteLine("--> beginning");
};
Action postfixAction = delegate
{
HandleLockerKill(id);
};
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 KillPlayerPatch.Postfix: " + ex));
Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
}
}
private static void HandleLockerKill(ulong playerId)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
Plugin.Instance.PluginLogger.LogDebug((object)"Player was killed by a Locker! Processing...");
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId];
Plugin.Instance.PluginLogger.LogDebug((object)$"Player {playerId} was killed by a Locker! Setting cause of death...");
API.SetCauseOfDeath(val, (AdvancedCauseOfDeath?)LockerSoftDep.LOCKER);
}
}
public class LockerSoftDep
{
private static bool? _enabled;
public static string LOCKER_KEY = "DeathEnemyLocker";
public static AdvancedCauseOfDeath LOCKER;
public static string LOCKER_EXPLODE_KEY = "DeathEnemyLockerExplode";
public static AdvancedCauseOfDeath LOCKER_EXPLODE;
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("com.zealsprince.locker");
}
return _enabled.Value;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void CoronerRegister()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (!API.IsRegistered(LOCKER_KEY))
{
LOCKER = API.Register(LOCKER_KEY);
}
if (!API.IsRegistered(LOCKER_EXPLODE_KEY))
{
LOCKER_EXPLODE = API.Register(LOCKER_EXPLODE_KEY);
}
}
}
}
namespace CoronerIntegrations.Patch.BiodiversityIntegration
{
public class BiodiversitySoftDep
{
private static bool? _enabled;
public static string ALOE_SLAP_KEY = "DeathEnemyAloeSlap";
public static AdvancedCauseOfDeath ALOE_SLAP;
public static string ALOE_CRUSH_KEY = "DeathEnemyAloeCrush";
public static AdvancedCauseOfDeath ALOE_CRUSH;
public static string ALOE_BLUDGEON_KEY = "DeathEnemyAloeBludgeon";
public static AdvancedCauseOfDeath ALOE_BLUDGEON;
public static string COILCRAB_EXPLODE_KEY = "DeathEnemyCoilCrabExplosion";
public static AdvancedCauseOfDeath COILCRAB_EXPLODE;
public static string OGOPOGO_GRAVITY_KEY = "DeathEnemyOgopogoGravity";
public static AdvancedCauseOfDeath OGOPOGO_GRAVITY;
public static string OGOPOGO_DROWNING_KEY = "DeathEnemyOgopogoDrowned";
public static AdvancedCauseOfDeath OGOPOGO_DROWNING;
public static string VERMIN_KEY = "DeathEnemyVermin";
public static AdvancedCauseOfDeath VERMIN;
public static string PROTOTAX_KEY = "DeathEnemyPrototax";
public static AdvancedCauseOfDeath PROTOTAX;
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("com.github.biodiversitylc.Biodiversity");
}
return _enabled.Value;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void CoronerRegister()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
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);
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void CoronerSetCauseOfDeath(PlayerControllerB player)
{
}
}
}
namespace CoronerIntegrations.Patch.BiodiversityIntegration.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_0042: 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?)BiodiversitySoftDep.OGOPOGO_GRAVITY);
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
[HarmonyPatch("SetFaceUnderwaterFilters")]
public class SetFaceUnderwaterFiltersPatch
{
public static void Postfix(PlayerControllerB __instance)
{
//IL_0042: 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?)BiodiversitySoftDep.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_0053: 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?)BiodiversitySoftDep.VERMIN);
}
}
}
}
namespace CoronerIntegrations.Patch.BiodiversityIntegration.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_0053: 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?)BiodiversitySoftDep.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_0062: 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?)BiodiversitySoftDep.PROTOTAX);
}
}
}
}
namespace CoronerIntegrations.Patch.BiodiversityIntegration.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_0050: 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?)BiodiversitySoftDep.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_003c: 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?)BiodiversitySoftDep.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_0050: 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?)BiodiversitySoftDep.ALOE_SLAP);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}