Decompiled source of TrickOrTreat v2.0.0

TrickOrTreat.dll

Decompiled 4 days 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.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CursedScraps;
using CursedScraps.Managers;
using CursedScraps.Patches;
using CursedScraps.Registries;
using GameNetcodeStuff;
using LegaFusionCore;
using LegaFusionCore.Behaviours.Shaders;
using LegaFusionCore.Managers;
using LegaFusionCore.Managers.NetworkManagers;
using LegaFusionCore.Utilities;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using TrickOrTreat.Behaviours;
using TrickOrTreat.Managers;
using TrickOrTreat.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("TrickOrTreat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TrickOrTreat")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("aa332fd3-7a30-4c63-9e45-c5d6f0cb377a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TrickOrTreat
{
	internal class Constants
	{
		public const string INFORMATION = "Information";

		public const string MESSAGE_TRICK_OR_TREAT = "Trick or treat?";

		public const string MESSAGE_INFO_NO_CANDY = "You don't have any candy";

		public const string HOLLOW_GIRL = "Hollow Girl";

		public const string CURSED_CANDY = "Cursed Candy";
	}
	[BepInPlugin("Lega.TrickOrTreat", "Trick Or Treat", "2.0.0")]
	public class TrickOrTreat : BaseUnityPlugin
	{
		internal const string modGUID = "Lega.TrickOrTreat";

		internal const string modName = "Trick Or Treat";

		internal const string modVersion = "2.0.0";

		private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "trickortreat"));

		internal static ManualLogSource mls;

		public static ConfigFile configFile;

		public static GameObject cursedBallObj;

		public static Item cursedCandy;

		public void Awake()
		{
			mls = Logger.CreateLogSource("TrickOrTreat");
			configFile = ((BaseUnityPlugin)this).Config;
			ConfigManager.Load();
			NetcodePatcher();
			LoadItems();
			LoadEnemies();
			LoadNetworkPrefabs();
		}

		private static 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 static void LoadItems()
		{
			cursedCandy = bundle.LoadAsset<Item>("Assets/CursedCandy/CursedCandyItem.asset");
			LFCObjectsManager.RegisterObject(typeof(CursedCandy), cursedCandy);
		}

		public static void LoadEnemies()
		{
			EnemyType val = bundle.LoadAsset<EnemyType>("Assets/HollowGirl/HollowGirlEnemy.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, ConfigManager.hollowGirlRarity.Value, (LevelTypes)(-1), (TerminalNode)null, (TerminalKeyword)null);
		}

		public static void LoadNetworkPrefabs()
		{
			HashSet<GameObject> hashSet = new HashSet<GameObject> { cursedBallObj = bundle.LoadAsset<GameObject>("Assets/CursedBall/CursedBall.prefab") };
			foreach (GameObject item in hashSet)
			{
				NetworkPrefabs.RegisterNetworkPrefab(item);
				Utilities.FixMixerGroups(item);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TrickOrTreat";

		public const string PLUGIN_NAME = "TrickOrTreat";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace TrickOrTreat.Managers
{
	internal class ConfigManager
	{
		public static ConfigEntry<int> hollowGirlRarity;

		public static ConfigEntry<int> waitingDuration;

		public static ConfigEntry<int> damage;

		public static ConfigEntry<int> cursedCandyRarity;

		public static ConfigEntry<int> minCursedCandy;

		public static ConfigEntry<int> maxCursedCandy;

		internal static void Load()
		{
			hollowGirlRarity = TrickOrTreat.configFile.Bind<int>("Hollow Girl", "Rarity", 20, "Hollow Girl base rarity.");
			waitingDuration = TrickOrTreat.configFile.Bind<int>("Hollow Girl", "Waiting duration", 5, "Time window during which a player can give a candy.");
			damage = TrickOrTreat.configFile.Bind<int>("Hollow Girl", "Damage", 40, "Hollow Girl damage");
			cursedCandyRarity = TrickOrTreat.configFile.Bind<int>("Cursed Candy", "Rarity", 25, "Cursed Candy spawn rarity.");
			minCursedCandy = TrickOrTreat.configFile.Bind<int>("Cursed Candy", "Min spawn", 0, "Min Cursed Candy to spawn");
			maxCursedCandy = TrickOrTreat.configFile.Bind<int>("Cursed Candy", "Max spawn", 2, "Max Cursed Candy to spawn");
		}
	}
}
namespace TrickOrTreat.Behaviours
{
	public class CursedBall : NetworkBehaviour
	{
		public Rigidbody rigidbody;

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void ThrowCursedBallEveryoneRpc(Vector3 targetPosition)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(688818668u, val2, val, (SendTo)6, (RpcDelivery)0);
					((FastBufferWriter)(ref val3)).WriteValueSafe(ref targetPosition);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 688818668u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					float num = 35f;
					Vector3 val4 = targetPosition - ((Component)this).transform.position;
					Vector3 val5 = default(Vector3);
					((Vector3)(ref val5))..ctor(val4.x, 0f, val4.z);
					float magnitude = ((Vector3)(ref val5)).magnitude;
					float num2 = MathF.PI / 4f;
					float num3 = magnitude / (num * Mathf.Cos(num2));
					float num4 = val4.y / num3 - 0.5f * Physics.gravity.y * num3;
					Vector3 val6 = ((Vector3)(ref val5)).normalized * (num * Mathf.Cos(num2));
					rigidbody.velocity = Vector3.zero;
					rigidbody.AddForce(val6 + Vector3.up * num4, (ForceMode)2);
				}
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			if (!((Object)(object)other == (Object)null) && LFCUtilities.IsServer && HandlePlayerHit(other))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private bool HandlePlayerHit(Collider other)
		{
			PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
			if ((Object)(object)component == (Object)null)
			{
				return false;
			}
			HitPlayerEveryoneRpc((int)component.playerClientId);
			return true;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void HitPlayerEveryoneRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1204927959u, val2, val, (SendTo)6, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val3, playerId);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 1204927959u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
					List<CurseEffectType> eligibleCurses = RoundManagerPatch.GetEligibleCurses(StartOfRound.Instance.currentLevel.PlanetName);
					CurseEffectType val4 = eligibleCurses[new Random().Next(eligibleCurses.Count)];
					LFCGlobalManager.PlayAudio("Lega Fusion Core" + ((Object)LegaFusionCore.hitProjectileAudio).name, ((Component)this).transform.position);
					CursedScrapsNetworkManager.Instance.ApplyPlayerCurseEveryoneRpc((int)component.playerClientId, val4.Name, val4.Duration);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)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
			((NetworkBehaviour)this).__registerRpc(688818668u, new RpcReceiveHandler(__rpc_handler_688818668), "ThrowCursedBallEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(1204927959u, new RpcReceiveHandler(__rpc_handler_1204927959), "HitPlayerEveryoneRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_688818668(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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)
			{
				Vector3 targetPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref targetPosition);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CursedBall)(object)target).ThrowCursedBallEveryoneRpc(targetPosition);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1204927959(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)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CursedBall)(object)target).HitPlayerEveryoneRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CursedBall";
		}
	}
	public class CursedCandy : PhysicsProp
	{
		public HollowGirl aimedEnemy;

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (((GrabbableObject)this).isHeld && !((GrabbableObject)this).isPocketed && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && LFCUtilities.ShouldBeLocalPlayer(((GrabbableObject)this).playerHeldBy))
			{
				ShowAuraAimedEnemy(((GrabbableObject)this).playerHeldBy);
			}
		}

		public void ShowAuraAimedEnemy(PlayerControllerB player)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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)
			RaycastHit val = default(RaycastHit);
			EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect);
			if (Physics.Raycast(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, ref val, 5f, 524288, (QueryTriggerInteraction)2) && ((Component)((RaycastHit)(ref val)).collider).TryGetComponent<EnemyAICollisionDetect>(ref val2) && val2.mainScript is HollowGirl hollowGirl && hollowGirl.isWaiting)
			{
				if ((Object)(object)aimedEnemy != (Object)(object)hollowGirl)
				{
					RemoveAuraFromEnemy();
					aimedEnemy = hollowGirl;
					CustomPassManager.SetupAuraForObjects((GameObject[])(object)new GameObject[1] { ((Component)hollowGirl).gameObject }, LegaFusionCore.transparentShader, "Trick Or Treat" + ((Object)((Component)this).gameObject).name, Color.red);
				}
			}
			else
			{
				RemoveAuraFromEnemy();
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)aimedEnemy == (Object)null) && aimedEnemy.isWaiting)
			{
				aimedEnemy.ApplyCurseEveryoneRpc();
				LFCNetworkManager.Instance.DestroyObjectEveryoneRpc(NetworkObjectReference.op_Implicit(((Component)this).GetComponent<NetworkObject>()));
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			RemoveAuraFromEnemy();
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			RemoveAuraFromEnemy();
		}

		public void RemoveAuraFromEnemy()
		{
			if (!((Object)(object)aimedEnemy == (Object)null))
			{
				CustomPassManager.RemoveAuraFromObjects((GameObject[])(object)new GameObject[1] { ((Component)aimedEnemy).gameObject }, "Trick Or Treat" + ((Object)((Component)this).gameObject).name);
				aimedEnemy = null;
			}
		}

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CursedCandy";
		}
	}
	public class HollowGirl : EnemyAI
	{
		public enum State
		{
			WANDERING,
			CHASING,
			THROWING,
			INTERACTING
		}

		public Transform TurnCompass;

		public AudioClip[] FootstepSounds = Array.Empty<AudioClip>();

		public AudioClip SwingSound;

		public AudioClip DieSound;

		public float footstepTimer;

		public float throwTimer;

		public float angerTimer;

		public static float throwCooldown = 1f;

		public static float angerCooldown = 30f;

		public bool isAngry;

		public bool isWaiting;

		public bool isCursed;

		public Coroutine interactingCoroutine;

		public Coroutine attackCoroutine;

		public Coroutine killCoroutine;

		public override void Start()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			base.currentBehaviourStateIndex = 0;
			base.creatureAnimator.SetTrigger("startWalk");
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			if (!LFCUtilities.IsServer)
			{
				return;
			}
			for (int i = 0; i < ConfigManager.maxCursedCandy.Value; i++)
			{
				if (i < ConfigManager.minCursedCandy.Value || new Random().Next(1, 100) <= ConfigManager.cursedCandyRarity.Value)
				{
					LFCObjectsManager.SpawnNewObject(RoundManager.Instance, TrickOrTreat.cursedCandy);
				}
			}
		}

		public override void Update()
		{
			//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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//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_0105: Unknown result type (might be due to invalid IL or missing references)
			if (killCoroutine != null)
			{
				return;
			}
			((EnemyAI)this).Update();
			base.creatureAnimator.SetBool("stunned", base.stunNormalizedTimer > 0f);
			if (base.stunNormalizedTimer > 0f)
			{
				base.agent.speed = 0f;
				if ((Object)(object)base.stunnedByPlayer != (Object)null)
				{
					base.targetPlayer = base.stunnedByPlayer;
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				return;
			}
			PlayFootstepSound();
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 1 || currentBehaviourStateIndex == 3 || currentBehaviourStateIndex == 2))
			{
				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 (currentBehaviourStateIndex == 2)
				{
					throwTimer += Time.deltaTime;
				}
			}
			if (isAngry)
			{
				angerTimer += Time.deltaTime;
				if (angerTimer >= angerCooldown)
				{
					isAngry = false;
					angerTimer = 0f;
				}
			}
		}

		public void PlayFootstepSound()
		{
			if (base.currentBehaviourStateIndex != 3 && base.currentBehaviourStateIndex != 2 && attackCoroutine == null)
			{
				footstepTimer -= Time.deltaTime;
				if (FootstepSounds.Length != 0 && footstepTimer <= 0f)
				{
					base.creatureSFX.PlayOneShot(FootstepSounds[Random.Range(0, FootstepSounds.Length)]);
					footstepTimer = 0.6f;
				}
			}
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead)
			{
				switch (base.currentBehaviourStateIndex)
				{
				case 0:
					DoWandering();
					break;
				case 1:
					DoChasing();
					break;
				case 2:
					DoThrowing();
					break;
				case 3:
					DoInteracting();
					break;
				}
			}
		}

		public void DoWandering()
		{
			base.agent.speed = 3f;
			if (FoundClosestPlayerInRange(25, 10))
			{
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				DoAnimationEveryoneRpc("startChase");
				((EnemyAI)this).SwitchToBehaviourClientRpc(1);
			}
		}

		private bool FoundClosestPlayerInRange(int range, int senseRange)
		{
			PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(60f, range, senseRange);
			if ((Object)(object)val != (Object)null && ((EnemyAI)this).PlayerIsTargetable(val, false, false))
			{
				return Object.op_Implicit((Object)(object)(base.targetPlayer = val));
			}
			return false;
		}

		public void DoChasing()
		{
			//IL_0020: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			base.agent.speed = 6f;
			throwCooldown = 1f;
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position);
			if (!TargetClosestPlayerInAnyCase() || (num > 30f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
			{
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				DoAnimationEveryoneRpc("startWalk");
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				return;
			}
			if (HoldingCursedCandy(base.targetPlayer))
			{
				if (num <= 5f)
				{
					DoAnimationEveryoneRpc("startIdle");
					((EnemyAI)this).SwitchToBehaviourServerRpc(3);
					return;
				}
			}
			else if (CanThrow(num))
			{
				DoAnimationEveryoneRpc("startIdle");
				((EnemyAI)this).SwitchToBehaviourServerRpc(2);
				return;
			}
			((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
		}

		public bool TargetClosestPlayerInAnyCase()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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];
				}
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		public void DoThrowing()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			base.agent.speed = 0f;
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position);
			if (HoldingCursedCandy(base.targetPlayer))
			{
				throwTimer = 0f;
				if (num <= 5f)
				{
					DoAnimationEveryoneRpc("startIdle");
					((EnemyAI)this).SwitchToBehaviourServerRpc(3);
				}
				else
				{
					DoAnimationEveryoneRpc("startChase");
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
			}
			else if (!CanThrow(num))
			{
				throwTimer = 0f;
				DoAnimationEveryoneRpc("startChase");
				((EnemyAI)this).SwitchToBehaviourClientRpc(1);
			}
			else
			{
				ThrowCursedBall(base.targetPlayer);
			}
		}

		public void ThrowCursedBall(PlayerControllerB player)
		{
			//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)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (!(throwTimer < throwCooldown))
			{
				DoAnimationEveryoneRpc("startThrow");
				PlayThrowEveryoneRpc();
				GameObject val = Object.Instantiate<GameObject>(TrickOrTreat.cursedBallObj, ((Component)this).transform.position + Vector3.up * 1.5f, Quaternion.identity, StartOfRound.Instance.propsContainer);
				CursedBall component = val.GetComponent<CursedBall>();
				val.GetComponent<NetworkObject>().Spawn(false);
				component.ThrowCursedBallEveryoneRpc(((Component)player).transform.position + Vector3.up * 1.5f);
				DoAnimationEveryoneRpc("startIdle");
				throwTimer = 0f;
				throwCooldown = 5f;
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void PlayThrowEveryoneRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_00b3: 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 = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(24814623u, val2, val, (SendTo)6, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 24814623u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					base.creatureVoice.Play();
				}
			}
		}

		public void DoInteracting()
		{
			base.agent.speed = 0f;
			if (interactingCoroutine == null)
			{
				interactingCoroutine = ((MonoBehaviour)this).StartCoroutine(InteractingCoroutine());
			}
		}

		public IEnumerator InteractingCoroutine()
		{
			StartInteractingEveryoneRpc((int)base.targetPlayer.playerClientId);
			int timePassed = 0;
			while (timePassed < ConfigManager.waitingDuration.Value && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= 20f)
			{
				yield return (object)new WaitForSeconds(1f);
				timePassed++;
				if (isCursed)
				{
					break;
				}
			}
			EndInteractingEveryoneRpc();
			interactingCoroutine = null;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StartInteractingEveryoneRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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 = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1570185894u, val2, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val3, playerId);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1570185894u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				isWaiting = true;
				base.enemyType.canBeStunned = false;
				if (LFCUtilities.ShouldBeLocalPlayer(StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>()))
				{
					HUDManager.Instance.AddChatMessage("Trick or treat?", "Hollow Girl", -1, false);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void EndInteractingEveryoneRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_00b3: 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 = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(45174539u, val2, val, (SendTo)6, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 45174539u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					base.creatureAnimator.SetTrigger("startChase");
					((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1);
					isAngry = true;
					isWaiting = false;
					base.enemyType.canBeStunned = true;
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void ApplyCurseEveryoneRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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 = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2638001245u, val2, val, (SendTo)6, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 2638001245u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					isCursed = true;
					CustomPassManager.SetupAuraForObjects((GameObject[])(object)new GameObject[1] { ((Component)this).gameObject }, CursedScraps.cursedShader, "Trick Or Treat" + ((Object)CursedScraps.cursedShader).name, default(Color));
				}
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (base.currentBehaviourStateIndex == 1 && attackCoroutine == null && killCoroutine == null)
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if (LFCUtilities.ShouldBeLocalPlayer(val) && CanHitPlayer(val))
				{
					AttackEveryoneRpc((int)val.playerClientId);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void AttackEveryoneRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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 = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1175476650u, val2, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val3, playerId);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1175476650u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (attackCoroutine == null)
				{
					attackCoroutine = ((MonoBehaviour)this).StartCoroutine(AttackCoroutine(StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>()));
				}
			}
		}

		public IEnumerator AttackCoroutine(PlayerControllerB player)
		{
			base.agent.speed = 0f;
			base.creatureAnimator.SetTrigger("startAttack");
			base.creatureAnimator.SetTrigger("startChase");
			base.creatureSFX.PlayOneShot(SwingSound);
			yield return (object)new WaitForSeconds(1.1f);
			player.DamagePlayer(ConfigManager.damage.Value, true, true, (CauseOfDeath)8, 0, false, default(Vector3));
			base.creatureAnimator.SetTrigger("startChase");
			base.agent.speed = 6f;
			attackCoroutine = null;
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (!base.isEnemyDead && CanHitPlayer(playerWhoHit))
			{
				((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
				base.enemyHP -= force;
				if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner)
				{
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
				}
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			killCoroutine = ((MonoBehaviour)this).StartCoroutine(KillEnemyCoroutine(destroy));
		}

		public IEnumerator KillEnemyCoroutine(bool destroy)
		{
			base.creatureAnimator.SetTrigger("startKill");
			base.creatureSFX.PlayOneShot(DieSound);
			yield return (object)new WaitForSeconds(3f);
			LFCGlobalManager.PlayParticle("Lega Fusion Core" + ((Object)LegaFusionCore.darkExplosionParticle).name, ((Component)this).transform.position, Quaternion.Euler(-90f, 0f, 0f));
			LFCGlobalManager.PlayAudio("Lega Fusion Core" + ((Object)LegaFusionCore.darkExplosionAudio).name, ((Component)this).transform.position);
			<>n__0(destroy);
		}

		public bool CanThrow(float distanceWithPlayer)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (!CanHitPlayer(base.targetPlayer) && distanceWithPlayer <= 20f)
			{
				if (!(distanceWithPlayer <= 2f))
				{
					return ((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null);
				}
				return true;
			}
			return false;
		}

		public bool CanHitPlayer(PlayerControllerB player)
		{
			if (!isCursed)
			{
				if ((Object)(object)player != (Object)null)
				{
					return CSCurseRegistry.HasCurse(((Component)player).gameObject);
				}
				return false;
			}
			return true;
		}

		public bool HoldingCursedCandy(PlayerControllerB player)
		{
			if (!isCursed && !isAngry && (Object)(object)player.currentlyHeldObjectServer != (Object)null)
			{
				return player.currentlyHeldObjectServer is CursedCandy;
			}
			return false;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void DoAnimationEveryoneRpc(string animationState)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_005f: 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_0072: 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)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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 = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1319403598u, val2, val, (SendTo)6, (RpcDelivery)0);
				bool flag = animationState != null;
				((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val3)).WriteValueSafe(animationState, false);
				}
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1319403598u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				base.creatureAnimator.SetTrigger(animationState);
			}
		}

		[CompilerGenerated]
		[DebuggerHidden]
		private void <>n__0(bool destroy = false)
		{
			((EnemyAI)this).KillEnemy(destroy);
		}

		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
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(24814623u, new RpcReceiveHandler(__rpc_handler_24814623), "PlayThrowEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(1570185894u, new RpcReceiveHandler(__rpc_handler_1570185894), "StartInteractingEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(45174539u, new RpcReceiveHandler(__rpc_handler_45174539), "EndInteractingEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(2638001245u, new RpcReceiveHandler(__rpc_handler_2638001245), "ApplyCurseEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(1175476650u, new RpcReceiveHandler(__rpc_handler_1175476650), "AttackEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(1319403598u, new RpcReceiveHandler(__rpc_handler_1319403598), "DoAnimationEveryoneRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_24814623(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;
				((HollowGirl)(object)target).PlayThrowEveryoneRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1570185894(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)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HollowGirl)(object)target).StartInteractingEveryoneRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_45174539(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;
				((HollowGirl)(object)target).EndInteractingEveryoneRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2638001245(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;
				((HollowGirl)(object)target).ApplyCurseEveryoneRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1175476650(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)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HollowGirl)(object)target).AttackEveryoneRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1319403598(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 animationState = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationState, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HollowGirl)(object)target).DoAnimationEveryoneRpc(animationState);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "HollowGirl";
		}
	}
}
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 TrickOrTreat.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}