Decompiled source of LethalIntelligenceExperimental v0.4.4
BepInEx\plugins\VirusTLNR-LethalIntelligence\LethalIntelligence.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
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.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.4.0")] [assembly: AssemblyInformationalVersion("0.4.4")] [assembly: AssemblyProduct("LethalIntelligence")] [assembly: AssemblyTitle("LethalIntelligence")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.4.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.4")] [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 Bundle; 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.4 has loaded!"); enableMaskedFeatures = ((BaseUnityPlugin)this).Config.Bind<bool>("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<bool>("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<bool>("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<bool>("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<bool>("MaskedPersonalities", "MaskedAggressive", true, "Enables the 'Aggressive' personality for the Masked (at least 1 of these must be TRUE)").Value; enableMaskedStealthy = ((BaseUnityPlugin)this).Config.Bind<bool>("MaskedPersonalities", "MaskedStealthy", true, "Enables the 'Stealthy' personality for the Masked (at least 1 of these must be TRUE)").Value; enableMaskedCunning = ((BaseUnityPlugin)this).Config.Bind<bool>("MaskedPersonalities", "MaskedCunning", true, "Enables the Cunning personality for the Masked (at least 1 of these must be TRUE)").Value; enableMaskedDeceiving = ((BaseUnityPlugin)this).Config.Bind<bool>("MaskedPersonalities", "MaskedDeceiving", true, "Enables the 'Deceiving' personality for the Masked (at least 1 of these must be TRUE)").Value; enableMaskedInsane = ((BaseUnityPlugin)this).Config.Bind<bool>("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<bool>("MaskedAI", "Masked terminal access", true, "Allows Masked to use the terminal.").Value; useTerminalCredit = ((BaseUnityPlugin)this).Config.Bind<bool>("MaskedAI", "Masked uses credits", false, "(Not working rn) Allows Masked to use the terminal to spend credits.").Value; maskedShipDeparture = ((BaseUnityPlugin)this).Config.Bind<bool>("MaskedAI", "Masked pulls the brake lever", true, "Allows Masked to pull the brake lever.").Value; debugModeSetting = ((BaseUnityPlugin)this).Config.Bind<bool>("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<int>("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<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)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.4 finished checking for available dependencies!"); } private void LoadAssets() { try { Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "mapdotanimpack")); } catch (Exception ex) { mls.LogError((object)("Couldn't load asset bundle: " + ex.Message)); return; } try { MapDotRework = Bundle.LoadAsset<RuntimeAnimatorController>("MapDotRework.controller"); MapDotPrefab = Bundle.LoadAsset<GameObject>("MaskedMapDot.prefab"); MaskedAnimController = Bundle.LoadAsset<RuntimeAnimatorController>("MaskedMetarig.controller"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded assets!"); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)("Couldn't load assets: " + ex2.Message)); } } } internal static class PluginInfo { public const string PLUGIN_GUID = "VirusTLNR.LethalIntelligence"; public const string PLUGIN_NAME = "LethalIntelligence"; public const string PLUGIN_VERSION = "0.4.4"; } } namespace LethalIntelligence.Patches { [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { private static float validDistance = 2f; private static EntranceTeleport[] entrancesTeleportArray = null; private static List<EntranceTeleport> eta = new List<EntranceTeleport>(); private static List<string> badCombinations = new List<string>(); private static List<string> goodCombinations = new List<string>(); private static NavMeshPath path; private static int matchesChecked = 0; private static int entrancesChecked = 0; public static List<int> invalidEntrances = new List<int>(); private static Vector3 lastPos; public static LNetworkVariable<List<int>> networkedInvalidEntrances = LNetworkVariable<List<int>>.Connect("networkedInvalidEntrances" + ((NetworkBehaviour)StartOfRound.Instance).NetworkObjectId, (List<int>)null, (LNetworkVariableWritePerms)0, (Action<List<int>, List<int>>)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() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) float timeSinceLevelLoad = Time.timeSinceLevelLoad; while (RoundManager.FindMainEntrancePosition(false, false) == Vector3.zero && Time.timeSinceLevelLoad - timeSinceLevelLoad < 15f) { new WaitForSeconds(1f); } Vector3 exitIDs = RoundManager.FindMainEntrancePosition(false, false); RoundManager.Instance.SetExitIDs(exitIDs); } [HarmonyPostfix] [HarmonyPatch("SpawnSyncedProps")] public static void PathingAccessibilityTestPostfix() { //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: 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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0255: 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_0382: Unknown result type (might be due to invalid IL or missing references) 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(); entrancesChecked = 0; matchesChecked = 0; badCombinations.Clear(); goodCombinations.Clear(); entrancesTeleportArray = Object.FindObjectsOfType<EntranceTeleport>(false); 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."); } } internal class ImperiumPatches { public static void maskedVisualization() { try { Visualization.InsightsFor<MaskedPlayerEnemy>().RegisterInsight("Personality", (Func<MaskedPlayerEnemy, string>)((MaskedPlayerEnemy entity) => $"{((Component)entity).gameObject.GetComponent<MaskedAIRevamp>().maskedPersonality}")).RegisterInsight("Focus", (Func<MaskedPlayerEnemy, string>)((MaskedPlayerEnemy entity) => $"{((Component)entity).gameObject.GetComponent<MaskedAIRevamp>().maskedFocus}")) .RegisterInsight("Activity", (Func<MaskedPlayerEnemy, string>)((MaskedPlayerEnemy entity) => $"{((Component)entity).gameObject.GetComponent<MaskedAIRevamp>().maskedActivity}")) .RegisterInsight("FindPlayer", (Func<MaskedPlayerEnemy, string>)((MaskedPlayerEnemy entity) => (((Object)(object)((Component)entity).gameObject.GetComponent<MaskedAIRevamp>().targetedPlayer != (Object)null) ? ((Object)((Component)entity).gameObject.GetComponent<MaskedAIRevamp>().targetedPlayer).name.ToString() : "null") ?? "")) .RegisterInsight("FindTime", (Func<MaskedPlayerEnemy, string>)((MaskedPlayerEnemy entity) => (((Object)(object)((Component)entity).gameObject.GetComponent<MaskedAIRevamp>().targetedPlayer != (Object)null) ? ((Component)entity).gameObject.GetComponent<MaskedAIRevamp>().followTime.ToString() : "null") ?? "")) .RegisterInsight("Pos", (Func<MaskedPlayerEnemy, string>)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<MaskedAIRevamp>().agent).transform.position; return ((object)(Vector3)(ref position)).ToString().Replace(" ", "") ?? ""; }) .RegisterInsight("Dest", (Func<MaskedPlayerEnemy, string>)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<MaskedAIRevamp>().agent.pathEndPosition; return ((object)(Vector3)(ref pathEndPosition)).ToString().Replace(" ", "") ?? ""; }) .RegisterInsight("Distance", (Func<MaskedPlayerEnemy, string>)((MaskedPlayerEnemy entity) => ((Component)entity).gameObject.GetComponent<MaskedAIRevamp>().currentDestinationDistance.Value.ToString().Replace("F", "") ?? "")) .RegisterInsight("HeadTilt", (Func<MaskedPlayerEnemy, string>)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, string>)((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.4"), (CompatibilityLevel)2, (VersionStrictness)3); } } public class BushSystem : MonoBehaviour { public bool bushWithItem; } public class GlobalItemList : MonoBehaviour { public List<GrabbableObject> allitems = new List<GrabbableObject>(); private List<GrabbableObject> previtems = new List<GrabbableObject>(); public List<WalkieTalkie> allWalkieTalkies = new List<WalkieTalkie>(); 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<SyncConfiguration>(); ((Component)StartOfRound.Instance).gameObject.AddComponent<GlobalItemList>(); } } } 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<CheckItemCollision>(); GlobalItemList.Instance.allitems.Add(__instance); if (__instance is WalkieTalkie) { GlobalItemList.Instance.allWalkieTalkies.Add(((Component)__instance).GetComponent<WalkieTalkie>()); } } } [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<WalkieTalkie>()); } } } } 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 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<float>? currentDestinationDistance; public LNetworkVariable<int>? maskedPersonalityInt; public LNetworkVariable<int>? maskedFocusInt; public LNetworkVariable<int>? maskedActivityInt; public LNetworkVariable<bool>? useWalkie; public LNetworkVariable<bool>? isCrouched; public LNetworkVariable<bool>? isDancing; public LNetworkVariable<bool>? isRunning; public LNetworkVariable<bool>? isJumped; public LNetworkVariable<float>? terminalTimeFloat; public LNetworkVariable<float>? delayMaxTime; public LNetworkVariable<float>? transmitMessageTimer; public LNetworkVariable<float>? enterTerminalCodeTimer; public LNetworkVariable<string>? terminalCode; public LNetworkVariable<int>? maxDanceCount; public LNetworkVariable<bool>? dropItem; public LNetworkVariable<bool> terminalReachable; public LNetworkVariable<bool> breakerBoxReachable; public LNetworkVariable<bool> apparatusReachable; public LNetworkVariable<DateTime>? hostTimeStamp; public LNetworkVariable<ulong>? maskedTargetId; public LNetworkVariable<bool>? maskedInSpecialAnimation; public LNetworkVariable<ulong> closestGrabbableId; public LNetworkVariable<ulong> maskedWalkieId; public LNetworkVariable<float> closestGrabbableDistance; public LNetworkVariable<bool> closestGrabbableReachable; public LNetworkVariable<int> idleModeVersion; public LNetworkVariable<Vector3>? terminalPosition; public LNetworkVariable<Vector3>? breakerPosition; public LNetworkVariable<Vector3>? lockerPosition; public LNetworkVariable<Vector3>? apparatusPosition; public LNetworkVariable<Vector3>? fireExitPosition; public LNetworkVariable<Vector3>? mainEntrancePosition; public static LNetworkVariable<bool> appTrigger; public static LNetworkVariable<bool> signalTranslatorTrigger; public static LNetworkVariable<bool> landDropshipTrigger; public static LNetworkVariable<bool> objectCodeTrigger; public static LNetworkVariable<string> signalTranslatorMessage; public static LNetworkVariable<string> objectCode; private string currentMoon = null; private string currentInterior = null; private List<Personality> useablePersonalities; private 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 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<DateTime>.Connect("hostTimeStamp" + id, DateTime.FromBinary(-1L), (LNetworkVariableWritePerms)0, (Action<DateTime, DateTime>)null); terminalPosition = LNetworkVariable<Vector3>.Connect("terminalPosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action<Vector3, Vector3>)null); breakerPosition = LNetworkVariable<Vector3>.Connect("breakerPosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action<Vector3, Vector3>)null); lockerPosition = LNetworkVariable<Vector3>.Connect("lockerPosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action<Vector3, Vector3>)null); apparatusPosition = LNetworkVariable<Vector3>.Connect("apparatusPosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action<Vector3, Vector3>)null); fireExitPosition = LNetworkVariable<Vector3>.Connect("fireExitPosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action<Vector3, Vector3>)null); mainEntrancePosition = LNetworkVariable<Vector3>.Connect("mainEntrancePosition" + id, Vector3.negativeInfinity, (LNetworkVariableWritePerms)2, (Action<Vector3, Vector3>)null); currentDestinationDistance = LNetworkVariable<float>.Connect("currentDestinationDistance" + id, -1f, (LNetworkVariableWritePerms)2, (Action<float, float>)null); maskedTargetId = LNetworkVariable<ulong>.Connect("maskedTarget" + id, ulong.MaxValue, (LNetworkVariableWritePerms)2, (Action<ulong, ulong>)null); maskedTargetId.OnValueChanged += delegate(ulong oldVal, ulong newVal) { updateTargetPlayer(oldVal, newVal); }; maskedInSpecialAnimation = LNetworkVariable<bool>.Connect("maskedInSpecialAnimation" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); maskedPersonalityInt = LNetworkVariable<int>.Connect("maskedPersonalityInt" + id, -1, (LNetworkVariableWritePerms)2, (Action<int, int>)null); maskedFocusInt = LNetworkVariable<int>.Connect("maskedFocusInt" + id, -1, (LNetworkVariableWritePerms)2, (Action<int, int>)null); maskedActivityInt = LNetworkVariable<int>.Connect("maskedActivityInt" + id, -1, (LNetworkVariableWritePerms)2, (Action<int, int>)null); isCrouched = LNetworkVariable<bool>.Connect("isCrouched" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); isDancing = LNetworkVariable<bool>.Connect("isDancing" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); maxDanceCount = LNetworkVariable<int>.Connect("maxDanceCount" + id, -1, (LNetworkVariableWritePerms)2, (Action<int, int>)null); isRunning = LNetworkVariable<bool>.Connect("isRunning" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); isJumped = LNetworkVariable<bool>.Connect("isJumped" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); terminalTimeFloat = LNetworkVariable<float>.Connect("terminalTimeFloat" + id, -1f, (LNetworkVariableWritePerms)2, (Action<float, float>)null); transmitMessageTimer = LNetworkVariable<float>.Connect("transmitMessageTimer" + id, -1f, (LNetworkVariableWritePerms)2, (Action<float, float>)null); enterTerminalCodeTimer = LNetworkVariable<float>.Connect("enterTerminalCodeTimer" + id, -1f, (LNetworkVariableWritePerms)2, (Action<float, float>)null); delayMaxTime = LNetworkVariable<float>.Connect("delayMaxTime" + id, -1f, (LNetworkVariableWritePerms)2, (Action<float, float>)null); useWalkie = LNetworkVariable<bool>.Connect("useWalkie" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); maskedWalkieId = LNetworkVariable<ulong>.Connect("MaskedWalkieId" + id, ulong.MaxValue, (LNetworkVariableWritePerms)2, (Action<ulong, ulong>)null); closestGrabbableId = LNetworkVariable<ulong>.Connect("closestGrabbableId" + id, ulong.MaxValue, (LNetworkVariableWritePerms)2, (Action<ulong, ulong>)null); closestGrabbableDistance = LNetworkVariable<float>.Connect("closestGrabbableDistance" + id, -1f, (LNetworkVariableWritePerms)2, (Action<float, float>)null); closestGrabbableReachable = LNetworkVariable<bool>.Connect("closestGrabbableReachable" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); dropItem = LNetworkVariable<bool>.Connect("dropItem" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); terminalReachable = LNetworkVariable<bool>.Connect("terminalReachable" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); breakerBoxReachable = LNetworkVariable<bool>.Connect("breakerBoxReachable" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); apparatusReachable = LNetworkVariable<bool>.Connect("apparatusReachable" + id, false, (LNetworkVariableWritePerms)2, (Action<bool, bool>)null); idleModeVersion = LNetworkVariable<int>.Connect("idleModeVersion" + id, 0, (LNetworkVariableWritePerms)2, (Action<int, int>)null); appTrigger = LNetworkVariable<bool>.Connect("appTrigger" + id, false, (LNetworkVariableWritePerms)0, (Action<bool, bool>)null); appTrigger.OnValueChanged += delegate(bool oldVal, bool newVal) { sabotageApparatus(newVal); }; landDropshipTrigger = LNetworkVariable<bool>.Connect("landDropshipTrigger" + id, false, (LNetworkVariableWritePerms)0, (Action<bool, bool>)null); landDropshipTrigger.OnValueChanged += delegate(bool oldVal, bool newVal) { landDropship(newVal); }; signalTranslatorTrigger = LNetworkVariable<bool>.Connect("signalTranslatorTrigger" + id, false, (LNetworkVariableWritePerms)0, (Action<bool, bool>)null); signalTranslatorMessage = LNetworkVariable<string>.Connect("signalTranslatorMessage" + id, (string)null, (LNetworkVariableWritePerms)0, (Action<string, string>)null); signalTranslatorMessage.OnValueChanged += delegate(string oldVal, string newVal) { sendSignalTranslatorMessage(newVal); }; objectCodeTrigger = LNetworkVariable<bool>.Connect("objectCodeTrigger" + id, false, (LNetworkVariableWritePerms)0, (Action<bool, bool>)null); terminalCode = LNetworkVariable<string>.Connect("terminalCode" + id, (string)null, (LNetworkVariableWritePerms)0, (Action<string, string>)null); terminalCode.OnValueChanged += delegate(string oldVal, string newVal) { useObjectCode(newVal); }; } private void selectAvailablePersonalities() { useablePersonalities = new List<Personality>(); 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Expected O, but got Unknown //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02db: 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_02ef: Expected O, but got Unknown //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Expected O, but got Unknown //IL_033d: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_03a7: Unknown result type (might be due to invalid IL or missing references) maskedId = ((Component)this).gameObject.GetComponent<NetworkObject>().NetworkObjectId.ToString(); setupLNAPIvariables(maskedId); selectAvailablePersonalities(); if ((Object)(object)RoundManager.Instance.currentLevel == (Object)null) { return; } if (((Object)RoundManager.Instance.currentLevel).name.ToString() == "CompanyBuildingLevel") { currentMoon = ((Object)RoundManager.Instance.currentLevel).name; currentInterior = "null"; } else { Plugin.mls.LogDebug((object)("NormalMoonWithInteriorFound:- " + ((Object)RoundManager.Instance.currentLevel).name.ToString())); currentMoon = ((Object)RoundManager.Instance.currentLevel).name; currentInterior = ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name.ToString(); } 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<BushSystem>() == (Object)null) { val.AddComponent<BushSystem>(); } } } terminal = Object.FindObjectOfType<Terminal>(); breakerBox = Object.FindObjectOfType<BreakerBox>(); apparatus = Object.FindObjectOfType<LungProp>(); __instance = (EnemyAI)((Component)this).GetComponent<MaskedPlayerEnemy>(); maskedEnemy = ((Component)this).GetComponent<MaskedPlayerEnemy>(); creatureAnimator = ((Component)((Component)this).transform.GetChild(0).GetChild(3)).GetComponent<Animator>(); itemHolder = new GameObject("ItemHolder"); 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); 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<Animator>().runtimeAnimatorController != (Object)Plugin.MapDotRework) { ((Component)((Component)__instance).transform.GetChild(3).GetChild(0)).GetComponent<Animator>().runtimeAnimatorController = Plugin.MapDotRework; } dropship = Object.FindObjectOfType<ItemDropship>(); terminalAccessibleObject = Object.FindObjectsOfType<TerminalAccessibleObject>(); entrancesTeleportArray = Object.FindObjectsOfType<EntranceTeleport>(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_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0346: 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_035f: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: 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_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: 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_0158: 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_017c: 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_01b5: 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)) { 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)) { 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)) { 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_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Expected O, but got Unknown //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Expected O, but got Unknown //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown if ((currentMoon == null || currentInterior == null) && (currentMoon != null || currentInterior != null)) { return; } if (maskedPersonality != 0) { MaskedStatusReport(); } if (((EnemyAI)maskedEnemy).isEnemyDead && isHoldingObject) { maskedGoal = "died, dropping objects!"; dropItem.Value = true; } 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 (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<NavMeshAgent>(ref agent)) { agent = ((Component)this).GetComponent<NavMeshAgent>(); } 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(); 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<GrabbableObject> 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