Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MIMIC REPO v1.0.3
LivingDouble.dll
Decompiled 2 hours 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using REPOLib.Objects.Sdk; using Strobotnik.Klattersynth; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace LivingDouble; [BepInPlugin("repo.livingdouble", "MIMIC REPO", "1.0.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { internal const string Version = "1.0.3"; internal const string EnemyName = "Living Double"; internal const int CtxAnswer = 5; internal const int CtxDanger = 6; internal const int CtxCalling = 4; internal const int CtxHurt = 7; internal const int CtxDeath = 8; internal const int CtxExtract = 9; private static Plugin instance; internal static ConfigEntry<int> Damage; internal static ConfigEntry<int> Peace; internal static ConfigEntry<int> Health; internal static ConfigEntry<int> MaxPerLevel; internal static ConfigEntry<int> GrabPlayers; internal static ConfigEntry<int> Tier; internal static ConfigEntry<float> ExtraSpawnChance; internal static ConfigEntry<bool> NaturalSpawn; internal static ConfigEntry<bool> VoiceOn; internal static ConfigEntry<bool> RecordSolo; internal static ConfigEntry<bool> KeepBank; internal static ConfigEntry<bool> Verbose; internal static ConfigEntry<bool> Answer; internal static ConfigEntry<bool> UseChat; internal static ConfigEntry<bool> CopyDead; internal static ConfigEntry<string> Hints; internal static ConfigEntry<string> MenuLanguage; private static readonly FieldInfo LevelsDone = AccessTools.Field(typeof(RunManager), "levelsCompleted"); internal static EnemySetup Setup; private Harmony patcher; private SoloMicrophone soloMic; private string runKey; private bool levelActive; private bool extraSpawnDone; private int spawnedThisLevel; private float extraSpawnAt; private float nextContext; private int loggedBank = -1; private static readonly FieldInfo SaveName = AccessTools.Field(typeof(StatsManager), "saveFileCurrent"); private static readonly FieldInfo GrabCamera = AccessTools.Field(typeof(PhysGrabber), "playerCamera"); private static readonly FieldInfo ExtractionOn = AccessTools.Field(typeof(RoundDirector), "extractionPointActive"); private static readonly FieldInfo ExtractionAt = AccessTools.Field(typeof(RoundDirector), "extractionPointCurrent"); private float nextListeners; private static readonly FieldInfo PlayerHealthNow = AccessTools.Field(typeof(PlayerHealth), "health"); private int lastOwnHealth = -1; private int seenFinished; private float hurtAt = -100f; private float ownFinishAt = -100f; private bool ownAnswered; private bool ownJudged = true; private static readonly FieldInfo Talking = AccessTools.Field(typeof(PlayerVoiceChat), "isTalking"); private static readonly FieldInfo VoiceChatOf = AccessTools.Field(typeof(PlayerAvatar), "voiceChat"); private static readonly FieldInfo SpawnedFlag = AccessTools.Field(typeof(EnemyParent), "Spawned"); private static readonly FieldInfo EnemyOf = AccessTools.Field(typeof(EnemyParent), "Enemy"); private readonly Dictionary<PlayerAvatar, bool> wasTalking = new Dictionary<PlayerAvatar, bool>(); internal static float LastHeardOther; internal static float LevelStartedAt; internal static int LevelNumber { get { try { return (!Object.op_Implicit((Object)(object)RunManager.instance) || !(LevelsDone != null)) ? 1 : (Convert.ToInt32(LevelsDone.GetValue(RunManager.instance)) + 1); } catch { return 1; } } } internal static bool AutoDifficulty { get { if (Hints != null) { return string.Equals(Hints.Value, "Auto", StringComparison.OrdinalIgnoreCase); } return true; } } internal static string Difficulty { get { if (!AutoDifficulty) { return Hints.Value; } int levelNumber = LevelNumber; if (levelNumber > 1) { if (levelNumber != 2) { return "Hard"; } return "Medium"; } return "Easy"; } } internal static void Log(string message) { if (Object.op_Implicit((Object)(object)instance)) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } } private void Awake() { //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Expected O, but got Unknown instance = this; Damage = ((BaseUnityPlugin)this).Config.Bind<int>("Encounter", "Damage", 35, "Damage of a single blow; a lone victim can take two in one ambush."); Peace = ((BaseUnityPlugin)this).Config.Bind<int>("Encounter", "MinimumPeaceSeconds", 0, "Extra minimum peaceful time before an unprovoked reveal."); Health = ((BaseUnityPlugin)this).Config.Bind<int>("Encounter", "HitPoints", 200, "Hit points (vanilla Hunter has 250). Standing it still dies to about eight hits; knocked down it takes full damage."); Hints = ((BaseUnityPlugin)this).Config.Bind<string>("Encounter", "HintDifficulty", "Auto", "Auto, Easy, Medium or Hard: how often the mimic slips up. Auto: first level easy, second medium, from the third hard."); MenuLanguage = ((BaseUnityPlugin)this).Config.Bind<string>("Interface", "MenuLanguage", "Auto", "Language of the F8 menu: Auto (system language) or English, Russian, Ukrainian, German, French, Spanish, Portuguese, Polish, Turkish."); Tier = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "DifficultyTier", 2, "1, 2 or 3. Game spawn tier; also sets the orb size dropped on death."); NaturalSpawn = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawning", "NaturalSpawn", false, "Let the game's enemy director pick the mimic like any other enemy."); ExtraSpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("Spawning", "ExtraSpawnChance", 1f, "Chance (0 to 1) per level to add one more mimic on top of the director's pick."); MaxPerLevel = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "MaxPerLevel", 1, "Upper limit for the extra spawn (0 to 3)."); GrabPlayers = ((BaseUnityPlugin)this).Config.Bind<int>("Body", "PlayersToLiftKnockedDown", 2, "How many players it takes to lift the knocked-down mimic (1 to 4); one player can still drag it."); VoiceOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Voice", "Enabled", true, "Allow local capture and playback of mimic speech."); RecordSolo = ((BaseUnityPlugin)this).Config.Bind<bool>("Voice", "RecordSoloMicrophone", true, "Replay local microphone phrases during solo levels."); KeepBank = ((BaseUnityPlugin)this).Config.Bind<bool>("Voice", "KeepUntilRunEnds", false, "Preserve phrases across levels in the same run."); Answer = ((BaseUnityPlugin)this).Config.Bind<bool>("Voice", "AnswerWhenSpokenTo", true, "Reply with a recorded phrase shortly after a nearby player stops talking."); UseChat = ((BaseUnityPlugin)this).Config.Bind<bool>("Voice", "UseChatLines", true, "Repeat lines a player typed in text chat, in their TTS voice, when no recording is available."); CopyDead = ((BaseUnityPlugin)this).Config.Bind<bool>("Encounter", "CopyDeadPlayers", true, "Some time after a player dies, an unseen mimic takes their look and voice (multiplayer)."); ConfigEntry<int> bankSize = ((BaseUnityPlugin)this).Config.Bind<int>("Voice", "PhraseBankLines", 60, "Maximum phrases kept per player (30 to 60), short cut-out words included (up to 20)."); Verbose = ((BaseUnityPlugin)this).Config.Bind<bool>("Diagnostics", "Verbose", false, "Log extra details."); ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>("Diagnostics", "ConfigVersion", 0, "Internal: settings migration marker. Do not change."); if (val.Value < 1) { val.Value = 1; ExtraSpawnChance.Value = 1f; if (MaxPerLevel.Value < 1) { MaxPerLevel.Value = 1; } ((BaseUnityPlugin)this).Config.Save(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Living Double: spawn settings reset to one mimic per level (old config)."); } if (val.Value < 2) { val.Value = 2; if (string.Equals(Hints.Value, "Medium", StringComparison.OrdinalIgnoreCase)) { Hints.Value = "Auto"; } ((BaseUnityPlugin)this).Config.Save(); } VoiceMemory.SetLimit(bankSize.Value); bankSize.SettingChanged += delegate { VoiceMemory.SetLimit(bankSize.Value); }; VoiceOn.SettingChanged += delegate { VoiceMemory.Reset(); VoiceMemory.Forget(); soloMic.Stop(); }; ((Component)this).gameObject.AddComponent<ModMenu>(); soloMic = new SoloMicrophone(((BaseUnityPlugin)this).Logger); patcher = new Harmony("repo.livingdouble"); patcher.PatchAll(typeof(Plugin).Assembly); SceneManager.activeSceneChanged += delegate { LevelEnded(); }; try { RegisterEnemy(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Living Double could not build its enemy: " + ex)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Living Double 1.0.3 ready"); } private void OnDestroy() { if (patcher != null) { patcher.UnpatchSelf(); } } private void RegisterEnemy() { GameObject val = MimicTemplate.Build(((BaseUnityPlugin)this).Logger); if (!Object.op_Implicit((Object)(object)val)) { return; } Setup = ScriptableObject.CreateInstance<EnemySetup>(); ((Object)Setup).name = "Enemy - Living Double"; Setup.spawnObjects = new List<PrefabRef>(); EnemyContent val2 = ScriptableObject.CreateInstance<EnemyContent>(); ((Object)val2).name = "Living Double"; AccessTools.Field(typeof(EnemyContent), "_setup").SetValue(val2, Setup); AccessTools.Field(typeof(EnemyContent), "_spawnObjects").SetValue(val2, new List<GameObject> { val }); if (NaturalSpawn.Value) { Enemies.RegisterEnemy(val2); return; } PrefabRef val3 = NetworkPrefabs.RegisterNetworkPrefab("Enemies/" + ((Object)val).name, val); if (val3 != null) { Setup.spawnObjects.Add(val3); } } private void LevelEnded() { soloMic.Stop(); VoiceMemory.Reset(); DeathCapture.Deaths.Clear(); if (!KeepBank.Value) { VoiceMemory.KeepBest(); ChatMemory.Clear(); } levelActive = (extraSpawnDone = false); spawnedThisLevel = 0; } internal static void SaveSettings() { if (Object.op_Implicit((Object)(object)instance)) { ((BaseUnityPlugin)instance).Config.Save(); if (instance.levelActive) { instance.extraSpawnDone = false; instance.extraSpawnAt = Mathf.Min(instance.extraSpawnAt, Time.time + 5f); } ((BaseUnityPlugin)instance).Logger.LogInfo((object)("Settings changed in game: difficulty " + Hints.Value + ", mimics " + MaxPerLevel.Value + ", voice " + VoiceOn.Value + ", answers " + Answer.Value + ", damage " + Damage.Value + ", health " + Health.Value)); } } private void Update() { if (Object.op_Implicit((Object)(object)RunManager.instance) && SemiFunc.IsMainMenu() && runKey != null) { VoiceMemory.Forget(); ChatMemory.Clear(); PlayStyle.Clear(); runKey = null; } if (!Object.op_Implicit((Object)(object)RunManager.instance) || !Object.op_Implicit((Object)(object)LevelGenerator.Instance) || !SemiFunc.LevelGenDone() || !SemiFunc.RunIsLevel()) { if (levelActive) { LevelEnded(); } return; } if (!levelActive) { levelActive = true; LevelStartedAt = Time.time; try { ((BaseUnityPlugin)this).Config.Reload(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Config reload failed: " + ex.Message)); } string text = ((SemiFunc.IsMultiplayer() && PhotonNetwork.CurrentRoom != null) ? PhotonNetwork.CurrentRoom.Name : "solo") + "/" + ((Object.op_Implicit((Object)(object)StatsManager.instance) && SaveName != null) ? (SaveName.GetValue(StatsManager.instance) as string) : ""); if (text != runKey) { VoiceMemory.Forget(); ChatMemory.Clear(); runKey = text; } extraSpawnAt = Time.time + 25f; } bool flag = SemiFunc.IsMultiplayer(); VoiceMemory.Enabled = VoiceOn.Value && (flag || RecordSolo.Value); if (!flag && RecordSolo.Value && VoiceOn.Value) { soloMic.Tick(MimicEnemy.AnySpeaking); } CaptureContext(); if (SemiFunc.IsMasterClientOrSingleplayer()) { PlayStyle.Sample(); } int count = VoiceMemory.Count; if (count != loggedBank) { loggedBank = count; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Voice bank: " + VoiceMemory.Summary)); } if (!extraSpawnDone && Time.time >= extraSpawnAt && SemiFunc.IsMasterClientOrSingleplayer()) { float num = extraSpawnAt; extraSpawnDone = ExtraSpawn(); if (extraSpawnAt == num) { extraSpawnAt = Time.time + 3f; } } } private bool ExtraSpawn() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Setup == (Object)null || Setup.spawnObjects.Count == 0) { return false; } int num = Mathf.Clamp(MaxPerLevel.Value, 0, 3); int num2 = 0; foreach (MimicEnemy item in MimicEnemy.All) { if (Object.op_Implicit((Object)(object)item)) { num2++; } } num2 = Mathf.Max(num2, spawnedThisLevel); if (num2 >= num || ExtraSpawnChance.Value <= 0f) { return true; } if (spawnedThisLevel == 0 && ExtraSpawnChance.Value < 1f && Random.value >= ExtraSpawnChance.Value) { return true; } PlayerAvatar val = PlayerAvatar.instance; if (!Object.op_Implicit((Object)(object)val)) { return false; } LevelPoint val2 = SemiFunc.LevelPointGetPlayerDistance(((Component)val).transform.position, 20f, 45f, false); if (!Object.op_Implicit((Object)(object)val2)) { val2 = SemiFunc.LevelPointGet(((Component)val).transform.position, 15f, 999f); } if (!Object.op_Implicit((Object)(object)val2)) { return false; } List<EnemyParent> list = Enemies.SpawnEnemy(Setup, ((Component)val2).transform.position, Quaternion.identity, false); bool flag = list != null && list.Count > 0; if (flag) { spawnedThisLevel++; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Mimic spawn " + (flag ? ("placed (" + Mathf.Max(num2 + 1, spawnedThisLevel) + " of " + num + ")") : "failed"))); if (flag && Mathf.Max(num2 + 1, spawnedThisLevel) < num) { extraSpawnAt = Time.time + Random.Range(20f, 40f); return false; } return flag; } private static void UpdateListeners(PlayerAvatar me) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) List<int> list = new List<int>(); foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (Object.op_Implicit((Object)(object)item) && (Object)(object)item != (Object)(object)me && MimicEnemy.Living(item) && Object.op_Implicit((Object)(object)item.photonView) && item.photonView.Owner != null && Vector3.Distance(((Component)item).transform.position, ((Component)me).transform.position) < 15f) { list.Add(item.photonView.OwnerActorNr); } } VoiceMemory.Listeners = list.ToArray(); } internal static bool SomeoneJustDied() { foreach (KeyValuePair<int, float> death in DeathCapture.Deaths) { if (Time.time - death.Value < 8f) { return true; } } return false; } private static bool HeadingOut(PlayerAvatar me) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.EnemyDirectorEndingHeadToTruck()) { return true; } RoundDirector val = RoundDirector.instance; if (!Object.op_Implicit((Object)(object)val) || ExtractionOn == null || !(bool)ExtractionOn.GetValue(val)) { return false; } object? value = ExtractionAt.GetValue(val); ExtractionPoint val2 = (ExtractionPoint)((value is ExtractionPoint) ? value : null); if (Object.op_Implicit((Object)(object)val2)) { return Vector3.Distance(((Component)val2).transform.position, ((Component)me).transform.position) < 10f; } return false; } private void CaptureContext() { //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)PlayerAvatar.instance)) { return; } PlayerAvatar val = PlayerAvatar.instance; if (VoiceMemory.Finished != seenFinished) { seenFinished = VoiceMemory.Finished; ownFinishAt = Time.time; ownAnswered = false; ownJudged = false; } if (!ownJudged && !ownAnswered && Time.time - ownFinishAt > 4f && Time.time - ownFinishAt < 6f && !VoiceMemory.Talking) { ownJudged = true; if (SemiFunc.IsMultiplayer()) { VoiceMemory.MarkLastUnanswered(); } } foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (Object.op_Implicit((Object)(object)item) && !((Object)(object)item == (Object)(object)val)) { object? value = VoiceChatOf.GetValue(item); PlayerVoiceChat val2 = (PlayerVoiceChat)((value is PlayerVoiceChat) ? value : null); bool flag = Object.op_Implicit((Object)(object)val2) && Talking != null && (bool)Talking.GetValue(val2); bool value2; bool flag2 = wasTalking.TryGetValue(item, out value2); bool flag3 = Vector3.Distance(((Component)item).transform.position, ((Component)val).transform.position) < 20f; if (flag2 && value2 && !flag && flag3) { LastHeardOther = Time.time; } if (flag2 && !value2 && flag && flag3 && Time.time - ownFinishAt < 2.5f) { VoiceMemory.MarkLastAnswered(Object.op_Implicit((Object)(object)item.photonView) ? item.photonView.OwnerActorNr : 0); ownAnswered = true; } if (flag2 && !value2 && flag && flag3) { ownAnswered = ownAnswered || Time.time - ownFinishAt < 4f; } wasTalking[item] = flag; } } PlayerHealth playerHealth = val.playerHealth; if (Object.op_Implicit((Object)(object)playerHealth) && PlayerHealthNow != null) { int num = (int)PlayerHealthNow.GetValue(playerHealth); if (lastOwnHealth >= 0 && num < lastOwnHealth) { hurtAt = Time.time; } lastOwnHealth = num; } if (Time.time - hurtAt < 2.5f) { VoiceMemory.Situation = 7; } else { if (Time.time < nextContext) { return; } nextContext = Time.time + 0.25f; if (Time.time >= nextListeners) { nextListeners = Time.time + 0.5f; UpdateListeners(val); } if (SomeoneJustDied()) { VoiceMemory.Situation = 8; return; } if (Time.time - LastHeardOther < 2.5f) { VoiceMemory.Situation = 5; return; } EnemyDirector val3 = EnemyDirector.instance; if (Object.op_Implicit((Object)(object)val3) && val3.enemiesSpawned != null) { foreach (EnemyParent item2 in val3.enemiesSpawned) { if (Object.op_Implicit((Object)(object)item2) && (bool)SpawnedFlag.GetValue(item2)) { object? value3 = EnemyOf.GetValue(item2); Enemy val4 = (Enemy)((value3 is Enemy) ? value3 : null); if (Object.op_Implicit((Object)(object)val4) && !Object.op_Implicit((Object)(object)((Component)val4).GetComponent<MimicEnemy>()) && Vector3.Distance(((Component)val4).transform.position, ((Component)val).transform.position) < 12f) { VoiceMemory.Situation = 6; return; } } } } PhysGrabber physGrabber = val.physGrabber; if (Object.op_Implicit((Object)(object)physGrabber) && Object.op_Implicit((Object)(object)physGrabber.grabbedObjectTransform) && Object.op_Implicit((Object)(object)((Component)physGrabber.grabbedObjectTransform).GetComponentInParent<ValuableObject>())) { VoiceMemory.Situation = 2; return; } Camera val5 = (Camera)((Object.op_Implicit((Object)(object)physGrabber) && GrabCamera != null) ? /*isinst with value type is only supported in some contexts*/: null); RaycastHit val6 = default(RaycastHit); if (Object.op_Implicit((Object)(object)val5) && Physics.Raycast(((Component)val5).transform.position, ((Component)val5).transform.forward, ref val6, 5f) && Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val6)).collider).GetComponentInParent<ValuableObject>())) { VoiceMemory.Situation = 2; return; } bool flag4 = false; foreach (PlayerAvatar item3 in SemiFunc.PlayerGetList()) { if (!((Object)(object)item3 == (Object)(object)val) && MimicEnemy.Living(item3)) { float num2 = Vector3.Distance(((Component)item3).transform.position, ((Component)val).transform.position); if (num2 < 5f) { VoiceMemory.Situation = 3; return; } if (num2 < 15f) { flag4 = true; } } } if (HeadingOut(val)) { VoiceMemory.Situation = 9; } else { VoiceMemory.Situation = ((SemiFunc.IsMultiplayer() && !flag4) ? 4 : 0); } } } } internal static class MimicTemplate { internal static GameObject Build(ManualLogSource log) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Expected O, but got Unknown //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Expected O, but got Unknown //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Expected O, but got Unknown //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Expected O, but got Unknown //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Expected O, but got Unknown //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Expected O, but got Unknown //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Expected O, but got Unknown //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Expected O, but got Unknown //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Expected O, but got Unknown GameObject val = Resources.Load<GameObject>("Enemies/Enemy - Hunter"); if (!Object.op_Implicit((Object)(object)val)) { log.LogError((object)"Hunter prefab not found; Living Double disabled."); return null; } GameObject val2 = new GameObject("Living Double templates"); Object.DontDestroyOnLoad((Object)(object)val2); val2.SetActive(false); GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform); ((Object)val3).name = "Enemy - Living Double"; Transform transform = val3.transform; EnemyParent component = val3.GetComponent<EnemyParent>(); component.enemyName = "Living Double"; component.enemyNameLocalized = null; component.difficulty = (Difficulty)Mathf.Clamp(Plugin.Tier.Value - 1, 0, 2); component.SpawnedTimeMin = 360f; component.SpawnedTimeMax = 600f; component.DespawnedTimeMin = 90f; component.DespawnedTimeMax = 180f; Transform val4 = transform.Find("Always Active"); if (Object.op_Implicit((Object)(object)val4)) { Transform val5 = val4.Find("Death Effect"); if (Object.op_Implicit((Object)(object)val5)) { val5.SetParent(transform, true); ((Object)val5).name = "Mimic Death Effect"; } Object.DestroyImmediate((Object)(object)((Component)val4).gameObject); } Transform val6 = transform.Find("Enable"); Transform val7 = val6.Find("Controller"); Transform val8 = val6.Find("Rigidbody"); Transform val9 = val6.Find("[VISUALS]"); KillChild(val6, "Hurt Collider"); KillChild(val6, "Shoot Line"); Kill<EnemyHunter>(val7); Kill<EnemyHunterAnim>(val9); Kill<Animator>(val9); for (int num = val9.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val9.GetChild(num)).gameObject); } KillChild(val8, "Audio Source Humming"); val8.localPosition = new Vector3(0f, 0.75f, 0f); Transform val10 = val7.Find("Follow"); if (Object.op_Implicit((Object)(object)val10)) { val10.localPosition = new Vector3(0f, 0.75f, 0f); } Transform val11 = val8.Find("Capsule Collider"); if (Object.op_Implicit((Object)(object)val11)) { val11.localPosition = Vector3.zero; CapsuleCollider component2 = ((Component)val11).GetComponent<CapsuleCollider>(); component2.radius = 0.33f; component2.height = 1.5f; component2.center = Vector3.zero; } Transform val12 = val8.Find("Player Collision"); if (Object.op_Implicit((Object)(object)val12)) { val12.localPosition = new Vector3(0f, -0.5f, 0f); } Transform val13 = val8.Find("Visuals Follow"); if (Object.op_Implicit((Object)(object)val13)) { val13.localPosition = new Vector3(0f, -0.75f, 0f); } Transform val14 = val8.Find("Center"); if (Object.op_Implicit((Object)(object)val14)) { val14.localPosition = new Vector3(0f, 0.1f, 0f); } Transform transform2 = new GameObject("Kill Look At").transform; transform2.SetParent(val8, false); transform2.localPosition = new Vector3(0f, 0.55f, 0.1f); EnemyRigidbody component3 = ((Component)val8).GetComponent<EnemyRigidbody>(); if (Object.op_Implicit((Object)(object)component3.grabForceNeeded)) { GrabForce val15 = Object.Instantiate<GrabForce>(component3.grabForceNeeded); val15.amount = component3.grabForceNeeded.amount * (float)Mathf.Clamp(Plugin.GrabPlayers.Value, 1, 4) / 3f; component3.grabForceNeeded = val15; } component3.onGrabbed = new UnityEvent(); component3.stunFromFall = false; Enemy component4 = ((Component)val7).GetComponent<Enemy>(); component4.Type = (EnemyType)2; component4.SightingStinger = false; component4.EnemyNearMusic = false; component4.KillLookAtTransform = transform2; EnemyHealth component5 = ((Component)val7).GetComponent<EnemyHealth>(); component5.health = Mathf.Clamp(Plugin.Health.Value, 1, 5000); component5.onHurt = new UnityEvent(); component5.onDeath = new UnityEvent(); component5.onDeathStart = new UnityEvent(); component5.onObjectHurt = new UnityEvent(); ((Component)val7).GetComponent<EnemyStateSpawn>().OnSpawn = new UnityEvent(); EnemyStateDespawn component6 = ((Component)val7).GetComponent<EnemyStateDespawn>(); if (Object.op_Implicit((Object)(object)component6)) { component6.OnDespawn = new UnityEvent(); } EnemyStateStunned component7 = ((Component)val7).GetComponent<EnemyStateStunned>(); if (Object.op_Implicit((Object)(object)component7)) { component7.onStunnedStart = new UnityEvent(); component7.onStunnedEnd = new UnityEvent(); } NavMeshAgent component8 = ((Component)val7).GetComponent<NavMeshAgent>(); if (Object.op_Implicit((Object)(object)component8)) { component8.radius = 0.35f; component8.height = 1.5f; component8.baseOffset = 0f; component8.updateRotation = false; } ((Component)val9).gameObject.AddComponent<AvatarShell>(); ((Component)val7).gameObject.AddComponent<MimicEnemy>(); PhotonView[] componentsInChildren = val3.GetComponentsInChildren<PhotonView>(true); foreach (PhotonView val16 in componentsInChildren) { if (val16.ObservedComponents != null) { val16.ObservedComponents.RemoveAll((Component c) => (Object)(object)c == (Object)null); } } log.LogInfo((object)"Living Double enemy template built from the Hunter body"); return val3; } private static void Kill<T>(Transform on) where T : Component { T val = (Object.op_Implicit((Object)(object)on) ? ((Component)on).GetComponent<T>() : default(T)); if (Object.op_Implicit((Object)(object)val)) { Object.DestroyImmediate((Object)(object)val); } } private static void KillChild(Transform parent, string name) { Transform val = (Object.op_Implicit((Object)(object)parent) ? parent.Find(name) : null); if (Object.op_Implicit((Object)(object)val)) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } } } [HarmonyPatch(typeof(ItemInfoUI), "ItemInfoText")] internal static class MimicGrabLabel { private static void Prefix(string message, ref bool enemy) { if (enemy && MimicEnemy.IsMimicLabel(message) && !string.Equals(Plugin.Difficulty, "Easy", StringComparison.OrdinalIgnoreCase)) { enemy = false; } } } public sealed class MimicEnemy : MonoBehaviour { private struct Heard { public float At; public float Seconds; public bool Question; public float[] Print; } private enum CarryPlan { Deliver, HideHead, Cart } private const int ChatSlots = 8; private const int LocalSpeaker = -1; private const int MoodAngry = 0; private const int MoodSad = 1; private const int MoodHappy = 2; private const int MoodScared = 3; private const int MoodSuspicious = 4; internal static readonly List<MimicEnemy> All = new List<MimicEnemy>(); private static readonly Dictionary<int, KeyValuePair<MimicEnemy, float>> replyClaims = new Dictionary<int, KeyValuePair<MimicEnemy, float>>(); private static readonly Dictionary<int, float> replyClaimDistance = new Dictionary<int, float>(); private static readonly FieldInfo Disabled = AccessTools.Field(typeof(PlayerAvatar), "isDisabled"); private static readonly FieldInfo VoiceChat = AccessTools.Field(typeof(PlayerAvatar), "voiceChat"); private static readonly FieldInfo VoiceSource = AccessTools.Field(typeof(PlayerVoiceChat), "audioSource"); private static readonly FieldInfo Talking = AccessTools.Field(typeof(PlayerVoiceChat), "isTalking"); private static readonly FieldInfo ParentSpawned = AccessTools.Field(typeof(EnemyParent), "Spawned"); private static readonly FieldInfo NamesSetting = AccessTools.Field(typeof(GameplayManager), "playerNames"); private static readonly string[][] ChatLines = new string[10][] { new string[6] { "го", "ну чё", "пошли дальше", "тут пусто", "ок", "давай" }, new string[5] { "чё тут", "куда дальше?", "где выход?", "так", "хм" }, new string[6] { "тут лут", "о, смотри", "это дорогое?", "несу", "помоги поднять", "аккуратно" }, new string[5] { "я тут", "я за тобой", "подожди", "пошли вместе", "ага" }, new string[5] { "где все?", "ау", "вы где?", "слышите?", "эй" }, new string[7] { "да", "ага", "не", "щас", "ок", "норм", "хз" }, new string[5] { "беги!", "тут монстр", "осторожно", "тихо", "валим" }, new string[3] { "ай", "больно", "блин" }, new string[4] { "он умер?", "блин...", "кто умер?", "капец" }, new string[4] { "к грузовику", "пошли сдавать", "всё, уходим", "го на выход" } }; private Enemy enemy; private PhotonView view; private AvatarShell shell; private Transform visuals; private AudioSource mouth; private TTSVoice tts; private PlayerAvatar ttsModel; private MimicRoutine routine; private MimicNameTag nameTag; private ParticleSystem[] deathEffects = (ParticleSystem[])(object)new ParticleSystem[0]; private int identity = -1; private int expression; private int ticket; private int requestedContext; private int lastLure = -1; private int heardEnds; private Activity state; private Activity sentState = (Activity)(-1); private int sentExpression; private int sentIdentity = -2; private int posture; private int sentPosture; private float nextTick; private float nextSync; private float nextVoice; private float voiceDeadline; private float speechUntil; private float replyAt; private float nextLookCheck; private float nextFlee; private float nextMourning; private bool wasStunned; private bool wasHeld; private bool mourning; private float breakAt; private string shownName; private readonly Dictionary<int, float> talkStarted = new Dictionary<int, float>(); private float mouthUntil; private float nextReplyAllowed; private AudioSource scream; private AudioClip lastVoice; private static readonly FieldInfo LowPassFetch = AccessTools.Field(typeof(AudioLowPassLogic), "Fetch"); private static readonly HashSet<AudioSource> Muffled = new HashSet<AudioSource>(); private float screamStopAt; private Activity shownState; private CapsuleCollider capsule; private bool compact; private float lastHeldAt = -100f; private float lastRammedAt = -100f; private bool knocked; private static readonly FieldInfo TumbleOf = AccessTools.Field(typeof(PlayerAvatar), "tumble"); private readonly Dictionary<PlayerAvatar, Vector3> lastPlayerPos = new Dictionary<PlayerAvatar, Vector3>(); private readonly Dictionary<PlayerAvatar, int> rammingFrames = new Dictionary<PlayerAvatar, int>(); private bool hurtPending; private int lastHealth = int.MaxValue; private int hurtSum; private int hurtCount; private float lastHurt = -100f; private static readonly FieldInfo HealthCurrent = AccessTools.Field(typeof(EnemyHealth), "healthCurrent"); private float wornSince; private float wantNewFaceSince; private float nextWish; private bool wantNewFace; private static readonly Dictionary<int, int> timesWorn = new Dictionary<int, int>(); private static int lastWorn = int.MinValue; private readonly Dictionary<int, Heard> heard = new Dictionary<int, Heard>(); private int replySpeaker = int.MinValue; private int reportedFinished; private float replyGiveUp; private float hurtLineUntil; private int convoWith = int.MinValue; private int convoTurns; private int convoLength; private float convoUntil; private float convoNudgeAt; private float awaitAnswerUntil; private float lastReplyAt = -100f; private bool promptRepeated; private bool convoExtended; private bool lastAskedBack; private bool challengedOriginal; private EnemyStateStunned stunState; private bool standHeld; private bool madeKinematic; private float standUntil; private float lastTalkEndAt = -100f; private int lastTalkEndKey = int.MinValue; private static readonly FieldInfo ExtractionActive = AccessTools.Field(typeof(RoundDirector), "extractionPointActive"); private static readonly FieldInfo ExtractionCurrent = AccessTools.Field(typeof(RoundDirector), "extractionPointCurrent"); private static readonly FieldInfo EnemyOfParent = AccessTools.Field(typeof(EnemyParent), "Enemy"); private static AudioMixerGroup voiceMixer; private float[] answering; private int addressing; private readonly HashSet<int> spokeWithVoice = new HashSet<int>(); private float nextTyped; private float nextStockLine; private readonly HashSet<int> usedStock = new HashSet<int>(); private readonly HashSet<int> silentOwners = new HashSet<int>(); private readonly HashSet<int> answeredOwners = new HashSet<int>(); private static readonly Dictionary<int, string> versions = new Dictionary<int, string>(); private float nextFallback; private float nextChatLine; private int sentHealthPercent = -1; private byte[] queuedClip; private MimicBubble bubble; private Transform bubbleAnchor; private PhysGrabObject carried; private CarryPlan plan; private Vector3 carryDestination; private float nextCarryCheck; private float selfTumbleUntil; private bool settingDown; private Vector3 setDownPoint; private float setDownAt; private PhysGrabObject lastPlaced; private PhysGrabCart deliveryCart; private LineRenderer beamLine; private PlayerAvatar beamModel; private float beamScroll; private static readonly int WallMask = LayerMask.GetMask(new string[2] { "Default", "Wall" }); private static readonly FieldInfo DollarValue = AccessTools.Field(typeof(ValuableObject), "dollarValueCurrent"); private ValuableObject heavyGoal; private float nextHeavyCart; private PhysGrabCart cartTarget; private PhysGrabCart rolledCart; private float nextCartLook; private float cartJerkAt = float.MaxValue; private Vector3 cartSpot; private static readonly FieldInfo CartColliders = AccessTools.Field(typeof(PhysGrabCart), "capsuleColliders"); private static readonly FieldInfo CartSlippery = AccessTools.Field(typeof(PhysGrabCart), "physMaterialSlippery"); private static readonly FieldInfo CartNormal = AccessTools.Field(typeof(PhysGrabCart), "physMaterialNormal"); private static readonly FieldInfo HeadInExtraction = AccessTools.Field(typeof(PlayerDeathHead), "inExtractionPoint"); private static readonly FieldInfo HeadInTruck = AccessTools.Field(typeof(PlayerDeathHead), "inTruck"); private PlayerDeathHead headTarget; private float headDecoyUntil; private float nextHeadLook; private bool headDiverted; private readonly Dictionary<PlayerDeathHead, float> handledHeads = new Dictionary<PlayerDeathHead, float>(); private float nextLootLook; private bool intoCart; private float cartRim; private ValuableObject lootTry; private ValuableObject lootTryItem; private int lootTries; private ValuableObject loadAfterCart; private PhysGrabObject carryStartItem; private float carryStartAt; private Vector3 gripLocal; private float nextJump; private float nextDoor; private float doorBeamUntil; private float nextStepJump; private float nextHurdle; private Vector3 doorPush; private Vector3 doorPoint; private PhysGrabObject doorBeam; private static readonly FieldInfo HingeClosed = AccessTools.Field(typeof(PhysGrabHinge), "closed"); private static readonly FieldInfo HingeBroken = AccessTools.Field(typeof(PhysGrabHinge), "broken"); private static readonly FieldInfo HingeDead = AccessTools.Field(typeof(PhysGrabHinge), "dead"); private static readonly FieldInfo HingeRest = AccessTools.Field(typeof(PhysGrabHinge), "restRotation"); private PhysGrabHinge closingDoor; private float closeUntil; private float nextDisguiseCheck; private float lastDisguiseChange = -100f; private float victimCheckAt; private float victimGiveUp; private PlayerAvatar victim; private bool victimWitnessed; private bool rejoinPending; private PlayerAvatar heldPlayer; private PlayerTumble heldTumble; private PhysGrabObject heldPlayerGrab; private float holdPlayerUntil; private float nextPlayerGrab; private float grabbedPlayerAt; private float nextTumblePush; private float holdPhase; private bool slamAtEnd; private static readonly string[][] MoodWords = new string[5][] { new string[4] { "angry", "mad", "rage", "annoy" }, new string[3] { "sad", "cry", "upset" }, new string[5] { "happy", "smile", "joy", "laugh", "glad" }, new string[6] { "surpris", "shock", "scare", "fear", "afraid", "wide" }, new string[5] { "suspic", "squint", "sly", "sus", "doubt" } }; private float lastEmotionAt = -100f; private int lastMood = -1; private bool moodNamesLogged; private AudioSource beamHum; private AudioSource glitch; private bool beamOn; private Activity soundState; private float nextScrap; private readonly List<float[]> recentLines = new List<float[]>(); private PhysGrabObject helpItem; private PlayerAvatar helpWith; private Vector3 helpGrip; private float helpUntil; private float nextHelpOffer; private float heavySince; private PlayerAvatar heavyHolder; private bool assistAck; private static readonly FieldInfo GrabbedObject = AccessTools.Field(typeof(PhysGrabber), "grabbedPhysGrabObject"); private static readonly FieldInfo CartItems = AccessTools.Field(typeof(PhysGrabCart), "itemsInCart"); private float nextCartSense; private PhysGrabCart teamCart; private bool cartToExtraction; private float hauledByMe; private float shareLimit; private float lastCartWorth; private int extractionRolls; private static readonly FieldInfo HaulGoal = AccessTools.Field(typeof(RoundDirector), "extractionHaulGoal"); private static readonly FieldInfo HaulNow = AccessTools.Field(typeof(RoundDirector), "currentHaul"); private static readonly FieldInfo HealthOf = AccessTools.Field(typeof(PlayerHealth), "health"); private readonly Dictionary<PlayerAvatar, int> seenHealth = new Dictionary<PlayerAvatar, int>(); private readonly Dictionary<PlayerAvatar, bool> seenTumbling = new Dictionary<PlayerAvatar, bool>(); private readonly Dictionary<PlayerAvatar, bool> seenAlive = new Dictionary<PlayerAvatar, bool>(); private readonly Dictionary<PlayerAvatar, Vector3> seenAt = new Dictionary<PlayerAvatar, Vector3>(); private float nextEventPoll; private float nextEventReaction; private float nextBreakReaction; private bool reactLinePending; private int reactLine; private float reactLineAt; private Activity lastRoutineState; private ValuableObject resumeLoot; private ValuableObject resumeHeavy; private PhysGrabCart resumeCart; private float resumeAt; private readonly Dictionary<PlayerAvatar, bool> talkingNow = new Dictionary<PlayerAvatar, bool>(); private readonly Dictionary<PlayerAvatar, float> talkEnded = new Dictionary<PlayerAvatar, float>(); private readonly Queue<float> teamLines = new Queue<float>(); internal static bool AnySpeaking { get { foreach (MimicEnemy item in All) { if (Object.op_Implicit((Object)(object)item) && item.Speaking) { return true; } } return false; } } private bool Host => SemiFunc.IsMasterClientOrSingleplayer(); private static bool Online => SemiFunc.IsMultiplayer(); private bool Speaking { get { if ((!Object.op_Implicit((Object)(object)mouth) || !mouth.isPlaying) && !(Time.time < speechUntil + 1f)) { return Time.time < mouthUntil; } return true; } } private bool Active { get { if (Object.op_Implicit((Object)(object)enemy) && Object.op_Implicit((Object)(object)GameAccess.Parent(enemy))) { return (bool)ParentSpawned.GetValue(GameAccess.Parent(enemy)); } return false; } } private Vector3 BodyPosition { get { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) EnemyRigidbody val = GameAccess.Body(enemy); if (!Object.op_Implicit((Object)(object)val)) { return ((Component)this).transform.position + Vector3.up * 0.75f; } return ((Component)val).transform.position; } } private static int Hint { get { string difficulty = Plugin.Difficulty; if (!string.Equals(difficulty, "Easy", StringComparison.OrdinalIgnoreCase)) { if (!string.Equals(difficulty, "Hard", StringComparison.OrdinalIgnoreCase)) { return 1; } return 0; } return 2; } } private bool InConversation => Time.time < convoUntil; private PhysGrabObject BeamTarget { get { if (!Object.op_Implicit((Object)(object)carried)) { if (!Object.op_Implicit((Object)(object)helpItem)) { if (!Object.op_Implicit((Object)(object)heldPlayerGrab)) { if (!(Time.time < doorBeamUntil)) { return null; } return doorBeam; } return heldPlayerGrab; } return helpItem; } return carried; } } private bool Calmly { get { if (routine == null || routine.Unmasked || Object.op_Implicit((Object)(object)carried) || Object.op_Implicit((Object)(object)heldPlayer)) { return false; } Activity activity = routine.State; if (activity != Activity.Explore && activity != Activity.Look && activity != Activity.Accompany && activity != Activity.Trail && activity != Activity.Observe) { return activity == Activity.Inspect; } return true; } } internal bool DidEnough { get { if (shareLimit <= 0f) { float num = 0f; RoundDirector instance = RoundDirector.instance; if (Object.op_Implicit((Object)(object)instance) && HaulGoal != null) { try { num = Convert.ToSingle(HaulGoal.GetValue(instance)); } catch { } } if (num <= 0f) { return false; } shareLimit = num * Random.Range(0.25f, 0.45f); } if (hauledByMe >= shareLimit) { return !SemiFunc.EnemyDirectorEndingHeadToTruck(); } return false; } } internal static Vector3? OtherMimicNear(Enemy self, Vector3 at, float radius) { //IL_0034: 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_0043: Unknown result type (might be due to invalid IL or missing references) foreach (MimicEnemy item in All) { if (Object.op_Implicit((Object)(object)item) && !((Object)(object)item.enemy == (Object)(object)self) && item.Active && Vector3.Distance(item.BodyPosition, at) < radius) { return item.BodyPosition; } } return null; } private bool OtherMimicSpeakingNear(float range) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) foreach (MimicEnemy item in All) { if (Object.op_Implicit((Object)(object)item) && (Object)(object)item != (Object)(object)this && item.Speaking && Vector3.Distance(item.BodyPosition, BodyPosition) < range) { return true; } } return false; } private bool ClaimReply(int speaker, float distance) { if (replyClaims.TryGetValue(speaker, out var value) && Object.op_Implicit((Object)(object)value.Key) && (Object)(object)value.Key != (Object)(object)this && Time.time - value.Value < 3f && replyClaimDistance.TryGetValue(speaker, out var value2) && value2 <= distance) { return false; } replyClaims[speaker] = new KeyValuePair<MimicEnemy, float>(this, Time.time); replyClaimDistance[speaker] = distance; return true; } internal static bool Living(PlayerAvatar p) { if (Object.op_Implicit((Object)(object)p)) { return !(bool)Disabled.GetValue(p); } return false; } internal static int KeyOf(PlayerAvatar p) { if (Object.op_Implicit((Object)(object)p)) { if (!Online) { return 0; } if (!Object.op_Implicit((Object)(object)p.photonView)) { return -1; } return p.photonView.ViewID; } return -1; } private void Awake() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown All.Add(this); enemy = ((Component)this).GetComponent<Enemy>(); view = ((Component)this).GetComponent<PhotonView>(); visuals = ((Component)this).transform.parent.Find("[VISUALS]"); shell = (Object.op_Implicit((Object)(object)visuals) ? ((Component)visuals).GetComponent<AvatarShell>() : null); EnemyHealth component = ((Component)this).GetComponent<EnemyHealth>(); if (Object.op_Implicit((Object)(object)shell)) { shell.Health = component; } Transform val = ((Component)this).transform.parent.parent.Find("Mimic Death Effect"); if (Object.op_Implicit((Object)(object)val)) { deathEffects = ((Component)val).GetComponentsInChildren<ParticleSystem>(true); } component.onHurt.AddListener(new UnityAction(OnHurt)); component.onDeath.AddListener(new UnityAction(OnDeath)); ((Component)this).GetComponent<EnemyStateSpawn>().OnSpawn.AddListener(new UnityAction(OnSpawn)); EnemyRigidbody componentInChildren = ((Component)((Component)this).transform.parent).GetComponentInChildren<EnemyRigidbody>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.onGrabbed.AddListener(new UnityAction(OnGrabbed)); } GameObject val2 = new GameObject("Mimic mouth"); val2.transform.SetParent(Object.op_Implicit((Object)(object)visuals) ? visuals : ((Component)this).transform, false); val2.transform.localPosition = Vector3.up * 1.2f; mouth = val2.AddComponent<AudioSource>(); mouth.spatialBlend = 1f; mouth.minDistance = 2f; mouth.maxDistance = 22f; mouth.rolloffMode = (AudioRolloffMode)1; mouth.dopplerLevel = 0f; mouth.playOnAwake = false; nextVoice = Time.time + 8f; GameObject val3 = new GameObject("Mimic scream"); val3.transform.SetParent(val2.transform, false); scream = val3.AddComponent<AudioSource>(); scream.spatialBlend = 1f; scream.minDistance = 3f; scream.maxDistance = 28f; scream.rolloffMode = (AudioRolloffMode)1; scream.dopplerLevel = 0f; scream.playOnAwake = false; } private static void Muffle(AudioSource source) { Muffled.RemoveWhere((AudioSource s) => !Object.op_Implicit((Object)(object)s)); if (!Object.op_Implicit((Object)(object)source) || !Object.op_Implicit((Object)(object)AudioListenerFollow.instance) || Muffled.Contains(source)) { return; } Muffled.Add(source); AudioLowPassLogic val = ((Component)source).GetComponent<AudioLowPassLogic>(); if (!Object.op_Implicit((Object)(object)((Component)source).GetComponent<AudioLowPassFilter>())) { ((Component)source).gameObject.AddComponent<AudioLowPassFilter>(); } if (!Object.op_Implicit((Object)(object)val)) { val = ((Component)source).gameObject.AddComponent<AudioLowPassLogic>(); } try { if (LowPassFetch != null) { LowPassFetch.SetValue(val, true); } val.Setup(); } catch (Exception ex) { Plugin.Log("Voice muffling unavailable: " + ex.Message); } } private void UpdateTalkSources() { if (Object.op_Implicit((Object)(object)shell)) { AudioSource val = (Object.op_Implicit((Object)(object)tts) ? ((Component)tts).GetComponent<AudioSource>() : null); shell.TalkSources = (AudioSource[])(object)new AudioSource[3] { mouth, scream, val }; } } private MimicRoutine NewRoutine() { MimicRoutine mimicRoutine = new MimicRoutine(enemy, Plugin.Damage.Value, Plugin.Peace.Value, Plugin.Difficulty); mimicRoutine.Hit = OnHit; return mimicRoutine; } private void OnRevealStart() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) StopVoice(); Vector3 bodyPosition = BodyPosition; if (Object.op_Implicit((Object)(object)GameDirector.instance)) { GameDirector.instance.CameraShake.ShakeDistance(4f, 3f, 12f, bodyPosition, 0.6f); } if (Object.op_Implicit((Object)(object)lastVoice) && Plugin.VoiceOn.Value) { MatchScream(); Muffle(scream); UpdateTalkSources(); scream.clip = lastVoice; scream.pitch = Random.Range(0.45f, 0.6f); scream.time = Random.Range(0f, Mathf.Max(0f, lastVoice.length - 1.5f)); scream.Play(); screamStopAt = Time.time + 1.3f; } } private void MatchScream() { scream.outputAudioMixerGroup = mouth.outputAudioMixerGroup; scream.volume = 0.3f; } private void TickScream() { if (!(screamStopAt <= 0f)) { if (scream.isPlaying) { scream.pitch = Mathf.Clamp(scream.pitch + Random.Range(-0.12f, 0.1f), 0.3f, 0.75f); } if (Time.time >= screamStopAt) { scream.Stop(); screamStopAt = 0f; } } } private void OnHit(PlayerAvatar player, int damage) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) Vector3 bodyPosition = BodyPosition; player.playerHealth.HurtOther(damage, bodyPosition, false, SemiFunc.EnemyGetIndex(enemy), false); Vector3 val = ((Component)player).transform.position - bodyPosition; val.y = 0f; val = ((((Vector3)(ref val)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val)).normalized : ((Component)enemy).transform.forward); PlayerTumble val2 = GameAccess.Tumble(player); if (Object.op_Implicit((Object)(object)val2)) { val2.TumbleRequest(true, false); val2.TumbleOverrideTime(1.6f); val2.TumbleForce(val * 14f + Vector3.up * 5f); val2.TumbleTorque(Random.insideUnitSphere * 12f); } Rigidbody val3 = GameAccess.Rb(GameAccess.Body(enemy)); if (Object.op_Implicit((Object)(object)val3) && !val3.isKinematic) { val3.AddForce(val * val3.mass * 4f, (ForceMode)1); } if (Online) { view.RPC("LDHitRPC", (RpcTarget)0, new object[0]); } else { HitEffects(); } NoteVictim(player); Plugin.Log("Living Double hit a player"); } [PunRPC] private void LDHitRPC(PhotonMessageInfo info) { if (info.Sender != null && info.Sender.IsMasterClient) { HitEffects(); } } private void HitEffects() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)shell)) { shell.PlayHit(); } if (Object.op_Implicit((Object)(object)GameDirector.instance)) { GameDirector.instance.CameraImpact.ShakeDistance(8f, 2f, 7f, BodyPosition, 0.2f); } } private void OnDestroy() { All.Remove(this); if (Object.op_Implicit((Object)(object)mouth) && Object.op_Implicit((Object)(object)mouth.clip)) { Object.Destroy((Object)(object)mouth.clip); } if (Object.op_Implicit((Object)(object)nameTag)) { Object.Destroy((Object)(object)((Component)nameTag).gameObject); } if (Object.op_Implicit((Object)(object)bubble)) { Object.Destroy((Object)(object)((Component)bubble).gameObject); } if (Object.op_Implicit((Object)(object)tts)) { MimicWordCapture.Owners.Remove(tts); } } private void OnSpawn() { lastHealth = int.MaxValue; hurtSum = 0; hurtCount = 0; hurtPending = false; if (Object.op_Implicit((Object)(object)shell)) { shell.Clear(); } identity = -1; mourning = false; routine = null; state = Activity.Observe; SayHello(); if (Host) { if (!SemiFunc.EnemySpawn(enemy)) { Plugin.Log("Living Double: no spawn point found, staying where it is"); } PickIdentity(); routine = NewRoutine(); nextVoice = Time.time + 6f; nextSync = 0f; Plugin.Log("Living Double spawned as " + DescribeIdentity()); } } private void Compact(bool on) { if (on == compact) { return; } if (!Object.op_Implicit((Object)(object)capsule)) { EnemyRigidbody val = GameAccess.Body(enemy); Transform val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).transform.Find("Capsule Collider") : null); capsule = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).GetComponent<CapsuleCollider>() : null); if (!Object.op_Implicit((Object)(object)capsule)) { return; } } compact = on; capsule.height = (on ? 0.95f : 1.5f); capsule.radius = (on ? 0.42f : 0.33f); } private void OnGrabbed() { } private void OnHurt() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (!Host || routine == null) { return; } int num = HealthNow(); int num2 = Mathf.Max(1, lastHealth - num); lastHealth = num; if (Time.time - lastHurt > 10f) { hurtSum = 0; hurtCount = 0; } lastHurt = Time.time; hurtSum += num2; hurtCount++; hurtLineUntil = Time.time + 4f; nextVoice = Mathf.Min(nextVoice, Time.time + Random.Range(0.8f, 1.6f)); PlayerAvatar val = NearestLiving(); if (Object.op_Implicit((Object)(object)val) && Vector3.Distance(((Component)val).transform.position, BodyPosition) < 6f) { routine.AddSuspicion(val, 3f); } if (enemy.IsStunned()) { hurtPending = true; return; } Flinch(); if (!routine.Unmasked) { routine.Flee(); EnemyHealth component = ((Component)this).GetComponent<EnemyHealth>(); float num3 = ((Object.op_Implicit((Object)(object)component) && HealthCurrent != null) ? ((float)(int)HealthCurrent.GetValue(component) / (float)Mathf.Max(1, component.health)) : 1f); if (Time.time - wornSince > 60f || hurtCount >= 2 || num3 < 0.6f) { wantNewFace = true; wantNewFaceSince = Time.time; } Plugin.Log("Living Double was hit, cries out and runs" + (wantNewFace ? " (will change face)" : "")); } } internal int FilterHurt(int damage, Vector3 direction) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)enemy) && !PlayerCaused()) { if (Plugin.Verbose.Value) { Plugin.Log("Living Double ignored " + damage + " self-inflicted damage"); } return 0; } if (!Object.op_Implicit((Object)(object)enemy) || enemy.IsStunned()) { return damage; } EnemyHealth component = ((Component)this).GetComponent<EnemyHealth>(); int num = Mathf.Max(1, Mathf.CeilToInt((float)(Object.op_Implicit((Object)(object)component) ? component.health : 100) / 8f)); if (damage >= 25) { KnockDown(direction, "a heavy hit"); } return Mathf.Min(damage, num); } private bool PlayerCaused() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (Time.time - lastHeldAt < 3f) { return true; } Rigidbody val = GameAccess.Rb(GameAccess.Body(enemy)); Collider[] array = Physics.OverlapSphere(BodyPosition, 2.2f, -1, (QueryTriggerInteraction)1); foreach (Collider val2 in array) { PhysGrabObject componentInParent = ((Component)val2).GetComponentInParent<PhysGrabObject>(); if (!Object.op_Implicit((Object)(object)componentInParent) || !Object.op_Implicit((Object)(object)componentInParent.rb) || (Object)(object)componentInParent.rb == (Object)(object)val || (Object)(object)componentInParent == (Object)(object)carried) { continue; } if (componentInParent.playerGrabbing.Count <= 0) { Vector3 linearVelocity = componentInParent.rb.linearVelocity; if (!(((Vector3)(ref linearVelocity)).magnitude > 2f)) { continue; } } return true; } return false; } internal void KnockDown(Vector3 direction, string why) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)stunState)) { stunState = ((Component)this).GetComponent<EnemyStateStunned>(); } if (!Object.op_Implicit((Object)(object)stunState) || enemy.IsStunned()) { return; } stunState.Set(Random.Range(3f, 4.5f)); knocked = true; Rigidbody val = GameAccess.Rb(GameAccess.Body(enemy)); if (Object.op_Implicit((Object)(object)val) && !val.isKinematic) { direction.y = 0f; if (((Vector3)(ref direction)).sqrMagnitude < 0.01f) { direction = -((Component)enemy).transform.forward; } val.AddForce((((Vector3)(ref direction)).normalized * 3f + Vector3.up * 1.5f) * val.mass, (ForceMode)1); } Plugin.Log("Living Double was knocked down (" + why + ")"); } private bool LookingAtBack() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; EnemyRigidbody val = GameAccess.Body(enemy); Rigidbody val2 = GameAccess.Rb(val); if (!Object.op_Implicit((Object)(object)main) || !Object.op_Implicit((Object)(object)val2)) { return false; } RaycastHit val3 = default(RaycastHit); if (!Physics.Raycast(((Component)main).transform.position, ((Component)main).transform.forward, ref val3, 6f, -1, (QueryTriggerInteraction)1)) { return false; } if ((Object)(object)((RaycastHit)(ref val3)).rigidbody != (Object)(object)val2) { return false; } Vector3 position = ((Component)val).transform.position; Vector3 val4 = ((RaycastHit)(ref val3)).point - position; val4.y = 0f; Vector3 val5 = (Object.op_Implicit((Object)(object)shell) ? ((Component)shell).transform.forward : ((Component)enemy).transform.forward); val5.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude > 0.0001f && ((Vector3)(ref val5)).sqrMagnitude > 0.0001f && Vector3.Dot(((Vector3)(ref val4)).normalized, ((Vector3)(ref val5)).normalized) < -0.3f) { return ((RaycastHit)(ref val3)).point.y > position.y - 0.1f; } return false; } private void CheckRam() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) if (enemy.IsStunned() || Time.deltaTime <= 0f) { return; } Vector3 bodyPosition = BodyPosition; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!Living(item)) { continue; } Vector3 val = ((Component)item).transform.position + Vector3.up * 0.7f; Vector3 value; bool flag = lastPlayerPos.TryGetValue(item, out value); lastPlayerPos[item] = val; if (!flag) { rammingFrames.Remove(item); continue; } Vector3 direction = (val - value) / Time.deltaTime; Vector3 val2 = bodyPosition - val; float magnitude = ((Vector3)(ref direction)).magnitude; bool flag2 = magnitude > 4.5f && magnitude < 14f && Vector3.Dot(((Vector3)(ref direction)).normalized, ((Vector3)(ref val2)).normalized) > 0.5f; rammingFrames.TryGetValue(item, out var value2); value2 = (rammingFrames[item] = (flag2 ? (value2 + 1) : 0)); if (((Vector3)(ref val2)).magnitude > 1.3f || value2 < 4) { continue; } rammingFrames[item] = 0; lastRammedAt = Time.time; KnockDown(direction, "rammed by a player"); break; } } private int HealthNow() { EnemyHealth component = ((Component)this).GetComponent<EnemyHealth>(); if (!Object.op_Implicit((Object)(object)component)) { return 0; } int result = ((HealthCurrent != null) ? ((int)HealthCurrent.GetValue(component)) : component.health); if (lastHealth == int.MaxValue) { lastHealth = component.health; } return result; } private void Flinch() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)stunState)) { stunState = ((Component)this).GetComponent<EnemyStateStunned>(); } Rigidbody val = GameAccess.Rb(GameAccess.Body(enemy)); if (Object.op_Implicit((Object)(object)val) && !val.isKinematic) { Vector3 insideUnitSphere = Random.insideUnitSphere; insideUnitSphere.y = 0.2f; val.AddForce(((Vector3)(ref insideUnitSphere)).normalized * val.mass * 1.2f, (ForceMode)1); } Plugin.Log("Living Double flinched (" + hurtSum + " damage so far)"); } private void OnDeath() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) StopVoice(); ParticleSystem[] array = deathEffects; foreach (ParticleSystem val in array) { if (Object.op_Implicit((Object)(object)val)) { val.Play(); } } PlayerAvatar val2 = FindModel(); Vector3 val3 = (Object.op_Implicit((Object)(object)enemy.CenterTransform) ? enemy.CenterTransform.position : ((Component)this).transform.position); if (Object.op_Implicit((Object)(object)val2) && val2.deathSound != null) { val2.deathSound.Play(val3, 0.3f, 0.75f, 1f, 1f); } if (Object.op_Implicit((Object)(object)GameDirector.instance)) { GameDirector.instance.CameraShake.ShakeDistance(5f, 3f, 10f, val3, 0.5f); GameDirector.instance.CameraImpact.ShakeDistance(5f, 3f, 10f, val3, 0.05f); } if (Host) { GameAccess.Parent(enemy).Despawn(); } Plugin.Log("Living Double died"); } private PlayerAvatar FindModel() { if (identity < 0) { return null; } if (!Online) { return PlayerAvatar.instance; } foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.photonView) && item.photonView.ViewID == identity) { return item; } } return null; } private string DescribeIdentity() { PlayerAvatar val = FindModel(); if (!Object.op_Implicit((Object)(object)val)) { return "nobody"; } if (!Online) { return "the local player"; } return "player view " + identity; } private void PickIdentity() { mourning = false; wornSince = Time.time; List<PlayerAvatar> list = new List<PlayerAvatar>(); foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (Living(item) && Object.op_Implicit((Object)(object)item.playerAvatarVisuals)) { list.Add(item); } } if (list.Count == 0) { identity = -1; return; } for (int num = list.Count - 1; num > 0; num--) { int index = Random.Range(0, num + 1); PlayerAvatar value = list[num]; list[num] = list[index]; list[index] = value; } PlayerAvatar p = null; int num2 = int.MaxValue; foreach (PlayerAvatar item2 in list) { int num3 = KeyOf(item2); timesWorn.TryGetValue(num3, out var value2); int num4 = value2 * 10; if (num3 == lastWorn && list.Count > 1) { num4 += 1000; } foreach (MimicEnemy item3 in All) { if (Object.op_Implicit((Object)(object)item3) && (Object)(object)item3 != (Object)(object)this && item3.identity == num3) { num4 += 500; } } if (num4 < num2) { num2 = num4; p = item2; } } identity = KeyOf(p); timesWorn.TryGetValue(identity, out var value3); timesWorn[identity] = value3 + 1; lastWorn = identity; Plugin.Log("Living Double wears " + GameAccess.Name(p) + " (worn " + (value3 + 1) + " times this session)"); if (Object.op_Implicit((Object)(object)shell)) { shell.Clear(); } } private void CheckMourning() { if (mourning || !Online || !Plugin.CopyDead.Value || Time.time < nextMourning) { return; } nextMourning = Time.time + 2f; if (SeenByAnyone(14f)) { return; } foreach (KeyValuePair<int, float> death in DeathCapture.Deaths) { float num = Time.time - death.Value; if (num < 10f || num > 90f || death.Key == identity) { continue; } PlayerAvatar val = null; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (KeyOf(item) == death.Key) { val = item; } } if (!Object.op_Implicit((Object)(object)val) || Living(val)) { continue; } bool flag = false; foreach (MimicEnemy item2 in All) { if (Object.op_Implicit((Object)(object)item2) && (Object)(object)item2 != (Object)(object)this && item2.identity == death.Key) { flag = true; } } if (!flag) { identity = death.Key; mourning = true; if (Object.op_Implicit((Object)(object)shell)) { shell.Clear(); } nextVoice = Time.time + Random.Range(2f, 5f); Plugin.Log("Living Double now wears a fallen player"); break; } } } private bool SeenByAnyone(float range) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) Vector3 bodyPosition = BodyPosition; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (Living(item)) { Vector3 val = ((Component)item).transform.position + Vector3.up * 1.4f; if (Vector3.Distance(val, bodyPosition) < range && !Physics.Linecast(val, bodyPosition, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1)) { return true; } } } return false; } private void Update() { //IL_02a8: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)enemy) || !Active) { if (Object.op_Implicit((Object)(object)nameTag)) { ((Component)nameTag).gameObject.SetActive(false); } return; } bool flag = enemy.IsStunned(); PhysGrabObject val = GameAccess.Grab(GameAccess.Body(enemy)); bool flag2 = Object.op_Implicit((Object)(object)val) && val.playerGrabbing.Count > 0; if (flag2) { lastHeldAt = Time.time; } bool flag3 = ((!Host) ? ((posture & 0x20) != 0) : (flag || flag2)); bool flag4 = ((!Host) ? ((posture & 0x10) != 0) : (routine != null && routine.Unmasked)); if (Host) { flag3 = flag || (flag2 && !standHeld); } if (Object.op_Implicit((Object)(object)val) && !flag2 && !flag3 && !flag4 && !LookingAtBack()) { val.OverrideGrabDisable(0.3f); } if (Host) { CheckRam(); } if (Object.op_Implicit((Object)(object)shell)) { shell.Stunned = flag3; } if (Object.op_Implicit((Object)(object)shell) && !Object.op_Implicit((Object)(object)shell.Mixer)) { shell.Mixer = VoiceMixer(); } ReportOwnSpeech(); AvatarShell.SnapshotLiving(); SoundTouches(); PlayQueued(); SyncHealthBar(); if (Host) { Compact(flag3); HostTick(flag, flag2); } ShowName(); if (Object.op_Implicit((Object)(object)shell)) { if (!shell.Ready && !flag) { PlayerAvatar val2 = FindModel(); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.playerAvatarVisuals)) { shell.Build(val2); } } shell.SetAction(state, expression); shell.Posture = posture & 3; shell.MapOut = (posture & 4) != 0 && (state == Activity.Look || state == Activity.Explore); shell.Bobbing = (posture & 8) != 0; shell.Carrying = Object.op_Implicit((Object)(object)BeamTarget); PhysGrabObject beamTarget = BeamTarget; shell.CarryAt = ((Object.op_Implicit((Object)(object)beamTarget) && Object.op_Implicit((Object)(object)beamTarget.rb)) ? new Vector3?(beamTarget.rb.worldCenterOfMass) : ((Vector3?)null)); DrawBeam(); } if (state == Activity.Reveal && shownState != Activity.Reveal) { OnRevealStart(); } shownState = state; TickScream(); UpdateNameTag(); } private void HostTick(bool stunned, bool held) { //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = FindModel(); if (mourning && !Object.op_Implicit((Object)(object)val)) { mourning = false; } if (!mourning && !Living(val)) { PickIdentity(); val = FindModel(); } if (!Object.op_Implicit((Object)(object)val)) { return; } if (routine == null) { routine = NewRoutine(); nextVoice = Time.time + 6f; } bool flag = held && !stunned && !routine.Unmasked && (standHeld || !wasHeld); if (standHeld && !flag) { ReleaseStand(); } if (flag) { StandHeld(val); } else if (held) { if (!wasHeld) { breakAt = Time.time + Random.Range(5f, 7f); } routine.Hold(); StopVoice(); Struggle(); wasStunned = true; } else if (stunned) { wasStunned = true; routine.Hold(); StopVoice(); } else if (Time.time >= nextTick) { nextTick = Time.time + (routine.Urgent ? 0.15f : 0.4f); if (wasStunned) { wasStunned = false; if (!(Time.time < selfTumbleUntil) || hurtPending) { if (hurtPending) { routine.Flee(); } else if (!knocked) { routine.Suspect(); nextVoice = Time.time + Random.Range(0.8f, 1.6f); } } hurtPending = false; knocked = false; } if (SemiFunc.EnemyForceLeave(enemy) && Time.time >= nextFlee) { nextFlee = Time.time + 25f; PlayerAvatar val2 = NearestLiving(); routine.WalkAway(Object.op_Implicit((Object)(object)val2) ? ((Component)val2).transform.position : BodyPosition); } if (Disguise(val)) { val = FindModel(); } Rejoin(); if (!Object.op_Implicit((Object)(object)val)) { return; } AvoidOriginal(val); CheckMourning(); routine.Style = PlayStyle.Of(val); routine.Model = val; routine.Ending = SemiFunc.EnemyDirectorEndingHeadToTruck(); routine.GatherPoint = GatherPoint(routine.Ending); routine.Threat = NearestMonster(); bool flag2 = routine.State == Activity.Lure; routine.Tick(PickTarget(val)); if (flag2 && routine.State != Activity.Lure) { ticket = 0; } ResumeTick(); SenseEvents(); CarryTick(); GrabFallenPlayers(); AssistTick(); Trip(); if (routine.CloseDoorNear.HasValue) { CloseDoorNear(routine.CloseDoorNear.Value, 6f); routine.CloseDoorNear = null; } TumbleRoll(); Moves(); state = routine.State; expression = routine.Expression; posture = routine.Posture + (routine.MapOut ? 4 : 0) + (routine.Bobbing ? 8 : 0); } if (!held && standHeld) { ReleaseStand(); } wasHeld = held; posture = (posture & 0xF) | (routine.Unmasked ? 16 : 0) | ((stunned || (held && !standHeld)) ? 32 : 0); if (!stunned && (!held || standHeld)) { TurnSmoothly(); } if (Online && (Time.time >= nextSync || state != sentState || expression != sentExpression || identity != sentIdentity || posture != sentPosture)) { nextSync = Time.time + 3f; sentState = state; sentExpression = expression; sentIdentity = identity; sentPosture = posture; view.RPC("LDStateRPC", (RpcTarget)1, new object[3] { identity, (int)(state + 16 * posture), expression }); } if (routine.Silent || stunned || (held && !standHeld)) { ticket = 0; replyAt = 0f; return; } if (ticket != 0 && Time.time > voiceDeadline) { ticket = 0; string text = GameAccess.Name(val); if (!silentOwners.Contains(identity)) { silentOwners.Add(identity); Plugin.Log("Living Double: NO answer from " + text + "'s game to a voice request. Their mod is missing or a different version (theirs: " + (versions.ContainsKey(Object.op_Implicit((Object)(object)val.photonView) ? val.photonView.OwnerActorNr : (-1)) ? versions[val.photonView.OwnerActorNr] : "never reported") + ", host: 1.0.3)"); } if (!CallLureTarget() && !spokeWithVoice.Contains(identity) && !answeredOwners.Contains(identity) && Time.time >= nextFallback && ((requestedContext >> 4) & 7) != 3) { nextFallback = Time.time + 60f; Fallback(val); } } if (routine.State == Activity.Lure) { replyAt = (awaitAnswerUntil = 0f); if (Plugin.VoiceOn.Value && routine.WantsLureCall && !Speaking && ticket == 0) { routine.WantsLureCall = false; addressing = ActorOf(routine.LureTarget); Say(val, PhraseBank.Request(4, 2, -1)); } return; } AttendSpeakers(val); TrackTeamTalk(); ListenForSpeech(val); bool flag3 = OtherMimicSpeakingNear(35f); if (flag3) { if (replyAt > 0f && Time.time >= replyAt - 0.2f) { replyAt = Time.time + Random.Range(0.4f, 0.9f); } if (Time.time >= nextVoice - 0.5f) { nextVoice = Time.time + Random.Range(1.5f, 3.5f); } } if (Speaking) { if (replyAt > 0f && Time.time >= replyAt) { replyAt = Time.time + 0.5f; } if (Time.time >= nextVoice) { nextVoice = Time.time + 1f; } } if (replyAt > 0f && Time.time >= replyAt) { Heard value; bool flag4 = heard.TryGetValue(replySpeaker, out value) && Time.time - value.At < 3f; if (!flag4 && Time.time < replyGiveUp) { replyAt = Time.time + 0.15f; } else { replyAt = 0f; lastReplyAt = Time.time; int want = ReplyWant(flag4, value); if (assistAck) { assistAck = false; want = 4; } nextReplyAllowed = Time.time + 2f; bool flag5 = ConversationTurn(replySpeaker, flag4 && value.Question, ref want); nextVoice = Mathf.Max(nextVoice, Time.time + Random.Range(6f, 10f)); answering = (flag4 ? value.Print : null); if (Plugin.VoiceOn.Value) { Say(val, PhraseBank.Request((want == 0) ? 3 : 5, want, routine.VoiceContext) | 0x10000); } if (flag5) { routine.EndConversation(); } } } if (!flag3) { ConversationTick(val); ScenarioLines(val); } if (!(Time.time >= nextVoice)) { return; } if (!AnyoneListening(20f)) { nextVoice = Time.time + 4f; return; } if (SomeoneTalkingNear(20f)) { nextVoice = Time.time + Random.Range(0.8f, 2f); return; } PlayStyle playStyle = PlayStyle.Of(val); float num = Mathf.Clamp(60f / Mathf.Max(1.5f, playStyle.SpeakRate * 0.9f), 2f, 30f) * ((routine.Phase == 0) ? 1.25f : 1f) * TeamPace(); nextVoice = ((playStyle.SpeakRate > 8f && Random.value < 0.3f) ? (Time.time + Random.Range(1f, 2.5f)) : (Time.time + num * Random.Range(0.5f, 1.5f))); int num2 = routine.VoiceContext; if (Plugin.SomeoneJustDied() && !routine.Unmasked) { num2 = PhraseBank.Request(8, 0, 6); } if (num2 == 4 || Random.value < 0.25f) { num2 += 32; addressing = ActorOf(PickTarget(val)); awaitAnswerUntil = Time.time + 5f; promptRepeated = false; } if (routine.HidingWithSomeone(PickTarget(val))) { nextVoice = Time.time + Random.Range(2.5f, 4.5f); bool flag6 = Random.value < 0.4f; num2 = PhraseBank.Request(6, flag6 ? 2 : 0, 6); if (flag6) { awaitAnswerUntil = Time.time + 5f; promptRepeated = false; } } if (Time.time < hurtLineUntil) { hurtLineUntil = 0f; num2 = 55; } if (CanSpeak(val)) { Say(val, num2); } } private static int ReplyWant(bool knows, Heard info) { if (!knows) { return 1; } if (info.Question) { if (!(info.Seconds < 1.8f) || !(Random.value < 0.6f)) { return 1; } return 4; } if (!(info.Seconds < 1.5f)) { return 1; } return 4; } private void ReportOwnSpeech() { //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) int finished = VoiceMemory.Finished; if (finished == reportedFinished) { return; } reportedFinished = finished; Heard value = new Heard { At = Time.time, Seconds = VoiceMemory.LastSeconds, Question = VoiceMemory.LastWasQuestion, Print = VoiceMemory.LastPrint }; if (Plugin.Verbose.Value) { Plugin.Log("Living Double heard a " + (value.Question ? "question" : "statement") + " (" + value.Seconds.ToString("0.0") + " s)"); } if (Host) { heard[-1] = value; if (Online) { view.RPC("LDTriggerRPC", (RpcTarget)1, new object[2] { PhotonNetwork.LocalPlayer.ActorNumber, value.Print }); } return; } PlayerAvatar instance = PlayerAvatar.instance; if (Online && Object.op_Implicit((Object)(object)instance) && !(Vector3.Distance(((Component)instance).transform.position, BodyPosition) > 20f)) { view.RPC("LDHeardRPC", (RpcTarget)2, new object[3] { value.Question, value.Seconds, value.Print }); } } [PunRPC] private void LDHeardRPC(bool question, float seconds, float[] print, PhotonMessageInfo info) { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient || info.Sender == null) { return; } if (print != null && print.Length != 16) { print = null; } heard[info.Sender.ActorNumber] = new Heard { At = Time.time, Seconds = Mathf.Clamp(seconds, 0f, 10f), Question = question, Print = print }; if (print != null) { view.RPC("LDTriggerRPC", (RpcTarget)1, new object[2] { info.Sender.ActorNumber, print }); TriggerHeard(info.Sender.ActorNumber, print); } if (question && replyAt <= 0f && Time.time - lastReplyAt > 2f && Plugin.Answer.Value) { PlayerAvatar val = PlayerOf(info.Sender.ActorNumber); if (Object.op_Implicit((Object)(object)val)) { ScheduleReply(info.Sender.ActorNumber, Vector3.Distance(((Component)val).transform.position, BodyPosition)); } } } private bool ConversationTurn(int speaker, bool wasQuestion, ref int want) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (!InConversation || speaker != convoWith) { convoWith = speaker; convoTurns = 0; convoLength = Random.Range(3, 7); convoExtended = false; lastAskedBack = false; } convoTurns++; convoUntil = Time.time + 8f; convoNudgeAt = Time.time + Random.Range(3.5f, 5.5f); awaitAnswerUntil = 0f; PlayerAvatar val = PlayerOf(speaker); if (Object.op_Implicit((Object)(object)val)) { routine.Converse(((Component)val).transform.position + Vector3.up * 1.4f, 8f); routine.AddTrust(val, 3f); } bool flag = convoTurns >= convoLength; if (flag && wasQuestion && !convoExtended) { convoExtended = true; convoLength += 2; flag = false; } if (flag) { want = 5; } else if (!wasQuestion && convoTurns > 1 && !lastAskedBack && Random.value < 0.45f) { want = 2; } lastAskedBack = want == 2; if (lastAskedBack) { addressing = ((speaker != -1) ? speaker : ((PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : 0)); } if (flag) { convoUntil = 0f; nextReplyAllowed = Time.time + Random.Range(6f, 10f); } if (Plugin.Verbose.Value) { Plugin.Log("Living Double conversation turn " + convoTurns + "/" + convoLength + (wasQuestion ? ", answering a question" : "") + (lastAskedBack ? ", asking back" : "") + (flag ? " (wrapping up)" : "")); } return flag; } private void ConversationTick(PlayerAvatar model) { if (!Plugin.VoiceOn.Value || Speaking || replyAt > 0f || ticket != 0) { return; } if (InConversation && Time.time >= convoNudgeAt) { convoNudgeAt = float.MaxValue; if (Random.value < 0.5f) { int want = 0; bool flag = ConversationTurn(convoWith, wasQuestion: false, ref want); Say(model, PhraseBank.Request((want == 2) ? 4 : 3, want, routine.VoiceContext) | 0x10000); if (flag) { routine.EndConversation(); } } } else if (awaitAnswerUntil > 0f && Time.time >= awaitAnswerUntil) { awaitAnswerUntil = 0f; if (!promptRepeated && Random.value < 0.5f && AnyoneListening(20f) && CanSpeak(model)) { promptRepeated = true; Say(model, 36); awaitAnswerUntil = Time.time + 5f; } } } private void ScheduleReply(int speaker, float distance, bool late = false) { if (Host && InterpretSpeech(PlayerOf(speaker))) { assistAck = true; } bool flag = (InConversation && speaker == convoWith) || Time.time < awaitAnswerUntil; if (!(distance > (flag ? 16f : 12f)) && (!(Time.time < nextReplyAllowed) || flag) && (flag || ClaimReply(speaker, distance))) { if (flag) { ClaimReply(speaker, 0f); } replySpeaker = speaker; PlayerAvatar val = FindModel(); float num = (Object.op_Implicit((Object)(object)val) ? Mathf.Clamp(PlayStyle.Of(val).ReplyDelay, 0.3f, 2f) : 0.9f); replyAt = Time.time + num * (late ? 0.3f : 1f) * (flag ? 0.75f : 1f) * Random.Range(0.8f, 1.25f); replyGiveUp = replyAt + (flag ? 0.8f : 1.2f); } } private PlayerAvatar PlayerOf(int speaker) { if (speaker == -1) { return PlayerAvatar.instance; } foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.photonView) && item.photonView.OwnerActorNr == speaker) { return item; } } return null; } [PunRPC] private void LDTriggerRPC(int speakerActor, float[] print, PhotonMessageInfo info) { if (info.Sender != null && info.Sender.IsMasterClient) { TriggerHeard(speakerActor, print); } } private void TriggerHeard(int speakerActor, float[] print) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (print == null || print.Length != 16 || PhotonNetwork.LocalPlayer == null || speakerActor == PhotonNetwork.LocalPlayer.ActorNumber) { return; } PlayerAvatar instance = PlayerAvatar.instance; PlayerAvatar val = null; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.photonView) && item.photonView.OwnerActorNr == speakerActor) { val = item; } } if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)val) && !(Vector3.Distance(((Component)instance).transform.position, ((Component)val).transform.position) > 20f)) { VoiceMemory.HeardOther(print); } } private void ScenarioLines(PlayerAvatar model) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (routine != null && routine.WantsGiveAway) { routine.WantsGiveAway = false; EnemyDirector instance = EnemyDirector.instance; if (Object.op_Implicit((Object)(object)instance)) { try { instance.SetInvestigate(routine.GiveAwaySpot, 15f, false); } catch { } } if (Plugin.VoiceOn.Value && !Speaking && ticket == 0) { Say(model, PhraseBank.Request(6, 0, 6, 2)); } nextVoice = Mathf.Max(nextVoice, Time.time + 3f); } else { if (!Plugin.VoiceOn.Value || routine == null || Speaking || ticket != 0 || ReactionLine(model)) { return; } if (routine.WantsWhisper) { routine.WantsWhisper = false; Say(model, PhraseBank.Request(6, 4, 6, 1)); nextVoice = Mathf.Max(nextVoice, Time.time + 4f); } else if (routine.WantsWarning) { routine.WantsWarning = false; Say(model, PhraseBank.Request(6, 0, 6, 2)); nextVoice = Mathf.Max(nextVoice, Time.time + 3f); } else if (routine.WantsChallenge) { routine.WantsChallenge = false; if (CanSpeak(model)) { Say(model, PhraseBank.Request(5, 2, -1)); } nextVoice = Mathf.Max(nextVoice, Time.time + 3f); } else if (routine.WantsNoiseLine) { routine.WantsNoiseLine = false; if (CanSpeak(model)) { Say(model, PhraseBank.Request(1, 2, 6)); } nextVoice = Mathf.Max(nextVoice, Time.time + 3f); } } } private void Trip() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar tripVictim = routine.TripVictim; if (Object.op_Implicit((Object)(object)tripVictim)) { Vector3? tripTowards = routine.TripTowards; routine.TripVictim = null; routine.TripTowards = null; PlayerTumble val = GameAccess.Tumble(tripVictim); if (Object.op_Implicit((Object)(object)val) && tripTowards.HasValue && Living(tripVictim)) { Vector3 val2 = tripTowards.Value - ((Component)tripVictim).transform.position; val2.y = 0f; val2 = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : ((Component)enemy).transform.forward); val.TumbleRequest(true, false); val.TumbleOverrideTime(1.8f); val.TumbleForce(val2 * 9f + Vector3.up * 3f); Plugin.Log("Living Double tripped " + GameAccess.Name(tripVictim) + " towards a monster"); } } } private int SpeakerOf(PlayerAvatar p) { if ((Object)(object)p == (Object)(object)PlayerAvatar.instance) { return -1; } if (!Object.op_Implicit((Object)(object)p) || !Object.op_Implicit((Object)(object)p.photonView)) { return int.MinValue; } return p.photonView.OwnerActorNr; } private void AvoidOriginal(PlayerAvatar model) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) if (!Online || Hint == 2 || mourning || !Living(model) || Time.time < nextFlee || state == Activity.Reveal || state == Activity.Hunt || state == Activity.Retreat) { return; } Vector3 val = ((Component)model).transform.position + Vector3.up * 1.4f; if (!(Vector3.Distance(val, BodyPosition) > 9f) && !Physics.Linecast(val, BodyPosition, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1)) { if (Hint == 0 && !challengedOriginal && Random.value < 0.5f) { challengedOriginal = true; nextFlee = Time.time + 8f; routine.Attend(val); routine.WantsChallenge = true; Plugin.Log("Living Double faces the real " + GameAccess.Name(model) + " as if they were the fake"); } else { challengedOriginal = false; nextFlee = Time.time + 25f; routine.WalkAway(((Component)model).transform.position); } } } private void Struggle() { if (!Object.op_Implicit((Object)(object)stunState)) { stunState = ((Component)this).GetComponent<EnemyStateStunned>(); } if (Object.op_Implicit((Object)(object)stunState)) { stunState.Set(1.5f); } if (Time.time >= breakAt) { breakAt = float.MaxValue; GameAccess.BreakFree(GameAccess.Body(enemy)); Plugin.Log("Living Double broke free of the grab"); } } private void StandHeld(PlayerAvatar model) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) PhysGrabObject val = GameAccess.Grab(GameAccess.Body(enemy)); Rigidbody val2 = GameAccess.Rb(GameAccess.Body(enemy)); if (!standHeld) { standHeld = true; standUntil = Time.time + Random.Range(1.5f, 4f); if (Object.op_Implicit((Object)(object)val2) && !val2.isKinematic) { val2.linearVelocity = Vector3.zero; val2.angularVelocity = Vector3.zero; val2.isKinematic = true; madeKinematic = true; } routine.Suspect(); if (Object.op_Implicit((Object)(object)val) && val.playerGrabbing.Count > 0 && Object.op_Implicit((Object)(object)val.playerGrabbing[0])) { routine.AddSuspicion(val.playerGrabbing[0].playerAvatar, 2f); } if (Plugin.VoiceOn.Value && Random.value < 0.6f) { replyAt = 0f; Say(model, 69); } Plugin.Log("Living Double is held standing, like a player in a heal beam"); } routine.Hold(); if (Object.op_Implicit((Object)(object)val) && val.playerGrabbing.Count > 0 && Object.op_Implicit((Object)(object)val.playerGrabbing[0])) { routine.Attend(((Component)val.playerGrabbing[0]).transform.position + Vector3.up * 1.4f); } if (Time.time >= standUntil) { standUntil = Time.time + 0.7f; if (madeKinematic && Object.op_Implicit((Object)(object)val2)) { val2.isKinematic = false; madeKinematic = false; } GameAccess.BreakFree(GameAccess.Body(enemy)); } } private void ReleaseStand() { if (madeKinematic) { Rigidbody val = GameAccess.Rb(GameAccess.Body(enemy)); if (Object.op_Implicit((Object)(object)val)) { val.isKinematic = false; } madeKinematic = false; } standHeld = false; } private void TurnSmoothly() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references)