using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Imperium.API; using LethalIntelligence.Modules; using LethalIntelligence.Patches; using LethalNetworkAPI; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using Mirage.Core.Audio; using Mirage.Unity; using SkinwalkerMod; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using Wendigos; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("VirusTLNR")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.4.9.0")] [assembly: AssemblyInformationalVersion("0.4.9")] [assembly: AssemblyProduct("LethalIntelligence")] [assembly: AssemblyTitle("LethalIntelligence")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.9.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalIntelligence { [BepInPlugin("VirusTLNR.LethalIntelligence", "LethalIntelligence", "0.4.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static bool DebugMode = false; public static string LastDebugModeMsg; public static string logPluginName = "Lethal Intelligence"; public static AssetBundle MapDotBundle; public static AssetBundle MaskedAnimationsBundle; public static bool enableMaskedFeatures; public static bool enableSkinWalkers; public static bool enableWendigos; public static bool enableMirage; public static bool enableMaskedAggressive; public static bool enableMaskedStealthy; public static bool enableMaskedCunning; public static bool enableMaskedDeceiving; public static bool enableMaskedInsane; public static bool useTerminal; public static bool useTerminalCredit; public static bool maskedShipDeparture; public static GameObject MapDotPrefab; public static RuntimeAnimatorController MaskedAnimController; public static RuntimeAnimatorController MapDotRework; public static string PluginDirectory; public static bool skinWalkersIntegrated; public static bool wendigosIntegrated; public static bool mirageIntegrated; public static bool alwaysHearActiveWalkiesIntegrated; public static bool debugModeSetting; public static int debugStatusDelay; internal static bool isTerminalBeingUsed = false; internal static bool isBreakerBoxBeingUsed = false; internal static bool imperiumFound; public static Plugin Instance { get; private set; } = null; internal static ManualLogSource mls { get; private set; } = null; internal static Harmony? harmony { get; set; } private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if ((Object)Instance == (Object)null) { Instance = this; } mls = ((BaseUnityPlugin)this).Logger; if (LobbyCompatibilityChecker.Enabled) { mls.LogInfo((object)"BMX.LobbyCompatibility has been found, Initiating Soft Dependency!"); LobbyCompatibilityChecker.Init(); } imperiumFound = Chainloader.PluginInfos.ContainsKey("giosuel.Imperium"); PluginDirectory = ((BaseUnityPlugin)this).Info.Location; LoadAssets(); mls.LogInfo((object)"Plugin VirusTLNR.LethalIntelligence v0.4.9 has loaded!"); enableMaskedFeatures = ((BaseUnityPlugin)this).Config.Bind("General", "Masked AI Features", true, "Turn on masked AI features. If this feature is disabled, it will only change Masked's radar movement. If all masked Personalities are disabled, this will be disabled by default. *This option must be enabled to change Masked's AI.*").Value; enableSkinWalkers = ((BaseUnityPlugin)this).Config.Bind("General", "SkinWalkers mod Compatibility", true, "Enables compatibility with the SkinWalkers mod. (Requires SkinWalkers mod installed, automatically disables on launch if not installed)").Value; enableWendigos = ((BaseUnityPlugin)this).Config.Bind("General", "Wendigos mod Compatibility", true, "Enables compatibility with the Wendigos_Voice_Cloning mod. (Requires Wendigos_Voice_Cloning mod installed, automatically disables on launch if not installed)").Value; enableMirage = ((BaseUnityPlugin)this).Config.Bind("General", "Mirage mod Compatibility", true, "Enables compatibility with the Mirage mod. (Requires Mirage mod installed, automatically disables on launch if not installed)").Value; enableMaskedAggressive = ((BaseUnityPlugin)this).Config.Bind("MaskedPersonalities", "MaskedAggressive", true, "Enables the 'Aggressive' personality for the Masked (at least 1 of these must be TRUE)").Value; enableMaskedStealthy = ((BaseUnityPlugin)this).Config.Bind("MaskedPersonalities", "MaskedStealthy", true, "Enables the 'Stealthy' personality for the Masked (at least 1 of these must be TRUE)").Value; enableMaskedCunning = ((BaseUnityPlugin)this).Config.Bind("MaskedPersonalities", "MaskedCunning", true, "Enables the Cunning personality for the Masked (at least 1 of these must be TRUE)").Value; enableMaskedDeceiving = ((BaseUnityPlugin)this).Config.Bind("MaskedPersonalities", "MaskedDeceiving", true, "Enables the 'Deceiving' personality for the Masked (at least 1 of these must be TRUE)").Value; enableMaskedInsane = ((BaseUnityPlugin)this).Config.Bind("MaskedPersonalities", "MaskedInsane", true, "Enables the 'Insane' personality for the Masked (at least 1 of these must be TRUE)").Value; if (!enableMaskedAggressive && !enableMaskedStealthy && !enableMaskedCunning && !enableMaskedDeceiving && !enableMaskedInsane) { enableMaskedFeatures = false; mls.LogWarning((object)"Bad Config!, all Masked personalities are disabled, disabling entire MaskedAI Module."); } useTerminal = ((BaseUnityPlugin)this).Config.Bind("MaskedAI", "Masked terminal access", true, "Allows Masked to use the terminal.").Value; useTerminalCredit = ((BaseUnityPlugin)this).Config.Bind("MaskedAI", "Masked uses credits", false, "(Not working rn) Allows Masked to use the terminal to spend credits.").Value; maskedShipDeparture = ((BaseUnityPlugin)this).Config.Bind("MaskedAI", "Masked pulls the brake lever", true, "Allows Masked to pull the brake lever.").Value; debugModeSetting = ((BaseUnityPlugin)this).Config.Bind("DebugMode", "Debug Mode", true, "Enables more spammy logs for debugging, will be enabled automatically if imperium is installed. (all other DebugMode settings are ignored if Debug Mode is disabled)").Value; debugStatusDelay = ((BaseUnityPlugin)this).Config.Bind("DebugMode", "Status Report Delay", 0, "How often should status reports (only updates when information changes) be logged (higher number = less log spam but also less accurate as not all information is gathered").Value; if (imperiumFound || debugModeSetting) { if (imperiumFound) { mls.LogWarning((object)"Imperium has been found, All Hail The Emperor!, Auto Initiating Debug Mode (More Logs!)"); } else { mls.LogWarning((object)"Debug Mode enabled in config (More Logs!)"); } DebugMode = true; } RemoveOrphanedConfigs(); Patch(); Start(); } internal void RemoveOrphanedConfigs() { PropertyInfo property = ((object)((BaseUnityPlugin)this).Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary dictionary = (Dictionary)property.GetValue(((BaseUnityPlugin)this).Config, null); if (dictionary.Count != 0) { mls.LogInfo((object)"Found Orphaned Config Entries - Removing them all as they are not needed anymore"); } dictionary.Clear(); ((BaseUnityPlugin)this).Config.Save(); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (harmony == null) { harmony = new Harmony("LethalNetworkAPI"); } mls.LogDebug((object)"Patching..."); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(MaskedPlayerEnemyPatch)); harmony.PatchAll(typeof(ShotgunItemPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); mls.LogDebug((object)"Finished patching!"); } private void Start() { if (enableMaskedFeatures) { mls.LogInfo((object)"MaskedPersonalities feature has been enabled! Masked AI's behavior is now modified."); } else { mls.LogInfo((object)"MaskedPersonalities feature has been disabled! Masked AI's behaviour will not be modified."); } if (Chainloader.PluginInfos.Keys.Any((string k) => k == "RugbugRedfern.SkinwalkerMod") && enableSkinWalkers && enableMaskedFeatures) { mls.LogInfo((object)(logPluginName + " <-> SkinWalkers Integrated!")); skinWalkersIntegrated = true; } if (Chainloader.PluginInfos.Keys.Any((string w) => w == "Tim_Shaw.Wendigos_Voice_Cloning") && enableWendigos && enableMaskedFeatures) { mls.LogInfo((object)(logPluginName + " <-> Wendigos_Voice_Cloning Integrated!")); wendigosIntegrated = true; } if (Chainloader.PluginInfos.Keys.Any((string m) => m == "qwbarch.Mirage") && enableMirage && enableMaskedFeatures) { mls.LogInfo((object)(logPluginName + " <-> Mirage Integrated!")); mirageIntegrated = true; } if (Chainloader.PluginInfos.Keys.Any((string s) => s == "suskitech.LCAlwaysHearActiveWalkie") && enableMaskedFeatures) { mls.LogInfo((object)(logPluginName + " <-> AlwaysHearActiveWalkies Support Enabled!")); alwaysHearActiveWalkiesIntegrated = true; } mls.LogInfo((object)"Plugin VirusTLNR.LethalIntelligence v0.4.9 finished checking for available dependencies!"); } private void LoadAssets() { try { MapDotBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "mapdot.bundle")); } catch (Exception ex) { mls.LogError((object)("Couldn't load Mapdot.bundle: " + ex.Message)); return; } try { MapDotRework = MapDotBundle.LoadAsset("MapDotRework.controller"); MapDotPrefab = MapDotBundle.LoadAsset("MaskedMapDot.prefab"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded MapDot assets!"); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)("Couldn't load MapDot assets: " + ex2.Message)); } MapDotBundle.Unload(false); try { MaskedAnimationsBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "maskedanimations.bundle")); } catch (Exception ex3) { mls.LogError((object)("Couldn't load MaskedAnimations.bundle: " + ex3.Message)); return; } try { MaskedAnimController = MaskedAnimationsBundle.LoadAsset("MaskedMetarig.controller"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded MaskedAnimations assets!"); } catch (Exception ex4) { ((BaseUnityPlugin)this).Logger.LogError((object)("Couldn't load MaskedAnimations assets: " + ex4.Message)); } MaskedAnimationsBundle.Unload(false); } } internal static class PluginInfo { public const string PLUGIN_GUID = "VirusTLNR.LethalIntelligence"; public const string PLUGIN_NAME = "LethalIntelligence"; public const string PLUGIN_VERSION = "0.4.9"; } } namespace LethalIntelligence.Patches { public class DebugInfoCollectors { public static void BuyableItemsList(Terminal terminal) { Plugin.mls.LogError((object)"BuyableItemsList DebugInfo"); Item[] buyableItemsList = terminal.buyableItemsList; foreach (Item val in buyableItemsList) { Plugin.mls.LogWarning((object)val.itemName); } } public static void logAllEntranceDetails(string pointInCode = "unknown") { //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_00c1: Unknown result type (might be due to invalid IL or missing references) Plugin.mls.LogError((object)("logAllEntranceDetails Start @ " + pointInCode)); EntranceTeleport[] array = Object.FindObjectsOfType(false); for (int i = 0; i < array.Length; i++) { EntranceTeleport val = array[i]; ManualLogSource mls = Plugin.mls; string[] obj = new string[10] { "==============================\nEntrance # ", i.ToString(), "\nEntID -> ", val.entranceId.ToString(), "\nEntIsEntranceToBuilding (is outside?) -> ", val.isEntranceToBuilding.ToString(), "\nEntEntrancePoint -> ", null, null, null }; Vector3 position = ((Component)val.entrancePoint).transform.position; obj[7] = ((object)(Vector3)(ref position)).ToString(); obj[8] = "\nEntExitPoint -> "; obj[9] = (((Object)(object)val.exitScript == (Object)null) ? "null" : ((object)((Component)val.exitScript).transform.position))?.ToString(); mls.LogWarning((object)string.Concat(obj)); } Plugin.mls.LogError((object)("logAllEntranceDetails End @ " + pointInCode)); } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { private static float validDistance = 2f; internal static EntranceTeleport[] entrancesTeleportArray = null; private static List eta = new List(); private static List badCombinations = new List(); private static List goodCombinations = new List(); private static NavMeshPath path; private static int matchesChecked = 0; private static int entrancesChecked = 0; public static List invalidEntrances = new List(); private static Vector3 lastPos; public static LNetworkVariable> networkedInvalidEntrances = LNetworkVariable>.Connect("networkedInvalidEntrances" + ((NetworkBehaviour)StartOfRound.Instance).NetworkObjectId, (List)null, (LNetworkVariableWritePerms)0, (Action, List>)null); private static bool isRandomPathComplete(Vector3 s, int d) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0062: 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_0098: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Invalid comparison between Unknown and I4 //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: 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_0303: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) path = new NavMeshPath(); if (s == new Vector3(0f, 0f, 0f)) { Plugin.mls.LogDebug((object)" (random check)start position is null"); return false; } NavMeshHit val = default(NavMeshHit); NavMesh.SamplePosition(s, ref val, validDistance, -1); int num = 1; float num2 = 1000f; Vector3 val2 = ((NavMeshHit)(ref val)).position; if ((Object)(object)entrancesTeleportArray[d] == (Object)null) { Plugin.mls.LogDebug((object)" (random check)end position is null"); return false; } NavMeshHit val3 = default(NavMeshHit); while (num >= 1 && num <= 20 && num2 > 1.5f) { lastPos = val2; NavMesh.SamplePosition(val2, ref val, validDistance, -1); _ = ((NavMeshHit)(ref val)).position; if (false) { Plugin.mls.LogDebug((object)" start random position is not near the navmesh? (hit is null)"); return false; } if ((Object)(object)entrancesTeleportArray[d].entrancePoint == (Object)null) { Plugin.mls.LogDebug((object)" (random check)entrance cant be used from this side"); return false; } NavMesh.SamplePosition(entrancesTeleportArray[d].entrancePoint.position, ref val3, validDistance, -1); _ = ((NavMeshHit)(ref val3)).position; if (false) { Plugin.mls.LogDebug((object)" end entrance position is not near the navmesh? (hit is null)"); return false; } NavMesh.CalculatePath(((NavMeshHit)(ref val)).position, ((NavMeshHit)(ref val3)).position, -1, path); num2 = Vector3.Distance(val2, ((NavMeshHit)(ref val3)).position); Vector3 val4; NavMeshPathStatus status; Vector3 position; if (path.corners.Length == 0) { position = ((NavMeshHit)(ref val3)).position; ManualLogSource mls = Plugin.mls; string[] obj = new string[16] { " testing entrance#=", d.ToString(), " ID=", entrancesTeleportArray[d].entranceId.ToString(), " | attempt=", num.ToString(), " | startPos=", null, null, null, null, null, null, null, null, null }; val4 = val2; obj[7] = ((object)(Vector3)(ref val4)).ToString(); obj[8] = " | lastPos="; val4 = position; obj[9] = ((object)(Vector3)(ref val4)).ToString(); obj[10] = " | status="; status = path.status; obj[11] = ((object)(NavMeshPathStatus)(ref status)).ToString(); obj[12] = " | cornersLeft="; obj[13] = path.corners.Length.ToString(); obj[14] = " | dist="; obj[15] = num2.ToString(); mls.LogDebug((object)string.Concat(obj)); return false; } position = path.corners[path.corners.Length - 1]; ManualLogSource mls2 = Plugin.mls; string[] obj2 = new string[16] { " testing entrance#=", d.ToString(), " ID=", entrancesTeleportArray[d].entranceId.ToString(), " | attempt=", num.ToString(), " | startPos=", null, null, null, null, null, null, null, null, null }; val4 = val2; obj2[7] = ((object)(Vector3)(ref val4)).ToString(); obj2[8] = " | lastPos="; val4 = position; obj2[9] = ((object)(Vector3)(ref val4)).ToString(); obj2[10] = " | status="; status = path.status; obj2[11] = ((object)(NavMeshPathStatus)(ref status)).ToString(); obj2[12] = " | cornersLeft="; obj2[13] = path.corners.Length.ToString(); obj2[14] = " | dist="; obj2[15] = num2.ToString(); mls2.LogDebug((object)string.Concat(obj2)); val2 = path.corners[path.corners.Length - 1]; num++; if (val2 == lastPos) { num = -1; } } if ((int)path.status == 0) { return true; } return false; } private static bool isEntrancePathComplete(int s, int d) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0074: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Invalid comparison between Unknown and I4 //IL_0146: 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_0183: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) path = new NavMeshPath(); if ((Object)(object)entrancesTeleportArray[s] == (Object)null) { Plugin.mls.LogDebug((object)" (entrance check)start position is null"); return false; } if ((Object)(object)entrancesTeleportArray[s].entrancePoint == (Object)null) { Plugin.mls.LogDebug((object)" (random check)start entrance cant be used from this side"); return false; } NavMeshHit val = default(NavMeshHit); NavMesh.SamplePosition(entrancesTeleportArray[s].entrancePoint.position, ref val, validDistance, -1); int num = 1; float num2 = 1000f; Vector3 val2 = ((NavMeshHit)(ref val)).position; if ((Object)(object)entrancesTeleportArray[d] == (Object)null) { Plugin.mls.LogDebug((object)" (entrance check)end position is null"); return false; } NavMeshHit val3 = default(NavMeshHit); while (num >= 1 && num <= 20 && num2 > 1.5f) { lastPos = val2; NavMesh.SamplePosition(val2, ref val, validDistance, -1); _ = ((NavMeshHit)(ref val)).position; if (false) { Plugin.mls.LogDebug((object)" start entrance position is not near the navmesh? (hit is null)"); return false; } if ((Object)(object)entrancesTeleportArray[d].entrancePoint == (Object)null) { Plugin.mls.LogDebug((object)" (random check)end entrance cant be used from this side"); return false; } NavMesh.SamplePosition(entrancesTeleportArray[d].entrancePoint.position, ref val3, validDistance, -1); _ = ((NavMeshHit)(ref val3)).position; if (false) { Plugin.mls.LogDebug((object)" end entrance position is not near the navmesh? (hit is null)"); return false; } NavMesh.CalculatePath(((NavMeshHit)(ref val)).position, ((NavMeshHit)(ref val3)).position, -1, path); num2 = Vector3.Distance(val2, ((NavMeshHit)(ref val3)).position); Vector3 val4; NavMeshPathStatus status; Vector3 position; if (path.corners.Length == 0) { position = ((NavMeshHit)(ref val3)).position; ManualLogSource mls = Plugin.mls; string[] obj = new string[16] { " testing entrance#=", d.ToString(), " ID=", entrancesTeleportArray[d].entranceId.ToString(), " | attempt=", num.ToString(), " | startPos=", null, null, null, null, null, null, null, null, null }; val4 = val2; obj[7] = ((object)(Vector3)(ref val4)).ToString(); obj[8] = " | lastPos="; val4 = position; obj[9] = ((object)(Vector3)(ref val4)).ToString(); obj[10] = " | status="; status = path.status; obj[11] = ((object)(NavMeshPathStatus)(ref status)).ToString(); obj[12] = " | cornersLeft="; obj[13] = path.corners.Length.ToString(); obj[14] = " | dist="; obj[15] = num2.ToString(); mls.LogDebug((object)string.Concat(obj)); return false; } position = path.corners[path.corners.Length - 1]; ManualLogSource mls2 = Plugin.mls; string[] obj2 = new string[16] { " testing entrance#=", d.ToString(), " ID=", entrancesTeleportArray[d].entranceId.ToString(), " | attempt=", num.ToString(), " | startPos=", null, null, null, null, null, null, null, null, null }; val4 = val2; obj2[7] = ((object)(Vector3)(ref val4)).ToString(); obj2[8] = " | lastPos="; val4 = position; obj2[9] = ((object)(Vector3)(ref val4)).ToString(); obj2[10] = " | status="; status = path.status; obj2[11] = ((object)(NavMeshPathStatus)(ref status)).ToString(); obj2[12] = " | cornersLeft="; obj2[13] = path.corners.Length.ToString(); obj2[14] = " | dist="; obj2[15] = num2.ToString(); mls2.LogDebug((object)string.Concat(obj2)); val2 = path.corners[path.corners.Length - 1]; num++; if (val2 == lastPos) { num = -1; } } if ((int)path.status == 0) { return true; } return false; } private static void checkPathtoRandomLocation(Vector3 et1, int et2) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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) string text; if (isRandomPathComplete(et1, et2)) { goodCombinations.Add(entrancesTeleportArray[et2].isEntranceToBuilding + "|" + entrancesTeleportArray[et2].entranceId); text = "PathComplete"; } else { badCombinations.Add(entrancesTeleportArray[et2].isEntranceToBuilding + "|" + entrancesTeleportArray[et2].entranceId); text = "PathInvalid"; } ManualLogSource mls = Plugin.mls; string[] obj = new string[10] { " ", entrancesTeleportArray[et2].isEntranceToBuilding.ToString().Replace("True", "Outside").Replace("False", "Inside"), " RandomPos", ((object)(Vector3)(ref et1)).ToString(), " --> Entrance", entrancesTeleportArray[et2].entranceId.ToString(), "@", null, null, null }; Vector3 position = ((Component)entrancesTeleportArray[et2]).transform.position; obj[7] = ((object)(Vector3)(ref position)).ToString(); obj[8] = " = "; obj[9] = text; mls.LogDebug((object)string.Concat(obj)); } private static void checkPathtoEntranceLocation(int et1, int et2) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) string text; if (isEntrancePathComplete(et1, et2)) { goodCombinations.Add(entrancesTeleportArray[et2].isEntranceToBuilding + "|" + entrancesTeleportArray[et2].entranceId); text = "PathComplete"; } else { badCombinations.Add(entrancesTeleportArray[et2].isEntranceToBuilding + "|" + entrancesTeleportArray[et2].entranceId); text = "PathInvalid"; } ManualLogSource mls = Plugin.mls; string[] obj = new string[12] { " ", entrancesTeleportArray[et2].isEntranceToBuilding.ToString().Replace("True", "Outside").Replace("False", "Inside"), " Entrance", entrancesTeleportArray[et1].entranceId.ToString(), "@", null, null, null, null, null, null, null }; Vector3 position = ((Component)entrancesTeleportArray[et1]).transform.position; obj[5] = ((object)(Vector3)(ref position)).ToString(); obj[6] = " --> Entrance"; obj[7] = entrancesTeleportArray[et2].entranceId.ToString(); obj[8] = "@"; position = ((Component)entrancesTeleportArray[et2]).transform.position; obj[9] = ((object)(Vector3)(ref position)).ToString(); obj[10] = " = "; obj[11] = text; mls.LogDebug((object)string.Concat(obj)); } private static void analysePathingData() { int[] array = new int[20]; int[] array2 = new int[20]; int num = matchesChecked / entrancesChecked; foreach (string badCombination in badCombinations) { string[] array3 = badCombination.Split(new char[1] { '|' }); if (array3[0] == "True") { array[int.Parse(array3[1])]++; } else { array2[int.Parse(array3[1])]++; } } int num2 = 0; int[] array4 = array; for (int i = 0; i < array4.Length; i++) { int num3 = array4[i]; Plugin.mls.LogDebug((object)("Outside Entrance #" + num2 + " = " + num3 + "/" + num)); if (num3 >= num) { Plugin.mls.LogWarning((object)("Entrance #" + num2 + " is invalid for AI routing due to pathing issues Outside - this EntranceTeleport will be ignored for this round.")); if (!invalidEntrances.Contains(num2)) { invalidEntrances.Add(num2); } } num2++; } int num4 = 0; int[] array5 = array2; for (int j = 0; j < array5.Length; j++) { int num5 = array5[j]; Plugin.mls.LogDebug((object)("Inside Entrance #" + num4 + " = " + num5 + "/" + num)); if (num5 >= num) { Plugin.mls.LogWarning((object)("Entrance #" + num4 + " is invalid for AI routing due to pathing issues Inside - this EntranceTeleport will be ignored for this round.")); if (!invalidEntrances.Contains(num4)) { invalidEntrances.Add(num4); } } num4++; } networkedInvalidEntrances.Value = invalidEntrances; } public static Vector3 RandomNavmeshLocation(Vector3 startingPoint, Vector3 spFront, float move, float radius) { //IL_000a: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_001e: 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_0024: 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_007a: 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_003f: 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_007e: 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_005e: Unknown result type (might be due to invalid IL or missing references) float num = 0f; NavMeshHit val3 = default(NavMeshHit); while ((double)num < (double)radius * 0.75) { Vector3 val = Random.insideUnitSphere * radius; val += startingPoint; Vector3 val2 = Vector3.zero; if (NavMesh.SamplePosition(val, ref val3, radius, 1)) { val2 = ((NavMeshHit)(ref val3)).position; } num = Vector3.Distance(val2, startingPoint); if ((double)num > (double)radius * 0.7) { return val2; } } return startingPoint; } private static void earlyCallSetExitIDs(Vector3 mainEntrancePosition) { //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) //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) if (mainEntrancePosition == Vector3.zero) { Plugin.mls.LogWarning((object)"Main entrance teleport was not spawned on local client within 12 seconds. Early Setting ExitIDs based on origin instead. (this is a vanilla issue!)"); } int num = 1; EntranceTeleport[] array = Object.FindObjectsOfType().OrderBy(delegate(EntranceTeleport x) { //IL_0006: 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_0016: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)x).transform.position - mainEntrancePosition; return ((Vector3)(ref val)).sqrMagnitude; }).ToArray(); for (int i = 0; i < array.Length; i++) { if (array[i].entranceId == 1 && !array[i].isEntranceToBuilding) { array[i].entranceId = num; num++; } } } private static void resetExitPointToNull(EntranceTeleport[] entrancesArray) { foreach (EntranceTeleport val in entrancesArray) { val.exitScript = null; } } private static void preloadExitPoints(EntranceTeleport[] entrancesArray) { foreach (EntranceTeleport val in entrancesArray) { val.FindExitPoint(); } } [HarmonyPrefix] [HarmonyPatch("SetLockedDoors")] public static void PathingAccessibilityChecking(Vector3 mainEntrancePosition) { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: 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_0256: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) entrancesTeleportArray = Object.FindObjectsOfType(false); if (!GameNetworkManager.Instance.isHostingGame) { return; } if ((Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null) { Plugin.mls.LogInfo((object)("EntranceTeleport checks skipped on " + ((Object)RoundManager.Instance.currentLevel).name.ToString() + " as interior generator is null")); return; } if ((Object)(object)RoundManager.Instance.currentLevel == (Object)null) { Plugin.mls.LogError((object)"EntranceTeleport checks skipped as moon is null (urgent, report this telling me what moon you routed to!)"); return; } Plugin.mls.LogInfo((object)("Checking which Entrance Teleports are Valid...( " + ((Object)RoundManager.Instance.currentLevel).name.ToString() + " | " + ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name.ToString() + " )")); earlyCallSetExitIDs(mainEntrancePosition); entrancesChecked = 0; matchesChecked = 0; badCombinations.Clear(); goodCombinations.Clear(); for (int i = 0; i < entrancesTeleportArray.Length; i++) { if (((Object)entrancesTeleportArray[i]).name.Contains("PocketRoomTeleport")) { if (!invalidEntrances.Contains(entrancesTeleportArray[i].entranceId)) { invalidEntrances.Add(entrancesTeleportArray[i].entranceId); } } else { if ((Object)(object)entrancesTeleportArray[i] == (Object)null) { continue; } Plugin.mls.LogDebug((object)("Checking entrance #" + i + " vs Random Locations...")); for (int j = 0; j < 3; j++) { Vector3 et; if (entrancesTeleportArray[i].isEntranceToBuilding) { GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode"); et = array[Random.RandomRangeInt(0, array.Length)].transform.position; } else { et = RandomNavmeshLocation(entrancesTeleportArray[i].entrancePoint.position, entrancesTeleportArray[i].entrancePoint.right, 15f, 5f); } Plugin.mls.LogDebug((object)(" Using RandomLocation=" + ((object)(Vector3)(ref et)).ToString())); checkPathtoRandomLocation(et, i); matchesChecked++; } Plugin.mls.LogDebug((object)("Checking entrance #" + i + " vs Other Entrances...")); for (int k = 0; k < entrancesTeleportArray.Length; k++) { if (((Object)entrancesTeleportArray[k]).name.Contains("PocketRoomTeleport")) { if (!invalidEntrances.Contains(entrancesTeleportArray[k].entranceId)) { invalidEntrances.Add(entrancesTeleportArray[k].entranceId); } } else if (!((Object)(object)entrancesTeleportArray[k] == (Object)null) && entrancesTeleportArray[i].isEntranceToBuilding == entrancesTeleportArray[k].isEntranceToBuilding && entrancesTeleportArray[i].entranceId != entrancesTeleportArray[k].entranceId) { ManualLogSource mls = Plugin.mls; Vector3 position = ((Component)entrancesTeleportArray[k]).transform.position; mls.LogDebug((object)(" Using EntranceLocation=" + ((object)(Vector3)(ref position)).ToString())); checkPathtoEntranceLocation(k, i); matchesChecked++; } } entrancesChecked++; } } analysePathingData(); Plugin.mls.LogInfo((object)"Entrance Teleport Checks completed."); } [HarmonyPostfix] [HarmonyPatch("SetPowerOffAtStart")] private static void fixExitPointsPostfix() { resetExitPointToNull(entrancesTeleportArray); preloadExitPoints(entrancesTeleportArray); } } internal class ImperiumPatches { public static void maskedVisualization() { try { Visualization.InsightsFor().RegisterInsight("Personality", (Func)((MaskedPlayerEnemy entity) => $"{((Component)entity).gameObject.GetComponent().maskedPersonality}")).RegisterInsight("Focus", (Func)((MaskedPlayerEnemy entity) => $"{((Component)entity).gameObject.GetComponent().maskedFocus}")) .RegisterInsight("Activity", (Func)((MaskedPlayerEnemy entity) => $"{((Component)entity).gameObject.GetComponent().maskedActivity}")) .RegisterInsight("FindPlayer", (Func)((MaskedPlayerEnemy entity) => (((Object)(object)((Component)entity).gameObject.GetComponent().targetedPlayer != (Object)null) ? ((Object)((Component)entity).gameObject.GetComponent().targetedPlayer).name.ToString() : "null") ?? "")) .RegisterInsight("FindTime", (Func)((MaskedPlayerEnemy entity) => (((Object)(object)((Component)entity).gameObject.GetComponent().targetedPlayer != (Object)null) ? ((Component)entity).gameObject.GetComponent().followTime.ToString() : "null") ?? "")) .RegisterInsight("Pos", (Func)delegate(MaskedPlayerEnemy entity) { //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) Vector3 position = ((Component)((Component)entity).gameObject.GetComponent().agent).transform.position; return ((object)(Vector3)(ref position)).ToString().Replace(" ", "") ?? ""; }) .RegisterInsight("Dest", (Func)delegate(MaskedPlayerEnemy entity) { //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) Vector3 pathEndPosition = ((Component)entity).gameObject.GetComponent().agent.pathEndPosition; return ((object)(Vector3)(ref pathEndPosition)).ToString().Replace(" ", "") ?? ""; }) .RegisterInsight("Distance", (Func)((MaskedPlayerEnemy entity) => ((Component)entity).gameObject.GetComponent().currentDestinationDistance.Value.ToString().Replace("F", "") ?? "")) .RegisterInsight("HeadTilt", (Func)delegate(MaskedPlayerEnemy entity) { //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) Vector3 eulerAngles = entity.headTiltTarget.eulerAngles; return ((object)(Vector3)(ref eulerAngles)).ToString() ?? ""; }) .RegisterInsight("VLookAngle", (Func)((MaskedPlayerEnemy entity) => entity.verticalLookAngle.ToString() ?? "")); } catch (NullReferenceException) { } } } public static class LobbyCompatibilityChecker { public static bool Enabled => Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void Init() { PluginHelper.RegisterPlugin("VirusTLNR.LethalIntelligence", Version.Parse("0.4.9"), (CompatibilityLevel)2, (VersionStrictness)3); } } public class BushSystem : MonoBehaviour { public bool bushWithItem; } public class GlobalItemList : MonoBehaviour { public List allitems = new List(); private List previtems = new List(); public List allWalkieTalkies = new List(); public bool isShotgun; public bool isShovel; public bool isWalkie; public static GlobalItemList Instance { get; private set; } private void Awake() { Instance = this; } private void Update() { if (allitems != previtems) { CheckItem(1); CheckItem(2); CheckItem(3); previtems = allitems; } } private void CheckItem(int id) { foreach (GrabbableObject allitem in allitems) { if (id == 1) { if (allitem is ShotgunItem) { isShotgun = true; break; } isShotgun = false; } if (id == 2) { if (allitem is Shovel) { isShovel = true; break; } isShovel = false; } if (id == 3) { if (allitem is WalkieTalkie) { isWalkie = true; break; } isWalkie = false; } } } } public class SyncConfiguration : NetworkBehaviour { } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix() { if (Plugin.enableMaskedFeatures) { ((Component)StartOfRound.Instance).gameObject.AddComponent(); ((Component)StartOfRound.Instance).gameObject.AddComponent(); } } } public class CheckItemCollision : MonoBehaviour { public bool hidedByMasked; } [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(GrabbableObject __instance) { if (Plugin.enableMaskedFeatures) { ((Component)__instance).gameObject.AddComponent(); GlobalItemList.Instance.allitems.Add(__instance); if (__instance is WalkieTalkie) { GlobalItemList.Instance.allWalkieTalkies.Add(((Component)__instance).GetComponent()); } } } [HarmonyPostfix] [HarmonyPatch("DestroyObjectInHand")] private static void DestroyObjectInHand_Postfix(GrabbableObject __instance) { if (Plugin.enableMaskedFeatures) { GlobalItemList.Instance.allitems.Remove(__instance); if (__instance is WalkieTalkie) { GlobalItemList.Instance.allWalkieTalkies.Remove(((Component)__instance).GetComponent()); } } } } public class MaskedAIRevamp : NetworkBehaviour { public enum Personality { None, Aggressive, Stealthy, Cunning, Deceiving, Insane } public enum Focus { None, Player, Items, Terminal, BreakerBox, Hiding, Mimicking, Apparatus, Escape } public enum Activity { None, Idle, MainEntrance, FireExit, ItemLocker, BreakerBox, Apparatus, RandomItem, RandomPlayer, WalkieTalkie } public Personality maskedPersonality; public Personality lastMaskedPersonality; public Focus maskedFocus; public Focus lastMaskedFocus; public Activity maskedActivity; public bool mustChangeFocus; public bool mustChangeActivity; public bool ignoringPersonality; public bool focusingPersonality; public AISearchRoutine searchForItems; public float stopAndTbagTimer = 1.1f; public float stopAndTbagCooldown; public int randomPose; public bool isHoldingObject; public bool heldTwoHanded; public bool moveSpecial; public EnemyAI __instance; public MaskedPlayerEnemy maskedEnemy; public Animator creatureAnimator; public NavMeshAgent agent; public bool checkDestination; public GrabbableObject closestGrabbable; public GrabbableObject heldGrabbable; private bool targetPlayerReachable; private bool justPickedUpItem = false; public CheckItemCollision itemSystem; public float transmitPauseTimer; public int enterTermianlSpecialCodeTime; public float jumpTime = 1f; private float dropTimerB; private Vector3 prevPos; private float velX; private float velZ; public float closetTimer; private bool enableDance; public float shovelTimer; public float hornTimer; public bool stunThrowed; public float angle1; public float angle2; public float dropTimer; public float shootTimer; public float rotationTimer; public float rotationCooldown; public bool itemDroped; public bool droppingItem; public Terminal terminal; public bool isUsingTerminal; public bool isUsingApparatus; public bool completedApparatusFocus; public bool noMoreItems = false; public bool noMoreTerminal = false; public float dropShipTimer; public bool isDeliverEmptyDropship; public GameObject itemHolder; public GameObject LowerTorsoCostumeContainer; public GameObject beltBagHolder; public float upperBodyAnimationsWeight; public float grabbableTime; public float distanceToPlayer = 1000f; private float terminalDistance = 1000f; private float breakerBoxDistance = 1000f; private float apparatusDistance = 1000f; private float bushDistance = 1000f; public bool isStaminaDowned; public Vector3 originDestination; public bool walkieUsed; public bool walkieVoiceTransmitted; public float walkieTimer; public float walkieCooldown; public float originTimer; private BreakerBox breakerBox; private LungProp apparatus; private GrabbableObject grabbableApparatus; public bool isUsingBreakerBox; public bool noMoreBreakerBox = false; public bool noMoreApparatus = false; private AnimatedObjectTrigger powerBox; private GameObject[] bushes; private ItemDropship dropship; private TerminalAccessibleObject[] terminalAccessibleObject; private float lookTimer; private bool lookedPlayer; public bool notGrabClosestItem; public bool notGrabItems; public bool isReeledWithShovel; public bool isHittedWithShovel; public bool shovelHitConfirm; public PlayerControllerB nearestPlayer; public bool canGoThroughItem; public bool isDroppedShotgunAvailable; public string maskedId = null; private string lastDebugModeStatus; public string maskedGoal = ""; private bool stopStatusReporting = false; private float breakerClosestPoint; private float terminalClosestPoint; private float grabbableClosestPoint; private float apparatusClosestPoint; private Vector3 destination; private float distanceToDestination; private int delayNumber = 0; private int delayMax = Plugin.debugStatusDelay; public LNetworkVariable? currentDestinationDistance; public LNetworkVariable? maskedPersonalityInt; public LNetworkVariable? maskedFocusInt; public LNetworkVariable? maskedActivityInt; public LNetworkVariable? useWalkie; public LNetworkVariable? isCrouched; public LNetworkVariable? isDancing; public LNetworkVariable? isRunning; public LNetworkVariable? isJumped; public LNetworkVariable? isTired; public LNetworkVariable? terminalTimeFloat; public LNetworkVariable? delayMaxTime; public LNetworkVariable? transmitMessageTimer; public LNetworkVariable? enterTerminalCodeTimer; public LNetworkVariable? terminalCode; public LNetworkVariable? maxDanceCount; public LNetworkVariable? dropItem; public LNetworkVariable terminalReachable; public LNetworkVariable breakerBoxReachable; public LNetworkVariable apparatusReachable; public LNetworkVariable? hostTimeStamp; public LNetworkVariable? maskedTargetId; public LNetworkVariable? maskedInSpecialAnimation; public LNetworkVariable closestGrabbableId; public LNetworkVariable maskedWalkieId; public LNetworkVariable closestGrabbableDistance; public LNetworkVariable closestGrabbableReachable; public LNetworkVariable idleModeVersion; public LNetworkVariable? terminalPosition; public LNetworkVariable? breakerPosition; public LNetworkVariable? lockerPosition; public LNetworkVariable? apparatusPosition; public LNetworkVariable? fireExitPosition; public LNetworkVariable? mainEntrancePosition; public static LNetworkVariable appTrigger; public static LNetworkVariable signalTranslatorTrigger; public static LNetworkVariable landDropshipTrigger; public static LNetworkVariable objectCodeTrigger; public static LNetworkVariable signalTranslatorMessage; public static LNetworkVariable objectCode; private string currentMoon = null; private string currentInterior = null; private List useablePersonalities; internal float updateFrequency = 0.02f; private float lockerDistance; private float lockerClosestPoint; private bool lockerReachable; private int itemsToHide = 5; private int calculationDelay = 0; private bool lateGameChoices = false; private bool firstRun = true; private int lastItemErrorHour = 0; private GrabbableObject walkieToGrab = null; private int countOfNullWalkieError = 0; private int timeToPlay = 20; private int currentTime = 0; public float followTime = 1000f; public PlayerControllerB targetedPlayer; private int seenCheckNum = 200; private bool isTerminalEscaping; private bool isLeverEscaping; private float kad = 1f; private bool purchasedStuff = false; private Vector3 maskedHeightValue = new Vector3(0f, 2.4f, 0f); private float MaxTimeBeforeTeleporting = 1f; private EntranceTeleport[] entrancesTeleportArray = null; private EntranceTeleport? selectedEntrance = null; private int mirageAudioClipsPlayedInARow; private int randomMirageAllowedAudioClipsInARow; private bool mirageClipAllowed; private AISearchRoutine idleSearch = null; private Transform idleFarthestNode; private bool idleFarthestNodeSet; private List fakeItems; private GameObject fakeObject; public GrabbableObject fakeItem; private float TimeSinceTeleporting { get; set; } private void TestConfig() { maskedPersonality = Personality.Insane; maskedPersonalityInt.Value = 0; lastMaskedPersonality = Personality.Insane; maskedFocusInt.Value = 8; maskedActivityInt.Value = 0; mustChangeFocus = false; mustChangeActivity = false; SyncTerminalValues(10); } private void CheckForEntrancesNearby() { //IL_0084: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_027e: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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) if ((Object)(object)maskedEnemy == (Object)null) { Plugin.mls.LogError((object)"MaskedEnemy is NULL (CheckForEntrancesNearby)"); mustChangeFocus = true; mustChangeActivity = true; return; } if ((Object)(object)agent == (Object)null) { Plugin.mls.LogError((object)"Agent is NULL (CheckForEntrancesNearby)"); mustChangeFocus = true; mustChangeActivity = true; } TimeSinceTeleporting += updateFrequency; if (!(Vector3.Distance(((Component)agent).transform.position, agent.pathEndPosition) < 5f)) { return; } EntranceTeleport[] array = entrancesTeleportArray; foreach (EntranceTeleport val in array) { if ((Object)(object)val == (Object)null || (Object)(object)val.entrancePoint == (Object)null) { continue; } _ = val.entrancePoint.position; if (false || RoundManagerPatch.invalidEntrances.Contains(val.entranceId)) { continue; } if (Vector3.Distance(((Component)agent).transform.position, val.entrancePoint.position) < 4f) { } if (objectInLOSCheck((EnemyAI)(object)maskedEnemy, ((Component)val).gameObject) != 2 && !(Vector3.Distance(((Component)agent).transform.position, val.entrancePoint.position) < 1f)) { continue; } Vector3 position; if (TimeSinceTeleporting < 3f) { string[] obj = new string[5] { "waiting to use entrance (", val.entranceId.ToString(), "/", null, null }; position = val.entrancePoint.position; obj[3] = ((object)(Vector3)(ref position)).ToString(); obj[4] = ") (less than 3 seconds)"; maskedGoal = string.Concat(obj); break; } Vector3? teleportDestination = getTeleportDestination(val); string[] obj2 = new string[5] { "using entrance (", val.entranceId.ToString(), "/", null, null }; position = val.entrancePoint.position; obj2[3] = ((object)(Vector3)(ref position)).ToString(); obj2[4] = ")"; maskedGoal = string.Concat(obj2); TimeSinceTeleporting = 0f; TeleportMaskedEnemyAndSync(teleportDestination.Value, !((EnemyAI)maskedEnemy).isOutside); ((Component)agent).transform.position = teleportDestination.Value; if ((maskedPersonality != Personality.Deceiving || maskedFocus != Focus.Items) && (maskedPersonality != Personality.Insane || maskedFocus != Focus.Escape)) { mustChangeFocus = true; mustChangeActivity = true; } break; } } private bool delayUpdate() { delayNumber++; if (delayNumber >= delayMax) { delayNumber = 0; return true; } return false; } public void MaskedStatusReport() { //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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) if (!Plugin.DebugMode || stopStatusReporting || !delayUpdate()) { return; } try { string text = "null"; string text2 = "null"; string text3 = "null"; string text4 = "null"; string text5 = "null"; string text6 = "null"; string text7 = "null"; string text8 = "null"; string text9 = "null"; if ((Object)(object)heldGrabbable != (Object)null) { text = ((Object)heldGrabbable).name.ToString(); } if ((Object)(object)closestGrabbable != (Object)null) { text3 = ((Object)closestGrabbable).name.ToString(); text2 = closestGrabbableDistance.Value.ToString(); } if ((Object)(object)breakerBox != (Object)null) { text4 = breakerBoxReachable.Value.ToString(); text5 = breakerBox.isPowerOn.ToString(); } if ((Object)(object)apparatus != (Object)null) { text6 = apparatusReachable.Value.ToString(); text7 = completedApparatusFocus.ToString(); } if (currentMoon != null) { text8 = currentMoon.ToString(); } if (currentInterior != null) { text9 = currentInterior.ToString(); } string text10 = breakerClosestPoint.ToString(); string text11 = terminalClosestPoint.ToString(); string text12 = breakerBoxDistance.ToString(); string text13 = terminalDistance.ToString(); destination = ((EnemyAI)maskedEnemy).destination; distanceToDestination = Vector3.Distance(((Component)agent).transform.position, destination); string text14 = "\n------------ Focus Details ------------"; string text15 = ""; if (maskedFocus == Focus.Items || (maskedFocus == Focus.None && maskedActivity == Activity.RandomItem)) { text15 = text14 + "\nclosestGrabbableReachable = " + closestGrabbableReachable.Value + "\nclosestGrabbable = " + text3; } else if (maskedFocus == Focus.BreakerBox || (maskedFocus == Focus.None && maskedActivity == Activity.BreakerBox)) { text15 = text14 + "\nBreakerBoxReachable = " + text4 + "\nbreakerBox.isPowerOn = " + text5; } else if (maskedFocus == Focus.Terminal) { text15 = text14 + "\nTerminalReachable = " + terminalReachable.Value + "\nisUsingTerminal = " + isUsingTerminal; } else if (maskedActivity == Activity.Apparatus || maskedFocus == Focus.Apparatus) { text15 = text14 + "\nApparatusReachable = " + text6 + "\nThisMaskedSabotagedApparatus? = " + text7; } else if (maskedFocus == Focus.Escape) { text15 = text14 + "\nisTerminalEscaping = " + isTerminalEscaping + "\ntermianlSpecialCodeTime = " + enterTermianlSpecialCodeTime + "\nisLeverEscaping = " + isLeverEscaping; } string text16 = "ReplaceWithDateAndTimeNeverLogThis"; string newValue = hostTimeStamp.Value.ToString("dd/MM/yyyy @ hh:mm:ss"); string text17 = (((NetworkBehaviour)this).IsHost ? "Host" : "Client"); string text18 = "DebugMode...\n===== MaskedStatusReport(" + text17 + ") Start =====\nMaskedID = " + maskedId + "\nHostTimeStamp = " + text16 + "\nMaskedPersonality = " + maskedPersonality.ToString() + "\nMaskedFocus = " + maskedFocus.ToString() + "\nMustChangeFocus = " + mustChangeFocus + "\nMaskedActivity (Focus=None) = " + maskedActivity.ToString() + "\nMustChangeActivity = " + mustChangeActivity + "\nLateGameChoices = " + lateGameChoices + "\nMoon = " + text8 + "\nInterior = " + text9 + "\nisDead = " + ((EnemyAI)maskedEnemy).isEnemyDead + "\n\nisOutside = " + ((EnemyAI)maskedEnemy).isOutside + "\nisInsidePlayerShip = " + ((EnemyAI)maskedEnemy).isInsidePlayerShip + "\nheldGrabbable = " + text + "\nMaskedGoal = " + maskedGoal + "\n\nnoMoreBreakerBox = " + noMoreBreakerBox + "\nnoMoreTerminal = " + noMoreTerminal + "\nnoMoreApparatus = " + noMoreApparatus + "\nnoMoreItems = " + noMoreItems + "\nnotGrabClosestItem = " + notGrabClosestItem + text15 + "\n===== MaskedStatusReport() End ======="; if (text18 != lastDebugModeStatus) { lastDebugModeStatus = text18; string text19 = text18.Replace(text16, newValue); Plugin.mls.LogInfo((object)text19); } if (((EnemyAI)maskedEnemy).isEnemyDead) { Plugin.mls.LogInfo((object)("Masked " + maskedPersonality.ToString() + "(" + maskedId + ") is now dead, status reporting will cease for this masked")); stopStatusReporting = true; } } catch (Exception ex) { Plugin.mls.LogWarning((object)("MaskedStatusReport has failed to write...\n\t" + ex.ToString())); } } private void setupLNAPIvariables(string id) { //IL_002c: 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_0066: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) hostTimeStamp = LNetworkVariable.Connect("hostTimeStamp" + id, DateTime.FromBinary(-1L), (LNetworkVariableWritePerms)0, (Action)null); terminalPosition = LNetworkVariable.Connect("terminalPosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action)null); breakerPosition = LNetworkVariable.Connect("breakerPosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action)null); lockerPosition = LNetworkVariable.Connect("lockerPosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action)null); apparatusPosition = LNetworkVariable.Connect("apparatusPosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action)null); fireExitPosition = LNetworkVariable.Connect("fireExitPosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action)null); mainEntrancePosition = LNetworkVariable.Connect("mainEntrancePosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action)null); currentDestinationDistance = LNetworkVariable.Connect("currentDestinationDistance" + id, -1f, (LNetworkVariableWritePerms)2, (Action)null); maskedTargetId = LNetworkVariable.Connect("maskedTarget" + id, ulong.MaxValue, (LNetworkVariableWritePerms)2, (Action)null); maskedTargetId.OnValueChanged += delegate(ulong oldVal, ulong newVal) { updateTargetPlayer(oldVal, newVal); }; maskedInSpecialAnimation = LNetworkVariable.Connect("maskedInSpecialAnimation" + id, false, (LNetworkVariableWritePerms)2, (Action)null); maskedPersonalityInt = LNetworkVariable.Connect("maskedPersonalityInt" + id, -1, (LNetworkVariableWritePerms)2, (Action)null); maskedFocusInt = LNetworkVariable.Connect("maskedFocusInt" + id, -1, (LNetworkVariableWritePerms)2, (Action)null); maskedActivityInt = LNetworkVariable.Connect("maskedActivityInt" + id, -1, (LNetworkVariableWritePerms)2, (Action)null); isCrouched = LNetworkVariable.Connect("isCrouched" + id, false, (LNetworkVariableWritePerms)2, (Action)null); isDancing = LNetworkVariable.Connect("isDancing" + id, false, (LNetworkVariableWritePerms)2, (Action)null); maxDanceCount = LNetworkVariable.Connect("maxDanceCount" + id, -1, (LNetworkVariableWritePerms)2, (Action)null); isRunning = LNetworkVariable.Connect("isRunning" + id, false, (LNetworkVariableWritePerms)2, (Action)null); isJumped = LNetworkVariable.Connect("isJumped" + id, false, (LNetworkVariableWritePerms)2, (Action)null); isTired = LNetworkVariable.Connect("isTired" + id, false, (LNetworkVariableWritePerms)2, (Action)null); terminalTimeFloat = LNetworkVariable.Connect("terminalTimeFloat" + id, -1f, (LNetworkVariableWritePerms)2, (Action)null); transmitMessageTimer = LNetworkVariable.Connect("transmitMessageTimer" + id, -1f, (LNetworkVariableWritePerms)2, (Action)null); enterTerminalCodeTimer = LNetworkVariable.Connect("enterTerminalCodeTimer" + id, -1f, (LNetworkVariableWritePerms)2, (Action)null); delayMaxTime = LNetworkVariable.Connect("delayMaxTime" + id, -1f, (LNetworkVariableWritePerms)2, (Action)null); useWalkie = LNetworkVariable.Connect("useWalkie" + id, false, (LNetworkVariableWritePerms)2, (Action)null); maskedWalkieId = LNetworkVariable.Connect("MaskedWalkieId" + id, ulong.MaxValue, (LNetworkVariableWritePerms)2, (Action)null); closestGrabbableId = LNetworkVariable.Connect("closestGrabbableId" + id, ulong.MaxValue, (LNetworkVariableWritePerms)2, (Action)null); closestGrabbableDistance = LNetworkVariable.Connect("closestGrabbableDistance" + id, -1f, (LNetworkVariableWritePerms)2, (Action)null); closestGrabbableReachable = LNetworkVariable.Connect("closestGrabbableReachable" + id, false, (LNetworkVariableWritePerms)2, (Action)null); dropItem = LNetworkVariable.Connect("dropItem" + id, false, (LNetworkVariableWritePerms)2, (Action)null); dropItem.OnValueChanged += delegate(bool oldVal, bool newVal) { DropItemsNew(oldVal, newVal); }; terminalReachable = LNetworkVariable.Connect("terminalReachable" + id, false, (LNetworkVariableWritePerms)2, (Action)null); breakerBoxReachable = LNetworkVariable.Connect("breakerBoxReachable" + id, false, (LNetworkVariableWritePerms)2, (Action)null); apparatusReachable = LNetworkVariable.Connect("apparatusReachable" + id, false, (LNetworkVariableWritePerms)2, (Action)null); idleModeVersion = LNetworkVariable.Connect("idleModeVersion" + id, 0, (LNetworkVariableWritePerms)2, (Action)null); appTrigger = LNetworkVariable.Connect("appTrigger" + id, false, (LNetworkVariableWritePerms)0, (Action)null); appTrigger.OnValueChanged += delegate(bool oldVal, bool newVal) { sabotageApparatus(newVal); }; landDropshipTrigger = LNetworkVariable.Connect("landDropshipTrigger" + id, false, (LNetworkVariableWritePerms)0, (Action)null); landDropshipTrigger.OnValueChanged += delegate(bool oldVal, bool newVal) { landDropship(newVal); }; signalTranslatorTrigger = LNetworkVariable.Connect("signalTranslatorTrigger" + id, false, (LNetworkVariableWritePerms)0, (Action)null); signalTranslatorMessage = LNetworkVariable.Connect("signalTranslatorMessage" + id, (string)null, (LNetworkVariableWritePerms)0, (Action)null); signalTranslatorMessage.OnValueChanged += delegate(string oldVal, string newVal) { sendSignalTranslatorMessage(newVal); }; objectCodeTrigger = LNetworkVariable.Connect("objectCodeTrigger" + id, false, (LNetworkVariableWritePerms)0, (Action)null); terminalCode = LNetworkVariable.Connect("terminalCode" + id, (string)null, (LNetworkVariableWritePerms)0, (Action)null); terminalCode.OnValueChanged += delegate(string oldVal, string newVal) { useObjectCode(newVal); }; } private void selectAvailablePersonalities() { useablePersonalities = new List(); if (!Plugin.enableMaskedAggressive && !Plugin.enableMaskedCunning && !Plugin.enableMaskedDeceiving && !Plugin.enableMaskedInsane && !Plugin.enableMaskedStealthy) { Plugin.mls.LogWarning((object)"Bad Config!! - All masked personalities are turned off so turning off whole Masked AI Module."); return; } if (Plugin.enableMaskedAggressive) { useablePersonalities.Add(Personality.Aggressive); } if (Plugin.enableMaskedStealthy) { useablePersonalities.Add(Personality.Stealthy); } if (Plugin.enableMaskedCunning) { useablePersonalities.Add(Personality.Cunning); } if (Plugin.enableMaskedDeceiving) { useablePersonalities.Add(Personality.Deceiving); } if (Plugin.enableMaskedInsane) { useablePersonalities.Add(Personality.Insane); } } public void Start() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Expected O, but got Unknown //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Expected O, but got Unknown //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Expected O, but got Unknown //IL_043e: Expected O, but got Unknown //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Expected O, but got Unknown //IL_048c: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_04f6: Unknown result type (might be due to invalid IL or missing references) maskedId = ((Component)this).gameObject.GetComponent().NetworkObjectId.ToString(); setupLNAPIvariables(maskedId); selectAvailablePersonalities(); if ((Object)(object)RoundManager.Instance.currentLevel == (Object)null) { Plugin.mls.LogDebug((object)("MoonWasNotFound:- " + ((object)RoundManager.Instance.currentLevel).ToString())); return; } if ((Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null) { currentMoon = ((Object)RoundManager.Instance.currentLevel).name; currentInterior = "null"; Plugin.mls.LogDebug((object)("MoonWithoutInteriorFound:- " + currentMoon)); } else { currentMoon = ((Object)RoundManager.Instance.currentLevel).name; currentInterior = ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name.ToString(); Plugin.mls.LogDebug((object)("MoonWithInteriorFound:- " + currentMoon + "(" + currentInterior + ")")); } if ((Object)GameObject.FindGameObjectWithTag("Bush") != (Object)null) { if (bushes != GameObject.FindGameObjectsWithTag("Bush")) { bushes = GameObject.FindGameObjectsWithTag("Bush"); } GameObject[] array = bushes; GameObject[] array2 = array; foreach (GameObject val in array2) { if ((Object)val.GetComponent() == (Object)null) { val.AddComponent(); } } } terminal = Object.FindObjectOfType(); breakerBox = Object.FindObjectOfType(); apparatus = Object.FindObjectOfType(); __instance = (EnemyAI)((Component)this).GetComponent(); maskedEnemy = ((Component)this).GetComponent(); creatureAnimator = ((Component)((Component)this).transform.GetChild(0).GetChild(3)).GetComponent(); itemHolder = new GameObject("LocalItemHolder"); itemHolder.transform.parent = ((Component)__instance).transform.GetChild(0).GetChild(3).GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .GetChild(1) .GetChild(0) .GetChild(0) .GetChild(0); itemHolder.transform.localPosition = new Vector3(-0.002f, 0.036f, -0.042f); itemHolder.transform.localRotation = Quaternion.Euler(-3.616f, -2.302f, 0.145f); LowerTorsoCostumeContainer = new GameObject("LowerTorsoCostumeContainer"); LowerTorsoCostumeContainer.transform.parent = ((Component)__instance).transform.GetChild(0).GetChild(3).GetChild(0); LowerTorsoCostumeContainer.transform.localPosition = Vector3.zero; LowerTorsoCostumeContainer.transform.localRotation = Quaternion.Euler(0f, 0f, 0f); beltBagHolder = new GameObject("lowerTorsoCostumeContainerBeltBagOffset"); beltBagHolder.transform.parent = ((Component)__instance).transform.GetChild(0).GetChild(3).GetChild(0) .GetChild(3); beltBagHolder.transform.localPosition = new Vector3(0.396f, 0.279f, 0.131f); beltBagHolder.transform.localRotation = Quaternion.Euler(10.54f, 260.037f, 47.48f); if (GameNetworkManager.Instance.isHostingGame) { maxDanceCount.Value = Random.Range(2, 4); } if (Plugin.mirageIntegrated) { enableMirageAudio(); } if ((Object)creatureAnimator.runtimeAnimatorController != (Object)Plugin.MaskedAnimController) { creatureAnimator.runtimeAnimatorController = Plugin.MaskedAnimController; } if ((Object)((Component)((Component)__instance).transform.GetChild(3).GetChild(0)).GetComponent().runtimeAnimatorController != (Object)Plugin.MapDotRework) { ((Component)((Component)__instance).transform.GetChild(3).GetChild(0)).GetComponent().runtimeAnimatorController = Plugin.MapDotRework; } dropship = Object.FindObjectOfType(); terminalAccessibleObject = Object.FindObjectsOfType(); entrancesTeleportArray = Object.FindObjectsOfType(false); if (((NetworkBehaviour)this).IsHost) { mainEntrancePosition.Value = maskedEnemy.mainEntrancePosition; } } private void Jump(bool enable) { if (jumpTime > 0f && !isJumped.Value) { jumpTime -= updateFrequency; } if (!isCrouched.Value && !isJumped.Value && jumpTime < 1f && jumpTime > 0.9f) { isJumped.Value = true; creatureAnimator.SetTrigger("FakeJump"); } } private void Dance(bool enabled) { if (enabled) { isDancing.Value = true; __instance.movingTowardsTargetPlayer = false; agent.speed = 0f; } else { isDancing.Value = false; } } private void InvokeAllClientsSynced() { Plugin.mls.LogWarning((object)"InvokeAllClientsSynced"); } private void InvokeOtherClientsSynced() { Plugin.mls.LogWarning((object)"InvokeOtherClientsSynced"); } private void SelectPersonality(int num) { switch (num) { case 0: maskedPersonality = Personality.Aggressive; break; case 1: maskedPersonality = Personality.Cunning; break; case 2: maskedPersonality = Personality.Deceiving; break; case 3: maskedPersonality = Personality.Stealthy; break; case 4: maskedPersonality = Personality.Insane; break; } } private void SyncTerminalValues(int num) { enterTermianlSpecialCodeTime = num; transmitMessageTimer.Value = 0.01f; enterTerminalCodeTimer.Value = 0.01f; terminalTimeFloat.Value = 6f; } private void SyncTermianlInt(int num) { enterTermianlSpecialCodeTime = num; } private void CalculatingVariables() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: 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_0127: 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_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_050d: 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_018b: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) NavMeshPath val = new NavMeshPath(); NavMeshPath val2 = new NavMeshPath(); NavMeshPath val3 = new NavMeshPath(); NavMeshPath val4 = new NavMeshPath(); if (calculationDelay > 0) { calculationDelay--; return; } calculationDelay = 250; if (TimeOfDay.Instance.hour >= 8) { lateGameChoices = true; } if (firstRun || mustChangeFocus || maskedFocus == Focus.Items) { setNearestGrabbable(); } if (firstRun || mustChangeFocus || maskedFocus == Focus.Apparatus || maskedActivity == Activity.Apparatus) { if ((Object)(object)apparatus == (Object)null) { Plugin.mls.LogDebug((object)"Apparatus is Null"); apparatusReachable.Value = false; apparatusDistance = 1000f; noMoreApparatus = true; } else { try { NavMeshHit val5 = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)apparatus).transform.position + -((Component)apparatus).transform.forward, ref val5, 10f, -1)) { if (((NetworkBehaviour)this).IsHost) { apparatusReachable.Value = agent.CalculatePath(((NavMeshHit)(ref val5)).position, val4); } apparatusDistance = Vector3.Distance(((Component)agent).transform.position, ((NavMeshHit)(ref val5)).position); apparatusClosestPoint = Vector3.Distance(((NavMeshHit)(ref val5)).position, ((Component)apparatus).transform.position); apparatusPosition.Value = ((NavMeshHit)(ref val5)).position; } else { apparatusReachable.Value = false; } if (!apparatusReachable.Value) { apparatusDistance = 1000f; } } catch (NullReferenceException ex) { Plugin.mls.LogDebug((object)("Apparatus NullReferenceException() Caught!\n" + ex.Message)); apparatusReachable.Value = false; noMoreApparatus = true; } catch (Exception ex2) { Plugin.mls.LogDebug((object)("Apparatus Exception() Caught!\n" + ex2.Message)); apparatusReachable.Value = false; noMoreApparatus = true; } } } if (firstRun || mustChangeFocus || maskedFocus == Focus.BreakerBox || maskedActivity == Activity.BreakerBox) { if ((Object)(object)breakerBox == (Object)null) { Plugin.mls.LogDebug((object)"BreakerBox is Null"); breakerBoxReachable.Value = false; breakerBoxDistance = 1000f; noMoreBreakerBox = true; } else { try { NavMeshHit val6 = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)breakerBox).transform.position + -((Component)breakerBox).transform.up, ref val6, 10f, -1)) { if (((NetworkBehaviour)this).IsHost) { breakerBoxReachable.Value = agent.CalculatePath(((NavMeshHit)(ref val6)).position, val); } breakerBoxDistance = Vector3.Distance(((Component)agent).transform.position, ((NavMeshHit)(ref val6)).position); breakerClosestPoint = Vector3.Distance(((NavMeshHit)(ref val6)).position, ((Component)breakerBox).transform.position); breakerPosition.Value = ((NavMeshHit)(ref val6)).position; } else { breakerBoxReachable.Value = false; } if (!breakerBoxReachable.Value) { breakerBoxDistance = 1000f; } } catch (NullReferenceException ex3) { Plugin.mls.LogDebug((object)("BreakerBox NullReferenceException() Caught!\n" + ex3.Message)); breakerBoxReachable.Value = false; noMoreBreakerBox = true; } catch (Exception ex4) { Plugin.mls.LogDebug((object)("BreakerBox Exception() Caught!\n" + ex4.Message)); breakerBoxReachable.Value = false; noMoreBreakerBox = true; } } } if (firstRun || mustChangeFocus || maskedFocus == Focus.Terminal || maskedFocus == Focus.Escape) { if ((Object)(object)terminal == (Object)null) { Plugin.mls.LogDebug((object)"Terminal is Null"); terminalReachable.Value = false; terminalDistance = 1000f; noMoreTerminal = true; } else { try { NavMeshHit val7 = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)terminal).transform.position, ref val7, 10f, -1)) { if (((NetworkBehaviour)this).IsHost) { terminalReachable.Value = agent.CalculatePath(((NavMeshHit)(ref val7)).position, val2); } terminalDistance = Vector3.Distance(((Component)agent).transform.position, ((NavMeshHit)(ref val7)).position); terminalClosestPoint = Vector3.Distance(((NavMeshHit)(ref val7)).position, ((Component)terminal).transform.position); terminalPosition.Value = new Vector3(((Component)terminal).transform.position.x, ((Component)terminal).transform.position.y - 1.44f, ((Component)terminal).transform.position.z) - ((Component)terminal).transform.right * 0.8f; } else { terminalReachable.Value = false; } if (!terminalReachable.Value) { terminalDistance = 1000f; } } catch (NullReferenceException ex5) { Plugin.mls.LogDebug((object)("Terminal NullReferenceException() Caught!\n" + ex5.Message)); terminalReachable.Value = false; noMoreTerminal = true; } catch (Exception ex6) { Plugin.mls.LogDebug((object)("Terminal Exception() Caught!\n" + ex6.Message)); terminalReachable.Value = false; noMoreTerminal = true; } } } if (firstRun || mustChangeFocus || maskedActivity == Activity.ItemLocker) { if ((Object)(object)GameObject.Find("LockerAudio") == (Object)null) { Plugin.mls.LogDebug((object)"LockerAudio is Null"); lockerReachable = false; lockerDistance = 1000f; } else { try { lockerPosition.Value = GameObject.Find("LockerAudio").transform.position; } catch (NullReferenceException ex7) { Plugin.mls.LogDebug((object)("Locker NullReferenceException() Caught!\n" + ex7.Message)); lockerReachable = false; } catch (Exception ex8) { Plugin.mls.LogDebug((object)("Locker Exception() Caught!\n" + ex8.Message)); lockerReachable = false; } } } firstRun = false; } private void SetFocus() { if (!GameNetworkManager.Instance.isHostingGame || !mustChangeFocus) { return; } lastMaskedFocus = maskedFocus; if ((Object)(object)__instance.targetPlayer != (Object)null && lastMaskedFocus != Focus.Player) { maskedFocusInt.Value = 1; maskedActivityInt.Value = 0; mustChangeActivity = true; } else if (maskedPersonality == Personality.Cunning && breakerBoxDistance < 40f && lastMaskedFocus != Focus.BreakerBox && breakerBoxReachable.Value && !noMoreBreakerBox) { maskedFocusInt.Value = 4; maskedActivityInt.Value = 0; mustChangeActivity = true; } else if ((maskedPersonality == Personality.Cunning || maskedPersonality == Personality.Deceiving || maskedPersonality == Personality.Insane) && terminalDistance < 40f && lastMaskedFocus != Focus.Terminal && terminalReachable.Value && !noMoreTerminal) { maskedFocusInt.Value = 3; maskedActivityInt.Value = 0; mustChangeActivity = true; } else if ((maskedPersonality == Personality.Cunning || maskedPersonality == Personality.Deceiving || maskedPersonality == Personality.Aggressive) && closestGrabbableDistance.Value < 40f && lastMaskedFocus != Focus.Items && closestGrabbableReachable.Value && !noMoreItems && TimeOfDay.Instance.hour > lastItemErrorHour) { if (maskedPersonality == Personality.Aggressive) { noMoreItems = true; mustChangeFocus = true; mustChangeActivity = true; return; } maskedFocusInt.Value = 2; maskedActivityInt.Value = 0; mustChangeActivity = true; } else if (maskedPersonality == Personality.Stealthy && (Object)(object)__instance.targetPlayer != (Object)null && lastMaskedFocus != Focus.Hiding) { maskedFocusInt.Value = 5; maskedActivityInt.Value = 0; mustChangeActivity = true; } else if (maskedPersonality == Personality.Stealthy && (Object)(object)__instance.targetPlayer != (Object)null && lastMaskedFocus != Focus.Mimicking) { maskedFocusInt.Value = 6; maskedActivityInt.Value = 0; mustChangeActivity = true; } else if (maskedPersonality == Personality.Insane && lastMaskedFocus != Focus.Apparatus && lateGameChoices && !((EnemyAI)maskedEnemy).isOutside && (Object)(object)apparatus != (Object)null) { maskedFocusInt.Value = 7; maskedActivityInt.Value = 0; mustChangeActivity = true; } else if (maskedPersonality == Personality.Insane && lastMaskedFocus != Focus.Escape && lateGameChoices && completedApparatusFocus && ((EnemyAI)maskedEnemy).isOutside) { maskedFocusInt.Value = 8; maskedActivityInt.Value = 0; mustChangeActivity = true; } else { maskedFocusInt.Value = 0; if (mustChangeActivity) { SetActivity(); mustChangeActivity = false; } } mustChangeFocus = false; } private void SetActivity() { if (maskedActivity != Activity.MainEntrance && maskedActivity != Activity.FireExit) { switch (Random.RandomRangeInt(0, 2)) { case 0: maskedActivityInt.Value = 2; break; case 1: maskedActivityInt.Value = 3; break; } } else if (((EnemyAI)maskedEnemy).isOutside) { if (maskedActivity != Activity.ItemLocker) { maskedActivityInt.Value = 4; } else if (maskedActivity != Activity.RandomItem) { maskedActivityInt.Value = 7; } } else if (!((EnemyAI)maskedEnemy).isOutside) { if (maskedActivity != Activity.BreakerBox) { maskedActivityInt.Value = 5; } else if (maskedActivity != Activity.Apparatus) { maskedActivityInt.Value = 6; } else if (maskedActivity != Activity.RandomItem) { maskedActivityInt.Value = 7; } } else { maskedActivityInt.Value = 1; } maskedActivity = (Activity)maskedActivityInt.Value; } private void writeSyncedVariables() { //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) hostTimeStamp.Value = DateTime.Now; currentDestinationDistance.Value = Vector3.Distance(((Component)agent).transform.position, agent.pathEndPosition); if ((Object)(object)((EnemyAI)maskedEnemy).targetPlayer != (Object)null) { maskedTargetId.Value = LethalNetworkExtensions.GetClientId(((EnemyAI)maskedEnemy).targetPlayer); } else { maskedTargetId.Value = ulong.MaxValue; } if ((Object)(object)closestGrabbable != (Object)null) { closestGrabbableId.Value = ((NetworkBehaviour)closestGrabbable).NetworkObjectId; } else { closestGrabbableId.Value = ulong.MaxValue; } } private void readSyncedVariables() { maskedFocus = (Focus)maskedFocusInt.Value; maskedActivity = (Activity)maskedActivityInt.Value; if (closestGrabbableId.Value == ulong.MaxValue) { closestGrabbable = null; return; } foreach (GrabbableObject allitem in GlobalItemList.Instance.allitems) { if (((NetworkBehaviour)allitem).NetworkObjectId == closestGrabbableId.Value) { closestGrabbable = allitem; break; } } } private void LateUpdate() { if (!((Object)(object)agent == (Object)null)) { CalculatingVariables(); readSyncedVariables(); } } public void FixedUpdate() { //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Expected O, but got Unknown //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Expected O, but got Unknown //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Expected O, but got Unknown if ((currentMoon == null || currentInterior == null) && (currentMoon != null || currentInterior != null)) { return; } if (maskedPersonality != 0) { MaskedStatusReport(); } if (((EnemyAI)maskedEnemy).isEnemyDead || StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.shipLeftAutomatically) { maskedGoal = "none (dead or ship is leaving)!"; if ((Object)(object)agent != (Object)null) { ((Behaviour)agent).enabled = false; } if (isHoldingObject) { dropItem.Value = true; } if (isUsingTerminal) { isUsingTerminal = false; Plugin.isTerminalBeingUsed = false; terminal.SetTerminalNoLongerInUse(); terminalAccess(enabled: true); } return; } if (useWalkie.Value) { if ((maskedFocus == Focus.Escape || maskedFocus == Focus.Apparatus) && maskedPersonality == Personality.Insane) { maskedGoal = "insane is ignoring walkie due to its current focus being urgent"; } else { maskedGoal = "use walkie"; GrabWalkie(); HoldWalkie(); useWalkie.Value = false; } } if (GameNetworkManager.Instance.isHostingGame && maskedPersonality == Personality.None) { maskedPersonalityInt.Value = Random.Range(0, useablePersonalities.Count); } if (maskedPersonalityInt.Value == -1) { Plugin.mls.LogDebug((object)"Masked Has No Personality yet (non-hosts should get this once...)"); return; } maskedPersonality = useablePersonalities[maskedPersonalityInt.Value]; if (lastMaskedPersonality != maskedPersonality) { maskedGoal = "selecting new personality"; lastMaskedPersonality = maskedPersonality; if (maskedPersonality == Personality.Deceiving) { SyncTerminalValues(15); } else if (maskedPersonality == Personality.Insane) { SyncTerminalValues(10); } Plugin.mls.LogInfo((object)("Masked '" + maskedId + "' personality changed to '" + maskedPersonality.ToString() + "' (Moon:" + currentMoon + " & Interior:" + currentInterior + ")")); mustChangeFocus = true; mustChangeActivity = true; } if (!((Component)this).TryGetComponent(ref agent)) { agent = ((Component)this).GetComponent(); } if ((((Plugin.wendigosIntegrated || Plugin.skinWalkersIntegrated) && ((NetworkBehaviour)this).IsHost) || Plugin.mirageIntegrated) && (maskedPersonality == Personality.Deceiving || maskedPersonality == Personality.Insane || maskedPersonality == Personality.Stealthy)) { useWalkie.Value = true; } if ((Object)creatureAnimator == (Object)null) { Plugin.mls.LogError((object)"VariableDeclarationClass.Update(): creatureAnimator is null!"); return; } if ((Object)agent == (Object)null) { Plugin.mls.LogError((object)"VariableDeclarationClass.Update(): __agent is null!"); return; } if ((Object)__instance == (Object)null) { Plugin.mls.LogError((object)"VariableDeclarationClass.Update(): __instance is null!"); return; } MovementAnimationSelector(creatureAnimator, maskedEnemy); HeadPositionSelector(creatureAnimator, maskedEnemy); ItemAnimationSelector(creatureAnimator, __instance); if (((NetworkBehaviour)this).IsHost) { writeSyncedVariables(); DetectAndSelectRandomPlayer(); TargetAndKillPlayer(); if (!Elevator.HandleElevators(maskedEnemy, this, currentMoon, currentInterior) && maskedFocus != Focus.Player) { return; } CheckForEntrancesNearby(); SetFocus(); } OnCollideWithPlayer(); if (maskedFocus != 0) { if (maskedPersonality == Personality.Cunning) { maskedGoal = "trying to be cunning..."; MaskedCunning(); return; } if (maskedPersonality == Personality.Deceiving) { maskedGoal = "trying to be deceiving..."; MaskedDeceiving(); return; } if (maskedPersonality == Personality.Aggressive) { maskedGoal = "trying to be aggressive..."; MaskedAggressive(); return; } if (maskedPersonality == Personality.Stealthy) { maskedGoal = "trying to be stealthy..."; MaskedStealthy(); return; } if (maskedPersonality == Personality.Insane) { maskedGoal = "trying to be insane..."; MaskedInsane(); return; } Plugin.mls.LogError((object)"Personality = None???"); Plugin.mls.LogWarning((object)("maskedPersonality = " + maskedPersonality)); Plugin.mls.LogWarning((object)("maskedPersonalityInt.Value" + maskedPersonalityInt.Value)); Plugin.mls.LogWarning((object)"No Personality Found => changing personality!"); foreach (Personality useablePersonality in useablePersonalities) { Plugin.mls.LogWarning((object)(useablePersonality.ToString() + " is available")); } maskedPersonalityInt.Value = Random.Range(0, useablePersonalities.Count); } else if (maskedFocus == Focus.None && maskedActivity != 0) { if (maskedActivity == Activity.ItemLocker) { maskedGoal = "pathing to ship locker"; findLockerAudio(); } else if (maskedActivity == Activity.MainEntrance) { maskedGoal = "pathing to main entrance"; findEntranceTeleports(useMainEntrance: true, useFireExits: false); } else if (maskedActivity == Activity.FireExit) { maskedGoal = "pathing to closest fire exit"; findEntranceTeleports(useMainEntrance: false, useFireExits: true); } else if (maskedActivity == Activity.BreakerBox) { maskedGoal = "pathing to breaker box"; findBreakerBox(); } else if (maskedActivity == Activity.Apparatus) { maskedGoal = "finding Apparatus"; findApparatus(); } else if (maskedActivity == Activity.RandomItem) { maskedGoal = "finding RandomItem"; findRandomItem(); } else if (maskedActivity == Activity.Idle) { maskedGoal = "being idle, wandering until a player is targeted"; idleMode(); } } } public void LookAtPos(Vector3 pos, float lookAtTime = 1f, bool needsToSeePosition = true) { //IL_0023: 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_0061: 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_008f: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0137: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) maskedGoal = "Looking at Position for " + lookAtTime + "f"; if (__instance.CheckLineOfSightForPosition(pos, 80f, 60, -1f, (Transform)null) || !needsToSeePosition) { maskedEnemy.focusOnPosition = new Vector3(pos.x, pos.y - 1f, pos.z); maskedEnemy.lookAtPositionTimer = lookAtTime; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Component)((EnemyAI)maskedEnemy).eye).transform.position.x, 0f, ((Component)((EnemyAI)maskedEnemy).eye).transform.position.z); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(pos.x, 0f, pos.z); float num = Vector3.Distance(val, val2); if (num < 1f) { num = 1f; } float num2 = Vector3.Angle(((Component)((EnemyAI)maskedEnemy).eye).transform.forward, pos - ((Component)((EnemyAI)maskedEnemy).eye).transform.position); float num3 = 2f * num; if (pos.y - maskedEnemy.headTiltTarget.position.y < 0f) { num2 /= 0f - num3; } else if (pos.y - maskedEnemy.headTiltTarget.position.y > 0f) { num2 /= num3; } maskedEnemy.verticalLookAngle = 0f - (num2 - 2f); } } private void setNearestGrabbable() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_009f: 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_0140: 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_0183: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsHost || (Object)(object)agent == (Object)null) { return; } NavMeshPath val = new NavMeshPath(); float num = float.PositiveInfinity; List allitems = GlobalItemList.Instance.allitems; if (allitems.Count == 0) { Plugin.mls.LogDebug((object)"allItemsList is empty so setting no more items=true"); noMoreItems = true; mustChangeFocus = true; } NavMeshHit val2 = default(NavMeshHit); foreach (GrabbableObject item in allitems) { if ((Object)(object)this == (Object)null) { break; } _ = ((Component)this).transform.position; if (false) { break; } if ((Object)(object)item == (Object)null) { continue; } _ = ((Component)item).transform.position; if (false || ((Object)item).name == "ClipboardManual" || ((Object)item).name == "StickyNoteItem" || ((Object)item).name == "RedLocustHive" || (maskedPersonality == Personality.Cunning && Vector3.Distance(((Component)item).transform.position, ((Component)terminal).transform.position) >= 15f) || (maskedPersonality == Personality.Deceiving && Vector3.Distance(((Component)item).transform.position, ((Component)terminal).transform.position) <= 30f)) { continue; } float num2 = Vector3.Distance(((Component)agent).transform.position, ((Component)item).transform.position); if ((Object)(object)((Component)item).GetComponent() != (Object)null) { itemSystem = ((Component)item).GetComponent(); } if (!itemSystem.hidedByMasked && agent.CalculatePath(((Component)item).transform.position, val) && num2 < num && num2 <= 30f && !item.isHeld && !item.isHeldByEnemy && !notGrabClosestItem) { num = num2; closestGrabbable = item; if (NavMesh.SamplePosition(((Component)closestGrabbable).transform.position, ref val2, 10f, -1)) { closestGrabbableReachable.Value = agent.CalculatePath(((Component)closestGrabbable).transform.position, val); closestGrabbableDistance.Value = Vector3.Distance(((Component)agent).transform.position, ((Component)closestGrabbable).transform.position); } else { closestGrabbableReachable.Value = false; closestGrabbableDistance.Value = 1000f; } } } } private void DetectAndSelectRandomPlayer() { if ((Object)(object)targetedPlayer != (Object)null) { return; } PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)maskedEnemy).GetAllPlayersInLineOfSight(80f, 60, (Transform)null, -1f, -1); if (allPlayersInLineOfSight == null || maskedFocus == Focus.Player || (maskedFocus == Focus.None && maskedActivity == Activity.RandomPlayer) || ((EnemyAI)maskedEnemy).inSpecialAnimation || allPlayersInLineOfSight.Length == 0) { return; } maskedGoal = "Detecting Players"; int num = 0; if (maskedPersonality == Personality.Cunning) { num = allPlayersInLineOfSight.Length; } else if (maskedPersonality == Personality.Deceiving) { num = allPlayersInLineOfSight.Length * 2; } else if (maskedPersonality == Personality.Stealthy) { num = allPlayersInLineOfSight.Length * 4; } else if (maskedPersonality == Personality.Insane) { num = 2; } else if (maskedPersonality == Personality.Aggressive) { num = 1; } int num2 = Random.RandomRangeInt(0, allPlayersInLineOfSight.Length + num); if (num2 < allPlayersInLineOfSight.Length) { mustChangeActivity = false; mustChangeFocus = false; maskedFocus = Focus.Player; maskedActivity = Activity.None; mustChangeActivity = false; mustChangeFocus = false; if ((Object)(object)__instance.targetPlayer == (Object)null) { __instance.targetPlayer = allPlayersInLineOfSight[num2]; } } } public void DetectEnemy() { //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_008a: Unknown result type (might be due to invalid IL or missing references) maskedGoal = "detectEnemy"; foreach (GrabbableObject allitem in GlobalItemList.Instance.allitems) { float num = Vector3.Distance(((Component)agent).transform.position, ((Component)allitem).transform.position); if (num < float.PositiveInfinity && num <= 10f && ((NetworkBehaviour)this).IsHost) { if (num > 0.5f) { __instance.SetDestinationToPosition(((Component)closestGrabbable).transform.position, true); __instance.moveTowardsDestination = true; __instance.movingTowardsTargetPlayer = false; } else { maskedFocusInt.Value = 0; maskedActivityInt.Value = 2; __instance.moveTowardsDestination = false; } } } } public void ManuelGrabItem(GrabbableObject item) { //IL_0027: 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_0058: 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_0078: 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_0093: 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) maskedGoal = "manuelGrabItem"; if (isHoldingObject) { return; } float num = Vector3.Distance(((Component)agent).transform.position, ((Component)item).transform.position); if (num < 0.9f) { float num2 = Vector3.Angle(((Component)__instance).transform.forward, ((Component)closestGrabbable).transform.position - ((Component)__instance).transform.position); if (((Component)closestGrabbable).transform.position.y - maskedEnemy.headTiltTarget.position.y < 0f) { num2 *= -1f; } maskedEnemy.verticalLookAngle = num2; item.parentObject = itemHolder.transform; item.hasHitGround = false; item.isHeld = true; item.isHeldByEnemy = true; item.grabbable = false; isHoldingObject = true; itemDroped = false; item.GrabItemFromEnemy(__instance); } if (num < 4f && !isHoldingObject && maskedPersonality != Personality.Aggressive && ((NetworkBehaviour)this).IsHost) { isCrouched.Value = true; } } public void ForceGrabCustomItem(GrabbableObject item) { //IL_0017: 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_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_0052: 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) maskedGoal = "forcegrabcustomitem"; float num = Vector3.Angle(((Component)__instance).transform.forward, ((Component)closestGrabbable).transform.position - ((Component)__instance).transform.position); if (((Component)closestGrabbable).transform.position.y - maskedEnemy.headTiltTarget.position.y < 0f) { num *= -1f; } maskedEnemy.verticalLookAngle = num; item.parentObject = itemHolder.transform; item.hasHitGround = false; item.isHeld = true; item.isHeldByEnemy = true; item.grabbable = false; isHoldingObject = true; itemDroped = false; item.GrabItemFromEnemy(__instance); } public void HeadPositionSelector(Animator creatureAnimator, MaskedPlayerEnemy maskedEnemy) { //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_004b: 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) if (maskedEnemy.stopAndStareTimer == 0f && maskedEnemy.lookAtPositionTimer == 0f) { LookAtPos(new Vector3(((Component)this).transform.forward.x, ((Component)this).transform.forward.y, ((Component)this).transform.forward.z)); } } public void MovementAnimationSelector(Animator creatureAnimator, MaskedPlayerEnemy maskedEnemy) { //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) if (isCrouched.Value) { isDancing.Value = false; creatureAnimator.ResetTrigger("Dancing"); isRunning.Value = false; maskedEnemy.running = false; creatureAnimator.ResetTrigger("Running"); creatureAnimator.SetTrigger("Crouching"); agent.speed = 1.9f; } else if (isRunning.Value) { if (!isStaminaDowned) { isCrouched.Value = false; creatureAnimator.ResetTrigger("Crouching"); isDancing.Value = false; creatureAnimator.ResetTrigger("Dancing"); maskedEnemy.running = true; creatureAnimator.SetTrigger("Running"); maskedEnemy.staminaTimer -= updateFrequency * 0.05f; agent.speed = 7f; } } else if (isDancing.Value) { isCrouched.Value = false; creatureAnimator.ResetTrigger("Crouching"); maskedEnemy.running = false; isRunning.Value = false; creatureAnimator.ResetTrigger("Running"); creatureAnimator.SetTrigger("Dancing"); if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(((Component)__instance).transform.position, false); } agent.speed = 0f; Plugin.mls.LogInfo((object)"Dancing"); } else { isCrouched.Value = false; creatureAnimator.ResetTrigger("Crouching"); isDancing.Value = false; creatureAnimator.ResetTrigger("Dancing"); maskedEnemy.running = false; isRunning.Value = false; creatureAnimator.ResetTrigger("Running"); agent.speed = 3.8f; } if (isTired.Value) { ((EnemyAI)maskedEnemy).creatureAnimator.SetTrigger("Tired"); } else { ((EnemyAI)maskedEnemy).creatureAnimator.ResetTrigger("Tired"); } if (maskedEnemy.staminaTimer >= 2f && !isStaminaDowned) { if (!isJumped.Value) { isJumped.Value = true; } else { creatureAnimator.ResetTrigger("FakeJump"); } maskedEnemy.running = true; isRunning.Value = true; } if (maskedEnemy.staminaTimer < 0f && !isStaminaDowned) { isStaminaDowned = true; maskedEnemy.staminaTimer = -1.5f; maskedEnemy.running = false; isRunning.Value = false; isTired.Value = true; } if (isStaminaDowned) { maskedEnemy.staminaTimer += updateFrequency * 0.2f; if (maskedEnemy.staminaTimer > 6f) { isStaminaDowned = false; } if (maskedEnemy.staminaTimer > 1f) { isTired.Value = false; } } if ((Object)(object)__instance.targetPlayer != (Object)null) { LookAtPos(((Component)__instance.targetPlayer.playerEye).transform.position - __instance.targetPlayer.playerEye.forward, 0.5f); } } public void ItemAnimationSelector(Animator creatureAnimator, EnemyAI __instance) { //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) if (isHoldingObject) { upperBodyAnimationsWeight = Mathf.Lerp(upperBodyAnimationsWeight, 0.9f, 25f * updateFrequency); creatureAnimator.SetLayerWeight(creatureAnimator.GetLayerIndex("Item"), upperBodyAnimationsWeight); } else { upperBodyAnimationsWeight = Mathf.Lerp(upperBodyAnimationsWeight, 0f, 25f * updateFrequency); creatureAnimator.SetLayerWeight(creatureAnimator.GetLayerIndex("Item"), upperBodyAnimationsWeight); } string text = ""; if (isHoldingObject) { if ((Object)(object)heldGrabbable == (Object)null) { return; } if ((Object)(object)heldGrabbable.itemProperties == (Object)null) { Plugin.mls.LogError((object)("ItemAnimationSelector: " + ((Object)heldGrabbable).name + "'s ItemProperties are Null")); return; } switch ((heldGrabbable.itemProperties.grabAnim != null) ? heldGrabbable.itemProperties.grabAnim : "") { case "Grab": case "HoldKnife": case "HoldPatcherTool": itemHolder.transform.localPosition = new Vector3(0.002f, 0.056f, -0.046f); itemHolder.transform.localRotation = Quaternion.Euler(352.996f, 0f, 356.89f); creatureAnimator.SetTrigger("HoldOneItem"); break; case "HoldLung": itemHolder.transform.localPosition = new Vector3(-0.1799f, -0.1014f, -0.5119f); itemHolder.transform.localRotation = Quaternion.Euler(314.149f, 13.06f, 305.192f); creatureAnimator.SetTrigger("HoldLung"); break; case "HoldShotgun": itemHolder.transform.localPosition = new Vector3(0.0402f, -0.048f, 0.0104f); itemHolder.transform.localRotation = Quaternion.Euler(340.836f, 22.626f, 2.104f); creatureAnimator.SetTrigger("HoldShotgun"); break; case "HoldJetpack": itemHolder.transform.localPosition = new Vector3(-0.107f, -0.078f, -0.232f); itemHolder.transform.localRotation = Quaternion.Euler(305.184f, 210.613f, 84.047f); creatureAnimator.SetTrigger("HoldJetpack"); break; case "HoldForward": itemHolder.transform.localPosition = new Vector3(-0.1453f, -0.0898f, -0.4686f); itemHolder.transform.localRotation = Quaternion.Euler(314.149f, 13.06f, 305.192f); creatureAnimator.SetTrigger("HoldBeltbag"); doSpecialPocketingTasks(heldGrabbable); break; case "GrabClipboard": itemHolder.transform.localPosition = new Vector3(0.007f, 0.138f, -0.066f); itemHolder.transform.localRotation = Quaternion.Euler(15.577f, 358.759f, 356.795f); creatureAnimator.SetTrigger("HoldClipboard"); break; default: Plugin.mls.LogError((object)("GrabAnimation not found for item: " + ((Object)heldGrabbable).name.ToString() + "(Animation: " + heldGrabbable.itemProperties.grabAnim.ToString() + ")")); break; } } else { creatureAnimator.ResetTrigger("HoldOneItem"); creatureAnimator.ResetTrigger("HoldLung"); creatureAnimator.ResetTrigger("HoldShotgun"); creatureAnimator.ResetTrigger("HoldJetpack"); creatureAnimator.ResetTrigger("HoldBeltbag"); creatureAnimator.ResetTrigger("HoldClipboard"); itemHolder.transform.localPosition = new Vector3(0.002f, 0.0563f, -0.0456f); itemHolder.transform.localRotation = Quaternion.Euler(359.9778f, -0.0006f, 359.9901f); } } public void CheckPathRotating(NavMeshAgent agent, EnemyAI __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0064: 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_006b: 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_00be: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: 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_010f: 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_011b: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: 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) maskedGoal = "checkpathrotating"; if (!((NetworkBehaviour)this).IsHost) { return; } NavMeshPath val = new NavMeshPath(); int num = 1; if (agent.pathPending) { return; } Vector3 val2; if (agent.remainingDistance < agent.stoppingDistance) { if (!agent.hasPath) { return; } Vector3 velocity = agent.velocity; val2 = velocity; if (((Vector3)(ref val2)).sqrMagnitude == 0f) { return; } } if (num >= agent.path.corners.Length || !((NetworkBehaviour)this).IsHost) { return; } Vector3 val3 = agent.path.corners[num] - ((Component)agent).transform.position; if (num + 1 < agent.path.corners.Length) { Vector3 val4 = agent.path.corners[num + 1] - agent.path.corners[num]; float num2 = Vector3.Angle(val3, val4); if (num2 > 30f) { rotationTimer += updateFrequency; if (rotationTimer > 0f && rotationTimer < 0.5f) { if (angle1 == 0f) { angle1 = ((Component)__instance).transform.localEulerAngles.y + 10f; } Plugin.mls.LogInfo((object)("angle1: " + angle1)); ((Component)__instance).transform.localEulerAngles = new Vector3(((Component)__instance).transform.localEulerAngles.x, angle1, ((Component)__instance).transform.localEulerAngles.z); } else if ((double)rotationTimer > 0.5 && rotationTimer < 1.1f) { if (angle2 == 0f) { angle1 = ((Component)__instance).transform.localEulerAngles.y - 5f; } Plugin.mls.LogInfo((object)("angle2: " + angle2)); ((Component)__instance).transform.localEulerAngles = new Vector3(((Component)__instance).transform.localEulerAngles.x, angle1, ((Component)__instance).transform.localEulerAngles.z); } Plugin.mls.LogWarning((object)"Soon to rotate more than 30 degrees"); } else { rotationTimer = 0f; angle1 = 0f; angle2 = 0f; } } val2 = val3; if (((Vector3)(ref val2)).magnitude <= agent.stoppingDistance) { Plugin.mls.LogWarning((object)"Almost reached corner, increase index to check next corner"); num++; } } private void GrabWalkie() { //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0389: 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) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsHost) { if (isHoldingObject || maskedFocus != 0 || (StartOfRound.Instance.allPlayerScripts.Count() < 2 && Plugin.skinWalkersIntegrated)) { return; } List allWalkieTalkies = GlobalItemList.Instance.allWalkieTalkies; if (allWalkieTalkies.Count < 2) { return; } if ((Object)(object)walkieToGrab == (Object)null) { foreach (WalkieTalkie item in allWalkieTalkies) { if ((Object)(object)item == (Object)null) { if (countOfNullWalkieError < 1) { countOfNullWalkieError++; Plugin.mls.LogWarning((object)"walkie is Null (GrabWalkie) - dont worry about this, its usually happening because the walkie is not on the navmesh"); } continue; } if ((Object)(object)((Component)item).transform == (Object)null) { Plugin.mls.LogError((object)"walkie.transform is Null (GrabWalkie)"); continue; } _ = ((Component)item).transform.position; if (false) { Plugin.mls.LogError((object)"walkie.transform.position is Null (GrabWalkie)"); } else if (__instance.CheckLineOfSightForPosition(((Component)item).transform.position, 60f, 60, -1f, (Transform)null) && !((GrabbableObject)item).isHeld && !((GrabbableObject)item).isHeldByEnemy) { maskedGoal = "spotted walkie talkie, going to go pick it up"; walkieToGrab = (GrabbableObject)(object)item; if ((Object)(object)walkieToGrab != (Object)null) { maskedWalkieId.Value = ((NetworkBehaviour)walkieToGrab).NetworkObjectId; } else { maskedWalkieId.Value = ulong.MaxValue; } maskedFocusInt.Value = 0; maskedActivityInt.Value = 9; break; } } } } else if (maskedWalkieId.Value == ulong.MaxValue) { walkieToGrab = null; } else { foreach (GrabbableObject allitem in GlobalItemList.Instance.allitems) { if (((NetworkBehaviour)allitem).NetworkObjectId == maskedWalkieId.Value) { walkieToGrab = allitem; break; } } } if ((Object)(object)agent == (Object)null || (Object)(object)walkieToGrab == (Object)null) { return; } if (walkieToGrab.isHeld || walkieToGrab.isHeldByEnemy) { walkieToGrab = null; isCrouched.Value = false; mustChangeFocus = true; mustChangeActivity = true; return; } float num = Vector3.Distance(((Component)agent).transform.position, ((Component)walkieToGrab).transform.position); if (num < 1f && !isHoldingObject) { isCrouched.Value = true; } if (num > 0.5f) { Vector3 position = ((Component)walkieToGrab).transform.position; maskedGoal = "walkiing to selected walkie @ " + ((object)(Vector3)(ref position)).ToString(); if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(((Component)walkieToGrab).transform.position, true); __instance.moveTowardsDestination = true; __instance.movingTowardsTargetPlayer = false; } } if (num > 0.5f && num < 3f) { maskedEnemy.focusOnPosition = ((Component)walkieToGrab).transform.position; maskedEnemy.lookAtPositionTimer = 1.5f; } if (num < 0.9f && !isHoldingObject) { float num2 = Vector3.Angle(((Component)__instance).transform.forward, ((Component)walkieToGrab).transform.position - ((Component)__instance).transform.position); if (((Component)walkieToGrab).transform.position.y - maskedEnemy.headTiltTarget.position.y < 0f) { num2 *= -1f; } maskedEnemy.verticalLookAngle = num2; heldGrabbable = walkieToGrab; walkieToGrab.parentObject = itemHolder.transform; walkieToGrab.hasHitGround = false; walkieToGrab.isHeld = true; walkieToGrab.isHeldByEnemy = true; walkieToGrab.grabbable = false; isHoldingObject = true; itemDroped = false; walkieToGrab.GrabItemFromEnemy(__instance); if (isHoldingObject) { walkieToGrab = null; isCrouched.Value = false; mustChangeFocus = true; mustChangeActivity = true; } } } private void HoldWalkie() { maskedGoal = "holdwalkie"; if ((Plugin.wendigosIntegrated || Plugin.skinWalkersIntegrated) && isHoldingObject && heldGrabbable is WalkieTalkie) { WalkieTalkie component = ((Component)heldGrabbable).GetComponent(); walkieCooldown += updateFrequency; if (walkieCooldown < 1f) { creatureAnimator.ResetTrigger("UseWalkie"); walkieUsed = false; walkieVoiceTransmitted = false; walkieTimer = 0f; } else if (walkieCooldown < 4f && walkieCooldown > 3f && !((GrabbableObject)component).isBeingUsed) { ((GrabbableObject)component).isBeingUsed = true; } if (walkieCooldown > 10f) { UseWalkie(); } } } private AudioClip wendigosClip() { List list = Plugin.audioClips[maskedEnemy.mimickingPlayer.playerClientId]; int count = list.Count; int index = Random.RandomRangeInt(0, count); return list[index]; } private bool wendigosTimer() { if (currentTime >= timeToPlay) { currentTime = 0; return true; } currentTime++; return false; } public void UseWalkie() { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_017e: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown //IL_0294: Expected O, but got Unknown maskedGoal = "usewalkie"; if ((!Plugin.wendigosIntegrated && !Plugin.skinWalkersIntegrated) || !isHoldingObject || !(heldGrabbable is WalkieTalkie)) { return; } walkieTimer += updateFrequency; WalkieTalkie component = ((Component)heldGrabbable).GetComponent(); if (walkieTimer > 1f && !walkieUsed) { if (!((GrabbableObject)component).isBeingUsed) { ((GrabbableObject)component).isBeingUsed = true; component.EnableWalkieTalkieListening(true); ((Renderer)((GrabbableObject)component).mainObjectRenderer).sharedMaterial = component.onMaterial; ((Behaviour)component.walkieTalkieLight).enabled = true; component.thisAudio.PlayOneShot(component.switchWalkieTalkiePowerOn); } walkieUsed = true; } if (walkieTimer > 1.5f && !walkieVoiceTransmitted) { Plugin.mls.LogInfo((object)"Walkie Voice Transmitted!"); foreach (WalkieTalkie allWalkieTalky in GlobalItemList.Instance.allWalkieTalkies) { if (((GrabbableObject)allWalkieTalky).isBeingUsed) { allWalkieTalky.thisAudio.PlayOneShot(allWalkieTalky.startTransmissionSFX[Random.Range(0, allWalkieTalky.startTransmissionSFX.Length + 1)]); } if ((Object)((Component)heldGrabbable).gameObject != (Object)((Component)allWalkieTalky).gameObject && ((GrabbableObject)allWalkieTalky).isBeingUsed) { if (Plugin.skinWalkersIntegrated) { playSkinwalkersAudio(allWalkieTalky); } else if (Plugin.wendigosIntegrated) { allWalkieTalky.target.PlayOneShot(wendigosClip()); } } } creatureAnimator.SetTrigger("UseWalkie"); walkieVoiceTransmitted = true; } if (!(walkieTimer > 5f)) { return; } foreach (WalkieTalkie allWalkieTalky2 in GlobalItemList.Instance.allWalkieTalkies) { if (((GrabbableObject)allWalkieTalky2).isBeingUsed) { allWalkieTalky2.thisAudio.PlayOneShot(allWalkieTalky2.stopTransmissionSFX[Random.Range(0, allWalkieTalky2.stopTransmissionSFX.Length + 1)]); } if ((Object)((Component)heldGrabbable).gameObject == (Object)((Component)allWalkieTalky2).gameObject && ((GrabbableObject)allWalkieTalky2).isBeingUsed) { ((GrabbableObject)component).isBeingUsed = false; component.EnableWalkieTalkieListening(false); ((Renderer)((GrabbableObject)component).mainObjectRenderer).sharedMaterial = component.offMaterial; ((Behaviour)component.walkieTalkieLight).enabled = false; component.thisAudio.PlayOneShot(component.switchWalkieTalkiePowerOff); } } creatureAnimator.ResetTrigger("UseWalkie"); walkieCooldown = 0f; walkieTimer = 0f; } private void playSkinwalkersAudio(WalkieTalkie walkie) { walkie.target.PlayOneShot(SkinwalkerModPersistent.Instance.GetSample()); } public void AwayFromPlayer() { //IL_0031: 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_0072: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00e2: 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_00e9: 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) //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_0104: 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_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0127: 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_01f4: 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) maskedGoal = "awayfromplayer() method"; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; PlayerControllerB[] array = allPlayerScripts; foreach (PlayerControllerB val in array) { float num = Vector3.Distance(((Component)__instance).transform.position, ((Component)val).transform.position); if (!(num < float.PositiveInfinity)) { continue; } nearestPlayer = val; float num2 = Vector3.Distance(((Component)agent).transform.position, ((Component)val).transform.position); if (num2 < 4f && (Object)__instance.targetPlayer != (Object)null) { Vector3 val2 = ((Component)agent).transform.position - ((Component)val).transform.position; Vector3 position = ((Component)agent).transform.position; Vector3 val3 = val2; Vector3 val4 = position + ((Vector3)(ref val3)).normalized * 5f; if (originDestination != agent.destination) { originDestination = agent.destination; } if (Vector3.Distance(originDestination, agent.destination) < 1.5f) { originTimer += updateFrequency; } if (originTimer > 3.5f) { if (__instance.isOutside) { if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(maskedEnemy.shipHidingSpot, true); } } else { maskedFocusInt.Value = 0; maskedActivityInt.Value = 2; } originTimer = 0f; } if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(val4, true); } } else if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(originDestination, true); } } } public void PlayerLikeAction() { //IL_000c: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_005b: 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_0070: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_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_009f: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00c4: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)agent).transform.position, ((Component)nearestPlayer).transform.position); if (num < 4f && (Object)__instance.targetPlayer != (Object)null) { Vector3 val = ((Component)agent).transform.position - ((Component)nearestPlayer).transform.position; Vector3 position = ((Component)agent).transform.position; Vector3 val2 = val; Vector3 val3 = position + ((Vector3)(ref val2)).normalized * 5f; if (originDestination != agent.destination) { originDestination = agent.destination; } if (Vector3.Distance(originDestination, agent.destination) < 1.5f) { originTimer += updateFrequency; } if (originTimer > 3.5f) { if (__instance.isOutside) { if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(maskedEnemy.shipHidingSpot, true); } } else { maskedFocusInt.Value = 0; maskedActivityInt.Value = 2; } originTimer = 0f; } if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(val3, true); } } else if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(originDestination, true); } } public void MaskedCunning() { //IL_0125: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)breakerBox != (Object)null && breakerBox.isPowerOn) { noMoreBreakerBox = false; } Vector3 val; if (maskedFocus == Focus.Terminal) { if (!noMoreTerminal && Plugin.useTerminal) { UsingTerminal(); } else { mustChangeFocus = true; } } else if (maskedFocus == Focus.BreakerBox) { if (seenCheckNum <= 0) { Plugin.mls.LogWarning((object)"BreakerBox was seen, but could not be reached! Not Critical, but please report this!"); mustChangeFocus = true; mustChangeActivity = true; noMoreBreakerBox = true; } if (breakerBoxDistance < 15f && breakerBoxDistance > 3.5f && Plugin.isBreakerBoxBeingUsed) { Plugin.mls.LogDebug((object)"BreakerBox is being used by another entity"); noMoreBreakerBox = true; mustChangeFocus = true; mustChangeActivity = true; } else if (!noMoreBreakerBox) { breakerBoxDistance = Vector3.Distance(((Component)agent).transform.position, breakerPosition.Value); if (!(breakerBoxDistance < 40f) && !noMoreTerminal) { return; } val = breakerPosition.Value; maskedGoal = "walking to breaker box (" + ((object)(Vector3)(ref val)).ToString() + ")"; if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)maskedEnemy).SetDestinationToPosition(breakerPosition.Value, false); ((EnemyAI)maskedEnemy).moveTowardsDestination = true; } if (breakerBoxDistance < 0.5f && !isUsingBreakerBox) { Plugin.isBreakerBoxBeingUsed = true; maskedGoal = "using breaker box"; maskedEnemy.LookAtFocusedPosition(); isUsingBreakerBox = true; creatureAnimator.ResetTrigger("Crouching"); isCrouched.Value = false; agent.speed = 0f; creatureAnimator.ResetTrigger("IsMoving"); if (breakerBox.isPowerOn) { breakerBoxSwitchLogic(breakerBoxDistance, on: false); } else { breakerBoxSwitchLogic(breakerBoxDistance, on: true); } Plugin.isBreakerBoxBeingUsed = false; } } else { mustChangeFocus = true; } } else if (maskedFocus == Focus.Items) { if (!noMoreItems) { if (itemsToHide == 0) { maskedGoal = "changing focus as we have stolen enough items"; noMoreItems = true; mustChangeFocus = true; return; } if (!isHoldingObject) { setNearestGrabbable(); if ((Object)(object)closestGrabbable == (Object)null || !closestGrabbableReachable.Value) { maskedGoal = "cant find any grabbable items, switching focus"; lastItemErrorHour = TimeOfDay.Instance.hour; mustChangeFocus = true; } else { maskedGoal = "grabbing item from inside ship"; PickupItem(); } return; } isCrouched.Value = false; if (!isHoldingObject || !((EnemyAI)maskedEnemy).isOutside || !((NetworkBehaviour)this).IsHost || bushes == null) { if (isHoldingObject && ((EnemyAI)maskedEnemy).isOutside && bushes == null) { Plugin.mls.LogDebug((object)"Masked Cunning cannot find any bushes on this moon!"); noMoreItems = true; mustChangeFocus = true; } return; } GameObject[] array = bushes; array.ToList().RemoveAll((GameObject bush) => bush.GetComponent().bushWithItem); if (array.Length == 0) { Plugin.mls.LogDebug((object)"all bushes have an item, dropping item and changing focus"); dropItem.Value = true; noMoreItems = true; mustChangeFocus = true; } GameObject[] array2 = array; foreach (GameObject val2 in array2) { bushDistance = Vector3.Distance(((Component)__instance).transform.position, val2.transform.position); if (!(bushDistance < float.PositiveInfinity) || val2.GetComponent().bushWithItem) { continue; } if (bushDistance > 2f && bushDistance < float.PositiveInfinity && !val2.GetComponent().bushWithItem) { val = val2.transform.position; maskedGoal = "walking to bush (" + ((object)(Vector3)(ref val)).ToString() + ")"; if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)maskedEnemy).SetDestinationToPosition(val2.transform.position, true); } moveSpecial = true; } if (bushDistance < 2f) { val = val2.transform.position; maskedGoal = "hiding item in bush (" + ((object)(Vector3)(ref val)).ToString() + ")"; Plugin.mls.LogDebug((object)"Cunning Is Hiding an Item"); itemSystem.hidedByMasked = true; dropItem.Value = true; itemsToHide--; mustChangeFocus = true; val2.GetComponent().bushWithItem = true; } } } else { mustChangeFocus = true; } } else if (maskedFocus == Focus.Player) { focusingOnPlayer(); } } public void MaskedDeceiving() { //IL_0119: 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_0164: Unknown result type (might be due to invalid IL or missing references) if (maskedFocus == Focus.Terminal) { if (!noMoreTerminal && Plugin.useTerminal) { UsingTerminal(); } else { mustChangeFocus = true; } } else if (maskedFocus == Focus.Items) { if (!noMoreItems) { if (!isHoldingObject) { setNearestGrabbable(); if ((Object)(object)closestGrabbable == (Object)null || !closestGrabbableReachable.Value) { maskedGoal = "cant find any grabbable items, switching focus"; lastItemErrorHour = TimeOfDay.Instance.hour; mustChangeFocus = true; } else { maskedGoal = "grabbing nearest item outside of the ship"; PickupItem(); } return; } isCrouched.Value = false; if (!((EnemyAI)maskedEnemy).isOutside) { findEntranceTeleports(useMainEntrance: true, useFireExits: true); return; } float num = Vector3.Distance(((Component)agent).transform.position, terminalPosition.Value); if (num > 6f) { maskedGoal = "heading to player ship to drop an item"; if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)maskedEnemy).SetDestinationToPosition(terminalPosition.Value, false); } } else if (num < 6f && ((EnemyAI)maskedEnemy).isInsidePlayerShip) { maskedGoal = "dropping item in player ship"; dropItem.Value = true; mustChangeFocus = true; mustChangeActivity = true; } } else { mustChangeFocus = true; } } else if (maskedFocus == Focus.Player) { focusingOnPlayer(); } } public void MaskedStealthy() { if (maskedFocus == Focus.Hiding) { if (((NetworkBehaviour)this).IsHost) { maskedGoal = "going AwayFromPlayer()"; AwayFromPlayer(); } } else if (maskedFocus == Focus.Mimicking) { if (((NetworkBehaviour)this).IsHost) { maskedGoal = "doing PlayerLikeAction()"; PlayerLikeAction(); } } else if (maskedFocus == Focus.Player) { focusingOnPlayer(); } } public void MaskedAggressive() { if (maskedFocus == Focus.Items) { if (noMoreItems) { return; } if (GlobalItemList.Instance.isShotgun) { maskedGoal = "grabbing a shotgun"; FindAndGrabShotgun(); if (isHoldingObject && closestGrabbable is ShotgunItem) { maskedGoal = "using a shotgun"; UseItem(((EnemyAI)maskedEnemy).targetPlayer, distanceToPlayer); } } else { noMoreItems = true; mustChangeFocus = true; mustChangeActivity = true; } } else if (maskedFocus == Focus.Player) { focusingOnPlayer(); } } public void MaskedInsane() { if (maskedFocus == Focus.Terminal) { if (!noMoreTerminal && Plugin.useTerminal) { UsingTerminal(); } else { mustChangeFocus = true; } } else if (maskedFocus == Focus.Apparatus) { if (!noMoreApparatus) { usingApparatus(); } else { mustChangeFocus = true; } } else if (maskedFocus == Focus.Escape) { if (completedApparatusFocus) { InsaneEscape(); } else { mustChangeFocus = true; } } else if (maskedFocus == Focus.Player) { focusingOnPlayer(); } } private void focusingOnPlayer() { //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) PlayerControllerB closestPlayer = __instance.GetClosestPlayer(false, false, false); if ((Object)(object)closestPlayer == (Object)null) { mustChangeFocus = true; mustChangeActivity = true; return; } __instance.SetMovingTowardsTargetPlayer(closestPlayer); float num = Vector3.Distance(((Component)agent).transform.position, ((Component)closestPlayer).transform.position); if (num < 1f || closestPlayer.isPlayerDead) { mustChangeFocus = true; mustChangeActivity = true; } } private void findPlayer() { //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_0059: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetedPlayer == (Object)null) { mustChangeFocus = true; mustChangeActivity = true; return; } PlayerControllerB val = targetedPlayer; maskedGoal = "finding " + ((Object)val).name.ToString(); Vector3 position = ((Component)val).transform.position; if (__instance.CheckLineOfSightForPosition(position, 80f, 60, -1f, (Transform)null)) { followTime = 20f; } else { followTime -= updateFrequency; } if (followTime <= 0f || targetedPlayer.isPlayerDead || (((EnemyAI)maskedEnemy).isOutside && targetedPlayer.isInsideFactory)) { __instance.targetPlayer = null; targetedPlayer = null; mustChangeFocus = true; mustChangeActivity = true; lastMaskedFocus = Focus.Player; } } private void TargetAndKillPlayer() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Expected O, but got Unknown //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Expected O, but got Unknown //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Expected O, but got Unknown //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: 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_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) if ((Object)__instance.targetPlayer == (Object)null && isHoldingObject) { maskedGoal = "not targeting player, holding object"; dropTimer = 0f; } if ((Object)(object)targetedPlayer == (Object)null) { targetedPlayer = __instance.targetPlayer; } if ((Object)(object)targetedPlayer != (Object)null) { maskedFocusInt.Value = 1; maskedActivityInt.Value = 0; if ((Object)__instance.targetPlayer != (Object)null && isHoldingObject && !(closestGrabbable is Shovel) && !(closestGrabbable is ShotgunItem) && maskedPersonality == Personality.Aggressive) { maskedGoal = "[Aggressive]targetting player while holding object(not shotgun/shovel)"; dropTimer += updateFrequency; if (((NetworkBehaviour)this).IsHost) { if (!itemDroped) { dropTimerB = Random.Range(0.2f, 4f); itemDroped = true; } if (dropTimer > dropTimerB) { dropItem.Value = true; } } } else if ((Object)__instance.targetPlayer != (Object)null && isHoldingObject && (maskedPersonality == Personality.Deceiving || maskedPersonality == Personality.Insane)) { maskedGoal = "[Deceiving/Insane]targetting player while holding object"; dropTimer += updateFrequency; if (((NetworkBehaviour)this).IsHost) { if (!itemDroped) { dropTimerB = Random.Range(0.2f, 4f); itemDroped = true; } if (dropTimer > dropTimerB) { dropItem.Value = true; } } } if (isHoldingObject && (Object)__instance.targetPlayer != (Object)null && closestGrabbable is StunGrenadeItem && maskedPersonality == Personality.Aggressive) { maskedGoal = "[Aggressive]targetting player while holding object (stun grenade)"; StunGrenadeItem component = ((Component)closestGrabbable).GetComponent(); if (distanceToPlayer < 8f && !stunThrowed) { stunThrowed = true; creatureAnimator.SetTrigger("StunPin"); component.inPullingPinAnimation = true; ((GrabbableObject)component).playerHeldBy.activatingItem = true; ((GrabbableObject)component).playerHeldBy.doingUpperBodyEmote = 1.16f; component.itemAnimator.SetTrigger("pullPin"); component.itemAudio.PlayOneShot(component.pullPinSFX); WalkieTalkie.TransmitOneShotAudio(component.itemAudio, component.pullPinSFX, 0.8f); component.inPullingPinAnimation = false; component.pinPulled = true; ((GrabbableObject)component).itemUsedUp = true; ((GrabbableObject)component).grabbable = false; Vector3 position = ((Component)component).transform.position; component.grenadeThrowRay = new Ray(((Component)((GrabbableObject)component).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)component).playerHeldBy.gameplayCamera).transform.forward); Ray grenadeThrowRay; RaycastHit grenadeHit; Vector3 point; if (Physics.Raycast(component.grenadeThrowRay, ref component.grenadeHit, 12f, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { grenadeThrowRay = component.grenadeThrowRay; grenadeHit = component.grenadeHit; point = ((Ray)(ref grenadeThrowRay)).GetPoint(((RaycastHit)(ref grenadeHit)).distance - 0.05f); } else { grenadeThrowRay = component.grenadeThrowRay; point = ((Ray)(ref grenadeThrowRay)).GetPoint(10f); } position = point; Debug.DrawRay(position, Vector3.down, Color.blue, 15f); component.grenadeThrowRay = new Ray(position, Vector3.down); Vector3 val; if (Physics.Raycast(component.grenadeThrowRay, ref component.grenadeHit, 30f, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { grenadeHit = component.grenadeHit; val = ((RaycastHit)(ref grenadeHit)).point + Vector3.up * 0.05f; } else { grenadeThrowRay = component.grenadeThrowRay; val = ((Ray)(ref grenadeThrowRay)).GetPoint(30f); } Vector3 val2 = val; closestGrabbable.parentObject = null; ((Component)closestGrabbable).transform.SetParent(StartOfRound.Instance.propsContainer, true); closestGrabbable.EnablePhysics(true); closestGrabbable.fallTime = 0f; closestGrabbable.startFallingPosition = ((Component)closestGrabbable).transform.parent.InverseTransformPoint(((Component)closestGrabbable).transform.position); closestGrabbable.targetFloorPosition = ((Component)closestGrabbable).transform.parent.InverseTransformPoint(val2); closestGrabbable.floorYRot = -1; isHoldingObject = false; closestGrabbable.DiscardItemFromEnemy(); } } if (!__instance.isEnemyDead && isHoldingObject && (Object)__instance.targetPlayer != (Object)null && (maskedPersonality != Personality.Aggressive || (!(closestGrabbable is Shovel) && !(closestGrabbable is ShotgunItem)))) { maskedGoal = "not dead, holding object, targetting player (is not aggressive OR closest item is not a shovel/shotgun)"; if (__instance.isOutside) { if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(maskedEnemy.shipHidingSpot, false); } } else { maskedFocusInt.Value = 0; maskedActivityInt.Value = 2; } } if ((Object)__instance.targetPlayer != (Object)null) { distanceToPlayer = Vector3.Distance(((Component)creatureAnimator).transform.position, ((Component)__instance.targetPlayer).transform.position); maskedEnemy.lookAtPositionTimer = 0f; } findPlayer(); } else if (maskedFocus == Focus.Player || maskedActivity == Activity.RandomPlayer) { mustChangeFocus = true; mustChangeActivity = true; } } private void OnCollideWithPlayer() { //IL_0080: 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_011e: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)maskedEnemy).isEnemyDead || isUsingTerminal || isUsingBreakerBox || (maskedPersonality == Personality.Aggressive && isHoldingObject && (closestGrabbable is Shovel || closestGrabbable is ShotgunItem))) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; PlayerControllerB[] array = allPlayerScripts; foreach (PlayerControllerB val in array) { float num = Vector3.Distance(((Component)val).transform.position, ((Component)agent).transform.position); if (!(num < 1f)) { continue; } maskedGoal = "attempting to kill a player"; PlayerControllerB val2 = ((EnemyAI)maskedEnemy).MeetsStandardPlayerCollisionConditions(val.playerCollider, maskedEnemy.inKillAnimation || maskedEnemy.startingKillAnimationLocalClient || !maskedEnemy.enemyEnabled, false); if ((Object)(object)val2 != (Object)null) { __instance.targetPlayer = val; LookAtPos(((Component)val).transform.position); maskedEnemy.KillPlayerAnimationServerRpc((int)val.playerClientId); maskedEnemy.startingKillAnimationLocalClient = true; if (val.isCrouching) { val.Crouch(false); } } } } private int objectInLOSCheck(EnemyAI ent, GameObject gameObj, int proxyDist = -1, int moveCheckForwardDistance = 0) { //IL_0008: 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_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) //IL_0064: 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_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) if (ent.CheckLineOfSightForPosition(gameObj.transform.position + gameObj.transform.forward * (float)moveCheckForwardDistance, 60f, 2, (float)proxyDist, (Transform)null)) { seenCheckNum = 200; return 2; } int num = -1; if (proxyDist != -1) { num = proxyDist * 2; } if (ent.CheckLineOfSightForPosition(gameObj.transform.position + gameObj.transform.forward * (float)moveCheckForwardDistance, 60f, 4, (float)num, (Transform)null)) { seenCheckNum--; return 1; } if (seenCheckNum < 200) { seenCheckNum--; } seenCheckNum = 200; return 0; } private void usingApparatus() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)apparatus == (Object)null) { Plugin.mls.LogWarning((object)"Apparatus was null so insane cannot sabotage it. (usually due to mansion interior)"); mustChangeFocus = true; mustChangeActivity = true; noMoreApparatus = true; return; } if (seenCheckNum <= 0) { Plugin.mls.LogWarning((object)"Apparatus was seen, but could not be reached! Not Critical, but please report this!"); mustChangeFocus = true; mustChangeActivity = true; noMoreApparatus = true; } if (!apparatus.isLungPowered) { if (completedApparatusFocus) { maskedFocusInt.Value = 0; maskedActivityInt.Value = 2; } else { mustChangeFocus = true; mustChangeActivity = true; } noMoreApparatus = true; } apparatusDistance = Vector3.Distance(((Component)agent).transform.position, apparatusPosition.Value); if (!(apparatusDistance > 0f)) { return; } dropItem.Value = true; if (!isUsingApparatus && !noMoreApparatus && !__instance.isEnemyDead) { if (!apparatusReachable.Value) { return; } Vector3 value = apparatusPosition.Value; maskedGoal = "walking to apparatus (" + ((object)(Vector3)(ref value)).ToString() + ")"; if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(apparatusPosition.Value, false); __instance.moveTowardsDestination = true; } } if ((Object)apparatus != (Object)null && !apparatus.isLungDocked) { return; } if (apparatusDistance < 10f && isHoldingObject) { dropItem.Value = true; } if (!isUsingApparatus && !noMoreApparatus && apparatusDistance < 0.5f) { isUsingApparatus = true; } if (isUsingApparatus) { maskedGoal = "sabotaging apparatus"; if (((NetworkBehaviour)this).IsHost && !appTrigger.Value) { new WaitForSeconds(0.5f); appTrigger.Value = true; } } } private void sabotageApparatus(bool value) { if (!value) { return; } __instance.inSpecialAnimation = true; __instance.movingTowardsTargetPlayer = false; __instance.targetPlayer = null; ((Component)maskedEnemy.headTiltTarget).gameObject.SetActive(false); agent.speed = 0f; completedApparatusFocus = true; ((GrabbableObject)apparatus).EquipItem(); apparatus.isLungPowered = false; apparatus.lungDeviceLightIntensity = 0f; ((Component)apparatus).GetComponent().SetScrapValue(0); NetworkObject component = ((Component)apparatus).GetComponent(); if ((Object)(object)component != (Object)null) { ScanNodeProperties componentInChildren = ((Component)component).GetComponentInChildren(); componentInChildren.headerText = "SabotagedApparatus"; componentInChildren.scrapValue = 0; componentInChildren.subText = $"Value: ${0}"; List list = ((Component)component).GetComponentsInChildren().ToList(); CollectionExtensions.Do((IEnumerable)list, (Action)delegate(Light l) { ((Behaviour)l).enabled = false; }); } apparatus.isLungDocked = false; apparatus.isLungDockedInElevator = false; apparatus.isLungPowered = false; ((Component)apparatus).GetComponent().Stop(); isUsingApparatus = false; __instance.inSpecialAnimation = false; ((Component)maskedEnemy.headTiltTarget).gameObject.SetActive(true); Plugin.mls.LogError((object)("Masked " + maskedId + " is Insane and sabotaged the apparatus")); } private void InsaneEscape() { //IL_003b: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0212: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) if (!isTerminalEscaping && !isLeverEscaping) { isTerminalEscaping = true; } if (isTerminalEscaping) { if (Vector3.Distance(((Component)agent).transform.position, terminalPosition.Value) < 5f) { if (!TerminalPatches.Transmitter.IsSignalTranslatorUnlocked()) { Plugin.mls.LogDebug((object)"Signal Translator is not unlocked so skipping 'escape warnings'"); isTerminalEscaping = false; isLeverEscaping = true; return; } if (!Plugin.useTerminal) { Plugin.mls.LogDebug((object)"Terminal usage is disabled so skipping 'escape warnings'"); isTerminalEscaping = false; isLeverEscaping = true; return; } if (!isUsingTerminal && Plugin.isTerminalBeingUsed) { Plugin.mls.LogDebug((object)"Other entity is using terminal right now so switching focus"); mustChangeFocus = true; return; } if (enterTermianlSpecialCodeTime == 0 && !isLeverEscaping) { transmitMessageTimer.Value = 0f; enterTermianlSpecialCodeTime = 10; isTerminalEscaping = true; } if (enterTermianlSpecialCodeTime > 0 && !isLeverEscaping) { noMoreTerminal = false; maskedGoal = "(escape) sending warnings about leaving"; if (Plugin.useTerminal && TerminalPatches.Transmitter.IsSignalTranslatorUnlocked()) { UsingTerminal(); } } } else { maskedGoal = "(escape) heading to terminal in player ship"; if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)maskedEnemy).SetDestinationToPosition(terminalPosition.Value, false); } } } if (!isLeverEscaping) { return; } isTerminalEscaping = false; if (Plugin.maskedShipDeparture) { StartMatchLever val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { Plugin.mls.LogError((object)"startMatchLever is NULL"); return; } Vector3 position = ((Component)val).transform.position; maskedGoal = "(escape) walking to ships lever (" + ((object)(Vector3)(ref position)).ToString() + ")"; if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)maskedEnemy).SetDestinationToPosition(((Component)val).transform.position, false); ((EnemyAI)maskedEnemy).moveTowardsDestination = true; } if ((Object)(object)val == (Object)null) { Plugin.mls.LogError((object)"StartMatchLever cannot be found so cannot be used by InsaneMasked!"); mustChangeFocus = true; mustChangeActivity = true; Plugin.maskedShipDeparture = false; } else if (Vector3.Distance(((Component)agent).transform.position, ((Component)val).transform.position) < 3f) { val.LeverAnimation(); val.EndGame(); } } else { Plugin.mls.LogInfo((object)("maskedShipDeparture = " + Plugin.maskedShipDeparture + " so the escape finish is impossible!")); mustChangeFocus = true; mustChangeActivity = true; } } private void terminalAccess(bool enabled) { Plugin.mls.LogDebug((object)("Terminal Access Enabled = " + enabled)); terminal.terminalTrigger.interactable = enabled; } private void playKeyboardAudio() { int num = terminal.keyboardClips.Length; int num2 = Random.RandomRangeInt(0, num); float num3 = ((maskedPersonality == Personality.Deceiving && enterTerminalCodeTimer.Value > terminalTimeFloat.Value && enterTermianlSpecialCodeTime > 0) ? terminalTimeFloat.Value : ((maskedPersonality == Personality.Cunning && dropShipTimer > 11.5f) ? 10f : ((maskedPersonality != Personality.Insane || !(transmitMessageTimer.Value >= terminalTimeFloat.Value) || !(transmitPauseTimer >= delayMaxTime.Value)) ? (updateFrequency * (float)Random.RandomRangeInt(1, 7)) : delayMaxTime.Value))); if (kad <= 0f && !terminal.terminalAudio.isPlaying) { if (Random.RandomRangeInt(0, 50) == 0) { kad = terminal.syncedAudios[1].length + num3; terminal.PlayTerminalAudioServerRpc(1); } else { kad = terminal.keyboardClips[num2].length + num3; terminal.terminalAudio.PlayOneShot(terminal.keyboardClips[num2]); } } if (!terminal.terminalAudio.isPlaying) { kad -= updateFrequency; } } private void UsingTerminal() { //IL_000c: 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_003c: 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_0056: 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_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_0076: 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_0096: 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_00a5: 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) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) Vector3 val = new Vector3(((Component)terminal).transform.position.x, ((Component)terminal).transform.position.y - 1.44f, ((Component)terminal).transform.position.z) - ((Component)terminal).transform.right * 0.8f; float num = Vector3.Distance(((Component)agent).transform.position, ((Component)terminal).transform.position - ((Component)terminal).transform.right * 0.8f + new Vector3(0f, 0.25f, 0f)); if (num < 40f) { if (num < 15f && num > 3.5f && Plugin.isTerminalBeingUsed) { Plugin.mls.LogDebug((object)"Terminal is being used by another entity"); if (maskedFocus == Focus.Escape) { isLeverEscaping = true; } else { mustChangeFocus = true; } return; } if (num < 5.5f && isHoldingObject) { dropItem.Value = true; } if (!terminal.terminalInUse && !noMoreTerminal && num < 1.8f && !isUsingTerminal) { terminal.terminalAudio.PlayOneShot(terminal.enterTerminalSFX); Plugin.isTerminalBeingUsed = true; terminalAccess(enabled: false); isUsingTerminal = true; } if (!terminal.terminalInUse && !noMoreTerminal && !__instance.isEnemyDead) { if (((NetworkBehaviour)this).IsHost) { terminalReachable.Value = __instance.SetDestinationToPosition(val, true); } if (!terminalReachable.Value) { return; } maskedGoal = "walking to terminal (" + ((object)(Vector3)(ref val)).ToString() + ")"; __instance.moveTowardsDestination = true; ignoringPersonality = true; } } isCrouched.Value = false; creatureAnimator.ResetTrigger("Crouching"); if (isUsingTerminal) { maskedGoal = "using terminal"; if (((NetworkBehaviour)this).IsHost) { ((Component)this).transform.position = val; ((Component)this).transform.LookAt(new Vector3(((Component)terminal).transform.position.x, ((Component)this).transform.position.y, ((Component)terminal).transform.position.z)); } if (((Component)agent).transform.position != val) { return; } ((Component)this).transform.position = ((Component)agent).transform.position; ((Component)this).transform.rotation = ((Component)agent).transform.rotation; creatureAnimator.SetTrigger("Terminal"); __instance.inSpecialAnimation = true; ignoringPersonality = false; terminal.placeableObject.inUse = true; ((Behaviour)terminal.terminalLight).enabled = true; __instance.movingTowardsTargetPlayer = false; __instance.targetPlayer = null; ((Component)maskedEnemy.headTiltTarget).gameObject.SetActive(false); agent.speed = 0f; creatureAnimator.ResetTrigger("IsMoving"); playKeyboardAudio(); if (maskedPersonality == Personality.Cunning) { if (terminal.numberOfItemsInDropship <= 0 && !dropship.shipLanded && dropship.shipTimer <= 0f && !isDeliverEmptyDropship && !noMoreTerminal) { if (dropShipTimer > 6f && !purchasedStuff) { if (((NetworkBehaviour)this).IsHost) { terminal.PlayTerminalAudioServerRpc(0); } purchasedStuff = true; } dropShipTimer += updateFrequency; if (dropShipTimer > 10f && purchasedStuff && ((NetworkBehaviour)this).IsHost) { landDropshipTrigger.Value = true; } } else if (isDeliverEmptyDropship && dropShipTimer <= 12f && !noMoreTerminal) { dropShipTimer += updateFrequency; } if (dropShipTimer > 12f) { Plugin.mls.LogDebug((object)("Masked '" + maskedId + "' is '" + maskedPersonality.ToString() + " called in an item dropship.")); terminal.terminalAudio.PlayOneShot(terminal.leaveTerminalSFX); __instance.inSpecialAnimation = false; ignoringPersonality = false; __instance.SwitchToBehaviourState(2); terminal.placeableObject.inUse = false; ((Behaviour)terminal.terminalLight).enabled = false; creatureAnimator.ResetTrigger("Terminal"); ((Component)maskedEnemy.headTiltTarget).gameObject.SetActive(true); isUsingTerminal = false; noMoreTerminal = true; Plugin.isTerminalBeingUsed = false; terminalAccess(enabled: true); dropShipTimer = 0f; purchasedStuff = false; } return; } if (maskedPersonality == Personality.Insane) { if (!TerminalPatches.Transmitter.IsSignalTranslatorUnlocked()) { Plugin.mls.LogDebug((object)"SignalTranslator is NOT unlocked :("); terminal.terminalAudio.PlayOneShot(terminal.leaveTerminalSFX); __instance.inSpecialAnimation = false; ignoringPersonality = false; __instance.SwitchToBehaviourState(2); terminal.placeableObject.inUse = false; ((Behaviour)terminal.terminalLight).enabled = false; creatureAnimator.ResetTrigger("Terminal"); ((Component)maskedEnemy.headTiltTarget).gameObject.SetActive(true); isUsingTerminal = false; noMoreTerminal = true; Plugin.isTerminalBeingUsed = false; terminalAccess(enabled: true); isTerminalEscaping = false; return; } if (GameNetworkManager.Instance.isHostingGame) { LNetworkVariable? obj = transmitMessageTimer; obj.Value += updateFrequency; if (signalTranslatorMessage.Value == null || signalTranslatorTrigger.Value) { signalTranslatorTrigger.Value = false; terminalTimeFloat.Value = Random.Range(5.2f, 8.5f); if (enterTermianlSpecialCodeTime != 0) { signalTranslatorMessage.Value = InsaneTransmitMessageSelection(); } } if (transmitMessageTimer.Value > terminalTimeFloat.Value) { transmitMessageTimer.Value = 0f; signalTranslatorTrigger.Value = true; } } if (enterTermianlSpecialCodeTime == 0 || StartOfRound.Instance.shipIsLeaving) { terminal.terminalAudio.PlayOneShot(terminal.leaveTerminalSFX); __instance.inSpecialAnimation = false; ignoringPersonality = false; __instance.SwitchToBehaviourState(2); terminal.placeableObject.inUse = false; ((Behaviour)terminal.terminalLight).enabled = false; creatureAnimator.ResetTrigger("Terminal"); ((Component)maskedEnemy.headTiltTarget).gameObject.SetActive(true); isUsingTerminal = false; noMoreTerminal = true; signalTranslatorMessage.Value = null; if (maskedFocus == Focus.Escape) { isTerminalEscaping = false; isLeverEscaping = true; noMoreTerminal = true; } else { mustChangeFocus = true; mustChangeActivity = true; } Plugin.isTerminalBeingUsed = false; terminalAccess(enabled: true); } return; } if (maskedPersonality != Personality.Deceiving) { Plugin.mls.LogDebug((object)("Personality is not Deceiving :( (I am " + maskedPersonality.ToString() + ")")); terminal.terminalAudio.PlayOneShot(terminal.leaveTerminalSFX); __instance.inSpecialAnimation = false; ignoringPersonality = false; __instance.SwitchToBehaviourState(2); terminal.placeableObject.inUse = false; ((Behaviour)terminal.terminalLight).enabled = false; creatureAnimator.ResetTrigger("Terminal"); ((Component)maskedEnemy.headTiltTarget).gameObject.SetActive(true); isUsingTerminal = false; noMoreTerminal = true; Plugin.isTerminalBeingUsed = false; terminalAccess(enabled: true); return; } LNetworkVariable? obj2 = enterTerminalCodeTimer; obj2.Value += updateFrequency; if (enterTerminalCodeTimer.Value > terminalTimeFloat.Value && enterTermianlSpecialCodeTime > 0 && GameNetworkManager.Instance.isHostingGame) { if (objectCodeTrigger.Value) { objectCodeTrigger.Value = false; terminalTimeFloat.Value = Random.Range(2.2f, 8.5f); if (terminalAccessibleObject.Length != 0) { TerminalAccessibleObject val2 = terminalAccessibleObject[Random.Range(0, terminalAccessibleObject.Length)]; string value = val2.objectCode; if ((Object)(object)val2 != (Object)null) { terminalCode.Value = value; terminal.terminalAudio.PlayOneShot(terminal.codeBroadcastSFX); } } else { terminalCode.Value = null; terminal.terminalAudio.PlayOneShot(terminal.codeBroadcastSFX); } } else { objectCodeTrigger.Value = true; enterTerminalCodeTimer.Value = 0f; } } if (enterTermianlSpecialCodeTime == 0 || StartOfRound.Instance.shipIsLeaving) { terminal.terminalAudio.PlayOneShot(terminal.leaveTerminalSFX); __instance.inSpecialAnimation = false; ignoringPersonality = false; __instance.SwitchToBehaviourState(2); terminal.placeableObject.inUse = false; ((Behaviour)terminal.terminalLight).enabled = false; creatureAnimator.ResetTrigger("Terminal"); ((Component)maskedEnemy.headTiltTarget).gameObject.SetActive(true); isUsingTerminal = false; noMoreTerminal = true; Plugin.isTerminalBeingUsed = false; terminalAccess(enabled: true); } } else if (!((Component)maskedEnemy.headTiltTarget).gameObject.activeSelf) { terminal.placeableObject.inUse = false; ((Behaviour)terminal.terminalLight).enabled = false; creatureAnimator.ResetTrigger("Terminal"); ((Component)maskedEnemy.headTiltTarget).gameObject.SetActive(true); } } private void updatePosition(Vector3 oldVal, Vector3 newVal) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = newVal; } private void updateTargetPlayer(ulong oldVal, ulong newVal) { if (!((NetworkBehaviour)this).IsHost) { if (newVal == ulong.MaxValue) { ((EnemyAI)maskedEnemy).targetPlayer = null; } else { ((EnemyAI)maskedEnemy).targetPlayer = LethalNetworkExtensions.GetPlayerController(newVal); } } } private void landDropship(bool value) { if (value) { purchasedStuff = false; dropship.LandShipOnServer(); isDeliverEmptyDropship = true; landDropshipTrigger.Value = false; } } private void useObjectCode(string code) { if (code != null && ((NetworkBehaviour)this).IsHost) { terminal.CallFunctionInAccessibleTerminalObject(code); } enterTermianlSpecialCodeTime--; Plugin.mls.LogDebug((object)("Masked '" + maskedId + "' is '" + maskedPersonality.ToString() + "' and broadcasting code " + code + " (" + enterTermianlSpecialCodeTime + " code entries remaining)")); } private void sendSignalTranslatorMessage(string message) { if (message != null && !(message == "")) { Plugin.mls.LogDebug((object)("Masked '" + maskedId + "' is '" + maskedPersonality.ToString() + "' and sending a message using the signal translator")); TerminalPatches.Transmitter.SendMessage(message); enterTermianlSpecialCodeTime--; Plugin.mls.LogDebug((object)("Message sent is: " + message + " (" + enterTermianlSpecialCodeTime + " message sends remaining)")); } } public string InsaneTransmitMessageSelection() { string result = null; if (isTerminalEscaping) { switch (enterTermianlSpecialCodeTime) { case 1: result = "leaving!!!"; break; case 2: result = "sry!!!!!!!"; break; case 3: result = "hurry!!!!!"; break; case 4: result = "hurry!!!"; break; case 5: result = "where r u?"; break; case 6: result = "hurry!!"; break; case 7: result = "come ship!"; break; case 8: result = "evacuate!"; break; case 9: result = "hurry!"; break; case 10: result = "time to go"; break; } } else { switch (Random.Range(0, 10)) { case 0: result = "safe"; break; case 1: result = "danger"; break; case 2: switch (Random.Range(0, 7)) { case 0: result = "dogs"; break; case 1: result = "bracken"; break; case 2: result = "giant"; break; case 3: result = "worm"; break; case 4: result = "coilhead"; break; case 5: result = "mine"; break; case 6: result = "turret"; break; } break; case 3: result = "7pm"; break; case 4: result = "9pm"; break; case 5: result = "behind u"; break; case 6: result = "left"; break; case 7: result = "right"; break; case 8: result = "go back"; break; case 9: result = "watch out"; break; } } return result; } private async void breakerBoxSwitchLogic(float distanceToBox, bool on) { isUsingBreakerBox = true; __instance.inSpecialAnimation = true; __instance.movingTowardsTargetPlayer = false; __instance.targetPlayer = null; AnimatedObjectTrigger[] componentsInChildren = ((Component)breakerBox).GetComponentsInChildren(); foreach (AnimatedObjectTrigger k in componentsInChildren) { if (((Object)k).name == "PowerBoxDoor" && !k.boolValue) { k.boolValue = true; k.triggerAnimator.SetBool("isOpen", true); k.SetParticleBasedOnBoolean(); k.PlayAudio(true, false); k.localPlayerTriggered = true; k.UpdateAnimServerRpc(true, false, -1); } } if (!on) { RoundManager.Instance.FlickerLights(false, false); await Task.Delay(2000); RoundManager.Instance.FlickerLights(false, false); await Task.Delay(1000); RoundManager.Instance.FlickerLights(false, false); await Task.Delay(500); int switchesToChange2 = breakerBox.breakerSwitches.Length; for (int j = 0; j < switchesToChange2; j++) { if (j != 0) { await Task.Delay(1500); } powerBox = ((Component)breakerBox.breakerSwitches[j]).gameObject.GetComponent(); if (!powerBox.boolValue) { Plugin.mls.LogDebug((object)"switch already turned off"); continue; } breakerBox.breakerSwitches[j].SetBool("turnedLeft", false); breakerBox.thisAudioSource.PlayOneShot(breakerBox.switchPowerSFX); powerBox.boolValue = false; powerBox.setInitialState = false; BreakerBox obj = breakerBox; obj.leversSwitchedOff++; if (breakerBox.leversSwitchedOff > 0 && breakerBox.isPowerOn) { RoundManager.Instance.PowerSwitchOffClientRpc(); breakerBox.breakerBoxHum.Stop(); breakerBox.isPowerOn = false; } } noMoreBreakerBox = true; } else { int switchesToChange = breakerBox.breakerSwitches.Length; for (int i = 0; i < switchesToChange; i++) { if (i != 0) { await Task.Delay(1500); } powerBox = ((Component)breakerBox.breakerSwitches[i]).gameObject.GetComponent(); if (powerBox.boolValue) { Plugin.mls.LogDebug((object)"switch already turned on"); continue; } breakerBox.breakerSwitches[i].SetBool("turnedLeft", true); breakerBox.thisAudioSource.PlayOneShot(breakerBox.switchPowerSFX); powerBox.boolValue = true; powerBox.setInitialState = false; BreakerBox obj2 = breakerBox; obj2.leversSwitchedOff--; if (breakerBox.leversSwitchedOff == 0) { RoundManager.Instance.PowerSwitchOnClientRpc(); breakerBox.breakerBoxHum.Play(); breakerBox.isPowerOn = true; } } noMoreBreakerBox = false; } isUsingBreakerBox = false; focusingPersonality = false; __instance.inSpecialAnimation = false; } public void UseItem(PlayerControllerB target, float distance) { //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Expected O, but got Unknown //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) maskedGoal = "use item"; shovelTimer += updateFrequency; if (!isHoldingObject) { return; } if (closestGrabbable is FlashlightItem) { if (shovelTimer < 0.7f) { ((GrabbableObject)((Component)closestGrabbable).GetComponent()).ItemActivate(false, true); } else if (shovelTimer > 0.7f && shovelTimer < 1.4f) { ((GrabbableObject)((Component)closestGrabbable).GetComponent()).ItemActivate(true, true); } else if (shovelTimer > 1f) { shovelTimer = 0f; } } if (closestGrabbable is Shovel) { if (shovelTimer < 0.5f) { if (!isReeledWithShovel) { creatureAnimator.SetTrigger("ShovelUp"); ((Component)closestGrabbable).GetComponent().shovelAudio.PlayOneShot(((Component)closestGrabbable).GetComponent().reelUp); isReeledWithShovel = true; } } else if (shovelTimer > 0.5f && shovelTimer < 0.7f) { if (!isHittedWithShovel) { creatureAnimator.ResetTrigger("ShovelUp"); if (distance < 3f) { target.movementAudio.PlayOneShot(StartOfRound.Instance.hitPlayerSFX); if (target.health > 20) { target.DamagePlayer(20, true, true, (CauseOfDeath)1, 0, false, default(Vector3)); Plugin.mls.LogInfo((object)"Damage With Shovel"); } else { target.KillPlayer(Vector3.zero, true, (CauseOfDeath)1, 0, default(Vector3), false); ((EnemyAI)maskedEnemy).targetPlayer = null; maskedEnemy.lastPlayerKilled = null; ((EnemyAI)maskedEnemy).inSpecialAnimation = false; Plugin.mls.LogInfo((object)"Killed With Shovel"); } } ((Component)closestGrabbable).GetComponent().shovelAudio.PlayOneShot(((Component)closestGrabbable).GetComponent().swing); isHittedWithShovel = true; } } else if ((double)shovelTimer > 1.5) { shovelTimer = 0f; isReeledWithShovel = false; isHittedWithShovel = false; } } if (!((Object)((EnemyAI)maskedEnemy).targetPlayer != (Object)null) || !(closestGrabbable is ShotgunItem) || maskedPersonality != Personality.Aggressive) { return; } Plugin.mls.LogInfo((object)"Shotgun Guy targeted player"); ShotgunItem component = ((Component)closestGrabbable).GetComponent(); if (component.shellsLoaded <= 0) { return; } if (((Component)closestGrabbable).GetComponent().shellsLoaded > 0) { if (shootTimer > 0f) { shootTimer -= updateFrequency; } float num = Vector3.Distance(((Component)creatureAnimator).transform.position, ((Component)__instance.targetPlayer).transform.position); if (component.safetyOn && num < 8f) { component.safetyOn = false; component.gunAudio.PlayOneShot(component.switchSafetyOffSFX); WalkieTalkie.TransmitOneShotAudio(component.gunAudio, component.switchSafetyOffSFX, 1f); Plugin.mls.LogInfo((object)"Safety On"); } else if (!component.safetyOn && num > 12f) { component.safetyOn = true; component.gunAudio.PlayOneShot(component.switchSafetyOnSFX); WalkieTalkie.TransmitOneShotAudio(component.gunAudio, component.switchSafetyOnSFX, 1f); Plugin.mls.LogInfo((object)"Safety Off"); } if (num < 10f && shootTimer <= 0f) { Vector3 val = ((Component)((Component)__instance).transform.GetChild(0).GetChild(3).GetChild(3)).transform.position - ((Component)((Component)__instance).transform.GetChild(0).GetChild(3).GetChild(3)).transform.up * 0.45f; Vector3 forward = ((Component)((Component)__instance).transform.GetChild(0).GetChild(3).GetChild(3)).transform.forward; Plugin.mls.LogInfo((object)"Calling shoot gun...."); component.ShootGun(val, forward); Plugin.mls.LogInfo((object)"Calling shoot gun and sync"); component.localClientSendingShootGunRPC = true; component.ShootGunServerRpc(val, forward); shootTimer = 3f; } if ((Object)__instance.targetPlayer != (Object)null && num > 10f && shootTimer <= 0f) { isRunning.Value = true; } } else if (!component.safetyOn && component.shellsLoaded > 0 && (Object)__instance.targetPlayer == (Object)null) { component.safetyOn = true; component.gunAudio.PlayOneShot(component.switchSafetyOnSFX); WalkieTalkie.TransmitOneShotAudio(component.gunAudio, component.switchSafetyOnSFX, 1f); } } private async void NotGrabItemsTime() { notGrabItems = true; await Task.Delay(9000); notGrabItems = false; dropItem.Value = false; } private void OldDropItem() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0092: 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_009c: 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_00c5: 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_00d0: Unknown result type (might be due to invalid IL or missing references) if ((Object)heldGrabbable != (Object)null && isHoldingObject) { NotGrabItemsTime(); closestGrabbable.parentObject = null; ((Component)closestGrabbable).transform.SetParent(StartOfRound.Instance.propsContainer, true); closestGrabbable.EnablePhysics(true); closestGrabbable.fallTime = 0f; closestGrabbable.startFallingPosition = ((Component)closestGrabbable).transform.parent.InverseTransformPoint(((Component)closestGrabbable).transform.position); closestGrabbable.targetFloorPosition = ((Component)closestGrabbable).transform.parent.InverseTransformPoint(closestGrabbable.GetItemFloorPosition(default(Vector3))); closestGrabbable.floorYRot = -1; closestGrabbable.isHeld = false; closestGrabbable.isHeldByEnemy = false; isHoldingObject = false; closestGrabbable.DiscardItemFromEnemy(); closestGrabbable.hasHitGround = true; closestGrabbable.grabbable = true; heldGrabbable = null; isHoldingObject = false; itemDroped = true; PlayerControllerB targetPlayer = __instance.CheckLineOfSightForClosestPlayer(80f, 60, 1, 3f); __instance.movingTowardsTargetPlayer = true; __instance.targetPlayer = targetPlayer; __instance.SwitchToBehaviourState(2); } } private void DropItemsNew(bool oldVal, bool newVal) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //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_00af: 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_00d8: 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_00df: 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) if (oldVal != newVal && newVal && (Object)heldGrabbable != (Object)null && isHoldingObject) { heldGrabbable.parentObject = null; ((Component)heldGrabbable).transform.SetParent(StartOfRound.Instance.propsContainer, true); heldGrabbable.EnablePhysics(true); heldGrabbable.fallTime = 0f; heldGrabbable.startFallingPosition = ((Component)heldGrabbable).transform.parent.InverseTransformPoint(((Component)heldGrabbable).transform.position); heldGrabbable.targetFloorPosition = ((Component)heldGrabbable).transform.parent.InverseTransformPoint(heldGrabbable.GetItemFloorPosition(default(Vector3))); heldGrabbable.floorYRot = -1; heldGrabbable.isHeld = false; heldGrabbable.isHeldByEnemy = false; isHoldingObject = false; heldGrabbable.DiscardItemFromEnemy(); heldGrabbable.hasHitGround = true; NotGrabItemsTime(); heldGrabbable.grabbable = true; isHoldingObject = false; itemDroped = true; PlayerControllerB targetPlayer = __instance.CheckLineOfSightForClosestPlayer(80f, 60, 1, 3f); __instance.movingTowardsTargetPlayer = true; __instance.targetPlayer = targetPlayer; __instance.SwitchToBehaviourState(2); heldGrabbable = null; dropItem.Value = false; } } private void DropItem() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00c4: 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) if ((Object)heldGrabbable != (Object)null && isHoldingObject) { heldGrabbable.parentObject = null; ((Component)heldGrabbable).transform.SetParent(StartOfRound.Instance.propsContainer, true); heldGrabbable.EnablePhysics(true); heldGrabbable.fallTime = 0f; heldGrabbable.startFallingPosition = ((Component)heldGrabbable).transform.parent.InverseTransformPoint(((Component)heldGrabbable).transform.position); heldGrabbable.targetFloorPosition = ((Component)heldGrabbable).transform.parent.InverseTransformPoint(heldGrabbable.GetItemFloorPosition(default(Vector3))); heldGrabbable.floorYRot = -1; heldGrabbable.isHeld = false; heldGrabbable.isHeldByEnemy = false; isHoldingObject = false; heldGrabbable.DiscardItemFromEnemy(); heldGrabbable.hasHitGround = true; NotGrabItemsTime(); heldGrabbable.grabbable = true; isHoldingObject = false; itemDroped = true; PlayerControllerB targetPlayer = __instance.CheckLineOfSightForClosestPlayer(80f, 60, 1, 3f); __instance.movingTowardsTargetPlayer = true; __instance.targetPlayer = targetPlayer; __instance.SwitchToBehaviourState(2); heldGrabbable = null; } } public void PickupItem() { //IL_010f: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019f: 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_00aa: Unknown result type (might be due to invalid IL or missing references) if (isHoldingObject || noMoreItems || notGrabItems || (Object)(object)closestGrabbable == (Object)null) { return; } if (((NetworkBehaviour)this).IsHost) { if (closestGrabbableDistance.Value < 1.5f && !isHoldingObject) { isCrouched.Value = true; } else { isCrouched.Value = false; } if (closestGrabbableDistance.Value > 0.5f) { __instance.SetDestinationToPosition(((Component)closestGrabbable).transform.position, true); __instance.moveTowardsDestination = true; __instance.movingTowardsTargetPlayer = false; } } if (closestGrabbableDistance.Value > 0.5f && closestGrabbableDistance.Value < 3f) { maskedEnemy.focusOnPosition = ((Component)closestGrabbable).transform.position; maskedEnemy.lookAtPositionTimer = 1.5f; } if (closestGrabbableDistance.Value < 0.9f && !isHoldingObject) { float num = Vector3.Angle(((Component)__instance).transform.forward, ((Component)closestGrabbable).transform.position - ((Component)__instance).transform.position); if (((Component)closestGrabbable).transform.position.y - maskedEnemy.headTiltTarget.position.y < 0f) { num *= -1f; } maskedEnemy.verticalLookAngle = num; heldGrabbable = closestGrabbable; closestGrabbable.parentObject = itemHolder.transform; closestGrabbable.hasHitGround = false; closestGrabbable.isHeld = true; closestGrabbable.isHeldByEnemy = true; closestGrabbable.grabbable = false; isHoldingObject = true; itemDroped = false; closestGrabbable.GrabItemFromEnemy(__instance); } } public void GrabItem() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_00a1: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) if (isHoldingObject || noMoreItems || notGrabItems) { return; } NavMeshPath val = new NavMeshPath(); float num = float.PositiveInfinity; List allitems = GlobalItemList.Instance.allitems; if (allitems.Count == 0) { Plugin.mls.LogDebug((object)"allItemsList is empty so setting no more items=true"); noMoreItems = true; mustChangeFocus = true; return; } foreach (GrabbableObject item in allitems) { if ((Object)(object)this == (Object)null) { break; } _ = ((Component)this).transform.position; if (false) { break; } if ((Object)(object)item == (Object)null) { continue; } _ = ((Component)item).transform.position; if (false || ((Object)item).name == "ClipboardManual" || ((Object)item).name == "StickyNoteItem" || ((Object)item).name == "RedLocustHive" || (maskedPersonality == Personality.Cunning && Vector3.Distance(((Component)item).transform.position, ((Component)terminal).transform.position) >= 15f) || (maskedPersonality == Personality.Deceiving && Vector3.Distance(((Component)item).transform.position, ((Component)terminal).transform.position) <= 30f)) { continue; } float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if ((Object)(object)((Component)item).GetComponent() != (Object)null) { itemSystem = ((Component)item).GetComponent(); } if (itemSystem.hidedByMasked) { continue; } closestGrabbableReachable.Value = agent.CalculatePath(((Component)item).transform.position, val); if (!closestGrabbableReachable.Value || !(num2 < num) || !(num2 <= 30f) || item.isHeld || item.isHeldByEnemy || notGrabClosestItem) { continue; } num = num2; closestGrabbable = item; if (((NetworkBehaviour)this).IsHost) { if (num2 < 1.5f && !isHoldingObject) { isCrouched.Value = true; } else { isCrouched.Value = false; } if (num2 > 0.5f) { __instance.SetDestinationToPosition(((Component)closestGrabbable).transform.position, true); __instance.moveTowardsDestination = true; __instance.movingTowardsTargetPlayer = false; } } if (num2 > 0.5f && num2 < 3f) { maskedEnemy.focusOnPosition = ((Component)closestGrabbable).transform.position; maskedEnemy.lookAtPositionTimer = 1.5f; } if (num2 < 0.9f) { if (isHoldingObject) { break; } float num3 = Vector3.Angle(((Component)__instance).transform.forward, ((Component)closestGrabbable).transform.position - ((Component)__instance).transform.position); if (((Component)closestGrabbable).transform.position.y - maskedEnemy.headTiltTarget.position.y < 0f) { num3 *= -1f; } maskedEnemy.verticalLookAngle = num3; heldGrabbable = closestGrabbable; closestGrabbable.parentObject = itemHolder.transform; closestGrabbable.hasHitGround = false; closestGrabbable.isHeld = true; closestGrabbable.isHeldByEnemy = true; closestGrabbable.grabbable = false; isHoldingObject = true; itemDroped = false; closestGrabbable.GrabItemFromEnemy(__instance); } } } public void GrabItemNewOne() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_00d7: Unknown result type (might be due to invalid IL or missing references) if (isHoldingObject || noMoreItems) { return; } if ((!closestGrabbableReachable.Value || (Object)(object)closestGrabbable == (Object)null) && (Object)(object)closestGrabbable == (Object)null) { noMoreItems = true; return; } if (((NetworkBehaviour)this).IsHost) { if (closestGrabbableDistance.Value < 1.5f && !isHoldingObject) { isCrouched.Value = true; } else { isCrouched.Value = false; } if (closestGrabbableDistance.Value > 0.5f) { __instance.SetDestinationToPosition(((Component)closestGrabbable).transform.position, false); __instance.moveTowardsDestination = true; __instance.movingTowardsTargetPlayer = false; } } if (closestGrabbableDistance.Value > 0.5f && closestGrabbableDistance.Value < 3f) { maskedEnemy.focusOnPosition = ((Component)closestGrabbable).transform.position; maskedEnemy.lookAtPositionTimer = 1.5f; } if (closestGrabbableDistance.Value < 0.9f) { float num = Vector3.Angle(((Component)__instance).transform.forward, ((Component)closestGrabbable).transform.position - ((Component)__instance).transform.position); if (((Component)closestGrabbable).transform.position.y - maskedEnemy.headTiltTarget.position.y < 0f) { num *= -1f; } maskedEnemy.verticalLookAngle = num; heldGrabbable = closestGrabbable; heldGrabbable.parentObject = itemHolder.transform; heldGrabbable.hasHitGround = false; heldGrabbable.isHeld = true; heldGrabbable.isHeldByEnemy = true; heldGrabbable.grabbable = false; isHoldingObject = true; itemDroped = false; heldGrabbable.GrabItemFromEnemy(__instance); } if (closestGrabbableDistance.Value < 1f && !isHoldingObject && ((NetworkBehaviour)this).IsHost) { isCrouched.Value = true; } } public void GrabShotgunItem() { //IL_006a: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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_0223: 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_024f: Unknown result type (might be due to invalid IL or missing references) maskedGoal = "grabshotgunitem"; if (isHoldingObject || noMoreItems) { return; } float num = float.PositiveInfinity; foreach (GrabbableObject allitem in GlobalItemList.Instance.allitems) { if (!(allitem is ShotgunItem)) { continue; } float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)allitem).transform.position); if (!(num2 < num) || !(num2 <= 10f) || allitem.isHeld || allitem.isHeldByEnemy || notGrabClosestItem) { continue; } num = num2; closestGrabbable = allitem; if ((Object)closestGrabbable != (Object)null && (Object)((Component)closestGrabbable).GetComponent() != (Object)null) { itemSystem = ((Component)closestGrabbable).GetComponent(); } if (itemSystem.hidedByMasked) { continue; } if (((NetworkBehaviour)this).IsHost) { if (num2 > 0.5f) { __instance.SetDestinationToPosition(((Component)closestGrabbable).transform.position, true); __instance.moveTowardsDestination = true; __instance.movingTowardsTargetPlayer = false; } else { maskedFocusInt.Value = 0; maskedActivityInt.Value = 2; __instance.moveTowardsDestination = false; } } if (num2 > 0.5f && num2 < 3f) { maskedEnemy.focusOnPosition = ((Component)closestGrabbable).transform.position; maskedEnemy.lookAtPositionTimer = 1.5f; } if (num2 < 0.9f) { float num3 = Vector3.Angle(((Component)__instance).transform.forward, ((Component)closestGrabbable).transform.position - ((Component)__instance).transform.position); if (((Component)closestGrabbable).transform.position.y - maskedEnemy.headTiltTarget.position.y < 0f) { num3 *= -1f; } maskedEnemy.verticalLookAngle = num3; heldGrabbable = closestGrabbable; closestGrabbable.parentObject = itemHolder.transform; closestGrabbable.hasHitGround = false; closestGrabbable.isHeld = true; closestGrabbable.isHeldByEnemy = true; closestGrabbable.grabbable = false; isHoldingObject = true; itemDroped = false; closestGrabbable.GrabItemFromEnemy(__instance); } if (num2 < 4f && !isHoldingObject && maskedPersonality != Personality.Aggressive && ((NetworkBehaviour)this).IsHost) { isCrouched.Value = true; } } } private void FindAndGrabShotgun() { //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0181: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) if (!(closestGrabbable is ShotgunItem) && isHoldingObject && !isDroppedShotgunAvailable) { Plugin.mls.LogInfo((object)"Drop Item!"); dropItem.Value = true; } bool flag = false; foreach (GrabbableObject allitem in GlobalItemList.Instance.allitems) { if (!(allitem is ShotgunItem)) { continue; } flag = true; if (allitem.isHeld) { if (!allitem.isHeldByEnemy) { HandleShotgunHeldByPlayer(); Plugin.mls.LogInfo((object)"Held Shotgun Found!"); isDroppedShotgunAvailable = false; } } else { GrabShotgunItem(); isDroppedShotgunAvailable = true; } } if (!flag) { noMoreItems = true; mustChangeFocus = true; } if (!isHoldingObject || !(closestGrabbable is Shovel)) { return; } foreach (GrabbableObject allitem2 in GlobalItemList.Instance.allitems) { if (allitem2 is ShotgunItem && (Object)allitem2.playerHeldBy != (Object)null) { __instance.SetDestinationToPosition(((Component)allitem2.playerHeldBy).transform.position, true); float num = Vector3.Distance(((Component)this).transform.position, ((Component)allitem2.playerHeldBy).transform.position); maskedEnemy.stopAndStareTimer = 0f; if (num < float.PositiveInfinity && num < 4f) { maskedEnemy.headTiltTarget.LookAt(((Component)allitem2.playerHeldBy).transform); LookAtPos(((Component)allitem2.playerHeldBy).transform.position, 0.2f); } if (num < 3.2f) { UseItem(allitem2.playerHeldBy, num); } else { isRunning.Value = true; } } } } private void HandleShotgunHeldByPlayer() { //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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_012e: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) if (isHoldingObject) { return; } foreach (GrabbableObject allitem in GlobalItemList.Instance.allitems) { if (!(allitem is Shovel)) { continue; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)allitem).transform.position); if (!(num < float.PositiveInfinity) || !(num <= 10f) || allitem.isHeld || allitem.isHeldByEnemy || notGrabClosestItem) { continue; } closestGrabbable = allitem; if ((Object)closestGrabbable != (Object)null && (Object)((Component)closestGrabbable).GetComponent() != (Object)null) { itemSystem = ((Component)closestGrabbable).GetComponent(); } if (itemSystem.hidedByMasked) { continue; } if (((NetworkBehaviour)this).IsHost) { if ((double)num > 0.5) { __instance.SetDestinationToPosition(((Component)closestGrabbable).transform.position, true); __instance.moveTowardsDestination = true; __instance.movingTowardsTargetPlayer = false; } else { maskedFocusInt.Value = 0; maskedActivityInt.Value = 2; __instance.moveTowardsDestination = false; } } if (num > 0.5f && num < 3f) { maskedEnemy.focusOnPosition = ((Component)closestGrabbable).transform.position; maskedEnemy.lookAtPositionTimer = 1.5f; } if (num < 0.9f) { float num2 = Vector3.Angle(((Component)__instance).transform.forward, ((Component)closestGrabbable).transform.position - ((Component)__instance).transform.position); if (((Component)closestGrabbable).transform.position.y - maskedEnemy.headTiltTarget.position.y < 0f) { num2 *= -1f; } maskedEnemy.verticalLookAngle = num2; closestGrabbable.parentObject = itemHolder.transform; closestGrabbable.hasHitGround = false; closestGrabbable.isHeld = true; closestGrabbable.isHeldByEnemy = true; closestGrabbable.grabbable = false; isHoldingObject = true; itemDroped = false; closestGrabbable.GrabItemFromEnemy(__instance); } if (num < 4f && !isHoldingObject && maskedPersonality != Personality.Aggressive && GameNetworkManager.Instance.isHostingGame) { isCrouched.Value = true; } } } private void HandleShotgunNotHeld() { //IL_0043: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_0123: 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_01dc: 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_021f: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) notGrabClosestItem = true; foreach (GrabbableObject allitem in GlobalItemList.Instance.allitems) { if (!(allitem is ShotgunItem)) { continue; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)allitem).transform.position); if (!(num < float.PositiveInfinity) || !(num <= 10f) || allitem.isHeld || allitem.isHeldByEnemy || notGrabClosestItem) { continue; } closestGrabbable = allitem; if ((Object)closestGrabbable != (Object)null && (Object)((Component)closestGrabbable).GetComponent() != (Object)null) { itemSystem = ((Component)closestGrabbable).GetComponent(); } if (itemSystem.hidedByMasked) { continue; } if (((NetworkBehaviour)this).IsHost) { if ((double)num > 0.5) { __instance.SetDestinationToPosition(((Component)closestGrabbable).transform.position, true); __instance.moveTowardsDestination = true; __instance.movingTowardsTargetPlayer = false; } else { maskedFocusInt.Value = 0; maskedActivityInt.Value = 2; __instance.moveTowardsDestination = false; } } if (num < 3f && isHoldingObject && !(closestGrabbable is ShotgunItem)) { dropItem.Value = true; } if (num > 0.5f && num < 3f) { maskedEnemy.focusOnPosition = ((Component)closestGrabbable).transform.position; maskedEnemy.lookAtPositionTimer = 1.5f; } if (num < 0.9f) { float num2 = Vector3.Angle(((Component)__instance).transform.forward, ((Component)closestGrabbable).transform.position - ((Component)__instance).transform.position); if (((Component)closestGrabbable).transform.position.y - maskedEnemy.headTiltTarget.position.y < 0f) { num2 *= -1f; } maskedEnemy.verticalLookAngle = num2; closestGrabbable.parentObject = itemHolder.transform; closestGrabbable.hasHitGround = false; closestGrabbable.isHeld = true; closestGrabbable.isHeldByEnemy = true; closestGrabbable.grabbable = false; isHoldingObject = true; itemDroped = false; closestGrabbable.GrabItemFromEnemy(__instance); } if (num < 4f && !isHoldingObject && maskedPersonality != Personality.Aggressive && ((NetworkBehaviour)this).IsHost) { isCrouched.Value = true; } } } private void findLockerAudio() { //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_0066: 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_00ab: Unknown result type (might be due to invalid IL or missing references) Vector3 value = lockerPosition.Value; maskedGoal = "walking to ships locker (" + ((object)(Vector3)(ref value)).ToString() + ")"; maskedEnemy.lostLOSTimer = 0f; maskedEnemy.stopAndStareTimer = 0f; if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)maskedEnemy).SetDestinationToPosition(lockerPosition.Value, true); ((EnemyAI)maskedEnemy).moveTowardsDestination = true; } if (!lockerReachable) { mustChangeActivity = true; } float num = Vector3.Distance(((Component)agent).transform.position, lockerPosition.Value); if (num <= 2f) { mustChangeFocus = true; mustChangeActivity = true; } } private void findBreakerBox() { //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_0066: Unknown result type (might be due to invalid IL or missing references) Vector3 value = breakerPosition.Value; maskedGoal = "walking to breaker box (" + ((object)(Vector3)(ref value)).ToString() + ")"; maskedEnemy.lostLOSTimer = 0f; maskedEnemy.stopAndStareTimer = 0f; if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)maskedEnemy).SetDestinationToPosition(breakerPosition.Value, false); ((EnemyAI)maskedEnemy).moveTowardsDestination = true; } if (!breakerBoxReachable.Value) { mustChangeActivity = true; } if (breakerBoxDistance <= 10f) { mustChangeFocus = true; mustChangeActivity = true; } } private void findRandomItem() { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0180: 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) GrabbableObject val = null; List list = GlobalItemList.Instance.allitems.Where((GrabbableObject x) => Vector3.Distance(((Component)agent).transform.position, ((Component)x).transform.position) < 50f).ToList(); if (list.Count == 0) { mustChangeFocus = true; mustChangeActivity = true; return; } if ((Object)(object)val == (Object)null) { foreach (GrabbableObject item in list) { if (item.isHeld || item.isHeldByEnemy) { continue; } val = item; break; } } if ((Object)(object)val == (Object)null) { mustChangeFocus = true; mustChangeActivity = true; return; } string[] obj = new string[9] { "walking to ", ((Object)val).name, "(", ((EnemyAI)maskedEnemy).isOutside.ToString(), "/", val.isInFactory.ToString(), "/", null, null }; Vector3 position = ((Component)val).transform.position; obj[7] = ((object)(Vector3)(ref position)).ToString(); obj[8] = ")"; maskedGoal = string.Concat(obj); if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)maskedEnemy).SetDestinationToPosition(((Component)val).transform.position, true); } if (Vector3.Distance(((Component)agent).transform.position, ((Component)val).transform.position) < 1.5f) { mustChangeFocus = true; mustChangeActivity = true; } } private void findApparatus() { //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_0066: Unknown result type (might be due to invalid IL or missing references) Vector3 value = apparatusPosition.Value; maskedGoal = "walking to apparatus (" + ((object)(Vector3)(ref value)).ToString() + ")"; maskedEnemy.lostLOSTimer = 0f; maskedEnemy.stopAndStareTimer = 0f; if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)maskedEnemy).SetDestinationToPosition(apparatusPosition.Value, true); ((EnemyAI)maskedEnemy).moveTowardsDestination = true; } if (!apparatusReachable.Value) { mustChangeActivity = true; } if (apparatusDistance <= 10f) { mustChangeFocus = true; mustChangeActivity = true; } } private EntranceTeleport? selectClosestEntrance(bool isOutside, bool MainEntranceAllowed = true, bool FireExitsAllowed = true) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) EntranceTeleport result = null; if (!MainEntranceAllowed && !FireExitsAllowed) { return null; } float num = 1000f; for (int i = 0; i < entrancesTeleportArray.Length; i++) { if (RoundManagerPatch.networkedInvalidEntrances.Value == null) { Plugin.mls.LogWarning((object)"networkedInvalidEntrances list is null (please report this..)"); continue; } _ = entrancesTeleportArray[i].entranceId; if (false) { Plugin.mls.LogWarning((object)("Entrance Teleport Array @ " + i + " is null (please report this..)")); } else if (!RoundManagerPatch.networkedInvalidEntrances.Value.Contains(entrancesTeleportArray[i].entranceId) && ((entrancesTeleportArray[i].entranceId == 0 && MainEntranceAllowed) || (entrancesTeleportArray[i].entranceId > 0 && FireExitsAllowed))) { float num2 = Vector3.Distance(((Component)agent).transform.position, entrancesTeleportArray[i].entrancePoint.position); if (num2 < num && isOutside == entrancesTeleportArray[i].isEntranceToBuilding) { num = num2; result = entrancesTeleportArray[i]; } } } return result; } private void useEntranceTeleport(EntranceTeleport entrance) { //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_0029: 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_0046: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)entrance == (Object)null)) { Vector3 position = entrance.entrancePoint.position; float num = Vector3.Distance(((Component)agent).transform.position, position); if (((NetworkBehaviour)this).IsHost) { ((EnemyAI)maskedEnemy).SetDestinationToPosition(position, false); } if (num > 4f) { maskedGoal = "going to entrance (" + entrance.entranceId + "/" + ((object)(Vector3)(ref position)).ToString() + ")"; } if (num < 4f) { maskedGoal = "nearing entrance (" + entrance.entranceId + "/" + ((object)(Vector3)(ref position)).ToString() + ")"; maskedEnemy.running = false; } if (num < 2f) { maskedGoal = "reached entrance (" + entrance.entranceId + "/" + ((object)(Vector3)(ref position)).ToString() + ")"; } } } private void enableMirageAudio() { if ((Object)(object)((Component)maskedEnemy).GetComponent() == (Object)null) { Plugin.mls.LogWarning((object)"Mirage AudioStream is NULL - Disabling Mirage Compatibility"); Plugin.mirageIntegrated = false; } else { ((Component)maskedEnemy).GetComponent().OnAudioStream += OnAudioStreamHandler; } } public bool mirageShouldUseWalkies() { //IL_006b: 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_00ad: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; foreach (WalkieTalkie allWalkieTalky in GlobalItemList.Instance.allWalkieTalkies) { if ((Object)(object)allWalkieTalky == (Object)(object)heldGrabbable) { continue; } num++; if (!((GrabbableObject)allWalkieTalky).isBeingUsed) { num2++; continue; } float num5; if (__instance.CheckLineOfSightForPosition(((Component)allWalkieTalky).transform.position, 60f, 60, -1f, (Transform)null)) { num3++; num5 = 0f; continue; } num5 = Vector3.Distance(((Component)agent).transform.position, ((Component)allWalkieTalky).transform.position); if (num5 <= 15f) { num4++; } } int num6 = num - (num3 + num4 + num2); double num7 = ((double)num6 + 0.5) / (double)num * 100.0; if (num6 > 0) { if (Random.RandomRangeInt(0, num6 + 1) == 0) { Plugin.mls.LogInfo((object)("(LI<->Mirage) Masked is not using WalkieTalkie to speak (" + num7 + "% chance to use walkie)")); return false; } Plugin.mls.LogInfo((object)("(LI<->Mirage) Masked is using WalkieTalkie to speak (" + num7 + "% chance to use walkie)")); return true; } Plugin.mls.LogInfo((object)"(LI<->Mirage) Masked is not using WalkieTalkie to speak (No Other Valid Walkies Nearby/TurnedOn)"); return false; } public void OnAudioStreamHandler(object _, AudioStreamEvent audioEvent) { //IL_0061: 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) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.mirageIntegrated || !(heldGrabbable is WalkieTalkie)) { return; } List allWalkieTalkies = GlobalItemList.Instance.allWalkieTalkies; if (((AudioStreamEvent)(ref audioEvent)).IsAudioStartEvent) { if (!mirageShouldUseWalkies()) { mirageClipAllowed = false; return; } mirageClipAllowed = true; AudioStartEvent audioStartEvent = ((AudioStreamEvent)(ref audioEvent)).audioStartEvent; int num = (int)((double)((AudioStartEvent)(ref audioStartEvent)).lengthSamples / (double)((AudioStartEvent)(ref audioStartEvent)).frequency / (double)((AudioStartEvent)(ref audioStartEvent)).channels * 1000.0); if (num == 0) { Plugin.mls.LogWarning((object)"LI<->Mirage Audio Integration -> clip length was 0 (this shouldent normally happen)"); return; } mirageTurnOnWalkie(); mirageActivateWalkieSpeaking(); mirageDeactivateWalkieSpeaking(num); mirageTurnOffWalkie(num); } if (!mirageClipAllowed) { return; } foreach (WalkieTalkie item in allWalkieTalkies) { if ((Object)(object)item == (Object)(object)heldGrabbable || !((GrabbableObject)item).isBeingUsed) { continue; } item.target.volume = 100f; if ((Object)(object)((GrabbableObject)item).playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController && !Plugin.alwaysHearActiveWalkiesIntegrated) { continue; } switch (((AudioStreamEvent)(ref audioEvent)).Tag) { case 0: { AudioStartEvent audioStartEvent2 = ((AudioStreamEvent)(ref audioEvent)).audioStartEvent; item.target.clip = AudioClip.Create("maskedClip", ((AudioStartEvent)(ref audioStartEvent2)).lengthSamples, ((AudioStartEvent)(ref audioStartEvent2)).channels, ((AudioStartEvent)(ref audioStartEvent2)).frequency, false); break; } case 1: { AudioReceivedEvent audioReceivedEvent = ((AudioStreamEvent)(ref audioEvent)).audioReceivedEvent; AudioClip clip = item.target.clip; Samples samples = ((AudioReceivedEvent)(ref audioReceivedEvent)).samples; clip.SetData(((Samples)(ref samples)).data, ((AudioReceivedEvent)(ref audioReceivedEvent)).sampleIndex); if (!item.target.isPlaying) { item.target.Play(); } break; } } } } private void mirageTurnOnWalkie() { WalkieTalkie component = ((Component)heldGrabbable).GetComponent(); if (!((GrabbableObject)component).isBeingUsed) { Plugin.mls.LogDebug((object)"Masked Turning Walkie On!"); ((GrabbableObject)component).isBeingUsed = true; component.EnableWalkieTalkieListening(true); ((Renderer)((GrabbableObject)component).mainObjectRenderer).sharedMaterial = component.onMaterial; ((Behaviour)component.walkieTalkieLight).enabled = true; component.thisAudio.PlayOneShot(component.switchWalkieTalkiePowerOn); } } private void mirageActivateWalkieSpeaking() { Plugin.mls.LogDebug((object)"Masked Started Pressing Speaking Button!"); foreach (WalkieTalkie allWalkieTalky in GlobalItemList.Instance.allWalkieTalkies) { if (((GrabbableObject)allWalkieTalky).isBeingUsed) { allWalkieTalky.thisAudio.PlayOneShot(allWalkieTalky.startTransmissionSFX[Random.Range(0, allWalkieTalky.startTransmissionSFX.Length)]); } } creatureAnimator.SetTrigger("UseWalkie"); } private async void mirageDeactivateWalkieSpeaking(int delay) { await Task.Delay(delay + 1500); Plugin.mls.LogDebug((object)"Masked Stopped Pressing Speaking Button!"); creatureAnimator.ResetTrigger("UseWalkie"); foreach (WalkieTalkie allWalkieTalky2 in GlobalItemList.Instance.allWalkieTalkies) { if (((GrabbableObject)allWalkieTalky2).isBeingUsed) { allWalkieTalky2.thisAudio.PlayOneShot(allWalkieTalky2.stopTransmissionSFX[Random.Range(0, allWalkieTalky2.stopTransmissionSFX.Length)]); } } } private async void mirageTurnOffWalkie(int delay) { await Task.Delay(delay + 2000); WalkieTalkie component = ((Component)heldGrabbable).GetComponent(); if (((GrabbableObject)component).isBeingUsed) { ((GrabbableObject)component).isBeingUsed = false; component.EnableWalkieTalkieListening(false); ((Renderer)((GrabbableObject)component).mainObjectRenderer).sharedMaterial = component.offMaterial; ((Behaviour)component.walkieTalkieLight).enabled = false; component.thisAudio.PlayOneShot(component.switchWalkieTalkiePowerOff); Plugin.mls.LogDebug((object)"Masked Turned Walkie Off!"); } } private void TeleportMaskedEnemyAndSync(Vector3 pos, bool setOutside) { //IL_0017: 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) if (((NetworkBehaviour)this).IsOwner) { maskedEnemy.TeleportMaskedEnemy(pos, setOutside); maskedEnemy.TeleportMaskedEnemyServerRpc(pos, setOutside); } } private Vector3? getTeleportDestination(EntranceTeleport entrance) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)entrance == (Object)null) { return null; } for (int i = 0; i < entrancesTeleportArray.Length; i++) { EntranceTeleport val = entrancesTeleportArray[i]; if (val.entranceId == entrance.entranceId && val.isEntranceToBuilding != entrance.isEntranceToBuilding) { Plugin.mls.LogDebug((object)("SettingEntranceExitPointFor#=" + i + " | EID=" + entrance.entranceId + " | OID=" + val.entranceId + " | IETB?=" + entrance.isEntranceToBuilding)); return val.entrancePoint.position; } } return null; } private void findEntranceTeleports(bool useMainEntrance, bool useFireExits) { selectedEntrance = null; selectedEntrance = selectClosestEntrance(((EnemyAI)maskedEnemy).isOutside, useMainEntrance, useFireExits); if ((Object)(object)selectedEntrance == (Object)null) { maskedGoal = "No Entrance Found, Changing Focus"; Plugin.mls.LogWarning((object)"selectedEntrance was Null, if all entrances are null, this may lead to masked stopping from moving completely."); selectedEntrance = null; maskedFocusInt.Value = 0; maskedActivityInt.Value = 1; } else { useEntranceTeleport(selectedEntrance); } } private void idleMode() { //IL_002a: 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_0073: 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_00a5: 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_015e: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsHost) { return; } if (!idleFarthestNodeSet) { idleFarthestNode = __instance.ChooseFarthestNodeFromPosition(mainEntrancePosition.Value, false, 0, false, 50, -1); idleFarthestNodeSet = true; } if (idleModeVersion.Value == 0) { if (Vector3.Distance(mainEntrancePosition.Value, ((Component)agent).transform.position) <= 5f) { if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(idleFarthestNode.position, false); } __instance.StopSearch(idleSearch, true); idleModeVersion.Value = 1; } else { __instance.StartSearch(agent.nextPosition, idleSearch); } } else if (idleModeVersion.Value == 1 && idleFarthestNodeSet) { if (((NetworkBehaviour)this).IsHost) { __instance.SetDestinationToPosition(idleFarthestNode.position, false); } if (Vector3.Distance(mainEntrancePosition.Value, ((Component)agent).transform.position) >= 80f || Vector3.Distance(idleFarthestNode.position, ((Component)agent).transform.position) <= 5f) { idleModeVersion.Value = 0; } } maskedGoal = "being idle(mode=" + idleModeVersion.Value + ")"; if ((Object)(object)__instance.targetPlayer != (Object)null) { __instance.StopSearch(idleSearch, true); idleFarthestNodeSet = false; mustChangeFocus = true; mustChangeActivity = true; } } private void giftFakeItems() { if (fakeItems == null) { fakeItems = new List(); Transform transform = itemHolder.transform; List allitems = GlobalItemList.Instance.allitems; GameObject val = null; do { GrabbableObject val2 = allitems[Random.Range(0, allitems.Count - 1)]; List list = new List { "ClipboardManual", "StickyNoteItem", "RedLocustHive(Clone)", "LungApparatus(Clone)", "FancyGlass(Clone)", "LaserPointer(Clone)" }; bool flag = true; Plugin.mls.LogError((object)("fakeItem.name = " + ((Object)val2).name)); Plugin.mls.LogError((object)("fakeItem.2handed? = " + val2.itemProperties.twoHanded)); Plugin.mls.LogError((object)("fakeItem.2handedanimation? = " + val2.itemProperties.twoHandedAnimation)); Plugin.mls.LogError((object)("fakeItem.spawnprefab = " + (object)val2.itemProperties.spawnPrefab)); Plugin.mls.LogError((object)("fakeItem.grabanimation = " + val2.itemProperties.grabAnim)); Plugin.mls.LogError((object)("fakeItem.useanimation = " + val2.itemProperties.useAnim)); val = Object.Instantiate(val2.itemProperties.spawnPrefab, transform); } while ((Object)(object)val == (Object)null); fakeItems.Add(val); giftSelfFakeItem(); } } private void spawnFakeItems() { //IL_0033: 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) GrabbableObject val = heldGrabbable; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; bool flag = false; PlayerControllerB[] array = allPlayerScripts; foreach (PlayerControllerB val2 in array) { if (val2.HasLineOfSightToPosition(((Component)maskedEnemy).transform.position, 45f, 60, -1f, -1)) { flag = true; break; } } if (flag) { } int num = 0; num = (((Object)(object)val != (Object)null || maskedFocus == Focus.Items || maskedActivity == Activity.RandomItem) ? ((maskedFocus != Focus.Items || maskedPersonality != Personality.Aggressive) ? (-1) : (-1)) : 0); if (num == -1) { return; } fakeObject = fakeItems[num]; Plugin.mls.LogError((object)("using FakeItem - " + ((Object)fakeObject).name)); fakeObject.transform.localScale = fakeItems[num].transform.localScale; fakeObject.layer = 6; MeshRenderer[] componentsInChildren = fakeObject.GetComponentsInChildren(); foreach (MeshRenderer val3 in componentsInChildren) { if (!((Object)val3).name.Contains("ScanNode") && !((Component)val3).gameObject.CompareTag("DoNotSet") && !((Component)val3).gameObject.CompareTag("InteractTrigger")) { ((Component)val3).gameObject.layer = 6; } } if (val is FlashlightItem) { Light[] componentsInChildren2 = fakeObject.GetComponentsInChildren(); foreach (Light val4 in componentsInChildren2) { ((Behaviour)val4).enabled = false; } } else { Light[] componentsInChildren3 = fakeObject.GetComponentsInChildren(); foreach (Light val5 in componentsInChildren3) { ((Behaviour)val5).enabled = true; } } GrabbableObject componentInChildren = fakeObject.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.playerHeldBy = null; FlashlightItem val6 = (FlashlightItem)(object)((componentInChildren is FlashlightItem) ? componentInChildren : null); if ((Object)(object)val6 != (Object)null) { ((Behaviour)val6.flashlightBulb).enabled = true; ((Behaviour)val6.flashlightBulbGlow).enabled = true; ((Renderer)val6.flashlightMesh).sharedMaterials[1] = val6.bulbLight; } componentInChildren.EnableItemMeshes(((Behaviour)this).enabled); componentInChildren.EnablePhysics(false); ((Object)componentInChildren).name = ((Object)componentInChildren).name.Replace("(Clone)", "(LI-MaskedFake)"); heldGrabbable = componentInChildren; closestGrabbable = componentInChildren; componentInChildren.parentObject = itemHolder.transform; componentInChildren.hasHitGround = false; componentInChildren.isHeld = true; componentInChildren.isHeldByEnemy = true; componentInChildren.grabbable = false; isHoldingObject = true; itemDroped = false; fakeItem = componentInChildren; } Object.DestroyImmediate((Object)(object)fakeObject.GetComponentInChildren()); } private void pocketItem(GrabbableObject item) { if (!item.isPocketed) { isHoldingObject = false; item.isPocketed = true; item.EnableItemMeshes(false); ((Component)item).gameObject.GetComponent().PlayOneShot(item.itemProperties.pocketSFX, 1f); heldGrabbable = null; } } private void unpocketItem(GrabbableObject item) { if (item.isPocketed) { heldGrabbable = item; item.EnableItemMeshes(true); item.isPocketed = false; isHoldingObject = true; } } private void doSpecialPocketingTasks(GrabbableObject item) { bool isPocketed = item.isPocketed; if (item is BeltBagItem) { item.EnableItemMeshes(true); Animator component = ((Component)((Component)item).transform.GetChild(1)).GetComponent(); component.SetBool("Buckled", isPocketed); creatureAnimator.SetBool("HoldBeltbag", !isPocketed); } if (!isPocketed) { item.parentObject = itemHolder.transform; } else if (item is BeltBagItem) { item.parentObject = beltBagHolder.transform; } } private void giftSelfFakeItem() { //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) GameObject val = Object.Instantiate(fakeItems[0], itemHolder.transform.position, Quaternion.identity, itemHolder.transform); GrabbableObject component = val.GetComponent(); int scrapValue = 0; component.SetScrapValue(scrapValue); component.Start(); NetworkObject componentInChildren = val.gameObject.GetComponentInChildren(); componentInChildren.Spawn(true); bool flag = false; if (component.grabbable) { component.InteractItem(); component.parentObject = itemHolder.transform; component.GrabItemOnClient(); } fakeItem = component; isHoldingObject = true; heldGrabbable = fakeItem; } } [HarmonyPatch(typeof(ShotgunItem))] internal class ShotgunItemPatch { public bool GetVar(ref bool ___localClientSendingShootGunRPC) { return ___localClientSendingShootGunRPC; } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] internal class MaskedPlayerEnemyPatch { public static MaskedAIRevamp vd; [HarmonyPrefix] [HarmonyPatch("Awake")] private static void Awake_Prefix(EnemyAI __instance) { //IL_0059: 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_006d: Expected O, but got Unknown //IL_006d: Expected O, but got Unknown if (Plugin.enableMaskedFeatures && !badMaskedPlayerEnemy(__instance)) { vd = ((Component)__instance).gameObject.AddComponent(); if (Plugin.imperiumFound) { ImperiumPatches.maskedVisualization(); } } else if ((Object)((Component)((Component)__instance).transform.GetChild(3).GetChild(0)).GetComponent().runtimeAnimatorController != (Object)Plugin.MapDotRework) { ((Component)((Component)__instance).transform.GetChild(3).GetChild(0)).GetComponent().runtimeAnimatorController = Plugin.MapDotRework; } } public static bool badMaskedPlayerEnemy(EnemyAI __instance) { bool flag = false; switch (((Object)__instance).name) { case "MaskedPlayerEnemy": case "MaskedPlayerEnemy(Clone)": return false; case "GhostPlayer": case "GhostPlayer(Clone)": Plugin.mls.LogError((object)("Ooblterra's GhostPlayer found, disabling MaskedAIRevamp component on " + ((Object)__instance).name + "(" + ((Object)__instance).GetInstanceID() + "). If you have issues with " + ((Object)__instance).name + " (not acting as they were intended.) then report this error, otherwise ignore this error.")); return true; default: Plugin.mls.LogError((object)("Unknown Potentially Unusable MaskedPlayerEnemy found with name: " + ((Object)__instance).name + ". If you have issues with masked, report this error, otherwise ignore this error.")); return false; } } [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPrefix] private static bool OnCollideWithPlayer_Prefix() { return false; } [HarmonyPatch("LookAtPosition")] [HarmonyPrefix] private static bool LookAtPosition_Prefix() { return false; } [HarmonyPatch("LookAtPlayerServerRpc")] [HarmonyPrefix] private static bool LookAtPlayerServerRpc_Prefix() { return false; } [HarmonyPatch("TeleportMaskedEnemyAndSync")] [HarmonyPrefix] private static bool TeleportMaskedEnemyAndSync_Prefix() { return false; } [HarmonyPatch("TeleportMaskedEnemy")] [HarmonyPrefix] private static bool TeleportMaskedEnemy_Prefix(MaskedPlayerEnemy __instance, Vector3 pos, bool setOutside) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0079: 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_005b: 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_0083: 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) __instance.timeAtLastUsingEntrance = Time.realtimeSinceStartup; Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(pos, default(NavMeshHit), 5f, -1); if (((NetworkBehaviour)RoundManager.Instance).IsHost) { ((Behaviour)((EnemyAI)__instance).agent).enabled = false; ((Component)((EnemyAI)__instance).agent).transform.position = navMeshPosition; ((Component)__instance).transform.position = navMeshPosition; ((Behaviour)((EnemyAI)__instance).agent).enabled = true; } else { ((Component)__instance).transform.position = navMeshPosition; } ((EnemyAI)__instance).serverPosition = navMeshPosition; ((EnemyAI)__instance).SetEnemyOutside(setOutside); EntranceTeleport val = findEntranceScript(setOutside, null, pos); if (val.doorAudios != null && val.doorAudios.Length != 0) { if (!val.FindExitPoint()) { return false; } val.PlayAudioAtTeleportPositions(); WalkieTalkie.TransmitOneShotAudio(val.entrancePointAudio, val.doorAudios[0], 1f); } return false; } private static EntranceTeleport findEntranceScript(bool setOutside, int? id = null, Vector3? pos = null) { //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_003a: 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) EntranceTeleport[] array = Object.FindObjectsOfType(false); Vector3? val; for (int i = 0; i < array.Length; i++) { if (pos.HasValue) { Vector3 position = array[i].entrancePoint.position; val = pos; if (val.HasValue && position == val.GetValueOrDefault() && setOutside == array[i].isEntranceToBuilding) { return array[i]; } } if (id.HasValue && array[i].entranceId == id && setOutside == array[i].isEntranceToBuilding) { return array[i]; } } if (array.Length == 0) { Plugin.mls.LogError((object)"No Entrances Exist, returning Null"); return null; } ManualLogSource mls = Plugin.mls; val = pos; mls.LogError((object)("Entrance at " + val.ToString() + " could not be found. Returning first entrance teleport script found.")); return array[0]; } [HarmonyPatch("LookAndRunRandomly")] [HarmonyPrefix] private static bool LookAndRunRandomly_Prefix(MaskedPlayerEnemy __instance, bool onlySetRunning = false) { __instance.randomLookTimer -= ((EnemyAI)__instance).AIIntervalTime; if (!__instance.runningRandomly && !__instance.running) { __instance.staminaTimer = Mathf.Min(6f, __instance.staminaTimer + ((EnemyAI)__instance).AIIntervalTime); } else { __instance.staminaTimer = Mathf.Max(0f, __instance.staminaTimer - ((EnemyAI)__instance).AIIntervalTime); } if (__instance.randomLookTimer <= 0f) { __instance.randomLookTimer = Random.Range(0.7f, 5f); if (!__instance.runningRandomly) { int num = ((!((EnemyAI)__instance).isOutside) ? 20 : 35); if (onlySetRunning) { num /= 3; } if (__instance.staminaTimer >= 5f && Random.Range(0, 100) < num) { __instance.running = true; __instance.runningRandomly = true; ((EnemyAI)__instance).creatureAnimator.SetBool("Running", true); __instance.SetRunningServerRpc(true); return false; } if (onlySetRunning) { return false; } return false; } int num2 = ((!((EnemyAI)__instance).isOutside) ? 30 : 80); if (onlySetRunning) { num2 /= 5; } if (Random.Range(0, 100) > num2 || __instance.staminaTimer <= 0f) { __instance.running = false; __instance.runningRandomly = false; __instance.staminaTimer = -6f; ((EnemyAI)__instance).creatureAnimator.SetBool("Running", false); __instance.SetRunningServerRpc(false); } } return false; } } internal class TerminalPatches { public static class Transmitter { [CompilerGenerated] private sealed class d__2 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string signalMessage; public int seed; public SignalTranslator signalTranslator; private HUDManager 5__1; private Random 5__2; private int 5__3; private float 5__4; private int 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = HUDManager.Instance; if ((Object)(object)5__1 == (Object)null) { Plugin.mls.LogFatal((object)"(Transmitter.DisplaySignalTranslatorMessage) - HudManager is null"); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } goto IL_008d; case 1: <>1__state = -1; goto IL_008d; case 2: <>1__state = -1; 5__3 = 0; goto IL_020a; case 3: <>1__state = -1; 5__5 = 5__3; 5__3 = 5__5 + 1; goto IL_020a; case 4: { <>1__state = -1; 5__1.signalTranslatorAnimator.SetBool("transmitting", false); return false; } IL_020a: if (5__3 < signalMessage.Length && !((Object)(object)signalTranslator == (Object)null) && ((Component)signalTranslator).gameObject.activeSelf) { 5__1.UIAudio.PlayOneShot(signalTranslator.typeTextClips[Random.Range(0, signalTranslator.typeTextClips.Length)]); ((TMP_Text)5__1.signalTranslatorText).text = ((TMP_Text)5__1.signalTranslatorText).text + signalMessage[5__3]; 5__4 = Mathf.Min((float)5__2.Next(-1, 4) * 0.5f, 0f); <>2__current = (object)new WaitForSeconds(0.7f + 5__4); <>1__state = 3; return true; } if ((Object)(object)signalTranslator != (Object)null) { 5__1.UIAudio.PlayOneShot(signalTranslator.finishTypingSFX); signalTranslator.localAudio.Stop(); } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 4; return true; IL_008d: 5__2 = new Random(seed + StartOfRound.Instance.randomMapSeed); 5__1.signalTranslatorAnimator.SetBool("transmitting", true); signalTranslator.localAudio.Play(); 5__1.UIAudio.PlayOneShot(signalTranslator.startTransmissionSFX, 1f); ((TMP_Text)5__1.signalTranslatorText).text = ""; <>2__current = (object)new WaitForSeconds(1.21f); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static bool IsSignalTranslatorUnlocked() { return (from unlockableItem in StartOfRound.Instance.unlockablesList.unlockables where !unlockableItem.alreadyUnlocked where unlockableItem.hasBeenUnlockedByPlayer select unlockableItem).Any((UnlockableItem unlockableItem) => unlockableItem.unlockableName.ToLower().Contains("translator")); } public static void SendMessage(string message) { HUDManager instance = HUDManager.Instance; if ((Object)(object)instance == (Object)null) { Plugin.mls.LogFatal((object)"(Transmitter.SendMessage) - HudManager is null"); return; } SignalTranslator val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { Plugin.mls.LogFatal((object)"(Transmitter.SendMessage) - SignalTranslator is null"); return; } val.timeLastUsingSignalTranslator = Time.realtimeSinceStartup; if (val.signalTranslatorCoroutine != null) { ((MonoBehaviour)instance).StopCoroutine(val.signalTranslatorCoroutine); } message = message.Substring(0, Mathf.Min(message.Length, 10)); Coroutine signalTranslatorCoroutine = ((MonoBehaviour)instance).StartCoroutine(DisplaySignalTranslatorMessage(message, val.timesSendingMessage = Math.Max(val.timesSendingMessage + 1, 1), val)); val.signalTranslatorCoroutine = signalTranslatorCoroutine; } [IteratorStateMachine(typeof(d__2))] private static IEnumerator DisplaySignalTranslatorMessage(string signalMessage, int seed, SignalTranslator signalTranslator) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { signalMessage = signalMessage, seed = seed, signalTranslator = signalTranslator }; } } public static class Teleporter { [CompilerGenerated] private sealed class d__0 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerControllerB playerToTeleport; public ShipTeleporter teleporter; private AudioReverbPresets 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0100: 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_010a: 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) //IL_0114: 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_011e: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)teleporter == (Object)null) { return false; } teleporter.shipTeleporterAudio.PlayOneShot(teleporter.teleporterSpinSFX); if ((Object)(object)playerToTeleport == (Object)null || (Object)(object)playerToTeleport.deadBody != (Object)null) { return false; } teleporter.SetPlayerTeleporterId(playerToTeleport, 1); playerToTeleport.beamUpParticle.Play(); playerToTeleport.movementAudio.PlayOneShot(teleporter.beamUpPlayerBodySFX); <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)playerToTeleport.deadBody == (Object)null) { playerToTeleport.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); 5__1 = Object.FindObjectOfType(); if ((Object)(object)5__1 != (Object)null) { 5__1.audioPresets[3].ChangeAudioReverbForPlayer(playerToTeleport); } playerToTeleport.isInElevator = true; playerToTeleport.isInHangarShipRoom = true; playerToTeleport.isInsideFactory = false; playerToTeleport.averageVelocity = 0f; playerToTeleport.velocityLastFrame = Vector3.zero; playerToTeleport.TeleportPlayer(teleporter.teleporterPosition.position, true, 160f, false, true); teleporter.SetPlayerTeleporterId(playerToTeleport, -1); teleporter.shipTeleporterAudio.PlayOneShot(teleporter.teleporterBeamUpSFX); if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } 5__1 = null; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [IteratorStateMachine(typeof(d__0))] private static IEnumerator BeamUpPlayer(PlayerControllerB? playerToTeleport, ShipTeleporter? teleporter) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__0(0) { playerToTeleport = playerToTeleport, teleporter = teleporter }; } } } } namespace LethalIntelligence.Modules { internal static class Elevator { private static bool elevatorHasRider; internal static bool HandleElevators(MaskedPlayerEnemy maskedEnemy, MaskedAIRevamp mair, string currentMoon, string currentInterior) { //IL_00bb: 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_0082: 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 (ElevatorFirst(maskedEnemy, mair, currentMoon, currentInterior)) { mair.isRunning.Value = false; if (currentInterior == "Level3Flow") { bool flag = true; if ((Object)(object)maskedEnemy.elevatorScript == (Object)null) { maskedEnemy.elevatorScript = Object.FindObjectOfType(); if ((Object)(object)maskedEnemy.elevatorScript == (Object)null) { flag = false; } } if (flag) { if (maskedEnemy.isInElevatorStartRoom) { if (Vector3.Distance(((Component)maskedEnemy).transform.position, maskedEnemy.elevatorScript.elevatorBottomPoint.position) < 10f) { maskedEnemy.isInElevatorStartRoom = false; } } else if (Vector3.Distance(((Component)maskedEnemy).transform.position, maskedEnemy.elevatorScript.elevatorTopPoint.position) < 10f) { maskedEnemy.isInElevatorStartRoom = true; } } return UseElevator(maskedEnemy, mair, currentMoon, currentInterior); } } return true; } private static bool ElevatorFirst(MaskedPlayerEnemy maskedEnemy, MaskedAIRevamp mair, string currentMoon, string currentInterior) { if (mair.maskedFocus != MaskedAIRevamp.Focus.Player) { if (currentInterior == "Level3Flow") { if (!((EnemyAI)maskedEnemy).isOutside && !maskedEnemy.isInElevatorStartRoom && mair.maskedActivity == MaskedAIRevamp.Activity.MainEntrance && mair.maskedFocus != MaskedAIRevamp.Focus.Player) { return true; } if (!((EnemyAI)maskedEnemy).isOutside && maskedEnemy.isInElevatorStartRoom && mair.maskedActivity != MaskedAIRevamp.Activity.MainEntrance && mair.maskedFocus != MaskedAIRevamp.Focus.Player) { return true; } } if (currentMoon == "SynthesisLevel") { } if (!(currentInterior == "OfficeDungeonFlow")) { } } return false; } private static bool CanPathToPoint(MaskedPlayerEnemy maskedAI, Vector3 pos) { //IL_001f: 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_0075: 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_0090: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)maskedAI).pathDistance = 0f; if (((EnemyAI)maskedAI).agent.isOnNavMesh && !((EnemyAI)maskedAI).agent.CalculatePath(pos, ((EnemyAI)maskedAI).path1)) { return false; } if (((EnemyAI)maskedAI).path1 == null || ((EnemyAI)maskedAI).path1.corners.Length == 0) { return false; } if (Vector3.Distance(((EnemyAI)maskedAI).path1.corners[^1], RoundManager.Instance.GetNavMeshPosition(pos, RoundManager.Instance.navHit, 2.7f, ((EnemyAI)maskedAI).agent.areaMask)) > 1.5f) { return false; } return true; } private static bool UseElevator(MaskedPlayerEnemy maskedAI, MaskedAIRevamp mair, string currentMoon, string currentInterior) { //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_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_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) //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_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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_01ff: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0263: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)maskedAI.elevatorScript == (Object)null) { return true; } Vector3 val = -maskedAI.elevatorScript.elevatorInsidePoint.forward * 0.25f; Vector3 val2 = maskedAI.elevatorScript.elevatorInsidePoint.position + val; bool flag = Vector3.Distance(((Component)maskedAI).transform.position, val2) < 1f; if (flag && (!maskedAI.elevatorScript.elevatorFinishedMoving || !maskedAI.elevatorScript.elevatorDoorOpen)) { return false; } Vector3 val3 = (maskedAI.isInElevatorStartRoom ? maskedAI.elevatorScript.elevatorTopPoint.position : maskedAI.elevatorScript.elevatorBottomPoint.position); bool flag2 = ElevatorFirst(maskedAI, mair, currentMoon, currentInterior); if (!flag2 && !flag) { return true; } if (flag) { elevatorHasRider = true; if (flag2 && maskedAI.elevatorScript.elevatorMovingDown != maskedAI.isInElevatorStartRoom) { maskedAI.elevatorScript.PressElevatorButtonOnServer(true); return false; } if (!flag2 && maskedAI.elevatorScript.elevatorFinishedMoving && maskedAI.elevatorScript.elevatorDoorOpen) { if (CanPathToPoint(maskedAI, val3)) { ((EnemyAI)maskedAI).SetDestinationToPosition(val3, false); new WaitForSeconds(2f); elevatorHasRider = false; } return false; } } if (flag2) { if (maskedAI.elevatorScript.elevatorFinishedMoving && maskedAI.elevatorScript.elevatorDoorOpen && maskedAI.elevatorScript.elevatorMovingDown != maskedAI.isInElevatorStartRoom) { if (CanPathToPoint(maskedAI, val2)) { ((EnemyAI)maskedAI).SetDestinationToPosition(val2, false); } return false; } if (Vector3.Distance(((Component)maskedAI).transform.position, val3) < 1f && !elevatorHasRider) { if (maskedAI.elevatorScript.elevatorMovingDown == maskedAI.isInElevatorStartRoom && !maskedAI.elevatorScript.elevatorCalled) { maskedAI.elevatorScript.CallElevator(!maskedAI.isInElevatorStartRoom); } return false; } if (CanPathToPoint(maskedAI, val3)) { ((EnemyAI)maskedAI).SetDestinationToPosition(val3, false); } return false; } Plugin.mls.LogWarning((object)"Masked elevator behavior seems to be stuck in an impossible state"); return false; } } }