Decompiled source of HuntedCompany v1.1.2
BepInEx/plugins/HuntedCompany-1.1.2.dll
Decompiled a year 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 BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using GameNetcodeStuff; using HarmonyLib; using HuntedCompany.NetcodePatcher; using HuntedCompany.ai; using HuntedCompany.audio; using HuntedCompany.predator; using HuntedCompany.util; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UIElements.Collections; [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("HuntedCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A vore mod for Lethal Company")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyInformationalVersion("1.1.2+3f28aee9e3ee17d236afca5e8d69b824981ca38a")] [assembly: AssemblyProduct("HuntedCompany")] [assembly: AssemblyTitle("HuntedCompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HuntedCompany { [BepInPlugin("HuntedCompany", "HuntedCompany", "1.1.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("HuntedCompany"); public static ManualLogSource LoggerInst; public static AssetBundle ModAssetBundle; public static GameObject ScavPrefab; public static GameObject TestPrefab; public static List<(EnemyType, GameObject, TerminalNode, TerminalKeyword, Dictionary<string, int>)> Predators = new List<(EnemyType, GameObject, TerminalNode, TerminalKeyword, Dictionary<string, int>)>(); public static Dictionary<string, int> PredOffset = new Dictionary<string, int>(); public static ConfigEntry<int> PredCount; public static ConfigEntry<int> SpawnChance; public static ConfigEntry<bool> Digestion; public static ConfigEntry<bool> StruggleTip; public static ConfigEntry<bool> LeaveImmediately; public static ConfigEntry<bool> StruggleEffect; public static ConfigFile ConfigFile; private static readonly List<string> Moons = new List<string>(12) { "41 Experimentation", "220 Assurance", "56 Vow", "21 Offense", "61 March", "20 Adamance", "85 Rend", "7 Dine", "8 Titan", "68 Artifice", "5 Embrion", "44 Liquidation" }; private void Awake() { LoggerInst = ((BaseUnityPlugin)this).Logger; LoggerInst.LogInfo((object)"Loading Hunted Company! Version 1.1.2"); ModAssetBundle = AssetBundle.LoadFromMemory(Global.GetValue("devout")); TestPrefab = ModAssetBundle.LoadAsset<GameObject>("Assets/Modded/Items/Testing.prefab"); ScavPrefab = ModAssetBundle.LoadAsset<GameObject>("Assets/Modded/Scavenger/Scavenger.prefab"); AddPredator<DevAI>("DeVout", MakeSpawnList(new <>z__ReadOnlyArray<int>(new int[12] { 5, 4, 2, 4, 2, 3, 5, 6, 7, 8, 8, 2 }))); AddPredator<ArchieAI>("Archie", MakeSpawnList(new <>z__ReadOnlyArray<int>(new int[12] { 8, 7, 6, 7, 6, 7, 5, 5, 4, 4, 4, 4 }))); PredCount = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "Predator Count", 1, "The maximum amount of predators spawned"); SpawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "Spawn Chance", 40, "The chance of a predator replacing a vanilla spawn (0 to 100)"); Digestion = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Enable Digestion", true, "Enable the predator digesting their prey. This is per-client, other players will still be digested if they set this to true"); StruggleTip = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Show Struggle Tip", true, "Shows the struggle tip again. This is mostly here cause there isn't a better way to save this lol"); LeaveImmediately = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Leave Immediately", true, "Causes the ship to leave immediately after every non-digestion player is eaten"); StruggleEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Struggle Damage", true, "Causes damage when you struggle. Set to false if you'd like to enjoy the animations without taking damage. Has no effect if Digestion is false."); ConfigFile = ((BaseUnityPlugin)this).Config; ((BaseUnityPlugin)this).Config.Save(); AudioManager.Setup(ModAssetBundle); _harmony.PatchAll(); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } private Dictionary<string, int> MakeSpawnList(IReadOnlyList<int> spawns) { Dictionary<string, int> dictionary = new Dictionary<string, int>(); for (int i = 0; i < spawns.Count; i++) { dictionary.Add(Moons[i], spawns[i]); } return dictionary; } private void AddPredator<T>(string name, Dictionary<string, int> spawnChances) where T : EnemyAI { if (((BaseUnityPlugin)this).Config.Bind<bool>("Predators", name, true, "Toggles whether " + name + " will appear in game. Only the host's choices affect this, so make sure to tell them if there's a predator you absolutely do not want to see.").Value) { EnemyType item = ModAssetBundle.LoadAsset<EnemyType>("Assets/Modded/Preds/" + name + "/Type.asset"); TerminalNode item2 = ModAssetBundle.LoadAsset<TerminalNode>("Assets/Modded/Preds/" + name + "/Log.asset"); TerminalKeyword item3 = ModAssetBundle.LoadAsset<TerminalKeyword>("Assets/Modded/Preds/" + name + "/Keyword.asset"); GameObject val = ModAssetBundle.LoadAsset<GameObject>("Assets/Modded/Preds/" + name + "/Predator.prefab"); val.AddComponent<T>(); Predators.Add((item, val, item2, item3, spawnChances)); EnemyAICollisionDetect[] componentsInChildren = val.GetComponentsInChildren<EnemyAICollisionDetect>(); foreach (EnemyAICollisionDetect val2 in componentsInChildren) { val2.mainScript = (EnemyAI)(object)val.GetComponent<T>(); } } } } [HarmonyPatch(typeof(NetworkManager))] internal class NetworkManagerPatch { [HarmonyPatch("OnEnable")] [HarmonyPostfix] private static void Enable(ref NetworkManager __instance) { foreach (var predator in Plugin.Predators) { GameObject item = predator.Item2; __instance.AddNetworkPrefab(item); } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartGamePatch { public static bool isSetup; [HarmonyPatch("Start")] [HarmonyPrefix] private static void StartGame(ref StartOfRound __instance) { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown Debug.Log((object)("Checking setup: " + isSetup)); if (isSetup) { return; } isSetup = true; SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val in levels) { Debug.Log((object)("Added predators to planet " + val.PlanetName)); Plugin.PredOffset.Add(val.PlanetName, val.Enemies.Count); } foreach (var predator in Plugin.Predators) { var (types, _, _, _, _) = predator; Debug.Log((object)("Setup spawns for " + types.enemyName)); SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = types, rarity = 0 }; SelectableLevel[] levels2 = __instance.levels; foreach (SelectableLevel val2 in levels2) { if (val2.Enemies.All((SpawnableEnemyWithRarity found) => (Object)(object)found.enemyType != (Object)(object)types)) { val2.Enemies.Add(item); } } } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("Update")] [HarmonyPrefix] private static void Update(ref RoundManager __instance) { //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) if (((ButtonControl)Keyboard.current.numpad0Key).wasPressedThisFrame && Keyboard.current.shiftKey.isPressed && Keyboard.current.ctrlKey.isPressed) { int num = 0; foreach (SpawnableEnemyWithRarity enemy in __instance.currentLevel.Enemies) { EnemyType enemyType = enemy.enemyType; if ((Object)(object)enemyType != (Object)null && enemyType.enemyName != null && enemyType.enemyName == "Dev") { break; } num++; } __instance.SpawnEnemyOnServer(((Component)__instance.playersManager.allPlayerScripts[0]).transform.position + ((Component)__instance.playersManager.allPlayerScripts[0].gameplayCamera).transform.forward * 5f, 0f, num); } else if (((ButtonControl)Keyboard.current.numpad1Key).wasPressedThisFrame && Keyboard.current.shiftKey.isPressed && Keyboard.current.ctrlKey.isPressed) { int num2 = 0; foreach (SpawnableEnemyWithRarity enemy2 in __instance.currentLevel.Enemies) { EnemyType enemyType2 = enemy2.enemyType; if ((Object)(object)enemyType2 != (Object)null && enemyType2.enemyName != null && enemyType2.enemyName == "Archie") { break; } num2++; } __instance.SpawnEnemyOnServer(((Component)__instance.playersManager.allPlayerScripts[0]).transform.position + ((Component)__instance.playersManager.allPlayerScripts[0].gameplayCamera).transform.forward * 5f, 0f, num2); } else if (((ButtonControl)Keyboard.current.minusKey).wasPressedThisFrame) { Transform transform = ((Component)__instance.playersManager.allPlayerScripts[0]).transform; transform.position += ((Component)__instance.playersManager.allPlayerScripts[0].gameplayCamera).transform.forward * 10f; } } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("Start")] [HarmonyPrefix] private static void Start(ref Terminal __instance) { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown Terminal val = __instance; int num = val.enemyFiles.Count; foreach (var predator in Plugin.Predators) { GameObject item = predator.Item2; TerminalNode item2 = predator.Item3; TerminalKeyword item3 = predator.Item4; item.GetComponentInChildren<ScanNodeProperties>().creatureScanID = num; item2.creatureFileID = num; TerminalKeyword val2 = (item3.defaultVerb = val.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info")); val.enemyFiles.Add(item2); List<TerminalKeyword> list = val.terminalNodes.allKeywords.ToList(); list.Add(item3); val.terminalNodes.allKeywords = list.ToArray(); List<CompatibleNoun> list2 = val2.compatibleNouns.ToList(); list2.Add(new CompatibleNoun { noun = item3, result = item2 }); val2.compatibleNouns = list2.ToArray(); num++; } } } public static class Global { public static byte[] GetValue(string name) { Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HuntedCompany.resources.huntedcompany"); byte[] array = new byte[manifestResourceStream.Length]; if (manifestResourceStream.Read(array, 0, (int)manifestResourceStream.Length) != manifestResourceStream.Length) { Plugin.LoggerInst.LogError((object)$"Bytes: {manifestResourceStream.Length}"); } return array; } } public static class PluginInfo { public const string PLUGIN_GUID = "HuntedCompany"; public const string PLUGIN_NAME = "HuntedCompany"; public const string PLUGIN_VERSION = "1.1.2"; } } namespace HuntedCompany.util { public static class Animations { public static IEnumerator PlayDefaultEatAnimation(PredAI predator, Food food, int doneState) { ((Renderer)predator.scavenger.GetComponentInChildren<SkinnedMeshRenderer>()).enabled = false; yield return (object)new WaitForSeconds(1.3f); ((EnemyAI)predator).creatureSFX.PlayOneShot(AudioManager.Gulps[Random.Range(0, 10)]); yield return (object)new WaitForSeconds(1.2f); ((EnemyAI)predator).creatureSFX.PlayOneShot(AudioManager.Gulps[Random.Range(0, 10)]); yield return (object)new WaitForSeconds(1.2f); Debug.Log((object)"Switching to third person"); predator.eating.disableLookInput = false; predator.thirdPerson = true; ((Renderer)predator.scavenger.GetComponentInChildren<SkinnedMeshRenderer>()).enabled = true; ((EnemyAI)predator).creatureSFX.PlayOneShot(AudioManager.Gulps[Random.Range(0, 10)]); yield return (object)new WaitForSeconds(1.3f); ((EnemyAI)predator).creatureSFX.PlayOneShot(AudioManager.Gulps[Random.Range(0, 10)]); yield return (object)new WaitForSeconds(1.3f); ((EnemyAI)predator).creatureSFX.PlayOneShot(AudioManager.Gulps[Random.Range(0, 10)]); yield return (object)new WaitForSeconds(1f); predator.thirdPerson = false; if (RoundManager.Instance.playersManager.allPlayerScripts.All((PlayerControllerB player) => !((EnemyAI)predator).PlayerIsTargetable(player, false, false))) { PredAI[] array = Object.FindObjectsOfType<PredAI>(); foreach (PredAI pred in array) { pred.allEaten = true; } } ((EnemyAI)predator).SwitchToBehaviourState((!predator.allEaten) ? doneState : 0); predator.FinishEat(food); } } [HarmonyPatch(typeof(PlayerControllerB))] internal class TeleportPatch { [HarmonyPatch("TeleportPlayer")] [HarmonyPrefix] private static bool TeleportPlayer(ref PlayerControllerB __instance, Vector3 pos, bool withRotation, float rot, bool allowInteractTrigger, bool enableController) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (rot != 160f || allowInteractTrigger || !enableController || !withRotation || !IsTeleporterPosition(pos)) { return true; } Debug.LogWarning((object)("Teleporting triggered for " + (object)__instance)); PredAI[] array = Object.FindObjectsOfType<PredAI>(); foreach (PredAI predAI in array) { Debug.LogWarning((object)("Checking from " + GeneralExtensions.Join<string>(predAI.Bellied.Select((Food food) => food.Player.playerUsername), (Func<string, string>)null, ", "))); ulong id = __instance.playerClientId; Food food2 = predAI.Bellied.Find((Food food) => food.Player.playerClientId == id); if (food2 != null) { Debug.LogWarning((object)("Teleporting " + food2.Player.playerUsername)); predAI.UnbellySync(food2.Player); } } return true; } [HarmonyPatch("TeleportPlayer")] [HarmonyPostfix] private static void FixPostTeleport(ref PlayerControllerB __instance, Vector3 pos, bool withRotation, float rot, bool allowInteractTrigger, bool enableController) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!(rot != 160f || allowInteractTrigger) && enableController && withRotation && IsTeleporterPosition(pos)) { Debug.LogWarning((object)"Teleporter Postfix Entered."); } } private static bool IsTeleporterPosition(Vector3 pos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return StartOfRound.Instance.SpawnedShipUnlockables.Values.Select((GameObject unlockable) => unlockable.GetComponent<ShipTeleporter>()).Any((ShipTeleporter teleporter) => (Object)(object)teleporter != (Object)null && !teleporter.isInverseTeleporter && pos == teleporter.teleporterPosition.position); } } [HarmonyPatch(typeof(ShipTeleporter))] internal class TeleporterFix { [HarmonyPatch("PressTeleportButtonClientRpc")] [HarmonyPostfix] private static void DoBeamUpPlayer(ref ShipTeleporter __instance) { Debug.LogWarning((object)("Button press triggered for " + ((Object)__instance).name)); if (__instance.isInverseTeleporter) { return; } PlayerControllerB targetedPlayer = StartOfRound.Instance.mapScreen.targetedPlayer; PredAI[] array = Object.FindObjectsOfType<PredAI>(); foreach (PredAI predAI in array) { Debug.LogWarning((object)("Checking from " + GeneralExtensions.Join<string>(predAI.Bellied.Select((Food food) => food.Player.playerUsername), (Func<string, string>)null, ", "))); ulong id = targetedPlayer.playerClientId; Food food2 = predAI.Bellied.Find((Food food) => food.Player.playerClientId == id); if (food2 != null && !food2.Savable) { Debug.LogWarning((object)("Cancelling teleporting " + food2.Player.playerUsername)); ((MonoBehaviour)__instance).StopAllCoroutines(); } } } } [HarmonyPatch(typeof(StartOfRound))] internal class RoundEndFix { [HarmonyPatch("OnPlayerDC")] [HarmonyPrefix] private static void Disconnect(ref StartOfRound __instance, int playerObjectNumber, ulong clientId) { Debug.LogWarning((object)("Disconnecting player id " + clientId + " (" + __instance.allPlayerScripts[playerObjectNumber].playerUsername + ")")); PredAI[] array = Object.FindObjectsOfType<PredAI>(); foreach (PredAI predAI in array) { ulong id = clientId; Food food2 = predAI.Bellied.Find((Food food) => food.Player.playerClientId == id); if (food2 != null) { predAI.ShipLeaveCleanupSync(food2, (int)id); } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class DisableKillPatch { [HarmonyPatch("KillPlayer")] [HarmonyPrefix] private static bool TakeOffHelper(ref PlayerControllerB __instance, Vector3 bodyVelocity, bool spawnBody) { PlayerControllerB player = __instance; Debug.LogWarning((object)("TakeOffHelper entered, KillPlayer call on " + ((Object)player).name + " and shipIsLeaving: " + StartOfRound.Instance.shipIsLeaving)); Debug.LogWarning((object)("TakeOffHelper: Player is dead?: " + player.isPlayerDead)); if (player.isPlayerDead) { return false; } if (StartOfRound.Instance.shipIsLeaving) { bool result = false; PredAI[] array = Object.FindObjectsOfType<PredAI>(); foreach (PredAI predAI in array) { if (!predAI.Bellied.All((Food food) => (Object)(object)food.Player != (Object)(object)player)) { Debug.Log((object)(player.playerUsername + " is eaten post round.")); Food food2 = predAI.Bellied.Find((Food food) => (Object)(object)food.Player == (Object)(object)player); predAI.ShipLeaveCleanupSync(food2, (int)food2.Player.playerClientId); result = true; } } return result; } if (!spawnBody || (Object)(object)__instance == (Object)null || (Object)(object)__instance.inAnimationWithEnemy == (Object)null || !__instance.inSpecialInteractAnimation || (Object)(object)((Component)__instance).transform.parent == (Object)null) { return true; } GameObject gameObject = ((Component)((Component)__instance).transform.parent).gameObject; Debug.Log((object)("Stop Kill transform? : " + gameObject.tag)); if ((Object)(object)gameObject.GetComponent<PredAI>() == (Object)null) { return true; } Debug.Log((object)"Stopping kill!"); return false; } [HarmonyPatch("KillPlayer")] [HarmonyPostfix] private static void TakeOffAfterDeath(ref PlayerControllerB __instance, Vector3 bodyVelocity, bool spawnBody) { Debug.LogWarning((object)("Player died postfix: " + __instance.playerUsername + ", is dead: " + __instance.isPlayerDead)); if (__instance.isPlayerDead) { CheckTakeoffServerRPC(__instance); } } [ServerRpc(RequireOwnership = false)] public static void CheckTakeoffServerRPC(PlayerControllerB __instance) { //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown if (!Plugin.LeaveImmediately.Value || StartOfRound.Instance.livingPlayers == 0) { return; } Debug.Log((object)"Endo player check for early takeoff."); bool flag = true; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val == (Object)(object)__instance || val.isPlayerDead || !val.isPlayerControlled) { continue; } bool flag2 = false; PredAI[] array = Object.FindObjectsOfType<PredAI>(); foreach (PredAI predAI in array) { ulong id = val.playerClientId; Food food2 = predAI.Bellied.Find((Food food) => food.Player.playerClientId == id); if (food2 != null) { if (!food2.DigestionValue) { Debug.Log((object)(val.playerUsername + " is eaten with endo enabled.")); flag2 = true; } else { Debug.Log((object)(val.playerUsername + " is eaten with digestion enabled.")); } break; } } if (!flag2) { flag = false; break; } } if (flag && !StartOfRound.Instance.shipIsLeaving) { StartOfRound.Instance.ShipLeaveAutomatically(false); HUDManager.Instance.ReadDialogue((DialogueSegment[])(object)new DialogueSegment[1] { new DialogueSegment { speakerText = "SHIP LEAVING", bodyText = "Ship leaving early due to incapacitation of all workers" } }); } } } [HarmonyPatch] internal static class HuntedProtogenExtensionsVisibility { private static MethodBase _target; [UsedImplicitly] private static bool Prepare() { if (!Chainloader.PluginInfos.Select((KeyValuePair<string, PluginInfo> plugin) => plugin.Value.Metadata).Any((BepInPlugin metadata) => metadata.GUID.Equals("CompanyIssuedProtogen"))) { return false; } Debug.LogWarning((object)"CompanyIssuedProtogen detected, patching for HuntedCompany"); Type type = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "CompanyIssuedProtogen")?.GetType("CompanyIssuedProtogen.Protogen.ProtogenHandler"); if (type == null) { return true; } Debug.LogWarning((object)type); _target = type.GetTypeInfo().GetDeclaredMethod("IsVisible"); return true; } [UsedImplicitly] private static MethodBase TargetMethod() { return _target; } [UsedImplicitly] private static void Prefix(ref Object __instance, ref bool visible) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown PlayerControllerB player = (PlayerControllerB)((object)__instance).GetType().GetTypeInfo().GetField("player") .GetValue(__instance); if (Object.FindObjectsOfType<PredAI>().Any((PredAI pred) => pred.Bellied.Any((Food food) => food.Player.playerClientId == player.playerClientId))) { visible = false; } } } public static class MapManager { public static List<MapNode> Nodes; private static readonly Color[] Colors = (Color[])(object)new Color[6] { Color.red, Color.green, Color.blue, Color.cyan, Color.magenta, Color.red }; private const float Scale = 0.2f; private static readonly Vector3[] Checking = (Vector3[])(object)new Vector3[6] { new Vector3(0f, 0.2f, 0f), new Vector3(0.2f, 0f, 0f), new Vector3(-0.2f, 0f, 0f), new Vector3(0f, -0.2f, 0f), new Vector3(0f, 0f, 0.2f), new Vector3(0f, 0f, -0.2f) }; public static void CreateMap(bool debug = false) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Expected O, but got Unknown //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Expected O, but got Unknown //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) List<MapNode> found = new List<MapNode>(); GameObject[] array = GameObject.FindGameObjectsWithTag("AINode"); foreach (GameObject val in array) { if (debug) { GameObject val2 = Object.Instantiate<GameObject>(Plugin.TestPrefab); val2.transform.position = val.transform.position; found.Add(new MapNode(val2, val2.transform.position)); } else { found.Add(new MapNode(null, val.transform.position)); } } Doorway[] array2 = Object.FindObjectsByType<Doorway>((FindObjectsSortMode)0); foreach (Doorway val3 in array2) { if (val3.HasDoorPrefabInstance) { if (debug) { GameObject val4 = Object.Instantiate<GameObject>(Plugin.TestPrefab); val4.transform.position = ((Component)val3).transform.position; found.Add(new MapNode(val4, val4.transform.position)); } else { found.Add(new MapNode(null, ((Component)val3).transform.position)); } } } for (int i = 0; i < found.Count; i++) { int j; for (j = i + 1; j < found.Count; j++) { if (!(Vector3.Distance(found[i].Position, found[j].Position) > 25f) && !Checking.All((Vector3 adding) => Physics.Linecast(found[i].Position + adding, found[j].Position + adding, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))) { found[i].Connected.Add(found[j]); found[j].Connected.Add(found[i]); } } } foreach (MapNode node in found) { List<MapNode> list = node.Connected.ToList(); foreach (MapNode item in node.Connected.SelectMany((MapNode connected) => connected.Connected.Where((MapNode mutual) => node.Connected.Contains(mutual) && Vector3.Distance(node.Position, mutual.Position) > Vector3.Distance(connected.Position, mutual.Position) && Vector3.Distance(node.Position, connected.Position) < Vector3.Distance(node.Position, mutual.Position)))) { list.Remove(item); } if (!debug) { continue; } LineRenderer val5 = node.Testing.AddComponent<LineRenderer>(); ((Renderer)val5).sortingOrder = 1; ((Renderer)node.Testing.GetComponent<MeshRenderer>()).material = new Material(Shader.Find("Sprites/Default")) { color = Colors[Math.Min(list.Count, 5)] }; ((Renderer)val5).material = new Material(Shader.Find("Sprites/Default")) { color = Colors[Math.Min(list.Count, 5)] }; Vector3[] array3 = (Vector3[])(object)new Vector3[list.Count * 2]; int num = 0; foreach (MapNode item2 in list) { array3[num] = node.Position; array3[num + 1] = item2.Position; num += 2; } val5.positionCount = num; val5.SetPositions(array3.ToArray()); } Nodes = found; } } [HarmonyPatch(typeof(RoundManager))] internal class SmartMapper { [HarmonyPatch("GenerateNewFloor")] [HarmonyPostfix] private static void Update(ref RoundManager __instance) { MapManager.CreateMap(); } } [HarmonyPatch(typeof(EnemyAI))] internal class DisableLineOfSightEnemyAI { [HarmonyPatch("CheckLineOfSightForPlayer")] [HarmonyPostfix] private static void DisableLOSGeneralPlayer(ref PlayerControllerB __result) { if (!((Object)(object)__result != (Object)null)) { return; } bool flag = false; PredAI[] array = Object.FindObjectsOfType<PredAI>(); foreach (PredAI predAI in array) { ulong id = __result.playerClientId; Food food2 = predAI.Bellied.Find((Food food) => food.Player.playerClientId == id); if (food2 != null) { flag = true; break; } } if (flag) { __result = null; } } [HarmonyPatch("CheckLineOfSightForClosestPlayer")] [HarmonyPostfix] private static void DisableLOSClosestPlayer(ref PlayerControllerB __result) { if (!((Object)(object)__result != (Object)null)) { return; } bool flag = false; PredAI[] array = Object.FindObjectsOfType<PredAI>(); foreach (PredAI predAI in array) { ulong id = __result.playerClientId; Food food2 = predAI.Bellied.Find((Food food) => food.Player.playerClientId == id); if (food2 != null) { flag = true; break; } } if (flag) { __result = null; } } } [HarmonyPatch(typeof(NutcrackerEnemyAI))] internal class DisableNutcrackerLineOfSight { [HarmonyPatch("CheckLineOfSightForLocalPlayer")] [HarmonyPostfix] private static void DisableLOS(ref bool __result) { if (__result && (from ai in Object.FindObjectsOfType<PredAI>() let id = GameNetworkManager.Instance.localPlayerController.playerClientId select ai.Bellied.Find((Food food) => food.Player.playerClientId == id)).Any((Food food) => food != null)) { __result = false; } } } [HarmonyPatch(typeof(Turret))] internal class DisableTurretLineOfSight { [HarmonyPatch("CheckForPlayersInLineOfSight")] [HarmonyPostfix] private static void DisableLOS(ref PlayerControllerB __result) { if (!((Object)(object)__result != (Object)null)) { return; } bool flag = false; PredAI[] array = Object.FindObjectsOfType<PredAI>(); foreach (PredAI predAI in array) { ulong id = __result.playerClientId; Food food2 = predAI.Bellied.Find((Food food) => food.Player.playerClientId == id); if (food2 != null) { flag = true; break; } } if (flag) { __result = null; } } } [HarmonyPatch(typeof(RoundManager))] public class SpawnUtil { private static readonly FieldInfo FirstSpawn = typeof(RoundManager).GetField("firstTimeSpawningEnemies", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch("AssignRandomEnemyToVent")] [HarmonyPrefix] private static bool AssignRandomEnemyToVent(ref RoundManager __instance, ref bool __result, EnemyVent vent, float spawnTime) { Debug.Log((object)"Attempting to spawn a creature."); if (__instance.EnemySpawnRandom.NextDouble() * 100.0 > (double)Plugin.SpawnChance.Value) { return true; } if (FirstSpawn.GetValue(__instance).Equals(true)) { Debug.Log((object)"Resetting enemy spawns"); foreach (SpawnableEnemyWithRarity enemy in __instance.currentLevel.Enemies) { enemy.enemyType.numberSpawned = 0; } FirstSpawn.SetValue(__instance, false); } string planetName = __instance.currentLevel.PlanetName; List<int> list = new List<int>(); int num = 0; int num2 = Plugin.PredOffset[__instance.currentLevel.PlanetName]; foreach (var predator in Plugin.Predators) { Dictionary<string, int> item = predator.Item5; int numberSpawned = __instance.currentLevel.Enemies[num2++].enemyType.numberSpawned; num += numberSpawned; if (numberSpawned > 0) { list.Add(0); } else { list.Add(item.TryGetValue(planetName, out var value) ? value : item["8 Titan"]); } } if (num > Plugin.PredCount.Value || list.Sum() == 0) { Debug.Log((object)"Predator count exceeded, spawning a vanilla enemy!"); return true; } Debug.Log((object)("Spawning a predator with the weights " + GeneralExtensions.Join<string>(list.Select((int weight) => weight.ToString() ?? ""), (Func<string, string>)null, ", "))); int num3 = __instance.GetRandomWeightedIndex(list.ToArray(), __instance.EnemySpawnRandom) + Plugin.PredOffset[__instance.currentLevel.PlanetName]; RoundManager obj = __instance; obj.currentEnemyPower += __instance.currentLevel.Enemies[num3].enemyType.PowerLevel; vent.enemyType = __instance.currentLevel.Enemies[num3].enemyType; vent.enemyTypeIndex = num3; vent.occupied = true; vent.spawnTime = spawnTime; vent.SyncVentSpawnTimeClientRpc((int)spawnTime, num3); Debug.Log((object)("Chose predator " + vent.enemyType.enemyName + " in " + spawnTime)); EnemyType enemyType = __instance.currentLevel.Enemies[num3].enemyType; enemyType.numberSpawned++; __result = true; return false; } } } namespace HuntedCompany.predator { public class ArchieAI : PredAI { private readonly AIUtility<ArchieStates> _ai = new AIUtility<ArchieStates>(); public override void Start() { PredData = new PredData(); forcedCameraTransform = ((Component)this).gameObject.transform.Find("Archie/Armature/Camera"); int connectedPlayersAmount = StartOfRound.Instance.connectedPlayersAmount; if (1 == 0) { } TotalTries totalTries = connectedPlayersAmount switch { 1 => new TotalTries(4, 6), 2 => new TotalTries(3, 5), _ => new TotalTries(2, 4), }; if (1 == 0) { } TotalTries totalTries2 = totalTries; AIBehavior<ArchieStates> aIBehavior = _ai.CreateLayer(ArchieStates.Wandering); aIBehavior.AddBehavior(new PlaySound<ArchieStates, bool>(AudioManager.Hungry), new RandomChance(100 * StartOfRound.Instance.livingPlayers)); aIBehavior.AddBehavior(new SwitchStates<ArchieStates, bool>(ArchieStates.Staring), new LookedAt()); aIBehavior.AddBehavior(new MoveTowardsPositionVec<ArchieStates>(), new FindCutOffNode()); aIBehavior.AddBehavior(new MoveTowardsPosition<ArchieStates>(), new FindLineOfSightNode()); aIBehavior.AddBehavior(new MoveTowardsPlayer<ArchieStates>(), new HasTargetPlayer()); aIBehavior.AddBehavior(new Patrol<ArchieStates, bool>()); AIBehavior<ArchieStates> aIBehavior2 = _ai.CreateLayer(ArchieStates.Staring); aIBehavior2.AddBehavior(new SwitchStates<ArchieStates, bool>(ArchieStates.Chasing), new JointConstraint(totalTries2, new Timer(2f))); aIBehavior2.AddBehavior(new SwitchStates<ArchieStates, bool>(ArchieStates.Running), new Timer(2f)); aIBehavior2.AddBehavior(new MoveTowardsPlayer<ArchieStates>(), new HasTargetPlayer()); AIBehavior<ArchieStates> aIBehavior3 = _ai.CreateLayer(ArchieStates.Chasing); aIBehavior3.AddBehavior(new SwitchStates<ArchieStates, bool>(ArchieStates.Running), new Timer()); if (StartOfRound.Instance.livingPlayers > 2) { aIBehavior3.AddBehavior(new SwitchStates<ArchieStates, bool>(ArchieStates.Staring), new LookedAt((int)Math.Ceiling((float)StartOfRound.Instance.livingPlayers * 2f / 3f))); } aIBehavior3.AddBehavior(new MoveTowardsPlayer<ArchieStates>(), new HasTargetPlayer()); aIBehavior3.AddBehavior(new SwitchStates<ArchieStates, bool>(ArchieStates.Wandering)); AIBehavior<ArchieStates> aIBehavior4 = _ai.CreateLayer(ArchieStates.Running); aIBehavior4.AddBehavior(new SwitchStates<ArchieStates, bool>(ArchieStates.Chasing), new LookedAt()); aIBehavior4.AddBehavior(new SwitchStates<ArchieStates, bool>(ArchieStates.Wandering), new Timer(10f)); aIBehavior4.AddBehavior(new RunAway<ArchieStates, bool>()); _ai.Start((EnemyAI)(object)this); ((EnemyAI)this).enemyType = Plugin.Predators[1].Item1; base.Start(); } public override void DoAIInterval() { if ((Object)(object)eating != (Object)null) { ((EnemyAI)this).agent.speed = 0f; return; } _ai.DoAIInterval((EnemyAI)(object)this); if (((EnemyAI)this).currentBehaviourStateIndex == 1) { ((EnemyAI)this).agent.speed = 0f; } else { ((EnemyAI)this).agent.speed = (1f - (float)Bellied.Count / (float)StartOfRound.Instance.livingPlayers + 0.1f) * 2f + 4f; } ((EnemyAI)this).DoAIInterval(); } protected override IEnumerator EatAnimation(Food food) { return Animations.PlayDefaultEatAnimation(this, food, 0); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "ArchieAI"; } } public enum ArchieStates { Wandering, Staring, Chasing, Running } public class DevAI : PredAI { private readonly AIUtility<DevStates> _ai = new AIUtility<DevStates>(); public override void Start() { PredData = new PredData(15, 60f, 60f, 180f, doesDamage: true, singleGut: false, flipCamera: true); forcedCameraTransform = ((Component)this).gameObject.transform.Find("DeVout/DeVoutRetop-Rig.GameRig/Camera"); int connectedPlayersAmount = StartOfRound.Instance.connectedPlayersAmount; if (1 == 0) { } TotalTries totalTries = connectedPlayersAmount switch { 1 => new TotalTries(4, 6), 2 => new TotalTries(3, 5), _ => new TotalTries(2, 4), }; if (1 == 0) { } TotalTries totalTries2 = totalTries; AIBehavior<DevStates> aIBehavior = _ai.CreateLayer(DevStates.Wandering); aIBehavior.AddBehavior(new PlaySound<DevStates, bool>(AudioManager.Hungry), new RandomChance(100 * StartOfRound.Instance.livingPlayers)); aIBehavior.AddBehavior(new SwitchStates<DevStates, bool>(DevStates.Staring), new LookedAt()); aIBehavior.AddBehavior(new MoveTowardsPositionVec<DevStates>(), new FindCutOffNode()); aIBehavior.AddBehavior(new MoveTowardsPosition<DevStates>(), new FindLineOfSightNode()); aIBehavior.AddBehavior(new MoveTowardsPlayer<DevStates>(), new HasTargetPlayer()); aIBehavior.AddBehavior(new Patrol<DevStates, bool>()); AIBehavior<DevStates> aIBehavior2 = _ai.CreateLayer(DevStates.Staring); aIBehavior2.AddBehavior(new SwitchStates<DevStates, bool>(DevStates.Chasing), new JointConstraint(totalTries2, new Timer(2f))); aIBehavior2.AddBehavior(new SwitchStates<DevStates, bool>(DevStates.Running), new Timer(2f)); aIBehavior2.AddBehavior(new MoveTowardsPlayer<DevStates>(), new HasTargetPlayer()); AIBehavior<DevStates> aIBehavior3 = _ai.CreateLayer(DevStates.Chasing); aIBehavior3.AddBehavior(new SwitchStates<DevStates, bool>(DevStates.Running), new Timer()); if (StartOfRound.Instance.livingPlayers > 2) { aIBehavior3.AddBehavior(new SwitchStates<DevStates, bool>(DevStates.Staring), new LookedAt((int)Math.Ceiling((float)StartOfRound.Instance.livingPlayers * 2f / 3f))); } aIBehavior3.AddBehavior(new MoveTowardsPlayer<DevStates>(), new HasTargetPlayer()); aIBehavior3.AddBehavior(new SwitchStates<DevStates, bool>(DevStates.Wandering)); AIBehavior<DevStates> aIBehavior4 = _ai.CreateLayer(DevStates.Running); aIBehavior4.AddBehavior(new SwitchStates<DevStates, bool>(DevStates.Chasing), new LookedAt()); aIBehavior4.AddBehavior(new SwitchStates<DevStates, bool>(DevStates.Wandering), new Timer(10f)); aIBehavior4.AddBehavior(new RunAway<DevStates, bool>()); _ai.Start((EnemyAI)(object)this); ((EnemyAI)this).enemyType = Plugin.Predators[0].Item1; base.Start(); } public override void DoAIInterval() { if ((Object)(object)eating != (Object)null) { ((EnemyAI)this).agent.speed = 0f; return; } _ai.DoAIInterval((EnemyAI)(object)this); if (((EnemyAI)this).currentBehaviourStateIndex == 1) { ((EnemyAI)this).agent.speed = 0f; } else { ((EnemyAI)this).agent.speed = (1f - (float)Bellied.Count / (float)StartOfRound.Instance.livingPlayers + 0.1f) * 2f + 4f; } ((EnemyAI)this).DoAIInterval(); } protected override IEnumerator EatAnimation(Food food) { return Animations.PlayDefaultEatAnimation(this, food, 3); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "DevAI"; } } public enum DevStates { Wandering, Staring, Chasing, Running } public abstract class PredAI : EnemyAI { public bool allEaten; public PlayerControllerB eating; public bool thirdPerson; public GameObject scavenger; public Transform forcedCameraTransform; public readonly List<Food> Bellied = new List<Food>(); protected PredData PredData; private float _eatTime; private Coroutine _eatAnimationCoroutine; private Vector3 _lastPosition; private float _lastTick; private float _lastBellySize; private readonly List<float> _targetWeights = new List<float>(3) { 0f, 0f, 0f }; private readonly List<float> _struggleWeights = new List<float>(3) { 0f, 0f, 0f }; private static readonly int Eat = Animator.StringToHash("Eat"); private static readonly int Walking = Animator.StringToHash("Walking"); public override void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) _lastPosition = ((Component)this).transform.position; base.creatureSFX = ((Component)this).GetComponent<AudioSource>(); base.eye = ((Component)this).transform.Find("Scavenger/CrewMate-GameRig/DEF-spine.006"); ((EnemyAI)this).Start(); } public override void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (((Component)this).transform.position != _lastPosition) { base.creatureAnimator.SetBool(Walking, true); _lastPosition = ((Component)this).transform.position; } else { base.creatureAnimator.SetBool(Walking, false); } float num = 0f; if (Bellied.Any()) { num = 0.25f + Bellied.Sum((Food food) => (float)food.Player.health / 300f); } if ((Object)(object)eating != (Object)null) { float num2 = 0f - Mathf.Pow((Time.time - _eatTime) / 4f - 1.9f, 2f) + 1f; num += Mathf.Min(0f, num2) * (float)eating.health / 300f; } _lastBellySize += (Mathf.Max(0f, Mathf.Min(1f, num)) - _lastBellySize) * Time.deltaTime; base.creatureAnimator.SetLayerWeight(1, _lastBellySize); base.creatureAnimator.SetLayerWeight(2, Mathf.Sin(Time.time) * 0.5f * _lastBellySize); base.creatureAnimator.SetLayerWeight(3, Mathf.Sin(Time.time / 2f) * 0.5f * _lastBellySize); base.creatureAnimator.SetLayerWeight(4, Mathf.Sin(Time.time / 3f) * 0.5f * _lastBellySize); base.creatureAnimator.SetLayerWeight(5, Mathf.Sin(Time.time / 5f) * 0.5f * _lastBellySize); List<(Food, int)> list = new List<(Food, int)>(); foreach (Food item in Bellied) { item.Player.DisablePlayerModel(((Component)item.Player).gameObject, false, false); item.Player.inAnimationWithEnemy = (EnemyAI)(object)this; item.Player.inSpecialInteractAnimation = true; ((Component)item.Player).gameObject.transform.parent = ((Component)this).transform; if (!((Object)(object)item.Player != (Object)(object)StartOfRound.Instance.localPlayerController)) { if (((ButtonControl)Keyboard.current.aKey).wasPressedThisFrame) { list.Add((item, 0)); } else if (((ButtonControl)Keyboard.current.wKey).wasPressedThisFrame || ((ButtonControl)Keyboard.current.sKey).wasPressedThisFrame) { list.Add((item, 1)); } else if (((ButtonControl)Keyboard.current.dKey).wasPressedThisFrame) { list.Add((item, 2)); } } } foreach (var (food2, id) in list) { StruggleSync(food2, id); } for (int i = 0; i < 3; i++) { _targetWeights[i] = Mathf.Min(1f, Mathf.Max(0f, _targetWeights[i] - Time.deltaTime)); _struggleWeights[i] += (_targetWeights[i] - _struggleWeights[i]) * Time.deltaTime; for (int j = 6 + i * 4; j < 8 + i * 4; j++) { base.creatureAnimator.SetLayerWeight(j, Mathf.Min(1f, Mathf.Max(0f, (_struggleWeights[i] + Mathf.Sin(Time.time / (float)j) * 0.1f) * (num * 2f)))); } } ((EnemyAI)this).Update(); SpectateCameraRay(); } public override void OnCollideWithPlayer(Collider other) { ((EnemyAI)this).OnCollideWithPlayer(other); PlayerControllerB playerControllerB = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if (!((Object)(object)playerControllerB == (Object)null) && (!Bellied.Any() || !PredData.SingleGut) && !((Object)(object)eating != (Object)null) && !Bellied.Any((Food item) => item.Player.playerClientId == playerControllerB.playerClientId)) { Debug.Log((object)("Collided with " + playerControllerB.playerUsername)); Bellied.Add(new Food(playerControllerB, PredData.DigestTicks, Plugin.Digestion.Value, Plugin.StruggleEffect.Value)); Debug.Log((object)("Bellied add " + playerControllerB.playerUsername)); StartEat(playerControllerB); } } public void FinishEat(Food food) { if (Plugin.StruggleTip.Value && (Object)(object)food.Player == (Object)(object)StartOfRound.Instance.localPlayerController) { HUDManager.Instance.DisplayTip("Struggling", Plugin.Digestion.Value ? "You can use the movement keys to struggle. This will cause you to digest faster!" : "You can use the movement keys to struggle.", false, false, "LC_Tip1"); Plugin.StruggleTip.Value = false; Plugin.ConfigFile.Save(); } if ((Object)(object)food.Player == (Object)(object)StartOfRound.Instance.localPlayerController) { Debug.Log((object)("Digest coroutine started on " + ((Object)food.Player).name)); food.DigestCoroutine = ((MonoBehaviour)this).StartCoroutine(Digest(food)); } base.creatureAnimator.SetBool(Eat, false); DisableKillPatch.CheckTakeoffServerRPC(null); eating = null; Object.Destroy((Object)(object)scavenger); scavenger = null; base.inSpecialAnimation = false; _eatAnimationCoroutine = null; } private void StartEat(PlayerControllerB food) { Debug.LogWarning((object)("Starting eat " + food.playerUsername)); if (((NetworkBehaviour)food).IsHost || ((NetworkBehaviour)food).IsServer) { Debug.LogWarning((object)(food.playerUsername + " is Host")); StartEatClientRpc((int)food.playerClientId, Plugin.Digestion.Value, Plugin.StruggleEffect.Value); } else { StartEatServerRpc((int)food.playerClientId, Plugin.Digestion.Value, Plugin.StruggleEffect.Value); } } [ServerRpc(RequireOwnership = false)] private void StartEatServerRpc(int id, bool digest, bool struggle) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3372745478u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref digest, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref struggle, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3372745478u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Debug.LogWarning((object)("Server eat " + RoundManager.Instance.playersManager.allPlayerScripts[id].playerUsername + " with Digestion: " + digest)); StartEatClientRpc(id, digest, struggle); } } } private void SpectateCameraRay() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) if (Bellied.All((Food food) => (Object)(object)food.Player != (Object)(object)StartOfRound.Instance.localPlayerController)) { return; } Transform transform = ((Component)this).transform; if ((Object)(object)scavenger != (Object)null) { scavenger.transform.position = transform.position; scavenger.transform.rotation = transform.rotation; } PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; Transform transform2 = ((Component)localPlayerController.gameplayCamera).transform; if ((Object)(object)eating == (Object)(object)localPlayerController && !thirdPerson) { Transform val = forcedCameraTransform; ((Component)localPlayerController.gameplayCamera).transform.position = val.position; Quaternion rotation = transform2.rotation; Quaternion rotation2 = val.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation2)).eulerAngles; if (PredData.FlipCamera) { eulerAngles.x += 180f; eulerAngles.z += 180f; } ((Quaternion)(ref rotation)).eulerAngles = eulerAngles; ((Component)transform2).transform.rotation = rotation; } else { Vector3 val2 = ((Component)this).transform.position + Vector3.up * 2f + -((Component)localPlayerController.gameplayCamera).transform.forward * 0.5f; Ray val3 = default(Ray); ((Ray)(ref val3))..ctor(val2, -transform2.forward); RaycastHit val4 = default(RaycastHit); Vector3 val5 = ((!Physics.Raycast(val3, ref val4, 4.5f, 268437761, (QueryTriggerInteraction)2)) ? ((Ray)(ref val3)).GetPoint(4.5f) : (((Ray)(ref val3)).GetPoint(((RaycastHit)(ref val4)).distance - 0.25f) + ((Component)localPlayerController.gameplayCamera).transform.forward * 0.1f)); ((Component)localPlayerController.gameplayCamera).transform.position = val5; ((Component)localPlayerController.gameplayCamera).transform.rotation = Quaternion.LookRotation(val2 - val5); } } [ClientRpc] private void StartEatClientRpc(int id, bool digest, bool struggle) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3837686542u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref digest, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref struggle, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3837686542u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB val3 = RoundManager.Instance.playersManager.allPlayerScripts[id]; Debug.LogWarning((object)("Client eat " + val3.playerUsername + " with Digestion: " + digest)); StartEatLocal(val3, digest, struggle); } } } private void StartEatLocal(PlayerControllerB food, bool digest, bool struggle) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) _eatTime = Time.time; ((Behaviour)food.usernameCanvas).enabled = false; ((Renderer)food.playerBetaBadgeMesh).enabled = false; food.inAnimationWithEnemy = (EnemyAI)(object)this; ((Renderer)food.thisPlayerModelArms).enabled = false; food.inSpecialInteractAnimation = true; food.disableLookInput = true; ((Component)food).GetComponent<Collider>().enabled = false; ((Component)food).gameObject.transform.parent = ((Component)this).transform; food.DropAllHeldItemsAndSync(); base.targetPlayer = null; base.inSpecialAnimation = true; Debug.Log((object)"Spawned scavenger"); scavenger = Object.Instantiate<GameObject>(Plugin.ScavPrefab); scavenger.transform.position = forcedCameraTransform.parent.position; scavenger.transform.rotation = ((Component)this).gameObject.transform.rotation; ((Component)scavenger.transform.Find("Scavenger")).GetComponent<Animator>().SetBool(Eat, true); SkinnedMeshRenderer component = ((Component)scavenger.transform.Find("Scavenger/CrewMateBody")).GetComponent<SkinnedMeshRenderer>(); ((Renderer)component).material = ((Renderer)food.thisPlayerModel).material; if ((Object)(object)food.currentVoiceChatAudioSource != (Object)null) { ((Component)food.currentVoiceChatAudioSource).transform.parent = ((Component)this).transform; ((Component)food.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 5f; OccludeAudio component2 = ((Component)food.currentVoiceChatAudioSource).GetComponent<OccludeAudio>(); component2.overridingLowPass = true; component2.lowPassOverride = 500f; food.voiceMuffledByEnemy = true; } base.creatureAnimator.SetBool(Eat, true); eating = food; Food food2 = Bellied.Find((Food foodObj) => (Object)(object)foodObj.Player == (Object)(object)food); if (food2 == null) { food2 = new Food(food, PredData.DigestTicks, digest, struggle); Debug.Log((object)("Bellied add LATE " + food2.Player.playerUsername)); Bellied.Add(food2); } Renderer[] componentsInChildren = ((Component)food).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (val.enabled) { food2.Renderers.Add(val); val.enabled = false; } } _eatAnimationCoroutine = ((MonoBehaviour)this).StartCoroutine(EatAnimation(food2)); } private IEnumerator Digest(Food food) { yield return (object)new WaitForSeconds(PredData.UnsavableTime); UnsavableSync(food); float digestTime = Random.Range(PredData.MinDigestTime, PredData.MaxDigestTime); float time = digestTime / (float)PredData.DigestTicks; while (Bellied.Contains(food)) { Debug.Log((object)"Struggle from Digest Coroutine"); Struggle(food, -1); yield return (object)new WaitForSeconds(time); } } private void UnsavableSync(Food food) { if (((NetworkBehaviour)food.Player).IsHost || ((NetworkBehaviour)food.Player).IsServer) { UnsavableClientRpc((int)food.Player.playerClientId); } else { UnsavableServerRpc((int)food.Player.playerClientId); } } [ServerRpc(RequireOwnership = false)] private void UnsavableServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1036626736u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1036626736u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { UnsavableClientRpc(playerId); } } } [ClientRpc] private void UnsavableClientRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2447971697u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2447971697u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { int playerId2 = playerId; Food food = Bellied.Find((Food player) => (int)player.Player.playerClientId == playerId2); if (food != null) { food.Savable = false; } else { Debug.Log((object)("Failed to set Food " + playerId2 + " to unsavable.")); } } } private void StruggleSync(Food food, int id) { if (((NetworkBehaviour)food.Player).IsHost || ((NetworkBehaviour)food.Player).IsServer) { StruggleClientRpc((int)food.Player.playerClientId, id); } else { StruggleServerRpc((int)food.Player.playerClientId, id); } } [ServerRpc(RequireOwnership = false)] private void StruggleServerRpc(int playerId, int id) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2550197627u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, id); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2550197627u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { StruggleClientRpc(playerId, id); } } } [ClientRpc] private void StruggleClientRpc(int playerId, int id) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2978549949u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, id); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2978549949u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } int playerId2 = playerId; Food food = Bellied.Find((Food player) => (int)player.Player.playerClientId == playerId2); if (food != null) { Struggle(food, id); return; } Debug.LogWarning((object)("Failed to find food " + playerId2 + " in belly " + GeneralExtensions.Join<string>(Bellied.Select((Food inner) => inner.Player.playerUsername), (Func<string, string>)null, ", "))); Debug.LogWarning((object)"Searching for belly occupants in ClientRPC"); foreach (Food item in Bellied) { Debug.Log((object)("In belly:" + ((Object)item.Player).name + " (" + playerId2 + ")")); } } public void Struggle(Food food, int struggle) { //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if (!Bellied.Contains(food)) { return; } if (struggle >= 0) { _targetWeights[struggle] = Mathf.Min(_targetWeights[struggle] + 0.25f, 1f); if (_targetWeights[struggle] < 0.5f) { return; } if (PredData.DoesDamage && food.DigestionValue && food.StruggleValue) { if (food.Player.health <= 20 && Time.time > _lastTick) { Debug.LogWarning((object)("Killing " + food.Player.playerUsername)); UnbellyLocal(food.Player); food.Player.KillPlayer(Vector3.zero, false, (CauseOfDeath)0, 0, default(Vector3)); } else if (Time.time > _lastTick) { Debug.Log((object)("Struggle damaging " + food.Player.playerUsername + " to " + (food.Player.health - 10))); food.Player.DamagePlayer(10, false, true, (CauseOfDeath)0, 0, false, default(Vector3)); _lastTick = Time.time + 1f; } } } else if (PredData.DoesDamage && food.DigestionValue) { if (food.Player.health <= 20 + food.Damage || food.TicksLeft == 1) { Debug.LogWarning((object)("Killing " + food.Player.playerUsername)); UnbellySync(food.Player); food.Player.KillPlayer(Vector3.zero, false, (CauseOfDeath)0, 0, default(Vector3)); } else { Debug.Log((object)("Struggle damaging " + food.Player.playerUsername + " to " + (food.Player.health - food.Damage))); food.Player.DamagePlayer(food.Damage, false, true, (CauseOfDeath)0, 0, false, default(Vector3)); food.TicksLeft--; } } if (!((Component)this).GetComponent<AudioSource>().isPlaying) { ((Component)this).GetComponent<AudioSource>().PlayOneShot(AudioManager.Gurgles[Random.Range(0, AudioManager.Gurgles.Count)]); } } public void ShipLeaveCleanupSync(Food food, int id) { if (((NetworkBehaviour)food.Player).IsHost || ((NetworkBehaviour)food.Player).IsServer) { ShipLeaveCleanupClientRpc((int)food.Player.playerClientId, id); } else { ShipLeaveCleanupServerRpc((int)food.Player.playerClientId, id); } } [ServerRpc] private void ShipLeaveCleanupServerRpc(int playerId, int id) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2501333832u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, id); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2501333832u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ShipLeaveCleanupClientRpc(playerId, id); } } [ClientRpc] private void ShipLeaveCleanupClientRpc(int playerId, int id) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2749408218u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, id); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2749408218u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { int playerId2 = playerId; Food food = Bellied.Find((Food player) => (int)player.Player.playerClientId == playerId2); ShipLeaveCleanup(food, id); } } public void ShipLeaveCleanup(Food food, int id) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Debug.LogWarning((object)("Ship leaving or player disconnect, killing " + food.Player.playerUsername)); UnbellyLocal(food.Player); food.Player.KillPlayer(Vector3.zero, false, (CauseOfDeath)0, 0, default(Vector3)); } public void UnbellySync(PlayerControllerB instance) { if (((NetworkBehaviour)instance).IsHost || ((NetworkBehaviour)instance).IsServer) { UnbellyClientRpc((int)instance.playerClientId); } else { UnbellyServerRpc((int)instance.playerClientId); } } [ServerRpc(RequireOwnership = false)] public void UnbellyServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1030010423u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1030010423u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { UnbellyClientRpc(playerId); } } } [ClientRpc] public void UnbellyClientRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(515925232u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 515925232u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId]; if (!((Object)(object)val3 == (Object)null)) { UnbellyLocal(val3); } } } public void UnbellyLocal(PlayerControllerB instance) { //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) Debug.LogWarning((object)("Unbellying " + instance.playerUsername + " for " + GeneralExtensions.Join<string>(from enemy in Object.FindObjectsOfType<PredAI>() select ((Object)enemy).name, (Func<string, string>)null, ", "))); int num = Bellied.FindIndex((Food food) => (Object)(object)food.Player == (Object)(object)instance); if (num == -1) { Debug.LogWarning((object)("Failed to unbelly " + instance.playerUsername + ", not in a belly")); return; } foreach (Renderer item in Bellied[num].Renderers.Where((Renderer componentsInChild) => (Object)(object)componentsInChild != (Object)null)) { item.enabled = true; } if (Bellied[num].DigestCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(Bellied[num].DigestCoroutine); Bellied[num].DigestCoroutine = null; } Debug.Log((object)("Removing player from bellied: " + GeneralExtensions.Join<string>(Bellied.Select((Food player) => player.Player.playerUsername), (Func<string, string>)null, ", "))); Bellied.RemoveAt(num); Debug.Log((object)("After bellied: " + GeneralExtensions.Join<string>(Bellied.Select((Food player) => player.Player.playerUsername), (Func<string, string>)null, ", "))); if ((Object)(object)eating == (Object)(object)instance) { eating = null; if (_eatAnimationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_eatAnimationCoroutine); _eatAnimationCoroutine = null; } Object.DestroyImmediate((Object)(object)scavenger); scavenger = null; base.creatureAnimator.SetBool(Eat, false); } ((Component)instance).GetComponent<Collider>().enabled = true; if ((Object)(object)((Component)instance).gameObject.transform.parent != (Object)null && (Object)(object)((Component)((Component)instance).gameObject.transform.parent).gameObject.GetComponent<PredAI>() != (Object)null) { ((Component)instance).gameObject.transform.parent = null; } ((Behaviour)instance.usernameCanvas).enabled = true; ((Renderer)instance.playerBetaBadgeMesh).enabled = true; instance.inSpecialInteractAnimation = false; instance.inAnimationWithEnemy = null; instance.disableLookInput = false; Transform transform = ((Component)instance.gameplayCamera).transform; transform.rotation = instance.cameraContainerTransform.rotation; transform.position = instance.cameraContainerTransform.position; if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)(object)instance) { ((Renderer)instance.thisPlayerModelArms).enabled = true; } else { instance.DisablePlayerModel(((Component)instance).gameObject, true, true); } if (!((Object)(object)instance.currentVoiceChatAudioSource == (Object)null)) { if ((Object)(object)((Component)instance.currentVoiceChatAudioSource).transform != (Object)null) { ((Component)instance.currentVoiceChatAudioSource).transform.parent = null; } if ((Object)(object)((Component)instance.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>() != (Object)null) { ((Component)instance.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 1f; } OccludeAudio component = ((Component)instance.currentVoiceChatAudioSource).GetComponent<OccludeAudio>(); if ((Object)(object)component != (Object)null) { component.overridingLowPass = false; component.lowPassOverride = 20000f; } instance.voiceMuffledByEnemy = false; } } protected abstract IEnumerator EatAnimation(Food food); protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PredAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3372745478u, new RpcReceiveHandler(__rpc_handler_3372745478)); NetworkManager.__rpc_func_table.Add(3837686542u, new RpcReceiveHandler(__rpc_handler_3837686542)); NetworkManager.__rpc_func_table.Add(1036626736u, new RpcReceiveHandler(__rpc_handler_1036626736)); NetworkManager.__rpc_func_table.Add(2447971697u, new RpcReceiveHandler(__rpc_handler_2447971697)); NetworkManager.__rpc_func_table.Add(2550197627u, new RpcReceiveHandler(__rpc_handler_2550197627)); NetworkManager.__rpc_func_table.Add(2978549949u, new RpcReceiveHandler(__rpc_handler_2978549949)); NetworkManager.__rpc_func_table.Add(2501333832u, new RpcReceiveHandler(__rpc_handler_2501333832)); NetworkManager.__rpc_func_table.Add(2749408218u, new RpcReceiveHandler(__rpc_handler_2749408218)); NetworkManager.__rpc_func_table.Add(1030010423u, new RpcReceiveHandler(__rpc_handler_1030010423)); NetworkManager.__rpc_func_table.Add(515925232u, new RpcReceiveHandler(__rpc_handler_515925232)); } private static void __rpc_handler_3372745478(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int id = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref id); bool digest = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref digest, default(ForPrimitives)); bool struggle = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref struggle, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PredAI)(object)target).StartEatServerRpc(id, digest, struggle); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3837686542(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int id = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref id); bool digest = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref digest, default(ForPrimitives)); bool struggle = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref struggle, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((PredAI)(object)target).StartEatClientRpc(id, digest, struggle); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1036626736(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PredAI)(object)target).UnsavableServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2447971697(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)2; ((PredAI)(object)target).UnsavableClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2550197627(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int id = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)1; ((PredAI)(object)target).StruggleServerRpc(playerId, id); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2978549949(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int id = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)2; ((PredAI)(object)target).StruggleClientRpc(playerId, id); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2501333832(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int id = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)1; ((PredAI)(object)target).ShipLeaveCleanupServerRpc(playerId, id); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2749408218(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int id = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)2; ((PredAI)(object)target).ShipLeaveCleanupClientRpc(playerId, id); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1030010423(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PredAI)(object)target).UnbellyServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_515925232(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)2; ((PredAI)(object)target).UnbellyClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PredAI"; } } public class Food { public readonly PlayerControllerB Player; public readonly List<Renderer> Renderers; public readonly int Damage; public int TicksLeft; public bool Savable; public Coroutine DigestCoroutine; public readonly bool DigestionValue; public readonly bool StruggleValue; public Food(PlayerControllerB target, int ticks, bool digestInput, bool struggleInput) { Player = target; Renderers = new List<Renderer>(); Damage = (target.health - 20) / ticks; TicksLeft = ticks; Savable = true; DigestionValue = digestInput; StruggleValue = struggleInput; base..ctor(); } } public class PredData { public readonly int DigestTicks; public readonly float MinDigestTime; public readonly float MaxDigestTime; public readonly float UnsavableTime; public readonly bool DoesDamage; public readonly bool SingleGut; public readonly bool FlipCamera; public PredData(int digestTicks = 15, float minDigestTime = 60f, float maxDigestTime = 60f, float unsavableTime = 180f, bool doesDamage = true, bool singleGut = false, bool flipCamera = false) { DigestTicks = digestTicks; MinDigestTime = minDigestTime; MaxDigestTime = maxDigestTime; UnsavableTime = unsavableTime; DoesDamage = doesDamage; SingleGut = singleGut; FlipCamera = flipCamera; base..ctor(); } } } namespace HuntedCompany.audio { public static class AudioManager { public static readonly List<AudioClip> Gulps = new List<AudioClip>(); public static readonly List<AudioClip> Gurgles = new List<AudioClip>(); public static readonly List<AudioClip> Hungry = new List<AudioClip>(); public static void Setup(AssetBundle assets) { for (int i = 1; i < 11; i++) { Gulps.Add(assets.LoadAsset<AudioClip>($"Assets/Modded/Audio/Gulps/{i}.wav")); } for (int j = 1; j < 19; j++) { Gurgles.Add(assets.LoadAsset<AudioClip>($"Assets/Modded/Audio/Gurgles/{j}.wav")); } for (int k = 1; k < 12; k++) { Hungry.Add(assets.LoadAsset<AudioClip>($"Assets/Modded/Audio/Hungry/{k}.wav")); } } } } namespace HuntedCompany.ai { public class AIUtility<T> { public readonly Dictionary<int, T> Indexes = new Dictionary<int, T>(); private int _lastID; private readonly Dictionary<T, AIBehavior<T>> _layers = new Dictionary<T, AIBehavior<T>>(); public AIBehavior<T> CreateLayer(T name) { Indexes.Add(_lastID, name); _lastID++; AIBehavior<T> aIBehavior = new AIBehavior<T>(this); _layers.Add(name, aIBehavior); return aIBehavior; } public void Start(EnemyAI monster) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown monster.enemyBehaviourStates = (EnemyBehaviourState[])(object)new EnemyBehaviourState[_layers.Count]; for (int i = 0; i < _layers.Count; i++) { monster.enemyBehaviourStates[i] = new EnemyBehaviourState { parameterString = Indexes[i].ToString(), boolValue = true }; } monster.currentBehaviourState = monster.enemyBehaviourStates[0]; } public void DoAIInterval(EnemyAI monster) { DictionaryExtensions.Get<T, AIBehavior<T>>((IDictionary<T, AIBehavior<T>>)_layers, DictionaryExtensions.Get<int, T>((IDictionary<int, T>)Indexes, monster.currentBehaviourStateIndex, default(T)), (AIBehavior<T>)null).DoAIInterval(monster); } } public class Utils { public static bool WithinSight(Vector3 position, Vector3 forward) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) return Mathf.Acos((position.x * forward.x + position.z * forward.z) / Mathf.Sqrt(Mathf.Pow(position.x, 2f) + Mathf.Pow(position.z, 2f))) <= 30f; } } public class AIBehavior<T> { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private AIUtility<T> <setAI>P; private readonly List<Func<EnemyAI, bool>> _behaviors; public AIBehavior(AIUtility<T> setAI) { <setAI>P = setAI; _behaviors = new List<Func<EnemyAI, bool>>(); base..ctor(); } public void AddBehavior<TE>(IBehavior<T, TE> behavior, IConstraint<TE> constraint = null) { bool setup = false; _behaviors.Add(delegate(EnemyAI monster) { if (!setup) { behavior.Setup(<setAI>P); constraint?.Setup(); setup = true; } if (constraint == null) { if (behavior.Passed(monster)) { return true; } } else { Tuple<TE> tuple = constraint.Passed(monster); if (tuple != null && behavior.Passed(tuple.Item1, mons