Decompiled source of EyelessDogWalterJumpscare v2.0.2

plugins/EyelessDogJumpscareModv2/Eyeless Dog Jumpscare Mod v2.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Eyeless Dog Jumpscare Mod v2.NetcodePatcher;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

[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("Eyeless Dog Jumpscare Mod v2")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7e9d0c80c536e48341d15e86da7195fa6a2e6345")]
[assembly: AssemblyProduct("Eyeless Dog Jumpscare Mod v2")]
[assembly: AssemblyTitle("Eyeless Dog Jumpscare Mod v2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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;
		}
	}
}
public static class ConfigEntries
{
	public static ConfigEntry<bool> DoRandom;

	public static ConfigEntry<bool> Global;

	public static ConfigEntry<float> MinRandomFadeout;

	public static ConfigEntry<float> MaxRandomFadeout;

	public static ConfigEntry<float> Delay;

	public static ConfigEntry<bool> DoDelayOnDeath;

	public static ConfigEntry<bool> CallEventsOnBlob;

	public static ConfigEntry<bool> OnCollideBlob;

	public static ConfigEntry<bool> CallEventsOnBushWolf;

	public static ConfigEntry<bool> OnCollideBushWolf;

	public static ConfigEntry<bool> CallEventsOnButler;

	public static ConfigEntry<bool> OnCollideButler;

	public static ConfigEntry<bool> CallEventsOnButlerBees;

	public static ConfigEntry<bool> OnCollideButlerBees;

	public static ConfigEntry<bool> CallEventsOnManeater;

	public static ConfigEntry<bool> OnCollideManeater;

	public static ConfigEntry<bool> CallEventsOnClaySurgeon;

	public static ConfigEntry<bool> OnCollideClaySurgeon;

	public static ConfigEntry<bool> CallEventsOnTulipSnake;

	public static ConfigEntry<bool> OnCollideTulipSnake;

	public static ConfigEntry<bool> CallEventsOnCoilhead;

	public static ConfigEntry<bool> OnCollideCoilhead;

	public static ConfigEntry<bool> CallEventsOnHoarderBug;

	public static ConfigEntry<bool> OnCollideHoarderBug;

	public static ConfigEntry<bool> CallEventsOnGhostGirl;

	public static ConfigEntry<bool> OnCollideGhostGirl;

	public static ConfigEntry<bool> CallEventsOnBracken;

	public static ConfigEntry<bool> OnCollideBracken;

	public static ConfigEntry<bool> CallEventsOnNutcracker;

	public static ConfigEntry<bool> OnCollideNutcracker;

	public static ConfigEntry<bool> CallEventsOnJester;

	public static ConfigEntry<bool> OnCollideJester;

	public static ConfigEntry<bool> CallEventsOnEyelessDog;

	public static ConfigEntry<bool> OnCollideEyelessDog;

	public static ConfigEntry<bool> CallEventsOnRoamingLocust;

	public static ConfigEntry<bool> OnCollideRoamingLocust;

	public static ConfigEntry<bool> CallEventsOnForestGiant;

	public static ConfigEntry<bool> OnCollideForestGiant;

	public static ConfigEntry<bool> CallEventsOnBaboonHawk;

	public static ConfigEntry<bool> OnCollideBaboonHawk;

	public static ConfigEntry<bool> CallEventsOnThumper;

	public static ConfigEntry<bool> OnCollideThumper;

	public static ConfigEntry<bool> CallEventsOnManticoil;

	public static ConfigEntry<bool> OnCollideManticoil;

	public static ConfigEntry<bool> CallEventsOnCentipedeSam;

	public static ConfigEntry<bool> OnCollideCentipedeSam;

	public static ConfigEntry<bool> CallEventsOnSandworm;

	public static ConfigEntry<bool> OnCollideSandworm;

	public static ConfigEntry<bool> CallEventsOnSporeLizard;

	public static ConfigEntry<bool> OnCollideSporeLizard;

	public static ConfigEntry<bool> CallEventsOnCircuitBees;

	public static ConfigEntry<bool> OnCollideCircuitBees;

	public static ConfigEntry<bool> CallEventsOnBunkerSpider;

	public static ConfigEntry<bool> OnCollideBunkerSpider;

	public static ConfigEntry<bool> CallEventsOnMasked;

	public static ConfigEntry<bool> OnCollideMasked;

	public static ConfigEntry<bool> CallEventsOnLassoMan;

	public static ConfigEntry<bool> OnCollideLassoMan;

	public static ConfigEntry<bool> CallEventsOnRadMech;

	public static ConfigEntry<bool> OnCollideRadMech;

	public static ConfigEntry<bool> CallEventsOnDefault;

	public static ConfigEntry<bool> CallEventsOnShot;

	public static ConfigEntry<bool> CallEventsOnFall;

	public static ConfigEntry<bool> CallEventsOnDrown;

	public static ConfigEntry<bool> CallEventsOnOtherPlayer;

	public static ConfigEntry<bool> CallEventsOnSpikeTrap;

	public static ConfigEntry<bool> CallEventsOnTurret;

	public static ConfigEntry<bool> CallEventsOnLandmine;
}
[StructLayout(LayoutKind.Sequential, Size = 1)]
internal struct ModInfo
{
	public const string Name = "EyelessDogJumpscareMod v2";

	public const string GUID = "EDJM2";

	public const string Author = "fayeknd";

	public const string Version = "2.0.0";

	public const string InitMessage = "EyelessDogJumpscareMod v2 loaded!";

	public static string AssemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
[BepInPlugin("EDJM2", "EyelessDogJumpscareMod v2", "2.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class EDJM_Base : BaseUnityPlugin
{
	public static EDJM_Enemies LastEnemyToDamageThisClient;

	public static bool EnemySetRecently = false;

	public bool FilesLoading = false;

	public static EDJMNetworkObject networkObject;

	public static List<bool> CollidableEnemies = new List<bool>();

	public static List<bool> TriggerEnemies = new List<bool>();

	public readonly Harmony harmony = new Harmony("EDJM2");

	public static EDJM_Base instance;

	public static GameObject NetworkObject;

	private Sprite icon;

	private void Awake()
	{
		instance = this;
		Log.Init("EyelessDogJumpscareMod v2 loaded!");
		harmony.PatchAll(typeof(EDJM_CreateOverlay));
		harmony.PatchAll(typeof(EDJM_AIPatch));
		harmony.PatchAll(typeof(EDJM_Update));
		harmony.PatchAll(typeof(EDJM_Player));
		harmony.PatchAll(typeof(EDJM_GameNetworkManager));
		ConfigSetup();
		LoadNetworkObject();
		NetcodePatcher();
	}

	private void LoadIcon()
	{
		AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(ModInfo.AssemblyLocation, "assets/icon"));
		if (!Object.op_Implicit((Object)(object)val))
		{
			Log.Write.LogWarning((object)"Icon not found! Not a big deal, this just means LethalConfig won't have an icon.");
		}
		else
		{
			icon = val.LoadAsset<Sprite>("assets/icon.png");
		}
	}

	private void LoadNetworkObject()
	{
		AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(ModInfo.AssemblyLocation, "assets/networkobject"));
		if (!Object.op_Implicit((Object)(object)val))
		{
			Log.Write.LogWarning((object)"Network Object not found! No network functions will work.");
			return;
		}
		NetworkObject = val.LoadAsset<GameObject>("assets/EDJMNetworkObject.prefab");
		val.Unload(false);
	}

	private void ConfigSetup()
	{
		ConfigEntries.DoRandom = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Randomise duration", true, "Determines if the duration of the fadeout and audio pitch should be randomised. This config entry was NOT automatically generated btw. xoxo.");
		ConfigEntries.Global = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Is global?", true, "Should the flashes be triggered for all or just for you? (Disclaimer: This and all the other fields are determined by the host's config.)");
		ConfigEntries.MinRandomFadeout = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Minimum Fadeout", 0.3f, "The floor of the random calculation");
		ConfigEntries.MaxRandomFadeout = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Maximum Fadeout", 1.5f, "The ceiling of the random calculation");
		ConfigEntries.Delay = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Delay between flash", 1.5f, "The time in seconds until the next flash can appear. If images are flashing on collision rather than on death, the image will flash every frame unless a delay is set.");
		ConfigEntries.DoDelayOnDeath = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Delay on death?", false, "Is the delay value still used between player deaths, rather than collisions?");
		ConfigEntries.CallEventsOnDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("Player Interactions", "Trigger on any death", false, "Triggers image on every death. Reccomended to keep this off.");
		ConfigEntries.CallEventsOnShot = ((BaseUnityPlugin)this).Config.Bind<bool>("Player Interactions", "Player shot", false, "Triggers every time a player is killed via a bullet.");
		ConfigEntries.CallEventsOnFall = ((BaseUnityPlugin)this).Config.Bind<bool>("Player Interactions", "Player fell", false, "Triggers every time a player falls to their death.");
		ConfigEntries.CallEventsOnDrown = ((BaseUnityPlugin)this).Config.Bind<bool>("Player Interactions", "Player drowned", false, "Triggers every time a player drowns. (Nothing ever happens in the lake)");
		ConfigEntries.CallEventsOnSpikeTrap = ((BaseUnityPlugin)this).Config.Bind<bool>("Player Interactions", "Spike trap", false, "Triggers every time a player is killed by a spike trap.");
		ConfigEntries.CallEventsOnTurret = ((BaseUnityPlugin)this).Config.Bind<bool>("Player Interactions", "Turret", false, "Triggers every time a player is killed by a turret.");
		ConfigEntries.CallEventsOnLandmine = ((BaseUnityPlugin)this).Config.Bind<bool>("Player Interactions", "Landmine", false, "Triggers every time a player is killed by a landmine.");
		ConfigEntries.CallEventsOnEyelessDog = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Eyeless Dog", "Trigger on Eyeless Dog", true, (ConfigDescription)null);
		ConfigEntries.OnCollideEyelessDog = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Eyeless Dog", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnBaboonHawk = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Baboon Hawk", "Trigger on Baboon Hawk", false, (ConfigDescription)null);
		ConfigEntries.OnCollideBaboonHawk = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Baboon Hawk", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnBracken = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Bracken", "Trigger on Bracken", false, (ConfigDescription)null);
		ConfigEntries.OnCollideBracken = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Bracken", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnBlob = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Hydrogere", "Trigger on Hydrogere", false, (ConfigDescription)null);
		ConfigEntries.OnCollideBlob = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Hydrogere", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnCoilhead = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Coilhead", "Trigger on Coilhead", true, (ConfigDescription)null);
		ConfigEntries.OnCollideCoilhead = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Coilhead", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnHoarderBug = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Hoarding Bug", "Trigger on Hoarding Bug", false, (ConfigDescription)null);
		ConfigEntries.OnCollideHoarderBug = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Hoarding Bug", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnThumper = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Thumper", "Trigger on Thumper", true, (ConfigDescription)null);
		ConfigEntries.OnCollideThumper = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Thumper", "On collide", true, (ConfigDescription)null);
		ConfigEntries.CallEventsOnSporeLizard = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Spore Lizard", "Trigger on Spore Lizard", false, (ConfigDescription)null);
		ConfigEntries.OnCollideSporeLizard = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Spore Lizard", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnJester = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Jester", "Trigger on Jester", true, (ConfigDescription)null);
		ConfigEntries.OnCollideJester = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Jester", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnNutcracker = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Nutcracker", "Trigger on Nutcracker", true, (ConfigDescription)null);
		ConfigEntries.OnCollideNutcracker = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Nutcracker", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnForestGiant = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Forest Giant", "Trigger on Forest Giant", true, (ConfigDescription)null);
		ConfigEntries.OnCollideForestGiant = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Forest Giant", "On collide", true, (ConfigDescription)null);
		ConfigEntries.CallEventsOnGhostGirl = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Ghost Girl", "Trigger on Ghost Girl", true, (ConfigDescription)null);
		ConfigEntries.OnCollideGhostGirl = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Ghost Girl", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnCircuitBees = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - CircuitBees", "Trigger on Circuit Bees", false, (ConfigDescription)null);
		ConfigEntries.OnCollideCircuitBees = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - CircuitBees", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnManeater = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Maneater", "Trigger on Maneater", true, (ConfigDescription)null);
		ConfigEntries.OnCollideManeater = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Maneater", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnButler = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Butler", "Trigger on Butler", false, (ConfigDescription)null);
		ConfigEntries.OnCollideButler = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Butler", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnButlerBees = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Butler", "Trigger on Butlers Bees", true, (ConfigDescription)null);
		ConfigEntries.OnCollideButlerBees = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Butler", "On collide w/ bees", true, (ConfigDescription)null);
		ConfigEntries.CallEventsOnTulipSnake = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Tulip Snake", "Trigger on Tulip Snake", false, (ConfigDescription)null);
		ConfigEntries.OnCollideTulipSnake = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Tulip Snake", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnClaySurgeon = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Barber", "Trigger on Barber", false, (ConfigDescription)null);
		ConfigEntries.OnCollideClaySurgeon = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Barber", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnRoamingLocust = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Roaming Locust", "Trigger on Roaming Locusts", false, (ConfigDescription)null);
		ConfigEntries.OnCollideRoamingLocust = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Roaming Locust", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnCentipedeSam = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Snare Flea", "Trigger on Snare Flea", true, (ConfigDescription)null);
		ConfigEntries.OnCollideCentipedeSam = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Snare Flea", "On collide", true, (ConfigDescription)null);
		ConfigEntries.CallEventsOnManticoil = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Manticoil", "Trigger on Manticoil", false, (ConfigDescription)null);
		ConfigEntries.OnCollideManticoil = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Manticoil", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnBunkerSpider = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Bunker Spider", "Trigger on Bunker Spider", false, (ConfigDescription)null);
		ConfigEntries.OnCollideBunkerSpider = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Bunker Spider", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnMasked = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Masked", "Trigger on Masked", false, (ConfigDescription)null);
		ConfigEntries.OnCollideMasked = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Masked", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnSandworm = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Sandworm", "Trigger on Sandworm", true, (ConfigDescription)null);
		ConfigEntries.OnCollideSandworm = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Sandworm", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnRadMech = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Old Bird", "Trigger on Old Bird", true, (ConfigDescription)null);
		ConfigEntries.OnCollideRadMech = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Old Bird", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnBushWolf = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Additional - Bush Wolf", "Trigger on Bush Wolf", false, (ConfigDescription)null);
		ConfigEntries.OnCollideBushWolf = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Additional - Bush Wolf", "On collide", false, (ConfigDescription)null);
		ConfigEntries.CallEventsOnLassoMan = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Additional - Lasso Man", "Trigger on Lasso Man", false, (ConfigDescription)null);
		ConfigEntries.OnCollideLassoMan = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies - Additional - Lasso Man", "On collide", false, (ConfigDescription)null);
		Log.Write.LogInfo((object)"Config Entries loaded!");
		LoadIcon();
		LethalConfigManager.SetModIcon(icon);
	}

	public IEnumerator SetEnemyState(float time)
	{
		if (!EnemySetRecently)
		{
			EnemySetRecently = true;
			yield return (object)new WaitForSeconds(time);
			EnemySetRecently = false;
		}
		else
		{
			yield return null;
		}
	}

	private void NetcodePatcher()
	{
		Type[] types = Assembly.GetExecutingAssembly().GetTypes();
		Type[] array = types;
		foreach (Type type in array)
		{
			MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
			MethodInfo[] array2 = methods;
			foreach (MethodInfo methodInfo in array2)
			{
				object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
				if (customAttributes.Length != 0)
				{
					methodInfo.Invoke(null, null);
				}
			}
		}
	}
}
public enum EDJM_CauseOfDeath
{
	Default,
	Shot,
	FallDamage,
	Drowning,
	OtherPlayer,
	Spike,
	Turret,
	Landmine
}
public enum EDJM_Enemies
{
	Hydrogere,
	BushWolf,
	Butler,
	ButlerBees,
	Maneater,
	ClaySurgeon,
	TulipSnake,
	Coilhead,
	HoarderBug,
	GhostGirl,
	Bracken,
	Nutcracker,
	Jester,
	EyelessHound,
	RoamingLocust,
	ForestGiant,
	BaboonHawk,
	Thumper,
	Manticoil,
	CentipedeSam,
	Sandworm,
	SporeLizard,
	CircuitBees,
	BunkerSpider,
	Masked,
	LassoMan,
	RadMech
}
internal class EDJM_AIPatch : MonoBehaviour
{
	public static bool NutcrackerJustShot;

	public static bool LandmineJustWentOff;

	public static bool TurretJustShotClient;

	public static bool SpikeTrapKilledPlayer;

	private static IEnumerator WaitForSecondsThenResetGunState(float time)
	{
		NutcrackerJustShot = true;
		yield return (object)new WaitForSeconds(time);
		NutcrackerJustShot = false;
	}

	private static IEnumerator WaitForSecondsThenResetLandmineState(float time)
	{
		LandmineJustWentOff = true;
		yield return (object)new WaitForSeconds(time);
		LandmineJustWentOff = false;
	}

	private static IEnumerator WaitForSecondsThenResetTurretState(float time)
	{
		TurretJustShotClient = true;
		yield return (object)new WaitForSeconds(time);
		TurretJustShotClient = false;
	}

	[HarmonyPatch(typeof(EnemyAI), "Start")]
	[HarmonyPostfix]
	private static void LogEnemyType(EnemyAI __instance)
	{
		((Component)__instance).gameObject.AddComponent<ThisEnemyType>();
	}

	[HarmonyPatch(typeof(EnemyAI), "OnCollideWithPlayer")]
	[HarmonyPrefix]
	private static void EnemyDamagedPlayer(EnemyAI __instance, Collider other)
	{
		if (!((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>() != (Object)null))
		{
			return;
		}
		string enemyName = __instance.enemyType.enemyName;
		PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
		Log.Write.LogInfo((object)("Enemy '" + enemyName + "' hit player '" + component.playerUsername + "'"));
		if ((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
		{
			EDJM_Base.LastEnemyToDamageThisClient = ((Component)__instance).gameObject.GetComponent<ThisEnemyType>().enemy;
			((MonoBehaviour)__instance).StartCoroutine(EDJM_Base.instance.SetEnemyState(1.5f));
			Log.Write.LogInfo((object)"Hit player is this client");
			if (EDJM_Base.CollidableEnemies[(int)((Component)__instance).gameObject.GetComponent<ThisEnemyType>().enemy])
			{
				Overlay.Display(Random.Range(0, Images.GetSize()), Random.Range(0, AudioFiles.GetSize()), 0.5f, ConfigEntries.DoDelayOnDeath.Value);
			}
		}
	}

	[HarmonyPatch(typeof(RadMechAI), "SetExplosion")]
	[HarmonyPrefix]
	private static void Explosion(RadMechAI __instance, Vector3 explosionPosition, Vector3 forwardRotation)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition - forwardRotation * 0.1f) < 7f)
		{
			EDJM_Base.LastEnemyToDamageThisClient = EDJM_Enemies.RadMech;
			((MonoBehaviour)__instance).StartCoroutine(EDJM_Base.instance.SetEnemyState(1.5f));
		}
	}

	[HarmonyPatch(typeof(NutcrackerEnemyAI), "FireGun")]
	[HarmonyPrefix]
	private static bool FireGunOverride(Vector3 gunPosition, Vector3 gunForward, NutcrackerEnemyAI __instance)
	{
		//IL_005b: 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)
		((EnemyAI)__instance).creatureAnimator.ResetTrigger("ShootGun");
		((EnemyAI)__instance).creatureAnimator.SetTrigger("ShootGun");
		if ((Object)(object)__instance.gun == (Object)null)
		{
			((EnemyAI)__instance).LogEnemyError("No gun held on local client, unable to shoot");
		}
		else
		{
			((MonoBehaviour)__instance).StartCoroutine(WaitForSecondsThenResetGunState(0.5f));
			__instance.gun.ShootGun(gunPosition, gunForward);
		}
		return false;
	}

	[HarmonyPatch(typeof(Landmine), "Detonate")]
	[HarmonyPrefix]
	private static void LandminePatch(Landmine __instance)
	{
		((MonoBehaviour)__instance).StartCoroutine(WaitForSecondsThenResetLandmineState(0.5f));
	}

	[HarmonyPatch(typeof(Turret), "Update")]
	[HarmonyPrefix]
	private static void TurretPatch(Turret __instance)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Invalid comparison between Unknown and I4
		float num = (float)Traverse.Create((object)__instance).Field("turretInterval").GetValue();
		if ((int)__instance.turretMode == 2 && num >= 0.21f && (Object)(object)__instance.CheckForPlayersInLineOfSight(3f, false) == (Object)(object)GameNetworkManager.Instance.localPlayerController)
		{
			((MonoBehaviour)__instance).StartCoroutine(WaitForSecondsThenResetTurretState(0.5f));
		}
	}

	[HarmonyPatch(typeof(SpikeRoofTrap), "OnTriggerStay")]
	[HarmonyPrefix]
	private static void SpikeTrapPatch(SpikeRoofTrap __instance, Collider other)
	{
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		List<DeadBodyInfo> list = (List<DeadBodyInfo>)Traverse.Create((object)__instance).Field("deadBodiesSlammed").GetValue();
		if (__instance.trapActive && __instance.slammingDown && !(Time.realtimeSinceStartup - __instance.timeSinceMovingUp < 0.75f))
		{
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController && !component.isPlayerDead)
			{
				SpikeTrapKilledPlayer = true;
				GameNetworkManager.Instance.localPlayerController.KillPlayer(Vector3.down * 17f, true, (CauseOfDeath)8, 0, default(Vector3));
			}
		}
	}
}
internal class EDJM_CreateOverlay : MonoBehaviour
{
	public static IEnumerator LoadFiles()
	{
		yield return (object)new WaitForSeconds(0.1f);
		EDJM_Base.instance.FilesLoading = true;
		Log.Write.LogInfo((object)"Loading files...");
		Images.GetImages();
		AudioFiles.GetAudioFiles();
		EDJM_Base.instance.FilesLoading = false;
		Log.Write.LogInfo((object)"Files finished loading successfully.");
	}

	[HarmonyPatch(typeof(MenuManager), "SetLoadingScreen")]
	[HarmonyPrefix]
	private static void LoadImagesAndAudio(bool isLoading, MenuManager __instance)
	{
		if (isLoading)
		{
			__instance.menuButtons.SetActive(false);
			__instance.loadingScreen.SetActive(true);
			__instance.serverListUIContainer.SetActive(false);
			__instance.MenuAudio.volume = 0.2f;
			((MonoBehaviour)__instance).StartCoroutine(LoadFiles());
			isLoading = false;
		}
	}

	[HarmonyPatch(typeof(StartOfRound), "Awake")]
	[HarmonyPrefix]
	private static void CreateImageOverlayAndLoadConfigs(StartOfRound __instance)
	{
		//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d7: Expected O, but got Unknown
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		EDJM_Update.NetworkObjectFound = false;
		if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
		{
			GameObject val = Object.Instantiate<GameObject>(EDJM_GameNetworkManager.networkPrefab, Vector3.zero, Quaternion.identity);
			val.GetComponent<NetworkObject>().Spawn(false);
		}
		EDJM_Base.CollidableEnemies.Clear();
		EDJM_Base.TriggerEnemies.Clear();
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideBlob.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideBushWolf.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideButler.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideButlerBees.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideManeater.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideClaySurgeon.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideTulipSnake.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideCoilhead.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideHoarderBug.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideGhostGirl.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideBracken.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideNutcracker.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideJester.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideEyelessDog.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideRoamingLocust.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideForestGiant.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideBaboonHawk.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideThumper.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideManticoil.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideCentipedeSam.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideSandworm.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideSporeLizard.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideCircuitBees.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideBunkerSpider.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideMasked.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideLassoMan.Value);
		EDJM_Base.CollidableEnemies.Add(ConfigEntries.OnCollideRadMech.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnBlob.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnBushWolf.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnButler.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnButlerBees.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnManeater.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnClaySurgeon.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnTulipSnake.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnCoilhead.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnHoarderBug.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnGhostGirl.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnBracken.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnNutcracker.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnJester.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnEyelessDog.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnRoamingLocust.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnForestGiant.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnBaboonHawk.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnThumper.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnManticoil.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnCentipedeSam.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnSandworm.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnSporeLizard.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnCircuitBees.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnBunkerSpider.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnMasked.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnLassoMan.Value);
		EDJM_Base.TriggerEnemies.Add(ConfigEntries.CallEventsOnRadMech.Value);
		GameObject val2 = new GameObject("Overlay");
		val2.AddComponent<Overlay>();
		Overlay.Create("Systems/UI/Canvas");
	}
}
internal class EDJM_GameNetworkManager : MonoBehaviour
{
	public static GameObject networkPrefab;

	[HarmonyPatch(typeof(GameNetworkManager), "Start")]
	[HarmonyPostfix]
	public static void StartPatch()
	{
		if (!((Object)(object)networkPrefab != (Object)null))
		{
			networkPrefab = EDJM_Base.NetworkObject;
			networkPrefab.AddComponent<EDJMNetworkObject>();
			Log.Write.LogInfo((object)"NetworkObject prefab registered.");
			NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
		}
	}
}
internal class EDJM_Player : MonoBehaviour
{
	[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
	[HarmonyPostfix]
	public static void PlayerDeathPatch(PlayerControllerB __instance, Vector3 bodyVelocity, bool spawnBody, CauseOfDeath causeOfDeath, int deathAnimation, Vector3 positionOffset)
	{
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Invalid comparison between Unknown and I4
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Invalid comparison between Unknown and I4
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Invalid comparison between Unknown and I4
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Invalid comparison between Unknown and I4
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Invalid comparison between Unknown and I4
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Invalid comparison between Unknown and I4
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Invalid comparison between Unknown and I4
		if (!((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController))
		{
			return;
		}
		Log.Write.LogInfo((object)("Player " + __instance.playerUsername + " was killed by " + EDJM_Base.LastEnemyToDamageThisClient.ToString() + ". Enemy set recently? " + EDJM_Base.EnemySetRecently));
		if (ConfigEntries.CallEventsOnDefault.Value)
		{
			DisplayImage();
		}
		else if (EDJM_Base.EnemySetRecently)
		{
			if (EDJM_Base.TriggerEnemies[(int)EDJM_Base.LastEnemyToDamageThisClient])
			{
				DisplayImage();
			}
		}
		else if (EDJM_AIPatch.NutcrackerJustShot && (int)causeOfDeath == 7 && EDJM_Base.TriggerEnemies[11])
		{
			DisplayImage();
		}
		else if (EDJM_AIPatch.LandmineJustWentOff && (int)causeOfDeath == 3 && ConfigEntries.CallEventsOnLandmine.Value)
		{
			DisplayImage();
		}
		else if (EDJM_AIPatch.TurretJustShotClient && (int)causeOfDeath == 7 && ConfigEntries.CallEventsOnTurret.Value)
		{
			DisplayImage();
		}
		else if (EDJM_AIPatch.SpikeTrapKilledPlayer && (int)causeOfDeath == 8 && ConfigEntries.CallEventsOnSpikeTrap.Value)
		{
			DisplayImage();
			EDJM_AIPatch.SpikeTrapKilledPlayer = false;
		}
		else if ((int)causeOfDeath == 7 && ConfigEntries.CallEventsOnShot.Value)
		{
			DisplayImage();
		}
		else if ((int)causeOfDeath == 2 && ConfigEntries.CallEventsOnFall.Value)
		{
			DisplayImage();
		}
		else if ((int)causeOfDeath == 9 && ConfigEntries.CallEventsOnDrown.Value)
		{
			DisplayImage();
		}
	}

	private static void DisplayImage()
	{
		Overlay.Display(Random.Range(0, Images.GetSize()), Random.Range(0, AudioFiles.GetSize()), 0.5f, ConfigEntries.DoDelayOnDeath.Value);
	}
}
internal class EDJM_Update : MonoBehaviour
{
	public static bool NetworkObjectFound = false;

	private static bool begunSearch = false;

	private static bool flag = true;

	private static float beginSearch;

	[HarmonyPatch(typeof(StartOfRound), "Update")]
	[HarmonyPrefix]
	private static void UpdatePatch(StartOfRound __instance)
	{
		if (!NetworkObjectFound && (Time.realtimeSinceStartup <= beginSearch + 30f || !begunSearch))
		{
			if (!begunSearch)
			{
				beginSearch = Time.realtimeSinceStartup;
				begunSearch = true;
			}
			try
			{
				Log.Write.LogWarning((object)"Trying to get NetworkObject");
				EDJM_Base.networkObject = GameObject.Find("/EDJMNetworkObject(Clone)").GetComponent<EDJMNetworkObject>();
				NetworkObjectFound = true;
				Log.Write.LogInfo((object)"Successfully found NetworkObject");
				return;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		if (Time.realtimeSinceStartup > beginSearch + 30f && flag && !NetworkObjectFound)
		{
			flag = false;
			Log.Write.LogWarning((object)$"Could not find NetworkObject, assuming it does not exist. ({Time.realtimeSinceStartup}, {beginSearch + 30f})");
		}
	}
}
internal class AudioFiles
{
	private static readonly object singletonLock = new object();

	private static AudioFiles instance = null;

	private static List<AudioClip> audioClips = new List<AudioClip>();

	private static string audioFolderLocation = Path.Combine(ModInfo.AssemblyLocation, "audios");

	public static bool FilesLoaded = false;

	public static AudioFiles Instance
	{
		get
		{
			lock (singletonLock)
			{
				if (instance == null)
				{
					instance = new AudioFiles();
				}
				return instance;
			}
		}
	}

	private AudioFiles()
	{
	}

	public static int GetSize()
	{
		return audioClips.Count;
	}

	public static AudioClip Get(int index)
	{
		return audioClips[index];
	}

	public static AudioClip RandAudio()
	{
		int count = audioClips.Count;
		int index = Random.Range(0, count);
		return audioClips[index];
	}

	public static void GetAudioFiles()
	{
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		FilesLoaded = false;
		Log.Write.LogInfo((object)("Attempting to retrieve audio files from " + audioFolderLocation + "."));
		if (!Directory.Exists(audioFolderLocation))
		{
			Log.Write.LogError((object)"Location is inaccessible or doesn't exist! Trying to create a valid directory...");
			File.Create(audioFolderLocation);
			return;
		}
		audioClips.Clear();
		AudioType val = (AudioType)20;
		string[] files = Directory.GetFiles(audioFolderLocation);
		bool flag = true;
		string[] array = files;
		foreach (string text in array)
		{
			switch (Path.GetExtension(text))
			{
			case ".wav":
				val = (AudioType)20;
				break;
			case ".mp3":
				val = (AudioType)13;
				break;
			case ".ogg":
				val = (AudioType)14;
				break;
			default:
				flag = false;
				break;
			}
			if (!flag)
			{
				continue;
			}
			UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("file://" + text, val);
			try
			{
				UnityWebRequestAsyncOperation val2 = audioClip.SendWebRequest();
				while (!((AsyncOperation)val2).isDone)
				{
					Thread.Sleep(100);
				}
				AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
				audioClips.Add(content);
				Log.Write.LogInfo((object)("Loaded " + Path.GetFileName(text)));
			}
			finally
			{
				((IDisposable)audioClip)?.Dispose();
			}
		}
		Log.Write.LogInfo((object)"Audio files finished loading.");
		FilesLoaded = true;
	}
}
public class EDJMNetworkObject : NetworkBehaviour
{
	public static GameObject thisGameObject;

	public static EDJMNetworkObject instance { get; private set; }

	public override void OnNetworkSpawn()
	{
		if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
		{
			try
			{
				EDJMNetworkObject eDJMNetworkObject = instance;
				if (eDJMNetworkObject != null)
				{
					((Component)eDJMNetworkObject).gameObject.GetComponent<NetworkObject>().Despawn(true);
				}
			}
			catch
			{
			}
		}
		instance = this;
		((NetworkBehaviour)this).OnNetworkSpawn();
	}

	public void DisplayImage(int spriteIndex, int clipIndex, float pause = 0f, bool force = false)
	{
		DisplayImageServerRpc(spriteIndex, clipIndex, pause, force);
	}

	[ServerRpc(RequireOwnership = false)]
	private void DisplayImageServerRpc(int spriteIndex, int clipIndex, float pause = 0f, bool force = false)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: 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_0097: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2565464757u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, spriteIndex);
				BytePacker.WriteValueBitPacked(val2, clipIndex);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref pause, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref force, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2565464757u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				DisplayImageClientRpc(spriteIndex, clipIndex, pause, force);
			}
		}
	}

	[ClientRpc]
	private void DisplayImageClientRpc(int spriteIndex, int clipIndex, float pause = 0f, bool force = false)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: 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_0097: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3662376652u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, spriteIndex);
				BytePacker.WriteValueBitPacked(val2, clipIndex);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref pause, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref force, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3662376652u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Overlay.DisplayClient(spriteIndex, clipIndex, pause, force);
			}
		}
	}

	protected override void __initializeVariables()
	{
		((NetworkBehaviour)this).__initializeVariables();
	}

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_EDJMNetworkObject()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(2565464757u, new RpcReceiveHandler(__rpc_handler_2565464757));
		NetworkManager.__rpc_func_table.Add(3662376652u, new RpcReceiveHandler(__rpc_handler_3662376652));
	}

	private static void __rpc_handler_2565464757(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int spriteIndex = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref spriteIndex);
			int clipIndex = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex);
			float pause = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pause, default(ForPrimitives));
			bool force = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref force, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((EDJMNetworkObject)(object)target).DisplayImageServerRpc(spriteIndex, clipIndex, pause, force);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3662376652(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int spriteIndex = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref spriteIndex);
			int clipIndex = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex);
			float pause = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pause, default(ForPrimitives));
			bool force = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref force, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((EDJMNetworkObject)(object)target).DisplayImageClientRpc(spriteIndex, clipIndex, pause, force);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "EDJMNetworkObject";
	}
}
internal class Images
{
	private static readonly object singletonLock = new object();

	private static Images instance;

	private static string imageFolderLocation = Path.Combine(ModInfo.AssemblyLocation, "images");

	public static bool FilesLoaded = false;

	private static List<Texture2D> List = new List<Texture2D>();

	public static Images Instance
	{
		get
		{
			lock (singletonLock)
			{
				if (instance == null)
				{
					instance = new Images();
				}
				return instance;
			}
		}
	}

	private Images()
	{
	}

	public static int GetSize()
	{
		return List.Count;
	}

	public static Sprite Get(int index)
	{
		//IL_0069: 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)
		if (index > List.Count)
		{
			Log.Write.LogWarning((object)"Index exceeds list size, Defaulting to end of list.");
			index = List.Count - 1;
		}
		return Sprite.Create(List[index], new Rect(0f, 0f, (float)((Texture)List[index]).width, (float)((Texture)List[index]).height), new Vector2(0.5f, 0.5f));
	}

	public static Sprite RandImage()
	{
		//IL_004b: 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)
		int count = List.Count;
		int index = Random.Range(0, count);
		return Sprite.Create(List[index], new Rect(0f, 0f, (float)((Texture)List[index]).width, (float)((Texture)List[index]).height), new Vector2(0.5f, 0.5f));
	}

	public static void GetImages()
	{
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Expected O, but got Unknown
		FilesLoaded = false;
		Log.Write.LogInfo((object)("Attempting to retrieve images from " + imageFolderLocation + "."));
		if (!Directory.Exists(imageFolderLocation))
		{
			Log.Write.LogError((object)"Location is inaccessible or doesn't exist! Trying to create a valid directory...");
			File.Create(imageFolderLocation);
			return;
		}
		List.Clear();
		string[] files = Directory.GetFiles(imageFolderLocation);
		string[] array = files;
		foreach (string path in array)
		{
			byte[] array2 = File.ReadAllBytes(path);
			Texture2D val = new Texture2D(0, 0);
			ImageConversion.LoadImage(val, array2);
			List.Add(val);
			Log.Write.LogInfo((object)("Loaded " + Path.GetFileName(path)));
		}
		Log.Write.LogInfo((object)"Images finished loading.");
		FilesLoaded = true;
	}
}
public sealed class Log
{
	private static Log instance;

	private static readonly object singletonLock = new object();

	private static ManualLogSource source = new ManualLogSource("EDJM2");

	public static Log Instance
	{
		get
		{
			lock (singletonLock)
			{
				if (instance == null)
				{
					instance = new Log();
				}
				return instance;
			}
		}
	}

	public static ManualLogSource Write => source;

	private Log()
	{
	}

	public static void Init(string initMessage)
	{
		Logger.Sources.Add((ILogSource)(object)source);
		source.LogMessage((object)initMessage);
		source.LogMessage((object)"Logger component initialised.");
	}

	public static void Delete()
	{
		source.LogMessage((object)"Bye :(");
		Logger.Sources.Remove((ILogSource)(object)source);
	}
}
internal class Overlay : MonoBehaviour
{
	public static Overlay instance;

	private GameObject obj;

	private static Image image;

	private static AudioSource audioSource;

	private static bool waiting;

	private static float time;

	private static float timeDuration;

	private IEnumerator StartTimer(float duration)
	{
		waiting = true;
		time = 0f;
		timeDuration = duration;
		while (time < duration)
		{
			time += Time.deltaTime;
			yield return null;
		}
		waiting = false;
	}

	public static void Display(int spriteIndex, int clipIndex, float pause = 0f, bool force = false)
	{
		if (ConfigEntries.Global.Value)
		{
			EDJM_Base.networkObject.DisplayImage(spriteIndex, clipIndex, pause, force);
		}
		else
		{
			DisplayClient(spriteIndex, clipIndex, pause, force);
		}
	}

	public static void DisplayClient(int spriteIndex, int clipIndex, float pause = 0f, bool force = false)
	{
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		Sprite sprite = Images.Get(spriteIndex);
		AudioClip val = AudioFiles.Get(clipIndex);
		if (!waiting || force)
		{
			float num = 1f;
			if (ConfigEntries.DoRandom.Value)
			{
				num = Random.Range(ConfigEntries.MinRandomFadeout.Value * 10f, ConfigEntries.MaxRandomFadeout.Value * 10f) / 10f;
			}
			((MonoBehaviour)instance).StopAllCoroutines();
			((Graphic)image).color = Color.op_Implicit(new Vector4(1f, 1f, 1f, 1.5f));
			image.sprite = sprite;
			audioSource.pitch = 0.9f + (num + pause) / 10f;
			audioSource.PlayOneShot(val);
			Log.Write.LogInfo((object)("Displaying with a fade out time of " + num + " and a pause of " + pause + ", total duration of " + (num + pause) + ", pitch: " + audioSource.pitch));
			((MonoBehaviour)instance).StartCoroutine(instance.FadeOutOver(pause, num));
			((MonoBehaviour)instance).StartCoroutine(instance.StartTimer(ConfigEntries.Delay.Value + pause + num));
		}
		else
		{
			Log.Write.LogWarning((object)("Tried to display image, but cooldown isn't over! (" + (timeDuration - time) + " second(s) left)"));
		}
	}

	private IEnumerator FadeOutOver(float pause, float duration)
	{
		Color final = Color.op_Implicit(new Vector4(1f, 1f, 1f, 0f));
		for (float time2 = 0f; time2 < pause; time2 += Time.deltaTime)
		{
			yield return null;
			((Graphic)image).rectTransform.sizeDelta = ((Component)((Component)image).gameObject.transform.parent).GetComponent<RectTransform>().sizeDelta;
		}
		for (float time2 = 0f; time2 < duration; time2 += Time.deltaTime)
		{
			float normalisedTime = time2 / duration;
			((Graphic)image).color = Color.Lerp(Color.op_Implicit(Vector4.one), final, normalisedTime);
			((Graphic)image).rectTransform.sizeDelta = ((Component)((Component)image).gameObject.transform.parent).GetComponent<RectTransform>().sizeDelta;
			yield return null;
		}
		((Graphic)image).rectTransform.sizeDelta = Vector2.zero;
		((Graphic)image).color = final;
	}

	private void Awake()
	{
		instance = this;
		obj = ((Component)this).gameObject;
	}

	public static void Create(string path)
	{
		//IL_0069: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)instance.obj == (Object)null))
		{
			instance.obj.transform.parent = GameObject.Find(path).transform;
			instance.obj.AddComponent<Image>();
			instance.obj.AddComponent<AudioSource>();
			instance.obj.transform.localPosition = Vector3.zero;
			instance.obj.transform.localScale = Vector3.one;
			image = instance.obj.GetComponent<Image>();
			audioSource = instance.obj.GetComponent<AudioSource>();
			((Graphic)image).color = new Color(1f, 1f, 1f, 0f);
		}
	}
}
internal class ThisEnemyType : MonoBehaviour
{
	public EDJM_Enemies enemy;

	private void Awake()
	{
		string enemyName = ((Component)this).gameObject.GetComponent<EnemyAI>().enemyType.enemyName;
		switch (enemyName)
		{
		case "Blob":
			enemy = EDJM_Enemies.Hydrogere;
			break;
		case "Baboon hawk":
			enemy = EDJM_Enemies.BaboonHawk;
			break;
		case "Bush Wolf":
			enemy = EDJM_Enemies.BushWolf;
			break;
		case "Butler":
			enemy = EDJM_Enemies.Butler;
			break;
		case "ButlerBees":
			enemy = EDJM_Enemies.ButlerBees;
			break;
		case "Maneater":
			enemy = EDJM_Enemies.Maneater;
			break;
		case "Centipede":
			enemy = EDJM_Enemies.CentipedeSam;
			break;
		case "Clay Surgeon":
			enemy = EDJM_Enemies.ClaySurgeon;
			break;
		case "Crawler":
			enemy = EDJM_Enemies.Thumper;
			break;
		case "Docile Locust Bees":
			enemy = EDJM_Enemies.RoamingLocust;
			break;
		case "Manticoil":
			enemy = EDJM_Enemies.Manticoil;
			break;
		case "Girl":
			enemy = EDJM_Enemies.GhostGirl;
			break;
		case "Flowerman":
			enemy = EDJM_Enemies.Bracken;
			break;
		case "Tulip Snake":
			enemy = EDJM_Enemies.TulipSnake;
			break;
		case "ForestGiant":
			enemy = EDJM_Enemies.ForestGiant;
			break;
		case "Hoarding Bug":
			enemy = EDJM_Enemies.HoarderBug;
			break;
		case "Jester":
			enemy = EDJM_Enemies.Jester;
			break;
		case "Lasso":
			enemy = EDJM_Enemies.LassoMan;
			break;
		case "Masked":
			enemy = EDJM_Enemies.Masked;
			break;
		case "MouthDog":
			enemy = EDJM_Enemies.EyelessHound;
			break;
		case "Nutcracker":
			enemy = EDJM_Enemies.Nutcracker;
			break;
		case "Puffer":
			enemy = EDJM_Enemies.SporeLizard;
			break;
		case "RadMech":
			enemy = EDJM_Enemies.RadMech;
			break;
		case "Red Locust Bees":
			enemy = EDJM_Enemies.CircuitBees;
			break;
		case "Bunker Spider":
			enemy = EDJM_Enemies.BunkerSpider;
			break;
		case "Earth Leviathan":
			enemy = EDJM_Enemies.Sandworm;
			break;
		case "Spring":
			enemy = EDJM_Enemies.Coilhead;
			break;
		}
		Log.Write.LogInfo((object)("Enemy name is '" + enemyName + "', Type is " + enemy));
	}
}
namespace Eyeless Dog Jumpscare Mod v2.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}