Decompiled source of NellyEarnshaw v0.1.3

Sutra.NellyEarnshaw.dll

Decompiled 2 weeks ago
#define DEBUG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using LobbyCompatibility.Attributes;
using Microsoft.CodeAnalysis;
using NellyEarnshaw.Behaviours;
using Sutra.NellyEarnshaw.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Sutra.NellyEarnshaw")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("NellyEarnshaw")]
[assembly: AssemblyTitle("Sutra.NellyEarnshaw")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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 NellyEarnshaw
{
	public class ButlersMarkEffect : MonoBehaviour
	{
		public int effectStack = 0;

		public bool bindingTechnique = false;

		private float timeRemaining;

		private float STACK_EXPIRE_TIME = 15f;

		private void Start()
		{
			addStack();
			timeRemaining = STACK_EXPIRE_TIME;
		}

		private void Update()
		{
			if (GameNetworkManager.Instance.localPlayerController.isPlayerDead)
			{
				DeleteThis();
			}
			if (bindingTechnique)
			{
				return;
			}
			timeRemaining -= Time.deltaTime;
			if (!(timeRemaining > 0f) && effectStack < 3)
			{
				removeStack();
				timeRemaining = STACK_EXPIRE_TIME;
				if (effectStack <= 0)
				{
					DeleteThis();
				}
			}
		}

		public void addMoreButlersMark(int amount)
		{
			if (effectStack < 3 && !bindingTechnique)
			{
				if (effectStack == 2)
				{
					addStack();
					((MonoBehaviour)this).StartCoroutine(DelayBindingTechniqueActivation());
				}
				else
				{
					addStack();
				}
			}
		}

		public int getButlerMarkAmount()
		{
			return effectStack;
		}

		public bool isPlayerBound()
		{
			return bindingTechnique;
		}

		private IEnumerator DelayBindingTechniqueActivation()
		{
			yield return (object)new WaitForSeconds(20f);
			bindingTechnique = true;
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			localPlayerController.movementSpeed -= 2f;
			for (int i = 0; i < effectStack; i++)
			{
				PlayerControllerB localPlayerController2 = GameNetworkManager.Instance.localPlayerController;
				localPlayerController2.sprintTime += 1f;
				HUDManagerSetup.AddEffect(enable: false, "ButlersMarkStatusEffect");
			}
			effectStack = 0;
			HUDManagerSetup.AddEffect(enable: true, "BindingTechniqueStatusEffect");
			((MonoBehaviour)this).StartCoroutine(PostBindingTechniqueActivation());
			((MonoBehaviour)this).StopCoroutine(DelayBindingTechniqueActivation());
		}

		private IEnumerator PostBindingTechniqueActivation()
		{
			yield return (object)new WaitForSeconds(10f);
			bindingTechnique = false;
			HUDManagerSetup.AddEffect(enable: false, "BindingTechniqueStatusEffect");
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			localPlayerController.movementSpeed += 2f;
			DeleteThis();
			((MonoBehaviour)this).StopCoroutine(PostBindingTechniqueActivation());
		}

		public void DeleteThis()
		{
			if (effectStack > 0)
			{
				for (int i = 0; i < effectStack; i++)
				{
					PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
					localPlayerController.sprintTime += 1f;
					HUDManagerSetup.AddEffect(enable: false, "ButlersMarkStatusEffect");
				}
			}
			if (bindingTechnique)
			{
				PlayerControllerB localPlayerController2 = GameNetworkManager.Instance.localPlayerController;
				localPlayerController2.movementSpeed += 2f;
				HUDManagerSetup.AddEffect(enable: false, "BindingTechniqueStatusEffect");
			}
			Object.Destroy((Object)(object)this);
		}

		public void addStack()
		{
			effectStack++;
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			localPlayerController.sprintTime -= 1f;
			HUDManagerSetup.AddEffect(enable: true, "ButlersMarkStatusEffect");
		}

		public void removeStack()
		{
			effectStack--;
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			localPlayerController.sprintTime += 1f;
			HUDManagerSetup.AddEffect(enable: false, "ButlersMarkStatusEffect");
		}
	}
	public class EnemyData
	{
		public string NellyDesc = "NELLY EARNSHAW \r\n                \r\n    Scientific Name: Homo Sapiens(?)\r\n    Atlas Danger Level: 2\r\n    Moons of Origin/Inhabitance: Mirror World HxC-6\r\n\r\n    Due to the nature of Mirror Worlds, there is not much known about Wuthering Heights and its inhabitants.\r\n\r\n    Nelly Earnshaw is a self-proclaimed 'Head Butler' of Wuthering Heights. Standing at around 5.6 feet tall, she resembles a normal female human, hence the reference by usual pronoun. She dons a full maid dress reminiscient of ancient Victorian style. Some report having seen hidden pockets near her hip where knives could be seen, although the purpose is unknown. The defining feature of this entity is her ability to converse in English, although only in brief sentences. She seems to respond and comprehend spoken language and speaks in modern vernacular, despite her outfit and the moon's overall look. Her demeanor seems to be polite and servicing, consistent with her own self-description as a butler. Occasionally, she has been documented rearranging scrap, dusting the mansion's hallways, and discarding letters in the common area.\r\n    \r\n    For exploration purposes, it is advised to remain courteous yet wary. Despite a disarming exterior, odd mumblings have been attributed to a feminine voice similar to hers. Reports include overhearing names such as \"Heathcliff\", \"Miss Catherine\", or utterances relating to \"being crushed under that wheel\". It should also be noted that many different groups have all reported amiable or neutral behavior towards other entities, particularly \"Cathy\" of the same moon. It can be assumed that Nelly does not have all your best interests in mind. \r\n\r\n\r\n    SHIPLOG Linton-32 \"sDFrw\" -- Jul 30 2385:\r\n\r\n    ATLAS DANGER LEVEL  5\r\n    DONT TRUST HEr DONT DO IT SHE JUST KILLED LIEK TWO OF US\r\n\r\n\r\n    SHIPLOG Linton-32 \"nelly\"-- Jul 30 2385:\r\n\r\n    We were going in for another stupid reconaissance mission because we just so happened to slip into a mirror world and HQ or whoever the fuck decided we had enough meatshields to throw at the damn mansion again. something about finding out what happends when you pull that golden branch. things were going fine until two REALLY big lightning strike hit, and then Nelly just started chasing after us with a knife\r\n    She reached dess and just...stabbed her repeatedly. since luka was too fucking in shock to move i had to get dess away with a stun cage. she said she was feeling slow? like she was injured but also felt an \"oppresive\" presence around her or smth thats how she described it. to me it just looked like she started running out of breath a lot quicker\r\n    after a little bit she started limping really bad and said she felt like she was losing mobility so i tried to check it when Nelly runs towards us at fucking mach jesus and strikes her and then leaves and i just stand there like a FUCKING IDIOT\r\n\r\n    Sorry. Anyways Dess didn't get up after that. not like i could check anyways since that creepy ghost lady was in the room next over\r\n    i dunno what caused it but we should really updaate our database. Nelly is dangerous, avoid her ESPECIALLY after a big ass lightning strike, weird how we didn't see that happen before\r\n\r\n    Im sorry, Dess. I should've just at least tried getting your body back.\r\n\r\n    oh and I guess I need to log the death toll\r\n    (Dess, Nelly; Jaime, nelly; Luzi, Swordsman; Anasia, Swordsman; Minstay, ghost lady)\r\n    lost a lot of good people today. they better not send us on another recon mission with only 12\r\n\r\n\r\n    oh shit did i put this on the wrong database what the fuck why dont they allow us to change that fuck\r\n\r\n        \r\n    SHIPLOG Linton-32 \"Weekly Database Cleanup\" -- Jul 31 2385:\r\n\r\n    Fixed the typos Jaime made in the new Springhead entity log regarding its \"sprtingy neck\". \r\n    \r\n    + Re-alphabetized the past month's Ship Logs. \r\n    + Looks like some of our entries are being cloned to those Fortune ships. Tell Sam to go fix it and reread the manual; he forgot to sign the logs.\r\n    + Aside from that, our new access key is coming in six homebase cycles. Be glad you all get to rest for a while.\r\n    \r\n    - Kirshaw";

		public string CathyDesc = "13913MZ\r\n\r\n    Sigurd's Note: Desmond says this can't be erased from the databse for some reason, says the ship probably picked up radio signals(how is there text???) from the weird moon we just passed through or something \r\n    \r\n    Hey you hear\r\n\r\n    Hey, are\r\n\r\n    Hey, are you hearing this? what just turn on the auto captioning man its fine \r\n    Good\r\n    so I think I just found that ghost lady you guys were talking about. Yeah tall pale, floating. What do I do now   oh shit \r\n    nevermind it was just a scavenger bug i killed it with a shovel. What's your scanner saying is she registering? What I thought we already added her to our database oh ok doing that\r\n    Right now she's sorta just woah jesus\r\n    \r\n    SCHMERZENSSCHREI AUSSTO\r\n\r\n       lightning just hit, like really big lightning. I'm gonna have to  defend few shells on the butler lady\r\n    [gunshot] [gunshot]\r\n    Okay she's she's gone what can you guys hear that! The sobbing yeah. then it's not that girl. Actually I can hear it from the room over\r\n    Is that the damn lootbug? She's crying over it the lootbug the body \r\n\r\n    DIE MITTE DE RAUMES\r\n\r\n    [noise] \r\n    What the fuck! she's teleporting\r\n    [noise]\r\n    hands\r\n    [screaming]\r\n    the hands\r\n    [screaming]\r\n\r\n    -LASS ES DICH NICHT SEHEN";

		public string HeathcliffDesc = "13913MZ\r\n\r\n    Sigurd's Note: Desmond says this can't be erased from the databse for some reason, says the ship probably picked up radio signals(how is there text???) from the weird moon we just passed through or something \r\n    \r\n    Hey you hear\r\n\r\n    Hey, are\r\n\r\n    Hey, are you hearing this? what just turn on the auto captioning man its fine \r\n    Good\r\n    so I think I just found that ghost lady you guys were talking about. Yeah tall pale, floating. What do I do now   oh shit \r\n    nevermind it was just a scavenger bug i killed it with a shovel. What's your scanner saying is she registering? What I thought we already added her to our database oh ok doing that\r\n    Right now she's sorta just woah jesus\r\n    \r\n    SCHMERZENSSCHREI AUSSTO\r\n\r\n       lightning just hit, like really big lightning. I'm gonna have to  defend few shells on the butler lady\r\n    [gunshot] [gunshot]\r\n    Okay she's she's gone what can you guys hear that! The sobbing yeah. then it's not that girl. Actually I can hear it from the room over\r\n    Is that the damn lootbug? She's crying over it the lootbug the body \r\n\r\n    DIE MITTE DE RAUMES\r\n\r\n    [noise] \r\n    What the fuck! she's teleporting\r\n    [noise]\r\n    hands\r\n    [screaming]\r\n    the hands\r\n    [screaming]\r\n\r\n    -LASS ES DICH NICHT SEHEN";
	}
	public static class HUDManagerSetup
	{
		[HarmonyPatch(typeof(HUDManager))]
		internal class HUDManagerPatch
		{
			[HarmonyPatch("Awake")]
			[HarmonyPostfix]
			public static void AwakePostfix(HUDManager __instance)
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Expected O, but got Unknown
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Expected O, but got Unknown
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				_instance = __instance;
				effectHolder = new GameObject("StatusEffects", new Type[3]
				{
					typeof(CanvasGroup),
					typeof(RectTransform),
					typeof(Image)
				});
				HUDElement val = new HUDElement
				{
					canvasGroup = effectHolder.GetComponent<CanvasGroup>(),
					targetAlpha = 1f
				};
				_instance.HUDElements = CollectionExtensions.AddToArray<HUDElement>(_instance.HUDElements, val);
				RectTransform component = effectHolder.GetComponent<RectTransform>();
				component.pivot = new Vector2(0.5f, 0.5f);
				component.sizeDelta = new Vector2(70f, 70f);
				component.anchoredPosition3D = new Vector3(0f, 200f, -0.075f);
				Image component2 = effectHolder.GetComponent<Image>();
				component2.sprite = CreateSpriteFromTexture(Texture2D.whiteTexture);
				((Graphic)component2).color = Color.black;
				((Component)component2).transform.SetParent(((Component)_instance.HUDElements[2].canvasGroup).transform.parent, false);
			}
		}

		private static HUDManager _instance = null;

		public static int statusEffectCountOnLocalPlayer = 0;

		public static List<GameObject> statusEffectList = new List<GameObject>();

		private static int STATUS_SPACING = 100;

		public static GameObject effectHolder;

		public static Sprite CreateSpriteFromTexture(Texture2D texture2D)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			Sprite val = Sprite.Create(texture2D, new Rect(0f, 0f, (float)((Texture)texture2D).width, (float)((Texture)texture2D).height), new Vector2(0.5f, 0.5f));
			((Object)val).name = ((Object)texture2D).name;
			return val;
		}

		public static void AddEffect(bool enable, string effectName)
		{
			if (enable)
			{
				statusEffectCountOnLocalPlayer++;
				CreateOrAddToStatusEffectMarker(effectName);
			}
			else
			{
				statusEffectCountOnLocalPlayer--;
				DeleteStatusEffectMarker(effectName);
			}
		}

		private static void CreateOrAddToStatusEffectMarker(string effectName)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			NellyEarnshaw.Logger.LogInfo((object)("Hey so the statusindex for this local client is " + statusEffectCountOnLocalPlayer));
			GameObject val = new GameObject(effectName, new Type[1] { typeof(Image) });
			RectTransform component = val.GetComponent<RectTransform>();
			component.pivot = new Vector2(0f, 1f);
			component.sizeDelta = new Vector2(70f, 70f);
			component.anchoredPosition3D = new Vector3((float)(-400 + statusEffectCountOnLocalPlayer * STATUS_SPACING), 200f, -0.075f);
			Image component2 = val.GetComponent<Image>();
			component2.sprite = CreateSpriteFromTexture(Texture2D.whiteTexture);
			((Graphic)component2).color = Color.black;
			((Component)component2).transform.SetParent(((Component)_instance.HUDElements[2].canvasGroup).transform.parent, false);
			val.SetActive(true);
			statusEffectList.Add(val);
		}

		private static void DeleteStatusEffectMarker(string effectName)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < statusEffectList.Count; i++)
			{
				NellyEarnshaw.Logger.LogInfo((object)("Checking Status Effect " + ((Object)statusEffectList[i]).name));
				if (!(((Object)statusEffectList[i]).name != effectName))
				{
					GameObject val = statusEffectList[i];
					statusEffectList.Remove(val);
					Object.Destroy((Object)(object)val);
				}
			}
			for (int j = 0; j < statusEffectList.Count; j++)
			{
				RectTransform component = statusEffectList[j].GetComponent<RectTransform>();
				component.anchoredPosition3D += new Vector3((float)STATUS_SPACING, 0f, 0f);
			}
		}
	}
	[BepInPlugin("Sutra.NellyEarnshaw", "NellyEarnshaw", "0.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[LobbyCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class NellyEarnshaw : BaseUnityPlugin
	{
		public static AssetBundle? HeathcliffAssets;

		public static AssetBundle? NellyAssets;

		public static NellyEarnshaw Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Patch();
			InitializeNetworkBehaviours();
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			HeathcliffAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "heathcliffplush"));
			NellyAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "nellyearnshaw"));
			if ((Object)(object)HeathcliffAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load HeathcliffPlushie custom assets for mod: NellyEarnshaw.");
				return;
			}
			if ((Object)(object)NellyAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load Nelly custom assets for mod: NellyEarnshaw.");
				return;
			}
			SetupCustomEnemies(NellyAssets);
			SetupCustomScrap(HeathcliffAssets);
			Logger.LogInfo((object)"Sutra.NellyEarnshaw v0.1.0 has loaded!");
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("Sutra.NellyEarnshaw");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}

		internal static void SetupCustomScrap(AssetBundle HeathcliffAsset)
		{
			Item val = HeathcliffAsset.LoadAsset<Item>("Assets/HeathcliffPlush.asset");
			Utilities.FixMixerGroups(val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Items.RegisterScrap(val, 5, (LevelTypes)(-1));
			NoisyPlushieItem noisyPlushieItem = val.spawnPrefab.AddComponent<NoisyPlushieItem>();
			((GrabbableObject)noisyPlushieItem).grabbable = true;
			((GrabbableObject)noisyPlushieItem).grabbableToEnemies = true;
			((GrabbableObject)noisyPlushieItem).itemProperties = val;
			((GrabbableObject)noisyPlushieItem).isInFactory = true;
			noisyPlushieItem.plushAudio = val.spawnPrefab.GetComponent<AudioSource>();
			noisyPlushieItem.audioClips = (AudioClip[])(object)new AudioClip[5]
			{
				HeathcliffAsset.LoadAsset<AudioClip>("Assets/LethalCompany/Game/Audio/AudioClips/LCB_Sinner_Heathcliff_Commence.wav"),
				HeathcliffAsset.LoadAsset<AudioClip>("Assets/LethalCompany/Game/Audio/AudioClips/LCB_Sinner_Heathcliff_View.wav"),
				HeathcliffAsset.LoadAsset<AudioClip>("Assets/LethalCompany/Game/Audio/AudioClips/Shi_Association_South_Section_5_Heathcliff_Ally_Death.wav.ogg"),
				HeathcliffAsset.LoadAsset<AudioClip>("Assets/LethalCompany/Game/Audio/AudioClips/Battle_endcommand_10712_1.ogg"),
				HeathcliffAsset.LoadAsset<AudioClip>("Assets/LethalCompany/Game/Audio/AudioClips/LCB_Sinner_Heathcliff_Idle.wav")
			};
		}

		internal static void SetupCustomEnemies(AssetBundle NellyAsset)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00ca: 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)
			//IL_00db: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			EnemyType val = NellyAsset.LoadAsset<EnemyType>("Assets/NellyEarnshaw.asset");
			TerminalNode val2 = NellyAsset.LoadAsset<TerminalNode>("Assets/NellyTN.asset");
			TerminalKeyword val3 = NellyAsset.LoadAsset<TerminalKeyword>("Assets/NellyTK.asset");
			val.enemyPrefab = NellyAsset.LoadAsset<GameObject>("Assets/NellyEnemy.prefab");
			val.canDie = false;
			val.stunTimeMultiplier = 0.3f;
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, 0, (LevelTypes)(-1), val2, val3);
			GameObject enemyPrefab = val.enemyPrefab;
			NellyEarnshawAI nellyEarnshawAI = enemyPrefab.AddComponent<NellyEarnshawAI>();
			((EnemyAI)nellyEarnshawAI).agent = enemyPrefab.GetComponent<NavMeshAgent>();
			((EnemyAI)nellyEarnshawAI).enemyType = val;
			((EnemyAI)nellyEarnshawAI).eye = enemyPrefab.transform.Find("Eye");
			((EnemyAI)nellyEarnshawAI).enemyBehaviourStates = (EnemyBehaviourState[])(object)new EnemyBehaviourState[6]
			{
				new EnemyBehaviourState
				{
					name = "SearchingForPlayer"
				},
				new EnemyBehaviourState
				{
					name = "PassivelyFollowingPlayer"
				},
				new EnemyBehaviourState
				{
					name = "PissedOff"
				},
				new EnemyBehaviourState
				{
					name = "KnifeSwingInProgress"
				},
				new EnemyBehaviourState
				{
					name = "RetreatToHeal"
				},
				new EnemyBehaviourState
				{
					name = "ChasingBindedPlayer"
				}
			};
			((EnemyAI)nellyEarnshawAI).syncMovementSpeed = 0f;
			((EnemyAI)nellyEarnshawAI).openDoorSpeedMultiplier = 1f;
			((EnemyAI)nellyEarnshawAI).enemyHP = 10;
			((EnemyAI)nellyEarnshawAI).AIIntervalTime = 0.2f;
			nellyEarnshawAI.turnCompass = enemyPrefab.transform.Find("TurnCompass");
			((EnemyAI)nellyEarnshawAI).updatePositionThreshold = 999999f;
			((EnemyAI)nellyEarnshawAI).creatureAnimator = ((Component)((Component)enemyPrefab.transform.Find("MeshContainer")).transform.Find("AnimContainer")).GetComponent<Animator>();
			((Component)enemyPrefab.transform.Find("Collider")).GetComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)nellyEarnshawAI;
			enemyPrefab.GetComponent<NavMeshAgent>().baseOffset = 0f;
			val.EnemySize = (EnemySize)0;
			val2.displayText = new EnemyData().NellyDesc;
			val3.word = "nelly earnshaw";
		}

		private static void InitializeNetworkBehaviours()
		{
			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 static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Sutra.NellyEarnshaw";

		public const string PLUGIN_NAME = "NellyEarnshaw";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace NellyEarnshaw.Behaviours
{
	internal class NellyEarnshawAI : EnemyAI
	{
		private enum State
		{
			SearchingForPlayer,
			PassivelyFollowingPlayer,
			PissedOff,
			KnifeSwingInProgress,
			RetreatingToHeal,
			ChasingBindedPlayer
		}

		public Transform turnCompass = null;

		public Transform attackArea = null;

		public Transform retreatNode = null;

		public float baseEnemySpeed = 4f;

		public float angerMeter;

		private float timeSinceSwingingKnife;

		private float secondsSinceLastRandomChase;

		private Random randomizer;

		private HashSet<PlayerControllerB> toBeSleepyTapped = new HashSet<PlayerControllerB>();

		private const int FOV_WIDTH = 100;

		private const float KNIFE_SWING_RANGE = 2.5f;

		private const float SLEEPY_TAP_DISTANCE = 2.5f;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			NellyEarnshaw.Logger.LogInfo((object)text);
		}

		public override void Start()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			LogIfDebugBuild("Example Enemy Spawned");
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			base.creatureAnimator.SetTrigger("startWalk");
			((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			angerMeter = 0f;
			randomizer = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
		}

		public override void Update()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (!base.isEnemyDead)
			{
				int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
				if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 1 || currentBehaviourStateIndex == 2 || currentBehaviourStateIndex == 5) && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= 10f)
				{
					turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
					((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime);
				}
				if (base.stunNormalizedTimer > 0f)
				{
					base.agent.speed = 0f;
				}
				secondsSinceLastRandomChase += Time.deltaTime;
				timeSinceSwingingKnife += Time.deltaTime;
			}
		}

		public override void DoAIInterval()
		{
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_062f: Unknown result type (might be due to invalid IL or missing references)
			//IL_063f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0674: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			LogIfDebugBuild("Current state is:" + base.currentBehaviourStateIndex + " and anger = " + angerMeter);
			CheckForBoundPlayersRpc();
			if (secondsSinceLastRandomChase >= 90f)
			{
				LogIfDebugBuild("Starting random chase!");
				secondsSinceLastRandomChase = 0f;
				if (base.currentBehaviourStateIndex == 0 || base.currentBehaviourStateIndex == 1)
				{
					if ((Object)(object)base.targetPlayer == (Object)null)
					{
						TargetClosestPlayerInAnyCase();
					}
					angerMeter = 30f;
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					DoAnimationClientRpc("startRun");
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
				}
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = baseEnemySpeed * 1.2f;
				base.currentSearch.searchPrecision = 1f;
				if (FoundClosestPlayerInRange(30f, 10f))
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				break;
			case 1:
				base.agent.speed = baseEnemySpeed;
				base.agent.stoppingDistance = 10f;
				if ((Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 30f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)) || !base.targetPlayer.isInsideFactory)
				{
					base.targetPlayer = null;
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					base.agent.stoppingDistance = 0f;
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				else
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				}
				break;
			case 2:
				base.agent.speed = baseEnemySpeed * 1.4f;
				base.agent.stoppingDistance = 1.5f;
				if (angerMeter <= 0f)
				{
					TargetFurthestNodeFromPlayer();
					DoAnimationClientRpc("startRun");
					((EnemyAI)this).SwitchToBehaviourClientRpc(4);
					break;
				}
				if (angerMeter > 0f && (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 25f)
				{
					angerMeter -= 0.2f;
				}
				if ((Object)(object)base.targetPlayer == (Object)null || base.targetPlayer.isPlayerDead || !base.targetPlayer.isInsideFactory)
				{
					TargetClosestPlayerInAnyCase();
					if (!base.targetPlayer.isInsideFactory)
					{
						((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
						DoAnimationClientRpc("startWalk");
						((EnemyAI)this).SwitchToBehaviourClientRpc(0);
						break;
					}
				}
				if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 3f && (((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null) || Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 2f))
				{
					((MonoBehaviour)this).StartCoroutine(KnifeSwing());
				}
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				break;
			case 3:
				base.agent.speed = 0f;
				break;
			case 4:
				base.agent.speed = baseEnemySpeed * 2f;
				base.agent.stoppingDistance = 0f;
				if (Vector3.Distance(((Component)this).transform.position, ((Component)retreatNode).transform.position) < 3f)
				{
					if (base.enemyHP <= 0)
					{
						HealNellyToFullClientRpc();
					}
					base.targetPlayer = null;
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					DoAnimationClientRpc("startWalk");
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				break;
			case 5:
				base.agent.speed = baseEnemySpeed * 2f;
				base.agent.stoppingDistance = 1.2f;
				foreach (PlayerControllerB item in toBeSleepyTapped)
				{
					if (!item.isInsideFactory && (Object)(object)item == (Object)(object)base.targetPlayer)
					{
						if (toBeSleepyTapped.Count > 1)
						{
							base.targetPlayer = toBeSleepyTapped.ElementAt(randomizer.Next(toBeSleepyTapped.Count - 1));
							toBeSleepyTapped.Remove(base.targetPlayer);
							((EnemyAI)this).SwitchToBehaviourClientRpc(5);
							continue;
						}
						angerMeter = 0f;
						DoAnimationClientRpc("startWalk");
						((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
						((EnemyAI)this).SwitchToBehaviourClientRpc(0);
						toBeSleepyTapped.Remove(base.targetPlayer);
						base.targetPlayer = null;
					}
				}
				if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= 2.5f)
				{
					((MonoBehaviour)this).StartCoroutine(SleepyTapAttack());
				}
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				break;
			default:
				LogIfDebugBuild("This Behavior State doesn't exist!");
				break;
			}
		}

		private bool FoundClosestPlayerInRange(float range, float senseRange)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).TargetClosestPlayer(1.5f, true, 100f);
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				((EnemyAI)this).TargetClosestPlayer(1.5f, false, 100f);
				range = senseRange;
			}
			return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
		}

		private bool TargetClosestPlayerInAnyCase()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			base.mostOptimalDistance = 2000f;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
				if (base.tempDist < base.mostOptimalDistance)
				{
					base.mostOptimalDistance = base.tempDist;
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
				}
			}
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				return false;
			}
			return true;
		}

		private void TargetFurthestNodeFromPlayer()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)base.targetPlayer).transform.position, false, 0, false, 50, false);
			retreatNode = val;
			if ((Object)(object)retreatNode == (Object)null)
			{
				retreatNode = ((Component)this).transform;
			}
			((EnemyAI)this).SetDestinationToPosition(retreatNode.position, false);
		}

		private void ApplyButlerMark(int amount, PlayerControllerB player)
		{
			ButlersMarkEffect butlersMarkEffect = default(ButlersMarkEffect);
			if (((Component)player).gameObject.TryGetComponent<ButlersMarkEffect>(ref butlersMarkEffect))
			{
				butlersMarkEffect.addMoreButlersMark(amount);
			}
			else
			{
				((Component)player).gameObject.AddComponent<ButlersMarkEffect>();
			}
		}

		private IEnumerator KnifeSwing()
		{
			if (!(timeSinceSwingingKnife <= 1f))
			{
				LogIfDebugBuild("Swinging Knife for Nelly!");
				timeSinceSwingingKnife = 0f;
				((EnemyAI)this).SwitchToBehaviourClientRpc(3);
				turnCompass.LookAt(((Component)base.targetPlayer).transform.position);
				((Component)this).transform.rotation = Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f));
				DoAnimationClientRpc("slash");
				yield return (object)new WaitForSeconds(0.3f);
				SwingAttackHitClientRpc();
				DoAnimationClientRpc("startRun");
				yield return (object)new WaitForSeconds(0.3f);
				((EnemyAI)this).SwitchToBehaviourClientRpc(2);
				((MonoBehaviour)this).StopCoroutine(KnifeSwing());
			}
		}

		private IEnumerator SleepyTapAttack()
		{
			((EnemyAI)this).SwitchToBehaviourClientRpc(3);
			DoAnimationClientRpc("sleepyTap");
			yield return (object)new WaitForSeconds(0.2f);
			base.targetPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)1, 0, default(Vector3));
			ButlersMarkEffect effectScript = default(ButlersMarkEffect);
			if (((Component)base.targetPlayer).gameObject.TryGetComponent<ButlersMarkEffect>(ref effectScript))
			{
				effectScript.DeleteThis();
			}
			yield return (object)new WaitForSeconds(0.5f);
			if (toBeSleepyTapped.Count > 1)
			{
				base.targetPlayer = toBeSleepyTapped.ElementAt(randomizer.Next(toBeSleepyTapped.Count - 1));
				toBeSleepyTapped.Remove(base.targetPlayer);
				((EnemyAI)this).SwitchToBehaviourClientRpc(5);
			}
			else
			{
				angerMeter = 0f;
				DoAnimationClientRpc("startWalk");
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				toBeSleepyTapped.Remove(base.targetPlayer);
				base.targetPlayer = null;
			}
			((MonoBehaviour)this).StopCoroutine(SleepyTapAttack());
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			base.enemyHP -= force;
			if (base.enemyHP <= 1 && !base.isEnemyDead && base.currentBehaviourStateIndex != 4)
			{
				if ((Object)(object)base.targetPlayer == (Object)null)
				{
					retreatNode = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, false, 0, true, 50, true);
					((EnemyAI)this).SetDestinationToPosition(((Component)retreatNode).transform.position, false);
				}
				else
				{
					TargetFurthestNodeFromPlayer();
				}
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				((MonoBehaviour)this).StopAllCoroutines();
				angerMeter = 0f;
				secondsSinceLastRandomChase = 0f;
				DoAnimationClientRpc("startRun");
				((EnemyAI)this).SwitchToBehaviourClientRpc(4);
			}
			else if ((Object)(object)playerWhoHit != (Object)null && (base.currentBehaviourStateIndex == 0 || base.currentBehaviourStateIndex == 1))
			{
				angerMeter = 15f;
				base.targetPlayer = playerWhoHit;
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				DoAnimationClientRpc("startRun");
				((EnemyAI)this).SwitchToBehaviourClientRpc(2);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void DoAnimationClientRpc(string animationName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1808760248u, val2, val, (SendTo)7, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val3)).WriteValueSafe(animationName, false);
				}
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1808760248u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				LogIfDebugBuild("Animation: " + animationName);
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void CheckForBoundPlayersRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(682304678u, val2, val, (SendTo)7, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 682304678u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				ButlersMarkEffect butlersMarkEffect = default(ButlersMarkEffect);
				if (localPlayerController.isInsideFactory && ((Component)localPlayerController).gameObject.TryGetComponent<ButlersMarkEffect>(ref butlersMarkEffect) && butlersMarkEffect.bindingTechnique)
				{
					AddClientToBoundListRpc(localPlayerController.playerClientId);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void AddClientToBoundListRpc(ulong playerToBeAddedID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2591653836u, val2, val, (SendTo)2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val3, playerToBeAddedID);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 2591653836u, val2, val, (SendTo)2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val4 = StartOfRound.Instance.allPlayerScripts[playerToBeAddedID];
			if (!((Object)(object)val4 == (Object)null) && val4.isPlayerControlled && !val4.isPlayerDead)
			{
				toBeSleepyTapped.Add(val4);
				LogIfDebugBuild(" s" + toBeSleepyTapped.Count);
				if (base.currentBehaviourStateIndex != 5 && base.currentBehaviourStateIndex != 3)
				{
					DoAnimationClientRpc("startRun");
					base.targetPlayer = val4;
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((MonoBehaviour)this).StopAllCoroutines();
					((EnemyAI)this).SwitchToBehaviourClientRpc(5);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void HealNellyToFullClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1581165477u, val2, val, (SendTo)7, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 1581165477u, val2, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					base.enemyHP = 10;
					LogIfDebugBuild($"Nelly has healed back to : {base.enemyHP}");
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SwingAttackHitClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2921592034u, val2, val, (SendTo)7, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 2921592034u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			int num = 8;
			bool flag = false;
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 2.5f, num, (QueryTriggerInteraction)2);
			Vector3 val4 = ((Component)this).transform.position;
			LogIfDebugBuild("Nelly slash hitbox at local player spawned at: " + ((object)(Vector3)(ref val4)).ToString());
			for (int i = 0; i < array.Length; i++)
			{
				Collider[] array2 = array;
				foreach (Collider val5 in array2)
				{
					PlayerControllerB val6 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val5, false, false);
					if ((Object)(object)val6 != (Object)null && ((NetworkBehaviour)val6).IsOwner && !flag)
					{
						flag = true;
						LogIfDebugBuild("Hit local player!");
						val4 = default(Vector3);
						val6.DamagePlayer(20, true, true, (CauseOfDeath)14, 0, false, val4);
						ApplyButlerMark(1, val6);
					}
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1808760248u, new RpcReceiveHandler(__rpc_handler_1808760248), "DoAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(682304678u, new RpcReceiveHandler(__rpc_handler_682304678), "CheckForBoundPlayersRpc");
			((NetworkBehaviour)this).__registerRpc(2591653836u, new RpcReceiveHandler(__rpc_handler_2591653836), "AddClientToBoundListRpc");
			((NetworkBehaviour)this).__registerRpc(1581165477u, new RpcReceiveHandler(__rpc_handler_1581165477), "HealNellyToFullClientRpc");
			((NetworkBehaviour)this).__registerRpc(2921592034u, new RpcReceiveHandler(__rpc_handler_2921592034), "SwingAttackHitClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_1808760248(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string animationName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NellyEarnshawAI)(object)target).DoAnimationClientRpc(animationName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_682304678(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NellyEarnshawAI)(object)target).CheckForBoundPlayersRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2591653836(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong playerToBeAddedID = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerToBeAddedID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NellyEarnshawAI)(object)target).AddClientToBoundListRpc(playerToBeAddedID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1581165477(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NellyEarnshawAI)(object)target).HealNellyToFullClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2921592034(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NellyEarnshawAI)(object)target).SwingAttackHitClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "NellyEarnshawAI";
		}
	}
	internal class NoisyPlushieItem : GrabbableObject
	{
		public AudioSource plushAudio = null;

		public AudioClip[] audioClips = null;

		public Random audioRandomizer = null;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			audioRandomizer = new Random(StartOfRound.Instance.randomMapSeed - 15);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			playAudioClip(used);
		}

		private void playAudioClip(bool startAudio)
		{
			if (startAudio)
			{
				plushAudio.PlayOneShot(audioClips[audioRandomizer.Next(0, audioClips.Length)]);
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			plushAudio.Stop(true);
		}

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

		protected override void __initializeRpcs()
		{
			((GrabbableObject)this).__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "NoisyPlushieItem";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace Sutra.NellyEarnshaw.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}