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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
[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("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[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.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")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("Nuclear_Fox.LethalPlaytime")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3")]
[assembly: AssemblyProduct("LethalPlaytime")]
[assembly: AssemblyTitle("Nuclear_Fox.LethalPlaytime")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace LethalPlaytime
{
public class PlaytimeConfig
{
internal enum RarityAddTypes
{
All,
Modded,
Vanilla,
List
}
private static AssetBundle assetBundle;
private static LevelTypes chosenRegistrationMethod = (LevelTypes)(-1);
private static RarityAddTypes defaultCreatureRegistrationMethod = RarityAddTypes.All;
private static int missDelightRarity;
private static int huggyWuggyRarity;
public static void ConfigureAndRegisterAssets(LethalPlaytime Instance)
{
LoadAssets();
CreateConfigEntries(Instance);
ConfigureAndRegisterMissDelight();
ConfigureAndRegisterHuggyWuggy();
}
internal static void CreateConfigEntries(LethalPlaytime Instance)
{
//IL_004a: 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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
ConfigEntry<RarityAddTypes> val = ((BaseUnityPlugin)Instance).Config.Bind<RarityAddTypes>("Creatures", "Registration Method", RarityAddTypes.All, "The method to add creatures to the level. \n Default = All \n Vanilla \n Modded \n List (Not yet implemented for creatures, defaults to All)");
EnumDropDownConfigItem<RarityAddTypes> val2 = new EnumDropDownConfigItem<RarityAddTypes>(val);
switch (val.Value)
{
case RarityAddTypes.All:
chosenRegistrationMethod = (LevelTypes)(-1);
break;
case RarityAddTypes.Vanilla:
chosenRegistrationMethod = (LevelTypes)1020;
break;
case RarityAddTypes.Modded:
chosenRegistrationMethod = (LevelTypes)1024;
break;
case RarityAddTypes.List:
chosenRegistrationMethod = (LevelTypes)(-1);
break;
}
ConfigEntry<int> val3 = Instance.CreateIntSliderConfig("Miss Delight", 50, "Adjust how often you see the enemy Miss Delight.", 0, 100, "Creatures");
missDelightRarity = val3.Value;
ConfigEntry<int> val4 = Instance.CreateIntSliderConfig("Huggy Wuggy", 50, "Adjust how often you see Huggy Wuggy.", 0, 100, "Creatures");
huggyWuggyRarity = val4.Value;
}
private static void ConfigureAndRegisterMissDelight()
{
//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
EnemyType val = assetBundle.LoadAsset<EnemyType>("Miss Delight");
MissDelightAI missDelightAI = val.enemyPrefab.AddComponent<MissDelightAI>();
((EnemyAI)missDelightAI).creatureVoice = val.enemyPrefab.GetComponent<AudioSource>();
((EnemyAI)missDelightAI).creatureSFX = val.enemyPrefab.GetComponent<AudioSource>();
missDelightAI.weaponAudioPoint = ((Component)FindDeepChild(val.enemyPrefab.transform, "DelightWeaponAudio")).GetComponent<AudioSource>();
((EnemyAI)missDelightAI).agent = val.enemyPrefab.GetComponent<NavMeshAgent>();
((EnemyAI)missDelightAI).creatureAnimator = val.enemyPrefab.GetComponent<Animator>();
((EnemyAI)missDelightAI).syncMovementSpeed = 0.1f;
((EnemyAI)missDelightAI).exitVentAnimationTime = 1f;
((EnemyAI)missDelightAI).eye = val.enemyPrefab.transform.Find("Eye");
((EnemyAI)missDelightAI).enemyType = val;
((EnemyAI)missDelightAI).updatePositionThreshold = 0.1f;
((EnemyAI)missDelightAI).enemyBehaviourStates = (EnemyBehaviourState[])(object)new EnemyBehaviourState[4];
((EnemyAI)missDelightAI).AIIntervalTime = 0.08f;
missDelightAI.weaponCollider = ((Component)FindDeepChild(val.enemyPrefab.transform, "JNT_R_Hand_IK")).GetComponent<SphereCollider>();
((Component)val.enemyPrefab.transform.Find("Teacher")).GetComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)missDelightAI;
missDelightAI.footstepClips = (AudioClip[])(object)new AudioClip[7];
missDelightAI.footstepClips[0] = assetBundle.LoadAsset<AudioClip>("DelightFootstep1");
missDelightAI.footstepClips[1] = assetBundle.LoadAsset<AudioClip>("DelightFootstep2");
missDelightAI.footstepClips[2] = assetBundle.LoadAsset<AudioClip>("DelightFootstep3");
missDelightAI.footstepClips[3] = assetBundle.LoadAsset<AudioClip>("DelightFootstep4");
missDelightAI.footstepClips[4] = assetBundle.LoadAsset<AudioClip>("DelightFootstep5");
missDelightAI.footstepClips[5] = assetBundle.LoadAsset<AudioClip>("DelightFootstep6");
missDelightAI.footstepClips[6] = assetBundle.LoadAsset<AudioClip>("DelightFootstep7");
missDelightAI.weaponSwingClip = (AudioClip[])(object)new AudioClip[1];
missDelightAI.weaponSwingClip[0] = assetBundle.LoadAsset<AudioClip>("DelightWeaponSwing1");
missDelightAI.weaponSwingVoiceClips = (AudioClip[])(object)new AudioClip[4];
missDelightAI.weaponSwingVoiceClips[0] = assetBundle.LoadAsset<AudioClip>("DelightSwingVoice1");
missDelightAI.weaponSwingVoiceClips[1] = assetBundle.LoadAsset<AudioClip>("DelightSwingVoice2");
missDelightAI.weaponSwingVoiceClips[2] = assetBundle.LoadAsset<AudioClip>("DelightSwingVoice3");
missDelightAI.weaponSwingVoiceClips[3] = assetBundle.LoadAsset<AudioClip>("DelightSwingVoice4");
missDelightAI.weaponImpactClips = (AudioClip[])(object)new AudioClip[2];
missDelightAI.weaponImpactClips[0] = assetBundle.LoadAsset<AudioClip>("DelightWeaponImpact1");
missDelightAI.weaponImpactClips[1] = assetBundle.LoadAsset<AudioClip>("DelightWeaponImpact2");
missDelightAI.laughClips = (AudioClip[])(object)new AudioClip[4];
missDelightAI.laughClips[0] = assetBundle.LoadAsset<AudioClip>("DelightLaugh1");
missDelightAI.laughClips[1] = assetBundle.LoadAsset<AudioClip>("DelightLaugh2");
missDelightAI.laughClips[2] = assetBundle.LoadAsset<AudioClip>("DelightLaugh3");
missDelightAI.laughClips[3] = assetBundle.LoadAsset<AudioClip>("DelightLaugh4");
missDelightAI.doorSmashClips = (AudioClip[])(object)new AudioClip[1];
missDelightAI.doorSmashClips[0] = assetBundle.LoadAsset<AudioClip>("DelightDoorKick 1");
missDelightAI.growlClips = (AudioClip[])(object)new AudioClip[4];
missDelightAI.growlClips[0] = assetBundle.LoadAsset<AudioClip>("DelightBreathe1");
missDelightAI.growlClips[1] = assetBundle.LoadAsset<AudioClip>("DelightBreathe2");
missDelightAI.growlClips[2] = assetBundle.LoadAsset<AudioClip>("DelightBreathe3");
missDelightAI.growlClips[3] = assetBundle.LoadAsset<AudioClip>("DelightBreathe4");
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
TerminalNode val2 = assetBundle.LoadAsset<TerminalNode>("Miss Delight Terminal Node");
TerminalKeyword val3 = assetBundle.LoadAsset<TerminalKeyword>("Miss Delight Terminal Keyword");
Enemies.RegisterEnemy(val, missDelightRarity, chosenRegistrationMethod, val2, val3);
}
private static void ConfigureAndRegisterHuggyWuggy()
{
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
EnemyType val = assetBundle.LoadAsset<EnemyType>("Huggy Wuggy");
HuggyAI huggyAI = val.enemyPrefab.AddComponent<HuggyAI>();
((EnemyAI)huggyAI).creatureVoice = val.enemyPrefab.GetComponent<AudioSource>();
((EnemyAI)huggyAI).creatureSFX = val.enemyPrefab.GetComponent<AudioSource>();
huggyAI.voiceAudio = ((Component)val.enemyPrefab.transform.Find("VoiceAudio")).GetComponent<AudioSource>();
huggyAI.voiceFarAudio = ((Component)val.enemyPrefab.transform.Find("VoiceFarAudio")).GetComponent<AudioSource>();
huggyAI.slashAudio = ((Component)val.enemyPrefab.transform.Find("SlashAudio")).GetComponent<AudioSource>();
((EnemyAI)huggyAI).enemyBehaviourStates = (EnemyBehaviourState[])(object)new EnemyBehaviourState[6];
((EnemyAI)huggyAI).AIIntervalTime = 0.08f;
((EnemyAI)huggyAI).syncMovementSpeed = 0.1f;
((EnemyAI)huggyAI).updatePositionThreshold = 0.12f;
((EnemyAI)huggyAI).exitVentAnimationTime = 1f;
((EnemyAI)huggyAI).enemyType = val;
((EnemyAI)huggyAI).eye = val.enemyPrefab.transform.Find("Eye");
((EnemyAI)huggyAI).agent = val.enemyPrefab.GetComponent<NavMeshAgent>();
((EnemyAI)huggyAI).creatureAnimator = val.enemyPrefab.GetComponent<Animator>();
huggyAI.jumpScarePoint = FindDeepChild(val.enemyPrefab.transform, "JumpScarePoint");
((Component)val.enemyPrefab.transform.Find("HuggyWuggyModelContainer")).GetComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)huggyAI;
huggyAI.weaponSwingCheckArea = ((Component)val.enemyPrefab.transform.Find("AttackCollisionArea")).GetComponent<BoxCollider>();
TerminalNode val2 = assetBundle.LoadAsset<TerminalNode>("Huggy Wuggy Terminal Node");
TerminalKeyword val3 = assetBundle.LoadAsset<TerminalKeyword>("Huggy Wuggy Terminal Keyword");
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
Enemies.RegisterEnemy(val, huggyWuggyRarity, chosenRegistrationMethod, val2, val3);
huggyAI.footstepClips = (AudioClip[])(object)new AudioClip[3]
{
assetBundle.LoadAsset<AudioClip>("HuggyStomp1"),
assetBundle.LoadAsset<AudioClip>("HuggyStomp2"),
assetBundle.LoadAsset<AudioClip>("HuggyStomp3")
};
huggyAI.attackSwingClips = (AudioClip[])(object)new AudioClip[4]
{
assetBundle.LoadAsset<AudioClip>("HuggyAttack1"),
assetBundle.LoadAsset<AudioClip>("HuggyAttack2"),
assetBundle.LoadAsset<AudioClip>("HuggyAttack3"),
assetBundle.LoadAsset<AudioClip>("HuggyAttack4")
};
huggyAI.attackVoiceClips = (AudioClip[])(object)new AudioClip[3]
{
assetBundle.LoadAsset<AudioClip>("HuggyAttackVoice1"),
assetBundle.LoadAsset<AudioClip>("HuggyAttackVoice2"),
assetBundle.LoadAsset<AudioClip>("HuggyAttackVoice3")
};
huggyAI.crouchClips = (AudioClip[])(object)new AudioClip[1] { assetBundle.LoadAsset<AudioClip>("HuggyCrouch1") };
huggyAI.sitDownClips = (AudioClip[])(object)new AudioClip[1] { assetBundle.LoadAsset<AudioClip>("HuggySitDown") };
huggyAI.sitUpClips = (AudioClip[])(object)new AudioClip[1] { assetBundle.LoadAsset<AudioClip>("HuggySitUp") };
huggyAI.roarClips = (AudioClip[])(object)new AudioClip[3]
{
assetBundle.LoadAsset<AudioClip>("HuggyRoar1"),
assetBundle.LoadAsset<AudioClip>("HuggyRoar2"),
assetBundle.LoadAsset<AudioClip>("HuggyRoar3")
};
huggyAI.roarFarClips = (AudioClip[])(object)new AudioClip[3]
{
assetBundle.LoadAsset<AudioClip>("HuggyRoar1Far"),
assetBundle.LoadAsset<AudioClip>("HuggyRoar2Far"),
assetBundle.LoadAsset<AudioClip>("HuggyRoar3Far")
};
huggyAI.slashClips = (AudioClip[])(object)new AudioClip[1] { assetBundle.LoadAsset<AudioClip>("HuggySlash") };
huggyAI.jumpscareClips = (AudioClip[])(object)new AudioClip[1];
huggyAI.jumpscareClips[0] = assetBundle.LoadAsset<AudioClip>("Huggie_Jumpscare");
}
private static void LoadAssets()
{
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalplaytime");
assetBundle = AssetBundle.LoadFromFile(text);
}
public static Transform FindDeepChild(Transform parent, string childName)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
foreach (Transform item in parent)
{
Transform val = item;
if (((Object)val).name == childName)
{
return val;
}
Transform val2 = FindDeepChild(val, childName);
if ((Object)(object)val2 != (Object)null)
{
return val2;
}
}
return null;
}
}
[HarmonyPatch(typeof(DoorLock))]
[HarmonyPatch("OnTriggerStay")]
internal class DoorLockMissDelight
{
private static Dictionary<DoorLock, bool> interactionTable = new Dictionary<DoorLock, bool>();
[HarmonyPostfix]
private static void OnTriggerStay(DoorLock __instance, Collider other)
{
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: 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_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
if (!interactionTable.TryGetValue(__instance, out var value))
{
value = false;
interactionTable[__instance] = value;
}
if (__instance.isLocked || __instance.isDoorOpened || !((NetworkBehaviour)__instance).IsServer || interactionTable[__instance])
{
return;
}
GameObject gameObject = ((Component)((Component)other).gameObject.transform.parent).gameObject;
if (!((Object)(object)gameObject != (Object)null) || (Object)(object)((Component)((Component)((Component)__instance).gameObject.transform.parent).transform.parent).transform.parent == (Object)null)
{
return;
}
MissDelightAI component = gameObject.GetComponent<MissDelightAI>();
if (!((Object)(object)component != (Object)null) || component.doorTrigger)
{
return;
}
if ((Object)(object)((EnemyAI)component).targetPlayer != (Object)null)
{
float num = Vector3.Distance(((Component)((Component)__instance).gameObject.transform.parent).transform.position, gameObject.transform.position);
float num2 = Vector3.Distance(gameObject.transform.position, ((Component)((EnemyAI)component).targetPlayer).transform.position);
if (num2 < num || !IsBetween(gameObject.transform, ((Component)((EnemyAI)component).targetPlayer).transform, ((Component)((Component)__instance).gameObject.transform.parent).transform))
{
return;
}
}
if (!(Vector3.Dot(((Component)((Component)((Component)((Component)__instance).gameObject.transform.parent).transform.parent).transform.parent).transform.forward, ((Component)((Component)((Component)((Component)__instance).gameObject.transform.parent).transform.parent).transform.parent).transform.position - gameObject.transform.position) > 0f))
{
interactionTable[__instance] = true;
component.HandleDoorTrigger();
component.doorTrigger = true;
Vector3 val = ((Component)((Component)((Component)((Component)__instance).gameObject.transform.parent).transform.parent).transform.parent).transform.position - gameObject.gameObject.transform.position;
val.y = 0f;
gameObject.transform.rotation = Quaternion.LookRotation(val);
((MonoBehaviour)__instance).StartCoroutine(ResetInteractionStateAfterDelay(__instance, 1.5f));
}
}
private static IEnumerator ResetInteractionStateAfterDelay(DoorLock instance, float delay)
{
yield return (object)new WaitForSeconds(delay);
interactionTable[instance] = false;
}
private static bool IsBetween(Transform me, Transform target, Transform obstacle)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = target.position - me.position;
Vector3 val2 = obstacle.position - me.position;
return Vector3.Dot(((Vector3)(ref val)).normalized, ((Vector3)(ref val2)).normalized) > 0f && ((Vector3)(ref val2)).magnitude < ((Vector3)(ref val)).magnitude;
}
}
public class HuggyAI : EnemyAI
{
private enum HuggyStates
{
Wandering,
Creeping,
RegularChase,
SitRecovery,
Enrage,
Retreat
}
private HuggyStates beforeRetreatState = HuggyStates.Creeping;
private Random rng;
private AISearchRoutine huggySearch;
private readonly float maxStamina = 20f;
public float currentStamina = 20f;
private readonly float maxWanderingTime = 22f;
public float currentWanderingTime = 0f;
private readonly float maxFrustration = 3.5f;
public float currentFrustration = 0f;
private Vector3 idealHidingSpotPosition;
private Vector3 idealRetreatSpotPosition;
private Vector3 mainEntrancePosition;
private Vector3 hidingSpotPosition;
private readonly float chasingSpeed;
private readonly float retreatingSpeed;
private bool changeInAnimationStateNeeded = false;
public bool sitting;
public bool standing;
public bool crouching;
public bool forward;
public bool running;
public bool charging;
public bool attacking;
public bool jumpscaring;
public bool atHidingPosition = false;
public bool hidingPositionFound = false;
public bool hidingPositionNoPlayers = true;
public PlayerControllerB playerLooking = null;
public float retreatTime = 12f;
public float currentRetreatTime = 0f;
public bool validRetreatSpot = false;
public bool canJumpscare = false;
private Coroutine jumpscareAnimation;
private Coroutine waitingRoutine;
public Transform jumpScarePoint;
public string[] statesArray;
public string nameOfLastAnimation;
public AudioSource voiceAudio;
public AudioSource voiceFarAudio;
public AudioSource slashAudio;
public AudioClip[] attackSwingClips;
public AudioClip[] attackVoiceClips;
public AudioClip[] roarClips;
public AudioClip[] roarFarClips;
public AudioClip[] footstepClips;
public AudioClip[] crouchClips;
public AudioClip[] sitDownClips;
public AudioClip[] sitUpClips;
public AudioClip[] jumpscareClips;
public AudioClip[] slashClips;
public BoxCollider weaponSwingCheckArea;
public override void Start()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
((EnemyAI)this).Start();
idealRetreatSpotPosition = ((Component)this).transform.position;
idealHidingSpotPosition = ((Component)this).transform.position;
mainEntrancePosition = RoundManager.FindMainEntrancePosition(false, false);
rng = new Random(StartOfRound.Instance.randomMapSeed + 5);
huggySearch = new AISearchRoutine();
sitting = false;
standing = true;
crouching = false;
forward = true;
running = false;
attacking = false;
charging = false;
jumpscaring = false;
if (!((NetworkBehaviour)this).IsHost || !((NetworkBehaviour)this).IsServer)
{
((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
}
if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
{
nameOfLastAnimation = base.creatureAnimator.GetCurrentStateName(0);
}
}
public override void DoAIInterval()
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0875: Unknown result type (might be due to invalid IL or missing references)
//IL_087b: Invalid comparison between Unknown and I4
//IL_07fb: Unknown result type (might be due to invalid IL or missing references)
//IL_080a: Unknown result type (might be due to invalid IL or missing references)
//IL_0817: Unknown result type (might be due to invalid IL or missing references)
//IL_081c: Unknown result type (might be due to invalid IL or missing references)
//IL_082a: Unknown result type (might be due to invalid IL or missing references)
//IL_0839: Unknown result type (might be due to invalid IL or missing references)
//IL_0846: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0421: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Unknown result type (might be due to invalid IL or missing references)
//IL_0518: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0600: Unknown result type (might be due to invalid IL or missing references)
//IL_060b: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0697: Unknown result type (might be due to invalid IL or missing references)
//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
switch (base.currentBehaviourStateIndex)
{
case 0:
{
if (!huggySearch.inProgress)
{
forward = true;
changeInAnimationStateNeeded = true;
((EnemyAI)this).StartSearch(((Component)this).transform.position, huggySearch);
}
if (currentWanderingTime > maxWanderingTime)
{
SwitchToCreeping();
((EnemyAI)this).SwitchToBehaviourState(1);
break;
}
PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(150f, 23, -1, 0f);
if ((Object)(object)val != (Object)null)
{
ScareClientAmount(val.actualClientId, 0.65f);
SwitchToRegularChasing();
((EnemyAI)this).SwitchToBehaviourState(2);
}
break;
}
case 1:
if (!atHidingPosition)
{
((EnemyAI)this).SetDestinationToPosition(hidingSpotPosition, true);
}
else
{
PlayerControllerB closestPlayerFixed = GetClosestPlayerFixed(((Component)this).transform.position);
if ((Object)(object)closestPlayerFixed != (Object)null)
{
Vector3 val2 = ((Component)closestPlayerFixed).transform.position - ((Component)this).transform.position;
val2.y = 0f;
((Component)this).transform.rotation = Quaternion.LookRotation(val2);
}
}
if (!atHidingPosition && Vector3.Distance(((Component)this).transform.position, hidingSpotPosition) < 1f)
{
atHidingPosition = true;
forward = false;
changeInAnimationStateNeeded = true;
base.agent.velocity = Vector3.zero;
base.agent.avoidancePriority = 51;
PlayerControllerB closestPlayerFixed2 = GetClosestPlayerFixed(((Component)this).transform.position);
if ((Object)(object)closestPlayerFixed2 != (Object)null)
{
Vector3 val3 = ((Component)closestPlayerFixed2).transform.position - ((Component)this).transform.position;
val3.y = 0f;
((Component)this).transform.rotation = Quaternion.LookRotation(val3);
}
}
RevalidateHidingSpot();
break;
case 2:
{
if (currentStamina <= 0f)
{
SwitchToSitting();
((EnemyAI)this).SwitchToBehaviourState(3);
break;
}
if ((Object)(object)base.targetPlayer != (Object)null && base.targetPlayer.isInsideFactory && !base.targetPlayer.isPlayerDead && !base.targetPlayer.inSpecialInteractAnimation)
{
float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position);
if (num > 25f)
{
base.targetPlayer = null;
}
else
{
((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true);
}
}
PlayerControllerB val4 = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(270f, 23, -1, 0f);
if ((Object)(object)val4 != (Object)null && !val4.isPlayerDead && val4.isInsideFactory && currentStamina > 0f && (Object)(object)base.targetPlayer != (Object)(object)val4)
{
base.targetPlayer = val4;
ScareClientAmount(base.targetPlayer.actualClientId, 0.4f);
((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true);
}
else if (currentStamina > 0f && (Object)(object)base.targetPlayer == (Object)null)
{
if ((Object)(object)val4 != (Object)null)
{
((EnemyAI)this).TargetClosestPlayer(0f, false, 70f);
break;
}
running = false;
changeInAnimationStateNeeded = true;
((EnemyAI)this).SwitchToBehaviourState(0);
}
break;
}
case 3:
if (base.moveTowardsDestination || base.movingTowardsTargetPlayer)
{
base.movingTowardsTargetPlayer = false;
base.moveTowardsDestination = false;
base.targetPlayer = null;
base.destination = ((Component)this).transform.position;
forward = false;
}
if (currentStamina >= maxStamina)
{
sitting = false;
standing = true;
forward = true;
changeInAnimationStateNeeded = true;
if (currentFrustration >= maxFrustration)
{
SwitchToEnrage();
((EnemyAI)this).SwitchToBehaviourState(4);
}
else
{
((EnemyAI)this).SwitchToBehaviourState(0);
}
}
break;
case 4:
if (currentStamina <= 0f)
{
if (huggySearch.inProgress)
{
((EnemyAI)this).StopSearch(huggySearch, true);
}
SwitchToWandering();
((EnemyAI)this).SwitchToBehaviourState(0);
}
if (!charging)
{
if (!huggySearch.inProgress)
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, huggySearch);
}
PlayerControllerB val5 = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(150f, 23, -1, 0f);
if ((Object)(object)val5 != (Object)null && !val5.isPlayerDead && val5.isInsideFactory && !val5.inSpecialInteractAnimation)
{
ScareClientAmount(val5.actualClientId, 0.75f);
((EnemyAI)this).StopSearch(huggySearch, true);
SwitchToCharging();
((EnemyAI)this).TargetClosestPlayer(0f, true, 360f);
}
}
else if ((Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.inSpecialInteractAnimation && !base.targetPlayer.isPlayerDead && base.targetPlayer.isInsideFactory)
{
if (Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position) > 27f)
{
PlayerControllerB val6 = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(360f, 24, -1, 0f);
if ((Object)(object)val6 != (Object)null && !val6.isPlayerDead && val6.isInsideFactory && !val6.inSpecialInteractAnimation)
{
((EnemyAI)this).TargetClosestPlayer(0f, true, 360f);
}
else
{
charging = false;
}
break;
}
((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true);
if (Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position) < 1.4f && canJumpscare)
{
ScareClientAmount(base.targetPlayer.actualClientId, 1f);
SwitchToJumpscare(base.targetPlayer.actualClientId);
}
}
else
{
PlayerControllerB val7 = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(360f, 24, -1, 0f);
if ((Object)(object)val7 != (Object)null)
{
((EnemyAI)this).TargetClosestPlayer(0f, true, 360f);
}
else
{
charging = false;
}
}
break;
case 5:
if (currentRetreatTime >= retreatTime)
{
validRetreatSpot = false;
if (currentFrustration > maxFrustration)
{
SwitchToEnrage();
((EnemyAI)this).SwitchToBehaviourState(4);
}
else if (base.previousBehaviourStateIndex == 1)
{
SwitchToWandering();
((EnemyAI)this).SwitchToBehaviourState(0);
}
else if (base.previousBehaviourStateIndex == 2)
{
SwitchToRegularChasing();
((EnemyAI)this).SwitchToBehaviourState(2);
}
}
else if (!validRetreatSpot)
{
idealRetreatSpotPosition = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)GetClosestPlayerFixed(((Component)this).transform.position)).transform.position, false, 0, false).position;
((EnemyAI)this).SetDestinationToPosition(((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)GetClosestPlayerFixed(((Component)this).transform.position)).transform.position, false, 0, false).position, true);
currentFrustration += 0.65f;
validRetreatSpot = true;
}
else if ((int)base.path1.status == 2)
{
validRetreatSpot = false;
}
break;
}
}
public override void Update()
{
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: 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_0158: 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_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (changeInAnimationStateNeeded)
{
UpdateAnimationStates();
}
switch (base.currentBehaviourStateIndex)
{
case 0:
currentWanderingTime += Time.deltaTime;
if (currentStamina < maxStamina)
{
currentStamina += Time.deltaTime * 0.5f;
}
if (!forward && ((NetworkBehaviour)this).IsHost)
{
forward = true;
changeInAnimationStateNeeded = true;
}
break;
case 1:
break;
case 2:
currentStamina -= Time.deltaTime;
if ((Object)(object)base.targetPlayer != (Object)null && (double)Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 1.5 && !attacking)
{
base.agent.velocity = Vector3.zero;
base.agent.speed = 0f;
Vector3 val = ((Component)base.targetPlayer).transform.position - ((Component)this).transform.position;
val.y = 0f;
((Component)this).transform.rotation = Quaternion.LookRotation(val);
int num = rng.Next(2);
((Collider)((Component)this).gameObject.GetComponent<BoxCollider>()).isTrigger = false;
switch (num)
{
case 0:
HuggySendStringClientRcp("Attacking");
base.creatureAnimator.SetTrigger("Attacking");
attacking = true;
break;
case 1:
HuggySendStringClientRcp("AttackingMirror");
base.creatureAnimator.SetTrigger("AttackingMirror");
attacking = true;
break;
}
ScareClientAmount(base.targetPlayer.actualClientId, 0.4f);
}
break;
case 3:
if (currentStamina < maxStamina)
{
currentStamina += Time.deltaTime;
}
break;
case 4:
if (!base.inSpecialAnimation)
{
currentStamina -= Time.deltaTime / 3f;
}
break;
case 5:
if (currentRetreatTime < retreatTime)
{
currentRetreatTime += Time.deltaTime;
}
break;
}
}
private void CheckAttackCollision()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: 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_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
((Collider)((Component)this).gameObject.GetComponent<BoxCollider>()).isTrigger = true;
if ((Object)(object)weaponSwingCheckArea != (Object)null && !StartOfRound.Instance.localPlayerController.isPlayerDead)
{
Bounds bounds = ((Collider)((Component)StartOfRound.Instance.localPlayerController).GetComponent<BoxCollider>()).bounds;
if (((Bounds)(ref bounds)).Intersects(((Collider)weaponSwingCheckArea).bounds))
{
PlayRandomSlashSound();
StartOfRound.Instance.localPlayerController.DamagePlayer(45, false, true, (CauseOfDeath)6, 0, false, default(Vector3));
StartOfRound.Instance.localPlayerController.DropBlood(default(Vector3), true, false);
}
}
}
private void PlayHuggyRoar()
{
//IL_0007: 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)
float num = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.localPlayerController).transform.position);
if (num < 4f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
StartOfRound.Instance.localPlayerController.JumpToFearLevel(1f, true);
}
else if (num < 11f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
StartOfRound.Instance.localPlayerController.JumpToFearLevel(0.7f, true);
}
else if (num < 25f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
StartOfRound.Instance.localPlayerController.JumpToFearLevel(0.35f, true);
}
}
private void PlayRandomFootstepSound()
{
if (footstepClips != null && (Object)(object)base.creatureSFX != (Object)null)
{
base.creatureSFX.pitch = (float)(1.0 - rng.NextDouble() / 14.0);
RoundManager.PlayRandomClip(base.creatureSFX, footstepClips, true, 0.7f, 0, 1000);
}
}
private void PlayRandomAttackVoiceSound()
{
if (attackVoiceClips != null && (Object)(object)voiceAudio != (Object)null)
{
voiceAudio.pitch = (float)(1.0 - rng.NextDouble() / 14.0);
RoundManager.PlayRandomClip(voiceAudio, attackVoiceClips, true, 3f, 0, 1000);
}
}
private void PlayRandomAttackSound()
{
if (attackSwingClips != null && (Object)(object)base.creatureSFX != (Object)null)
{
base.creatureSFX.pitch = (float)(1.0 - rng.NextDouble() / 14.0);
RoundManager.PlayRandomClip(base.creatureSFX, attackSwingClips, true, 2f, 0, 1000);
}
}
private void PlayRandomRoarSound()
{
if (roarClips != null && (Object)(object)voiceAudio != (Object)null)
{
voiceAudio.pitch = (float)(1.0 - rng.NextDouble() / 14.0);
int num = RoundManager.PlayRandomClip(voiceAudio, roarClips, true, 1f, 0, 1000);
if (roarFarClips != null && (Object)(object)voiceFarAudio != (Object)null)
{
RoundManager.PlayRandomClip(voiceFarAudio, roarFarClips, true, 4f, 0, 1000);
}
}
}
private void PlayRandomSitDownSound()
{
if (sitDownClips != null && (Object)(object)base.creatureSFX != (Object)null)
{
base.creatureSFX.pitch = (float)(1.0 - rng.NextDouble() / 14.0);
RoundManager.PlayRandomClip(base.creatureSFX, sitDownClips, true, 1f, 0, 1000);
}
}
private void PlayRandomSitUpSound()
{
if (sitUpClips != null && (Object)(object)base.creatureSFX != (Object)null)
{
base.creatureSFX.pitch = (float)(1.0 - rng.NextDouble() / 14.0);
RoundManager.PlayRandomClip(base.creatureSFX, sitUpClips, true, 1f, 0, 1000);
}
}
private void PlayRandomCrouchSound()
{
if (crouchClips != null && (Object)(object)base.creatureSFX != (Object)null)
{
base.creatureSFX.pitch = (float)(1.0 - rng.NextDouble() / 14.0);
RoundManager.PlayRandomClip(base.creatureSFX, crouchClips, true, 1f, 0, 1000);
}
}
private void PlayRandomSlashSound()
{
if (slashClips != null && (Object)(object)slashAudio != (Object)null)
{
slashAudio.pitch = (float)(1.0 - rng.NextDouble() / 14.0);
RoundManager.PlayRandomClip(slashAudio, slashClips, true, 1f, 0, 1000);
}
}
private void ResetAfterStanding()
{
switch (base.currentBehaviourStateIndex)
{
case 4:
base.agent.speed = 6.5f;
break;
case 2:
base.agent.speed = 4.5f;
break;
default:
base.agent.speed = 3f;
break;
}
}
private void ResetAfterAttacking()
{
attacking = false;
base.agent.speed = 4.5f;
}
private void SetStatsAfterRoaring()
{
base.agent.speed = 6.5f;
base.openDoorSpeedMultiplier = 100f;
canJumpscare = true;
}
private void ResetAfterJumpscare()
{
canJumpscare = false;
base.openDoorSpeedMultiplier = 1f;
base.inSpecialAnimation = false;
base.agent.speed = 3f;
currentFrustration = 0f;
standing = true;
forward = true;
running = false;
charging = false;
attacking = false;
sitting = false;
crouching = false;
changeInAnimationStateNeeded = true;
}
private void SwitchToWandering()
{
crouching = false;
forward = false;
running = false;
sitting = false;
standing = true;
charging = false;
base.agent.speed = 3f;
changeInAnimationStateNeeded = true;
}
private void SwitchToCreeping()
{
currentWanderingTime = 0f;
atHidingPosition = false;
hidingPositionFound = false;
hidingPositionNoPlayers = true;
((EnemyAI)this).StopSearch(huggySearch, true);
FindHidingSpot();
crouching = true;
forward = true;
running = false;
sitting = false;
standing = false;
changeInAnimationStateNeeded = true;
base.agent.speed = 3f;
}
private void SwitchToRegularChasing()
{
crouching = false;
standing = true;
forward = true;
running = true;
atHidingPosition = false;
changeInAnimationStateNeeded = true;
base.agent.speed = 4.5f;
currentWanderingTime = 0f;
((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
((EnemyAI)this).StopSearch(huggySearch, true);
}
private void SwitchToSitting()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
base.targetPlayer = null;
standing = false;
forward = false;
running = false;
sitting = true;
crouching = false;
changeInAnimationStateNeeded = true;
currentFrustration += 1f;
base.agent.velocity = Vector3.zero;
base.agent.speed = 0f;
if (huggySearch.inProgress)
{
((EnemyAI)this).StopSearch(huggySearch, true);
}
}
private void SwitchToCharging()
{
HuggySendStringClientRcp("Charge");
base.creatureAnimator.SetTrigger("Charge");
base.agent.speed = 0f;
forward = true;
running = false;
charging = true;
crouching = false;
sitting = false;
changeInAnimationStateNeeded = true;
}
private void SwitchToRetreating(float retreatTime)
{
this.retreatTime = retreatTime;
currentRetreatTime = 0f;
base.agent.speed = 5f;
standing = true;
crouching = false;
forward = true;
running = true;
changeInAnimationStateNeeded = true;
}
private void SwitchToEnrage()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
sitting = false;
standing = true;
forward = true;
currentFrustration = 0f;
running = true;
base.agent.velocity = Vector3.zero;
currentStamina = maxStamina;
if (base.currentBehaviourStateIndex == 3)
{
base.agent.speed = 0f;
}
else
{
base.agent.speed = 6.5f;
}
changeInAnimationStateNeeded = true;
}
private PlayerControllerB GetClosestPlayerFixed(Vector3 toThisPosition)
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB result = null;
float num = 10000f;
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
if (!StartOfRound.Instance.allPlayerScripts[i].isPlayerDead && StartOfRound.Instance.allPlayerScripts[i].isInsideFactory && !StartOfRound.Instance.allPlayerScripts[i].inSpecialInteractAnimation)
{
float num2 = Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position, toThisPosition);
if (num2 < num)
{
result = StartOfRound.Instance.allPlayerScripts[i];
num = num2;
}
}
}
return result;
}
private bool GetAnyPlayerLooking(Vector3 atPosition, int range = 60)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
if (!StartOfRound.Instance.allPlayerScripts[i].isPlayerDead && StartOfRound.Instance.allPlayerScripts[i].isInsideFactory && !StartOfRound.Instance.allPlayerScripts[i].inSpecialInteractAnimation && StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(atPosition, 90f, range, -1f))
{
playerLooking = StartOfRound.Instance.allPlayerScripts[i];
return true;
}
}
playerLooking = null;
return false;
}
private void FindHidingSpot()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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)
//IL_004f: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB closestPlayerFixed = GetClosestPlayerFixed(((Component)this).transform.position);
if ((Object)(object)closestPlayerFixed != (Object)null && (!hidingPositionFound || hidingPositionNoPlayers))
{
Vector3 position = ((Component)closestPlayerFixed).transform.position;
Vector3 position2 = ((EnemyAI)this).ChooseClosestNodeToPosition(position, true, 2).position;
hidingSpotPosition = position2;
hidingPositionFound = true;
hidingPositionNoPlayers = false;
atHidingPosition = false;
forward = true;
changeInAnimationStateNeeded = true;
}
else if (!hidingPositionFound)
{
forward = true;
changeInAnimationStateNeeded = true;
hidingSpotPosition = idealHidingSpotPosition;
hidingPositionFound = true;
hidingPositionNoPlayers = true;
atHidingPosition = false;
}
}
private void RevalidateHidingSpot()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
GetAnyPlayerLooking(((Component)this).transform.position, 20);
PlayerControllerB closestPlayerFixed = GetClosestPlayerFixed(((Component)this).transform.position);
if ((Object)(object)playerLooking != (Object)null)
{
float num = Vector3.Distance(((Component)playerLooking).transform.position, ((Component)this).transform.position);
hidingPositionFound = false;
hidingPositionNoPlayers = true;
base.agent.avoidancePriority = 49;
if (num < 7f)
{
ScareClientAmount(playerLooking.actualClientId, 0.5f);
SwitchToRegularChasing();
((EnemyAI)this).SwitchToBehaviourState(2);
}
else
{
ScareClientAmount(playerLooking.actualClientId, 0.35f);
SwitchToRetreating(8f);
((EnemyAI)this).SwitchToBehaviourState(5);
}
return;
}
FindHidingSpot();
GetAnyPlayerLooking(hidingSpotPosition, 9);
if ((Object)(object)playerLooking != (Object)null)
{
hidingPositionFound = false;
}
if ((Object)(object)closestPlayerFixed != (Object)null)
{
float num2 = Vector3.Distance(((Component)closestPlayerFixed).transform.position, ((Component)this).transform.position);
if (num2 > 15f)
{
hidingPositionFound = false;
}
}
}
private void SwitchToJumpscare(ulong playerID)
{
//IL_008d: 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)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: 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_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
{
HuggySendStringClientRcp("Jumpscare");
HuggySendStringClientRcp("Jumpscare:" + playerID);
base.creatureAnimator.SetTrigger("Jumpscare");
}
RoundManager.PlayRandomClip(base.creatureSFX, jumpscareClips, false, 1.5f, 0, 1000);
base.agent.speed = 0f;
currentFrustration = 0f;
base.agent.velocity = Vector3.zero;
charging = false;
changeInAnimationStateNeeded = true;
base.inSpecialAnimationWithPlayer = StartOfRound.Instance.allPlayerScripts[playerID];
base.targetPlayer = base.inSpecialAnimationWithPlayer;
if ((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null)
{
base.inSpecialAnimation = true;
base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = true;
base.inSpecialAnimationWithPlayer.snapToServerPosition = true;
base.inSpecialAnimationWithPlayer.disableLookInput = true;
base.inSpecialAnimationWithPlayer.DropAllHeldItems(true, false);
Vector3 val = ((Component)base.targetPlayer).transform.position - ((Component)this).transform.position;
val.y = 0f;
((Component)this).transform.rotation = Quaternion.LookRotation(val);
Vector3 val2 = ((Component)this).transform.position - ((Component)base.targetPlayer).transform.position;
val2.y = 0f;
((Component)base.inSpecialAnimationWithPlayer).transform.rotation = Quaternion.LookRotation(val);
jumpscareAnimation = ((MonoBehaviour)this).StartCoroutine(JumpScareAnimation());
}
}
private IEnumerator JumpScareAnimation()
{
float elapsedTime = 0f;
while (elapsedTime < 1f)
{
Vector3 diff2 = ((Component)this).transform.position - ((Component)base.targetPlayer).transform.position;
diff2.y = 0f;
((Component)base.inSpecialAnimationWithPlayer).transform.position = jumpScarePoint.position;
((Component)base.inSpecialAnimationWithPlayer).transform.rotation = Quaternion.LookRotation(diff2);
base.inSpecialAnimationWithPlayer.ResetFallGravity();
elapsedTime += Time.deltaTime;
yield return null;
}
EndJumpscareAnimation();
}
private IEnumerator WaitAfterJumpscare()
{
yield return (object)new WaitForSeconds(3f);
ResetAfterJumpscare();
((EnemyAI)this).SwitchToBehaviourState(0);
}
private void EndJumpscareAnimation()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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_0093: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)base.inSpecialAnimationWithPlayer))
{
forward = false;
base.inSpecialAnimationWithPlayer.DropBlood(Vector3.forward, true, false);
base.inSpecialAnimationWithPlayer.DropBlood(Vector3.left, true, false);
base.inSpecialAnimationWithPlayer.DropBlood(Vector3.right, true, false);
base.inSpecialAnimationWithPlayer.DropBlood(Vector3.up, true, false);
base.inSpecialAnimationWithPlayer.DropBlood(Vector3.back, true, false);
base.inSpecialAnimationWithPlayer.DropBlood(Vector3.down, true, false);
base.inSpecialAnimationWithPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)4, 1);
base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = false;
base.inSpecialAnimationWithPlayer.snapToServerPosition = false;
base.inSpecialAnimationWithPlayer.disableLookInput = false;
base.inSpecialAnimationWithPlayer = null;
changeInAnimationStateNeeded = true;
}
waitingRoutine = ((MonoBehaviour)this).StartCoroutine(WaitAfterJumpscare());
}
private void formStateArray()
{
statesArray = new string[8]
{
sitting.ToString(),
standing.ToString(),
crouching.ToString(),
forward.ToString(),
running.ToString(),
charging.ToString(),
attacking.ToString(),
jumpscaring.ToString()
};
}
[ClientRpc]
private void UpdateAnimationState(string[] states)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Invalid comparison between Unknown and I4
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2947720591u, val, (RpcDelivery)0);
bool flag = states != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
int num = states.Length;
((FastBufferWriter)(ref val2)).WriteValueSafe<int>(ref num, default(ForPrimitives));
for (int i = 0; i < states.Length; i++)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(states[i], false);
}
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2947720591u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && networkManager.IsClient && !((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
{
sitting = bool.Parse(states[0]);
standing = bool.Parse(states[1]);
crouching = bool.Parse(states[2]);
forward = bool.Parse(states[3]);
running = bool.Parse(states[4]);
UpdateAnimationStates();
charging = bool.Parse(states[5]);
attacking = bool.Parse(states[6]);
jumpscaring = bool.Parse(states[7]);
}
}
private void UpdateAnimationStates()
{
if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
{
formStateArray();
UpdateAnimationState(statesArray);
}
base.creatureAnimator.SetBool("Sitting", sitting);
base.creatureAnimator.SetBool("Standing", standing);
base.creatureAnimator.SetBool("Crouching", crouching);
base.creatureAnimator.SetBool("Forward", forward);
base.creatureAnimator.SetBool("Running", running);
changeInAnimationStateNeeded = false;
}
private void ProcessScareClientAmount(ulong clientID, float amount)
{
if (StartOfRound.Instance.localPlayerController.actualClientId == clientID)
{
StartOfRound.Instance.localPlayerController.JumpToFearLevel(amount, true);
}
}
private void ScareClientAmount(ulong clientID, float amount)
{
string informationString = "Scare:" + clientID + "," + amount;
HuggySendStringClientRcp(informationString);
}
private static void __rpc_handler_2947720591(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (!((Object)(object)networkManager != (Object)null) || !networkManager.IsListening)
{
return;
}
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string[] array = null;
if (flag)
{
int num = default(int);
((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
array = new string[num];
for (int i = 0; i < num; i++)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref array[i], false);
}
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((HuggyAI)(object)target).UpdateAnimationState(array);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
[ClientRpc]
private void HuggySendStringClientRcp(string informationString)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Invalid comparison between Unknown and I4
//IL_004b: 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)
//IL_0059: 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)
//IL_006c: 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_0096: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1345740394u, val, (RpcDelivery)0);
bool flag = informationString != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(informationString, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1345740394u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && networkManager.IsClient && !((NetworkBehaviour)this).IsServer && !((NetworkBehaviour)this).IsHost)
{
InterpretRpcString(informationString);
}
}
private void InterpretRpcString(string informationString)
{
if (informationString.Contains("Jumpscare:"))
{
string s = informationString.Replace("Jumpscare:", "");
ulong playerID = (ulong)int.Parse(s);
SwitchToJumpscare(playerID);
}
if (informationString.Contains("Scare:"))
{
string[] array = informationString.Replace("Scare:", "").Split(",");
if (array.Length == 2)
{
ulong clientID = (ulong)int.Parse(array[0]);
ProcessScareClientAmount(clientID, (float)double.Parse(array[1]));
}
}
switch (informationString)
{
case "Attacking":
((Collider)((Component)this).gameObject.GetComponent<BoxCollider>()).isTrigger = false;
base.creatureAnimator.SetTrigger(informationString);
break;
case "AttackingMirror":
((Collider)((Component)this).gameObject.GetComponent<BoxCollider>()).isTrigger = false;
base.creatureAnimator.SetTrigger(informationString);
break;
case "Jumpscare":
forward = true;
base.creatureAnimator.SetTrigger(informationString);
break;
case "Charge":
base.creatureAnimator.SetTrigger(informationString);
break;
}
}
private static void __rpc_handler_1345740394(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
bool flag = false;
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string informationString = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref informationString, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((HuggyAI)(object)target).HuggySendStringClientRcp(informationString);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_HuggyAI()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(2947720591u, new RpcReceiveHandler(__rpc_handler_2947720591));
NetworkManager.__rpc_func_table.Add(1345740394u, new RpcReceiveHandler(__rpc_handler_1345740394));
}
}
[BepInPlugin("Nuclear_Fox.LethalPlaytime", "LethalPlaytime", "1.1.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class LethalPlaytime : BaseUnityPlugin
{
public static LethalPlaytime 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;
NetcodePatcher();
Patch();
PlaytimeConfig.ConfigureAndRegisterAssets(Instance);
Logger.LogInfo((object)"Nuclear_Fox.LethalPlaytime v1.1.3 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("Nuclear_Fox.LethalPlaytime");
}
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!");
}
private void NetcodePatcher()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
internal ConfigEntry<int> CreateIntSliderConfig(string itemName, int defaultRarity, string description, int sliderMin, int sliderMax, string configCategory)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
//IL_0071: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>(configCategory, itemName, defaultRarity, description + " [" + sliderMin + "-" + sliderMax + "]");
IntSliderOptions val2 = new IntSliderOptions
{
RequiresRestart = true
};
((BaseRangeOptions<int>)val2).Min = sliderMin;
((BaseRangeOptions<int>)val2).Max = sliderMax;
IntSliderConfigItem val3 = new IntSliderConfigItem(val, val2);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3);
return val;
}
}
public class MissDelightAI : EnemyAI
{
private enum BehaviorState
{
Searching,
Chasing,
Swinging,
Doorbusting
}
public AISearchRoutine searchForPlayers;
public bool deadlyWeapon = false;
public float minStopInterval = 0.15f;
public float currentStopInterval = 0f;
public float timeSinceLookedAt = 10f;
public float reservedAgentMovementSpeed = 2.5f;
public float reservedAgentAnimationSpeed = 1f;
public float agentSpeedIncrement = 0.75f;
public float agentAnimationSpeedIncrement = 0.25f;
public float timeToLaugh = 12f;
public double timeExisting = 0.0;
public double timeToIncrement = 55.0;
public int timeToLaughMax = 15;
public int timeToLaughMin = 8;
public int swingCount = 0;
public int maxSwingSpeedBoost = 7;
public bool canSendLookCheck = true;
public bool canBeFrozen = true;
public bool isFrozen = false;
public bool doorTrigger = false;
public SphereCollider weaponCollider;
private Random rngGenerator;
public AudioSource weaponAudioPoint;
public AudioClip[] weaponImpactClips;
public AudioClip[] footstepClips;
public AudioClip[] weaponSwingVoiceClips;
public AudioClip[] weaponSwingClip;
public AudioClip[] laughClips;
public AudioClip[] growlClips;
public AudioClip[] doorSmashClips;
public override void Start()
{
((EnemyAI)this).Start();
rngGenerator = new Random(StartOfRound.Instance.randomMapSeed + 1337);
}
public override void DoAIInterval()
{
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: 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_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (StartOfRound.Instance.allPlayersDead)
{
return;
}
if (!((NetworkBehaviour)this).IsServer)
{
((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
}
switch (base.currentBehaviourStateIndex)
{
case 0:
{
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
if (!StartOfRound.Instance.allPlayerScripts[i].isPlayerDead && StartOfRound.Instance.allPlayerScripts[i].isInsideFactory && ((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && !Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position) < 30f)
{
((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
base.movingTowardsTargetPlayer = true;
((EnemyAI)this).SwitchToBehaviourState(1);
return;
}
}
if (!searchForPlayers.inProgress)
{
base.movingTowardsTargetPlayer = false;
((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayers);
}
break;
}
case 1:
if (searchForPlayers.inProgress)
{
((EnemyAI)this).StopSearch(searchForPlayers, true);
}
if ((Object)(object)base.targetPlayer != (Object)null)
{
float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position);
if ((Object)(object)base.targetPlayer != (Object)null && ((NetworkBehaviour)this).IsOwner)
{
((Component)this).gameObject.GetComponent<NavMeshAgent>().angularSpeed = 900f;
if (!isFrozen)
{
if (num < 1.85f)
{
Vector3 forward = ((Component)this).transform.forward;
Vector3 val = ((Component)base.targetPlayer).transform.position - ((Component)this).transform.position;
if (Vector3.Angle(forward, ((Vector3)(ref val)).normalized) < 9f)
{
goto IL_02be;
}
}
if (num < 0.8f)
{
goto IL_02be;
}
}
if (num < 2f)
{
((Component)this).gameObject.GetComponent<NavMeshAgent>().angularSpeed = 4000f;
}
else
{
((Component)this).gameObject.GetComponent<NavMeshAgent>().angularSpeed = 900f;
}
}
}
if ((Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isPlayerDead)
{
if ((Object)(object)((EnemyAI)this).GetClosestPlayer(false, false, false) != (Object)(object)base.targetPlayer)
{
Debug.Log((object)"Retargeted closer player.");
((EnemyAI)this).TargetClosestPlayer(30f, true, 270f);
}
if (!base.movingTowardsTargetPlayer)
{
base.movingTowardsTargetPlayer = true;
}
}
else
{
base.targetPlayer = null;
((EnemyAI)this).SwitchToBehaviourState(0);
}
break;
case 2:
break;
case 3:
break;
IL_02be:
((Component)this).gameObject.GetComponent<NavMeshAgent>().velocity = Vector3.zero;
base.movingTowardsTargetPlayer = false;
DoAnimationClientRpc("enterSwing");
break;
}
}
public override void Update()
{
//IL_01c3: 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_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Unknown result type (might be due to invalid IL or missing references)
//IL_033e: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (swingCount < maxSwingSpeedBoost)
{
timeExisting += Time.deltaTime;
if (timeExisting >= timeToIncrement && (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer))
{
DoAnimationClientRpc("incrementSwing");
timeExisting = 0.0;
}
}
if (base.isEnemyDead)
{
return;
}
timeSinceLookedAt += Time.deltaTime;
if (currentStopInterval > 0f)
{
currentStopInterval -= Time.deltaTime;
if (currentStopInterval <= 0f)
{
canSendLookCheck = true;
}
}
if (base.currentBehaviourStateIndex == 1 || (base.currentBehaviourStateIndex == 2 && isFrozen))
{
timeToLaugh -= Time.deltaTime;
if (timeToLaugh <= 0f)
{
PlayRandomLaughSound();
timeToLaugh = rngGenerator.Next(timeToLaughMin, timeToLaughMax);
}
}
if (canBeFrozen && (base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 0))
{
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
if (canSendLookCheck && ((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f) && Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, base.eye.position) > 0.3f)
{
canSendLookCheck = false;
currentStopInterval = minStopInterval;
FreezeDelightClientRcp("true");
}
}
}
if (((NetworkBehaviour)this).IsOwner && (double)timeSinceLookedAt > 0.25)
{
FreezeDelightClientRcp("false");
}
if (base.currentBehaviourStateIndex != 2 || !deadlyWeapon || isFrozen)
{
return;
}
for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++)
{
if (!StartOfRound.Instance.allPlayerScripts[j].isInsideFactory || StartOfRound.Instance.allPlayerScripts[j].isPlayerDead)
{
continue;
}
BoxCollider component = ((Component)StartOfRound.Instance.allPlayerScripts[j]).gameObject.GetComponent<BoxCollider>();
Bounds bounds = ((Collider)component).bounds;
Vector3 center = ((Bounds)(ref bounds)).center;
bounds = ((Collider)component).bounds;
Collider[] array = Physics.OverlapBox(center, ((Bounds)(ref bounds)).extents, ((Component)component).transform.rotation);
Collider[] array2 = array;
foreach (Collider val in array2)
{
if ((Object)(object)val == (Object)(object)weaponCollider)
{
StartOfRound.Instance.allPlayerScripts[j].DamagePlayer(200, true, true, (CauseOfDeath)1, 0, false, new Vector3(0f, -600f, 0f));
Debug.Log((object)("Miss delight hit " + ((Object)StartOfRound.Instance.allPlayerScripts[j]).name));
}
}
}
}
public void HandleDoorTrigger()
{
if (!doorTrigger && (base.currentBehaviourStateIndex == 0 || base.currentBehaviourStateIndex == 1))
{
DoAnimationClientRpc("enterDoor");
}
}
private void PlayRandomWeaponSwing()
{
if (weaponSwingClip != null && (Object)(object)base.creatureVoice != (Object)null)
{
RoundManager.PlayRandomClip(base.creatureVoice, weaponSwingClip, true, 1f, 0, 1000);
}
}
private void PlayRandomWeaponSwingVoiceSound()
{
if (weaponSwingVoiceClips != null && (Object)(object)base.creatureVoice != (Object)null)
{
RoundManager.PlayRandomClip(base.creatureVoice, weaponSwingVoiceClips, true, 1f, 0, 1000);
if (doorTrigger && base.currentBehaviourStateIndex != 2)
{
PlayDoorSmashOpenSound();
}
}
}
private void PlayDoorSmashOpenSound()
{
if (doorSmashClips != null && (Object)(object)base.creatureVoice != (Object)null)
{
RoundManager.PlayRandomClip(base.creatureVoice, doorSmashClips, true, 1f, 0, 1000);
}
}
private void PlayRandomWeaponImpactSound()
{
if (weaponImpactClips != null && (Object)(object)weaponAudioPoint != (Object)null)
{
RoundManager.PlayRandomClip(weaponAudioPoint, weaponImpactClips, true, 1f, 0, 1000);
ShakeScreenNearbyPlayer(GetDistanceFromPlayer());
}
}
private void ShakeScreenNearbyPlayer(float distance)
{
if (distance < 10f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
private float GetDistanceFromPlayer()
{
//IL_0007: 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)
return Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position);
}
private void PlayRandomFootStepSound()
{
if (footstepClips != null && (Object)(object)base.creatureSFX != (Object)null)
{
RoundManager.PlayRandomClip(base.creatureSFX, footstepClips, true, 1f, 0, 1000);
}
}
private void PlayRandomLaughSound()
{
if (!isFrozen)
{
if (laughClips != null && (Object)(object)base.creatureSFX != (Object)null)
{
RoundManager.PlayRandomClip(base.creatureSFX, laughClips, true, 1f, 0, 1000);
}
return;
}
switch (rngGenerator.Next(2))
{
case 0:
RoundManager.PlayRandomClip(base.creatureSFX, laughClips, true, 1f, 0, 1000);
break;
case 1:
RoundManager.PlayRandomClip(base.creatureSFX, growlClips, true, 1f, 0, 1000);
break;
}
}
private void PlayRandomGrowlSound()
{
if (growlClips != null && (Object)(object)base.creatureSFX != (Object)null)
{
RoundManager.PlayRandomClip(base.creatureSFX, growlClips, true, 1f, 0, 1000);
}
}
[ClientRpc]
private void DoAnimationClientRpc(string animationName)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Invalid comparison between Unknown and I4
//IL_004b: 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)
//IL_0059: 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)
//IL_006c: 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_0096: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1947720646u, val, (RpcDelivery)0);
bool flag = animationName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1947720646u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
PerformAnimationSwitchWithImplications(animationName);
}
}
[ClientRpc]
private void ChangeWeaponDeadlyStateClientRpc(string valueToSetAsString)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Invalid comparison between Unknown and I4
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Invalid comparison between Unknown and I4
//IL_004c: 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_005a: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(947720646u, val, (RpcDelivery)0);
bool flag = valueToSetAsString != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(valueToSetAsString, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 947720646u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
bool valueAsBool = bool.Parse(valueToSetAsString);
ChangeWeaponDeadlyState(valueAsBool);
}
}
[ClientRpc]
private void FreezeDelightClientRcp(string freezeStateString)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Invalid comparison between Unknown and I4
//IL_004b: 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)
//IL_0059: 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)
//IL_006c: 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_0096: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2947720646u, val, (RpcDelivery)0);
bool flag = freezeStateString != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(freezeStateString, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2947720646u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
TryFreezeDelight(bool.Parse(freezeStateString));
}
}
private void ChangeWeaponDeadlyState(bool valueAsBool)
{
deadlyWeapon = valueAsBool;
}
private void ScareClosePlayer(float distance, float fearLevel)
{
//IL_0007: 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)
float num = Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position);
if (num < distance)
{
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(fearLevel, true);
}
}
private void PerformAnimationSwitchWithImplications(string animationName)
{
switch (animationName)
{
case "enterSwing":
base.creatureAnimator.SetTrigger(animationName);
((EnemyAI)this).SwitchToBehaviourState(2);
reservedAgentMovementSpeed = base.agent.speed;
base.agent.speed = 0f;
ScareClosePlayer(2.5f, 0.7f);
break;
case "exitSwing":
base.creatureAnimator.SetTrigger(animationName);
((EnemyAI)this).SwitchToBehaviourState(1);
if (swingCount < maxSwingSpeedBoost)
{
swingCount++;
}
base.agent.speed = 2.5f + (float)swingCount * agentSpeedIncrement;
base.creatureAnimator.speed = 1f + (float)swingCount * agentAnimationSpeedIncrement;
break;
case "enterDoor":
((EnemyAI)this).SwitchToBehaviourState(3);
base.creatureAnimator.SetTrigger(animationName);
base.openDoorSpeedMultiplier = 3f;
base.agent.speed = 0f;
base.creatureAnimator.speed = 1f + (float)swingCount * agentAnimationSpeedIncrement;
if (isFrozen)
{
isFrozen = false;
}
canBeFrozen = false;
break;
case "exitDoor":
base.agent.speed = 1f + (float)swingCount * agentSpeedIncrement;
base.creatureAnimator.SetTrigger(animationName);
base.openDoorSpeedMultiplier = 1f;
((EnemyAI)this).SwitchToBehaviourState(1);
canBeFrozen = true;
doorTrigger = false;
break;
case "incrementSwing":
if (swingCount < maxSwingSpeedBoost)
{
swingCount++;
if (!isFrozen && base.agent.speed != 0f)
{
base.agent.speed = 2.5f + (float)swingCount * agentSpeedIncrement;
base.creatureAnimator.speed = 1f + (float)swingCount * agentAnimationSpeedIncrement;
}
}
break;
}
}
private void TryFreezeDelight(bool freezeRequest)
{
if (freezeRequest && isFrozen)
{
timeSinceLookedAt = 0f;
}
else if (freezeRequest && !isFrozen && !base.agent.isOnOffMeshLink)
{
timeSinceLookedAt = 0f;
isFrozen = true;
reservedAgentMovementSpeed = base.agent.speed;
reservedAgentAnimationSpeed = base.creatureAnimator.speed;
base.agent.speed = 0f;
base.creatureAnimator.speed = 0f;
}
else if (!freezeRequest && isFrozen)
{
base.agent.speed = reservedAgentMovementSpeed;
base.creatureAnimator.speed = reservedAgentAnimationSpeed;
isFrozen = false;
}
}
private static void __rpc_handler_1947720646(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
bool flag = false;
((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)2;
((MissDelightAI)(object)target).DoAnimationClientRpc(animationName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_weaponswing_0947720646(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
bool flag = false;
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string valueToSetAsString = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref valueToSetAsString, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((MissDelightAI)(object)target).ChangeWeaponDeadlyStateClientRpc(valueToSetAsString);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_freezeDelight_2947720646(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
bool flag = false;
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string freezeStateString = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref freezeStateString, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((MissDelightAI)(object)target).FreezeDelightClientRcp(freezeStateString);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_MissDelight()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(1947720646u, new RpcReceiveHandler(__rpc_handler_1947720646));
NetworkManager.__rpc_func_table.Add(947720646u, new RpcReceiveHandler(__rpc_handler_weaponswing_0947720646));
NetworkManager.__rpc_func_table.Add(2947720646u, new RpcReceiveHandler(__rpc_handler_freezeDelight_2947720646));
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Nuclear_Fox.LethalPlaytime";
public const string PLUGIN_NAME = "LethalPlaytime";
public const string PLUGIN_VERSION = "1.1.3";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}