using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DigitalRuby.ThunderAndLightning; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalCompanyInputUtils.BindingPathEnums; using LethalLib.Modules; using LethalMon; using LethalMon.Behaviours; using LethalMon.CatchableEnemy; using LethalMon.Compatibility; using LethalMon.CustomPasses; using LethalMon.Items; using LethalMon.NetcodePatcher; using LethalMon.Patches; using LethalMon.Throw; using Microsoft.CodeAnalysis; using ModelReplacement; using ModelReplacement.Monobehaviors.Enemies; using Newtonsoft.Json; using TMPro; using TerminalApi; using TerminalApi.Classes; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.Rendering.RendererUtils; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalMon")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+4aca66cbd2fa774e84486d5ec3c4493a5dd7efe3")] [assembly: AssemblyProduct("LethalMon")] [assembly: AssemblyTitle("LethalMon")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class { static () { NetworkVariableSerializationTypes.InitializeSerializer_FixedString(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); NetworkVariableSerializationTypes.InitializeSerializer_FixedString(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); } } 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; } } } internal class SeeThroughCustomPass : CustomPass { public Material seeThroughMaterial = new Material(Utils.WireframeMaterial); public LayerMask seeThroughLayer; public float maxVisibilityDistance = 20f; [SerializeField] private Shader stencilShader = Utils.SeeThroughShader; private Material stencilMaterial; private ShaderTagId[] shaderTags; protected override bool executeInSceneView => true; public void ConfigureMaterial(Color edgeColor, Color fillColor, float thickness) { //IL_000b: 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) seeThroughMaterial.SetColor("_EdgeColor", edgeColor); seeThroughMaterial.SetColor("_MainColor", fillColor); seeThroughMaterial.SetFloat("_WireframeVal", thickness); } protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) { //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_0030: 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_0041: 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_0052: 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) stencilMaterial = CoreUtils.CreateEngineMaterial(stencilShader); shaderTags = (ShaderTagId[])(object)new ShaderTagId[4] { new ShaderTagId("Forward"), new ShaderTagId("ForwardOnly"), new ShaderTagId("SRPDefaultUnlit"), new ShaderTagId("FirstPass") }; } protected override void Execute(CustomPassContext ctx) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //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_003d: 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_006b: 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_0071: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) stencilMaterial.SetInt("_StencilWriteMask", 64); seeThroughMaterial.SetFloat("_MaxVisibilityDistance", maxVisibilityDistance); RenderObjects(ctx.renderContext, ctx.cmd, stencilMaterial, 0, (CompareFunction)4, ctx.cullingResults, ctx.hdCamera); StencilState value = default(StencilState); ((StencilState)(ref value))..ctor(true, (byte)64, byte.MaxValue, (CompareFunction)3, (StencilOp)0, (StencilOp)0, (StencilOp)0); RenderObjects(ctx.renderContext, ctx.cmd, seeThroughMaterial, seeThroughMaterial.FindPass("ForwardOnly"), (CompareFunction)7, ctx.cullingResults, ctx.hdCamera, value); } public override IEnumerable RegisterMaterialForInspector() { yield return seeThroughMaterial; } private void RenderObjects(ScriptableRenderContext renderContext, CommandBuffer cmd, Material overrideMaterial, int passIndex, CompareFunction depthCompare, CullingResults cullingResult, HDCamera hdCamera, StencilState? overrideStencil = null) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) RendererListDesc val = default(RendererListDesc); ((RendererListDesc)(ref val))..ctor(shaderTags, cullingResult, hdCamera.camera); val.rendererConfiguration = (PerObjectData)0; val.renderQueueRange = RenderQueueRange.all; val.sortingCriteria = (SortingCriteria)4; val.excludeObjectMotionVectors = false; val.overrideMaterial = overrideMaterial; val.overrideMaterialPassIndex = passIndex; val.layerMask = LayerMask.op_Implicit(seeThroughLayer); RenderStateBlock value = default(RenderStateBlock); ((RenderStateBlock)(ref value))..ctor((RenderStateMask)4); ((RenderStateBlock)(ref value)).depthState = new DepthState(true, depthCompare); val.stateBlock = value; RendererListDesc val2 = val; if (overrideStencil.HasValue) { RenderStateBlock value2 = val2.stateBlock.Value; ((RenderStateBlock)(ref value2)).mask = (RenderStateMask)(((RenderStateBlock)(ref value2)).mask | 8); ((RenderStateBlock)(ref value2)).stencilState = overrideStencil.Value; val2.stateBlock = value2; } CoreUtils.DrawRendererList(renderContext, cmd, ((ScriptableRenderContext)(ref renderContext)).CreateRendererList(val2)); } protected override void Cleanup() { } } namespace LethalMon { public sealed class ModConfig : LcInputActions { public struct ConfigValues { public int Tier1BallSpawnWeight { get; set; } public int Tier2BallSpawnWeight { get; set; } public int Tier3BallSpawnWeight { get; set; } public int Tier4BallSpawnWeight { get; set; } public int Tier1BallCost { get; set; } public int Tier2BallCost { get; set; } public int Tier3BallCost { get; set; } public int Tier4BallCost { get; set; } public string KeepBallsIfAllPlayersDead { get; set; } public int CaptureRateModifier { get; set; } public string[] DisabledMonsters { get; set; } public bool MonstersReactToFailedCaptures { get; set; } public float BrackenGrabCooldown { get; set; } public float DressGirlTeleportCooldown { get; set; } public float HoardingBugBringItemCooldown { get; set; } public float FoxTongueHitCooldown { get; set; } public float EyelessDogHowlCooldown { get; set; } public float MaskedLendCooldown { get; set; } } [HarmonyPatch] public class SyncHandshake { private const string REQUEST_MESSAGE = "LethalMon_HostConfigRequested"; private const string RECEIVE_MESSAGE = "LethalMon_HostConfigReceived"; [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void Initialize(PlayerControllerB __instance) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown if ((Object)(object)Utils.CurrentPlayer == (Object)(object)__instance) { if (Utils.IsHost) { Debug.Log((object)"Current player is the host."); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("LethalMon_HostConfigRequested", new HandleNamedMessageDelegate(HostConfigRequested)); Instance.values = Instance.originalValues; ProcessValues(); } else { Debug.Log((object)"Current player is not the host."); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("LethalMon_HostConfigReceived", new HandleNamedMessageDelegate(HostConfigReceived)); RequestHostConfig(); } } } public static void RequestHostConfig() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!Utils.IsHost) { Debug.Log((object)"Sending config request to host."); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("LethalMon_HostConfigRequested", 0uL, new FastBufferWriter(0, (Allocator)2, -1), (NetworkDelivery)3); } else { Debug.Log((object)"Config request not required. No other player available."); } } public static void HostConfigRequested(ulong clientId, FastBufferReader reader) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!Utils.IsHost) { return; } string text = JsonConvert.SerializeObject((object)Instance.values); Debug.Log((object)("Client [" + clientId + "] requested host config. Sending own config: " + text)); int writeSize = FastBufferWriter.GetWriteSize(text, false); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(writeSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe(text, false); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("LethalMon_HostConfigReceived", clientId, val, (NetworkDelivery)4); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void HostConfigReceived(ulong clientId, FastBufferReader reader) { string text = default(string); ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); Debug.Log((object)("Received host config: " + text)); ConfigValues values = JsonConvert.DeserializeObject(text); Instance.values = values; ProcessValues(); } } public ConfigValues values; public ConfigValues originalValues; private static ModConfig instance; public InputAction RetrieveBallKey => ((LcInputActions)this).Asset["retreiveBallKey"]; public InputAction ActionKey1 => ((LcInputActions)this).Asset["actionKey1"]; public static ModConfig Instance { get { if (instance == null) { instance = new ModConfig(); } return instance; } } public void Setup() { values.Tier1BallCost = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Items", "Tier1BallCost", 40, "The cost of the tier 1 ball (pokeball) item in the shop. -1 to disable").Value; values.Tier2BallCost = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Items", "Tier2BallCost", 125, "The cost of the tier 1 ball (great ball) item in the shop. -1 to disable").Value; values.Tier3BallCost = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Items", "Tier3BallCost", 375, "The cost of the tier 1 ball (ultra ball) item in the shop. -1 to disable").Value; values.Tier4BallCost = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Items", "Tier4BallCost", 700, "The cost of the tier 1 ball (master ball) item in the shop. -1 to disable").Value; values.Tier1BallSpawnWeight = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Items", "Tier1BallSpawnWeight", 20, "The spawn weight of the tier 1 ball (pokeball). Higher = more common").Value; values.Tier2BallSpawnWeight = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Items", "Tier2BallSpawnWeight", 10, "The spawn weight of the tier 2 ball (great ball). Higher = more common").Value; values.Tier3BallSpawnWeight = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Items", "Tier3BallSpawnWeight", 6, "The spawn weight of the tier 3 ball (ultra ball). Higher = more common").Value; values.Tier4BallSpawnWeight = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Items", "Tier4BallSpawnWeight", 2, "The spawn weight of the tier 4 ball (master ball). Higher = more common").Value; values.KeepBallsIfAllPlayersDead = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Items", "KeepBallsIfAllPlayersDead", "no", "Make the balls don't despawn even if all the players are dead. Values are: no, fullOnly, all").Value; values.DisabledMonsters = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Monsters", "DisabledMonsters", "", "Disabled monsters types. Separate with a comma and don't put spaces. Example: Monster1,Monster2. Available monsters: " + string.Join(", ", Enum.GetNames(typeof(Utils.Enemy)))).Value.Split(","); values.MonstersReactToFailedCaptures = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Monsters", "MonstersReactToFailedCaptures", true, "Make the monsters react aggressively if a capture fails").Value; values.CaptureRateModifier = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Monsters", "CaptureRateModifier", 0, "Modifier for the capture rate. Each monster have a difficulty to catch between 1 and 10. You can modify all the monsters difficulty by adding this modifier to the base difficulty. Negative = easier to catch, positive = harder to catch").Value; values.BrackenGrabCooldown = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Cooldowns", "BrackenGrabCooldown", 20f, "Grab cooldown time in seconds for the bracken").Value; values.DressGirlTeleportCooldown = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Cooldowns", "DressGirlTeleportCooldown", 60f, "Teleport cooldown time in seconds for the dress girl").Value; values.HoardingBugBringItemCooldown = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Cooldowns", "HoardingBugBringItemCooldown", 5f, "Bring item cooldown time in seconds for the hoarder bug").Value; values.FoxTongueHitCooldown = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Cooldowns", "FoxTongueHitCooldown", 5f, "Tongue hit cooldown time in seconds for the fox").Value; values.EyelessDogHowlCooldown = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Cooldowns", "EyelessDogHowlCooldown", 5f, "Howl cooldown time in seconds for the eyeless dog").Value; values.MaskedLendCooldown = ((BaseUnityPlugin)LethalMon.Instance).Config.Bind("Cooldowns", "MaskedLendCooldown", 7f, "Mask lending cooldown time in seconds for the masked").Value; originalValues = values; } public override void CreateInputActions(in InputActionMapBuilder builder) { //IL_001b: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) ConfigFile config = ((BaseUnityPlugin)LethalMon.Instance).Config; KeyboardControl val = (KeyboardControl)36; string value = config.Bind("Controls", "RetrieveBallKeyKeyboard", "/" + ((object)(KeyboardControl)(ref val)).ToString(), "Key for retrieving the tamed enemy inside its ball. Requires a restart after changing.").Value; ConfigFile config2 = ((BaseUnityPlugin)LethalMon.Instance).Config; GamepadControl val2 = (GamepadControl)7; string value2 = config2.Bind("Controls", "RetrieveBallKeyGamepad", "/" + ((object)(GamepadControl)(ref val2)).ToString(), "Gamepad key for retrieving the tamed enemy inside its ball. Requires a restart after changing.").Value; builder.NewActionBinding().WithActionId("retreiveBallKey").WithActionType((InputActionType)1) .WithBindingName("RetrieveBallKey") .WithKbmPath(value) .WithGamepadPath(value2) .Finish(); ConfigFile config3 = ((BaseUnityPlugin)LethalMon.Instance).Config; val = (KeyboardControl)22; string value3 = config3.Bind("Controls", "ActionKey1Keyboard", "/" + ((object)(KeyboardControl)(ref val)).ToString(), "Key for the first custom action on a tamed enemy. Requires a restart after changing.").Value; ConfigFile config4 = ((BaseUnityPlugin)LethalMon.Instance).Config; val2 = (GamepadControl)9; string value4 = config4.Bind("Controls", "ActionKey1Gamepad", "/" + ((object)(GamepadControl)(ref val2)).ToString(), "Gamepad key for the first custom action on a tamed enemy. Requires a restart after changing.").Value; builder.NewActionBinding().WithActionId("actionKey1").WithActionType((InputActionType)1) .WithBindingName("ActionKey1") .WithKbmPath(value3) .WithGamepadPath(value4) .Finish(); } public static void ProcessValues() { LethalMon.Log("Processing config"); if ((Object)(object)Pokeball.BallItem != (Object)null) { if (Instance.values.Tier1BallCost >= 0) { Items.UpdateShopItemPrice(Pokeball.BallItem, Instance.values.Tier1BallCost); } else { Items.RemoveShopItem(Pokeball.BallItem); } } if ((Object)(object)Greatball.BallItem != (Object)null) { if (Instance.values.Tier2BallCost >= 0) { Items.UpdateShopItemPrice(Greatball.BallItem, Instance.values.Tier2BallCost); } else { Items.RemoveShopItem(Greatball.BallItem); } } if ((Object)(object)Ultraball.BallItem != (Object)null) { if (Instance.values.Tier3BallCost >= 0) { Items.UpdateShopItemPrice(Ultraball.BallItem, Instance.values.Tier3BallCost); } else { Items.RemoveShopItem(Ultraball.BallItem); } } if ((Object)(object)Masterball.BallItem != (Object)null) { if (Instance.values.Tier4BallCost >= 0) { Items.UpdateShopItemPrice(Masterball.BallItem, Instance.values.Tier4BallCost); } else { Items.RemoveShopItem(Masterball.BallItem); } } string[] disabledMonsters = Instance.values.DisabledMonsters; foreach (string key in disabledMonsters) { Data.CatchableMonsters.Remove(key); } if (Chainloader.PluginInfos.ContainsKey("atomic.terminalapi")) { LethalDex.Register(); } } } public static class Data { public static readonly Random Random = new Random(); public static readonly float[][] CaptureProbabilities = new float[4][] { new float[10] { 0.95f, 0.9f, 0.8f, 0.65f, 0.5f, 0.3f, 0.1f, 0.05f, 0.02f, 0.01f }, new float[10] { 1f, 0.97f, 0.95f, 0.85f, 0.7f, 0.5f, 0.3f, 0.2f, 0.15f, 0.1f }, new float[10] { 1f, 1f, 1f, 0.97f, 0.95f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f }, new float[10] { 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f } }; public static readonly Dictionary CatchableMonsters = new Dictionary { { Utils.Enemy.Flowerman.ToString(), new CatchableFlowerman() }, { Utils.Enemy.HoarderBug.ToString(), new CatchableHoarderBug() }, { Utils.Enemy.RedLocustBees.ToString(), new CatchableRedLocustBees() }, { Utils.Enemy.Puffer.ToString(), new CatchableSporeLizard() }, { Utils.Enemy.MouthDog.ToString(), new CatchableMouthDog() }, { Utils.Enemy.FlowerSnake.ToString(), new CatchableTulipSnake() }, { Utils.Enemy.DressGirl.ToString(), new CatchableGhostGirl() }, { Utils.Enemy.Nutcracker.ToString(), new CatchableNutcracker() }, { Utils.Enemy.Butler.ToString(), new CatchableButler() }, { Utils.Enemy.BushWolf.ToString(), new CatchableKidnapperFox() }, { Utils.Enemy.Crawler.ToString(), new CatchableCrawler() }, { Utils.Enemy.MaskedPlayerEnemy.ToString(), new CatchableMasked() } }; } public class LethalDex { private const string TopLeftJoint = "+"; private const string TopRightJoint = "+"; private const string BottomLeftJoint = "+"; private const string BottomRightJoint = "+"; private const string TopJoint = "+"; private const string BottomJoint = "+"; private const string LeftJoint = "+"; private const string MiddleJoint = "+"; private const string RightJoint = "+"; private const char HorizontalLine = '-'; private const string VerticalLine = "|"; private static string _commandText = "Something went wrong :("; public static void Register() { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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: Expected O, but got Unknown _commandText = InitCommandText(); TerminalApi.AddCommand("lethaldex", new CommandInfo { Title = "LethalDex", Category = "Other", Description = "Shows LethalMon's monsters details", DisplayTextSupplier = () => _commandText }, (string)null, true); LethalMon.Log("Registered LethalDex terminal command"); } private static string InitCommandText() { string text = "Capture probabilities:\n\nPB = Pokeball, GB = Great ball, UB = Ultra ball, MB = Master ball\n"; global::LethalMon.CatchableEnemy.CatchableEnemy[] array = Data.CatchableMonsters.Values.OrderBy((global::LethalMon.CatchableEnemy.CatchableEnemy enemy) => enemy.CatchDifficulty).ToArray(); int num = array.Max((global::LethalMon.CatchableEnemy.CatchableEnemy enemy) => enemy.DisplayName.Length); string text2 = " PB "; string text3 = " GB "; string text4 = " UB "; string text5 = " MB "; text = text + "+" + new string('-', num + 2) + "+" + new string('-', text2.Length + 2) + "+" + new string('-', text3.Length + 2) + "+" + new string('-', text4.Length + 2) + "+" + new string('-', text5.Length + 2) + "+\n"; text = text + "|" + new string(' ', num + 2) + "| " + text2 + " | " + text3 + " | " + text4 + " | " + text5 + " |\n"; string text6 = "+" + new string('-', num + 2) + "+" + new string('-', text2.Length + 2) + "+" + new string('-', text3.Length + 2) + "+" + new string('-', text4.Length + 2) + "+" + new string('-', text5.Length + 2) + "+"; foreach (global::LethalMon.CatchableEnemy.CatchableEnemy catchableEnemy in array) { text = text + text6 + "\n"; string text7 = ((int)Mathf.Floor(catchableEnemy.GetCaptureProbability(0) * 100f)).ToString(); string text8 = ((int)Mathf.Floor(catchableEnemy.GetCaptureProbability(1) * 100f)).ToString(); string text9 = ((int)Mathf.Floor(catchableEnemy.GetCaptureProbability(2) * 100f)).ToString(); string text10 = ((int)Mathf.Floor(catchableEnemy.GetCaptureProbability(3) * 100f)).ToString(); text = text + "| " + catchableEnemy.DisplayName + new string(' ', num - catchableEnemy.DisplayName.Length) + " | " + new string(' ', Math.Clamp(3 - text7.Length, 0, 3)) + text7 + "% | " + new string(' ', Math.Clamp(3 - text8.Length, 0, 3)) + text8 + "% | " + new string(' ', Math.Clamp(3 - text9.Length, 0, 3)) + text9 + "% | " + new string(' ', Math.Clamp(3 - text10.Length, 0, 3)) + text10 + "% |\n"; } return text + "+" + new string('-', num + 2) + "+" + new string('-', text2.Length + 2) + "+" + new string('-', text3.Length + 2) + "+" + new string('-', text4.Length + 2) + "+" + new string('-', text5.Length + 2) + "+\n\n"; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("LethalMon", "LethalMon", "1.0.0")] public class LethalMon : BaseUnityPlugin { public enum LogType { Message, Warning, Error, Fatal, Debug } internal static GameObject hudPrefab; internal static Dictionary monstersSprites = new Dictionary(); public static LethalMon Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; ModConfig.Instance.Setup(); LoadAssetBundle(); NetcodePatching(); ApplyHarmonyPatches(); PlayerControllerBPatch.InitializeRPCS(); Logger.LogInfo((object)"LethalMon v1.0.0 has loaded!"); } private void NetcodePatching() { 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); } } } } private void LoadAssetBundle() { AssetBundle assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalmon")); Pokeball.Setup(assetBundle); Greatball.Setup(assetBundle); Ultraball.Setup(assetBundle); Masterball.Setup(assetBundle); Utils.LoadSeeThroughShader(assetBundle); Utils.LoadWireframeMaterial(assetBundle); MaskedTamedBehaviour.LoadGhostAudio(assetBundle); HoarderBugTamedBehaviour.LoadAudio(assetBundle); hudPrefab = assetBundle.LoadAsset("Assets/UI/MonsterInfo.prefab"); monstersSprites = (from assetName in assetBundle.GetAllAssetNames() where assetName.StartsWith("assets/ui/monstersicons/") && assetName.EndsWith(".png") select assetName).ToDictionary((string assetName) => assetName.Substring("assets/ui/monstersicons/".Length, assetName.Length - "assets/ui/monstersicons/".Length - 4), (string assetName) => assetBundle.LoadAsset(assetName)); } private void ApplyHarmonyPatches() { Harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); Harmony.PatchAll(typeof(DebugPatches)); Harmony.PatchAll(typeof(ModConfig.SyncHandshake)); Harmony.PatchAll(typeof(PlayerControllerBPatch)); Harmony.PatchAll(typeof(StartOfRoundPatch)); Harmony.PatchAll(typeof(RoundManagerPatch)); Harmony.PatchAll(typeof(HUDManagerPatch)); Harmony.PatchAll(typeof(EnemyAIPatch)); Harmony.PatchAll(typeof(RedLocustBeesPatch)); Harmony.PatchAll(typeof(MouthDogPatch)); Harmony.PatchAll(typeof(FlowermanAIPatch)); Harmony.PatchAll(typeof(BushWolfEnemyPatch)); Harmony.PatchAll(typeof(MaskedPlayerEnemyPatch)); Harmony.PatchAll(typeof(TamedEnemyBehaviour)); Harmony.PatchAll(typeof(KidnapperFoxTamedBehaviour)); } private static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } internal static void Log(string message, LogType type = LogType.Debug) { switch (type) { case LogType.Debug: break; case LogType.Warning: Logger.LogWarning((object)message); break; case LogType.Error: Logger.LogError((object)message); break; case LogType.Fatal: Logger.LogFatal((object)message); break; default: Logger.LogMessage((object)message); break; } } } public class Utils { public enum Enemy { BaboonHawk, Blob, BushWolf, Butler, ButlerBees, Centipede, ClaySurgeon, Crawler, DocileLocustBees, Doublewing, FlowerSnake, RedLocustBees, DressGirl, Flowerman, ForestGiant, HoarderBug, Jester, LassoMan, MaskedPlayerEnemy, MouthDog, Nutcracker, Puffer, RadMech, RedPillEnemyType, SandSpider, SandWorm, SpringMan } internal class LayerMasks { internal enum Mask { All = -1, Default, TransparentFX, Ignore_Raycast, Player, Water, UI, Props, HelmetVisor, Room, InteractableObject, Foliage, Colliders, PhysicsObject, Triggers, MapRadar, NavigationSurface, RoomLight, Anomaly, LineOfSight, Enemies, PlayerRagdoll, MapHazards, ScanNode, EnemiesNotRendered, MiscLevelGeometry, Terrain, PlaceableShipObjects, PlacementBlocker, Railing, DecalStickableSurface, CompanyCruiser } internal static int ToInt(Mask[] masks) { int num = 0; foreach (Mask mask in masks) { num |= 1 << (int)mask; } return num; } } public static readonly Random Random = new Random(); private static Dictionary infoNodes = new Dictionary(); public static readonly float DefaultJumpForce = 13f; private static Item? _giftBoxItem; public static Shader? SeeThroughShader; public static readonly Color EnemyHighlightOutline = Color.red; public static readonly Color EnemyHighlightInline = new Color(0.8f, 0f, 0f, 0.8f); public static readonly Color ItemHighlightOutline = Color.yellow; public static readonly Color ItemHighlightInline = new Color(0.8f, 0.8f, 0f, 0.5f); public static readonly Color PlayerHighlightOutline = Color.green; public static readonly Color PlayerHighlightInline = new Color(0f, 0.8f, 0f, 0.6f); public static Material? WireframeMaterial; private static readonly string GlassName = "LethalMonGlass"; private static Material? _glassMaterial = null; private static Material? _ghostMaterial = null; private static Material? _ghostEyesMaterial = null; public static List? AllPlayers => StartOfRound.Instance?.allPlayerScripts?.Where((PlayerControllerB pcb) => (Object)(object)pcb != (Object)null && (pcb.isPlayerControlled || pcb.isPlayerDead)).ToList(); public static List? AlivePlayers => AllPlayers?.Where((PlayerControllerB pcb) => !pcb.isPlayerDead).ToList(); public static PlayerControllerB CurrentPlayer => GameNetworkManager.Instance.localPlayerController; public static ulong? CurrentPlayerID => CurrentPlayer?.playerClientId; public static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton != (Object)null) { if (!NetworkManager.Singleton.IsHost) { return NetworkManager.Singleton.IsServer; } return true; } if (CurrentPlayerID.HasValue) { return CurrentPlayerID.Value == 0; } return false; } } public static float DefaultPlayerSpeed { get { if (!CurrentPlayer.isSprinting) { return 1f; } return 2.25f; } } public static List EnemyTypes => Resources.FindObjectsOfTypeAll().ToList(); public static Item? GiftBoxItem { get { if ((Object)(object)_giftBoxItem != (Object)null) { return _giftBoxItem; } _giftBoxItem = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((Item item) => item.itemName == "Gift")); return _giftBoxItem; } } public static Material Glass { get { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_glassMaterial == (Object)null) { _glassMaterial = new Material(Shader.Find("HDRP/Lit")); _glassMaterial.color = new Color(0.5f, 0.5f, 0.6f, 0.6f); _glassMaterial.renderQueue = 3300; _glassMaterial.shaderKeywords = new string[5] { "_SURFACE_TYPE_TRANSPARENT", "_DISABLE_SSR_TRANSPARENT", "_REFRACTION_THIN", "_NORMALMAP_TANGENT_SPACE", "_ENABLE_FOG_ON_TRANSPARENT" }; ((Object)_glassMaterial).name = GlassName; } return _glassMaterial; } } internal static Material GhostMaterial { get { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_ghostMaterial == (Object)null) { _ghostMaterial = new Material(WireframeMaterial); _ghostMaterial.SetColor("_EdgeColor", new Color(0.8f, 0.9f, 1f, 0.15f)); _ghostMaterial.SetFloat("_WireframeVal", 1f); _ghostMaterial.SetFloat("_MaxVisibilityDistance", 15f); } return _ghostMaterial; } } internal static Material GhostEyesMaterial { get { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_ghostEyesMaterial == (Object)null) { _ghostEyesMaterial = new Material(Shader.Find("HDRP/Unlit")); _ghostEyesMaterial.color = new Color(0.8f, 0.9f, 1f); } return _ghostEyesMaterial; } } public static void CallNextFrame(Action action) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(CallNextFrameCoroutine(action)); } public static IEnumerator CallNextFrameCoroutine(Action action) { yield return null; action(); } public static TamedEnemyBehaviour? GetPlayerPet(PlayerControllerB player) { PlayerControllerB player2 = player; return Object.FindObjectsOfType().FirstOrDefault((TamedEnemyBehaviour tamedBehaviour) => (Object)(object)tamedBehaviour.ownerPlayer == (Object)(object)player2); } public static Vector3 GetPositionInFrontOfPlayerEyes(PlayerControllerB player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0020: Unknown result type (might be due to invalid IL or missing references) return player.playerEye.position + player.playerEye.forward * 2.5f; } public static Vector3 GetPositionBehindPlayer(PlayerControllerB player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0020: Unknown result type (might be due to invalid IL or missing references) return ((Component)player).transform.position + ((Component)player).transform.forward * -2f; } public static EnemyAI? GetMostProbableAttackerEnemy(PlayerControllerB player, StackTrace stackTrace) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) StackFrame[] frames = stackTrace.GetFrames(); StackFrame[] subArray = frames[1..]; foreach (StackFrame stackFrame in subArray) { Type declaringType = stackFrame.GetMethod().DeclaringType; LethalMon.Log("Stackframe type: " + declaringType); if (!declaringType.IsSubclassOf(typeof(EnemyAI))) { continue; } LethalMon.Log("Class is assignable from EnemyAI"); EnemyAI val = null; float? num = float.MaxValue; Collider[] array = Physics.OverlapSphere(((Component)player).transform.position, 10f); Collider[] array2 = array; foreach (Collider val2 in array2) { EnemyAI componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && ((object)componentInParent).GetType() == declaringType) { float num2 = Vector3.Distance(((Component)player).transform.position, ((Component)componentInParent).transform.position); if (num > num2) { val = componentInParent; num = num2; } } } if ((Object)(object)val != (Object)null) { return val; } } return null; } public static TerminalNode CreateTerminalNode(string name, string description) { if (infoNodes.TryGetValue(name, out TerminalNode value)) { return value; } TerminalNode val = ScriptableObject.CreateInstance(); Object.DontDestroyOnLoad((Object)(object)val); val.clearPreviousText = true; ((Object)val).name = name + "InfoNode"; val.displayText = description + "\n\n"; infoNodes.Add(name, val); return val; } public static Vector3 GetRandomNavMeshPositionOnRadius(Vector3 pos, float radius, NavMeshHit navHit = default(NavMeshHit)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0030: Unknown result type (might be due to invalid IL or missing references) float y = pos.y; pos = Random.onUnitSphere * radius + pos; pos.y = y; if (NavMesh.SamplePosition(pos, ref navHit, radius, -1)) { return ((NavMeshHit)(ref navHit)).position; } return pos; } public static void PlaySoundAtPosition(Vector3 position, AudioClip clip, float volume = 1f) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) AudioSource val = (SoundManager.Instance.tempAudio1.isPlaying ? SoundManager.Instance.tempAudio2 : SoundManager.Instance.tempAudio1); ((Component)val).transform.position = position; val.PlayOneShot(clip, volume); } public static void PlaySoundAtPosition(Vector3 position, AudioClip clip) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) ((Component)SoundManager.Instance.tempAudio1).transform.position = position; SoundManager.Instance.tempAudio1.PlayOneShot(clip); } public static void EnableShotgunHeldByEnemyAi(EnemyAI enemyAI, bool enable) { ShotgunItem[] array = Object.FindObjectsOfType(); ShotgunItem[] array2 = array; foreach (ShotgunItem val in array2) { if ((Object)(object)val.heldByEnemy == (Object)(object)enemyAI) { ((GrabbableObject)val).EnableItemMeshes(enable); } } } public static void DestroyShotgunHeldByEnemyAi(EnemyAI enemyAI) { ShotgunItem[] array = Object.FindObjectsOfType(); ShotgunItem[] array2 = array; foreach (ShotgunItem val in array2) { if ((Object)(object)val.heldByEnemy == (Object)(object)enemyAI) { ((Component)val).GetComponent().Despawn(true); } } } public static void OpenDoorsAsEnemyAroundPosition(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(position, 0.5f); Collider[] array2 = array; AnimatedObjectTrigger val3 = default(AnimatedObjectTrigger); foreach (Collider val in array2) { DoorLock componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isDoorOpened && !componentInParent.isLocked) { Vector3 val2 = position; LethalMon.Log("Door opened at " + ((object)(Vector3)(ref val2)).ToString()); if (((Component)componentInParent).gameObject.TryGetComponent(ref val3)) { val3.TriggerAnimationNonPlayer(false, true, false); } componentInParent.OpenDoorAsEnemyServerRpc(); } } } public static bool TryGetRealEnemyBounds(EnemyAI enemy, out Bounds bounds) { //IL_0001: 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_002c: 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) bounds = default(Bounds); if ((Object)(object)enemy == (Object)null) { return false; } Renderer[] componentsInChildren = ((Component)enemy).gameObject.GetComponentsInChildren(); if (componentsInChildren == null) { return false; } bounds = componentsInChildren[0].bounds; for (int i = 1; i < componentsInChildren.Length; i++) { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren[i].bounds); } return true; } private static GameObject? TrySpawnItemAtPosition(SpawnableItemWithRarity spawnableItemWithRarity, Vector3 position) { //IL_003a: 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) if (!IsHost) { LethalMon.Log("TrySpawnItemAtPosition: Not a valid item or not the host."); return null; } LethalMon.Log("Instantiating item " + ((Object)spawnableItemWithRarity.spawnableItem).name); GameObject val = Object.Instantiate(spawnableItemWithRarity.spawnableItem.spawnPrefab, position, Quaternion.identity, StartOfRound.Instance.elevatorTransform); NetworkObject component = val.GetComponent(); if (component != null) { component.Spawn(false); } return val; } public static GameObject? TrySpawnRandomItemAtPosition(Vector3 position, out SpawnableItemWithRarity spawnableItemWithRarity) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) LethalMon.Log("Spawnable items: " + RoundManager.Instance.currentLevel.spawnableScrap.Count); spawnableItemWithRarity = RoundManager.Instance.currentLevel.spawnableScrap[Random.RandomRangeInt(0, RoundManager.Instance.currentLevel.spawnableScrap.Count)]; return TrySpawnItemAtPosition(spawnableItemWithRarity, position); } public static void SpawnPoofCloudAt(Vector3 position) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) Item giftBoxItem = GiftBoxItem; if ((Object)(object)giftBoxItem != (Object)null && (Object)(object)giftBoxItem.spawnPrefab != (Object)null) { GiftBoxItem component = giftBoxItem.spawnPrefab.GetComponent(); ParticleSystem val = Object.Instantiate(component.PoofParticle); ((Component)val).transform.position = position; val.Play(); } } public static List GetRenderers(GameObject? g) { List list = new List(); if ((Object)(object)g != (Object)null) { Renderer[] componentsInChildren = g.GetComponentsInChildren(); foreach (Renderer item in componentsInChildren) { list.Add(item); } } return list; } public static void ReplaceAllMaterialsWith(GameObject g, Func materialReplacer) { List renderers = GetRenderers(g); foreach (Renderer item in renderers) { ReplaceAllMaterialsWith(item, materialReplacer); } } public static Material[] ReplaceAllMaterialsWith(Renderer mr, Func materialReplacer) { List list = new List(); Material[] materials = mr.materials; foreach (Material arg in materials) { list.Add(materialReplacer(arg)); } Material[] materials2 = mr.materials; mr.materials = list.ToArray(); return materials2; } public static void LoadSeeThroughShader(AssetBundle assetBundle) { SeeThroughShader = assetBundle.LoadAsset("Assets/SeeThrough/SeeThroughStencil.shader"); if ((Object)(object)SeeThroughShader == (Object)null) { LethalMon.Log("Unable to load seethrough shader!", LethalMon.LogType.Error); } } public static void LoadWireframeMaterial(AssetBundle assetBundle) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown Shader val = assetBundle.LoadAsset("Assets/SeeThrough/wireframe.shader"); if ((Object)(object)val == (Object)null) { LethalMon.Log("Unable to load wireframe shader!", LethalMon.LogType.Error); } else { WireframeMaterial = new Material(val); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LethalMon"; public const string PLUGIN_NAME = "LethalMon"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace LethalMon.Throw { public class FallCurve { internal static readonly Keyframe[] fallCurveKeyframes = (Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 0f, 2f, 2f), new Keyframe(1f, 1f, 0f, 0f) }; internal static readonly Keyframe[] verticalFallCurveKeyframes = (Keyframe[])(object)new Keyframe[5] { new Keyframe(0f, 0f, 0.116908506f, 0.116908506f, 0f, 0.27230743f), new Keyframe(0.49081117f, 1f, 4.1146584f, -1.81379f, 0.07234045f, 0.28319725f), new Keyframe(0.7587703f, 1f, 1.4123471f, -1.3678839f, 0.31997186f, 0.56917864f), new Keyframe(0.9393898f, 1f, 0.82654804f, -0.029021755f, 0.53747445f, 1f), new Keyframe(1f, 1f) }; internal static readonly Keyframe[] verticalFallCurveNoBounceKeyFrames = (Keyframe[])(object)new Keyframe[4] { new Keyframe(0f, 0f, 0.116908506f, 0.116908506f, 0f, 0.27230743f), new Keyframe(0.69081116f, 1f, 0.1146584f, 0.06098772f, 0.07234045f, 0.20768756f), new Keyframe(0.9393898f, 1f, 0.06394797f, -0.029021755f, 0.1980713f, 1f), new Keyframe(1f, 1f) }; internal static readonly AnimationCurve fallCurve = new AnimationCurve(fallCurveKeyframes); internal static readonly AnimationCurve verticalFallCurve = new AnimationCurve(verticalFallCurveKeyframes); internal static readonly AnimationCurve verticalFallCurveNoBounce = new AnimationCurve(verticalFallCurveNoBounceKeyFrames); } public abstract class ThrowableItem : GrabbableObject { public AnimationCurve itemFallCurve; public AnimationCurve itemVerticalFallCurve; public AnimationCurve itemVerticalFallCurveNoBounce; public RaycastHit itemHit; public Ray itemThrowRay; public PlayerControllerB playerThrownBy; public PlayerControllerB lastThrower; [ServerRpc(RequireOwnership = false)] public void ThrowServerRpc(NetworkObjectReference playerThrownByReference) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2923164452u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerThrownByReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2923164452u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ThrowClientRpc(playerThrownByReference); } } } [ClientRpc] public void ThrowClientRpc(NetworkObjectReference playerThrownByReference) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3841692620u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerThrownByReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3841692620u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LethalMon.Log("SendThrowRpc server rpc received"); NetworkObject val3 = default(NetworkObject); PlayerControllerB val4 = default(PlayerControllerB); if (!((NetworkObjectReference)(ref playerThrownByReference)).TryGet(ref val3, (NetworkManager)null)) { LethalMon.Log(((Object)((Component)this).gameObject).name + ": Failed to get player component (SendThrowRpc)", LethalMon.LogType.Error); } else if (((Component)val3).TryGetComponent(ref val4)) { playerThrownBy = val4; lastThrower = playerThrownBy; } } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (((NetworkBehaviour)this).IsOwner) { playerThrownBy = base.playerHeldBy; lastThrower = playerThrownBy; base.playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, GetItemThrowDestination(), true); ThrowServerRpc(NetworkObjectReference.op_Implicit(((Component)playerThrownBy).GetComponent())); } } public override void EquipItem() { ((GrabbableObject)this).EnableItemMeshes(true); base.isPocketed = false; } public abstract void TouchGround(); public override void FallWithCurve() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0105: 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_0124: Unknown result type (might be due to invalid IL or missing references) Vector3 val = base.startFallingPosition - base.targetFloorPosition; float magnitude = ((Vector3)(ref val)).magnitude; ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(base.itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, base.itemProperties.restingRotation.z), 14f * Time.deltaTime / magnitude); ((Component)this).transform.localPosition = Vector3.Lerp(base.startFallingPosition, base.targetFloorPosition, FallCurve.fallCurve.Evaluate(base.fallTime)); if (magnitude > 5f) { ((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, base.startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, base.targetFloorPosition.y, ((Component)this).transform.localPosition.z), FallCurve.verticalFallCurveNoBounce.Evaluate(base.fallTime)); } else { ((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, base.startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, base.targetFloorPosition.y, ((Component)this).transform.localPosition.z), FallCurve.verticalFallCurve.Evaluate(base.fallTime)); } base.fallTime += Mathf.Abs(Time.deltaTime * 12f / magnitude); if (base.fallTime > 1f) { TouchGround(); playerThrownBy = null; } } public override void Update() { ((GrabbableObject)this).Update(); } public Vector3 GetItemThrowDestination() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0088: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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) //IL_00f4: 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) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; itemThrowRay = new Ray(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward); position = ((!Physics.Raycast(itemThrowRay, ref itemHit, 12f, 268437761, (QueryTriggerInteraction)1)) ? ((Ray)(ref itemThrowRay)).GetPoint(10f) : ((Ray)(ref itemThrowRay)).GetPoint(((RaycastHit)(ref itemHit)).distance - 0.05f)); itemThrowRay = new Ray(position, Vector3.down); if (Physics.Raycast(itemThrowRay, ref itemHit, 30f, 268437761, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref itemHit)).point + Vector3.up * (base.itemProperties.verticalOffset + 0.05f); } return ((Ray)(ref itemThrowRay)).GetPoint(30f); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ThrowableItem() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2923164452u, new RpcReceiveHandler(__rpc_handler_2923164452)); NetworkManager.__rpc_func_table.Add(3841692620u, new RpcReceiveHandler(__rpc_handler_3841692620)); } private static void __rpc_handler_2923164452(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference playerThrownByReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerThrownByReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ThrowableItem)(object)target).ThrowServerRpc(playerThrownByReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3841692620(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference playerThrownByReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerThrownByReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((ThrowableItem)(object)target).ThrowClientRpc(playerThrownByReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ThrowableItem"; } } } namespace LethalMon.Patches { public class BushWolfEnemyPatch { [HarmonyPatch(typeof(BushWolfEnemy), "Start")] [HarmonyPostfix] public static void OnStartPostfix(BushWolfEnemy __instance) { KidnapperFoxTamedBehaviour component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.ownerPlayer != (Object)null) { ((EnemyAI)__instance).inSpecialAnimation = false; ((EnemyAI)__instance).EnableEnemyMesh(true, false); ((Behaviour)((EnemyAI)__instance).agent).enabled = true; ((EnemyAI)__instance).agent.speed = 5f; } } } [HarmonyPatch] internal class DebugPatches : NetworkBehaviour { protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "DebugPatches"; } } public class EnemyAIPatch { [HarmonyPatch(typeof(EnemyAI), "OnDestroy")] [HarmonyPrefix] private static void OnDestroyPreFix(EnemyAI __instance) { TamedEnemyBehaviour component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { LethalMon.Log("Destroying TamedEnemyBehaviour component"); Object.Destroy((Object)(object)component); } else { LethalMon.Log("No TamedEnemyBehaviour component found before EnemyAI OnDestroy", LethalMon.LogType.Warning); } } [HarmonyPatch(typeof(EnemyAI), "SwitchToBehaviourStateOnLocalClient")] [HarmonyPrefix] private static void SwitchToBehaviourStateOnLocalClientPrefix(EnemyAI __instance) { TamedEnemyBehaviour component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && __instance.currentBehaviourStateIndex > component.LastDefaultBehaviourIndex) { if (__instance.currentBehaviourStateIndex <= component.LastDefaultBehaviourIndex + TamedEnemyBehaviour.TamedBehaviourCount) { component.LeaveTamingBehaviour((TamedEnemyBehaviour.TamingBehaviour)(__instance.currentBehaviourStateIndex - component.LastDefaultBehaviourIndex)); } else { component.LeaveCustomBehaviour(__instance.currentBehaviourStateIndex - TamedEnemyBehaviour.TamedBehaviourCount - component.LastDefaultBehaviourIndex); } } } [HarmonyPatch(typeof(EnemyAI), "SwitchToBehaviourStateOnLocalClient")] [HarmonyPostfix] private static void SwitchToBehaviourStateOnLocalClientPostfix(EnemyAI __instance, int stateIndex) { TamedEnemyBehaviour component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { if (stateIndex > component.LastDefaultBehaviourIndex) { if (stateIndex <= component.LastDefaultBehaviourIndex + TamedEnemyBehaviour.TamedBehaviourCount) { component.InitTamingBehaviour((TamedEnemyBehaviour.TamingBehaviour)(stateIndex - component.LastDefaultBehaviourIndex)); } else { component.InitCustomBehaviour(stateIndex - TamedEnemyBehaviour.TamedBehaviourCount - component.LastDefaultBehaviourIndex); } } if ((Object)(object)component.ownerPlayer == (Object)(object)Utils.CurrentPlayer) { HUDManagerPatch.UpdateTamedMonsterAction(component.GetCurrentStateDescription()); } } else { LethalMon.Log("No TamedEnemyBehaviour component found after EnemyAI SwitchToBehaviourStateOnLocalClient", LethalMon.LogType.Warning); } } [HarmonyPatch(typeof(EnemyAI), "HitEnemy")] [HarmonyPrefix] private static bool HitEnemyPrefix(EnemyAI __instance, int force = -1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { TamedEnemyBehaviour component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null)) { return (Object)(object)component.ownerPlayer == (Object)null; } return true; } [HarmonyPatch(typeof(EnemyAI), "KillEnemy")] [HarmonyPrefix] private static bool KillEnemyPrefix(EnemyAI __instance, bool destroy = false) { TamedEnemyBehaviour component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null)) { return (Object)(object)component.ownerPlayer == (Object)null; } return true; } [HarmonyPatch(typeof(EnemyAI), "KillEnemyClientRpc")] [HarmonyPrefix] private static bool KillEnemyClientRpcPrefix(EnemyAI __instance, bool destroy) { TamedEnemyBehaviour component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null)) { return (Object)(object)component.ownerPlayer == (Object)null; } return true; } [HarmonyPatch(typeof(EnemyAI), "KillEnemyServerRpc")] [HarmonyPrefix] private static bool KillEnemyServerRpcPrefix(EnemyAI __instance, bool destroy) { TamedEnemyBehaviour component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null)) { return (Object)(object)component.ownerPlayer == (Object)null; } return true; } [HarmonyPatch(typeof(EnemyAI), "KillEnemyOnOwnerClient")] [HarmonyPrefix] private static bool KillEnemyOnOwnerClientPrefix(EnemyAI __instance, bool overrideDestroy = false) { TamedEnemyBehaviour component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null)) { return (Object)(object)component.ownerPlayer == (Object)null; } return true; } } public class FlowermanAIPatch { [HarmonyPatch(typeof(FlowermanAI), "HitEnemy")] [HarmonyPrefix] private static bool HitEnemyPrefix(FlowermanAI __instance, int force = -1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { TamedEnemyBehaviour component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null)) { return (Object)(object)component.ownerPlayer == (Object)null; } return true; } } public class HUDManagerPatch { private static HUDElement monsterHudElement; private static Image monsterIcon; private static TextMeshProUGUI monsterName; private static TextMeshProUGUI pressKeyTip; private static TextMeshProUGUI monsterAction; private static Image cooldownCircle1; private static TextMeshProUGUI cooldownTime1; private static TextMeshProUGUI cooldownName1; private static Image cooldownCircle2; private static TextMeshProUGUI cooldownTime2; private static TextMeshProUGUI cooldownName2; public static void UpdatePressKeyTip() { if ((Object)(object)pressKeyTip != (Object)null) { ((TMP_Text)pressKeyTip).text = "[" + InputActionRebindingExtensions.GetBindingDisplayString(ModConfig.Instance.RetrieveBallKey, (DisplayStringOptions)0, (string)null) + "]\nto retrieve"; } } public static void ChangeToTamedBehaviour(TamedEnemyBehaviour behaviour) { string name = ((Object)behaviour.Enemy.enemyType).name; monsterIcon.sprite = (Sprite)(LethalMon.monstersSprites.TryGetValue(name.ToLower(), out Sprite value) ? ((object)value) : ((object)LethalMon.monstersSprites["unknown"])); ((TMP_Text)monsterName).text = Data.CatchableMonsters[name].DisplayName; CooldownNetworkBehaviour[] components = ((Component)behaviour).GetComponents(); if (components.Length >= 1) { ((Component)cooldownCircle1).gameObject.SetActive(true); ((Component)cooldownTime1).gameObject.SetActive(true); ((Component)cooldownName1).gameObject.SetActive(true); components[0].BindToHUD(cooldownCircle1, cooldownTime1, cooldownName1); } else { ((Component)cooldownCircle1).gameObject.SetActive(false); ((Component)cooldownTime1).gameObject.SetActive(false); ((Component)cooldownName1).gameObject.SetActive(false); } if (components.Length >= 2) { ((Component)cooldownCircle2).gameObject.SetActive(true); ((Component)cooldownTime2).gameObject.SetActive(true); ((Component)cooldownName2).gameObject.SetActive(true); components[1].BindToHUD(cooldownCircle2, cooldownTime2, cooldownName2); } else { ((Component)cooldownCircle2).gameObject.SetActive(false); ((Component)cooldownTime2).gameObject.SetActive(false); ((Component)cooldownName2).gameObject.SetActive(false); } } public static void EnableHUD(bool enable) { ((Component)monsterHudElement.canvasGroup).gameObject.SetActive(enable); } public static void UpdateTamedMonsterAction(string action) { ((TMP_Text)monsterAction).text = action; } [HarmonyPostfix] [HarmonyPatch(typeof(HUDManager), "Awake")] private static void AwakePostfix(HUDManager __instance) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) FieldInfo field = typeof(HUDManager).GetField("HUDElements", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { LethalMon.Log("Unable to instantiate HUD, HUDElements array not found", LethalMon.LogType.Error); return; } HUDElement[] array = (HUDElement[])field.GetValue(__instance); if (array.Length == 0) { LethalMon.Log("NO HUD element found (probably because of another mod), cannot instantiate LethalMon HUD", LethalMon.LogType.Error); return; } HUDElement val = ((IEnumerable)array).FirstOrDefault((Func)((HUDElement e) => ((Component)e.canvasGroup).GetComponents().Any((Component c) => ((Object)c).name == "TopRightCorner"))); if (val == null) { LethalMon.Log("Top left corner HUDElement not found, cannot instantiate LethalMon HUD", LethalMon.LogType.Error); return; } GameObject val2 = Object.Instantiate(LethalMon.hudPrefab, ((Component)val.canvasGroup).transform.parent); monsterHudElement = new HUDElement { canvasGroup = val2.GetComponent(), targetAlpha = val.targetAlpha, fadeCoroutine = val.fadeCoroutine }; Component[] componentsInChildren = val2.GetComponentsInChildren(); monsterIcon = componentsInChildren.First((Component c) => ((Object)c).name == "Icon").GetComponent(); monsterName = componentsInChildren.First((Component c) => ((Object)c).name == "Name").GetComponent(); pressKeyTip = componentsInChildren.First((Component c) => ((Object)c).name == "PressKeyTip").GetComponent(); monsterAction = componentsInChildren.First((Component c) => ((Object)c).name == "Action").GetComponent(); cooldownCircle1 = componentsInChildren.First((Component c) => ((Object)c).name == "CooldownCircle1").GetComponent(); cooldownName1 = componentsInChildren.First((Component c) => ((Object)c).name == "CooldownName1").GetComponent(); cooldownTime1 = componentsInChildren.First((Component c) => ((Object)c).name == "CooldownTime1").GetComponent(); cooldownCircle2 = componentsInChildren.First((Component c) => ((Object)c).name == "CooldownCircle2").GetComponent(); cooldownName2 = componentsInChildren.First((Component c) => ((Object)c).name == "CooldownName2").GetComponent(); cooldownTime2 = componentsInChildren.First((Component c) => ((Object)c).name == "CooldownTime2").GetComponent(); UpdatePressKeyTip(); EnableHUD(enable: false); field.SetValue(__instance, new List(array) { monsterHudElement }.ToArray()); Transform transform = ((Component)val.canvasGroup).transform; Vector3 localPosition = transform.localPosition; Rect rect = ((Component)monsterHudElement.canvasGroup).GetComponent().rect; transform.localPosition = localPosition - new Vector3(0f, ((Rect)(ref rect)).height, 0f); LethalMon.Log("HUD initialized"); } } internal class MaskedPlayerEnemyPatch { internal static Dictionary lastColliderIDs = new Dictionary(); [HarmonyPrefix] [HarmonyPatch(typeof(MaskedPlayerEnemy), "OnCollideWithPlayer")] public static void OnCollideWithPlayerPrefix(MaskedPlayerEnemy __instance, Collider other) { if (lastColliderIDs.GetValueOrDefault(((Object)__instance).GetInstanceID(), -1) == ((Object)other).GetInstanceID()) { return; } lastColliderIDs[((Object)__instance).GetInstanceID()] = ((Object)other).GetInstanceID(); PlayerControllerB component = ((Component)other).gameObject.GetComponent(); MaskedTamedBehaviour maskedTamedBehaviour = default(MaskedTamedBehaviour); if ((Object)(object)component == (Object)null || !((Component)__instance).TryGetComponent(ref maskedTamedBehaviour) || (Object)(object)maskedTamedBehaviour.targetPlayer == (Object)null) { return; } if (maskedTamedBehaviour.CurrentCustomBehaviour.GetValueOrDefault(-1) == 2) { LethalMon.Log("Ghost hitting player " + component.playerClientId); maskedTamedBehaviour.Masked.startingKillAnimationLocalClient = true; maskedTamedBehaviour.GhostHitPlayerServerRpc(component.playerClientId); } else if (maskedTamedBehaviour.escapeFromBallEventRunning && (Object)(object)component == (Object)(object)maskedTamedBehaviour.targetPlayer) { LethalMon.Log("Player " + component.playerClientId + " ran into the masked that does the escape event."); maskedTamedBehaviour.CleanUp(); maskedTamedBehaviour.Masked.maskEyesGlowLight.intensity = 0.6f; if ((Object)(object)((EnemyAI)maskedTamedBehaviour.Masked).agent != (Object)null) { ((Behaviour)((EnemyAI)maskedTamedBehaviour.Masked).agent).enabled = true; } ((Behaviour)maskedTamedBehaviour.Masked).enabled = true; maskedTamedBehaviour.EscapeFromBallEventEndedServerRpc(); if (Time.realtimeSinceStartup - maskedTamedBehaviour.Masked.timeAtLastUsingEntrance < 1.75f) { maskedTamedBehaviour.Masked.timeAtLastUsingEntrance = Time.realtimeSinceStartup - 2f; } } } } public class MouthDogPatch { [HarmonyPatch(typeof(MouthDogAI), "ReactToOtherDogHowl")] [HarmonyPrefix] private static bool ReactToOtherDogHowlPreFix(MouthDogAI __instance, Vector3 howlPosition) { return !((Object)(object)((Component)__instance).GetComponentInParent()?.ownerPlayer != (Object)null); } } public class PlayerControllerBPatch { [CompilerGenerated] private static class <>O { public static RpcReceiveHandler <0>____rpc_handler_346187524u; public static Action <1>__RetrieveBallKeyPressed; public static Action <2>__ActionKey1Pressed; } private static bool lastTestPressed = false; private static int currentTestEnemyTypeIndex = 0; private static string[] testEnemyTypes = new List(Data.CatchableMonsters.Keys).ToArray(); private static bool SentBallScanTip = false; internal static void InitializeRPCS() { //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_0025: Expected O, but got Unknown Dictionary _rpc_func_table = NetworkManager.__rpc_func_table; object obj = <>O.<0>____rpc_handler_346187524u; if (obj == null) { RpcReceiveHandler val = __rpc_handler_346187524u; <>O.<0>____rpc_handler_346187524u = val; obj = (object)val; } _rpc_func_table.Add(346187524u, (RpcReceiveHandler)obj); } public static void SendPetRetrievePacket(PlayerControllerB player) { //IL_0002: 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_0045: 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_0051: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = (FastBufferWriter)((object)player).GetType().GetMethod("__beginSendServerRpc", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(player, new object[3] { 346187524u, val, (object)(RpcDelivery)0 }); NetworkObjectReference val3 = NetworkObjectReference.op_Implicit(((Component)player).GetComponent()); ((object)player).GetType().GetMethod("__endSendServerRpc", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(player, new object[4] { val2, 346187524u, val, (object)(RpcDelivery)0 }); LethalMon.Log("Send pet retrieve server rpc send finished"); } private static void __rpc_handler_346187524u(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown NetworkManager networkManager = target.NetworkManager; if ((Object)(object)networkManager != (Object)null && networkManager.IsListening) { LethalMon.Log("Execute RPC handler " + MethodBase.GetCurrentMethod().Name); PlayerControllerB val = (PlayerControllerB)target; TamedEnemyBehaviour playerPet = Utils.GetPlayerPet(val); if ((Object)(object)playerPet != (Object)null) { PetRetrieve(val, playerPet); } else { LethalMon.Log("No tamed enemy found for " + ((object)val)?.ToString() + " but they sent a retrieve ball RPC"); } } } private static void PetRetrieve(PlayerControllerB player, TamedEnemyBehaviour tamedEnemyBehaviour) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Vector3 positionInFrontOfPlayerEyes = Utils.GetPositionInFrontOfPlayerEyes(player); PokeballItem pokeballItem = tamedEnemyBehaviour.RetrieveInBall(positionInFrontOfPlayerEyes); if (!((Object)(object)pokeballItem == (Object)null)) { Bounds bounds = StartOfRound.Instance.shipBounds.bounds; bool flag = ((Bounds)(ref bounds)).Contains(positionInFrontOfPlayerEyes); player.SetItemInElevator(flag, flag, (GrabbableObject)(object)pokeballItem); ((Component)pokeballItem).transform.SetParent(StartOfRound.Instance.elevatorTransform, true); } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void ConnectPlayerPostfix(PlayerControllerB __instance) { ModConfig.Instance.RetrieveBallKey.performed += RetrieveBallKeyPressed; ModConfig.Instance.ActionKey1.performed += ActionKey1Pressed; } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPrefix] public static void DisconnectPlayerPrefix() { ModConfig.Instance.RetrieveBallKey.performed -= RetrieveBallKeyPressed; ModConfig.Instance.ActionKey1.performed -= ActionKey1Pressed; } internal static void RetrieveBallKeyPressed(CallbackContext dashContext) { if (Utils.IsHost) { LethalMon.Log("RetrieveBallKeyPressed"); TamedEnemyBehaviour playerPet = Utils.GetPlayerPet(Utils.CurrentPlayer); if ((Object)(object)playerPet != (Object)null) { PetRetrieve(Utils.CurrentPlayer, playerPet); } } else { SendPetRetrievePacket(Utils.CurrentPlayer); } } internal static void ActionKey1Pressed(CallbackContext dashContext) { LethalMon.Log("ActionKey1Pressed"); TamedEnemyBehaviour playerPet = Utils.GetPlayerPet(Utils.CurrentPlayer); if ((Object)(object)playerPet != (Object)null) { playerPet.ActionKey1Pressed(); } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void UpdatePostfix(PlayerControllerB __instance) { if (__instance == null || !__instance.isPlayerControlled || !((NetworkBehaviour)__instance).IsOwner || !((Object)(object)StartOfRound.Instance.testRoom != (Object)null) || (!((NetworkBehaviour)__instance).IsHost && !((NetworkBehaviour)__instance).IsServer)) { return; } bool flag = InputControlExtensions.IsPressed((InputControl)(object)Keyboard.current[(Key)29], 0f); if (flag && !lastTestPressed) { lastTestPressed = true; GrabbableObject val = __instance.ItemSlots[__instance.currentItemSlot]; if (!((Object)(object)val != (Object)null)) { return; } PokeballItem component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { EnemyType val2 = Resources.FindObjectsOfTypeAll().First((EnemyType enemyType) => ((Object)enemyType).name == testEnemyTypes[currentTestEnemyTypeIndex]); component.SetCaughtEnemyServerRpc(((Object)val2).name); HUDManager.Instance.AddTextMessageClientRpc("Caught enemy: " + ((Object)val2).name); currentTestEnemyTypeIndex++; if (currentTestEnemyTypeIndex >= testEnemyTypes.Length) { currentTestEnemyTypeIndex = 0; } } } else if (!flag) { lastTestPressed = false; } } [HarmonyPatch(typeof(PlayerControllerB), "TeleportPlayer")] [HarmonyPostfix] private static void TeleportPlayer(PlayerControllerB __instance, Vector3 pos) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) TamedEnemyBehaviour playerPet = Utils.GetPlayerPet(__instance); if ((Object)(object)playerPet != (Object)null && playerPet.CanBeTeleported()) { Vector3 val = pos; LethalMon.Log("Teleport tamed enemy to " + ((object)(Vector3)(ref val)).ToString()); ((Behaviour)playerPet.Enemy.agent).enabled = false; ((Component)playerPet.Enemy).transform.position = pos; ((Behaviour)playerPet.Enemy.agent).enabled = true; playerPet.Enemy.serverPosition = pos; playerPet.Enemy.SetEnemyOutside(!__instance.isInsideFactory); } } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayerServerRpc")] [HarmonyPostfix] private static void KillPlayerServerRpcPostfix(PlayerControllerB __instance) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) TamedEnemyBehaviour playerPet = Utils.GetPlayerPet(__instance); if ((Object)(object)playerPet != (Object)null && Utils.IsHost && !playerPet.hasBeenRetrieved) { LethalMon.Log("Owner is dead, go back to the ball"); playerPet.RetrieveInBall(((Component)playerPet.Enemy).transform.position); } } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] [HarmonyPostfix] private static void DamagePlayerPostfix(PlayerControllerB __instance, int damageNumber, bool hasDamageSFX, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force) { TamedEnemyBehaviour playerPet = Utils.GetPlayerPet(__instance); if ((Object)(object)playerPet != (Object)null && playerPet.CanDefend) { EnemyAI mostProbableAttackerEnemy = Utils.GetMostProbableAttackerEnemy(__instance, new StackTrace()); TamedEnemyBehaviour componentInParent = ((Component)mostProbableAttackerEnemy).GetComponentInParent(); if ((Object)(object)mostProbableAttackerEnemy != (Object)null && (Object)(object)mostProbableAttackerEnemy != (Object)(object)playerPet.Enemy && ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent.ownerPlayer == (Object)null)) { playerPet.targetEnemy = mostProbableAttackerEnemy; playerPet.SwitchToTamingBehaviour(TamedEnemyBehaviour.TamingBehaviour.TamedDefending); } } } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayerFromOtherClientServerRpc")] [HarmonyPostfix] private static void DamagePlayerFromOtherClientServerRpcPostFix(PlayerControllerB __instance, Vector3 hitDirection, int playerWhoHit) { //IL_0070: 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) if ((int)__instance.playerClientId == playerWhoHit) { return; } TamedEnemyBehaviour playerPet = Utils.GetPlayerPet(__instance); if ((Object)(object)playerPet != (Object)null && (((NetworkBehaviour)__instance).IsServer || ((NetworkBehaviour)__instance).IsHost) && playerPet.CanDefend) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerWhoHit]; LethalMon.Log("Player " + val.playerUsername + " hit " + __instance.playerUsername); if ((Object)(object)__instance != (Object)(object)val && Vector3.Distance(((Component)__instance).transform.position, ((Component)val).transform.position) < 5f) { playerPet.targetPlayer = val; playerPet.SwitchToTamingBehaviour(TamedEnemyBehaviour.TamingBehaviour.TamedDefending); } } } [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] [HarmonyPostfix] private static void SwitchToItemSlotPostFix(PlayerControllerB __instance, int slot, GrabbableObject fillSlotWithItem = null) { if (!SentBallScanTip && StartOfRound.Instance.shipHasLanded && !((Object)(object)__instance != (Object)(object)Utils.CurrentPlayer)) { GrabbableObject val = __instance.ItemSlots[slot]; if ((Object)(object)val != (Object)null && ((object)val).GetType().IsSubclassOf(typeof(PokeballItem)) && !((PokeballItem)(object)val).enemyCaptured) { HUDManager.Instance.DisplayTip("LethalMon Tip", "Scan base game enemies to know if they are catchable or not. Modded enemies are not catchable.", false, false, "LC_Tip1"); SentBallScanTip = true; } } } } public class RedLocustBeesPatch { public static readonly Dictionary AngryUntil = new Dictionary(); [HarmonyPatch(typeof(RedLocustBees), "IsHivePlacedAndInLOS")] [HarmonyPrefix] private static bool IsHivePlacedAndInLOSPrefix(RedLocustBees __instance, ref bool __result) { int instanceID = ((Object)__instance).GetInstanceID(); if (AngryUntil.TryGetValue(instanceID, out var value)) { if (value < DateTime.Now) { AngryUntil.Remove(instanceID); return true; } __result = false; LethalMon.Log("ANGRY BEES!!!!"); return false; } return true; } [HarmonyPatch(typeof(RedLocustBees), "SpawnHiveNearEnemy")] [HarmonyPrefix] public static bool SpawnHiveNearEnemyPrefix(RedLocustBees __instance) { TamedEnemyBehaviour component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { return !component.IsOwnedByAPlayer(); } return true; } } public class RoundManagerPatch { private static void ChangeIsScrapForBalls(bool isScrap, bool fullOnly) { GrabbableObject[] array = Object.FindObjectsOfType(); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if (((object)val).GetType().IsSubclassOf(typeof(PokeballItem)) && (!fullOnly || ((PokeballItem)(object)val).enemyCaptured)) { val.itemProperties.isScrap = isScrap; } } } [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] [HarmonyPrefix] private static void DespawnPropsAtEndOfRoundPrefix(RoundManager __instance, bool despawnAllItems = false) { if (ModConfig.Instance.values.KeepBallsIfAllPlayersDead != "no") { ChangeIsScrapForBalls(isScrap: false, ModConfig.Instance.values.KeepBallsIfAllPlayersDead == "fullOnly"); } } [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] [HarmonyPostfix] private static void DespawnPropsAtEndOfRoundPostfix(RoundManager __instance, bool despawnAllItems = false) { if (ModConfig.Instance.values.KeepBallsIfAllPlayersDead != "no") { ChangeIsScrapForBalls(isScrap: true, ModConfig.Instance.values.KeepBallsIfAllPlayersDead == "fullOnly"); } } } public class StartOfRoundPatch { [HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")] [HarmonyPrefix] private static void OnShipHasLeftPreFix(StartOfRound __instance) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) TamedEnemyBehaviour[] array = Object.FindObjectsOfType(); LethalMon.Log($"End of game, processing {array.Length} tamed enemies"); TamedEnemyBehaviour[] array2 = array; foreach (TamedEnemyBehaviour tamedEnemyBehaviour in array2) { if (!((Object)(object)tamedEnemyBehaviour.ownerPlayer == (Object)null)) { LethalMon.Log("Player is in hangar ship room: " + tamedEnemyBehaviour.ownerPlayer.isInHangarShipRoom); if (tamedEnemyBehaviour.ownerPlayer.isInHangarShipRoom) { PokeballItem pokeballItem = tamedEnemyBehaviour.RetrieveInBall(((Component)tamedEnemyBehaviour.ownerPlayer).transform.position); tamedEnemyBehaviour.ownerPlayer.SetItemInElevator(true, true, (GrabbableObject)(object)pokeballItem); ((Component)pokeballItem).transform.SetParent(__instance.elevatorTransform, true); } } } } [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] [HarmonyPrefix] private static void OnPlayerDCPrefix(StartOfRound __instance, int playerObjectNumber, ulong clientId) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) LethalMon.Log($"Client with ID {clientId} disconnected. Starting to delete its pets"); TamedEnemyBehaviour[] array = Object.FindObjectsOfType(); TamedEnemyBehaviour[] array2 = array; foreach (TamedEnemyBehaviour tamedEnemyBehaviour in array2) { if (tamedEnemyBehaviour.ownClientId == clientId) { LethalMon.Log("Found " + ((Object)tamedEnemyBehaviour.Enemy.enemyType).name + ", retrieving in ball"); tamedEnemyBehaviour.RetrieveInBall(((Component)tamedEnemyBehaviour.Enemy).transform.position); } } } } } namespace LethalMon.Items { public enum BallType { POKEBALL, GREAT_BALL, ULTRA_BALL, MASTER_BALL } public class BallTypeMethods { public static GameObject? GetPrefab(BallType ballType) { return (GameObject?)(ballType switch { BallType.GREAT_BALL => Greatball.SpawnPrefab, BallType.ULTRA_BALL => Ultraball.SpawnPrefab, BallType.MASTER_BALL => Masterball.SpawnPrefab, _ => Pokeball.SpawnPrefab, }); } } public class Greatball : PokeballItem { public static GameObject? SpawnPrefab; public static Item? BallItem; public Greatball() : base(BallType.GREAT_BALL, 1) { } internal static void Setup(AssetBundle assetBundle) { Item val = PokeballItem.InitBallPrefab(assetBundle, "Greatball/Greatball.asset", ModConfig.Instance.values.Tier2BallSpawnWeight); if (!((Object)(object)val == (Object)null)) { BallItem = val; SpawnPrefab = val.spawnPrefab; Item? ballItem = BallItem; int tier2BallCost = ModConfig.Instance.values.Tier2BallCost; Items.RegisterShopItem(ballItem, (TerminalNode)null, (TerminalNode)null, Utils.CreateTerminalNode("Great ball", "Use it to capture monsters. Second ball tier with a medium capture rate."), tier2BallCost); LethalMon.Log("Great ball added to shop"); } } protected override void __initializeVariables() { base.__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "Greatball"; } } public class Masterball : PokeballItem { public static GameObject? SpawnPrefab; public static Item? BallItem; public Masterball() : base(BallType.MASTER_BALL, 3) { } internal static void Setup(AssetBundle assetBundle) { Item val = PokeballItem.InitBallPrefab(assetBundle, "Masterball/Masterball.asset", ModConfig.Instance.values.Tier4BallSpawnWeight); if (!((Object)(object)val == (Object)null)) { BallItem = val; SpawnPrefab = val.spawnPrefab; Item? ballItem = BallItem; int tier4BallCost = ModConfig.Instance.values.Tier4BallCost; Items.RegisterShopItem(ballItem, (TerminalNode)null, (TerminalNode)null, Utils.CreateTerminalNode("Master ball", "Use it to capture monsters. Fourth ball tier with a 100% capture rate."), tier4BallCost); LethalMon.Log("Master ball added to shop"); } } protected override void __initializeVariables() { base.__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "Masterball"; } } public class Pokeball : PokeballItem { public static GameObject? SpawnPrefab; public static Item? BallItem; public Pokeball() : base(BallType.POKEBALL, 0) { } internal static void Setup(AssetBundle assetBundle) { Item val = PokeballItem.InitBallPrefab(assetBundle, "Pokeball/Pokeball.asset", ModConfig.Instance.values.Tier1BallSpawnWeight); if (!((Object)(object)val == (Object)null)) { BallItem = val; SpawnPrefab = val.spawnPrefab; Item? ballItem = BallItem; int tier1BallCost = ModConfig.Instance.values.Tier1BallCost; Items.RegisterShopItem(ballItem, (TerminalNode)null, (TerminalNode)null, Utils.CreateTerminalNode("Pokeball", "Use it to capture monsters. First ball tier with a low capture rate."), tier1BallCost); LethalMon.Log("Pokeball added to shop"); } } protected override void __initializeVariables() { base.__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "Pokeball"; } } public abstract class PokeballItem : ThrowableItem { private EnemyAI? enemyAI; private EnemyType? enemyType; private global::LethalMon.CatchableEnemy.CatchableEnemy? catchableEnemy; private bool captureSuccess; private int captureRounds = 1; private int currentCaptureRound; internal bool enemyCaptured; private int captureStrength; private BallType ballType; public Dictionary> cooldowns = new Dictionary>(); public PokeballItem(BallType ballType, int captureStrength) { this.ballType = ballType; this.captureStrength = captureStrength; } internal static Item? InitBallPrefab(AssetBundle assetBundle, string assetPath, int scrapRarity = 1) where T : PokeballItem { if ((Object)(object)assetBundle == (Object)null) { return null; } Item val = assetBundle.LoadAsset(Path.Combine("Assets/Balls", assetPath)); if ((Object)(object)val == (Object)null) { LethalMon.Log(assetPath + " not found.", LethalMon.LogType.Error); return null; } T val2 = val.spawnPrefab.AddComponent(); ((GrabbableObject)val2).itemProperties = val; ((GrabbableObject)val2).grabbable = true; ((GrabbableObject)val2).grabbableToEnemies = true; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, scrapRarity, (LevelTypes)(-1)); return val; } public override void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Start(); for (int i = 0; i < ((GrabbableObject)this).propColliders.Length; i++) { ((GrabbableObject)this).propColliders[i].excludeLayers = LayerMask.op_Implicit(0); } } public override void ItemActivate(bool used, bool buttonDown = true) { if (StartOfRound.Instance.shipHasLanded || (Object)(object)StartOfRound.Instance.testRoom != (Object)null) { base.ItemActivate(used, buttonDown); } } private void OnTriggerEnter(Collider other) { if (!Utils.IsHost || enemyCaptured || (Object)(object)playerThrownBy == (Object)null) { return; } LethalMon.Log("Collided with " + ((Object)((Component)other).gameObject).name); LethalMon.Log("Pokeball was thrown by: " + (object)playerThrownBy); EnemyAI componentInParent = ((Component)other).GetComponentInParent(); TamedEnemyBehaviour componentInParent2 = ((Component)other).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || componentInParent.isEnemyDead || (Object)(object)componentInParent2 == (Object)null || (Object)(object)componentInParent2.ownerPlayer != (Object)null) { return; } if (Data.CatchableMonsters.TryGetValue(((Object)componentInParent.enemyType).name, out global::LethalMon.CatchableEnemy.CatchableEnemy value)) { if (value.CanBeCapturedBy(componentInParent, playerThrownBy)) { CaptureEnemy(componentInParent, value); } else { LethalMon.Log(((Object)componentInParent.enemyType).name + " is not catchable by the player who threw the ball"); } } else { LethalMon.Log(((Object)componentInParent.enemyType).name + " is not catchable"); } } public override void OnDestroy() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if (!captureSuccess && !enemyCaptured) { if ((Object)(object)enemyAI != (Object)null) { ((Component)enemyAI).gameObject.SetActive(true); if (ModelReplacementAPICompatibility.Enabled) { GameObject val = ModelReplacementAPICompatibility.FindCurrentReplacementModelIn(((Component)enemyAI).gameObject, isEnemy: true); if ((Object)(object)val != (Object)null) { val.SetActive(true); } } Data.CatchableMonsters[((Object)enemyType).name].CatchFailBehaviour(enemyAI, lastThrower); if (Utils.IsHost && Utils.Random.NextDouble() < 0.5) { GameObject prefab = BallTypeMethods.GetPrefab(ballType); if ((Object)(object)prefab == (Object)null) { LethalMon.Log("Pokeball prefabs not loaded correctly.", LethalMon.LogType.Error); } else { GameObject val2 = Object.Instantiate(prefab, ((Component)enemyAI).transform.position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); PokeballItem component = val2.GetComponent(); ((GrabbableObject)component).fallTime = 0f; ((GrabbableObject)component).scrapPersistedThroughRounds = ((GrabbableObject)this).scrapPersistedThroughRounds; ((GrabbableObject)component).SetScrapValue(((GrabbableObject)this).scrapValue); val2.GetComponent().Spawn(false); ((GrabbableObject)component).FallToGround(false); component.cooldowns = cooldowns; } } } } else if ((Object)(object)enemyAI != (Object)null) { RoundManager.Instance.SpawnedEnemies.Remove(enemyAI); if (Utils.IsHost && ((NetworkBehaviour)enemyAI).IsSpawned) { ((Component)enemyAI).GetComponent().Despawn(true); } } ((NetworkBehaviour)this).OnDestroy(); } public override void TouchGround() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) LethalMon.Log("Touch ground"); if (!enemyCaptured || (Object)(object)playerThrownBy == (Object)null) { return; } TamedEnemyBehaviour playerPet = Utils.GetPlayerPet(playerThrownBy); if ((Object)(object)playerPet != (Object)null) { if ((Object)(object)playerThrownBy == (Object)(object)Utils.CurrentPlayer) { LethalMon.Logger.LogInfo((object)"You already have a monster out!"); HUDManager.Instance.DisplayTip("LethalMon", "You already have a monster out!", false, false, "LC_Tip1"); } } else if (Utils.IsHost) { EnemyType val = enemyType; GameObject val2 = Object.Instantiate(val.enemyPrefab, ((Component)this).transform.position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); TamedEnemyBehaviour tamedEnemyBehaviour = default(TamedEnemyBehaviour); if (!val2.TryGetComponent(ref tamedEnemyBehaviour)) { LethalMon.Logger.LogWarning((object)"TouchGround: TamedEnemyBehaviour not found"); return; } LethalMon.Logger.LogInfo((object)"TouchGround: TamedEnemyBehaviour found"); tamedEnemyBehaviour.ballType = ballType; tamedEnemyBehaviour.ballValue = ((GrabbableObject)this).scrapValue; tamedEnemyBehaviour.scrapPersistedThroughRounds = ((GrabbableObject)this).scrapPersistedThroughRounds; tamedEnemyBehaviour.alreadyCollectedThisRound = RoundManager.Instance.scrapCollectedThisRound.Contains((GrabbableObject)(object)this); tamedEnemyBehaviour.SwitchToTamingBehaviour(TamedEnemyBehaviour.TamingBehaviour.TamedFollowing); Vector3 position = ((Component)tamedEnemyBehaviour.Enemy).transform.position; tamedEnemyBehaviour.Enemy.SetDestinationToPosition(position, false); ((Component)tamedEnemyBehaviour.Enemy).transform.rotation = Quaternion.LookRotation(((Component)playerThrownBy).transform.position - position); tamedEnemyBehaviour.SetCooldownTimers(cooldowns); val2.GetComponentInChildren().Spawn(true); CallTamedEnemyServerRpc(NetworkObjectReference.op_Implicit(val2.GetComponent()), ((Object)enemyType).name, NetworkObjectReference.op_Implicit(((NetworkBehaviour)playerThrownBy).NetworkObject)); Object.Destroy((Object)(object)((Component)this).gameObject); } } public override void SetControlTipsForItem() { string[] toolTips = ((GrabbableObject)this).itemProperties.toolTips; if (toolTips.Length < 1) { LethalMon.Log("Pokeball control tips array length is too short to set tips!", LethalMon.LogType.Error); return; } if (enemyCaptured && (Object)(object)enemyType != (Object)null) { toolTips[0] = "Enemy captured: " + ((Object)enemyType).name; } else { toolTips[0] = ""; } HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, ((GrabbableObject)this).itemProperties); } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); if (!enemyCaptured || catchableEnemy == null) { return -1; } return catchableEnemy.Id; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); if (Data.CatchableMonsters.Count>((KeyValuePair entry) => entry.Value.Id == saveData) != 0) { KeyValuePair catchable = Data.CatchableMonsters.First>((KeyValuePair entry) => entry.Value.Id == saveData); EnemyType caughtEnemy = Resources.FindObjectsOfTypeAll().First((EnemyType type) => ((Object)type).name == catchable.Key); SetCaughtEnemy(caughtEnemy); } } [ServerRpc(RequireOwnership = false)] public void PlayCaptureAnimationServerRpc(NetworkObjectReference enemy, int roundsNumber, bool catchSuccess) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(278188223u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemy, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, roundsNumber); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref catchSuccess, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 278188223u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayCaptureAnimationClientRpc(enemy, roundsNumber, catchSuccess); } } } [ClientRpc] public void PlayCaptureAnimationClientRpc(NetworkObjectReference enemy, int roundsNumber, bool catchSuccess) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3782321668u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemy, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, roundsNumber); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref catchSuccess, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3782321668u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LethalMon.Log("Play capture animation client rpc received"); NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref enemy)).TryGet(ref val3, (NetworkManager)null)) { LethalMon.Log(((Object)((Component)this).gameObject).name + ": Failed to get network object from network object reference (Capture animation RPC)", LethalMon.LogType.Error); return; } enemyAI = ((Component)val3).gameObject.GetComponent(); enemyType = enemyAI.enemyType; captureSuccess = catchSuccess; captureRounds = roundsNumber; currentCaptureRound = 0; PlayCaptureAnimation(); } } public void PlayCaptureAnimation() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).targetFloorPosition = ((Component)this).transform.localPosition; currentCaptureRound = 0; ((GrabbableObject)this).grabbable = false; ((GrabbableObject)this).grabbableToEnemies = false; Data.CatchableMonsters[((Object)enemyAI.enemyType).name].BeforeCapture(enemyAI, playerThrownBy); ((Component)enemyAI).gameObject.SetActive(false); if (ModelReplacementAPICompatibility.Enabled) { GameObject val = ModelReplacementAPICompatibility.FindCurrentReplacementModelIn(((Component)enemyAI).gameObject, isEnemy: true); if ((Object)(object)val != (Object)null) { val.SetActive(false); } } PlayCaptureAnimationAnimator(); } public void PlayCaptureAnimationAnimator() { Animator component = ((Component)this).GetComponent(); component.Play("Base Layer.Capture", 0); } private void CaptureEnemy(EnemyAI enemyAI, global::LethalMon.CatchableEnemy.CatchableEnemy catchable) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) LethalMon.Log("Start to capture " + ((Object)enemyAI).name); playerThrownBy = null; catchableEnemy = catchable; this.enemyAI = enemyAI; enemyType = enemyAI.enemyType; float captureProbability = catchable.GetCaptureProbability(captureStrength); float num = Mathf.Pow(captureProbability, 1f / 3f); LethalMon.Log("Total capture probability: " + captureProbability + ". Each shake has probability of " + num); captureRounds = 1; captureSuccess = false; for (int i = 0; i < 3; i++) { float num2 = (float)Data.Random.NextDouble(); LethalMon.Log("Got random value " + num2 + " for shake n°" + (i + 2)); if (!(num2 < num)) { break; } if (i == 2) { captureSuccess = true; } else { captureRounds++; } } PlayCaptureAnimationServerRpc(NetworkObjectReference.op_Implicit(((Component)this.enemyAI).GetComponent()), captureRounds, captureSuccess); } public void CaptureEnd(string message) { LethalMon.Log("Capture animation end"); if (currentCaptureRound + 1 < captureRounds) { LethalMon.Log("Play the animation again"); currentCaptureRound++; PlayCaptureAnimationAnimator(); } else if (captureSuccess) { LethalMon.Log("Capture success"); SetCaughtEnemyServerRpc(((Object)enemyType).name); playerThrownBy = null; ((GrabbableObject)this).FallToGround(false); ((GrabbableObject)this).grabbable = true; ((GrabbableObject)this).grabbableToEnemies = true; } else { LethalMon.Log("Capture failed"); if (Utils.IsHost) { ((Component)this).GetComponent().Despawn(true); } } } public void SetCaughtEnemy(EnemyType enemyType) { this.enemyType = enemyType; catchableEnemy = Data.CatchableMonsters[((Object)this.enemyType).name]; enemyCaptured = true; ChangeName(); } private void ChangeName() { string name = GetName(); ((Component)this).GetComponentInChildren().headerText = name; } private string GetName() { return ((GrabbableObject)this).itemProperties.itemName + " (" + catchableEnemy?.DisplayName + ")"; } [ServerRpc(RequireOwnership = false)] public void CallTamedEnemyServerRpc(NetworkObjectReference networkObjectReference, string enemyName, NetworkObjectReference ownerNetworkReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_00d6: 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_00f0: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(195805142u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); bool flag = enemyName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(enemyName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref ownerNetworkReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 195805142u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { CallTamedEnemyClientRpc(networkObjectReference, enemyName, ownerNetworkReference); } } [ClientRpc] public void CallTamedEnemyClientRpc(NetworkObjectReference networkObjectReference, string enemyName, NetworkObjectReference ownerNetworkReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00f0: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2447518502u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); bool flag = enemyName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(enemyName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref ownerNetworkReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2447518502u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LethalMon.Log("ReplaceWithCustomAi client rpc received"); NetworkObject val3 = default(NetworkObject); NetworkObject val4 = default(NetworkObject); if (!((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val3, (NetworkManager)null) || !((NetworkObjectReference)(ref ownerNetworkReference)).TryGet(ref val4, (NetworkManager)null)) { LethalMon.Log(((Object)((Component)this).gameObject).name + ": Failed to get network object from network object reference (Capture animation RPC)", LethalMon.LogType.Error); return; } if (!Data.CatchableMonsters.TryGetValue(enemyName, out global::LethalMon.CatchableEnemy.CatchableEnemy _)) { LethalMon.Log("Enemy not catchable (maybe mod version mismatch).", LethalMon.LogType.Error); return; } TamedEnemyBehaviour tamedEnemyBehaviour = default(TamedEnemyBehaviour); if (!((Component)val3).gameObject.TryGetComponent(ref tamedEnemyBehaviour)) { LethalMon.Log("CallTamedEnemy: No tamed enemy behaviour found.", LethalMon.LogType.Error); return; } PlayerControllerB val5 = default(PlayerControllerB); if (!((Component)val4).gameObject.TryGetComponent(ref val5)) { LethalMon.Log("CallTamedEnemy: No owner found.", LethalMon.LogType.Error); return; } tamedEnemyBehaviour.ownerPlayer = val5; tamedEnemyBehaviour.ownClientId = val5.playerClientId; tamedEnemyBehaviour.SwitchToTamingBehaviour(TamedEnemyBehaviour.TamingBehaviour.TamedFollowing); HUDManagerPatch.UpdateTamedMonsterAction(tamedEnemyBehaviour.FollowingBehaviourDescription); tamedEnemyBehaviour.OnCallFromBall(); } } [ServerRpc(RequireOwnership = false)] public void SetCaughtEnemyServerRpc(string enemyTypeName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00ba: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2854819158u, val, (RpcDelivery)0); bool flag = enemyTypeName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(enemyTypeName, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2854819158u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetCaughtEnemyClientRpc(enemyTypeName); } } [ClientRpc] public void SetCaughtEnemyClientRpc(string enemyTypeName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00ba: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1995131767u, val, (RpcDelivery)0); bool flag = enemyTypeName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(enemyTypeName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1995131767u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { string enemyTypeName2 = enemyTypeName; LethalMon.Log("SyncContentPacket client rpc received"); EnemyType caughtEnemy = Utils.EnemyTypes.First((EnemyType type) => ((Object)type).name == enemyTypeName2); SetCaughtEnemy(caughtEnemy); } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PokeballItem() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(278188223u, new RpcReceiveHandler(__rpc_handler_278188223)); NetworkManager.__rpc_func_table.Add(3782321668u, new RpcReceiveHandler(__rpc_handler_3782321668)); NetworkManager.__rpc_func_table.Add(195805142u, new RpcReceiveHandler(__rpc_handler_195805142)); NetworkManager.__rpc_func_table.Add(2447518502u, new RpcReceiveHandler(__rpc_handler_2447518502)); NetworkManager.__rpc_func_table.Add(2854819158u, new RpcReceiveHandler(__rpc_handler_2854819158)); NetworkManager.__rpc_func_table.Add(1995131767u, new RpcReceiveHandler(__rpc_handler_1995131767)); } private static void __rpc_handler_278188223(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_003e: 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_005d: 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_0077: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference enemy = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemy, default(ForNetworkSerializable)); int roundsNumber = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref roundsNumber); bool catchSuccess = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref catchSuccess, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PokeballItem)(object)target).PlayCaptureAnimationServerRpc(enemy, roundsNumber, catchSuccess); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3782321668(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_003e: 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_005d: 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_0077: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference enemy = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemy, default(ForNetworkSerializable)); int roundsNumber = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref roundsNumber); bool catchSuccess = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref catchSuccess, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((PokeballItem)(object)target).PlayCaptureAnimationClientRpc(enemy, roundsNumber, catchSuccess); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_195805142(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_004a: 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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string enemyName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyName, false); } NetworkObjectReference ownerNetworkReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref ownerNetworkReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PokeballItem)(object)target).CallTamedEnemyServerRpc(networkObjectReference, enemyName, ownerNetworkReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2447518502(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_004a: 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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string enemyName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyName, false); } NetworkObjectReference ownerNetworkReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref ownerNetworkReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((PokeballItem)(object)target).CallTamedEnemyClientRpc(networkObjectReference, enemyName, ownerNetworkReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2854819158(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(ref flag, default(ForPrimitives)); string caughtEnemyServerRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref caughtEnemyServerRpc, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((PokeballItem)(object)target).SetCaughtEnemyServerRpc(caughtEnemyServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1995131767(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(ref flag, default(ForPrimitives)); string caughtEnemyClientRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref caughtEnemyClientRpc, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((PokeballItem)(object)target).SetCaughtEnemyClientRpc(caughtEnemyClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PokeballItem"; } } public class Ultraball : PokeballItem { public static GameObject? SpawnPrefab; public static Item? BallItem; public Ultraball() : base(BallType.ULTRA_BALL, 2) { } internal static void Setup(AssetBundle assetBundle) { Item val = PokeballItem.InitBallPrefab(assetBundle, "Ultraball/Ultraball.asset", ModConfig.Instance.values.Tier3BallSpawnWeight); if (!((Object)(object)val == (Object)null)) { BallItem = val; SpawnPrefab = val.spawnPrefab; Item? ballItem = BallItem; int tier3BallCost = ModConfig.Instance.values.Tier3BallCost; Items.RegisterShopItem(ballItem, (TerminalNode)null, (TerminalNode)null, Utils.CreateTerminalNode("Ultra ball", "Use it to capture monsters. Third ball tier with a high capture rate."), tier3BallCost); LethalMon.Log("Ultra ball added to shop"); } } protected override void __initializeVariables() { base.__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "Ultraball"; } } } namespace LethalMon.CustomPasses { internal class CustomPassManager { public enum CustomPassType { SeeThroughEnemies, SeeThroughItems, SeeThroughPlayers } private Dictionary _customPasses = new Dictionary(); private static CustomPassManager? _instance; private CustomPassVolume? _volume; public static CustomPassManager Instance { get { if (_instance == null) { _instance = new CustomPassManager(); } return _instance; } } public CustomPassVolume Volume { get { if ((Object)(object)_volume == (Object)null) { _volume = ((Component)Utils.CurrentPlayer.gameplayCamera).gameObject.AddComponent(); configureVolume(); } return _volume; } } private void configureVolume() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_volume == (Object)null)) { _volume.targetCamera = Utils.CurrentPlayer.gameplayCamera; _volume.injectionPoint = (CustomPassInjectionPoint)1; _volume.isGlobal = true; } } private void InitCustomPass(CustomPassType type) { //IL_002b: 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_003b: 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_0046: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (!HasCustomPass(type)) { CustomPass val = null; switch (type) { case CustomPassType.SeeThroughEnemies: { SeeThroughCustomPass seeThroughCustomPass3 = new SeeThroughCustomPass(); ((CustomPass)seeThroughCustomPass3).clearFlags = (ClearFlag)0; seeThroughCustomPass3.seeThroughLayer = LayerMask.op_Implicit(524288); seeThroughCustomPass3.ConfigureMaterial(Utils.EnemyHighlightOutline, Utils.EnemyHighlightInline, 0.04f); val = (CustomPass)(object)seeThroughCustomPass3; break; } case CustomPassType.SeeThroughItems: { SeeThroughCustomPass seeThroughCustomPass2 = new SeeThroughCustomPass(); ((CustomPass)seeThroughCustomPass2).clearFlags = (ClearFlag)0; seeThroughCustomPass2.seeThroughLayer = LayerMask.op_Implicit(64); seeThroughCustomPass2.ConfigureMaterial(Utils.ItemHighlightOutline, Utils.ItemHighlightInline, 0.04f); val = (CustomPass)(object)seeThroughCustomPass2; break; } case CustomPassType.SeeThroughPlayers: { SeeThroughCustomPass seeThroughCustomPass = new SeeThroughCustomPass(); ((CustomPass)seeThroughCustomPass).clearFlags = (ClearFlag)0; seeThroughCustomPass.seeThroughLayer = LayerMask.op_Implicit(Utils.LayerMasks.ToInt(new Utils.LayerMasks.Mask[2] { Utils.LayerMasks.Mask.Player, Utils.LayerMasks.Mask.PlayerRagdoll })); seeThroughCustomPass.ConfigureMaterial(Utils.PlayerHighlightOutline, Utils.PlayerHighlightInline, 0.04f); val = (CustomPass)(object)seeThroughCustomPass; break; } } if (val != null) { _customPasses.Add(type, val); Volume.customPasses.Add(val); } } } private void RemoveCustomPass(CustomPassType type) { Volume.customPasses.Remove(_customPasses[type]); _customPasses.Remove(type); } public bool HasCustomPass(CustomPassType type) { return _customPasses.ContainsKey(type); } public CustomPass? CustomPassOfType(CustomPassType type) { return _customPasses.GetValueOrDefault(type); } public bool IsCustomPassEnabled(CustomPassType type) { if (!_customPasses.ContainsKey(type)) { return false; } return _customPasses[type].enabled; } public void EnableCustomPass(CustomPassType type, bool enable = true) { InitCustomPass(type); _customPasses[type].enabled = enable; } public void CleanUp() { for (int num = _customPasses.Count - 1; num >= 0; num--) { RemoveCustomPass(_customPasses.ElementAt(num).Key); } Object.DestroyImmediate((Object)(object)_volume); } } } namespace LethalMon.Compatibility { internal class MirageCompatibility { public const string MirageReferenceChain = "Mirage"; private static bool? _mirageEnabled; internal static Dictionary> headMasks = new Dictionary>(); public static bool Enabled { get { if (!_mirageEnabled.HasValue) { _mirageEnabled = Chainloader.PluginInfos.ContainsKey("Mirage"); bool? mirageEnabled = _mirageEnabled; LethalMon.Log("Mirage enabled? " + mirageEnabled); } return _mirageEnabled.Value; } } public static void SaveHeadMasksOf(GameObject gameObject) { headMasks[((Object)gameObject).GetInstanceID()] = (from t in gameObject.GetComponentsInChildren() where ((Object)t).name.StartsWith("HeadMask") select ((Component)t).gameObject).ToList(); } public static void ShowMaskOf(GameObject gameObject, bool show = true) { if (!Enabled || !headMasks.ContainsKey(((Object)gameObject).GetInstanceID())) { return; } foreach (GameObject item in headMasks[((Object)gameObject).GetInstanceID()]) { item.SetActive(show); } } public static bool IsMaskEnabled(GameObject gameObject) { if (!Enabled) { return true; } if (!headMasks.ContainsKey(((Object)gameObject).GetInstanceID())) { LethalMon.Log("No HeadMasks saved..", LethalMon.LogType.Warning); return false; } List list = headMasks[((Object)gameObject).GetInstanceID()]; if (list.Count == 0) { return false; } return list.First().activeSelf; } } internal class ModelReplacementAPICompatibility { public const string ModelReplacementApiReferenceChain = "meow.ModelReplacementAPI"; private static bool? _modelReplacementApiEnabled; public static bool Enabled { get { if (!_modelReplacementApiEnabled.HasValue) { _modelReplacementApiEnabled = Chainloader.PluginInfos.ContainsKey("meow.ModelReplacementAPI"); bool? modelReplacementApiEnabled = _modelReplacementApiEnabled; LethalMon.Log("MRApi enabled -> " + modelReplacementApiEnabled); } return _modelReplacementApiEnabled.Value; } } public static GameObject? FindCurrentReplacementModelIn(GameObject? gameObject, bool isEnemy = false) { if ((Object)(object)gameObject == (Object)null) { return null; } if (isEnemy) { MaskedReplacementBase component = gameObject.GetComponent(); if (!((Object)(object)component != (Object)null) || !component.IsActive) { return null; } return component.replacementModel; } BodyReplacementBase component2 = gameObject.GetComponent(); if (!((Object)(object)component2 != (Object)null) || !component2.IsActive) { return null; } return component2.replacementModel; } } } namespace LethalMon.CatchableEnemy { public class CatchableButler : CatchableEnemy { public CatchableButler() : base(10, "Butler", 4) { } public override void BeforeCapture(EnemyAI enemyAI, PlayerControllerB player) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown base.BeforeCapture(enemyAI, player); ButlerEnemyAI val = (ButlerEnemyAI)enemyAI; val.ambience1.Stop(); val.ambience2.Stop(); } } public class CatchableCrawler : CatchableEnemy { public CatchableCrawler() : base(12, "Thumper", 4) { } } public abstract class CatchableEnemy { private readonly int _baseCatchDifficulty; public int CatchDifficulty => Math.Clamp(_baseCatchDifficulty + ModConfig.Instance.values.CaptureRateModifier, 0, 9); public string DisplayName { get; private set; } public int Id { get; } protected CatchableEnemy(int id, string displayName, int catchDifficulty) { Id = id; DisplayName = displayName; _baseCatchDifficulty = catchDifficulty; } public float GetCaptureProbability(int ballStrength) { if (ballStrength < 0 || ballStrength >= Data.CaptureProbabilities.Length || CatchDifficulty < 0 || CatchDifficulty >= Data.CaptureProbabilities[0].Length) { return 0f; } return Data.CaptureProbabilities[ballStrength][CatchDifficulty]; } public void CatchFailBehaviour(EnemyAI enemyAI, PlayerControllerB player) { TamedEnemyBehaviour tamedEnemyBehaviour = default(TamedEnemyBehaviour); if (ModConfig.Instance.values.MonstersReactToFailedCaptures && ((Component)enemyAI).gameObject.TryGetComponent(ref tamedEnemyBehaviour)) { tamedEnemyBehaviour.OnEscapedFromBall(player); } } public virtual bool CanBeCapturedBy(EnemyAI enemyAI, PlayerControllerB player) { return true; } public virtual void BeforeCapture(EnemyAI enemyAI, PlayerControllerB player) { } } public class CatchableFlowerman : CatchableEnemy { public CatchableFlowerman() : base(1, "Bracken", 7) { } } internal class CatchableGhostGirl : CatchableEnemy { public CatchableGhostGirl() : base(7, "GhostGirl", 9) { } public override bool CanBeCapturedBy(EnemyAI enemyAI, PlayerControllerB player) { GhostGirlTamedBehaviour ghostGirlTamedBehaviour = ((enemyAI != null) ? ((Component)enemyAI).GetComponent() : null); if ((Object)(object)ghostGirlTamedBehaviour == (Object)null) { return base.CanBeCapturedBy(enemyAI, player); } int? currentCustomBehaviour = ghostGirlTamedBehaviour.CurrentCustomBehaviour; if (currentCustomBehaviour.HasValue) { return currentCustomBehaviour != 2; } return true; } } public class CatchableHoarderBug : CatchableEnemy { public CatchableHoarderBug() : base(2, "Hoarding Bug", 2) { } } internal class CatchableKidnapperFox : CatchableEnemy { public CatchableKidnapperFox() : base(9, "Fox", 4) { } public override bool CanBeCapturedBy(EnemyAI enemyAI, PlayerControllerB player) { return !((BushWolfEnemy)((enemyAI is BushWolfEnemy) ? enemyAI : null)).isHiding; } } public class CatchableMasked : CatchableEnemy { public CatchableMasked() : base(11, "Masked", 5) { } public override bool CanBeCapturedBy(EnemyAI enemyAI, PlayerControllerB player) { MaskedPlayerEnemy val = (MaskedPlayerEnemy)(object)((enemyAI is MaskedPlayerEnemy) ? enemyAI : null); if ((Object)(object)val != (Object)null) { return (Object)(object)((EnemyAI)val).inSpecialAnimationWithPlayer == (Object)null; } return base.CanBeCapturedBy(enemyAI, player); } } public class CatchableMouthDog : CatchableEnemy { public CatchableMouthDog() : base(6, "Eyeless Dog", 1) { } } public class CatchableNutcracker : CatchableEnemy { public CatchableNutcracker() : base(8, "Nutcracker", 9) { } public override void BeforeCapture(EnemyAI enemyAI, PlayerControllerB player) { base.BeforeCapture(enemyAI, player); Utils.EnableShotgunHeldByEnemyAi(enemyAI, enable: false); } } public class CatchableRedLocustBees : CatchableEnemy { public CatchableRedLocustBees() : base(3, "Bees", 4) { } } internal class CatchableSporeLizard : CatchableEnemy { public CatchableSporeLizard() : base(4, "Spore Lizard", 3) { } } internal class CatchableTulipSnake : CatchableEnemy { public CatchableTulipSnake() : base(5, "Tulip Snake", 8) { } public override bool CanBeCapturedBy(EnemyAI enemyAI, PlayerControllerB player) { if ((Object)(object)((FlowerSnakeEnemy)((enemyAI is FlowerSnakeEnemy) ? enemyAI : null)).clingingToPlayer == (Object)(object)player) { return false; } return base.CanBeCapturedBy(enemyAI, player); } } } namespace LethalMon.Behaviours { internal class ButlerTamedBehaviour : TamedEnemyBehaviour { internal enum CustomBehaviour { RunTowardsDeadEnemy = 1, CleanUpEnemy } private ButlerEnemyAI? _butler; internal readonly float CleanUpTime = 5f; internal float timeCleaning; internal ButlerEnemyAI Butler { get { if ((Object)(object)_butler == (Object)null) { ref ButlerEnemyAI? butler = ref _butler; EnemyAI enemy = base.Enemy; butler = (ButlerEnemyAI?)(object)((enemy is ButlerEnemyAI) ? enemy : null); } return _butler; } } internal override bool CanDefend => false; internal override List>? CustomBehaviourHandler => new List> { new Tuple(CustomBehaviour.RunTowardsDeadEnemy.ToString(), "Runs towards a dead enemy...", OnRunTowardsDeadEnemy), new Tuple(CustomBehaviour.CleanUpEnemy.ToString(), "Is cleaning up an enemy...", OnCleanUpEnemy) }; internal override void InitCustomBehaviour(int behaviour) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) base.InitCustomBehaviour(behaviour); switch ((CustomBehaviour)behaviour) { case CustomBehaviour.RunTowardsDeadEnemy: if (!((Object)(object)targetEnemy == (Object)null)) { ((EnemyAI)Butler).agent.speed = 9f; if (((NetworkBehaviour)this).IsOwner) { Butler.SetButlerRunningServerRpc(true); } ((EnemyAI)Butler).SetDestinationToPosition(((Component)targetEnemy).transform.position, false); } break; case CustomBehaviour.CleanUpEnemy: timeCleaning = ((((EnemyAI)Butler).creatureAnimator.GetInteger("HeldItem") == 1) ? 0f : (-2f)); ((EnemyAI)Butler).creatureAnimator.SetInteger("HeldItem", 1); ((EnemyAI)Butler).agent.speed = 0f; if (((NetworkBehaviour)this).IsOwner) { Butler.SetButlerRunningServerRpc(false); Butler.SetSweepingAnimServerRpc(true); } break; } } internal void OnRunTowardsDeadEnemy() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) if ((Object)(object)targetEnemy == (Object)null) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); return; } TurnTowardsPosition(((Component)targetEnemy).transform.position); if (Vector3.Distance(((Component)Butler).transform.position, ((Component)targetEnemy).transform.position) < 1.5f) { SwitchToCustomBehaviour(2); } } internal void OnCleanUpEnemy() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetEnemy == (Object)null) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); return; } timeCleaning += Time.deltaTime; if (timeCleaning > CleanUpTime) { timeCleaning = 0f; EnemyCleanedUpServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)targetEnemy).NetworkObject)); Butler.SetSweepingAnimServerRpc(false); } } [ServerRpc(RequireOwnership = false)] internal void EnemyCleanedUpServerRpc(NetworkObjectReference enemyRef) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: 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_01dc: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2768690249u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2768690249u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } SpawnableItemWithRarity spawnableItemWithRarity = null; GameObject val3 = null; NetworkObject val4 = default(NetworkObject); if (((NetworkObjectReference)(ref enemyRef)).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent(ref targetEnemy) && (Object)(object)targetEnemy != (Object)null) { val3 = Utils.TrySpawnRandomItemAtPosition(((Component)targetEnemy).transform.position, out spawnableItemWithRarity); if ((Object)(object)val3 == (Object)null) { LethalMon.Log("Unable to spawn an item after cleaning up the enemy.", LethalMon.LogType.Error); } else { LethalMon.Log("Spawned " + val3.GetComponent().itemProperties.itemName + " from cleaning up enemy " + targetEnemy.enemyType.enemyName); } } int num = ((spawnableItemWithRarity != null) ? ((int)((float)Random.RandomRangeInt(spawnableItemWithRarity.spawnableItem.minValue + 25, spawnableItemWithRarity.spawnableItem.maxValue + 35) * RoundManager.Instance.scrapValueMultiplier)) : 0); if ((Object)(object)val3 != (Object)null) { RoundManager instance = RoundManager.Instance; instance.totalScrapValueInLevel += (float)num; val3.GetComponent().SetScrapValue(num); } EnemyCleanedUpClientRpc(enemyRef, (Object)(object)val3 != (Object)null, (NetworkObjectReference)(((Object)(object)val3 != (Object)null) ? NetworkObjectReference.op_Implicit(val3.GetComponent()) : default(NetworkObjectReference)), num); } [ClientRpc] internal void EnemyCleanedUpClientRpc(NetworkObjectReference enemyRef, bool itemSpawned, NetworkObjectReference itemRef, int scrapValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0247: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3252690219u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref itemSpawned, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref itemRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, scrapValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3252690219u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((EnemyAI)Butler).creatureAnimator.SetInteger("HeldItem", 0); Vector3 localScale = Vector3.one; NetworkObject val3 = default(NetworkObject); Vector3 position; if (((NetworkObjectReference)(ref enemyRef)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref targetEnemy) && (Object)(object)targetEnemy != (Object)null) { position = ((Component)targetEnemy).transform.position; if (Utils.TryGetRealEnemyBounds(targetEnemy, out var bounds)) { localScale = ((Bounds)(ref bounds)).size; } } else { LethalMon.Log("EnemyCleanedUpServerRpc: Unable to get enemy object.", LethalMon.LogType.Error); position = ((Component)base.Enemy).transform.position; } Item giftBoxItem = Utils.GiftBoxItem; if ((Object)(object)giftBoxItem != (Object)null && (Object)(object)giftBoxItem.spawnPrefab != (Object)null) { GiftBoxItem component = giftBoxItem.spawnPrefab.GetComponent(); AudioClip val4 = Object.Instantiate(component.openGiftAudio); ParticleSystem val5 = Object.Instantiate(component.PoofParticle); Transform transform = ((Component)val5).transform; transform.position = position; transform.localScale = localScale; val5.Play(); Utils.PlaySoundAtPosition(((Component)Butler).transform.position, val4); Object.Destroy((Object)(object)val4, 1f); Object.Destroy((Object)(object)val5, 1f); } if (Utils.IsHost) { RoundManager.Instance.DespawnEnemyGameObject(enemyRef); } else if ((Object)(object)targetEnemy != (Object)null) { RoundManager.Instance.SpawnedEnemies.Remove(targetEnemy); } targetEnemy = null; if (((NetworkBehaviour)this).IsOwner) { EnemyAI val6 = NearestEnemy(); if ((Object)(object)val6 != (Object)null) { targetEnemy = val6; SwitchToCustomBehaviour(1); } else { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } } if (itemSpawned && !Utils.IsHost) { ((MonoBehaviour)this).StartCoroutine(waitForGiftPresentToSpawnOnClient(itemRef, scrapValue)); } } private IEnumerator waitForGiftPresentToSpawnOnClient(NetworkObjectReference netItemRef, int scrapValue) { //IL_0007: 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) NetworkObject netObject = null; float startTime = Time.realtimeSinceStartup; while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref netItemRef)).TryGet(ref netObject, (NetworkManager)null)) { yield return (object)new WaitForSeconds(0.03f); } if ((Object)(object)netObject == (Object)null) { Debug.Log((object)"No network object found"); yield break; } yield return (object)new WaitForEndOfFrame(); GrabbableObject component = ((Component)netObject).GetComponent(); RoundManager instance = RoundManager.Instance; instance.totalScrapValueInLevel += (float)scrapValue; component.SetScrapValue(scrapValue); } internal override void InitTamingBehaviour(TamingBehaviour behaviour) { base.InitTamingBehaviour(behaviour); switch (behaviour) { case TamingBehaviour.TamedFollowing: if (!((Object)(object)ownerPlayer == (Object)null)) { if ((Object)(object)((EnemyAI)Butler).agent != (Object)null) { ((EnemyAI)Butler).agent.speed = 6f; } ((EnemyAI)Butler).creatureAnimator.SetBool("Running", false); } break; case TamingBehaviour.TamedDefending: if (!((Object)(object)targetEnemy == (Object)null)) { ((EnemyAI)Butler).agent.speed = 9f; ((EnemyAI)Butler).creatureAnimator.SetBool("Running", true); } break; } } internal override void OnTamedFollowing() { base.OnTamedFollowing(); TargetNearestEnemy(); } internal override bool EnemyMeetsTargetingConditions(EnemyAI enemyAI) { if (((Component)enemyAI).gameObject.layer != 23) { return enemyAI.isEnemyDead; } return false; } internal override void OnFoundTarget() { SwitchToCustomBehaviour(1); } internal override void OnTamedDefending() { base.OnTamedDefending(); } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { base.OnEscapedFromBall(playerWhoThrewBall); if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)Butler).targetPlayer = playerWhoThrewBall; Butler.berserkModeTimer = 8f; Butler.SwitchOwnershipAndSetToStateServerRpc(2, playerWhoThrewBall.actualClientId, 0f); } } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { base.OnUpdate(update, doAIInterval); Butler.CalculateAnimationDirection(1f); } internal override void Start() { base.Start(); if ((Object)(object)ownerPlayer != (Object)null) { ((EnemyAI)Butler).agent.speed = 6f; Butler.ambience1.volume = 0f; Butler.ambience2.volume = 0f; } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ButlerTamedBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2768690249u, new RpcReceiveHandler(__rpc_handler_2768690249)); NetworkManager.__rpc_func_table.Add(3252690219u, new RpcReceiveHandler(__rpc_handler_3252690219)); } private static void __rpc_handler_2768690249(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference enemyRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ButlerTamedBehaviour)(object)target).EnemyCleanedUpServerRpc(enemyRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3252690219(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_004a: 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) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0092: 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_00ad: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference enemyRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyRef, default(ForNetworkSerializable)); bool itemSpawned = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemSpawned, default(ForPrimitives)); NetworkObjectReference itemRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemRef, default(ForNetworkSerializable)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); target.__rpc_exec_stage = (__RpcExecStage)2; ((ButlerTamedBehaviour)(object)target).EnemyCleanedUpClientRpc(enemyRef, itemSpawned, itemRef, scrapValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ButlerTamedBehaviour"; } } public class Cooldown { public string Id { get; private set; } public string DisplayName { get; private set; } public float CooldownTime { get; private set; } public Cooldown(string id, string displayName, float cooldownTime) { Id = id; DisplayName = displayName; CooldownTime = cooldownTime; } } public class CooldownNetworkBehaviour : NetworkBehaviour { private bool _needSyncing = true; private Image? _cooldownCircle; private TextMeshProUGUI? _cooldownTime; public NetworkVariable Id { get; private set; } public NetworkVariable DisplayName { get; private set; } public NetworkVariable CooldownTime { get; private set; } public bool Paused { get; private set; } public float CurrentTimer { get; private set; } public void InitTimer(float timer) { CurrentTimer = timer; _needSyncing = true; } public void Setup(Cooldown cooldownModel) { //IL_0007: 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) Id = new NetworkVariable(new FixedString64Bytes(cooldownModel.Id), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); DisplayName = new NetworkVariable(new FixedString512Bytes(cooldownModel.DisplayName), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); CooldownTime = new NetworkVariable(cooldownModel.CooldownTime, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); CurrentTimer = CooldownTime.Value; } public void Update() { if (!Paused) { CurrentTimer += Time.deltaTime; } if ((Object)(object)_cooldownCircle != (Object)null) { if (Paused && CurrentTimer == 0f) { _cooldownCircle.fillAmount = 1f; } else { _cooldownCircle.fillAmount = Mathf.Clamp(CurrentTimer / CooldownTime.Value, 0f, 1f); } float num = Mathf.Clamp(CooldownTime.Value - CurrentTimer, 0f, CooldownTime.Value); ((TMP_Text)_cooldownTime).text = ((num == 0f) ? "" : ((int)Mathf.Round(num)).ToString(CultureInfo.InvariantCulture)); } if (_needSyncing) { Sync(); } } public bool IsFinished() { return CurrentTimer >= CooldownTime.Value; } public void Reset() { CurrentTimer = 0f; _needSyncing = true; } public void Sync() { _needSyncing = false; SyncCooldownServerRpc(); } public void Pause() { Paused = true; _needSyncing = true; } public void Resume() { Paused = false; _needSyncing = true; } public void BindToHUD(Image cooldownCircle, TextMeshProUGUI cooldownTime, TextMeshProUGUI cooldownName) { //IL_0015: 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) _cooldownCircle = cooldownCircle; _cooldownTime = cooldownTime; FixedString512Bytes value = DisplayName.Value; ((TMP_Text)cooldownName).text = ((object)(FixedString512Bytes)(ref value)).ToString(); } [ServerRpc(RequireOwnership = false)] public void SyncCooldownServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1897180757u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1897180757u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { LethalMon.Log($"Send cooldown \"{DisplayName.Value}\" syncing to {CurrentTimer}"); float currentTimer = CurrentTimer; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; SyncCooldownClientRpc(currentTimer, ((NetworkTime)(ref serverTime)).Time, Paused); } } } [ClientRpc] public void SyncCooldownClientRpc(float currentTimer, double serverTime, bool paused) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2788679100u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref currentTimer, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref serverTime, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref paused, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2788679100u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { float num = currentTimer; NetworkTime serverTime2 = ((NetworkBehaviour)this).NetworkManager.ServerTime; CurrentTimer = num + (float)(((NetworkTime)(ref serverTime2)).Time - serverTime); Paused = paused; LethalMon.Log($"Cooldown \"{DisplayName.Value}\"'s timer has been set to {CurrentTimer} (paused: " + Paused + ")"); } } } protected override void __initializeVariables() { if (Id == null) { throw new Exception("CooldownNetworkBehaviour.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)Id).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)Id, "Id"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)Id); if (DisplayName == null) { throw new Exception("CooldownNetworkBehaviour.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)DisplayName).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)DisplayName, "DisplayName"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)DisplayName); if (CooldownTime == null) { throw new Exception("CooldownNetworkBehaviour.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)CooldownTime).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)CooldownTime, "CooldownTime"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)CooldownTime); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_CooldownNetworkBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1897180757u, new RpcReceiveHandler(__rpc_handler_1897180757)); NetworkManager.__rpc_func_table.Add(2788679100u, new RpcReceiveHandler(__rpc_handler_2788679100)); } private static void __rpc_handler_1897180757(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; ((CooldownNetworkBehaviour)(object)target).SyncCooldownServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2788679100(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_004a: 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) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float currentTimer = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref currentTimer, default(ForPrimitives)); double serverTime = default(double); ((FastBufferReader)(ref reader)).ReadValueSafe(ref serverTime, default(ForPrimitives)); bool paused = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref paused, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((CooldownNetworkBehaviour)(object)target).SyncCooldownClientRpc(currentTimer, serverTime, paused); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "CooldownNetworkBehaviour"; } } internal class CrawlerTamedBehaviour : TamedEnemyBehaviour { private enum CustomBehaviour { OpenSmallDoor = 1, OpenBigDoor, DisableTurret, GoToSmallDoor, GoToBigDoor, GoToTurret, AfraidOfTurret, FollowEnemy } public enum AttackType { SmallDoor, BigDoor, Turret } private CrawlerAI? _crawler; private float _iaTimer; private Vector3 _targetPos = Vector3.zero; private DoorLock? _targetSmallDoor; private TerminalAccessibleObject? _targetBigDoor; private Turret? _targetTurret; private Coroutine? _smashCoroutine; private int _stuckTries; private float _afraidTimer; private float _followEnemyTimer; private EnemyAI? _targetEnemy; private const float CheckDoorsAndTurretsInterval = 1.5f; private const float CheckReachDestinationInterval = 0.25f; private const float MaxDoorAndTurretDistance = 30f; private const int MaxStuckTries = 30; private const int SmashNumberOfTimesSmallDoorLocked = 5; private const int SmashNumberOfTimesSmallDoorUnlocked = 2; private const int SmashNumberOfTimesBigDoor = 12; private const int SmashNumberOfTimesTurret = 4; private const int CloseBigDoorAfterSeconds = 5; private const float AfraidTime = 5f; private const float FollowEnemyTime = 10f; private static readonly int SpeedMultiplier = Animator.StringToHash("speedMultiplier"); private CrawlerAI Crawler { get { if ((Object)(object)_crawler == (Object)null) { ref CrawlerAI? crawler = ref _crawler; EnemyAI enemy = base.Enemy; crawler = (CrawlerAI?)(object)((enemy is CrawlerAI) ? enemy : null); } return _crawler; } } internal override float MaxFollowDistance => 150f; internal override bool CanDefend => false; internal override List> CustomBehaviourHandler => new List> { new Tuple(CustomBehaviour.OpenSmallDoor.ToString(), "Smashes a closed door!", OpenSmallDoor), new Tuple(CustomBehaviour.OpenBigDoor.ToString(), "Smashes a secured door!", OnOpenBigDoor), new Tuple(CustomBehaviour.DisableTurret.ToString(), "Smashes a turret!", OnDisableTurret), new Tuple(CustomBehaviour.GoToSmallDoor.ToString(), "Saw a closed door!", OnGoToSmallDoor), new Tuple(CustomBehaviour.GoToBigDoor.ToString(), "Saw a secured door!", OnGoToBigDoor), new Tuple(CustomBehaviour.GoToTurret.ToString(), "Saw a turret!", OnGoToTurretDoor), new Tuple(CustomBehaviour.AfraidOfTurret.ToString(), "Got scared by a turret!", OnAfraidOfTurret), new Tuple(CustomBehaviour.FollowEnemy.ToString(), "Follows an enemy...", OnFollowEnemy) }; private void OpenSmallDoor() { if (SwitchToFollowingModeIfSmallDoorInvalid() || _smashCoroutine != null) { return; } AttackAndSync(_targetSmallDoor.isLocked ? 5 : 2, delegate { //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (_targetSmallDoor.isLocked) { _targetSmallDoor.UnlockDoorSyncWithServer(); } AnimatedObjectTrigger val = default(AnimatedObjectTrigger); if (((Component)_targetSmallDoor).gameObject.TryGetComponent(ref val)) { val.TriggerAnimationNonPlayer(false, true, false); } _targetSmallDoor.OpenDoorAsEnemyServerRpc(); BreakDoorServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)_targetSmallDoor).NetworkObject)); _targetSmallDoor = null; LethalMon.Log("Door opened!"); }, delegate { ChooseCloseEnemy(checkChance: false); }, AttackType.SmallDoor); } private void OnOpenBigDoor() { if (!SwitchToFollowingModeIfBigDoorInvalid() && _smashCoroutine == null) { AttackAndSync(12, delegate { ((Component)_targetBigDoor).GetComponentInParent().CallFunctionFromTerminal(); ((MonoBehaviour)this).StartCoroutine(CloseBigDoorAfterTime(_targetBigDoor)); _targetBigDoor = null; LethalMon.Log("Big door opened!"); }, delegate { ChooseCloseEnemy(checkChance: false); }, AttackType.BigDoor); } } private void OnDisableTurret() { if (SwitchToFollowingModeIfTurretInvalid() || _smashCoroutine != null) { return; } AttackAndSync(4, delegate { _targetTurret.SwitchTurretMode(0); _targetTurret.Update(); ((Component)_targetTurret).GetComponentInParent().CallFunctionFromTerminal(); _targetTurret = null; LethalMon.Log("Turret disabled!"); }, delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0042: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if ((int)_targetTurret.turretMode != 3) { _targetTurret.SwitchTurretMode(3); if (Random.Range(0f, 1f) < 0.5f) { _targetPos = ((EnemyAI)Crawler).ChooseFarthestNodeFromPosition(((Component)_targetTurret).transform.position, false, 0, false).position; ((EnemyAI)Crawler).SetDestinationToPosition(_targetPos, false); _targetTurret = null; _afraidTimer = 0f; SwitchToCustomBehaviour(7); return; } } ChooseCloseEnemy(checkChance: false); }, AttackType.Turret); } private void OnGoToSmallDoor() { if (!SwitchToFollowingModeIfSmallDoorInvalid()) { OnGoToTarget(2.5f, CustomBehaviour.OpenSmallDoor); } } private void OnGoToBigDoor() { if (!SwitchToFollowingModeIfBigDoorInvalid()) { OnGoToTarget(2f, CustomBehaviour.OpenBigDoor); } } private void OnGoToTurretDoor() { if (!SwitchToFollowingModeIfTurretInvalid()) { OnGoToTarget(2f, CustomBehaviour.DisableTurret); } } private void OnAfraidOfTurret() { _afraidTimer += Time.deltaTime; if (_afraidTimer >= 5f) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } } private void OnFollowEnemy() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_targetEnemy == (Object)null || _followEnemyTimer >= 10f) { _targetEnemy = null; SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } else { _followEnemyTimer += Time.deltaTime; FollowPosition(((Component)_targetEnemy).transform.position); } } internal override void Start() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) base.Start(); if (!((Object)(object)ownerPlayer == (Object)null)) { Transform transform = ((Component)Crawler).transform; transform.localScale *= 0.8f; ((EnemyAI)Crawler).openDoorSpeedMultiplier = 0f; ((EnemyAI)Crawler).creatureVoice.pitch = 1.5f; ((Component)Crawler).GetComponentInChildren().audioToPlay.volume = 0.5f; ((EnemyAI)Crawler).creatureAnimator.Play("Base Layer.CrawlSlow"); } } internal override void InitTamingBehaviour(TamingBehaviour behaviour) { if ((Object)(object)((EnemyAI)Crawler).agent != (Object)null) { ((EnemyAI)Crawler).agent.speed = 8f; } if (behaviour == TamingBehaviour.TamedFollowing && _smashCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_smashCoroutine); _smashCoroutine = null; } } internal override void InitCustomBehaviour(int behaviour) { base.InitCustomBehaviour(behaviour); ((EnemyAI)Crawler).agent.speed = 8f; if (behaviour >= 4 && behaviour <= 6) { _stuckTries = 0; } else if (_smashCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_smashCoroutine); _smashCoroutine = null; } } internal override void OnTamedFollowing() { base.OnTamedFollowing(); if (_iaTimer >= 1.5f) { _iaTimer = 0f; ChooseClosestTarget(); } } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) base.OnEscapedFromBall(playerWhoThrewBall); ((EnemyAI)Crawler).SetDestinationToPosition(((Component)playerWhoThrewBall).transform.position, false); } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0042: 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_0051: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) base.OnUpdate(update, doAIInterval); _iaTimer += Time.deltaTime; Vector3 position = ((Component)Crawler).transform.position; Animator creatureAnimator = ((EnemyAI)Crawler).creatureAnimator; int speedMultiplier = SpeedMultiplier; Vector3 val = Vector3.ClampMagnitude(position - Crawler.previousPosition, 1f); creatureAnimator.SetFloat(speedMultiplier, ((Vector3)(ref val)).sqrMagnitude / (Time.deltaTime / 4f)); Vector3 previousPosition = Crawler.previousPosition; Crawler.previousPosition = position; int? currentCustomBehaviour = base.CurrentCustomBehaviour; if (_smashCoroutine != null) { TurnTowardsPosition(_targetPos); } else { if (!Utils.IsHost || !currentCustomBehaviour.HasValue) { return; } int valueOrDefault = currentCustomBehaviour.GetValueOrDefault(); if (valueOrDefault >= 4 && valueOrDefault <= 6 && Vector3.Distance(position, previousPosition) < 0.0005f) { _stuckTries++; LethalMon.Log("Incrementing stuck tries: " + _stuckTries); if (_stuckTries > 30) { _stuckTries = 0; _targetSmallDoor = null; _targetBigDoor = null; _targetTurret = null; LethalMon.Log("Stuck, switching to following mode!"); SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } } } } public override bool CanBeTeleported() { return base.CurrentTamingBehaviour == TamingBehaviour.TamedFollowing; } private bool ChooseCloseEnemy(bool checkChance) { if (!checkChance || Random.Range(0f, 1f) < 0.15f) { EnemyAI val = NearestEnemy(requireLOS: true, fromOwnerPerspective: false); if ((Object)(object)val != (Object)null) { _targetEnemy = val; _targetSmallDoor = null; _targetBigDoor = null; _targetTurret = null; _followEnemyTimer = 0f; SwitchToCustomBehaviour(8); return true; } } return false; } private void ChooseClosestTarget() { //IL_003d: 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_004d: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) if (ChooseCloseEnemy(checkChance: true)) { return; } float num = float.MaxValue; DoorLock val = null; TerminalAccessibleObject val2 = null; Turret val3 = null; DoorLock[] array = Object.FindObjectsOfType(); DoorLock[] array2 = array; RaycastHit val5 = default(RaycastHit); foreach (DoorLock val4 in array2) { AnimatedObjectTrigger component = ((Component)val4).GetComponent(); Vector3 position = ((Component)component).transform.position; if (!val4.isDoorOpened) { float num2 = Vector3.Distance(position, ((Component)Crawler).transform.position); if (num2 <= 30f && num2 <= num && !Physics.Linecast(((Component)Crawler).transform.position, position, ref val5, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { num = num2; val = val4; } } } TerminalAccessibleObject[] array3 = Object.FindObjectsOfType(); TerminalAccessibleObject[] array4 = array3; RaycastHit val7 = default(RaycastHit); foreach (TerminalAccessibleObject val6 in array4) { Collider componentInParent = ((Component)val6).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { continue; } Vector3 position2 = ((Component)componentInParent).transform.position; if (val6 == null || !val6.isBigDoor || val6.isDoorOpen) { continue; } float num3 = Vector3.Distance(position2, ((Component)Crawler).transform.position); if (num3 <= 30f && num3 <= num) { Physics.Linecast(((Component)Crawler).transform.position, position2, ref val7, StartOfRound.Instance.collidersAndRoomMaskAndDefault); if ((Object)(object)((RaycastHit)(ref val7)).collider == (Object)(object)componentInParent) { num = num3; val2 = val6; val = null; } } } Turret[] array5 = Object.FindObjectsOfType(); Turret[] array6 = array5; foreach (Turret val8 in array6) { Vector3 position3 = ((Component)val8).transform.position; if (val8.turretActive) { float num4 = Vector3.Distance(position3, ((Component)Crawler).transform.position); if (val8.turretActive && num4 <= 30f && num4 <= num && !Physics.Linecast(((Component)Crawler).transform.position, position3, ref val5, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { num = num4; val3 = val8; val2 = null; val = null; } } } if ((Object)(object)val != (Object)null) { _targetSmallDoor = val; _targetPos = ((Component)((Component)val).GetComponent()).transform.position; SwitchToCustomBehaviour(4); } else if ((Object)(object)val2 != (Object)null) { _targetBigDoor = val2; _targetPos = ((Component)((Component)val2).GetComponentInParent()).transform.position; SwitchToCustomBehaviour(5); } else if ((Object)(object)val3 != (Object)null) { _targetTurret = val3; _targetPos = ((Component)val3).transform.position; SwitchToCustomBehaviour(6); } } private IEnumerator SmashAnimationCoroutine(int smashTimes, Action callback, Action smashAction) { ((EnemyAI)Crawler).agent.speed = 0f; int i = 0; while (i < smashTimes) { yield return (object)new WaitForSeconds(1f); ((EnemyAI)Crawler).creatureAnimator.Play("Base Layer.Attack"); RoundManager.PlayRandomClip(((EnemyAI)Crawler).creatureSFX, Crawler.hitWallSFX, true, 1f, 0, 1000); smashAction(); int num = i + 1; i = num; } _smashCoroutine = null; callback(); } private void OnGoToTarget(float reachDistance, CustomBehaviour reachCustomBehaviour) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (_iaTimer >= 0.25f) { _iaTimer = 0f; if (Vector3.Distance(_targetPos, ((Component)Crawler).transform.position) < reachDistance) { SwitchToCustomBehaviour((int)reachCustomBehaviour); LethalMon.Log("Target reached"); } } ((EnemyAI)Crawler).SetDestinationToPosition(_targetPos, false); } private void ClearTargetsAndSwitchToFollowing() { LethalMon.Log("Target invalid, switching to following mode!"); _targetSmallDoor = null; _targetBigDoor = null; _targetTurret = null; SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } private bool SwitchToFollowingModeIfSmallDoorInvalid() { if ((Object)(object)_targetSmallDoor != (Object)null && !_targetSmallDoor.isDoorOpened) { return false; } ClearTargetsAndSwitchToFollowing(); return true; } private bool SwitchToFollowingModeIfBigDoorInvalid() { if ((Object)(object)_targetBigDoor != (Object)null && !_targetBigDoor.isDoorOpen) { return false; } ClearTargetsAndSwitchToFollowing(); return true; } private bool SwitchToFollowingModeIfTurretInvalid() { if ((Object)(object)_targetTurret != (Object)null && _targetTurret.turretActive) { return false; } ClearTargetsAndSwitchToFollowing(); return true; } private IEnumerator CloseBigDoorAfterTime(TerminalAccessibleObject bigDoor) { yield return (object)new WaitForSeconds(5f); if (bigDoor.isDoorOpen) { bigDoor.CallFunctionFromTerminal(); } } public void AttackAndSync(int numberOfTimes, Action callback, Action smashAction, AttackType attackType) { _smashCoroutine = ((MonoBehaviour)this).StartCoroutine(SmashAnimationCoroutine(numberOfTimes, callback, smashAction)); AttackTargetServerRpc(numberOfTimes, attackType); } [ServerRpc(RequireOwnership = false)] public void AttackTargetServerRpc(int numberOfTimes, AttackType attackType) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1188710973u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, numberOfTimes); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref attackType, default(ForEnums)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1188710973u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Vector3 targetPos = _targetPos; int attackType2 = (int)attackType; AttackTargetClientRpc(targetPos, numberOfTimes, attackType2, NetworkObjectReference.op_Implicit((NetworkObject)(attackType switch { AttackType.Turret => ((NetworkBehaviour)_targetTurret).NetworkObject, AttackType.BigDoor => ((NetworkBehaviour)_targetBigDoor).NetworkObject, _ => ((NetworkBehaviour)_targetSmallDoor).NetworkObject, }))); } } } [ClientRpc] public void AttackTargetClientRpc(Vector3 targetPosition, int numberOfTimes, int attackType, NetworkObjectReference target) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(641670663u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetPosition); BytePacker.WriteValueBitPacked(val2, numberOfTimes); BytePacker.WriteValueBitPacked(val2, attackType); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref target, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 641670663u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } int attackType2 = attackType; if (Utils.IsHost) { return; } _targetPos = targetPosition; NetworkObject networkObject = default(NetworkObject); ((NetworkObjectReference)(ref target)).TryGet(ref networkObject, (NetworkManager)null); switch (attackType2) { case 2: _targetTurret = ((IEnumerable)Object.FindObjectsOfType()).FirstOrDefault((Func)((Turret t) => (Object)(object)((NetworkBehaviour)t).NetworkObject == (Object)(object)networkObject)); break; case 1: _targetBigDoor = ((IEnumerable)Object.FindObjectsOfType()).FirstOrDefault((Func)((TerminalAccessibleObject d) => (Object)(object)((NetworkBehaviour)d).NetworkObject == (Object)(object)networkObject)); break; default: _targetSmallDoor = ((IEnumerable)Object.FindObjectsOfType()).FirstOrDefault((Func)((DoorLock d) => (Object)(object)((NetworkBehaviour)d).NetworkObject == (Object)(object)networkObject)); break; } _smashCoroutine = ((MonoBehaviour)this).StartCoroutine(SmashAnimationCoroutine(numberOfTimes, delegate { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (attackType2 == 2) { _targetTurret.turretModeLastFrame = (TurretMode)0; _targetTurret.rotatingClockwise = false; _targetTurret.mainAudio.Stop(); _targetTurret.farAudio.Stop(); _targetTurret.berserkAudio.Stop(); if (_targetTurret.fadeBulletAudioCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_targetTurret.fadeBulletAudioCoroutine); } _targetTurret.fadeBulletAudioCoroutine = ((MonoBehaviour)this).StartCoroutine(_targetTurret.FadeBulletAudio()); _targetTurret.bulletParticles.Stop(true, (ParticleSystemStopBehavior)1); _targetTurret.rotationSpeed = 28f; _targetTurret.rotatingSmoothly = true; _targetTurret.turretAnimator.SetInteger("TurretMode", 0); _targetTurret.turretAnimator.SetBool("turretActive", _targetTurret.turretActive); _targetTurret.turretInterval = Random.Range(0f, 0.15f); } }, delegate { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 if ((int)_targetTurret.turretMode != 3) { _targetTurret.SwitchTurretMode(3); } })); } [ServerRpc(RequireOwnership = false)] public void BreakDoorServerRpc(NetworkObjectReference door) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(725492058u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref door, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 725492058u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { BreakDoorClientRpc(door); } } } [ClientRpc] public void BreakDoorClientRpc(NetworkObjectReference door) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1683010552u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref door, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1683010552u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } NetworkObject networkObject = default(NetworkObject); if (((NetworkObjectReference)(ref door)).TryGet(ref networkObject, (NetworkManager)null)) { DoorLock val3 = ((IEnumerable)Object.FindObjectsOfType()).FirstOrDefault((Func)((DoorLock dl) => (Object)(object)((NetworkBehaviour)dl).NetworkObject == (Object)(object)networkObject)); if ((Object)(object)val3 != (Object)null) { val3.doorTrigger.interactable = false; val3.doorTrigger.timeToHold = float.MaxValue; val3.doorTrigger.disabledHoverTip = "Broken"; val3.navMeshObstacle.carving = true; val3.navMeshObstacle.carveOnlyStationary = true; } else { LethalMon.Log("Door not found", LethalMon.LogType.Warning); } } else { LethalMon.Log("Door NetworkObject not found", LethalMon.LogType.Warning); } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_CrawlerTamedBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1188710973u, new RpcReceiveHandler(__rpc_handler_1188710973)); NetworkManager.__rpc_func_table.Add(641670663u, new RpcReceiveHandler(__rpc_handler_641670663)); NetworkManager.__rpc_func_table.Add(725492058u, new RpcReceiveHandler(__rpc_handler_725492058)); NetworkManager.__rpc_func_table.Add(1683010552u, new RpcReceiveHandler(__rpc_handler_1683010552)); } private static void __rpc_handler_1188710973(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0051: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int numberOfTimes = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref numberOfTimes); AttackType attackType = default(AttackType); ((FastBufferReader)(ref reader)).ReadValueSafe(ref attackType, default(ForEnums)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CrawlerTamedBehaviour)(object)target).AttackTargetServerRpc(numberOfTimes, attackType); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_641670663(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0082: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 targetPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref targetPosition); int numberOfTimes = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref numberOfTimes); int attackType = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref attackType); NetworkObjectReference target2 = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref target2, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((CrawlerTamedBehaviour)(object)target).AttackTargetClientRpc(targetPosition, numberOfTimes, attackType, target2); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_725492058(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference door = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref door, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CrawlerTamedBehaviour)(object)target).BreakDoorServerRpc(door); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1683010552(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference door = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref door, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((CrawlerTamedBehaviour)(object)target).BreakDoorClientRpc(door); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "CrawlerTamedBehaviour"; } } internal class EnemyController : NetworkBehaviour { internal EnemyAI? enemy; internal PlayerControllerB? playerControlledBy; private float controllingPlayerStamina; private Color staminaDefaultColor; private float enemyStamina = 1f; private bool inputsBinded; internal bool isSprinting; internal bool isMoving; private Vector3 lastDirection = Vector3.zero; private float currentSpeed; internal float EnemySpeedInside = 4f; internal float EnemySpeedOutside = 6f; internal float EnemyJumpForce = 10f; internal float EnemyDuration = 5f; internal float EnemyStrength = 1f; internal bool EnemyCanJump; internal bool EnemyCanFly; internal float EnemyStaminaUseMultiplier = 1f; internal Vector3 EnemyOffsetWhileControlling = Vector3.zero; internal InputAction moveAction = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false); internal InteractTrigger? controlTrigger; internal Vector3 triggerCenterDistance = Vector3.zero; internal GameObject? triggerObject; internal Action? OnStartControlling; internal Action? OnStopControlling; internal Func OnCalculateMovementVector; internal Action OnMove; internal Action? OnStartMoving; internal Action? OnStopMoving; internal Action OnJump; internal Action OnCrouch; internal bool IsPlayerControlled => (Object)(object)playerControlledBy != (Object)null; internal bool IsControlledByUs { get { if (!((Object)(object)playerControlledBy == (Object)(object)Utils.CurrentPlayer)) { return inputsBinded; } return true; } } internal virtual float ControlTriggerHoldTime => 1f; public EnemyController() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0084: 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) OnCalculateMovementVector = CalculateMovementVector; OnMove = Moving; OnJump = Jumping; OnCrouch = Crouching; } private void Awake() { if (!((Component)this).gameObject.TryGetComponent(ref enemy)) { LethalMon.Log("EnemyController: Unable to get enemy object.", LethalMon.LogType.Error); } } public void AddTrigger(string hoverTip = "Control") { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown EnemyAI? obj = enemy; if ((Object)(object)((obj != null) ? ((Component)obj).transform : null) == (Object)null || (Object)(object)controlTrigger != (Object)null) { return; } LethalMon.Log("Adding riding trigger."); if (!Utils.TryGetRealEnemyBounds(enemy, out var bounds)) { LethalMon.Log("Unable to get enemy bounds. No MeshRenderer found.", LethalMon.LogType.Error); return; } triggerObject = GameObject.CreatePrimitive((PrimitiveType)3); triggerObject.transform.position = ((Bounds)(ref bounds)).center; triggerCenterDistance = ((Component)enemy).transform.position - ((Bounds)(ref bounds)).center; triggerObject.transform.localScale = ((Bounds)(ref bounds)).size; Physics.IgnoreCollision((Collider)(object)triggerObject.GetComponent(), Utils.CurrentPlayer.playerCollider); triggerObject.tag = "InteractTrigger"; triggerObject.layer = LayerMask.NameToLayer("InteractableObject"); controlTrigger = triggerObject.AddComponent(); controlTrigger.interactable = true; InteractTrigger? obj2 = controlTrigger; GameObject obj3 = GameObject.Find("StartGameLever"); obj2.hoverIcon = ((obj3 == null) ? null : obj3.GetComponent()?.hoverIcon); controlTrigger.hoverTip = hoverTip; controlTrigger.oneHandedItemAllowed = true; controlTrigger.twoHandedItemAllowed = true; controlTrigger.holdInteraction = true; controlTrigger.touchTrigger = false; controlTrigger.timeToHold = ControlTriggerHoldTime; controlTrigger.timeToHoldSpeedMultiplier = 1f; controlTrigger.holdingInteractEvent = new InteractEventFloat(); controlTrigger.onInteract = new InteractEvent(); controlTrigger.onInteractEarly = new InteractEvent(); controlTrigger.onStopInteract = new InteractEvent(); controlTrigger.onCancelAnimation = new InteractEvent(); ((UnityEvent)(object)controlTrigger.onInteract).AddListener((UnityAction)delegate(PlayerControllerB player) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) StartControllingServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)player).NetworkObject)); }); ((Behaviour)controlTrigger).enabled = true; } public void SetControlTriggerVisible(bool visible = true) { if (!((Object)(object)controlTrigger == (Object)null)) { controlTrigger.holdInteraction = visible; controlTrigger.isPlayingSpecialAnimation = !visible; } } [ServerRpc(RequireOwnership = false)] public void StartControllingServerRpc(NetworkObjectReference playerNetworkReference) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3234952606u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerNetworkReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3234952606u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { LethalMon.Log("StartControllingServerRpc"); StartControllingClientRpc(playerNetworkReference, ((Component)enemy).transform.position); } } } [ClientRpc] public void StartControllingClientRpc(NetworkObjectReference playerNetworkReference, Vector3 enemyPos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_021b: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3929720118u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerNetworkReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyPos); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3929720118u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } LethalMon.Log("StartControllingClientRpc"); NetworkObject val3 = default(NetworkObject); PlayerControllerB val4 = default(PlayerControllerB); if (!((NetworkObjectReference)(ref playerNetworkReference)).TryGet(ref val3, (NetworkManager)null) || !((Component)val3).TryGetComponent(ref val4)) { LethalMon.Log("Failed to get player object (StartControllingClientRpc).", LethalMon.LogType.Error); return; } playerControlledBy = val4; enemy.moveTowardsDestination = false; if (EnemyCanFly) { ((Behaviour)enemy.agent).enabled = false; } val4.disableMoveInput = true; Transform transform = ((Component)enemy).transform; transform.localPosition += EnemyOffsetWhileControlling; ((Component)val4).transform.position = ((Component)enemy).transform.position - EnemyOffsetWhileControlling; ((Component)val4).transform.rotation = ((Component)enemy).transform.rotation; if (IsControlledByUs) { if (!EnemyCanFly) { enemy.agent.Warp(enemyPos); ((Behaviour)enemy.agent).enabled = false; ((Behaviour)enemy.agent).enabled = true; } controllingPlayerStamina = val4.sprintMeter; val4.sprintMeter = enemyStamina; staminaDefaultColor = ((Graphic)val4.sprintMeterUI).color; ((Graphic)val4.sprintMeterUI).color = Color.cyan; SetControlTriggerVisible(visible: false); BindInputs(); } Collider val5 = default(Collider); if (((Component)enemy).TryGetComponent(ref val5)) { Physics.IgnoreCollision(val5, val4.playerCollider); } OnStartControlling?.Invoke(); } [ServerRpc(RequireOwnership = false)] public void StopControllingServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1239255944u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1239255944u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { LethalMon.Log("StopControllingServerRpc"); StopControllingClientRpc(); } } } [ClientRpc] public void StopControllingClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1872489712u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1872489712u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { StopControlling(); } } } internal void StopControlling(bool beingDestroyed = false) { //IL_0047: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerControlledBy != (Object)null) { playerControlledBy.disableMoveInput = false; Collider val = default(Collider); if (((Component)enemy).TryGetComponent(ref val)) { Physics.IgnoreCollision(val, playerControlledBy.playerCollider, false); } } Transform transform = ((Component)enemy).transform; transform.localPosition -= EnemyOffsetWhileControlling; if (EnemyCanFly) { ((Behaviour)enemy.agent).enabled = true; } if (IsControlledByUs) { SetControlTriggerVisible(); UnbindInputs(); playerControlledBy.sprintMeter = controllingPlayerStamina; playerControlledBy.sprintMeterUI.fillAmount = playerControlledBy.sprintMeter; ((Graphic)playerControlledBy.sprintMeterUI).color = staminaDefaultColor; } if (!beingDestroyed) { OnStopControlling?.Invoke(); } playerControlledBy = null; } internal void BindInputs() { if (!inputsBinded && IsControlledByUs) { LethalMon.Log("Binding inputs to control enemy " + ((Object)enemy.enemyType).name); IngamePlayerSettings.Instance.playerInput.actions.FindAction("Sprint", false).started += SprintStart; IngamePlayerSettings.Instance.playerInput.actions.FindAction("Sprint", false).canceled += SprintStop; IngamePlayerSettings.Instance.playerInput.actions.FindAction("Crouch", false).started += Crouch; if (EnemyCanJump) { IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false).started += Jump; } inputsBinded = true; } } internal void UnbindInputs() { if (inputsBinded && IsControlledByUs) { LethalMon.Log("Unbinding inputs -> " + ((Object)enemy.enemyType).name); IngamePlayerSettings.Instance.playerInput.actions.FindAction("Sprint", false).started -= SprintStart; IngamePlayerSettings.Instance.playerInput.actions.FindAction("Sprint", false).canceled -= SprintStop; IngamePlayerSettings.Instance.playerInput.actions.FindAction("Crouch", false).started -= Crouch; if (EnemyCanJump) { IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false).started -= Jump; } inputsBinded = false; } } private void LateUpdate() { UpdateStamina(); } private void Update() { //IL_0029: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)controlTrigger != (Object)null) { ((Component)controlTrigger).gameObject.transform.position = ((Component)enemy).transform.position + triggerCenterDistance; } if ((Object)(object)playerControlledBy != (Object)null && (Object)(object)enemy != (Object)null) { if (inputsBinded) { ((Component)playerControlledBy).transform.position = ((Component)enemy).transform.position - EnemyOffsetWhileControlling; playerControlledBy.ResetFallGravity(); if (moveAction.IsPressed()) { if (!isMoving) { OnStartMoving?.Invoke(); isMoving = true; } Moving(OnCalculateMovementVector(moveAction.ReadValue())); } else { if (isMoving) { OnStopMoving?.Invoke(); isMoving = false; } if (currentSpeed > 0.1f) { Moving(lastDirection); } } } else { ((Component)enemy).transform.position = ((Component)playerControlledBy).transform.position + EnemyOffsetWhileControlling; } ((Component)enemy).transform.rotation = ((Component)playerControlledBy).transform.rotation; } if (inputsBinded && ((Object)(object)playerControlledBy == (Object)null || playerControlledBy.isPlayerDead || (Object)(object)enemy == (Object)null || enemy.isEnemyDead)) { StopControllingServerRpc(); } } private void UpdateStamina() { if (IsControlledByUs && inputsBinded) { if (isMoving) { enemyStamina = Mathf.Clamp(enemyStamina - Time.deltaTime / playerControlledBy.sprintTime * (playerControlledBy.carryWeight / EnemyStrength) * (isSprinting ? 4f : 1f) * EnemyStaminaUseMultiplier / EnemyDuration, 0f, 1f); } else if (EnemyCanFly && !playerControlledBy.IsPlayerNearGround()) { enemyStamina = Mathf.Clamp(enemyStamina - Time.deltaTime / playerControlledBy.sprintTime * (playerControlledBy.carryWeight / EnemyStrength) * EnemyStaminaUseMultiplier / EnemyDuration / 5f, 0f, 1f); } else { enemyStamina = Mathf.Clamp(enemyStamina + Time.deltaTime / (playerControlledBy.sprintTime + 1f) * EnemyStaminaUseMultiplier, 0f, 1f); } controllingPlayerStamina = Mathf.Clamp(controllingPlayerStamina + Time.deltaTime / (playerControlledBy.sprintTime + 2f), 0f, 1f); if (playerControlledBy.sprintMeter < 0.2f) { StopControllingServerRpc(); return; } playerControlledBy.sprintMeter = enemyStamina; playerControlledBy.sprintMeterUI.fillAmount = enemyStamina; } else { enemyStamina = Mathf.Clamp(enemyStamina + Time.deltaTime / 5f / EnemyDuration, 0f, 1f); } } internal void Jump(CallbackContext callbackContext) { OnJump(); } internal void SprintStart(CallbackContext callbackContext) { isSprinting = true; } internal void SprintStop(CallbackContext callbackContext) { isSprinting = false; } internal void Crouch(CallbackContext callbackContext) { OnCrouch(); } internal Vector3 CalculateMovementVector(Vector2 moveInputVector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0055: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_008c: Unknown result type (might be due to invalid IL or missing references) float num = ((moveInputVector.x > 0f) ? moveInputVector.x : (0f - moveInputVector.x)); Vector3 forward = ((Component)playerControlledBy.gameplayCamera).transform.forward; Vector3 val = Quaternion.Euler(0f, 90f * moveInputVector.x, 0f) * forward * num; Vector3 val2 = forward * moveInputVector.y; Vector3 val3 = val + val2; if (!EnemyCanFly) { val3.y = 0f; } return val3 * Time.deltaTime; } internal void Moving(Vector3 direction) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00db: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) lastDirection = direction; if (isMoving) { float num = ((playerControlledBy.isInsideFactory && (Object)(object)StartOfRound.Instance.testRoom == (Object)null) ? EnemySpeedInside : EnemySpeedOutside); if (isSprinting) { num *= 2.25f; } currentSpeed = Mathf.Max(Mathf.Lerp(currentSpeed, num, 2f * Time.deltaTime), 0f); } else { currentSpeed = Mathf.Max(Mathf.Lerp(currentSpeed, 0f, 5f * Time.deltaTime), 0f); } direction *= currentSpeed; if (EnemyCanFly) { Vector3 val = direction; Bounds bounds = playerControlledBy.playerCollider.bounds; ((Vector3)(ref val)).Scale(((Bounds)(ref bounds)).size / 2f); bounds = playerControlledBy.playerCollider.bounds; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(new Ray(((Bounds)(ref bounds)).center, val), ref val2, 0.5f, StartOfRound.Instance.allPlayersCollideWithMask, (QueryTriggerInteraction)1)) { return; } if (direction.y < 0f) { bounds = playerControlledBy.playerCollider.bounds; if (Physics.Raycast(new Ray(((Bounds)(ref bounds)).center, Vector3.down), ref val2, ((Component)playerControlledBy).transform.localScale.y / 2f, StartOfRound.Instance.allPlayersCollideWithMask, (QueryTriggerInteraction)1)) { return; } } Transform transform = ((Component)enemy).transform; transform.position += direction; } else { Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)enemy).transform.position + direction, RoundManager.Instance.navHit, -1f, -1); OnMove(direction); enemy.agent.Move(navMeshPosition - ((Component)enemy).transform.position); enemy.agent.destination = navMeshPosition; } } internal virtual void Crouching() { StopControllingServerRpc(); } internal virtual void Jumping() { } public override void OnDestroy() { Object.Destroy((Object)(object)triggerObject); Object.Destroy((Object)(object)controlTrigger); ((NetworkBehaviour)this).OnDestroy(); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_EnemyController() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3234952606u, new RpcReceiveHandler(__rpc_handler_3234952606)); NetworkManager.__rpc_func_table.Add(3929720118u, new RpcReceiveHandler(__rpc_handler_3929720118)); NetworkManager.__rpc_func_table.Add(1239255944u, new RpcReceiveHandler(__rpc_handler_1239255944)); NetworkManager.__rpc_func_table.Add(1872489712u, new RpcReceiveHandler(__rpc_handler_1872489712)); } private static void __rpc_handler_3234952606(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference playerNetworkReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerNetworkReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EnemyController)(object)target).StartControllingServerRpc(playerNetworkReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3929720118(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_0051: 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_0060: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference playerNetworkReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerNetworkReference, default(ForNetworkSerializable)); Vector3 enemyPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyPos); target.__rpc_exec_stage = (__RpcExecStage)2; ((EnemyController)(object)target).StartControllingClientRpc(playerNetworkReference, enemyPos); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1239255944(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; ((EnemyController)(object)target).StopControllingServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1872489712(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)2; ((EnemyController)(object)target).StopControllingClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "EnemyController"; } } public class FlowermanTamedBehaviour : TamedEnemyBehaviour { internal enum CustomBehaviour { DragEnemyAway = 1, GoesBackToOwner } private EnemyAI? grabbedEnemyAi; private Transform? arm1L; private Transform? arm2L; private Transform? arm3L; private Transform? hand1L; private Transform? arm1R; private Transform? arm2R; private Transform? arm3R; private Transform? hand1R; private static Dictionary> grabbedMonstersPositions = new Dictionary> { { "SpringManAI", new Tuple(0.5f, 0f, Quaternion.Euler(15f, 0f, 0f)) }, { "FlowermanAI", new Tuple(0.5f, 0.2f, Quaternion.Euler(15f, 0f, 0f)) }, { "CrawlerAI", new Tuple(2f, 1.2f, Quaternion.Euler(-60f, 0f, 0f)) }, { "HoarderBugAI", new Tuple(1.5f, 0.3f, Quaternion.Euler(15f, 0f, 0f)) }, { "CentipedeAI", new Tuple(2.3f, 0.8f, Quaternion.Euler(-75f, 0f, 0f)) }, { "PufferAI", new Tuple(2.3f, 0.1f, Quaternion.Euler(-75f, 0f, 180f)) }, { "JesterAI", new Tuple(0.5f, 0.1f, Quaternion.Euler(15f, 0f, 0f)) }, { "NutcrackerEnemyAI", new Tuple(0.5f, 0.1f, Quaternion.Euler(15f, 0f, 0f)) }, { "MaskedPlayerEnemy", new Tuple(0.5f, 0.1f, Quaternion.Euler(15f, 0f, 0f)) }, { "ButlerEnemyAI", new Tuple(0.5f, 0.5f, Quaternion.Euler(15f, 0f, 0f)) } }; private static Dictionary> beforeGrabFunctions = new Dictionary> { { "HoarderBugAI", delegate(EnemyAI enemyAI) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown HoarderBugAI val2 = (HoarderBugAI)enemyAI; if (val2.isAngry) { ((EnemyAI)val2).SwitchToBehaviourState(0); val2.ExitChaseMode(); } } }, { "CentipedeAI", delegate(EnemyAI enemyAI) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown CentipedeAI val = (CentipedeAI)enemyAI; if ((Object)(object)val.clingingToPlayer != (Object)null) { val.StopClingingToPlayer(false); } } } }; private readonly float MaximumDistanceTowardsOwner = 50f; private static readonly string GrabCooldownId = "bracken_grab"; private CooldownNetworkBehaviour grabCooldown; internal FlowermanAI bracken { get; private set; } internal float DistanceTowardsOwner { get { //IL_001f: 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) if (!((Object)(object)ownerPlayer != (Object)null)) { return 0f; } return Vector3.Distance(((Component)ownerPlayer).transform.position, ((Component)bracken).transform.position); } } internal override string DefendingBehaviourDescription => "Saw an enemy to drag away!"; internal override List>? CustomBehaviourHandler => new List> { new Tuple(CustomBehaviour.DragEnemyAway.ToString(), "Drags an enemy away...", OnDragEnemyAway), new Tuple(CustomBehaviour.GoesBackToOwner.ToString(), "Walks back to you...", OnWalkBackToOwner) }; internal override Cooldown[] Cooldowns => new Cooldown[1] { new Cooldown(GrabCooldownId, "Grab enemy", ModConfig.Instance.values.BrackenGrabCooldown) }; internal override bool CanDefend => grabCooldown.IsFinished(); public void OnDragEnemyAway() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)grabbedEnemyAi == (Object)null) { SwitchToCustomBehaviour(2); } else if (Vector3.Distance(((Component)bracken).transform.position, ((EnemyAI)bracken).destination) < 2f || DistanceTowardsOwner > MaximumDistanceTowardsOwner) { LethalMon.Log("Enemy brought to destination or far enough away from owner, release it. Distance to owner: " + DistanceTowardsOwner); ReleaseEnemy(); ReleaseEnemyServerRpc(); SwitchToCustomBehaviour(2); } else { Utils.OpenDoorsAsEnemyAroundPosition(((Component)grabbedEnemyAi).transform.position); } } public void OnWalkBackToOwner() { //IL_0026: 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_006d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ownerPlayer == (Object)null || ownerPlayer.isPlayerDead || Vector3.Distance(((Component)bracken).transform.position, ((Component)ownerPlayer).transform.position) < 8f || !ownerPlayer.isInsideFactory) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } else { ((EnemyAI)bracken).SetDestinationToPosition(((Component)ownerPlayer).transform.position, false); } } internal override void InitCustomBehaviour(int behaviour) { base.InitCustomBehaviour(behaviour); if (behaviour == 2) { CalmDown(); } } internal override void Start() { base.Start(); EnemyAI enemy = base.Enemy; bracken = (FlowermanAI)(object)((enemy is FlowermanAI) ? enemy : null); if ((Object)(object)bracken == (Object)null) { bracken = ((Component)this).gameObject.AddComponent(); } grabCooldown = GetCooldownWithId(GrabCooldownId); if ((Object)(object)ownerPlayer != (Object)null) { ((EnemyAI)bracken).creatureAnimator.SetBool("sneak", true); ((EnemyAI)bracken).creatureAnimator.Play("Base Layer.CreepForward"); } Transform obj = ((Component)bracken).gameObject.transform.Find("FlowermanModel"); object obj2; if (obj == null) { obj2 = null; } else { Transform obj3 = obj.Find("AnimContainer"); if (obj3 == null) { obj2 = null; } else { Transform obj4 = obj3.Find("metarig"); if (obj4 == null) { obj2 = null; } else { Transform obj5 = obj4.Find("Torso1"); if (obj5 == null) { obj2 = null; } else { Transform obj6 = obj5.Find("Torso2"); obj2 = ((obj6 != null) ? obj6.Find("Torso3") : null); } } } } Transform val = (Transform)obj2; if ((Object)(object)val != (Object)null) { arm1L = val.Find("Arm1.L"); arm2L = arm1L.Find("Arm2.L"); arm3L = arm2L.Find("Arm3.L"); hand1L = arm3L.Find("Hand1.L"); arm1R = val.Find("Arm1.R"); arm2R = arm1R.Find("Arm2.R"); arm3R = arm2R.Find("Arm3.R"); hand1R = arm3R.Find("Hand1.R"); } } internal override void LateUpdate() { base.LateUpdate(); if ((Object)(object)grabbedEnemyAi != (Object)null) { SetArmsInHoldPosition(); } } internal override void OnTamedFollowing() { base.OnTamedFollowing(); if (grabCooldown.IsFinished()) { TargetNearestEnemy(); } } internal override void OnTamedDefending() { //IL_00a8: 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) if ((Object)(object)targetEnemy == (Object)null) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } else if (targetEnemy.isEnemyDead) { LethalMon.Log("Target is dead, stop targeting it"); targetEnemy = null; SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } else if (targetEnemy.meshRenderers.Any((MeshRenderer meshRendererTarget) => ((EnemyAI)bracken).meshRenderers.Any(delegate(MeshRenderer meshRendererSelf) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = ((Renderer)meshRendererSelf).bounds; return ((Bounds)(ref bounds)).Intersects(((Renderer)meshRendererTarget).bounds); }))) { LethalMon.Log("Collided with target, grab it"); EnemyAI val = targetEnemy; GrabEnemy(val); StandUp(); GrabEnemyServerRpc(NetworkObjectReference.op_Implicit(((Component)val).GetComponent())); } else { LethalMon.Log("Moving to target"); ((EnemyAI)bracken).SetDestinationToPosition(((Component)targetEnemy).transform.position, false); } } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { base.OnEscapedFromBall(playerWhoThrewBall); if (Utils.IsHost) { bracken.AddToAngerMeter(float.MaxValue); } } internal override void DoAIInterval() { base.DoAIInterval(); } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { //IL_0023: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) base.OnUpdate(update, doAIInterval: false); Animator creatureAnimator = ((EnemyAI)bracken).creatureAnimator; Vector3 val = Vector3.ClampMagnitude(((Component)bracken).transform.position - bracken.previousPosition, 1f); creatureAnimator.SetFloat("speedMultiplier", ((Vector3)(ref val)).sqrMagnitude / (Time.deltaTime / 4f)); bracken.CalculateAnimationDirection(1f); } public override void OnDestroy() { ReleaseEnemy(); base.OnDestroy(); } public override bool CanBeTeleported() { return (Object)(object)grabbedEnemyAi == (Object)null; } internal override void InitTamingBehaviour(TamingBehaviour behaviour) { base.InitTamingBehaviour(behaviour); switch (behaviour) { case TamingBehaviour.TamedFollowing: CalmDown(); break; case TamingBehaviour.TamedDefending: StandUp(); break; } } public void StandUp() { bracken.creatureAngerVoice.Play(); bracken.creatureAngerVoice.pitch = Random.Range(0.9f, 1.3f); ((EnemyAI)bracken).creatureAnimator.SetBool("anger", true); ((EnemyAI)bracken).creatureAnimator.SetBool("sneak", false); } public void CalmDown() { if ((Object)(object)bracken != (Object)null) { bracken.creatureAngerVoice.Stop(); ((EnemyAI)bracken).creatureAnimator.SetBool("sneak", true); ((EnemyAI)bracken).creatureAnimator.SetBool("anger", false); } } public void GrabEnemy(EnemyAI enemyAI) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)grabbedEnemyAi != (Object)null) { ReleaseEnemy(); ReleaseEnemyServerRpc(); } bracken.creatureAngerVoice.Stop(); if (beforeGrabFunctions.TryGetValue(((object)enemyAI).GetType().Name, out Action value)) { value(enemyAI); } PlaceEnemyAiInBrackenHands(enemyAI); targetEnemy = null; Vector3 position = ((EnemyAI)bracken).ChooseFarthestNodeFromPosition(((Component)enemyAI).transform.position, false, 0, false).position; ((EnemyAI)bracken).SetDestinationToPosition(position, false); grabCooldown.Reset(); grabCooldown.Pause(); Vector3 val = position; LethalMon.Log("Moving to " + ((object)(Vector3)(ref val)).ToString()); SwitchToCustomBehaviour(1); } public void PlaceEnemyAiInBrackenHands(EnemyAI enemyAI) { //IL_004c: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0078: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)enemyAI).enabled = false; ((Behaviour)enemyAI.agent).enabled = false; Transform transform = ((Component)enemyAI).transform; Transform transform2 = ((Component)bracken).transform; ((Component)transform).transform.SetParent(transform2); if (grabbedMonstersPositions.TryGetValue(((object)enemyAI).GetType().Name, out Tuple value)) { transform.localPosition = Vector3.up * value.Item1 + Vector3.forward * value.Item2; transform.localRotation = value.Item3; } grabbedEnemyAi = enemyAI; } public void ReleaseEnemy() { //IL_003b: 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_0053: 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_008e: Unknown result type (might be due to invalid IL or missing references) grabCooldown.Resume(); if (!((Object)(object)grabbedEnemyAi == (Object)null)) { Transform transform = ((Component)grabbedEnemyAi).transform; transform.SetParent((Transform)null); Transform transform2 = ((Component)bracken).transform; transform.localPosition = transform2.localPosition; transform.position = transform2.position; transform.rotation = transform2.rotation; transform.localRotation = transform2.localRotation; ((Behaviour)grabbedEnemyAi).enabled = true; ((Behaviour)grabbedEnemyAi.agent).enabled = true; TeleportEnemy(grabbedEnemyAi, transform2.position); grabbedEnemyAi = null; LethalMon.Log("Enemy release"); } } private void SetArmsInHoldPosition() { //IL_0023: 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) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_015e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)arm1L != (Object)null) { arm1L.localRotation = Quaternion.Euler(-115.4f, -103.6f, -162.8f); } if ((Object)(object)arm2L != (Object)null) { arm2L.localRotation = Quaternion.Euler(-15.3f, 0.4f, 37.87f); } if ((Object)(object)arm3L != (Object)null) { arm3L.localRotation = Quaternion.Euler(-88.09f, 93.4f, 8.3f); } if ((Object)(object)hand1L != (Object)null) { hand1L.localRotation = Quaternion.Euler(-22.3f, 0f, 0f); } if ((Object)(object)arm1R != (Object)null) { arm1R.localRotation = Quaternion.Euler(-81.5f, 88.9f, -553.6f); } if ((Object)(object)arm2R != (Object)null) { arm2R.localRotation = Quaternion.Euler(-50.7f, -92.46f, 6f); } if ((Object)(object)arm3R != (Object)null) { arm3R.localRotation = Quaternion.Euler(-50.6f, 5.84f, 0f); } if ((Object)(object)hand1R != (Object)null) { hand1R.localRotation = Quaternion.Euler(-69.2f, 0f, 0f); } } [ServerRpc(RequireOwnership = false)] public void GrabEnemyServerRpc(NetworkObjectReference enemyAiRef) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3120163692u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyAiRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3120163692u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GrabEnemyClientRpc(enemyAiRef); } } } [ClientRpc] public void GrabEnemyClientRpc(NetworkObjectReference enemyAiRef) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2473653781u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyAiRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2473653781u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref enemyAiRef)).TryGet(ref val3, (NetworkManager)null)) { LethalMon.Log(((Object)((Component)this).gameObject).name + ": Failed to get network object from network object reference (Grab item RPC)", LethalMon.LogType.Error); return; } PlaceEnemyAiInBrackenHands(((Component)val3).GetComponent()); StandUp(); } } [ServerRpc(RequireOwnership = false)] public void ReleaseEnemyServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2377724585u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2377724585u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ReleaseEnemyClientRpc(); } } } [ClientRpc] public void ReleaseEnemyClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2764945815u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2764945815u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ReleaseEnemy(); } } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_FlowermanTamedBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3120163692u, new RpcReceiveHandler(__rpc_handler_3120163692)); NetworkManager.__rpc_func_table.Add(2473653781u, new RpcReceiveHandler(__rpc_handler_2473653781)); NetworkManager.__rpc_func_table.Add(2377724585u, new RpcReceiveHandler(__rpc_handler_2377724585)); NetworkManager.__rpc_func_table.Add(2764945815u, new RpcReceiveHandler(__rpc_handler_2764945815)); } private static void __rpc_handler_3120163692(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference enemyAiRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyAiRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((FlowermanTamedBehaviour)(object)target).GrabEnemyServerRpc(enemyAiRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2473653781(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference enemyAiRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyAiRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((FlowermanTamedBehaviour)(object)target).GrabEnemyClientRpc(enemyAiRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2377724585(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; ((FlowermanTamedBehaviour)(object)target).ReleaseEnemyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2764945815(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)2; ((FlowermanTamedBehaviour)(object)target).ReleaseEnemyClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "FlowermanTamedBehaviour"; } } internal class GhostGirlTamedBehaviour : TamedEnemyBehaviour { internal enum CustomBehaviour { RunningBackToOwner = 1, ScareThrowerAndHunt } internal DressGirlAI? _ghostGirl; internal bool isWalking; internal Vector3 previousPosition = Vector3.zero; internal bool ownerInsideFactory; internal Coroutine? ScareAndHuntCoroutine; private static readonly string TeleportCooldownId = "dressgirl_tp"; private CooldownNetworkBehaviour teleportCooldown; internal DressGirlAI GhostGirl { get { if ((Object)(object)_ghostGirl == (Object)null) { ref DressGirlAI? ghostGirl = ref _ghostGirl; EnemyAI enemy = base.Enemy; ghostGirl = (DressGirlAI?)(object)((enemy is DressGirlAI) ? enemy : null); } return _ghostGirl; } } internal override string DefendingBehaviourDescription => "Saw an enemy to hunt!"; internal override Cooldown[] Cooldowns => new Cooldown[1] { new Cooldown(TeleportCooldownId, "Attack enemy", ModConfig.Instance.values.DressGirlTeleportCooldown) }; internal override bool CanDefend => teleportCooldown.IsFinished(); internal override List>? CustomBehaviourHandler => new List> { new Tuple(CustomBehaviour.RunningBackToOwner.ToString(), "Runs back to you...", OnRunningBackToOwner), new Tuple(CustomBehaviour.ScareThrowerAndHunt.ToString(), "Is hunting you!", WhileScaringThrower) }; internal override void InitCustomBehaviour(int behaviour) { base.InitCustomBehaviour(behaviour); switch ((CustomBehaviour)behaviour) { case CustomBehaviour.RunningBackToOwner: ownerInsideFactory = ownerPlayer.isInsideFactory; break; case CustomBehaviour.ScareThrowerAndHunt: LethalMon.Log("InitCustomBehaviour ScareThrowerAndHunt", LethalMon.LogType.Warning); if (Utils.IsHost && (Object)(object)targetPlayer != (Object)null) { EnableEnemyMeshForTargetClientRpc(targetPlayer.playerClientId); ScareAndHuntCoroutine = ((MonoBehaviour)GhostGirl).StartCoroutine(ScareThrowerAndHunt()); } break; } } public void OnRunningBackToOwner() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)GhostGirl).transform.position; LethalMon.Log("OnRunningBackToOwner: " + ((object)(Vector3)(ref position)).ToString()); AnimateWalking(); if ((Object)(object)ownerPlayer == (Object)null || ownerPlayer.isPlayerDead || Vector3.Distance(((Component)GhostGirl).transform.position, ((Component)ownerPlayer).transform.position) < 8f || ownerInsideFactory != ownerPlayer.isInsideFactory) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); EnableActionKeyControlTip(ModConfig.Instance.ActionKey1, enable: false); } else { ((EnemyAI)GhostGirl).agent.speed = 8f; ((EnemyAI)GhostGirl).SetDestinationToPosition(((Component)ownerPlayer).transform.position, false); } } public void WhileScaringThrower() { if (Utils.IsHost && ((Object)(object)targetPlayer == (Object)null || targetPlayer.isPlayerDead)) { LethalMon.Log("Stopping ScareThrowerAndHunt", LethalMon.LogType.Warning); if (ScareAndHuntCoroutine != null) { ((MonoBehaviour)GhostGirl).StopCoroutine(ScareAndHuntCoroutine); } GhostGirl.hauntingPlayer = null; targetPlayer = null; SwitchToDefaultBehaviour(0); } } internal IEnumerator ScareThrowerAndHunt() { if ((Object)(object)targetPlayer == (Object)null) { yield break; } EnableEnemyMeshForTargetClientRpc(targetPlayer.playerClientId); ((EnemyAI)GhostGirl).creatureSFX.Stop(); ((Behaviour)GhostGirl).enabled = false; bool targetingUs = (Object)(object)targetPlayer == (Object)(object)Utils.CurrentPlayer; ((EnemyAI)GhostGirl).agent.speed = 0f; if (targetingUs) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.2f, true); } RoundManager.PlayRandomClip(((EnemyAI)GhostGirl).creatureVoice, GhostGirl.appearStaringSFX, true, 1f, 0, 1000); float timeTillStart2 = 3f; while (timeTillStart2 > 0f) { TurnTowardsPosition(((Component)targetPlayer).transform.position); timeTillStart2 -= Time.deltaTime; yield return null; } RoundManager.Instance.FlickerLights(true, true); GhostGirl.hauntingPlayer = targetPlayer; GhostGirl.hauntingLocalPlayer = (Object)(object)targetPlayer == (Object)(object)Utils.CurrentPlayer; int fakeAttempts = 1; while (fakeAttempts <= 3) { if (targetingUs) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.2f + (float)fakeAttempts * 0.1f, true); } fakeAttempts++; if (!WarpToHauntPosition()) { LethalMon.Log("GhostGirl.ScareThrowerAndHunt: Unable to find next haunt position.", LethalMon.LogType.Warning); continue; } bool playerHasSeenGhostGirl = false; float timeSinceAttempt = 0f; yield return (object)new WaitUntil((Func)delegate { //IL_0010: 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_0071: 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) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_010a: Unknown result type (might be due to invalid IL or missing references) float num2 = Vector3.Distance(((Component)GhostGirl).transform.position, ((Component)targetPlayer).transform.position); if (num2 > 2f) { ((EnemyAI)GhostGirl).SetDestinationToPosition(((Component)targetPlayer).transform.position, false); } else { Vector3 val = ((Component)GhostGirl).transform.position - ((Component)targetPlayer).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; ((EnemyAI)GhostGirl).SetDestinationToPosition(((Component)targetPlayer).transform.position + normalized, false); } TurnTowardsPosition(((Component)targetPlayer).transform.position); if (!playerHasSeenGhostGirl) { playerHasSeenGhostGirl = targetPlayer.HasLineOfSightToPosition(((Component)GhostGirl).transform.position, 60f, 60, -1f); } timeSinceAttempt += Time.deltaTime; ((EnemyAI)GhostGirl).agent.speed = Mathf.Max(10f - num2, 1f) + timeSinceAttempt / 3f; return playerHasSeenGhostGirl && num2 < 2f; }); int num = Random.Range(0, GhostGirl.appearStaringSFX.Length); Utils.PlaySoundAtPosition(((Component)GhostGirl).transform.position, GhostGirl.appearStaringSFX[num]); } ((EnemyAI)GhostGirl).agent.speed = 0f; GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1.9f, true); RoundManager.Instance.FlickerLights(true, true); Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)targetPlayer).transform.position + ((Component)targetPlayer).transform.forward * 5f, GhostGirl.navHit, 5f, -1); if (((NavMeshHit)(ref GhostGirl.navHit)).hit) { ((EnemyAI)GhostGirl).agent.Warp(navMeshPosition); } else { WarpToHauntPosition(); } timeTillStart2 = 3f; while (timeTillStart2 > 0f) { TurnTowardsPosition(((Component)targetPlayer).transform.position); timeTillStart2 -= Time.deltaTime; yield return null; } ((Behaviour)GhostGirl).enabled = true; GhostGirl.BeginChasing(); } internal override void Start() { base.Start(); teleportCooldown = GetCooldownWithId(TeleportCooldownId); } internal override void LateUpdate() { AnimateWalking(); } internal override void InitTamingBehaviour(TamingBehaviour behaviour) { base.InitTamingBehaviour(behaviour); if (behaviour == TamingBehaviour.TamedDefending) { LethalMon.Log("GhostGirl: Play breathingSFX"); ((EnemyAI)GhostGirl).creatureVoice.clip = GhostGirl.breathingSFX; ((EnemyAI)GhostGirl).creatureVoice.Play(); } } internal override void OnTamedFollowing() { //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) base.OnTamedFollowing(); if (!((Object)(object)ownerPlayer == (Object)null)) { float num = Vector3.Distance(((Component)GhostGirl).transform.position, ((Component)ownerPlayer).transform.position); ((EnemyAI)GhostGirl).agent.speed = ((ownerPlayer.isSprinting || num > 5f) ? 6f : 3f); if (!GhostGirl.enemyMeshEnabled) { EnableEnemyMeshForTargetServerRpc(ownClientId); GhostGirl.enemyMeshEnabled = true; } if (teleportCooldown.IsFinished()) { TargetNearestEnemy(); } } } internal override void OnTamedDefending() { //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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) base.OnTamedDefending(); if ((Object)(object)ownerPlayer == (Object)null) { return; } float num = Vector3.Distance(((Component)GhostGirl).transform.position, ((Component)ownerPlayer).transform.position); if ((Object)(object)targetEnemy == (Object)null || targetEnemy.isEnemyDead || num > 30f) { targetEnemy = null; SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); return; } float num2 = Vector3.Distance(((Component)GhostGirl).transform.position, ((Component)targetEnemy).transform.position); if (num2 < 2f) { LethalMon.Log("GhostGirlTamedBehaviour: Teleporting enemy."); OnHitTargetEnemyServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)targetEnemy).NetworkObject)); SwitchToCustomBehaviour(1); EnableActionKeyControlTip(ModConfig.Instance.ActionKey1); } else { LethalMon.Log("GhostGirlTamedBehaviour: Moving to target"); ((EnemyAI)GhostGirl).agent.speed = 5.25f; ((EnemyAI)GhostGirl).SetDestinationToPosition(((Component)targetEnemy).transform.position, false); ((EnemyAI)GhostGirl).creatureVoice.volume = Mathf.Max((20f - num2) / 15f, 0f); } } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { base.OnEscapedFromBall(playerWhoThrewBall); if (!((Object)(object)playerWhoThrewBall == (Object)null)) { targetPlayer = playerWhoThrewBall; if (Utils.IsHost) { SwitchToCustomBehaviour(2); } } } internal void AnimateWalking() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) bool flag = Vector3.Distance(previousPosition, ((Component)GhostGirl).transform.position) > Mathf.Epsilon; if (flag != isWalking) { isWalking = flag; ((EnemyAI)GhostGirl).creatureAnimator.SetBool("Walk", isWalking); } previousPosition = ((Component)GhostGirl).transform.position; } internal IEnumerator FlickerLightsAndTurnDownBreaker() { RoundManager.Instance.FlickerLights(true, true); yield return (object)new WaitForSeconds(1f); TurnOffBreakerNearbyServerRpc(); } internal Vector3 ChooseFarthestPosition() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0055: 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) if (((EnemyAI)GhostGirl).allAINodes == null || ((EnemyAI)GhostGirl).allAINodes.Length == 0) { return RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)GhostGirl).transform.position, 80f, default(NavMeshHit)); } return ((EnemyAI)GhostGirl).ChooseFarthestNodeFromPosition(((Component)GhostGirl).transform.position, false, 0, false).position; } internal bool WarpToHauntPosition() { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) Vector3 val = GhostGirl.TryFindingHauntPosition(false, true); if (val == Vector3.zero) { val = GhostGirl.TryFindingHauntPosition(false, false); } if (val != Vector3.zero) { ((EnemyAI)GhostGirl).agent.Warp(val); return true; } return false; } [ServerRpc(RequireOwnership = false)] public void TurnOffBreakerNearbyServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(463773099u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 463773099u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { TurnOffBreakerNearbyClientRpc(); } } } [ClientRpc] public void TurnOffBreakerNearbyClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == 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(3560903152u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3560903152u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } BreakerBox[] array = Object.FindObjectsOfType(); BreakerBox[] array2 = array; foreach (BreakerBox val3 in array2) { if ((Object)(object)val3 != (Object)null && Vector3.Distance(((Component)val3).transform.position, ((Component)GhostGirl).transform.position) < 35f) { val3.SetSwitchesOff(); val3.thisAudioSource.PlayOneShot(val3.switchPowerSFX); } } } [ServerRpc(RequireOwnership = false)] public void OnHitTargetEnemyServerRpc(NetworkObjectReference enemyRef) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00de: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(416276360u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 416276360u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Vector3 newEnemyPosition = ChooseFarthestPosition(); OnHitTargetEnemyClientRpc(enemyRef, newEnemyPosition); } } } [ClientRpc] public void OnHitTargetEnemyClientRpc(NetworkObjectReference enemyRef, Vector3 newEnemyPosition) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2684175977u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref newEnemyPosition); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2684175977u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref enemyRef)).TryGet(ref val3, (NetworkManager)null) || !((Component)val3).TryGetComponent(ref targetEnemy) || (Object)(object)targetEnemy == (Object)null) { LethalMon.Log("OnHitTargetEnemyClientRpc: Unable to get enemy object.", LethalMon.LogType.Error); return; } ((EnemyAI)GhostGirl).creatureVoice.Stop(); ((MonoBehaviour)GhostGirl).StartCoroutine(TeleportAndDamage(targetEnemy, newEnemyPosition, delegate { targetEnemy = null; })); ((MonoBehaviour)RoundManager.Instance).StartCoroutine(FlickerLightsAndTurnDownBreaker()); } private IEnumerator TeleportAndDamage(EnemyAI enemyAI, Vector3 newPosition, Action onComplete = null) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) teleportCooldown.Reset(); if (enemyAI.enemyType.canDie) { DropBlood(((Component)GhostGirl).transform.position); if (enemyAI.isEnemyDead && (Object)(object)enemyAI.dieSFX != (Object)null) { Utils.PlaySoundAtPosition(((Component)GhostGirl).transform.position, enemyAI.dieSFX, 0.5f); } Utils.PlaySoundAtPosition(((Component)GhostGirl).transform.position, StartOfRound.Instance.bloodGoreSFX); } TeleportEnemy((EnemyAI)(object)GhostGirl, newPosition); TeleportEnemy(enemyAI, newPosition); if (enemyAI.enemyType.canDie) { yield return (object)new WaitForSeconds(0.1f); LethalMon.Log("Damaging enemy after teleporting."); enemyAI.HitEnemyOnLocalClient(1, default(Vector3), (PlayerControllerB)null, false, -1); } onComplete?.Invoke(); } [ServerRpc(RequireOwnership = false)] public void EnableEnemyMeshForTargetServerRpc(ulong targetPlayerID, bool enable = true) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(814085487u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, targetPlayerID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enable, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 814085487u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { EnableEnemyMeshForTargetClientRpc(targetPlayerID, enable); } } } [ClientRpc] public void EnableEnemyMeshForTargetClientRpc(ulong targetPlayerID, bool enable = true) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(582224795u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, targetPlayerID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enable, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 582224795u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((EnemyAI)GhostGirl).EnableEnemyMesh(enable && targetPlayerID == Utils.CurrentPlayerID, true); } } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_GhostGirlTamedBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(463773099u, new RpcReceiveHandler(__rpc_handler_463773099)); NetworkManager.__rpc_func_table.Add(3560903152u, new RpcReceiveHandler(__rpc_handler_3560903152)); NetworkManager.__rpc_func_table.Add(416276360u, new RpcReceiveHandler(__rpc_handler_416276360)); NetworkManager.__rpc_func_table.Add(2684175977u, new RpcReceiveHandler(__rpc_handler_2684175977)); NetworkManager.__rpc_func_table.Add(814085487u, new RpcReceiveHandler(__rpc_handler_814085487)); NetworkManager.__rpc_func_table.Add(582224795u, new RpcReceiveHandler(__rpc_handler_582224795)); } private static void __rpc_handler_463773099(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; ((GhostGirlTamedBehaviour)(object)target).TurnOffBreakerNearbyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3560903152(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)2; ((GhostGirlTamedBehaviour)(object)target).TurnOffBreakerNearbyClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_416276360(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference enemyRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((GhostGirlTamedBehaviour)(object)target).OnHitTargetEnemyServerRpc(enemyRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2684175977(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_0051: 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_0060: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference enemyRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyRef, default(ForNetworkSerializable)); Vector3 newEnemyPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newEnemyPosition); target.__rpc_exec_stage = (__RpcExecStage)2; ((GhostGirlTamedBehaviour)(object)target).OnHitTargetEnemyClientRpc(enemyRef, newEnemyPosition); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_814085487(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0051: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong targetPlayerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerID); bool enable = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enable, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((GhostGirlTamedBehaviour)(object)target).EnableEnemyMeshForTargetServerRpc(targetPlayerID, enable); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_582224795(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0051: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong targetPlayerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerID); bool enable = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enable, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((GhostGirlTamedBehaviour)(object)target).EnableEnemyMeshForTargetClientRpc(targetPlayerID, enable); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GhostGirlTamedBehaviour"; } } public class HoarderBugTamedBehaviour : TamedEnemyBehaviour { private enum CustomBehaviour { GettingItem = 1, BringBackItem } public float currentTimer; public const float searchTimer = 1f; internal static AudioClip? flySfx = null; private static readonly string BringItemCooldownId = "hoarderbug_bringitem"; private CooldownNetworkBehaviour bringItemCooldown; internal HoarderBugAI hoarderBug { get; private set; } internal override bool CanDefend => false; internal override List>? CustomBehaviourHandler => new List> { new Tuple(CustomBehaviour.GettingItem.ToString(), "Saw an interesting item!", OnGettingItem), new Tuple(CustomBehaviour.BringBackItem.ToString(), "Brings an item to you!", OnBringBackItem) }; internal override Cooldown[] Cooldowns => new Cooldown[1] { new Cooldown(BringItemCooldownId, "Bring item", ModConfig.Instance.values.HoardingBugBringItemCooldown) }; public void OnGettingItem() { if (hoarderBug.heldItem != null) { SwitchToCustomBehaviour(2); } else if (GrabTargetItemIfClose()) { LethalMon.Log("HoarderBugAI grabbed close item"); } else if ((Object)(object)hoarderBug.targetItem != (Object)null) { LethalMon.Log("HoarderBugAI found an object and move towards it"); hoarderBug.SetGoTowardsTargetObject(((Component)hoarderBug.targetItem).gameObject); } else { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } } public void OnBringBackItem() { //IL_002e: 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_0092: Unknown result type (might be due to invalid IL or missing references) if (hoarderBug.heldItem == null || (Object)(object)ownerPlayer == (Object)null) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } else if (Vector3.Distance(((Component)hoarderBug).transform.position, ((Component)ownerPlayer).transform.position) < 6f) { LethalMon.Log("HoarderBugAI drops held item to the owner"); DropItemAndCallDropRPC(((Component)hoarderBug.heldItem.itemGrabbableObject).GetComponent()); } else { LethalMon.Log("HoarderBugAI move held item to the owner"); ((EnemyAI)hoarderBug).SetDestinationToPosition(((Component)ownerPlayer).transform.position, false); } } internal override void Start() { base.Start(); EnemyAI enemy = base.Enemy; hoarderBug = (HoarderBugAI)(object)((enemy is HoarderBugAI) ? enemy : null); if ((Object)(object)hoarderBug == (Object)null) { hoarderBug = ((Component)this).gameObject.AddComponent(); } bringItemCooldown = GetCooldownWithId(BringItemCooldownId); if ((Object)(object)ownerPlayer != (Object)null) { ((EnemyAI)hoarderBug).creatureAnimator.Play("Base Layer.Walking"); } } internal override void OnTamedFollowing() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00e3: Unknown result type (might be due to invalid IL or missing references) base.OnTamedFollowing(); if ((Object)(object)ownerPlayer == (Object)null || !bringItemCooldown.IsFinished()) { return; } currentTimer += Time.deltaTime; if (!(currentTimer > 1f)) { return; } currentTimer = 0f; Collider[] array = Physics.OverlapSphere(((Component)hoarderBug).transform.position, 15f); Collider[] array2 = array; RaycastHit val2 = default(RaycastHit); foreach (Collider val in array2) { GrabbableObject componentInParent = ((Component)val).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.isInShipRoom && !componentInParent.isHeld && !(Vector3.Distance(((Component)componentInParent).transform.position, ((Component)ownerPlayer).transform.position) < 8f) && !Physics.Linecast(((Component)hoarderBug).transform.position, ((Component)componentInParent).transform.position, ref val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { LethalMon.Log("HoarderBugAI found item: " + ((Object)componentInParent).name); hoarderBug.targetItem = componentInParent; SwitchToCustomBehaviour(1); break; } } } internal override void OnTamedDefending() { base.OnTamedDefending(); } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { base.OnEscapedFromBall(playerWhoThrewBall); if (Utils.IsHost) { hoarderBug.angryTimer = 10f; hoarderBug.angryAtPlayer = playerWhoThrewBall; } } internal override void DoAIInterval() { base.DoAIInterval(); } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { base.OnUpdate(update, doAIInterval); hoarderBug.CalculateAnimationDirection(1f); } public override PokeballItem? RetrieveInBall(Vector3 position) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (hoarderBug.heldItem != null) { DropItemAndCallDropRPC(((Component)hoarderBug.heldItem.itemGrabbableObject).GetComponent()); } return base.RetrieveInBall(position); } public static void LoadAudio(AssetBundle assetBundle) { flySfx = assetBundle.LoadAsset("Assets/Audio/HoardingBug/Fly.ogg"); } private bool GrabTargetItemIfClose() { //IL_002b: 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_0077: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hoarderBug.targetItem != (Object)null && hoarderBug.heldItem == null && Vector3.Distance(((Component)hoarderBug).transform.position, ((Component)hoarderBug.targetItem).transform.position) < 0.75f) { NetworkObject component = ((Component)hoarderBug.targetItem).GetComponent(); GrabItem(component); hoarderBug.sendingGrabOrDropRPC = true; GrabItemServerRpc(NetworkObjectReference.op_Implicit(component)); return true; } return false; } private void GrabItem(NetworkObject item) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown if (hoarderBug.sendingGrabOrDropRPC) { hoarderBug.sendingGrabOrDropRPC = false; return; } if (hoarderBug.heldItem != null) { LethalMon.Log(((Object)((Component)this).gameObject).name + ": Trying to grab another item (" + ((Object)((Component)item).gameObject).name + ") while hands are already full with item (" + ((Object)((Component)hoarderBug.heldItem.itemGrabbableObject).gameObject).name + "). Dropping the currently held one."); DropItemAndCallDropRPC(((Component)hoarderBug.heldItem.itemGrabbableObject).GetComponent()); } hoarderBug.targetItem = null; GrabbableObject component = ((Component)item).gameObject.GetComponent(); hoarderBug.heldItem = new HoarderBugItem(component, (HoarderBugItemStatus)0, default(Vector3)); component.parentObject = hoarderBug.grabTarget; component.hasHitGround = false; component.GrabItemFromEnemy(base.Enemy); component.EnablePhysics(false); ((EnemyAI)hoarderBug).creatureAnimator.SetBool("Chase", true); ((EnemyAI)hoarderBug).creatureSFX.clip = flySfx; ((EnemyAI)hoarderBug).creatureSFX.Play(); RoundManager.PlayRandomClip(((EnemyAI)hoarderBug).creatureVoice, hoarderBug.chitterSFX, true, 1f, 0, 1000); } private void DropItem(NetworkObject dropItemNetworkObject, Vector3 targetFloorPosition) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if (hoarderBug.sendingGrabOrDropRPC) { hoarderBug.sendingGrabOrDropRPC = false; return; } if (hoarderBug.heldItem == null) { LethalMon.Log("Hoarder bug: my held item is null when attempting to drop it!!", LethalMon.LogType.Error); return; } GrabbableObject itemGrabbableObject = hoarderBug.heldItem.itemGrabbableObject; itemGrabbableObject.parentObject = null; ((Component)itemGrabbableObject).transform.SetParent(StartOfRound.Instance.propsContainer, true); itemGrabbableObject.EnablePhysics(true); itemGrabbableObject.fallTime = 0f; itemGrabbableObject.startFallingPosition = ((Component)itemGrabbableObject).transform.parent.InverseTransformPoint(((Component)itemGrabbableObject).transform.position); itemGrabbableObject.targetFloorPosition = ((Component)itemGrabbableObject).transform.parent.InverseTransformPoint(targetFloorPosition); itemGrabbableObject.floorYRot = -1; itemGrabbableObject.DiscardItemFromEnemy(); hoarderBug.heldItem = null; ((EnemyAI)hoarderBug).SetDestinationToPosition(((Component)hoarderBug).transform.position, false); ((EnemyAI)hoarderBug).creatureAnimator.SetBool("Chase", false); ((EnemyAI)hoarderBug).creatureSFX.Stop(); RoundManager.PlayRandomClip(((EnemyAI)hoarderBug).creatureVoice, hoarderBug.chitterSFX, true, 1f, 0, 1000); } private void DropItemAndCallDropRPC(NetworkObject dropItemNetworkObject) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) Vector3 targetFloorPosition = RoundManager.Instance.RandomlyOffsetPosition(hoarderBug.heldItem.itemGrabbableObject.GetItemFloorPosition(default(Vector3)), 1.2f, 0.4f); DropItem(dropItemNetworkObject, targetFloorPosition); hoarderBug.sendingGrabOrDropRPC = true; DropItemServerRpc(NetworkObjectReference.op_Implicit(dropItemNetworkObject), targetFloorPosition); } [ServerRpc(RequireOwnership = false)] public void DropItemServerRpc(NetworkObjectReference objectRef, Vector3 targetFloorPosition) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2160621892u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref objectRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetFloorPosition); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2160621892u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { bringItemCooldown.Resume(); DropItemClientRpc(objectRef, targetFloorPosition); SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } } } [ClientRpc] public void DropItemClientRpc(NetworkObjectReference objectRef, Vector3 targetFloorPosition) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4216062849u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref objectRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetFloorPosition); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4216062849u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkObject dropItemNetworkObject = default(NetworkObject); if (!((NetworkObjectReference)(ref objectRef)).TryGet(ref dropItemNetworkObject, (NetworkManager)null)) { LethalMon.Log(((Object)((Component)this).gameObject).name + ": Failed to get network object from network object reference (Drop item RPC)", LethalMon.LogType.Error); } else { DropItem(dropItemNetworkObject, targetFloorPosition); } } } [ServerRpc(RequireOwnership = false)] public void GrabItemServerRpc(NetworkObjectReference objectRef) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(961937343u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 961937343u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { bringItemCooldown.Reset(); bringItemCooldown.Pause(); GrabItemClientRpc(objectRef); SwitchToCustomBehaviour(2); } } } [ClientRpc] public void GrabItemClientRpc(NetworkObjectReference objectRef) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1405308731u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref objectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1405308731u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkObject item = default(NetworkObject); if (!((NetworkObjectReference)(ref objectRef)).TryGet(ref item, (NetworkManager)null)) { LethalMon.Log(((Object)((Component)this).gameObject).name + ": Failed to get network object from network object reference (Grab item RPC)", LethalMon.LogType.Error); } else { GrabItem(item); } } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_HoarderBugTamedBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2160621892u, new RpcReceiveHandler(__rpc_handler_2160621892)); NetworkManager.__rpc_func_table.Add(4216062849u, new RpcReceiveHandler(__rpc_handler_4216062849)); NetworkManager.__rpc_func_table.Add(961937343u, new RpcReceiveHandler(__rpc_handler_961937343)); NetworkManager.__rpc_func_table.Add(1405308731u, new RpcReceiveHandler(__rpc_handler_1405308731)); } private static void __rpc_handler_2160621892(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_0051: 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_0060: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference objectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref objectRef, default(ForNetworkSerializable)); Vector3 targetFloorPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref targetFloorPosition); target.__rpc_exec_stage = (__RpcExecStage)1; ((HoarderBugTamedBehaviour)(object)target).DropItemServerRpc(objectRef, targetFloorPosition); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4216062849(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_0051: 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_0060: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference objectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref objectRef, default(ForNetworkSerializable)); Vector3 targetFloorPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref targetFloorPosition); target.__rpc_exec_stage = (__RpcExecStage)2; ((HoarderBugTamedBehaviour)(object)target).DropItemClientRpc(objectRef, targetFloorPosition); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_961937343(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference objectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref objectRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((HoarderBugTamedBehaviour)(object)target).GrabItemServerRpc(objectRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1405308731(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference objectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref objectRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((HoarderBugTamedBehaviour)(object)target).GrabItemClientRpc(objectRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "HoarderBugTamedBehaviour"; } } internal class KidnapperFoxTamedBehaviour : TamedEnemyBehaviour { internal class HidingMoldTrigger : MonoBehaviour { internal KidnapperFoxTamedBehaviour? moldOwner; internal bool localPlayerInsideMold; internal bool localPlayerHiding; private void OnTriggerEnter(Collider other) { PlayerControllerB val = default(PlayerControllerB); if (!((Component)other).gameObject.TryGetComponent(ref val) || (Object)(object)val != (Object)(object)Utils.CurrentPlayer) { return; } foreach (ulong hidingPlayer in hidingPlayers) { LethalMon.Log("Hiding player: " + hidingPlayer, LethalMon.LogType.Warning); } localPlayerInsideMold = true; if (val.isCrouching) { HideLocalPlayer(); } } private void OnTriggerStay() { if (localPlayerInsideMold) { bool isCrouching = Utils.CurrentPlayer.isCrouching; if (localPlayerHiding && !isCrouching) { UnhideLocalPlayer(); } else if (!localPlayerHiding && isCrouching) { HideLocalPlayer(); } } } private void OnTriggerExit(Collider other) { PlayerControllerB val = default(PlayerControllerB); if (((Component)other).gameObject.TryGetComponent(ref val) && !((Object)(object)val != (Object)(object)Utils.CurrentPlayer)) { localPlayerInsideMold = false; if (localPlayerHiding) { UnhideLocalPlayer(); } } } private void OnDestroy() { if (localPlayerHiding) { UnhideLocalPlayer(); } } private void OnDisable() { if (localPlayerHiding) { UnhideLocalPlayer(); } } private void HideLocalPlayer() { localPlayerHiding = true; Utils.CurrentPlayer.drunkness = 0.3f; moldOwner.SetPlayerHiddenInMoldServerRpc(Utils.CurrentPlayerID.Value); } private void UnhideLocalPlayer() { localPlayerHiding = false; Utils.CurrentPlayer.drunkness = 0f; moldOwner.SetPlayerHiddenInMoldServerRpc(Utils.CurrentPlayerID.Value, hide: false); } } private BushWolfEnemy? _fox; private MoldSpreadManager? _moldSpreadManager; internal static List hidingPlayers = new List(); internal List hidingSpores = new List(); internal readonly int MaximumHidingSpores = 3; internal Vector3 lastHidingSporePosition = Vector3.zero; internal readonly float IdleTimeTillSpawningSpore = 3f; internal float idleTime; internal Coroutine? tongueShootCoroutine; internal Coroutine? pushTargetCoroutine; internal readonly int TongueKillPercentage = 20; internal EnemyAI? lastHitEnemy; internal int enemyHitTimes; private static readonly string TongueCooldownId = "fox_tongue"; private CooldownNetworkBehaviour tongueCooldown; internal BushWolfEnemy Fox { get { if ((Object)(object)_fox == (Object)null) { ref BushWolfEnemy? fox = ref _fox; EnemyAI enemy = base.Enemy; fox = (BushWolfEnemy?)(object)((enemy is BushWolfEnemy) ? enemy : null); } return _fox; } } internal MoldSpreadManager MoldSpreadManager { get { if ((Object)(object)_moldSpreadManager == (Object)null) { _moldSpreadManager = Object.FindObjectOfType(); } return _moldSpreadManager; } } internal override string DefendingBehaviourDescription => "Hits an enemy with its tongue!"; internal override bool CanDefend => tongueCooldown.IsFinished(); internal override Cooldown[] Cooldowns => new Cooldown[1] { new Cooldown(TongueCooldownId, "Tongue hit", ModConfig.Instance.values.FoxTongueHitCooldown) }; internal override void Start() { //IL_0031: 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) base.Start(); tongueCooldown = GetCooldownWithId(TongueCooldownId); if ((Object)(object)ownerPlayer != (Object)null) { Transform transform = ((Component)Fox).transform; transform.localScale *= 0.75f; } } internal override void InitTamingBehaviour(TamingBehaviour behaviour) { base.InitTamingBehaviour(behaviour); if (behaviour == TamingBehaviour.TamedDefending) { ShootTongueAtEnemy(); } } internal override void OnTamedFollowing() { //IL_0063: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) base.OnTamedFollowing(); if (Fox.agentLocalVelocity.x == 0f && Fox.agentLocalVelocity.z == 0f) { idleTime += Time.deltaTime; if (idleTime > IdleTimeTillSpawningSpore) { idleTime = 0f; if (Vector3.Distance(lastHidingSporePosition, ((Component)Fox).transform.position) > 3f) { Vector3 position = ((Component)Fox).transform.position; SpawnHidingMoldServerRpc(position); lastHidingSporePosition = position; } } } else { idleTime = 0f; } if (tongueCooldown.IsFinished()) { TargetNearestEnemy(); } } internal override void OnTamedDefending() { if ((Object)(object)targetEnemy == (Object)null || targetEnemy.isEnemyDead) { if (tongueShootCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(tongueShootCoroutine); tongueShootCoroutine = null; } targetEnemy = null; ((EnemyAI)Fox).creatureAnimator.SetBool("shootTongue", false); Fox.spitParticle.Stop(); SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } base.OnTamedDefending(); } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { base.OnEscapedFromBall(playerWhoThrewBall); ((EnemyAI)Fox).EnableEnemyMesh(true, false); ((EnemyAI)Fox).targetPlayer = playerWhoThrewBall; ((EnemyAI)Fox).SwitchToBehaviourStateOnLocalClient(2); } internal override void OnCallFromBall() { base.OnCallFromBall(); ((EnemyAI)Fox).EnableEnemyMesh(true, false); } public override PokeballItem? RetrieveInBall(Vector3 position) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) for (int num = hidingSpores.Count - 1; num >= 0; num--) { DestroyHidingSpore(hidingSpores[num]); } if (tongueShootCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(tongueShootCoroutine); } if (pushTargetCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(pushTargetCoroutine); } return base.RetrieveInBall(position); } internal override void TurnTowardsPosition(Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Fox.LookAtPosition(position); } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { base.OnUpdate(update, doAIInterval); Fox.CalculateAnimationDirection(Fox.maxAnimSpeed); Fox.LateUpdate(); } internal void ShootTongueAtEnemy() { if (!((Object)(object)targetEnemy == (Object)null) && tongueShootCoroutine == null && tongueCooldown.IsFinished()) { bool flag = targetEnemy.enemyType.canDie && (enemyHitTimes >= 4 || Random.Range(0, 100) < TongueKillPercentage); tongueShootCoroutine = ((MonoBehaviour)this).StartCoroutine(ShootTongueAtEnemyCoroutine(flag)); if (flag) { lastHitEnemy = null; enemyHitTimes = 0; } else if ((Object)(object)lastHitEnemy == (Object)(object)targetEnemy) { enemyHitTimes++; } else { lastHitEnemy = targetEnemy; enemyHitTimes = 1; } } } internal IEnumerator ShootTongueAtEnemyCoroutine(bool howlAndKill = false) { if ((Object)(object)targetEnemy == (Object)null) { tongueShootCoroutine = null; yield break; } LethalMon.Log("ShootTongueAtEnemy"); if (howlAndKill) { Fox.DoMatingCall(); float timer = 0f; while (timer < 1.5f) { timer += Time.deltaTime; Fox.LookAtPosition(((Component)targetEnemy).transform.position); yield return null; } } if (howlAndKill) { int hits = 0; while (!targetEnemy.isEnemyDead && hits < 3) { PushTargetEnemyWithTongueServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)targetEnemy).NetworkObject), 1); yield return (object)new WaitWhile((Func)(() => pushTargetCoroutine != null)); hits++; } if (!targetEnemy.isEnemyDead) { PushTargetEnemyWithTongueServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)targetEnemy).NetworkObject), targetEnemy.enemyHP); yield return (object)new WaitWhile((Func)(() => pushTargetCoroutine != null)); } } else { PushTargetEnemyWithTongueServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)targetEnemy).NetworkObject)); yield return (object)new WaitWhile((Func)(() => pushTargetCoroutine != null)); } targetEnemy = null; LethalMon.Log("ShootTongueAtEnemy -> Finished coroutine"); tongueShootCoroutine = null; tongueCooldown.Reset(); SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } [ServerRpc(RequireOwnership = false)] internal void PushTargetEnemyWithTongueServerRpc(NetworkObjectReference enemyRef, int damageOnHit = 0) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2657798600u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, damageOnHit); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2657798600u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { LethalMon.Log("PushTargetEnemyWithTongueServerRpc"); PushTargetEnemyWithTongueClientRpc(enemyRef, damageOnHit); } } } [ClientRpc] internal void PushTargetEnemyWithTongueClientRpc(NetworkObjectReference enemyRef, int damageOnHit = 0) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1068421184u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, damageOnHit); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1068421184u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref enemyRef)).TryGet(ref val3, (NetworkManager)null) || !((Component)val3).TryGetComponent(ref targetEnemy) || (Object)(object)targetEnemy == (Object)null) { LethalMon.Log("PushTargetEnemyWithTongueClientRpc: Unable to get enemy object.", LethalMon.LogType.Error); return; } LethalMon.Log("PushTargetEnemyWithTongueClientRpc"); if (pushTargetCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(pushTargetCoroutine); } pushTargetCoroutine = ((MonoBehaviour)this).StartCoroutine(PushTargetEnemyWithTongue(damageOnHit)); } internal IEnumerator PushTargetEnemyWithTongue(int damageOnHit = 0) { if ((Object)(object)targetEnemy == (Object)null) { pushTargetCoroutine = null; yield break; } LethalMon.Log("PushTargetEnemyWithTongue started.", LethalMon.LogType.Warning); float num = Mathf.Min(10f - Vector3.Distance(((Component)Fox).transform.position, ((Component)targetEnemy).transform.position), 3f) * 10f; Vector3 val; if (Utils.TryGetRealEnemyBounds(targetEnemy, out var bounds)) { val = ((Bounds)(ref bounds)).size; LethalMon.Log("ENEMY HEIGHT: " + val.y); num /= ((Bounds)(ref bounds)).size.y; } val = ((Component)targetEnemy).transform.position - ((Component)Fox).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; yield return PushTargetEnemyWithTongue(normalized, num, damageOnHit); LethalMon.Log("PushTargetEnemyWithTongue finished.", LethalMon.LogType.Warning); pushTargetCoroutine = null; } private IEnumerator PushTargetEnemyWithTongue(Vector3 direction, float force, int damageOnHit = 0) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetEnemy == (Object)null) { yield break; } yield return ReachTargetEnemyWithTongue(); Vector3 val = direction; LethalMon.Log("PushTargetEnemyWithTongue in direction " + ((object)(Vector3)(ref val)).ToString() + " with a force of " + force); Vector3 position = ((Component)targetEnemy).transform.position; Vector3 val2 = ((Component)targetEnemy).transform.position + direction * force; float distanceShortenedByWall = 0f; RaycastHit val3 = default(RaycastHit); if (Physics.Linecast(position + Vector3.up, val2 + Vector3.up, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { distanceShortenedByWall = Vector3.Distance(val2, ((RaycastHit)(ref val3)).point); val2 = ((RaycastHit)(ref val3)).point - direction * 0.5f - Vector3.up; } ((Behaviour)targetEnemy).enabled = false; ((Behaviour)targetEnemy.agent).enabled = false; if (damageOnHit > 0) { DropBlood(((Component)targetEnemy).transform.position, damageOnHit, damageOnHit); targetEnemy.HitEnemy(damageOnHit, (PlayerControllerB)null, true, -1); } else { targetEnemy.creatureSFX.PlayOneShot(targetEnemy.enemyType.hitBodySFX); WalkieTalkie.TransmitOneShotAudio(targetEnemy.creatureSFX, targetEnemy.enemyType.hitBodySFX, 1f); } float duration = force / 20f; yield return PushTargetEnemyTo(val2, duration, (Action?)Fox.LateUpdate); if (distanceShortenedByWall > 0f) { float timer = 0f; float timeStunned = Mathf.Min(distanceShortenedByWall / 10f, 0.3f); LethalMon.Log("PushTargetEnemyWithTongue -> Hit wall. Stunning for " + timeStunned); while (timer < timeStunned) { timer += Time.deltaTime; if (Fox.tongueLengthNormalized > 0f) { Fox.LateUpdate(); } yield return null; } } while (Fox.tongueLengthNormalized > 0f && (Object)(object)Fox.tongueTarget == (Object)null) { Fox.LateUpdate(); yield return null; } if ((Object)(object)targetEnemy != (Object)null && !targetEnemy.isEnemyDead) { if ((Object)(object)targetEnemy.agent != (Object)null) { ((Behaviour)targetEnemy.agent).enabled = true; } ((Behaviour)targetEnemy).enabled = true; } Fox.tongueLengthNormalized = 0f; Fox.LateUpdate(); Fox.spitParticle.Stop(); LethalMon.Log("PushTargetEnemyWithTongue -> Parameterised coroutine finished"); } private IEnumerator ReachTargetEnemyWithTongue() { if (!((Object)(object)targetEnemy == (Object)null)) { ((EnemyAI)Fox).creatureAnimator.SetBool("ShootTongue", true); ((EnemyAI)Fox).creatureVoice.PlayOneShot(Fox.shootTongueSFX); Fox.tongueLengthNormalized = 0f; Fox.tongueTarget = ((Component)targetEnemy).transform; while (Fox.tongueLengthNormalized < 1f) { Fox.LookAtPosition(((Component)targetEnemy).transform.position); Fox.LateUpdate(); yield return null; } ((EnemyAI)Fox).creatureAnimator.SetBool("ShootTongue", false); Fox.tongueTarget = null; } } private IEnumerator PushTargetEnemyTo(Vector3 targetPosition, float duration, Action? onUpdate) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)targetEnemy == (Object)null)) { Vector3 startPosition = ((Component)targetEnemy).transform.position; float timer = 0f; while (timer < duration) { timer += Time.deltaTime; onUpdate?.Invoke(); TeleportEnemy(targetEnemy, Vector3.Lerp(startPosition, targetPosition, timer / duration)); yield return null; } } } [ServerRpc(RequireOwnership = false)] public void SpawnHidingMoldServerRpc(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(329086029u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 329086029u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SpawnHidingMoldClientRpc(position); } } } [ClientRpc] public void SpawnHidingMoldClientRpc(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0178: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4259470792u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4259470792u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } LethalMon.Log("SpawnHidingMoldClientRpc"); GameObject val3 = Object.Instantiate(MoldSpreadManager.moldPrefab, position, Quaternion.Euler(new Vector3(0f, Random.Range(-180f, 180f), 0f)), MoldSpreadManager.moldContainer); Transform transform = val3.transform; transform.localScale *= 0.75f; MeshRenderer[] componentsInChildren = val3.GetComponentsInChildren(); foreach (MeshRenderer val4 in componentsInChildren) { Material[] materials = ((Renderer)val4).materials; foreach (Material val5 in materials) { val5.color = new Color(Random.Range(0f, 0.8f), Random.Range(0.3f, 1f), 1f); } } val3.AddComponent().moldOwner = this; ScanNodeProperties componentInChildren = val3.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.headerText = "Hiding Shroud"; componentInChildren.subText = "Crouch to hide from enemies"; componentInChildren.nodeType = 2; } MoldSpreadManager.generatedMold.Add(val3); hidingSpores.Add(val3); if (hidingSpores.Count > MaximumHidingSpores) { DestroyHidingSpore(hidingSpores[0]); } } public void DestroyHidingSpore(GameObject hidingSpore) { //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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_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_006c: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) hidingSpore.SetActive(false); hidingSpores.Remove(hidingSpore); Vector3 position = hidingSpore.transform.position; Object.Instantiate(MoldSpreadManager.destroyParticle, position + Vector3.up * 0.5f, Quaternion.identity, (Transform)null); MoldSpreadManager.destroyAudio.Stop(); ((Component)MoldSpreadManager.destroyAudio).transform.position = position + Vector3.up * 0.5f; MoldSpreadManager.destroyAudio.Play(); RoundManager.Instance.PlayAudibleNoise(((Component)MoldSpreadManager.destroyAudio).transform.position, 6f, 0.5f, 0, false, 99611); } [ServerRpc(RequireOwnership = false)] internal void SetPlayerHiddenInMoldServerRpc(ulong playerID, bool hide = true) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2161587048u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref hide, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2161587048u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetPlayerHiddenInMoldClientRpc(playerID, hide); } } } [ClientRpc] internal void SetPlayerHiddenInMoldClientRpc(ulong playerID, bool hide = true) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3505829976u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref hide, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3505829976u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { if (hide) { hidingPlayers.Add(playerID); LethalMon.Log($"Player {playerID} is now hiding."); } else { hidingPlayers.Remove(playerID); LethalMon.Log($"Player {playerID} is not hiding anymore."); } } } [HarmonyPatch(typeof(EnemyAI), "PlayerIsTargetable")] [HarmonyPostfix] public static bool PlayerIsTargetablePostfix(bool __result, EnemyAI __instance, PlayerControllerB playerScript) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (hidingPlayers != null && hidingPlayers.Contains(playerScript.playerClientId) && Vector3.Distance(((Component)__instance).transform.position, ((Component)playerScript).transform.position) > 3f) { LethalMon.Log("Player inside hiding spore. Not targetable."); return false; } return __result; } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_KidnapperFoxTamedBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2657798600u, new RpcReceiveHandler(__rpc_handler_2657798600)); NetworkManager.__rpc_func_table.Add(1068421184u, new RpcReceiveHandler(__rpc_handler_1068421184)); NetworkManager.__rpc_func_table.Add(329086029u, new RpcReceiveHandler(__rpc_handler_329086029)); NetworkManager.__rpc_func_table.Add(4259470792u, new RpcReceiveHandler(__rpc_handler_4259470792)); NetworkManager.__rpc_func_table.Add(2161587048u, new RpcReceiveHandler(__rpc_handler_2161587048)); NetworkManager.__rpc_func_table.Add(3505829976u, new RpcReceiveHandler(__rpc_handler_3505829976)); } private static void __rpc_handler_2657798600(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_003e: 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_005c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference enemyRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyRef, default(ForNetworkSerializable)); int damageOnHit = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref damageOnHit); target.__rpc_exec_stage = (__RpcExecStage)1; ((KidnapperFoxTamedBehaviour)(object)target).PushTargetEnemyWithTongueServerRpc(enemyRef, damageOnHit); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1068421184(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_003e: 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_005c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference enemyRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyRef, default(ForNetworkSerializable)); int damageOnHit = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref damageOnHit); target.__rpc_exec_stage = (__RpcExecStage)2; ((KidnapperFoxTamedBehaviour)(object)target).PushTargetEnemyWithTongueClientRpc(enemyRef, damageOnHit); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_329086029(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 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((KidnapperFoxTamedBehaviour)(object)target).SpawnHidingMoldServerRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4259470792(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 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)2; ((KidnapperFoxTamedBehaviour)(object)target).SpawnHidingMoldClientRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2161587048(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0051: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); bool hide = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref hide, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((KidnapperFoxTamedBehaviour)(object)target).SetPlayerHiddenInMoldServerRpc(playerID, hide); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3505829976(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0051: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); bool hide = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref hide, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((KidnapperFoxTamedBehaviour)(object)target).SetPlayerHiddenInMoldClientRpc(playerID, hide); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "KidnapperFoxTamedBehaviour"; } } internal class MaskedTamedBehaviour : TamedEnemyBehaviour { internal enum CustomBehaviour { LendMask = 1, Ghostified } private static readonly float MaskedNormalSpeed = 3.5f; private static readonly float MaskedRunningSpeed = 7f; private static readonly float MaximumMaskWearingTime = 10f; private static readonly float EscapeEventLightIntensity = 75f; private static readonly float MaximumGhostLifeTime = 15f; private static readonly float GhostChaseSpeed = 4f; private static readonly float GhostZoomUntilDistance = 25f; private static readonly float GhostGlitchMaxDuration = 1.5f; private static readonly float GhostAudioToggleDistance = 15f; internal MaskedPlayerEnemy? _masked; private bool isTransferingMask; private Material[] originalMaskMaterials = Array.Empty(); private Transform? originalMaskParent; private Vector3 originalMaskLocalPosition = new Vector3(-0.01f, 0.14f, 0.22f); private float timeWearingMask; private bool isWearingMask; private Animator? _maskAnimator; private Color? originalNightVisionColor; private float originalNightVisionIntensity = 366f; public bool escapeFromBallEventRunning; internal bool ghostAnimationInitialized; internal bool isGhostified; internal float ghostLifetime; internal List spawnedGhostMimics = new List(); internal MaskedTamedBehaviour? parentMimic; internal float aiIntervalTimeBackup; internal static List> GhostVoices = new List>(); internal static AudioClip? ghostAmbientSFX = null; internal static AudioClip? ghostHissSFX = null; internal static AudioClip? ghostHissFastSFX = null; internal static AudioClip? ghostPoofSFX = null; internal AudioSource? farAudio; internal static AudioClip? ghostAmbientFarSFX = null; private static readonly string CooldownId = "masked_lendmask"; private CooldownNetworkBehaviour? lendMaskCooldown; private List _actionKeys = new List { new ActionKey { actionKey = ModConfig.Instance.ActionKey1, description = "Lend mask" } }; internal MaskedPlayerEnemy Masked { get { if ((Object)(object)_masked == (Object)null) { ref MaskedPlayerEnemy? masked = ref _masked; EnemyAI enemy = base.Enemy; masked = (MaskedPlayerEnemy?)(object)((enemy is MaskedPlayerEnemy) ? enemy : null); } return _masked; } } internal override bool CanDefend => false; private GameObject? Mask { get { MaskedPlayerEnemy masked = Masked; if (masked == null) { return null; } return masked.maskTypes[Masked.maskTypeIndex]; } } private Animator? MaskAnimator { get { if ((Object)(object)_maskAnimator == (Object)null) { GameObject? mask = Mask; _maskAnimator = ((mask != null) ? mask.GetComponent() : null); } return _maskAnimator; } } internal static float GhostSpawnTime => 4.5f - GhostChaseSpeed / 3f; internal float GhostTimeToLive => MaximumGhostLifeTime - ghostLifetime; internal override Cooldown[] Cooldowns => new Cooldown[1] { new Cooldown(CooldownId, "Lending mask", ModConfig.Instance.values.MaskedLendCooldown) }; internal override List>? CustomBehaviourHandler => new List>(2) { new Tuple(CustomBehaviour.LendMask.ToString(), "Lending mask", OnLendMaskBehavior), new Tuple(CustomBehaviour.Ghostified.ToString(), "Ghostified", OnGhostBehavior) }; internal override List ActionKeys => _actionKeys; internal override void InitCustomBehaviour(int behaviour) { base.InitCustomBehaviour(behaviour); switch ((CustomBehaviour)behaviour) { case CustomBehaviour.LendMask: SetMaskShaking(shaking: false); break; case CustomBehaviour.Ghostified: { ghostLifetime = 0f; if ((Object)(object)targetPlayer == (Object)null) { break; } GhostAppeared(); float pitch = Random.Range(0.75f, 1.25f); Masked.movementAudio.clip = ghostAmbientSFX; Masked.movementAudio.volume = 0.5f; Masked.movementAudio.Play(); Masked.movementAudio.pitch = pitch; if ((Object)(object)farAudio != (Object)null) { farAudio.clip = ghostAmbientFarSFX; farAudio.volume = 0.5f; farAudio.Play(); farAudio.pitch = pitch; } ((Component)Masked).transform.LookAt(((Component)targetPlayer).transform); aiIntervalTimeBackup = ((EnemyAI)Masked).AIIntervalTime; ((EnemyAI)Masked).AIIntervalTime = 0.05f; if (((NetworkBehaviour)this).IsOwner) { ((MonoBehaviour)this).Invoke("GhostGlitchAnimationServerRpc", GhostSpawnTime + Random.Range(0f, 2f)); if (GhostVoices.Count > 0) { ((MonoBehaviour)this).Invoke("PlayRandomGhostVoiceServerRpc", GhostSpawnTime + Random.Range(0f, 4f)); } } break; } } } internal void OnLendMaskBehavior() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (!isWearingMask || isTransferingMask) { return; } if (base.IsOwnerPlayer) { StartOfRound instance = StartOfRound.Instance; instance.fearLevel += Time.deltaTime / 10f; timeWearingMask += Time.deltaTime; if ((Object)(object)MaskAnimator != (Object)null && timeWearingMask > MaximumMaskWearingTime / 1.5f) { Animator? maskAnimator = MaskAnimator; maskAnimator.speed += Time.deltaTime / (MaximumMaskWearingTime / 4f); } if (timeWearingMask > MaximumMaskWearingTime) { ownerPlayer.DamagePlayer(1, true, true, (CauseOfDeath)0, 8, false, default(Vector3)); if (!ownerPlayer.isPlayerDead) { GiveBackMaskServerRpc(); } } } if (((NetworkBehaviour)this).IsOwner) { FollowOwner(); } } internal void OnGhostBehavior() { //IL_0065: 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) ghostLifetime += Time.deltaTime; if (ghostLifetime < GhostSpawnTime) { return; } if ((Object)(object)targetPlayer == (Object)null || targetPlayer.isPlayerDead || ghostLifetime > MaximumGhostLifeTime) { LethalMon.Log("Player dead or ghost lifetime reached. Despawn ghost."); GhostDisappearsServerRpc(); return; } if (Vector3.Distance(((Component)targetPlayer).transform.position, ((Component)Masked).transform.position) > GhostZoomUntilDistance) { ((EnemyAI)Masked).agent.speed = 100f; } else { ((EnemyAI)Masked).agent.speed = GhostChaseSpeed; } Masked.CalculateAnimationDirection(1f); Masked.LookAtFocusedPosition(); } internal static void LoadGhostAudio(AssetBundle assetBundle) { ghostAmbientSFX = assetBundle.LoadAsset("Assets/Audio/Masked/GhostAmbient.ogg"); ghostAmbientFarSFX = assetBundle.LoadAsset("Assets/Audio/Masked/GhostAmbientFar.ogg"); ghostHissSFX = assetBundle.LoadAsset("Assets/Audio/Masked/GhostHiss.ogg"); ghostHissFastSFX = assetBundle.LoadAsset("Assets/Audio/Masked/GhostHissFast.ogg"); ghostPoofSFX = assetBundle.LoadAsset("Assets/Audio/Masked/GhostPoof.ogg"); AudioClip val = assetBundle.LoadAsset("Assets/Audio/Masked/GhostLaugh.ogg"); AudioClip val2 = assetBundle.LoadAsset("Assets/Audio/Masked/GhostLaughFar.ogg"); if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { GhostVoices.Add(new Tuple(val, val2)); } AudioClip val3 = assetBundle.LoadAsset("Assets/Audio/Masked/GhostLaugh2.ogg"); AudioClip val4 = assetBundle.LoadAsset("Assets/Audio/Masked/GhostLaugh2Far.ogg"); if ((Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null) { GhostVoices.Add(new Tuple(val3, val4)); } AudioClip val5 = assetBundle.LoadAsset("Assets/Audio/Masked/GhostCry.ogg"); AudioClip val6 = assetBundle.LoadAsset("Assets/Audio/Masked/GhostCryFar.ogg"); if ((Object)(object)val5 != (Object)null && (Object)(object)val6 != (Object)null) { GhostVoices.Add(new Tuple(val5, val6)); } AudioClip val7 = assetBundle.LoadAsset("Assets/Audio/Masked/GhostCry2.ogg"); AudioClip val8 = assetBundle.LoadAsset("Assets/Audio/Masked/GhostCry2Far.ogg"); if ((Object)(object)val7 != (Object)null && (Object)(object)val8 != (Object)null) { GhostVoices.Add(new Tuple(val7, val8)); } } [ServerRpc(RequireOwnership = false)] internal void PlayRandomGhostVoiceServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3453020217u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3453020217u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayRandomGhostVoiceClientRpc(Random.RandomRangeInt(0, GhostVoices.Count - 1)); float num = Random.Range(3f, Mathf.Max(4f, 8f)); if (GhostTimeToLive > num + 2f) { ((MonoBehaviour)this).Invoke("PlayRandomGhostVoiceClientRpc", num); } } } [ClientRpc] internal void PlayRandomGhostVoiceClientRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2707239091u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2707239091u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { bool flag = Vector3.Distance(((Component)Masked).transform.position, ((Component)Utils.CurrentPlayer).transform.position) > GhostAudioToggleDistance; ((EnemyAI)Masked).creatureVoice.PlayOneShot(flag ? GhostVoices[index].Item2 : GhostVoices[index].Item1); } } } [ServerRpc(RequireOwnership = false)] public void GhostGlitchAnimationServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3070935834u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3070935834u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GhostGlitchAnimationClientRpc(Random.Range(1f, GhostGlitchMaxDuration)); float num = Random.Range(2f, 4f); if (GhostTimeToLive > num + GhostGlitchMaxDuration) { ((MonoBehaviour)this).Invoke("GhostGlitchAnimationServerRpc", num); } } } [ClientRpc] public void GhostGlitchAnimationClientRpc(float duration) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2316712473u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref duration, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2316712473u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(GlitchAnimation(duration)); } } } public IEnumerator GlitchAnimation(float duration) { Animator creatureAnimator = ((EnemyAI)Masked).creatureAnimator; creatureAnimator.speed *= 2f; yield return (object)new WaitForSeconds(0.1f); ((EnemyAI)Masked).creatureAnimator.SetBool("Stunned", true); yield return (object)new WaitForSeconds(duration); ((EnemyAI)Masked).creatureAnimator.SetBool("Stunned", false); yield return (object)new WaitForSeconds(0.1f); Animator creatureAnimator2 = ((EnemyAI)Masked).creatureAnimator; creatureAnimator2.speed /= 2f; } internal override void ActionKey1Pressed() { base.ActionKey1Pressed(); if (!((Object)(object)ownerPlayer == (Object)null) && !isTransferingMask) { if (isWearingMask) { GiveBackMaskServerRpc(); } else if ((Object)(object)lendMaskCooldown != (Object)null && lendMaskCooldown.IsFinished()) { LendMaskServerRpc(); } } } internal override void Awake() { base.Awake(); MirageCompatibility.SaveHeadMasksOf(((Component)Masked).gameObject); } internal override void Start() { //IL_0047: 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) base.Start(); lendMaskCooldown = GetCooldownWithId(CooldownId); if ((Object)(object)Mask != (Object)null) { originalMaskParent = Mask.transform.parent; originalMaskLocalPosition = Mask.transform.localPosition; } if ((Object)(object)ownerPlayer != (Object)null) { ((EnemyAI)Masked).creatureAnimator.Play("Base Layer.Idle"); } } private new void OnDestroy() { CleanUp(); base.OnDestroy(); } private void OnDisable() { CleanUp(); } internal void CleanUp() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)farAudio != (Object)null) { Object.Destroy((Object)(object)farAudio); } if ((Object)(object)parentMimic != (Object)null) { parentMimic.spawnedGhostMimics.Remove(Masked); } ((MonoBehaviour)this).StopAllCoroutines(); for (int num = spawnedGhostMimics.Count - 1; num >= 0; num--) { MaskedPlayerEnemy val = spawnedGhostMimics[num]; if (!((Object)(object)val == (Object)null)) { if (((NetworkBehaviour)val).IsSpawned) { RoundManager.Instance.DespawnEnemyGameObject(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val).NetworkObject)); } Object.Destroy((Object)(object)val); } } spawnedGhostMimics.Clear(); MaskedPlayerEnemyPatch.lastColliderIDs.Remove(((Object)Masked).GetInstanceID()); } internal override void InitTamingBehaviour(TamingBehaviour behaviour) { base.InitTamingBehaviour(behaviour); if (behaviour == TamingBehaviour.TamedFollowing) { EnableActionKeyControlTip(ModConfig.Instance.ActionKey1); SetMaskShaking(shaking: false); } } internal override void LeaveCustomBehaviour(int behaviour) { base.LeaveCustomBehaviour(behaviour); if (behaviour == 2) { ((EnemyAI)Masked).AIIntervalTime = aiIntervalTimeBackup; } } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { if (!isTransferingMask) { base.OnUpdate(update, doAIInterval); if (!isGhostified) { Masked.CalculateAnimationDirection(1f); } } } internal override void DoAIInterval() { //IL_0033: 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) base.DoAIInterval(); if ((Object)(object)ownerPlayer == (Object)null || isGhostified) { return; } if (!isTransferingMask) { bool flag = Vector3.Distance(((Component)Masked).transform.position, ((Component)ownerPlayer).transform.position) > 8f; if (flag != Masked.running) { Masked.running = flag; ((EnemyAI)Masked).creatureAnimator.SetBool("Running", flag); if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)Masked).agent.speed = (Masked.running ? MaskedRunningSpeed : MaskedNormalSpeed); } } } else { if (Masked.running) { ((EnemyAI)Masked).creatureAnimator.SetBool("Running", false); } Masked.running = false; if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)Masked).agent.speed = 0f; } } } internal override void OnCallFromBall() { base.OnCallFromBall(); ((EnemyAI)Masked).EnableEnemyMesh(true, false); if ((Object)(object)ownerPlayer != (Object)null) { Masked.stareAtTransform = ((Component)ownerPlayer.gameplayCamera).transform; Masked.lookAtPositionTimer = 0f; } } internal override void TurnTowardsPosition(Vector3 position) { Masked.lookAtPositionTimer = 0f; if ((Object)(object)((EnemyAI)Masked).agent != (Object)null) { Masked.LookAtFocusedPosition(); } } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { base.OnEscapedFromBall(playerWhoThrewBall); ((EnemyAI)Masked).inSpecialAnimationWithPlayer = playerWhoThrewBall; targetPlayer = playerWhoThrewBall; ((MonoBehaviour)this).StartCoroutine(MaskedEscapeFromBallCoroutine(playerWhoThrewBall)); } internal IEnumerator MaskedEscapeFromBallCoroutine(PlayerControllerB playerWhoThrewBall) { escapeFromBallEventRunning = true; ((Behaviour)Masked).enabled = false; if (((NetworkBehaviour)this).IsOwner) { ((Behaviour)((EnemyAI)Masked).agent).enabled = false; } if ((Object)(object)targetPlayer != (Object)null) { ((Component)Masked).transform.LookAt(((Component)targetPlayer).transform); } bool maskEnabled = MirageCompatibility.IsMaskEnabled(((Component)Masked).gameObject); if (!maskEnabled) { MirageCompatibility.ShowMaskOf(((Component)Masked).gameObject); Utils.GetRenderers(Mask).ForEach(delegate(Renderer r) { r.enabled = false; }); } yield return (object)new WaitForSeconds(0.5f); SetMaskGlowNoSound(); yield return (object)new WaitForSeconds(0.5f); float timeGlowingUp = 0f; float startIntensity = Masked.maskEyesGlowLight.intensity; float finalIntensity = startIntensity * EscapeEventLightIntensity; while (Masked.maskEyesGlowLight.intensity < finalIntensity && timeGlowingUp < 2f) { Light maskEyesGlowLight = Masked.maskEyesGlowLight; maskEyesGlowLight.intensity += Time.deltaTime * EscapeEventLightIntensity; timeGlowingUp += Time.deltaTime; yield return null; } yield return (object)new WaitForSeconds(0.2f); if (((NetworkBehaviour)this).IsOwner) { ((MonoBehaviour)this).StartCoroutine(SpawnGhostMimic()); } Light maskEyesGlowLight2 = Masked.maskEyesGlowLight; maskEyesGlowLight2.intensity /= 1.5f; yield return (object)new WaitForSeconds(6f); if (((NetworkBehaviour)this).IsOwner) { ((MonoBehaviour)this).StartCoroutine(SpawnGhostMimic()); } Masked.maskEyesGlowLight.intensity = startIntensity; if (!maskEnabled) { MirageCompatibility.ShowMaskOf(((Component)Masked).gameObject, show: false); } if (((NetworkBehaviour)this).IsOwner) { float triggerFallbackAfter = MaximumGhostLifeTime + 1f; float fallbackTimer = 0f; yield return (object)new WaitWhile((Func)delegate { fallbackTimer += Time.deltaTime; return spawnedGhostMimics.Count > 0 && fallbackTimer < triggerFallbackAfter; }); if (fallbackTimer >= triggerFallbackAfter) { LethalMon.Log("Fallback triggered on MaskedEscapeFromBallCoroutine.", LethalMon.LogType.Warning); } CleanUp(); if ((Object)(object)((EnemyAI)Masked).agent != (Object)null) { ((Behaviour)((EnemyAI)Masked).agent).enabled = true; } ((Behaviour)Masked).enabled = true; EscapeFromBallEventEndedServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void EscapeFromBallEventEndedServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1424104349u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1424104349u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { EscapeFromBallEventEndedClientRpc(); } } } [ClientRpc] public void EscapeFromBallEventEndedClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1005418738u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1005418738u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SetMaskGlowNoSound(enable: false); if (MirageCompatibility.Enabled) { MirageCompatibility.ShowMaskOf(((Component)Masked).gameObject, show: false); } escapeFromBallEventRunning = false; ((EnemyAI)Masked).inSpecialAnimationWithPlayer = null; targetPlayer = null; } } internal IEnumerator SpawnGhostMimic() { MaskedPlayerEnemy val = SpawnMimic(((Component)Masked).transform.position); if ((Object)(object)val == (Object)null) { yield break; } MaskedTamedBehaviour tamedBehaviour = default(MaskedTamedBehaviour); if (!((Component)val).TryGetComponent(ref tamedBehaviour)) { LethalMon.Log("Ghost mimic has no tamed behaviour handler.", LethalMon.LogType.Error); yield break; } spawnedGhostMimics.Add(val); yield return null; ((Behaviour)tamedBehaviour.Masked).enabled = false; if (!MirageCompatibility.IsMaskEnabled(((Component)tamedBehaviour.Masked).gameObject)) { MirageCompatibility.ShowMaskOf(((Component)tamedBehaviour.Masked).gameObject); } ((Renderer)Masked.maskEyesGlow[Masked.maskTypeIndex]).enabled = true; ((Behaviour)Masked.maskEyesGlowLight).enabled = true; tamedBehaviour.parentMimic = this; if ((Object)(object)targetPlayer != (Object)null) { tamedBehaviour.SyncGhostTargetServerRpc(targetPlayer.playerClientId); } tamedBehaviour.SwitchToCustomBehaviour(2); } [ServerRpc] public void SyncGhostTargetServerRpc(ulong playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2656453501u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2656453501u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SyncGhostTargetClientRpc(playerID); } } [ClientRpc] public void SyncGhostTargetClientRpc(ulong playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2960584080u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2960584080u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ulong playerID2 = playerID; targetPlayer = Utils.AllPlayers.Where((PlayerControllerB p) => p.playerClientId == playerID2).First(); Masked.stareAtTransform = ((Component)targetPlayer).transform; Masked.lookAtPositionTimer = 0f; } } [ServerRpc] public void GhostHitPlayerServerRpc(ulong playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(977430241u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 977430241u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { if ((Object)(object)targetPlayer != (Object)null && targetPlayer.playerClientId == playerID) { GhostHitTargetPlayerClientRpc(); GhostDisappearsClientRpc(); } else { GhostHitNonTargetPlayerClientRpc(playerID); } } } [ClientRpc] public void GhostHitTargetPlayerClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2102968593u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2102968593u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (Object)(object)targetPlayer == (Object)(object)Utils.CurrentPlayer) { targetPlayer.DamagePlayer(2, true, true, (CauseOfDeath)0, 1, false, default(Vector3)); } } } [ClientRpc] public void GhostHitNonTargetPlayerClientRpc(ulong playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(629751675u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 629751675u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && playerID == Utils.CurrentPlayerID) { if (((EnemyAI)Masked).agent.speed > 50f && (Object)(object)ghostHissFastSFX != (Object)null) { Utils.PlaySoundAtPosition(((Component)Utils.CurrentPlayer).transform.position, ghostHissFastSFX); } else if ((Object)(object)ghostHissSFX != (Object)null) { Utils.PlaySoundAtPosition(((Component)Utils.CurrentPlayer).transform.position, ghostHissSFX); } } } public void GhostAppeared() { //IL_0017: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Ghostify(Masked); MainModule main = Masked.teleportParticle.main; ((MainModule)(ref main)).simulationSpeed = 20f; Masked.teleportParticle.Play(); if (Vector3.Distance(((Component)Masked).transform.position, ((Component)Utils.CurrentPlayer).transform.position) > 20f) { RoundManager.Instance.FlickerLights(true, false); } ((EnemyAI)Masked).creatureAnimator.SetFloat("VelocityY", 1f); Animator creatureAnimator = ((EnemyAI)Masked).creatureAnimator; creatureAnimator.speed *= GhostChaseSpeed / 5f; ((EnemyAI)Masked).SetMovingTowardsTargetPlayer(targetPlayer); ((EnemyAI)Masked).addPlayerVelocityToDestination = 0f; } [ServerRpc] public void GhostDisappearsServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1498729135u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1498729135u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GhostDisappearsClientRpc(); } } [ClientRpc] public void GhostDisappearsClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(881165923u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 881165923u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Utils.SpawnPoofCloudAt(((Component)Masked).transform.position + Vector3.up * 1.5f); if ((Object)(object)ghostPoofSFX != (Object)null) { Utils.PlaySoundAtPosition(((Component)Masked).transform.position, ghostPoofSFX); } if (((NetworkBehaviour)this).IsOwner) { RoundManager.Instance.DespawnEnemyGameObject(NetworkObjectReference.op_Implicit(((NetworkBehaviour)Masked).NetworkObject)); Object.Destroy((Object)(object)Masked, 0.5f); } } } internal MaskedPlayerEnemy? SpawnMimic(Vector3 position) { //IL_0010: 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) GameObject val = Object.Instantiate(((EnemyAI)Masked).enemyType.enemyPrefab, position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); val.GetComponentInChildren().Spawn(true); MaskedPlayerEnemy component = val.GetComponent(); ((EnemyAI)component).SetEnemyOutside(((EnemyAI)Masked).isOutside); return component; } private void Ghostify(MaskedPlayerEnemy maskedEnemy) { //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_021e: Unknown result type (might be due to invalid IL or missing references) ((Renderer)maskedEnemy.rendererLOD0).materials = Enumerable.Repeat(element: false, ((Renderer)Masked.rendererLOD0).materials.Length).Select((Func)((bool x) => new Material(Utils.GhostMaterial))).ToArray(); ((Renderer)maskedEnemy.rendererLOD1).materials = Enumerable.Repeat(element: false, ((Renderer)Masked.rendererLOD1).materials.Length).Select((Func)((bool x) => new Material(Utils.GhostMaterial))).ToArray(); ((Renderer)maskedEnemy.rendererLOD2).materials = Enumerable.Repeat(element: false, ((Renderer)Masked.rendererLOD2).materials.Length).Select((Func)((bool x) => new Material(Utils.GhostMaterial))).ToArray(); Transform val = ((Component)maskedEnemy).transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003"); if ((Object)(object)val != (Object)null) { Transform obj = val.Find("LevelSticker"); if (obj != null) { ((Component)obj).gameObject.SetActive(false); } Transform obj2 = val.Find("BetaBadge"); if (obj2 != null) { ((Component)obj2).gameObject.SetActive(false); } } bool enabled = true; if (ModelReplacementAPICompatibility.Enabled) { GameObject val2 = ModelReplacementAPICompatibility.FindCurrentReplacementModelIn(((Component)Masked).gameObject, isEnemy: true); if ((Object)(object)val2 != (Object)null) { Utils.ReplaceAllMaterialsWith(val2, (Material _) => new Material(Utils.GhostMaterial)); enabled = false; } } GameObject mask = Mask; if ((Object)(object)mask != (Object)null) { Utils.GetRenderers(mask).ForEach(delegate(Renderer r) { r.enabled = false; }); mask.GetComponent().speed = 0f; Light val3 = default(Light); if (!mask.gameObject.TryGetComponent(ref val3)) { val3 = mask.gameObject.AddComponent(); } val3.type = (LightType)2; val3.range = 5f; val3.intensity = 3f; val3.color = new Color(0.8f, 0.9f, 1f); ((Behaviour)val3).enabled = true; } MeshRenderer val4 = maskedEnemy.maskEyesGlow[maskedEnemy.maskTypeIndex]; if ((Object)(object)val4 != (Object)null) { ((Renderer)val4).material = new Material(Utils.GhostEyesMaterial); ((Renderer)val4).enabled = enabled; } farAudio = ((Component)Masked).gameObject.AddComponent(); farAudio.maxDistance = GhostAudioToggleDistance * 5f; farAudio.minDistance = GhostAudioToggleDistance; farAudio.rolloffMode = (AudioRolloffMode)1; farAudio.spatialBlend = 1f; farAudio.priority = 127; Masked.movementAudio.maxDistance = GhostAudioToggleDistance * 1.5f; Masked.movementAudio.rolloffMode = (AudioRolloffMode)1; Utilities.FixMixerGroups(((Component)Masked).gameObject); isGhostified = true; } [ServerRpc(RequireOwnership = false)] private void LendMaskServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3342547035u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3342547035u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { LendMaskClientRpc(); } } } [ClientRpc] private void LendMaskClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1389330487u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1389330487u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(LendMaskCoroutine()); if (base.IsOwnerPlayer) { EnableActionKeyControlTip(ModConfig.Instance.ActionKey1, enable: false); } } } private IEnumerator LendMaskCoroutine() { isTransferingMask = true; ((EnemyAI)Masked).inSpecialAnimationWithPlayer = ownerPlayer; Masked.SetHandsOutClientRpc(true); yield return ((MonoBehaviour)this).StartCoroutine(FaceOwner()); yield return (object)new WaitForSeconds(0.3f); SetMaskGlowNoSound(); yield return ((MonoBehaviour)this).StartCoroutine(RotateMaskOnPlayerFace()); SetMaskShaking(shaking: false); if (base.IsOwnerPlayer) { SetMaskGlassified(); } FinishKillAnimation(killPlayer: false); if (base.IsOwnerPlayer) { SetRedVision(); CustomPassManager.Instance.EnableCustomPass(CustomPassManager.CustomPassType.SeeThroughEnemies); } else { SetMaskGlowNoSound(); } isWearingMask = true; Masked.SetHandsOutClientRpc(false); isTransferingMask = false; ((EnemyAI)Masked).inSpecialAnimationWithPlayer = null; yield return null; if (((NetworkBehaviour)this).IsOwner) { SwitchToCustomBehaviour(1); } } [ServerRpc(RequireOwnership = false)] private void GiveBackMaskServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1553142923u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1553142923u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GiveBackMaskClientRpc(); } } } [ClientRpc] private void GiveBackMaskClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3544254367u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3544254367u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(GiveBackMaskCoroutine()); } } } private IEnumerator GiveBackMaskCoroutine() { isTransferingMask = true; ((EnemyAI)Masked).inSpecialAnimationWithPlayer = ownerPlayer; Masked.SetHandsOutClientRpc(true); yield return ((MonoBehaviour)this).StartCoroutine(FaceOwner()); SetMaskShaking(); if (base.IsOwnerPlayer) { SetMaskGlassified(glassified: false); } yield return (object)new WaitForSeconds(0.3f); SetMaskGlowNoSound(); if (base.IsOwnerPlayer) { SetRedVision(enable: false); CustomPassManager.Instance.EnableCustomPass(CustomPassManager.CustomPassType.SeeThroughEnemies, enable: false); } yield return ((MonoBehaviour)this).StartCoroutine(RotateMaskOnMaskedFace()); FinishKillAnimation(killPlayer: false); isWearingMask = false; timeWearingMask = 0f; SetMaskGlowNoSound(enable: false); Masked.SetHandsOutClientRpc(false); isTransferingMask = false; ((EnemyAI)Masked).inSpecialAnimationWithPlayer = null; lendMaskCooldown?.Reset(); if (((NetworkBehaviour)this).IsOwner) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } } private IEnumerator RotateMaskOnPlayerFace() { if (!((Object)(object)ownerPlayer == (Object)null)) { Vector3 endPosition = ((Component)ownerPlayer.gameplayCamera).transform.position + ((Component)ownerPlayer.gameplayCamera).transform.forward * 0.15f - Vector3.up * 0.1f; Quaternion rotation = ((Component)ownerPlayer).transform.rotation; yield return ((MonoBehaviour)this).StartCoroutine(RotateMaskTo(endPosition, rotation, 1f, base.IsOwnerPlayer ? ((Component)ownerPlayer.headCostumeContainerLocal).transform : ((Component)ownerPlayer.headCostumeContainer).transform)); } } private IEnumerator RotateMaskOnMaskedFace() { if (!((Object)(object)ownerPlayer == (Object)null) && !((Object)(object)originalMaskParent == (Object)null)) { Vector3 val = originalMaskLocalPosition; LethalMon.Log("originalMaskLocalPosition: " + ((object)(Vector3)(ref val)).ToString()); Vector3 endPosition = ((Component)originalMaskParent).transform.position + Vector3.up * originalMaskLocalPosition.y + ((Component)Masked).transform.forward * originalMaskLocalPosition.z; yield return ((MonoBehaviour)this).StartCoroutine(RotateMaskTo(endPosition, ((Component)originalMaskParent).transform.rotation, 1f, (Transform?)(((Object)(object)originalMaskParent != (Object)null) ? ((object)originalMaskParent) : ((object)((Component)Masked).transform)))); if ((Object)(object)Mask != (Object)null) { Mask.transform.localPosition = originalMaskLocalPosition; } } } private IEnumerator RotateMaskTo(Vector3 endPosition, Quaternion endRotation, float duration = 1f, Transform? bindingTo = null) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) GameObject currentMask = Mask; if (!((Object)(object)currentMask == (Object)null)) { currentMask.transform.SetParent((Transform)null); Vector3 maskStartingPos = currentMask.transform.position; Quaternion maskStartingRot = currentMask.transform.rotation; float maskProgress = 0f; while (maskProgress < duration) { maskProgress += Time.deltaTime; currentMask.transform.position = Vector3.Lerp(maskStartingPos, endPosition, maskProgress); currentMask.transform.rotation = Quaternion.Lerp(maskStartingRot, endRotation, Mathf.Min(maskProgress * 1.5f, 1f)); yield return null; } if ((Object)(object)bindingTo != (Object)null) { currentMask.transform.SetParent(bindingTo, true); } } } private IEnumerator FaceOwner() { if ((Object)(object)ownerPlayer == (Object)null) { yield break; } ((EnemyAI)Masked).inSpecialAnimationWithPlayer = ownerPlayer; ownerPlayer.inAnimationWithEnemy = (EnemyAI)(object)Masked; if ((Object)(object)ownerPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { ownerPlayer.CancelSpecialTriggerAnimations(); } ((Behaviour)((EnemyAI)Masked).agent).enabled = false; ownerPlayer.inSpecialInteractAnimation = true; ownerPlayer.snapToServerPosition = true; Vector3 val = (((NetworkBehaviour)ownerPlayer).IsOwner ? ((Component)ownerPlayer).transform.position : ((Component)ownerPlayer).transform.parent.TransformPoint(ownerPlayer.serverPlayerPosition)); Vector3 val2 = ((Component)Masked).transform.position - ((Component)Masked).transform.forward * 2f; val2.y = val.y; Masked.playerRay = new Ray(val, val2 - ((Component)ownerPlayer).transform.position); Vector3 endPosition = ((Ray)(ref Masked.playerRay)).GetPoint(0.7f); ownerPlayer.disableSyncInAnimation = true; ownerPlayer.disableLookInput = true; RoundManager.Instance.tempTransform.position = ((Component)ownerPlayer).transform.position; RoundManager.Instance.tempTransform.LookAt(endPosition); Quaternion startingPlayerRot = ((Component)ownerPlayer).transform.rotation; Quaternion targetRot = RoundManager.Instance.tempTransform.rotation; Vector3 startingPosition = ((Component)Masked).transform.position; for (int i = 0; i < 8; i++) { if (i > 0) { ((Component)Masked).transform.LookAt(((Component)ownerPlayer).transform.position); ((Component)Masked).transform.eulerAngles = new Vector3(0f, ((Component)Masked).transform.eulerAngles.y, 0f); } ((Component)Masked).transform.position = Vector3.Lerp(startingPosition, endPosition, (float)i / 8f); ((Component)ownerPlayer).transform.rotation = Quaternion.Lerp(startingPlayerRot, targetRot, (float)i / 8f); ((Component)ownerPlayer).transform.eulerAngles = new Vector3(0f, ((Component)ownerPlayer).transform.eulerAngles.y, 0f); yield return null; } ((Component)Masked).transform.position = endPosition; ((Component)ownerPlayer).transform.rotation = targetRot; ((Component)ownerPlayer).transform.eulerAngles = new Vector3(0f, ((Component)ownerPlayer).transform.eulerAngles.y, 0f); Masked.LookAtPosition(((Component)ownerPlayer).transform.position, 1f); if ((Object)(object)((EnemyAI)Masked).agent != (Object)null) { Masked.LookAtFocusedPosition(); } } private void SetMaskGlowNoSound(bool enable = true) { ((Renderer)Masked.maskEyesGlow[Masked.maskTypeIndex]).enabled = enable; ((Behaviour)Masked.maskEyesGlowLight).enabled = enable; } private void SetMaskGlassified(bool glassified = true) { GameObject? mask = Mask; MeshRenderer val = ((mask != null) ? ((Component)mask.transform.Find("Mesh")).GetComponent() : null); if ((Object)(object)val == (Object)null) { return; } if (glassified) { if (originalMaskMaterials.Length == 0) { originalMaskMaterials = Utils.ReplaceAllMaterialsWith((Renderer)(object)val, (Material m) => new Material(Utils.Glass)); } } else if (originalMaskMaterials.Length != 0) { Material[] materials = ((Renderer)val).materials; foreach (Material val2 in materials) { Object.DestroyImmediate((Object)(object)val2); } ((Renderer)val).materials = originalMaskMaterials; originalMaskMaterials = Array.Empty(); } } private void SetMaskShaking(bool shaking = true) { if (!((Object)(object)MaskAnimator == (Object)null)) { MaskAnimator.speed = (shaking ? 1f : 0f); } } private void SetRedVision(bool enable = true) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) if (!((Object)(object)ownerPlayer == (Object)null)) { if (enable) { originalNightVisionColor = ownerPlayer.nightVision.color; ownerPlayer.nightVision.color = new Color(1f, 0.42f, 0f); originalNightVisionIntensity = ownerPlayer.nightVision.intensity; Light nightVision = ownerPlayer.nightVision; nightVision.intensity /= 1.5f; } else { ownerPlayer.nightVision.color = originalNightVisionColor.GetValueOrDefault(Color.white); ownerPlayer.nightVision.intensity = originalNightVisionIntensity; } ((Behaviour)ownerPlayer.nightVision).enabled = enable; } } private void FinishKillAnimation(bool killPlayer) { PropertyInfo property = typeof(NetworkObject).GetProperty("IsSpawned"); if (((NetworkBehaviour)Masked).NetworkObject.IsSpawned && property != null) { property.GetSetMethod(nonPublic: true).Invoke(((NetworkBehaviour)Masked).NetworkObject, new object[1] { false }); Masked.FinishKillAnimation(killPlayer); property.GetSetMethod(nonPublic: true).Invoke(((NetworkBehaviour)Masked).NetworkObject, new object[1] { true }); } else { Masked.FinishKillAnimation(killPlayer); } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_MaskedTamedBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3453020217u, new RpcReceiveHandler(__rpc_handler_3453020217)); NetworkManager.__rpc_func_table.Add(2707239091u, new RpcReceiveHandler(__rpc_handler_2707239091)); NetworkManager.__rpc_func_table.Add(3070935834u, new RpcReceiveHandler(__rpc_handler_3070935834)); NetworkManager.__rpc_func_table.Add(2316712473u, new RpcReceiveHandler(__rpc_handler_2316712473)); NetworkManager.__rpc_func_table.Add(1424104349u, new RpcReceiveHandler(__rpc_handler_1424104349)); NetworkManager.__rpc_func_table.Add(1005418738u, new RpcReceiveHandler(__rpc_handler_1005418738)); NetworkManager.__rpc_func_table.Add(2656453501u, new RpcReceiveHandler(__rpc_handler_2656453501)); NetworkManager.__rpc_func_table.Add(2960584080u, new RpcReceiveHandler(__rpc_handler_2960584080)); NetworkManager.__rpc_func_table.Add(977430241u, new RpcReceiveHandler(__rpc_handler_977430241)); NetworkManager.__rpc_func_table.Add(2102968593u, new RpcReceiveHandler(__rpc_handler_2102968593)); NetworkManager.__rpc_func_table.Add(629751675u, new RpcReceiveHandler(__rpc_handler_629751675)); NetworkManager.__rpc_func_table.Add(1498729135u, new RpcReceiveHandler(__rpc_handler_1498729135)); NetworkManager.__rpc_func_table.Add(881165923u, new RpcReceiveHandler(__rpc_handler_881165923)); NetworkManager.__rpc_func_table.Add(3342547035u, new RpcReceiveHandler(__rpc_handler_3342547035)); NetworkManager.__rpc_func_table.Add(1389330487u, new RpcReceiveHandler(__rpc_handler_1389330487)); NetworkManager.__rpc_func_table.Add(1553142923u, new RpcReceiveHandler(__rpc_handler_1553142923)); NetworkManager.__rpc_func_table.Add(3544254367u, new RpcReceiveHandler(__rpc_handler_3544254367)); } private static void __rpc_handler_3453020217(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; ((MaskedTamedBehaviour)(object)target).PlayRandomGhostVoiceServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2707239091(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 index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)2; ((MaskedTamedBehaviour)(object)target).PlayRandomGhostVoiceClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3070935834(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; ((MaskedTamedBehaviour)(object)target).GhostGlitchAnimationServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2316712473(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_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float duration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref duration, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((MaskedTamedBehaviour)(object)target).GhostGlitchAnimationClientRpc(duration); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1424104349(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; ((MaskedTamedBehaviour)(object)target).EscapeFromBallEventEndedServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1005418738(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)2; ((MaskedTamedBehaviour)(object)target).EscapeFromBallEventEndedClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2656453501(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((MaskedTamedBehaviour)(object)target).SyncGhostTargetServerRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2960584080(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)2; ((MaskedTamedBehaviour)(object)target).SyncGhostTargetClientRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_977430241(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((MaskedTamedBehaviour)(object)target).GhostHitPlayerServerRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2102968593(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)2; ((MaskedTamedBehaviour)(object)target).GhostHitTargetPlayerClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_629751675(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)2; ((MaskedTamedBehaviour)(object)target).GhostHitNonTargetPlayerClientRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1498729135(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((MaskedTamedBehaviour)(object)target).GhostDisappearsServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_881165923(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)2; ((MaskedTamedBehaviour)(object)target).GhostDisappearsClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3342547035(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; ((MaskedTamedBehaviour)(object)target).LendMaskServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1389330487(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)2; ((MaskedTamedBehaviour)(object)target).LendMaskClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1553142923(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; ((MaskedTamedBehaviour)(object)target).GiveBackMaskServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3544254367(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)2; ((MaskedTamedBehaviour)(object)target).GiveBackMaskClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "MaskedTamedBehaviour"; } } public class MouthDogTamedBehaviour : TamedEnemyBehaviour { internal enum CustomBehaviour { Howl = 1 } private float CumulatedCheckDogsSeconds; private static readonly float CheckDogsSecondsInterval = 1f; internal float HowlTimer; private static readonly string HowlCooldownId = "mouthdog_howl"; private CooldownNetworkBehaviour howlCooldown; internal MouthDogAI mouthDog { get; private set; } internal override string DefendingBehaviourDescription => "Runs away..."; internal override List>? CustomBehaviourHandler => new List> { new Tuple(CustomBehaviour.Howl.ToString(), "Is howling!", OnHowl) }; internal override bool CanDefend => false; internal override Cooldown[] Cooldowns => new Cooldown[1] { new Cooldown(HowlCooldownId, "Howl", ModConfig.Instance.values.EyelessDogHowlCooldown) }; public void OnHowl() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (HowlTimer > 0f) { HowlTimer -= Time.deltaTime; return; } if ((Object)(object)targetEnemy != (Object)null) { ((MouthDogAI)targetEnemy).suspicionLevel = 0; targetEnemy = null; } SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } internal override void Start() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) base.Start(); EnemyAI enemy = base.Enemy; mouthDog = (MouthDogAI)(object)((enemy is MouthDogAI) ? enemy : null); if ((Object)(object)mouthDog == (Object)null) { mouthDog = ((Component)this).gameObject.AddComponent(); } howlCooldown = GetCooldownWithId(HowlCooldownId); if ((Object)(object)ownerPlayer != (Object)null) { ((Component)mouthDog).gameObject.transform.localScale = new Vector3(0.28f, 0.28f, 0.28f); ((EnemyAI)mouthDog).creatureSFX.volume = 0f; ((EnemyAI)mouthDog).creatureVoice.pitch = 1.4f; mouthDog.breathingSFX = null; WalkMode(); } } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) base.OnUpdate(update, doAIInterval: false); Vector3 position = ((Component)mouthDog).transform.position; Animator creatureAnimator = ((EnemyAI)mouthDog).creatureAnimator; Vector3 val = Vector3.ClampMagnitude(position - mouthDog.previousPosition, 1f); creatureAnimator.SetFloat("speedMultiplier", ((Vector3)(ref val)).sqrMagnitude / (Time.deltaTime / 4f)); mouthDog.previousPosition = position; } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { if (Utils.IsHost) { ((MonoBehaviour)this).StartCoroutine(EscapedFromBallCoroutine(playerWhoThrewBall)); } } internal override void OnTamedFollowing() { base.OnTamedFollowing(); if (howlCooldown.IsFinished()) { DefendOwnerFromCloseDogs(); } } internal override void OnTamedDefending() { //IL_0011: 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_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_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) //IL_006b: 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_007b: Unknown result type (might be due to invalid IL or missing references) base.OnTamedDefending(); if (Vector3.Distance(((Component)mouthDog).transform.position, ((EnemyAI)mouthDog).destination) < 1f) { HowlTimer = mouthDog.screamSFX.length; howlCooldown.Reset(); Vector3 position = ((Component)mouthDog).transform.position; ((MouthDogAI)targetEnemy).lastHeardNoisePosition = position; ((EnemyAI)(MouthDogAI)targetEnemy).DetectNoise(position, float.MaxValue, 0, 0); SwitchToCustomBehaviour(1); } } internal override void InitTamingBehaviour(TamingBehaviour behaviour) { base.InitTamingBehaviour(behaviour); switch (behaviour) { case TamingBehaviour.TamedFollowing: WalkMode(); break; case TamingBehaviour.TamedDefending: ChaseMode(); break; default: throw new ArgumentOutOfRangeException("behaviour", behaviour, null); } } internal override void InitCustomBehaviour(int behaviour) { base.InitCustomBehaviour(behaviour); if (behaviour == 1) { Howl(); } } public override bool CanBeTeleported() { return !IsCurrentBehaviourTaming(TamingBehaviour.TamedDefending); } private IEnumerator EscapedFromBallCoroutine(PlayerControllerB playerWhoThrewBall) { int chaseTime = 5; while (chaseTime > 0 && !playerWhoThrewBall.isPlayerDead) { chaseTime--; ((EnemyAI)mouthDog).DetectNoise(((Component)playerWhoThrewBall).transform.position, float.MaxValue, 0, 0); yield return (object)new WaitForSeconds(5f); } } private void DefendOwnerFromCloseDogs() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) CumulatedCheckDogsSeconds += Time.deltaTime; if (CumulatedCheckDogsSeconds < CheckDogsSecondsInterval) { return; } CumulatedCheckDogsSeconds = 0f; MouthDogAI[] array = Object.FindObjectsOfType(); MouthDogAI[] array2 = array; foreach (MouthDogAI val in array2) { TamedEnemyBehaviour componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)val == (Object)(object)mouthDog || ((EnemyAI)val).isEnemyDead || Vector3.Distance(((Component)val).transform.position, ((Component)ownerPlayer).transform.position) > 20f || ((Object)(object)componentInParent != (Object)null && componentInParent.IsOwnedByAPlayer())) { continue; } bool flag = false; float num = 15f; while (num > 7f && !flag) { Vector3[] positionsFarFromOwner = GetPositionsFarFromOwner(val, num); Vector3[] array3 = positionsFarFromOwner; foreach (Vector3 val2 in array3) { if (((EnemyAI)mouthDog).SetDestinationToPosition(val2, true)) { flag = true; break; } } num -= 1f; } if (flag) { targetEnemy = (EnemyAI?)(object)val; HowlTimer = 0f; SwitchToTamingBehaviour(TamingBehaviour.TamedDefending); break; } } } private Vector3[] GetPositionsFarFromOwner(MouthDogAI enemyToDefendFrom, float distance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0035: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0118: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0172: 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) Vector3 position = ((Component)enemyToDefendFrom).transform.position; Vector3 val = Vector3.Normalize(position - ((Component)ownerPlayer).transform.position); Vector3 val2 = position + val * distance; Vector3[] array = (Vector3[])(object)new Vector3[21]; array[0] = val2; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(val.x, val.y); Vector2 val4 = Vector2.Perpendicular(val3); for (int i = 1; i <= 10; i++) { array[1 + (i - 1) * 2] = new Vector3(val2.x + val4.x * 0.5f * (float)i, val2.y + val4.y * 0.5f * (float)i, val2.z); array[2 + (i - 1) * 2] = new Vector3(val2.x - val4.x * 0.5f * (float)i, val2.y - val4.y * 0.5f * (float)i, val2.z); } RaycastHit val5 = default(RaycastHit); for (int j = 0; j < array.Length; j++) { if (Physics.Raycast(new Ray(array[j], Vector3.down), ref val5, 30f, 268437761, (QueryTriggerInteraction)1)) { array[j] = ((RaycastHit)(ref val5)).point; } else if (Physics.Raycast(new Ray(array[j], Vector3.up), ref val5, 30f, 268437761, (QueryTriggerInteraction)1)) { array[j] = ((RaycastHit)(ref val5)).point; } } return array; } private void WalkMode() { if ((Object)(object)mouthDog != (Object)null) { if ((Object)(object)((EnemyAI)mouthDog).agent != (Object)null) { ((EnemyAI)mouthDog).agent.speed = 5f; } ((EnemyAI)mouthDog).creatureAnimator.Play("Base Layer.Idle1"); } } private void ChaseMode() { if ((Object)(object)((EnemyAI)mouthDog).agent != (Object)null) { ((EnemyAI)mouthDog).agent.speed = 13f; } ((EnemyAI)mouthDog).creatureAnimator.Play("Base Layer.Chase"); } private void Howl() { ((EnemyAI)mouthDog).creatureAnimator.Play("Base Layer.ChaseHowl"); ((EnemyAI)mouthDog).creatureVoice.PlayOneShot(mouthDog.screamSFX); } protected override void __initializeVariables() { base.__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "MouthDogTamedBehaviour"; } } public class NutcrackerTamedBehaviour : TamedEnemyBehaviour { private enum CustomBehaviour { LookForPlayer = 1, Rampage } private float lookTimer; private readonly float lookTimerInterval = 1f; internal NutcrackerEnemyAI nutcracker { get; private set; } internal override string DefendingBehaviourDescription => "Shoots at an enemy!"; internal override List>? CustomBehaviourHandler => new List> { new Tuple(CustomBehaviour.LookForPlayer.ToString(), "Is looking for you!", OnLookForPlayer), new Tuple(CustomBehaviour.Rampage.ToString(), "Is on a rampage!", OnRampage) }; private void OnRampage() { } private void OnLookForPlayer() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0070: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)targetPlayer).transform.position; float num = Vector3.Distance(((Component)nutcracker).transform.position, position); RaycastHit val = default(RaycastHit); if (num > 50f) { SwitchToDefaultBehaviour(0); } else if (num < 5f && !Physics.Linecast(((Component)this).transform.position, position, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { ((EnemyAI)nutcracker).SetDestinationToPosition(((Component)nutcracker).transform.position, false); SwitchToCustomBehaviour(2); ((MonoBehaviour)this).StartCoroutine(RampageCoroutine()); } else { nutcracker.SetTargetDegreesToPosition(position); SetTorsoTargetDegreesServerRPC(); ((EnemyAI)nutcracker).SetDestinationToPosition(position, false); } } internal IEnumerator RampageCoroutine() { nutcracker.torsoTurnSpeed = float.MaxValue; Quaternion val = Quaternion.LookRotation(((Component)targetPlayer).transform.position); int initialAngle = (int)((Quaternion)(ref val)).eulerAngles.x; for (int degrees = 0; degrees < 360; degrees += 10) { nutcracker.targetTorsoDegrees = (initialAngle + degrees - 90) % 360; SetTorsoTargetDegreesServerRPC(); yield return (object)new WaitForSeconds(0.05f); nutcracker.FireGunServerRpc(); } nutcracker.gun.shellsLoaded = 2; SwitchToDefaultBehaviour(0); } internal override void OnTamedFollowing() { base.OnTamedFollowing(); lookTimer += Time.deltaTime; if (lookTimer >= lookTimerInterval) { lookTimer = 0f; LookForEnemies(); } } private void LookForEnemies() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { TamedEnemyBehaviour componentInParent = ((Component)spawnedEnemy).GetComponentInParent(); if ((Object)(object)spawnedEnemy != (Object)null && (Object)(object)((Component)spawnedEnemy).transform != (Object)null && (Object)(object)spawnedEnemy != (Object)(object)nutcracker && !spawnedEnemy.isEnemyDead && ((EnemyAI)nutcracker).CheckLineOfSightForPosition(((Component)spawnedEnemy).transform.position, 70f, 60, 1f, (Transform)null) && ((Object)(object)componentInParent == (Object)null || !componentInParent.IsOwnedByAPlayer())) { targetEnemy = spawnedEnemy; SwitchToTamingBehaviour(TamingBehaviour.TamedDefending); LethalMon.Log("Targeting " + ((Object)spawnedEnemy.enemyType).name); break; } } } internal override void InitTamingBehaviour(TamingBehaviour behaviour) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) base.InitTamingBehaviour(behaviour); if (behaviour == TamingBehaviour.TamedDefending) { LethalMon.Log("Enter defending mode"); ((EnemyAI)nutcracker).creatureAnimator.SetInteger("State", 1); if (Utils.IsHost && (Object)(object)targetEnemy != (Object)null) { nutcracker.SetTargetDegreesToPosition(((Component)targetEnemy).transform.position); SetTorsoTargetDegreesServerRPC(); } } else if ((Object)(object)nutcracker != (Object)null && (Object)(object)((EnemyAI)nutcracker).creatureVoice != (Object)null) { LethalMon.Log("Enter following mode"); ((EnemyAI)nutcracker).creatureVoice.Stop(); ((EnemyAI)nutcracker).creatureAnimator.SetInteger("State", 0); } } internal override void OnTamedDefending() { //IL_0086: 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_00f3: Unknown result type (might be due to invalid IL or missing references) base.OnTamedDefending(); NutcrackerEnemyAI val = nutcracker; if (val != null && !val.aimingGun && !val.reloadingGun && !val.torsoTurning) { LethalMon.Log("Is not aiming nor reloading."); if ((Object)(object)targetEnemy != (Object)null && !targetEnemy.isEnemyDead && ((Behaviour)targetEnemy.agent).enabled && ((EnemyAI)nutcracker).CheckLineOfSightForPosition(((Component)targetEnemy).transform.position, 70f, 60, 1f, (Transform)null)) { LethalMon.Log(((object)targetEnemy)?.ToString() + " is in LOS, aiming gun"); nutcracker.SetTargetDegreesToPosition(((Component)targetEnemy).transform.position); SetTorsoTargetDegreesServerRPC(); nutcracker.AimGunServerRpc(((Component)targetEnemy).transform.position); } else { LethalMon.Log("Enemy lost or dead, switch back to following"); SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); targetEnemy = null; } } } private new void Start() { base.Start(); EnemyAI enemy = base.Enemy; nutcracker = (NutcrackerEnemyAI)(object)((enemy is NutcrackerEnemyAI) ? enemy : null); if ((Object)(object)ownerPlayer != (Object)null) { ((EnemyAI)nutcracker).creatureVoice.volume = 0.5f; } } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { base.OnEscapedFromBall(playerWhoThrewBall); Utils.EnableShotgunHeldByEnemyAi((EnemyAI)(object)nutcracker, enable: true); if (Utils.IsHost) { targetPlayer = playerWhoThrewBall; ((EnemyAI)nutcracker).agent.speed = 10f; nutcracker.timeSinceHittingPlayer = 0f; SwitchToCustomBehaviour(1); } } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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) //IL_009b: 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) base.OnUpdate(update: false, doAIInterval: false); nutcracker.TurnTorsoToTargetDegrees(); if (((EnemyAI)nutcracker).isEnemyDead || nutcracker.GrabGunIfNotHolding()) { if (nutcracker.walkCheckInterval <= 0f) { nutcracker.walkCheckInterval = 0.1f; Animator creatureAnimator = ((EnemyAI)nutcracker).creatureAnimator; Vector3 val = ((Component)this).transform.position - nutcracker.positionLastCheck; creatureAnimator.SetBool("IsWalking", ((Vector3)(ref val)).sqrMagnitude > 0.001f); nutcracker.positionLastCheck = ((Component)this).transform.position; } else { NutcrackerEnemyAI obj = nutcracker; obj.walkCheckInterval -= Time.deltaTime; } ((EnemyAI)nutcracker).creatureAnimator.SetBool("Aiming", nutcracker.aimingGun); } } internal override void OnRetrieveInBall() { base.OnRetrieveInBall(); Utils.DestroyShotgunHeldByEnemyAi((EnemyAI)(object)nutcracker); } [ServerRpc(RequireOwnership = false)] public void SetTorsoTargetDegreesServerRPC() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3394544860u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3394544860u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetTorsoTargetDegreesClientRPC(nutcracker.targetTorsoDegrees, nutcracker.torsoTurnSpeed); } } } [ClientRpc] public void SetTorsoTargetDegreesClientRPC(int targetDegrees, float turnSpeed) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(249310392u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, targetDegrees); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref turnSpeed, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 249310392u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { nutcracker.targetTorsoDegrees = targetDegrees; LethalMon.Log("Target degrees received: " + nutcracker.targetTorsoDegrees + " at speed " + turnSpeed); } } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_NutcrackerTamedBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3394544860u, new RpcReceiveHandler(__rpc_handler_3394544860)); NetworkManager.__rpc_func_table.Add(249310392u, new RpcReceiveHandler(__rpc_handler_249310392)); } private static void __rpc_handler_3394544860(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; ((NutcrackerTamedBehaviour)(object)target).SetTorsoTargetDegreesServerRPC(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_249310392(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0051: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int targetDegrees = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref targetDegrees); float turnSpeed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref turnSpeed, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((NutcrackerTamedBehaviour)(object)target).SetTorsoTargetDegreesClientRPC(targetDegrees, turnSpeed); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "NutcrackerTamedBehaviour"; } } public class RedLocustBeesTamedBehaviour : TamedEnemyBehaviour { public bool angry; internal RedLocustBees bees { get; private set; } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { base.OnUpdate(update, doAIInterval: false); BeesZapOnTimer(); } internal override void Start() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) base.Start(); EnemyAI enemy = base.Enemy; bees = (RedLocustBees)(object)((enemy is RedLocustBees) ? enemy : null); if ((Object)(object)bees == (Object)null) { bees = ((Component)this).gameObject.AddComponent(); } if (!((Object)(object)ownerPlayer == (Object)null)) { if ((Object)(object)((EnemyAI)bees).agent != (Object)null) { ((EnemyAI)bees).agent.speed = 10.3f; } bees.beesIdle.volume = 0.2f; bees.beesDefensive.volume = 0.2f; bees.beesAngry.Stop(); bees.beeZapAudio.Stop(); ((Component)bees).gameObject.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); } } internal override void OnTamedDefending() { //IL_002b: 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_010f: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (!angry) { ChangeAngryMode(angry: true); } if ((Object)(object)targetPlayer != (Object)null) { float num = Vector3.Distance(((Component)targetPlayer).transform.position, ((Component)bees).transform.position); LethalMon.Log("Distance to player: " + num); if (targetPlayer.isPlayerDead || !targetPlayer.isPlayerControlled || num > 25f) { LethalMon.Log("Stop targeting player"); targetPlayer = null; } else if (num < 2.5f) { LethalMon.Log("Target player collided"); BeeDamageServerRPC(NetworkObjectReference.op_Implicit(((Component)targetPlayer).GetComponent())); ChangeAngryMode(angry: false); targetPlayer = null; } else { LethalMon.Log("Follow player"); ((EnemyAI)bees).SetDestinationToPosition(((Component)targetPlayer).transform.position, false); } } else if ((Object)(object)targetEnemy != (Object)null) { float num2 = Vector3.Distance(((Component)targetEnemy).transform.position, ((Component)bees).transform.position); LethalMon.Log("Distance to enemy: " + num2); if (targetEnemy.isEnemyDead || num2 > 25f) { LethalMon.Log("Stop targeting enemy"); targetEnemy = null; } else if (num2 < 2.5f) { LethalMon.Log("Target enemy collided"); targetEnemy.SetEnemyStunned(true, 5f, (PlayerControllerB)null); ChangeAngryMode(angry: false); targetEnemy = null; } else { LethalMon.Log("Follow enemy"); ((EnemyAI)bees).SetDestinationToPosition(((Component)targetEnemy).transform.position, false); } } else { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { base.OnEscapedFromBall(playerWhoThrewBall); if (Utils.IsHost) { ((EnemyAI)bees).SetMovingTowardsTargetPlayer(playerWhoThrewBall); ((EnemyAI)bees).SwitchToBehaviourState(2); RedLocustBeesPatch.AngryUntil.Add(((Object)bees).GetInstanceID(), DateTime.Now.AddSeconds(10.0)); } } private void BeesZapOnTimer() { if (angry) { if (bees.beeZapRandom == null) { bees.beeZapRandom = new Random(); } if (bees.beesZapCurrentTimer > bees.beesZapTimer) { bees.beesZapCurrentTimer = 0f; bees.beesZapTimer = (float)bees.beeZapRandom.Next(1, 7) * 0.06f; BeesZap(); } else { RedLocustBees obj = bees; obj.beesZapCurrentTimer += Time.deltaTime; } } } public void BeesZap() { //IL_0062: 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) if (bees.beeParticles.GetBool("Alive")) { if (bees.beeZapRandom == null) { bees.beeZapRandom = new Random(); } for (int i = 0; i < bees.lightningPoints.Length; i++) { ((Component)bees.lightningPoints[i]).transform.position = RoundManager.Instance.GetRandomPositionInBoxPredictable(((Component)bees.beeParticlesTarget).transform.position, 4f, bees.beeZapRandom); } ((LightningBoltPrefabScriptBase)bees.lightningComponent).Trigger(0.1f); } bees.beeZapAudio.pitch = Random.Range(0.8f, 1.1f); bees.beeZapAudio.PlayOneShot(((EnemyAI)bees).enemyType.audioClips[Random.Range(0, ((EnemyAI)bees).enemyType.audioClips.Length)], Random.Range(0.6f, 1f)); } public void ChangeAngryMode(bool angry) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (angry && (Object)(object)targetEnemy == (Object)null && (Object)(object)targetPlayer == (Object)null) { LethalMon.Logger.LogWarning((object)"Attempting to make bees angry, but no target was defined."); return; } this.angry = angry; if (!angry) { targetEnemy = null; targetPlayer = null; } ResetBeeZapTimer(); AngryServerRpc(NetworkObjectReference.op_Implicit(((Component)bees).GetComponent()), angry); } private void ResetBeeZapTimer() { bees.beesZapCurrentTimer = 0f; bees.beeZapAudio.Stop(); } [ServerRpc(RequireOwnership = false)] public void AngryServerRpc(NetworkObjectReference networkObjectReference, bool angry) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1098993142u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref angry, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1098993142u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { AngryClientRpc(angry); } } } [ClientRpc] public void AngryClientRpc(bool angry) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3212045895u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref angry, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3212045895u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { this.angry = angry; ResetBeeZapTimer(); } } } [ServerRpc(RequireOwnership = false)] public void BeeDamageServerRPC(NetworkObjectReference networkObjectReference) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3490997832u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3490997832u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { BeeDamageClientRpc(networkObjectReference); } } } [ClientRpc] public void BeeDamageClientRpc(NetworkObjectReference networkObjectReference) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1604525786u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1604525786u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LethalMon.Log("BeeDamage client rpc received"); NetworkObject val3 = default(NetworkObject); PlayerControllerB val4 = default(PlayerControllerB); if (!((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val3, (NetworkManager)null)) { LethalMon.Log(((Object)((Component)bees).gameObject).name + ": Failed to get network object from network object reference (BeeDamageClientRpc RPC)", LethalMon.LogType.Error); } else if (!((Component)val3).TryGetComponent(ref val4)) { LethalMon.Log(((Object)((Component)bees).gameObject).name + ": Failed to get player object (BeeDamageClientRpc RPC)", LethalMon.LogType.Error); } else { val4.DamagePlayer(30, true, true, (CauseOfDeath)11, 3, false, default(Vector3)); } } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_RedLocustBeesTamedBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1098993142u, new RpcReceiveHandler(__rpc_handler_1098993142)); NetworkManager.__rpc_func_table.Add(3212045895u, new RpcReceiveHandler(__rpc_handler_3212045895)); NetworkManager.__rpc_func_table.Add(3490997832u, new RpcReceiveHandler(__rpc_handler_3490997832)); NetworkManager.__rpc_func_table.Add(1604525786u, new RpcReceiveHandler(__rpc_handler_1604525786)); } private static void __rpc_handler_1098993142(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_004a: 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) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RedLocustBeesTamedBehaviour)(object)target).AngryServerRpc(networkObjectReference, flag); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3212045895(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_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((RedLocustBeesTamedBehaviour)(object)target).AngryClientRpc(flag); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3490997832(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RedLocustBeesTamedBehaviour)(object)target).BeeDamageServerRPC(networkObjectReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1604525786(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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((RedLocustBeesTamedBehaviour)(object)target).BeeDamageClientRpc(networkObjectReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "RedLocustBeesTamedBehaviour"; } } internal class SporeLizardTamedBehaviour : TamedEnemyBehaviour { private enum CustomBehaviour { Riding = 1 } internal readonly float RidingTriggerHoldTime = 1f; internal InteractTrigger? ridingTrigger; internal bool nightVisionPreviouslyEnabled; internal EnemyController? controller; internal override bool Controllable => true; internal PufferAI sporeLizard { get; private set; } internal bool IsRiding => base.CurrentCustomBehaviour == 1; internal new bool IsOwnerPlayer => (Object)(object)ownerPlayer == (Object)(object)Utils.CurrentPlayer; internal override List>? CustomBehaviourHandler => new List> { new Tuple(CustomBehaviour.Riding.ToString(), "Is being rode...", WhileRiding) }; private void WhileRiding() { sporeLizard.CalculateAnimationDirection(1.7f); } internal void OnStartRiding() { if (Utils.IsHost) { SwitchToCustomBehaviour(1); } if (IsOwnerPlayer) { nightVisionPreviouslyEnabled = ((Behaviour)Utils.CurrentPlayer.nightVision).enabled; ((Behaviour)ownerPlayer.nightVision).enabled = ownerPlayer.isInsideFactory; } } internal void OnStopRiding() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (Utils.IsHost) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } if (IsOwnerPlayer) { ((Behaviour)ownerPlayer.nightVision).enabled = nightVisionPreviouslyEnabled; } sporeLizard.agentLocalVelocity = Vector3.zero; sporeLizard.CalculateAnimationDirection(0f); } internal void OnMove(Vector3 direction) { sporeLizard.CalculateAnimationDirection(1.7f); } internal void OnJump() { LethalMon.Log("Spore lizard is jumping"); controller.Jumping(); } private new void Awake() { EnemyAI enemy = base.Enemy; sporeLizard = (PufferAI)(object)((enemy is PufferAI) ? enemy : null); if (((Component)this).TryGetComponent(ref controller) && (Object)(object)controller != (Object)null) { controller.OnStartControlling = OnStartRiding; controller.OnStopControlling = OnStopRiding; controller.OnMove = OnMove; controller.OnJump = OnJump; controller.EnemyCanJump = true; controller.EnemyStrength = 3f; } } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { if (!IsRiding) { base.OnUpdate(); } } internal override void OnCallFromBall() { base.OnCallFromBall(); if ((Object)(object)ridingTrigger == (Object)null && (Object)(object)ownerPlayer == (Object)(object)Utils.CurrentPlayer) { controller.AddTrigger("Ride"); } controller.SetControlTriggerVisible(); } internal override void OnRetrieveInBall() { base.OnRetrieveInBall(); controller.SetControlTriggerVisible(visible: false); } internal override void OnTamedFollowing() { base.OnTamedFollowing(); sporeLizard.CalculateAnimationDirection(1.7f); } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { base.OnEscapedFromBall(playerWhoThrewBall); if (Utils.IsHost) { ((MonoBehaviour)sporeLizard).StartCoroutine(PuffAndWait(sporeLizard)); } } public override void OnDestroy() { //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) if (IsOwnerPlayer && (Object)(object)ownerPlayer?.nightVision != (Object)null) { ((Behaviour)ownerPlayer.nightVision).enabled = nightVisionPreviouslyEnabled; } sporeLizard.agentLocalVelocity = Vector3.zero; sporeLizard.CalculateAnimationDirection(0f); controller.StopControlling(beingDestroyed: true); Object.Destroy((Object)(object)controller); base.OnDestroy(); } private IEnumerator PuffAndWait(PufferAI sporeLizard) { sporeLizard.ShakeTailServerRpc(); ((Behaviour)sporeLizard).enabled = false; yield return (object)new WaitForSeconds(1f); ((Behaviour)sporeLizard).enabled = true; } protected override void __initializeVariables() { base.__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SporeLizardTamedBehaviour"; } } [DisallowMultipleComponent] public class TamedEnemyBehaviour : NetworkBehaviour { public enum TamingBehaviour { TamedFollowing = 1, TamedDefending } internal class ActionKey { internal InputAction? actionKey { get; set; } internal string description { get; set; } = ""; internal bool visible { get; set; } internal string Control { get { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (actionKey != null) { InputBinding val = actionKey.bindings[StartOfRound.Instance.localPlayerUsingController ? 1 : 0]; return ((InputBinding)(ref val)).path.Split("/").Last(); } return ""; } } internal string ControlTip => description + ": [" + Control + "]"; } internal static readonly Dictionary BehaviourClassMapping = new Dictionary { { typeof(FlowermanAI), typeof(FlowermanTamedBehaviour) }, { typeof(RedLocustBees), typeof(RedLocustBeesTamedBehaviour) }, { typeof(HoarderBugAI), typeof(HoarderBugTamedBehaviour) }, { typeof(PufferAI), typeof(SporeLizardTamedBehaviour) }, { typeof(MouthDogAI), typeof(MouthDogTamedBehaviour) }, { typeof(FlowerSnakeEnemy), typeof(TulipSnakeTamedBehaviour) }, { typeof(DressGirlAI), typeof(GhostGirlTamedBehaviour) }, { typeof(NutcrackerEnemyAI), typeof(NutcrackerTamedBehaviour) }, { typeof(ButlerEnemyAI), typeof(ButlerTamedBehaviour) }, { typeof(BushWolfEnemy), typeof(KidnapperFoxTamedBehaviour) }, { typeof(CrawlerAI), typeof(CrawlerTamedBehaviour) }, { typeof(MaskedPlayerEnemy), typeof(MaskedTamedBehaviour) } }; private EnemyAI? _enemy; public PlayerControllerB? ownerPlayer; public EnemyAI? targetEnemy; public PlayerControllerB? targetPlayer; public ulong ownClientId = ulong.MaxValue; public BallType ballType; public int ballValue; public bool scrapPersistedThroughRounds; public bool alreadyCollectedThisRound; public bool hasBeenRetrieved; private int _lastDefaultBehaviourIndex = -1; internal float targetNearestEnemyInterval; public static readonly int TamedBehaviourCount = Enum.GetNames(typeof(TamingBehaviour)).Length; private Dictionary> CustomBehaviours = new Dictionary>(); public static Dictionary LastDefaultBehaviourIndices = new Dictionary(); private static Dictionary> afterTeleportFunctions = new Dictionary> { { "SandSpiderAI", delegate(EnemyAI enemyAI, Vector3 position) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) SandSpiderAI val = (SandSpiderAI)(object)((enemyAI is SandSpiderAI) ? enemyAI : null); val.meshContainerPosition = position; val.meshContainerTarget = position; } }, { "BlobAI", delegate(EnemyAI enemyAI, Vector3 position) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((BlobAI)((enemyAI is BlobAI) ? enemyAI : null)).centerPoint.position = position; } } }; internal virtual bool Controllable => false; internal virtual Cooldown[] Cooldowns => Array.Empty(); public EnemyAI Enemy { get { if ((Object)(object)_enemy == (Object)null && !((Component)this).gameObject.TryGetComponent(ref _enemy)) { LethalMon.Logger.LogError((object)"Unable to get EnemyAI for TamedEnemyBehaviour."); _enemy = ((Component)this).gameObject.AddComponent(); } return _enemy; } } public bool IsOwnerPlayer => (Object)(object)ownerPlayer == (Object)(object)Utils.CurrentPlayer; internal int LastDefaultBehaviourIndex { get { if (_lastDefaultBehaviourIndex < 0) { _lastDefaultBehaviourIndex = LastDefaultBehaviourIndices.GetValueOrDefault(((Object)Enemy.enemyType.enemyPrefab).GetInstanceID(), int.MaxValue); } return _lastDefaultBehaviourIndex; } } internal virtual List>? CustomBehaviourHandler => null; internal virtual string FollowingBehaviourDescription => "Follows you..."; internal virtual string DefendingBehaviourDescription => "Defends you!"; internal virtual bool CanDefend => true; internal virtual float MaxFollowDistance => 30f; public TamingBehaviour? CurrentTamingBehaviour { get { int num = Enemy.currentBehaviourStateIndex - LastDefaultBehaviourIndex; if (!Enum.IsDefined(typeof(TamingBehaviour), num)) { return null; } return (TamingBehaviour)num; } } public int? CurrentCustomBehaviour => Enemy.currentBehaviourStateIndex - LastDefaultBehaviourIndex - TamedBehaviourCount; internal virtual List ActionKeys => new List(); public void SwitchToTamingBehaviour(TamingBehaviour behaviour) { if (CurrentTamingBehaviour != behaviour) { LethalMon.Logger.LogInfo((object)("Switch to taming state: " + behaviour)); Enemy.SwitchToBehaviourState((int)(LastDefaultBehaviourIndex + behaviour)); ((Behaviour)Enemy).enabled = false; } } internal virtual void InitTamingBehaviour(TamingBehaviour behaviour) { } internal virtual void LeaveTamingBehaviour(TamingBehaviour behaviour) { } public void SwitchToCustomBehaviour(int behaviour) { if (CurrentCustomBehaviour != behaviour) { LethalMon.Logger.LogInfo((object)("Switch to custom state: " + behaviour)); Enemy.SwitchToBehaviourState(LastDefaultBehaviourIndex + TamedBehaviourCount + behaviour); ((Behaviour)Enemy).enabled = false; } } internal virtual void InitCustomBehaviour(int behaviour) { } internal virtual void LeaveCustomBehaviour(int behaviour) { } public void SwitchToDefaultBehaviour(int behaviour) { Enemy.SwitchToBehaviourState(behaviour); ((Behaviour)Enemy).enabled = behaviour <= LastDefaultBehaviourIndex; } [HarmonyPrefix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void AddTamingBehaviours() { //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown int num = 0; int num2 = 0; int num3 = 0; EnemyAI val = default(EnemyAI); foreach (EnemyType enemyType in Utils.EnemyTypes) { num3++; if ((Object)(object)enemyType?.enemyPrefab == (Object)null || !enemyType.enemyPrefab.TryGetComponent(ref val) || (Object)(object)val == (Object)null) { continue; } Type valueOrDefault = BehaviourClassMapping.GetValueOrDefault(((object)val).GetType(), typeof(TamedEnemyBehaviour)); TamedEnemyBehaviour tamedEnemyBehaviour = enemyType.enemyPrefab.gameObject.AddComponent(valueOrDefault) as TamedEnemyBehaviour; if ((Object)(object)tamedEnemyBehaviour == (Object)null) { LethalMon.Logger.LogWarning((object)("TamedEnemyBehaviour-Initialization failed for " + enemyType.enemyName)); return; } num2++; if (valueOrDefault == typeof(TamedEnemyBehaviour)) { num++; } else { LethalMon.Logger.LogInfo((object)("Added " + valueOrDefault.Name + " for " + enemyType.enemyName)); } if (tamedEnemyBehaviour.Controllable) { enemyType.enemyPrefab.gameObject.AddComponent(); } for (int i = 0; i < tamedEnemyBehaviour.Cooldowns.Length; i++) { enemyType.enemyPrefab.gameObject.AddComponent(); } if (val.enemyBehaviourStates == null) { val.enemyBehaviourStates = Array.Empty(); } if (LastDefaultBehaviourIndices.ContainsKey(((Object)enemyType.enemyPrefab).GetInstanceID())) { LethalMon.Logger.LogWarning((object)("An enemy type (" + ((object)enemyType)?.ToString() + " with instance ID " + ((Object)enemyType.enemyPrefab).GetInstanceID() + ") is being registered but already has been registered before.")); continue; } LastDefaultBehaviourIndices.Add(((Object)enemyType.enemyPrefab).GetInstanceID(), val.enemyBehaviourStates.Length - 1); List list = val.enemyBehaviourStates.ToList(); string[] names = Enum.GetNames(typeof(TamingBehaviour)); foreach (string name in names) { list.Add(new EnemyBehaviourState { name = name }); } val.enemyBehaviourStates = list.ToArray(); } LethalMon.Logger.LogInfo((object)$"Added {num} more custom default behaviours. {num2}/{num3} enemy behaviours were added."); } internal void AddCustomBehaviours() { //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_0054: Expected O, but got Unknown if (CustomBehaviourHandler == null || CustomBehaviourHandler.Count == 0) { return; } List list = Enemy.enemyBehaviourStates.ToList(); foreach (Tuple item in CustomBehaviourHandler) { list.Add(new EnemyBehaviourState { name = item.Item1 }); CustomBehaviours.Add(CustomBehaviours.Count + 1, new Tuple(item.Item2, item.Item3)); LethalMon.Log($"Added custom behaviour {CustomBehaviours.Count} with handler {item.Item3.Method.Name}"); } Enemy.enemyBehaviourStates = list.ToArray(); } internal virtual void OnTamedFollowing() { if (!StartOfRound.Instance.inShipPhase) { FollowOwner(); } } internal virtual void OnTamedDefending() { if (!StartOfRound.Instance.inShipPhase && (Object)(object)targetEnemy == (Object)null && (Object)(object)targetPlayer == (Object)null) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } } internal virtual void OnCallFromBall() { ScanNodeProperties componentInChildren = ((Component)Enemy).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.headerText = "Tamed " + Enemy.enemyType.enemyName; componentInChildren.subText = "Owner: " + ((Object)ownerPlayer).name; componentInChildren.nodeType = 2; } } internal virtual void OnRetrieveInBall() { } internal virtual void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { } internal string GetCurrentStateDescription() { if (Enemy.currentBehaviourStateIndex <= LastDefaultBehaviourIndex) { return "Base behaviour " + Enemy.currentBehaviourStateIndex + " (not implemented)"; } if (Enemy.currentBehaviourStateIndex == LastDefaultBehaviourIndex + 1) { return FollowingBehaviourDescription; } if (Enemy.currentBehaviourStateIndex == LastDefaultBehaviourIndex + 2) { return DefendingBehaviourDescription; } if (Enemy.currentBehaviourStateIndex <= LastDefaultBehaviourIndex + TamedBehaviourCount + CustomBehaviours.Count) { return CustomBehaviours[Enemy.currentBehaviourStateIndex - LastDefaultBehaviourIndex - TamedBehaviourCount].Item1; } return "Unknown behaviour"; } internal virtual void ActionKey1Pressed() { } internal void EnableActionKeyControlTip(InputAction actionKey, bool enable = true) { InputAction actionKey2 = actionKey; IEnumerable source = ActionKeys.Where((ActionKey ak) => ak.actionKey == actionKey2); if (source.Any()) { source.First().visible = enable; ShowVisibleActionKeyControlTips(); } } internal void ShowVisibleActionKeyControlTips() { HUDManager.Instance.ClearControlTips(); string[] array = (from ak in ActionKeys where ak.visible select ak.ControlTip).ToArray(); HUDManager.Instance.ChangeControlTipMultiple(array, (Object)(object)Utils.CurrentPlayer.currentlyHeldObjectServer != (Object)null, Utils.CurrentPlayer.currentlyHeldObjectServer?.itemProperties); } public void Update() { int num = Enemy.currentBehaviourStateIndex - LastDefaultBehaviourIndex; if (num <= 0) { return; } OnUpdate(); if (!((NetworkBehaviour)Enemy).IsOwner) { return; } if (num > TamedBehaviourCount) { num -= TamedBehaviourCount; if (!CustomBehaviours.ContainsKey(num) || CustomBehaviours[num] == null) { LethalMon.Logger.LogWarning((object)$"Custom state {num} has no handler."); { foreach (KeyValuePair> customBehaviour in CustomBehaviours) { LethalMon.Log($"Behaviour found {customBehaviour.Key} with handler {customBehaviour.Value.Item2.Method.Name}"); } return; } } CustomBehaviours[num].Item2(); } else { switch ((TamingBehaviour)num) { case TamingBehaviour.TamedFollowing: OnTamedFollowing(); break; case TamingBehaviour.TamedDefending: OnTamedDefending(); break; } } } internal virtual void OnUpdate(bool update = false, bool doAIInterval = true) { //IL_0054: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027d: 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_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) if (StartOfRound.Instance.inShipPhase) { return; } if (update) { Enemy.Update(); return; } if (!((NetworkBehaviour)Enemy).IsOwner) { Enemy.SetClientCalculatingAI(false); if (!Enemy.inSpecialAnimation) { ((Component)this).transform.position = Vector3.SmoothDamp(((Component)this).transform.position, Enemy.serverPosition, ref Enemy.tempVelocity, Enemy.syncMovementSpeed); ((Component)this).transform.eulerAngles = new Vector3(((Component)this).transform.eulerAngles.x, Mathf.LerpAngle(((Component)this).transform.eulerAngles.y, Enemy.targetYRotation, 15f * Time.deltaTime), ((Component)this).transform.eulerAngles.z); } EnemyAI enemy = Enemy; enemy.timeSinceSpawn += Time.deltaTime; return; } if (Enemy.movingTowardsTargetPlayer && (Object)(object)targetPlayer != (Object)null) { if (Enemy.setDestinationToPlayerInterval <= 0f) { Enemy.setDestinationToPlayerInterval = 0.25f; Enemy.destination = RoundManager.Instance.GetNavMeshPosition(((Component)targetPlayer).transform.position, RoundManager.Instance.navHit, 2.7f, -1); Debug.Log((object)"Set destination to target player A"); } else { Enemy.destination = new Vector3(((Component)targetPlayer).transform.position.x, Enemy.destination.y, ((Component)targetPlayer).transform.position.z); Debug.Log((object)"Set destination to target player B"); EnemyAI enemy2 = Enemy; enemy2.setDestinationToPlayerInterval -= Time.deltaTime; } if (Enemy.addPlayerVelocityToDestination > 0f) { if ((Object)(object)targetPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { EnemyAI enemy3 = Enemy; enemy3.destination += Vector3.Normalize(targetPlayer.thisController.velocity * 100f) * Enemy.addPlayerVelocityToDestination; } else if (targetPlayer.timeSincePlayerMoving < 0.25f) { EnemyAI enemy4 = Enemy; enemy4.destination += Vector3.Normalize((targetPlayer.serverPlayerPosition - targetPlayer.oldPlayerPosition) * 100f) * Enemy.addPlayerVelocityToDestination; } } } if (Enemy.inSpecialAnimation) { return; } if (Enemy.updateDestinationInterval >= 0f) { EnemyAI enemy5 = Enemy; enemy5.updateDestinationInterval -= Time.deltaTime; } else { if (Enemy.currentBehaviourStateIndex > LastDefaultBehaviourIndex && Enemy.openDoorSpeedMultiplier > 0f) { Utils.OpenDoorsAsEnemyAroundPosition(((Component)Enemy).transform.position); } if (Enemy.updateDestinationInterval >= 0f) { EnemyAI enemy6 = Enemy; enemy6.updateDestinationInterval -= Time.deltaTime; } else { if (doAIInterval) { DoAIInterval(); } else { if (Enemy.moveTowardsDestination) { Enemy.agent.SetDestination(Enemy.destination); } Enemy.SyncPositionToClients(); } Enemy.updateDestinationInterval = Enemy.AIIntervalTime; } Enemy.updateDestinationInterval = Enemy.AIIntervalTime; } if (Mathf.Abs(Enemy.previousYRotation - ((Component)this).transform.eulerAngles.y) > 6f) { Enemy.previousYRotation = ((Component)this).transform.eulerAngles.y; Enemy.targetYRotation = Enemy.previousYRotation; if (((NetworkBehaviour)this).IsServer) { Enemy.UpdateEnemyRotationClientRpc((short)Enemy.previousYRotation); } else { Enemy.UpdateEnemyRotationServerRpc((short)Enemy.previousYRotation); } } } internal virtual void LateUpdate() { } internal virtual void Awake() { CooldownNetworkBehaviour[] components = ((Component)this).GetComponents(); if (components.Length != Cooldowns.Length) { LethalMon.Log("Parameterized cooldowns count (" + Cooldowns.Length + ") doesn't match cooldowns network behaviour count (" + components.Length + ")", LethalMon.LogType.Error); } else { for (int i = 0; i < Cooldowns.Length; i++) { components[i].Setup(Cooldowns[i]); } } } internal virtual void Start() { LethalMon.Logger.LogInfo((object)$"LastDefaultBehaviourIndex for {((Object)Enemy).name} is {LastDefaultBehaviourIndex}"); AddCustomBehaviours(); Utils.Enemy result; if ((Object)(object)ownerPlayer != (Object)null) { Enemy.Start(); if ((Object)(object)Enemy.creatureAnimator != (Object)null) { Enemy.creatureAnimator.SetBool("inSpawningAnimation", false); } } else if (Enum.TryParse(((Object)Enemy.enemyType).name, out result)) { ScanNodeProperties componentInChildren = ((Component)Enemy).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.subText = (Data.CatchableMonsters.ContainsKey(((Object)Enemy.enemyType).name) ? "Catchable" : "Not catchable"); } } if (ownClientId == Utils.CurrentPlayer.playerClientId) { HUDManagerPatch.EnableHUD(enable: true); HUDManagerPatch.ChangeToTamedBehaviour(this); } } internal virtual void DoAIInterval() { Enemy.DoAIInterval(); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); CooldownNetworkBehaviour[] components = ((Component)this).GetComponents(); foreach (CooldownNetworkBehaviour cooldownNetworkBehaviour in components) { ((NetworkBehaviour)cooldownNetworkBehaviour).OnDestroy(); } if ((Object)(object)ownerPlayer != (Object)null && (Object)(object)ownerPlayer == (Object)(object)Utils.CurrentPlayer) { HUDManagerPatch.EnableHUD(enable: false); } } internal virtual void TurnTowardsPosition(Vector3 position) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0033: 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) Transform transform = ((Component)Enemy).transform; Vector3 val = position - transform.position; val.y = 0f; Quaternion val2 = Quaternion.LookRotation(val); transform.rotation = Quaternion.Slerp(transform.rotation, val2, Time.deltaTime); } public virtual void MoveTowards(Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Enemy.SetDestinationToPosition(position, false); } public virtual PokeballItem? RetrieveInBall(Vector3 position) { //IL_0030: 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_0045: Unknown result type (might be due to invalid IL or missing references) hasBeenRetrieved = true; GameObject prefab = BallTypeMethods.GetPrefab(ballType); if ((Object)(object)prefab == (Object)null) { LethalMon.Log("Pokeball prefabs not loaded correctly.", LethalMon.LogType.Error); return null; } GameObject val = Object.Instantiate(prefab, position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); PokeballItem component = val.GetComponent(); DateTime now = SystemClock.now; component.cooldowns = ((Component)this).GetComponents().ToDictionary(delegate(CooldownNetworkBehaviour item) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) FixedString64Bytes value = item.Id.Value; return ((FixedString64Bytes)(ref value)).Value; }, (CooldownNetworkBehaviour item) => new Tuple(item.CurrentTimer, now)); ((GrabbableObject)component).fallTime = 0f; ((GrabbableObject)component).scrapPersistedThroughRounds = scrapPersistedThroughRounds || alreadyCollectedThisRound; ((GrabbableObject)component).SetScrapValue(ballValue); val.GetComponent().Spawn(false); component.SetCaughtEnemyServerRpc(((Object)Enemy.enemyType).name); ((GrabbableObject)component).FallToGround(false); OnRetrieveInBall(); ((Component)Enemy).GetComponent().Despawn(true); return component; } public void FollowPosition(Vector3 targetPosition) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0042: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_005b: 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_0063: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(Enemy.destination, targetPosition) > 2f) { Vector3 position = ((Component)Enemy).transform.position; if (Vector3.Distance(position, targetPosition) > MaxFollowDistance) { TeleportBehindOwner(); return; } if (Vector3.Distance(targetPosition, position) > 4f) { Vector3 val = targetPosition - position; if (FindRaySphereIntersections(position, ((Vector3)(ref val)).normalized, targetPosition, 4f, out var intersection, out var intersection2)) { Vector3 val2 = position; float num = Vector3.Distance(val2, intersection); float num2 = Vector3.Distance(val2, intersection2); if (num > 4f && num2 > 4f) { if ((Object)(object)Enemy.agent != (Object)null && !Enemy.agent.isOnNavMesh) { LethalMon.Log("Enemy not on valid navMesh. Recalculating."); ((Behaviour)Enemy.agent).enabled = false; ((Behaviour)Enemy.agent).enabled = true; } MoveTowards((num < num2) ? intersection : intersection2); } } } } TurnTowardsPosition(targetPosition); } public void FollowOwner() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ownerPlayer == (Object)null)) { FollowPosition(((Component)ownerPlayer).transform.position); } } private void TeleportBehindOwner() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ownerPlayer == (Object)null)) { ((Behaviour)Enemy.agent).enabled = false; ((Component)Enemy).transform.position = Utils.GetPositionBehindPlayer(ownerPlayer); ((Behaviour)Enemy.agent).enabled = true; } } internal virtual bool EnemyMeetsTargetingConditions(EnemyAI enemyAI) { if (((Component)enemyAI).gameObject.layer != 23) { return !enemyAI.isEnemyDead; } return false; } internal virtual void OnFoundTarget() { SwitchToTamingBehaviour(TamingBehaviour.TamedDefending); } internal void TargetNearestEnemy(bool requireLOS = true, bool fromOwnerPerspective = true) { targetNearestEnemyInterval -= Time.deltaTime; if (!(targetNearestEnemyInterval > 0f)) { targetNearestEnemyInterval = 1f; EnemyAI val = NearestEnemy(requireLOS, fromOwnerPerspective); if ((Object)(object)val != (Object)null) { targetEnemy = val; OnFoundTarget(); LethalMon.Log("Targeting " + ((Object)targetEnemy.enemyType).name); } } } internal EnemyAI? NearestEnemy(bool requireLOS = true, bool fromOwnerPerspective = true) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) EnemyAI result = null; float num = float.MaxValue; if (fromOwnerPerspective && (Object)(object)ownerPlayer == (Object)null) { return null; } Vector3 val = (fromOwnerPerspective ? ((Component)ownerPlayer).transform.position : ((Component)Enemy).transform.position); Collider[] array = Physics.OverlapSphere(val, 10f, 524288, (QueryTriggerInteraction)2); Collider[] array2 = array; foreach (Collider val2 in array2) { EnemyAI val3 = ((val2 != null) ? ((Component)val2).GetComponentInParent() : null); TamedEnemyBehaviour tamedEnemyBehaviour = ((val2 != null) ? ((Component)val2).GetComponentInParent() : null); if (!((Object)(object)((val3 != null) ? ((Component)val3).transform : null) == (Object)null) && !((Object)(object)tamedEnemyBehaviour == (Object)null) && !((Object)(object)tamedEnemyBehaviour.ownerPlayer != (Object)null) && !((Object)(object)val3 == (Object)(object)Enemy) && EnemyMeetsTargetingConditions(val3) && (!requireLOS || val3.CheckLineOfSightForPosition(val, 180f, 10, -1f, (Transform)null))) { float num2 = Vector3.Distance(val, ((Component)val3).transform.position); if (num2 < num) { num = num2; result = val3; } } } return result; } public static bool FindRaySphereIntersections(Vector3 rayOrigin, Vector3 rayDirection, Vector3 sphereCenter, float sphereRadius, out Vector3 intersection1, out Vector3 intersection2) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0088: 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_008e: 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_009a: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) intersection1 = Vector3.zero; intersection2 = Vector3.zero; Vector3 val = rayOrigin - sphereCenter; float num = Vector3.Dot(rayDirection, rayDirection); float num2 = 2f * Vector3.Dot(val, rayDirection); float num3 = Vector3.Dot(val, val) - sphereRadius * sphereRadius; float num4 = num2 * num2 - 4f * num * num3; if (num4 < 0f) { return false; } float num5 = Mathf.Sqrt(num4); float num6 = (0f - num2 - num5) / (2f * num); float num7 = (0f - num2 + num5) / (2f * num); intersection1 = rayOrigin + num6 * rayDirection; intersection2 = rayOrigin + num7 * rayDirection; return true; } internal void DropBlood(Vector3 position, int minAmount = 3, int maxAmount = 7) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_00ef: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_013b: 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) if ((Object)(object)ownerPlayer == (Object)null) { return; } int num = Random.Range(minAmount, maxAmount); Vector3 val2 = default(Vector3); Ray val3 = default(Ray); RaycastHit val4 = default(RaycastHit); while (num > 0) { num--; ownerPlayer.currentBloodIndex = (ownerPlayer.currentBloodIndex + 1) % ownerPlayer.playerBloodPooledObjects.Count; GameObject val = ownerPlayer.playerBloodPooledObjects[ownerPlayer.currentBloodIndex]; if (!((Object)(object)val == (Object)null)) { val.transform.rotation = Quaternion.LookRotation(Vector3.down, Vector3.up); val.transform.SetParent(ownerPlayer.isInElevator ? StartOfRound.Instance.elevatorTransform : StartOfRound.Instance.bloodObjectsContainer); ((Vector3)(ref val2))..ctor(Random.Range(-0.5f, 0.5f), Random.Range(-1f, -0.5f), Random.Range(-0.5f, 0.5f)); ((Ray)(ref val3))..ctor(position + Vector3.up * 2f, val2); if (Physics.Raycast(val3, ref val4, 6f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { val.transform.position = ((RaycastHit)(ref val4)).point - Vector3.down * 0.45f; ownerPlayer.RandomizeBloodRotationAndScale(val.transform); ((Component)val.transform).gameObject.SetActive(true); } } } } public void SetCooldownTimers(Dictionary> cooldownsTimers) { DateTime now = SystemClock.now; foreach (KeyValuePair> cooldownTimer in cooldownsTimers) { ((Component)this).GetComponents().FirstOrDefault(delegate(CooldownNetworkBehaviour cooldown) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) FixedString64Bytes value = cooldown.Id.Value; return ((FixedString64Bytes)(ref value)).Value == cooldownTimer.Key; })?.InitTimer(cooldownTimer.Value.Item1 + (float)(now - cooldownTimer.Value.Item2).TotalSeconds); } } public CooldownNetworkBehaviour GetCooldownWithId(string id) { string id2 = id; return ((Component)this).GetComponents().First(delegate(CooldownNetworkBehaviour cooldown) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) FixedString64Bytes value = cooldown.Id.Value; return ((FixedString64Bytes)(ref value)).Value == id2; }); } public bool IsOwnedByAPlayer() { return (Object)(object)ownerPlayer != (Object)null; } public bool IsCurrentBehaviourTaming(TamingBehaviour behaviour) { return Enemy.currentBehaviourStateIndex == (int)(LastDefaultBehaviourIndex + behaviour); } public void TeleportEnemy(EnemyAI enemyAI, Vector3 position) { //IL_003e: 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_0045: 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_0066: Unknown result type (might be due to invalid IL or missing references) if (Utils.IsHost && !((Object)(object)enemyAI?.agent == (Object)null)) { if (((Behaviour)enemyAI.agent).enabled) { enemyAI.agent.Warp(position); } else { ((Component)enemyAI).transform.position = position; } enemyAI.serverPosition = position; if (afterTeleportFunctions.TryGetValue(((object)enemyAI).GetType().Name, out Action value)) { value(enemyAI, position); } } } public virtual bool CanBeTeleported() { return true; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "TamedEnemyBehaviour"; } } internal class TulipSnakeTamedBehaviour : TamedEnemyBehaviour { private enum CustomBehaviour { Flying = 1 } internal InteractTrigger? flyingTrigger; internal EnemyController? controller; internal override bool Controllable => true; internal FlowerSnakeEnemy tulipSnake { get; private set; } internal bool IsFlying => base.CurrentCustomBehaviour == 1; internal new bool IsOwnerPlayer => (Object)(object)ownerPlayer == (Object)(object)Utils.CurrentPlayer; internal override List>? CustomBehaviourHandler => new List> { new Tuple(CustomBehaviour.Flying.ToString(), "Is flying with you...", WhileFlying) }; private void WhileFlying() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //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_0041: Unknown result type (might be due to invalid IL or missing references) tulipSnake.CalculateAnimationSpeed(1f); if (!Utils.IsHost) { return; } RaycastHit val = default(RaycastHit); if (!Physics.Raycast(new Ray(((Component)ownerPlayer).transform.position, Vector3.down), ref val, ((Component)ownerPlayer).transform.localScale.y / 2f + 0.03f, ownerPlayer.walkableSurfacesNoPlayersMask, (QueryTriggerInteraction)1)) { if (!tulipSnake.flapping) { tulipSnake.SetFlappingLocalClient(true, true); tulipSnake.SetFlappingClientRpc(true); } } else if (tulipSnake.flapping) { tulipSnake.SetFlappingLocalClient(false, true); tulipSnake.SetFlappingClientRpc(false); } } internal void OnStartFlying() { if (Utils.IsHost) { SwitchToCustomBehaviour(1); } } internal void OnStopFlying() { if (Utils.IsHost) { SwitchToTamingBehaviour(TamingBehaviour.TamedFollowing); } tulipSnake.flapping = false; tulipSnake.SetFlappingLocalClient(false, false); tulipSnake.SetFlappingClientRpc(false); } internal void OnMove(Vector3 direction) { } internal void OnJump() { } private new void Start() { base.Start(); EnemyAI enemy = base.Enemy; tulipSnake = (FlowerSnakeEnemy)(object)((enemy is FlowerSnakeEnemy) ? enemy : null); if ((Object)(object)ownerPlayer != (Object)null) { ((EnemyAI)tulipSnake).creatureVoice.volume = 0f; tulipSnake.SetFlappingLocalClient(false, false); } } private new void Awake() { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) EnemyAI enemy = base.Enemy; tulipSnake = (FlowerSnakeEnemy)(object)((enemy is FlowerSnakeEnemy) ? enemy : null); if (((Component)this).TryGetComponent(ref controller) && (Object)(object)controller != (Object)null) { controller.OnStartControlling = OnStartFlying; controller.OnStopControlling = OnStopFlying; controller.OnMove = OnMove; controller.EnemyCanFly = true; controller.OnJump = OnJump; controller.EnemySpeedOutside = 8f; controller.EnemyDuration = 3f; controller.EnemyOffsetWhileControlling = new Vector3(0f, 2.4f, 0f); controller.EnemyStaminaUseMultiplier = 1.5f; } } internal override void OnUpdate(bool update = false, bool doAIInterval = true) { base.OnUpdate(update, !IsFlying); } internal override void OnCallFromBall() { base.OnCallFromBall(); if ((Object)(object)flyingTrigger == (Object)null && (Object)(object)ownerPlayer == (Object)(object)Utils.CurrentPlayer) { controller.AddTrigger("Fly"); } controller.SetControlTriggerVisible(); } internal override void OnRetrieveInBall() { base.OnRetrieveInBall(); controller.SetControlTriggerVisible(visible: false); } internal override void OnTamedFollowing() { base.OnTamedFollowing(); if (!tulipSnake.flapping) { tulipSnake.clingPosition = 0; ((EnemyAI)tulipSnake).creatureAnimator.SetInteger("clingType", 0); tulipSnake.SetFlappingLocalClient(false, false); } tulipSnake.CalculateAnimationSpeed(0.5f); tulipSnake.DoChuckleOnInterval(); } internal override void OnEscapedFromBall(PlayerControllerB playerWhoThrewBall) { //IL_0031: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) base.OnEscapedFromBall(playerWhoThrewBall); if (!Utils.IsHost || (Object)(object)playerWhoThrewBall == (Object)null || !playerWhoThrewBall.isPlayerControlled || playerWhoThrewBall.isPlayerDead) { return; } float num = Vector3.Distance(((Component)playerWhoThrewBall).transform.position, ((Component)tulipSnake).transform.position); if (!(num > 50f)) { bool flag = ((EnemyAI)tulipSnake).CheckLineOfSightForPosition(((Component)playerWhoThrewBall).transform.position, 180f, 60, -1f, (Transform)null); LethalMon.Log("TulipSnake.OnEscapedFromBall distance: " + num + " / LOS: " + flag); if (num > 15f || !flag) { ((EnemyAI)tulipSnake).SetMovingTowardsTargetPlayer(playerWhoThrewBall); tulipSnake.timeSinceSeeingTarget = 0f; ((EnemyAI)tulipSnake).SwitchToBehaviourServerRpc(1); return; } ((EnemyAI)tulipSnake).targetPlayer = playerWhoThrewBall; Vector3 val = ((Component)((EnemyAI)tulipSnake).targetPlayer).transform.position - ((Component)this).transform.position; val += Random.insideUnitSphere * Random.Range(0.05f, 0.15f); val.y = Mathf.Clamp(val.y, -16f, 16f); val = Vector3.Normalize(val * 1000f); tulipSnake.StartLeapOnLocalClient(val); tulipSnake.StartLeapClientRpc(val); } } public override void OnDestroy() { controller.StopControlling(beingDestroyed: true); Object.Destroy((Object)(object)controller); base.OnDestroy(); } protected override void __initializeVariables() { base.__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "TulipSnakeTamedBehaviour"; } } } namespace LethalMon.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }