using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using REPOLib.Objects.Sdk; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("4.0.6.0")] [assembly: AssemblyInformationalVersion("4.0.6+5f1b735e473ca4ccf3b383128fbebd889cb564da")] [assembly: AssemblyProduct("EmpressBracken")] [assembly: AssemblyTitle("EmpressBracken")] [assembly: AssemblyVersion("4.0.6.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace EmpressBracken { internal static class BrackenAudioBank { private static readonly string[] SearchFolders = new string[4] { string.Empty, "Audio", "Bracken Assets", Path.Combine("Bracken Assets", "Audio") }; private static readonly string[] AngerNames = new string[4] { "angered", "Angered", "anger", "Anger" }; private static readonly string[] CrackNames = new string[4] { "crack_neck", "CrackNeck", "crackneck", "crack" }; private static readonly string[] ScurryNames = new string[2] { "scurry", "Scurry" }; private static readonly string[] Extensions = new string[3] { ".ogg", ".wav", ".mp3" }; private static bool _started; private static bool _loaded; internal static AudioClip? AngerClip { get; private set; } internal static AudioClip? CrackClip { get; private set; } internal static AudioClip? ScurryClip { get; private set; } internal static bool Loaded => _loaded; internal static IEnumerator LoadAudioAsync(string pluginDirectory, ManualLogSource log) { if (!_started) { _started = true; yield return LoadClipAsync(pluginDirectory, AngerNames, delegate(AudioClip clip) { AngerClip = clip; }, log); yield return LoadClipAsync(pluginDirectory, CrackNames, delegate(AudioClip clip) { CrackClip = clip; }, log); yield return LoadClipAsync(pluginDirectory, ScurryNames, delegate(AudioClip clip) { ScurryClip = clip; }, log); _loaded = true; log.LogInfo((object)$"Bracken audio load complete. anger={(Object)(object)AngerClip != (Object)null}, crack={(Object)(object)CrackClip != (Object)null}, scurry={(Object)(object)ScurryClip != (Object)null}"); } } private static IEnumerator LoadClipAsync(string pluginDirectory, IReadOnlyList names, Action assign, ManualLogSource log) { string path = ResolveClipPath(pluginDirectory, names); if (string.IsNullOrEmpty(path)) { yield break; } AudioType audioType = GetAudioType(path); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(path).AbsoluteUri, audioType); try { yield return request.SendWebRequest(); if ((int)request.result != 1) { log.LogWarning((object)("Failed to load Bracken audio clip from " + path + ": " + request.error)); yield break; } AudioClip clip = DownloadHandlerAudioClip.GetContent(request); ((Object)clip).name = Path.GetFileNameWithoutExtension(path); ((Object)clip).hideFlags = (HideFlags)61; assign(clip); } finally { ((IDisposable)request)?.Dispose(); } } private static string? ResolveClipPath(string pluginDirectory, IReadOnlyList names) { string[] searchFolders = SearchFolders; foreach (string text in searchFolders) { string text2 = (string.IsNullOrEmpty(text) ? pluginDirectory : Path.Combine(pluginDirectory, text)); if (!Directory.Exists(text2)) { continue; } foreach (string name in names) { string[] extensions = Extensions; foreach (string text3 in extensions) { string text4 = Path.Combine(text2, name + text3); if (File.Exists(text4)) { return text4; } } } } return null; } private static AudioType GetAudioType(string path) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) string text = Path.GetExtension(path).ToLowerInvariant(); if (1 == 0) { } AudioType result = ((text == ".wav") ? ((AudioType)20) : ((!(text == ".mp3")) ? ((AudioType)14) : ((AudioType)13))); if (1 == 0) { } return result; } } internal sealed class BrackenAudioController : MonoBehaviour { private AudioSource _angerLoopSource = null; private AudioSource _movementLoopSource = null; private AudioSource _oneShotSource = null; private bool _built; private bool _clipsAssigned; private float _angerTargetVolume; private float _movementTargetVolume; private float _movementTargetPitch = 1f; internal bool Ready => _built; internal void Build() { if (_built) { EnsureAudioRouting(); EnsureClipsAssigned(); return; } _angerLoopSource = CreateSource("BrackenAngerLoop", loop: true, 4f, 28f); _movementLoopSource = CreateSource("BrackenScurryLoop", loop: true, 3f, 18f); _oneShotSource = CreateSource("BrackenCrack", loop: false, 3f, 18f); _built = true; EnsureAudioRouting(); EnsureClipsAssigned(); } internal void SetAngerActive(bool active) { _angerTargetVolume = (active ? 0.75f : 0f); if (active) { EnsureClipsAssigned(); if ((Object)(object)_angerLoopSource.clip != (Object)null && !_angerLoopSource.isPlaying) { _angerLoopSource.pitch = Random.Range(0.9f, 1.2f); _angerLoopSource.time = 0f; _angerLoopSource.volume = 0f; _angerLoopSource.Play(); } } } internal void SetMovementLevel(float amount) { float num = Mathf.Clamp01(amount); _movementTargetVolume = 0.3f * num; _movementTargetPitch = Mathf.Lerp(0.8f, 1.25f, num); if (num > 0.01f) { EnsureClipsAssigned(); if ((Object)(object)_movementLoopSource.clip != (Object)null && !_movementLoopSource.isPlaying) { _movementLoopSource.time = 0f; _movementLoopSource.volume = 0f; _movementLoopSource.Play(); } } } internal void PlayCrack() { EnsureClipsAssigned(); if (!((Object)(object)_oneShotSource.clip == (Object)null)) { _oneShotSource.pitch = Random.Range(0.97f, 1.03f); _oneShotSource.PlayOneShot(_oneShotSource.clip, 1f); } } internal void StopAll() { _angerTargetVolume = 0f; _movementTargetVolume = 0f; if (_oneShotSource.isPlaying) { _oneShotSource.Stop(); } } private void Update() { if (_built) { EnsureAudioRouting(); EnsureClipsAssigned(); UpdateLoop(_angerLoopSource, _angerTargetVolume, 2.2f, 1.4f, _angerLoopSource.pitch); UpdateLoop(_movementLoopSource, _movementTargetVolume, 4.6f, 3.2f, _movementTargetPitch); } } private void UpdateLoop(AudioSource source, float targetVolume, float fadeInSpeed, float fadeOutSpeed, float pitchTarget) { source.pitch = Mathf.Lerp(source.pitch, pitchTarget, 8f * Time.deltaTime); float num = ((targetVolume > source.volume) ? fadeInSpeed : fadeOutSpeed); source.volume = Mathf.MoveTowards(source.volume, targetVolume, num * Time.deltaTime); if (targetVolume <= 0.001f && source.isPlaying && source.volume <= 0.001f) { source.Stop(); } } private void EnsureClipsAssigned() { if (!_clipsAssigned && (!((Object)(object)BrackenAudioBank.AngerClip == (Object)null) || !((Object)(object)BrackenAudioBank.CrackClip == (Object)null) || !((Object)(object)BrackenAudioBank.ScurryClip == (Object)null))) { _angerLoopSource.clip = BrackenAudioBank.AngerClip; _movementLoopSource.clip = BrackenAudioBank.ScurryClip; _oneShotSource.clip = BrackenAudioBank.CrackClip; _clipsAssigned = true; } } private void EnsureAudioRouting() { AudioMixerGroup val = (((Object)(object)AudioManager.instance != (Object)null) ? AudioManager.instance.SoundMasterGroup : null); if (!((Object)(object)val == (Object)null)) { _angerLoopSource.outputAudioMixerGroup = val; _movementLoopSource.outputAudioMixerGroup = val; _oneShotSource.outputAudioMixerGroup = val; } } private AudioSource CreateSource(string name, bool loop, float minDistance, float maxDistance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown GameObject val = new GameObject(name) { layer = ((Component)this).gameObject.layer }; val.transform.SetParent(((Component)this).transform, false); AudioSource val2 = val.AddComponent(); val2.playOnAwake = false; val2.loop = loop; val2.volume = 0f; val2.spatialBlend = 1f; val2.rolloffMode = (AudioRolloffMode)0; val2.minDistance = minDistance; val2.maxDistance = maxDistance; val2.dopplerLevel = 0f; val2.reverbZoneMix = 1f; val2.priority = 96; return val2; } } internal enum BrackenState { SpawnIntro, Stalk, Evade, Anger, Kill, CarryHead, Cooldown } internal sealed class BrackenFlowermanBrain : MonoBehaviour, IPunObservable { private const float SightDistance = 30f; private const float KillDistance = 3.05f; private const float SpawnIntroTime = 1.5f; private const float StandUpTime = 0.7f; private const float KillAnimationTime = 3f; private const float CarryHeadTime = 10f; private EnemyParent _enemyParent = null; private Enemy _enemy = null; private EnemyNavMeshAgent _enemyNavMeshAgent = null; private BrackenShadowVisual _visual = null; private BrackenAudioController _audio = null; private Transform _centerTransform = null; private NavMeshAgent _navMeshAgent = null; private BrackenState _state; private PlayerAvatar? _targetPlayer; private PlayerAvatar? _killPlayer; private PlayerDeathHead? _carriedHead; private Quaternion _networkRotation; private float _stateTimer; private float _angerMeter; private float _angerCheckInterval; private float _evadeStealthTimer; private float _decisionTimer; private float _killDamageTimer; private float _currentSpeed; private float _localVelX; private float _localVelZ; private float _remoteStateTimer; private int _timesThreatened; private int _timesFoundSneaking; private int _stareDownChanceIncrease; private int _networkTargetViewId = -1; private bool _spawnInitialized; private bool _evadeModeStareDown; private bool _killDamageApplied; private bool _initialized; private Vector3 _lastPosition; private Vector3 _carryDestination; internal void Initialize(EnemyParent enemyParent, Enemy enemy, EnemyNavMeshAgent enemyNavMeshAgent, BrackenShadowVisual visual, BrackenAudioController audio, Transform centerTransform) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) _enemyParent = enemyParent; _enemy = enemy; _enemyNavMeshAgent = enemyNavMeshAgent; _visual = visual; _audio = audio; _centerTransform = centerTransform; _navMeshAgent = RepoEnemyAccess.GetAgent(enemyNavMeshAgent); _networkRotation = ((Component)this).transform.rotation; _lastPosition = ((Component)this).transform.position; _initialized = true; } internal void HandleSpawnEvent() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (_initialized) { EnsureSpawnRuntimeReady(); ReleaseCarriedHead(dropAtDestination: false); _state = BrackenState.SpawnIntro; _stateTimer = 1.5f; _angerMeter = 0f; _angerCheckInterval = 0f; _evadeStealthTimer = 0f; _decisionTimer = 0f; _killDamageTimer = 0.45f; _currentSpeed = 0f; _timesThreatened = 0; _timesFoundSneaking = 0; _stareDownChanceIncrease = 0; _spawnInitialized = true; _evadeModeStareDown = false; _killDamageApplied = false; _targetPlayer = null; _killPlayer = null; _carriedHead = null; _carryDestination = ((Component)this).transform.position; _networkTargetViewId = -1; RepoEnemyAccess.SetTargetPlayer(_enemy, null, -1); _enemy.CurrentState = (EnemyState)1; _enemyNavMeshAgent.Stop(0.2f); _audio.StopAll(); _lastPosition = ((Component)this).transform.position; } } private void Update() { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (!_initialized) { return; } if (!IsGameplayReady()) { _audio.StopAll(); } else if (_spawnInitialized) { if (GameManager.Multiplayer() && !RepoEnemyAccess.GetMasterClient(_enemy)) { ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, _networkRotation, Time.deltaTime * 14f); UpdateRemoteTarget(); UpdateVisuals(_state, _remoteStateTimer); _lastPosition = ((Component)this).transform.position; } else { TickHostLogic(); UpdateVisuals(_state, _stateTimer); _lastPosition = ((Component)this).transform.position; } } } private void TickHostLogic() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 if (!RepoEnemyAccess.GetSpawned(_enemyParent) || (int)_enemy.CurrentState == 11) { _audio.StopAll(); return; } if (_enemy.IsStunned()) { _state = BrackenState.Evade; _stateTimer = Mathf.Max(_stateTimer, 0.5f); _angerMeter = Mathf.Max(_angerMeter, 6f); _enemyNavMeshAgent.Stop(0.1f); FaceClosestPlayer(12f); SyncNetworkState(); return; } if (_stateTimer > 0f) { _stateTimer -= Time.deltaTime; } PlayerAvatar player; bool flag = TryGetObservedPlayer(out player); if (_state == BrackenState.Stalk && flag) { EnterEvade(player); } else if (_state == BrackenState.Evade && flag && _evadeStealthTimer > 0.5f) { HandleLookTrigger(player); } switch (_state) { case BrackenState.SpawnIntro: TickSpawnIntro(); break; case BrackenState.Stalk: TickStalk(); break; case BrackenState.Evade: TickEvade(player, flag); break; case BrackenState.Anger: TickAnger(); break; case BrackenState.Kill: TickKill(); break; case BrackenState.CarryHead: TickCarryHead(); break; case BrackenState.Cooldown: TickCooldown(); break; } SyncNetworkState(); } private void TickSpawnIntro() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) _enemyNavMeshAgent.Stop(0.25f); _enemy.CurrentState = (EnemyState)1; if (_stateTimer <= 0f) { EnterStalk(); } } private void TickStalk() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) _enemy.CurrentState = (EnemyState)8; _targetPlayer = GetClosestValidPlayer(); if ((Object)(object)_targetPlayer == (Object)null) { Wander(); return; } FacePlayer(_targetPlayer, 6f); if (_decisionTimer <= 0f) { _decisionTimer = 0.4f; if (TryFindStalkDestination(_targetPlayer, out var destination)) { SetMoveDestination(destination, 6f, 48f); } } else { _decisionTimer -= Time.deltaTime; } if (Vector3.Distance(((Component)this).transform.position, ((Component)_targetPlayer).transform.position) < 3f) { AddToAngerMeter(Time.deltaTime * 0.3f); } } private void TickEvade(PlayerAvatar? observedPlayer, bool observed) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) _enemy.CurrentState = (EnemyState)5; _targetPlayer = observedPlayer ?? _targetPlayer ?? GetClosestValidPlayer(); if ((Object)(object)_targetPlayer == (Object)null) { EnterStalk(); return; } _evadeStealthTimer += Time.deltaTime; FacePlayer(_targetPlayer, 10f); if (_evadeModeStareDown && _evadeStealthTimer < 1.25f) { _enemyNavMeshAgent.Stop(0.1f); AddToAngerMeter(Time.deltaTime * 1.5f); } else { _evadeModeStareDown = false; if (_decisionTimer <= 0f) { _decisionTimer = 0.33f; if (TryFindEvadeDestination(_targetPlayer, out var destination)) { _currentSpeed = Mathf.Clamp(_currentSpeed + Time.deltaTime * 4.25f, 0f, 6f); SetMoveDestination(destination, Mathf.Max(_currentSpeed, 2.5f), 70f); } } else { _decisionTimer -= Time.deltaTime; } } float num = ((_timesFoundSneaking % 3 != 0) ? 11f : 24f); if (!observed && _evadeStealthTimer >= num) { EnterStalk(); } } private void TickAnger() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (_targetPlayer == null) { _targetPlayer = GetClosestValidPlayer(); } if ((Object)(object)_targetPlayer == (Object)null) { EnterEvade(null); return; } if (_stateTimer > 0f) { _enemy.CurrentState = (EnemyState)3; _enemyNavMeshAgent.Stop(0.1f); FacePlayer(_targetPlayer, 12f); return; } _enemy.CurrentState = (EnemyState)4; _currentSpeed = Mathf.Clamp(_currentSpeed + Time.deltaTime * 1.2f, 3f, 12f); SetMoveDestination(((Component)_targetPlayer).transform.position, _currentSpeed, 100f); FacePlayer(_targetPlayer, 18f); if (IsPlayerWithinKillReach(_targetPlayer)) { BeginKill(_targetPlayer); return; } _angerMeter -= Time.deltaTime; if (_angerMeter <= 0f) { EnterEvade(_targetPlayer); } } private void TickKill() { //IL_0008: 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) _enemy.CurrentState = (EnemyState)4; _enemyParent.SpawnedTimerPause(0.75f); _enemyNavMeshAgent.Stop(0.2f); if ((Object)(object)_killPlayer != (Object)null) { FacePlayer(_killPlayer, 24f); } _killDamageTimer -= Time.deltaTime; if (!_killDamageApplied && _killDamageTimer <= 0f && (Object)(object)_killPlayer != (Object)null && !RepoEnemyAccess.IsDisabled(_killPlayer)) { int num = SemiFunc.EnemyGetIndex(_enemy); _killPlayer.playerHealth.HurtOther(9999, ((Component)_killPlayer).transform.position, false, num, false); _killPlayer.PlayerDeath(num); _killPlayer.EnemyVisionFreezeTimerSet(0.75f); _audio.PlayCrack(); _killDamageApplied = true; } if (_killDamageApplied && (Object)(object)_killPlayer != (Object)null && RepoEnemyAccess.IsDeadSet(_killPlayer) && (Object)(object)_killPlayer.playerDeathHead != (Object)null && RepoEnemyAccess.IsTriggered(_killPlayer.playerDeathHead)) { BeginCarryHead(_killPlayer.playerDeathHead); } else if (_stateTimer <= 0f) { EnterCooldown(); } } private void TickCarryHead() { //IL_0008: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) _enemy.CurrentState = (EnemyState)5; _enemyParent.SpawnedTimerPause(1f); _enemyNavMeshAgent.Stop(0f); if ((Object)(object)_carriedHead == (Object)null || !RepoEnemyAccess.IsTriggered(_carriedHead)) { ReleaseCarriedHead(dropAtDestination: false); EnterCooldown(); return; } _carriedHead.OverrideSpectated(0.4f); _carriedHead.OverridePositionRotation(_visual.CarryAnchorTransform, _carryDestination, ((Component)this).transform.rotation, 0.12f); if (_decisionTimer <= 0f) { _decisionTimer = 0.25f; SetMoveDestination(_carryDestination, 7.25f, 54f); } else { _decisionTimer -= Time.deltaTime; } FacePosition(_carryDestination, 16f); if (Vector3.Distance(((Component)this).transform.position, _carryDestination) <= 1.35f || _stateTimer <= 0f) { ReleaseCarriedHead(dropAtDestination: true); EnterCooldown(); } } private void TickCooldown() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) _enemy.CurrentState = (EnemyState)2; _enemyNavMeshAgent.Stop(0.2f); FaceClosestPlayer(10f); if (_stateTimer <= 0f) { EnterEvade(GetClosestValidPlayer()); } } private void EnterStalk() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) _state = BrackenState.Stalk; _stateTimer = 0f; _decisionTimer = 0f; _evadeStealthTimer = 0f; _currentSpeed = 6f; _enemy.CurrentState = (EnemyState)8; } private void EnterCooldown() { _state = BrackenState.Cooldown; _stateTimer = 2f; _killPlayer = null; _killDamageApplied = false; } private void EnterEvade(PlayerAvatar? focusPlayer) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) _state = BrackenState.Evade; _stateTimer = 0f; _decisionTimer = 0f; _evadeStealthTimer = 0f; _evadeModeStareDown = false; _currentSpeed = 0f; _targetPlayer = focusPlayer ?? GetClosestValidPlayer(); if ((Object)(object)_targetPlayer != (Object)null) { _timesFoundSneaking++; } _enemy.CurrentState = (EnemyState)5; _enemyNavMeshAgent.Stop(0.1f); } private void EnterAnger() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) _state = BrackenState.Anger; _stateTimer = 0.7f; _currentSpeed = 3f; _angerMeter = Mathf.Max(_angerMeter, 6f); _enemy.CurrentState = (EnemyState)3; } private void BeginKill(PlayerAvatar player) { _state = BrackenState.Kill; _stateTimer = 3f; _killDamageTimer = 0.3f; _killDamageApplied = false; _killPlayer = player; _enemyNavMeshAgent.Stop(0.3f); _killPlayer.EnemyVisionFreezeTimerSet(0.45f); } private void BeginCarryHead(PlayerDeathHead head) { //IL_0059: 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_006e: 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) _carriedHead = head; _killPlayer = null; _killDamageApplied = false; _state = BrackenState.CarryHead; _stateTimer = 10f; _decisionTimer = 0f; _currentSpeed = 6.5f; if (!TryFindHeadCarryDestination(out _carryDestination)) { _carryDestination = ((Component)this).transform.position - ((Component)this).transform.forward * 3.5f; } } private void AddToAngerMeter(float amountToAdd) { EnemyStateStunned stateStunned = RepoEnemyAccess.GetStateStunned(_enemy); if ((Object)(object)stateStunned != (Object)null && stateStunned.stunTimer > 0f) { _angerMeter = 12f; return; } _angerMeter += amountToAdd; if (_angerMeter <= 0.4f) { return; } _angerCheckInterval += Mathf.Max(amountToAdd, 0.1f * Time.deltaTime); if (_angerCheckInterval <= 1f) { return; } _angerCheckInterval = 0f; float num = Mathf.Clamp01(0.09f * _angerMeter); if (Random.value < num) { if (_angerMeter < 2.5f) { _timesThreatened++; } _angerMeter += (float)_timesThreatened / 1.75f; EnterAnger(); } } private void HandleLookTrigger(PlayerAvatar? player) { if ((Object)(object)player == (Object)null) { return; } _targetPlayer = player; if (!_evadeModeStareDown) { if (Random.Range(0, 70) < _stareDownChanceIncrease) { _stareDownChanceIncrease = -6; _evadeModeStareDown = true; } else { _stareDownChanceIncrease++; } _evadeStealthTimer = 0f; } } private void UpdateVisuals(BrackenState visualState, float stateTimer) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - _lastPosition; Vector3 val2 = ((Component)this).transform.InverseTransformDirection(val / Mathf.Max(Time.deltaTime, 0.0001f)); _localVelX = Mathf.Lerp(_localVelX, val2.x, 10f * Time.deltaTime); _localVelZ = Mathf.Lerp(_localVelZ, val2.z, 10f * Time.deltaTime); if (1 == 0) { } BrackenVisualState brackenVisualState = visualState switch { BrackenState.SpawnIntro => BrackenVisualState.Spawn, BrackenState.Stalk => BrackenVisualState.Stalk, BrackenState.Evade => BrackenVisualState.Evade, BrackenState.Anger => BrackenVisualState.Anger, BrackenState.Kill => BrackenVisualState.Kill, BrackenState.CarryHead => BrackenVisualState.Kill, _ => BrackenVisualState.Stalk, }; if (1 == 0) { } BrackenVisualState state = brackenVisualState; if (_enemy.IsStunned()) { state = BrackenVisualState.Stunned; } Transform lookTarget = _killPlayer?.PlayerVisionTarget?.VisionTransform ?? _targetPlayer?.PlayerVisionTarget?.VisionTransform; _visual.UpdatePose(state, new Vector3(_localVelX, 0f, _localVelZ), lookTarget, _evadeModeStareDown); float movementLevel = 0f; if (visualState == BrackenState.Stalk || visualState == BrackenState.Evade || visualState == BrackenState.CarryHead || (visualState == BrackenState.Anger && stateTimer <= 0f)) { Vector3 velocity = _navMeshAgent.velocity; movementLevel = Mathf.InverseLerp(0.1f, 6.5f, ((Vector3)(ref velocity)).magnitude); } _audio.SetAngerActive(visualState == BrackenState.Anger); _audio.SetMovementLevel(movementLevel); } private bool TryGetObservedPlayer(out PlayerAvatar? player) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_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) player = null; float num = 0.45f; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if ((Object)(object)item == (Object)null || RepoEnemyAccess.IsDisabled(item) || (Object)(object)item.PlayerVisionTarget == (Object)null) { continue; } Transform visionTransform = item.PlayerVisionTarget.VisionTransform; Vector3 val = _centerTransform.position - visionTransform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude > 30f) && !(magnitude <= 0.01f)) { Vector3 val2 = val / magnitude; float num2 = Vector3.Dot(visionTransform.forward, val2); if (!(num2 < num) && HasClearRay(visionTransform.position, _centerTransform.position, magnitude)) { num = num2; player = item; } } } return (Object)(object)player != (Object)null; } private PlayerAvatar? GetClosestValidPlayer() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar result = null; float num = float.MaxValue; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!((Object)(object)item == (Object)null) && !RepoEnemyAccess.IsDisabled(item)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; result = item; } } } return result; } private bool TryFindStalkDestination(PlayerAvatar player, out Vector3 destination) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_0066: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00c8: 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) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) destination = ((Component)this).transform.position; LevelPoint val = null; float num = float.MinValue; foreach (LevelPoint levelPathPoint in LevelGenerator.Instance.LevelPathPoints) { if ((Object)(object)levelPathPoint == (Object)null || levelPathPoint.Truck) { continue; } Vector3 position = ((Component)levelPathPoint).transform.position; float num2 = Vector3.Distance(position, ((Component)player).transform.position); if (num2 < 4f || num2 > 18f) { continue; } float num3 = Vector3.Distance(position, ((Component)this).transform.position); if (!(num3 > 30f)) { bool flag = !CanPlayerSeePosition(player, position + Vector3.up * 1.1f, num2); Vector3 forward = player.PlayerVisionTarget.VisionTransform.forward; Vector3 val2 = position - ((Component)player).transform.position; float num4 = Vector3.Dot(forward, ((Vector3)(ref val2)).normalized); float num5 = (flag ? 15f : 0f) - num4 * 10f - num2 - num3 * 0.35f; if (num5 > num) { num = num5; val = levelPathPoint; } } } if ((Object)(object)val != (Object)null) { destination = ((Component)val).transform.position; return true; } LevelPoint val3 = SemiFunc.LevelPointGetPlayerDistance(((Component)this).transform.position, 8f, 20f, false); if ((Object)(object)val3 != (Object)null) { destination = ((Component)val3).transform.position; return true; } return false; } private bool TryFindEvadeDestination(PlayerAvatar player, out Vector3 destination) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) destination = ((Component)this).transform.position; LevelPoint val = null; float num = float.MinValue; foreach (LevelPoint levelPathPoint in LevelGenerator.Instance.LevelPathPoints) { if ((Object)(object)levelPathPoint == (Object)null || levelPathPoint.Truck) { continue; } Vector3 position = ((Component)levelPathPoint).transform.position; float num2 = Vector3.Distance(position, ((Component)player).transform.position); if (num2 < 8f) { continue; } float num3 = Vector3.Distance(position, ((Component)this).transform.position); if (!(num3 > 45f)) { bool flag = !CanPlayerSeePosition(player, position + Vector3.up * 1f, num2); float num4 = num2 + (flag ? 20f : 0f) - num3; if (num4 > num) { num = num4; val = levelPathPoint; } } } if ((Object)(object)val != (Object)null) { destination = ((Component)val).transform.position; return true; } LevelPoint val2 = SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 5f); if ((Object)(object)val2 != (Object)null) { destination = ((Component)val2).transform.position; return true; } return false; } private void Wander() { //IL_0008: 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_006c: Unknown result type (might be due to invalid IL or missing references) _enemy.CurrentState = (EnemyState)2; if (_decisionTimer > 0f) { _decisionTimer -= Time.deltaTime; return; } _decisionTimer = 1f; LevelPoint val = SemiFunc.LevelPointGet(((Component)this).transform.position, 5f, 25f); if ((Object)(object)val != (Object)null) { SetMoveDestination(((Component)val).transform.position, 4f, 24f); } else { _enemyNavMeshAgent.Stop(0.2f); } } private void SetMoveDestination(Vector3 destination, float speed, float acceleration) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) _enemyNavMeshAgent.UpdateAgent(speed, acceleration); _enemyNavMeshAgent.SetDestination(destination); } private void FacePlayer(PlayerAvatar player, float turnSpeed) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) FacePosition(((Object)(object)player.PlayerVisionTarget != (Object)null) ? player.PlayerVisionTarget.VisionTransform.position : ((Component)player).transform.position, turnSpeed); } private void FaceClosestPlayer(float turnSpeed) { PlayerAvatar closestValidPlayer = GetClosestValidPlayer(); if ((Object)(object)closestValidPlayer != (Object)null) { FacePlayer(closestValidPlayer, turnSpeed); } } private void FacePosition(Vector3 position, float turnSpeed) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position - ((Component)this).transform.position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude <= 0.0001f)) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, turnSpeed * Time.deltaTime); } } private bool HasClearRay(Vector3 from, Vector3 to, float distance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; Vector3 normalized = ((Vector3)(ref val)).normalized; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(from, normalized, ref val2, distance, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()), (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val2)).transform.IsChildOf(((Component)this).transform) || ((Object)(object)_targetPlayer != (Object)null && ((RaycastHit)(ref val2)).transform.IsChildOf(((Component)_targetPlayer).transform)); } return true; } private bool CanPlayerSeePosition(PlayerAvatar player, Vector3 position, float distance) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) Transform visionTransform = player.PlayerVisionTarget.VisionTransform; Vector3 val = position - visionTransform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Vector3.Dot(visionTransform.forward, normalized); if (num < 0.32f) { return false; } return HasClearRay(visionTransform.position, position, distance); } private bool TryFindHeadCarryDestination(out Vector3 destination) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) destination = ((Component)this).transform.position; LevelPoint val = null; float num = float.MinValue; NavMeshHit val2 = default(NavMeshHit); foreach (LevelPoint levelPathPoint in LevelGenerator.Instance.LevelPathPoints) { if ((Object)(object)levelPathPoint == (Object)null || levelPathPoint.Truck || RepoEnemyAccess.IsInStartRoom(levelPathPoint) || (Object)(object)levelPathPoint.Room == (Object)null || levelPathPoint.Room.Truck) { continue; } Vector3 position = ((Component)levelPathPoint).transform.position; if (!NavMesh.SamplePosition(position, ref val2, 1.5f, -1)) { continue; } float num2 = Vector3.Distance(position, ((Component)this).transform.position); if (num2 < 4f) { continue; } float num3 = float.MaxValue; bool flag = false; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!((Object)(object)item == (Object)null) && !RepoEnemyAccess.IsDisabled(item) && !((Object)(object)item.PlayerVisionTarget == (Object)null)) { float num4 = Vector3.Distance(position, ((Component)item).transform.position); num3 = Mathf.Min(num3, num4); if (!flag && CanPlayerSeePosition(item, position + Vector3.up * 1.15f, num4)) { flag = true; } } } if (num3 == float.MaxValue) { num3 = 20f; } float num5 = num3 + (flag ? (-18f) : 24f) - num2 * 0.18f; if (num5 > num) { num = num5; val = levelPathPoint; } } if ((Object)(object)val != (Object)null) { destination = ((Component)val).transform.position; return true; } LevelPoint val3 = SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 10f); if ((Object)(object)val3 != (Object)null) { destination = ((Component)val3).transform.position; return true; } return false; } private void ReleaseCarriedHead(bool dropAtDestination) { //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_0021: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_carriedHead == (Object)null) { return; } if (dropAtDestination) { Vector3 val = _carryDestination; NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(val, ref val2, 2f, -1)) { val = ((NavMeshHit)(ref val2)).position; } _carriedHead.OverridePositionRotation(_visual.CarryAnchorTransform, val, ((Component)this).transform.rotation, 0.02f); _carriedHead.OverridePositionRotationReset(); } _carriedHead.OverrideSpectatedReset(); _carriedHead = null; } private bool IsGameplayReady() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 return (Object)(object)LevelGenerator.Instance != (Object)null && LevelGenerator.Instance.Generated && (Object)(object)GameDirector.instance != (Object)null && (int)GameDirector.instance.currentState == 2 && !SemiFunc.RunIsLobbyMenu() && !SemiFunc.MenuLevel(); } private void EnsureSpawnRuntimeReady() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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) if (!_visual.Ready) { _visual.Build(); _enemy.KillLookAtTransform = _visual.HeadTransform; } if (!_audio.Ready) { _audio.Build(); } if (((Behaviour)_navMeshAgent).enabled && _navMeshAgent.isOnNavMesh) { if (!((Behaviour)_enemyNavMeshAgent).enabled) { ((Behaviour)_enemyNavMeshAgent).enabled = true; } return; } Vector3 position = ((Component)_navMeshAgent).transform.position; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val, 6f, -1)) { ((Behaviour)_navMeshAgent).enabled = true; _navMeshAgent.Warp(((NavMeshHit)(ref val)).position); if (!((Behaviour)_enemyNavMeshAgent).enabled) { ((Behaviour)_enemyNavMeshAgent).enabled = true; } } } private bool IsPlayerWithinKillReach(PlayerAvatar player) { //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) Vector3 position = _centerTransform.position; Vector3 val = (((Object)(object)player.PlayerVisionTarget != (Object)null) ? player.PlayerVisionTarget.VisionTransform.position : (((Component)player).transform.position + Vector3.up * 1.1f)); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(position.x, position.z); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(val.x, val.z); float num = Mathf.Abs(position.y - val.y); return Vector2.Distance(val2, val3) <= 3.05f && num <= 2.4f; } private void SyncNetworkState() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) _networkRotation = ((Component)this).transform.rotation; _remoteStateTimer = _stateTimer; _networkTargetViewId = (((Object)(object)_targetPlayer != (Object)null) ? _targetPlayer.photonView.ViewID : (-1)); RepoEnemyAccess.SetTargetPlayer(_enemy, _targetPlayer, _networkTargetViewId); } private void UpdateRemoteTarget() { if (_networkTargetViewId == -1) { _targetPlayer = null; return; } foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if ((Object)(object)item != (Object)null && item.photonView.ViewID == _networkTargetViewId) { _targetPlayer = item; return; } } _targetPlayer = null; } public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { //IL_0001: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { if (stream.IsWriting) { stream.SendNext((object)(int)_state); stream.SendNext((object)_stateTimer); stream.SendNext((object)_networkTargetViewId); stream.SendNext((object)((Component)this).transform.rotation); stream.SendNext((object)_evadeModeStareDown); } else { _state = (BrackenState)stream.ReceiveNext(); _remoteStateTimer = (float)stream.ReceiveNext(); _networkTargetViewId = (int)stream.ReceiveNext(); _networkRotation = (Quaternion)stream.ReceiveNext(); _evadeModeStareDown = (bool)stream.ReceiveNext(); } } } } internal enum BrackenVisualState { Spawn, Stalk, Evade, Anger, Kill, Stunned } internal sealed class BrackenShadowVisual : MonoBehaviour { private Transform _visualRoot = null; private Transform _hips = null; private Transform _chest = null; private Transform _head = null; private Transform _carryAnchor = null; private Transform _leftUpperArm = null; private Transform _leftLowerArm = null; private Transform _rightUpperArm = null; private Transform _rightLowerArm = null; private Transform _leftUpperLeg = null; private Transform _leftLowerLeg = null; private Transform _rightUpperLeg = null; private Transform _rightLowerLeg = null; private Material _shadowMaterial = null; private Material _eyeMaterial = null; private Material _mistMaterial = null; private Transform[] _shadowWisps = Array.Empty(); private Vector3[] _shadowWispBasePositions = Array.Empty(); private Vector3[] _shadowWispBaseScales = Array.Empty(); private Transform[] _mistShells = Array.Empty(); private Vector3[] _mistShellBaseScales = Array.Empty(); private bool _built; internal bool Ready => _built; internal Transform HeadTransform => _head; internal Transform CarryAnchorTransform => _carryAnchor; internal void Build() { //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00a9: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06df: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_0720: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0775: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07b6: Unknown result type (might be due to invalid IL or missing references) if (!_built) { Shader val = Shader.Find("Standard") ?? throw new InvalidOperationException("Could not find Standard shader."); _shadowMaterial = new Material(val) { color = new Color(0.03f, 0.04f, 0.05f, 1f), enableInstancing = true }; _shadowMaterial.SetFloat("_Glossiness", 0.02f); _eyeMaterial = new Material(val) { color = new Color(0.9f, 1f, 0.92f, 1f), enableInstancing = true }; _eyeMaterial.EnableKeyword("_EMISSION"); _eyeMaterial.SetColor("_EmissionColor", new Color(1.2f, 1.5f, 1.25f, 1f)); _eyeMaterial.SetFloat("_Glossiness", 0f); _mistMaterial = CreateTransparentMaterial(val, new Color(0.08f, 0.09f, 0.1f, 0.18f)); _visualRoot = new GameObject("ShadowVisualRoot").transform; _visualRoot.SetParent(((Component)this).transform, false); _hips = new GameObject("Hips").transform; _hips.SetParent(_visualRoot, false); _hips.localPosition = new Vector3(0f, 1f, 0f); _chest = new GameObject("Chest").transform; _chest.SetParent(_hips, false); _chest.localPosition = new Vector3(0f, 0.44f, 0f); _head = new GameObject("Head").transform; _head.SetParent(_chest, false); _head.localPosition = new Vector3(0f, 0.42f, 0.02f); _carryAnchor = new GameObject("CarryAnchor").transform; _carryAnchor.SetParent(_chest, false); _carryAnchor.localPosition = new Vector3(0f, -0.12f, 0.42f); _leftUpperArm = new GameObject("LeftUpperArm").transform; _leftUpperArm.SetParent(_chest, false); _leftUpperArm.localPosition = new Vector3(-0.34f, 0.18f, 0f); _leftLowerArm = new GameObject("LeftLowerArm").transform; _leftLowerArm.SetParent(_leftUpperArm, false); _leftLowerArm.localPosition = new Vector3(0f, -0.52f, 0f); _rightUpperArm = new GameObject("RightUpperArm").transform; _rightUpperArm.SetParent(_chest, false); _rightUpperArm.localPosition = new Vector3(0.34f, 0.18f, 0f); _rightLowerArm = new GameObject("RightLowerArm").transform; _rightLowerArm.SetParent(_rightUpperArm, false); _rightLowerArm.localPosition = new Vector3(0f, -0.52f, 0f); _leftUpperLeg = new GameObject("LeftUpperLeg").transform; _leftUpperLeg.SetParent(_hips, false); _leftUpperLeg.localPosition = new Vector3(-0.16f, -0.42f, 0f); _leftLowerLeg = new GameObject("LeftLowerLeg").transform; _leftLowerLeg.SetParent(_leftUpperLeg, false); _leftLowerLeg.localPosition = new Vector3(0f, -0.62f, 0.02f); _rightUpperLeg = new GameObject("RightUpperLeg").transform; _rightUpperLeg.SetParent(_hips, false); _rightUpperLeg.localPosition = new Vector3(0.16f, -0.42f, 0f); _rightLowerLeg = new GameObject("RightLowerLeg").transform; _rightLowerLeg.SetParent(_rightUpperLeg, false); _rightLowerLeg.localPosition = new Vector3(0f, -0.62f, 0.02f); CreatePart("Torso", (PrimitiveType)1, _chest, Vector3.zero, new Vector3(0.52f, 0.72f, 0.38f), _shadowMaterial); CreatePart("Pelvis", (PrimitiveType)0, _hips, Vector3.zero, new Vector3(0.38f, 0.28f, 0.28f), _shadowMaterial); CreatePart("Head", (PrimitiveType)0, _head, Vector3.zero, new Vector3(0.34f, 0.34f, 0.34f), _shadowMaterial); CreatePart("LeftUpperArmMesh", (PrimitiveType)1, _leftUpperArm, new Vector3(0f, -0.18f, 0f), new Vector3(0.18f, 0.42f, 0.18f), _shadowMaterial); CreatePart("LeftLowerArmMesh", (PrimitiveType)1, _leftLowerArm, new Vector3(0f, -0.18f, 0f), new Vector3(0.15f, 0.38f, 0.15f), _shadowMaterial); CreatePart("RightUpperArmMesh", (PrimitiveType)1, _rightUpperArm, new Vector3(0f, -0.18f, 0f), new Vector3(0.18f, 0.42f, 0.18f), _shadowMaterial); CreatePart("RightLowerArmMesh", (PrimitiveType)1, _rightLowerArm, new Vector3(0f, -0.18f, 0f), new Vector3(0.15f, 0.38f, 0.15f), _shadowMaterial); CreatePart("LeftUpperLegMesh", (PrimitiveType)1, _leftUpperLeg, new Vector3(0f, -0.22f, 0f), new Vector3(0.2f, 0.46f, 0.2f), _shadowMaterial); CreatePart("LeftLowerLegMesh", (PrimitiveType)1, _leftLowerLeg, new Vector3(0f, -0.22f, 0f), new Vector3(0.18f, 0.44f, 0.18f), _shadowMaterial); CreatePart("RightUpperLegMesh", (PrimitiveType)1, _rightUpperLeg, new Vector3(0f, -0.22f, 0f), new Vector3(0.2f, 0.46f, 0.2f), _shadowMaterial); CreatePart("RightLowerLegMesh", (PrimitiveType)1, _rightLowerLeg, new Vector3(0f, -0.22f, 0f), new Vector3(0.18f, 0.44f, 0.18f), _shadowMaterial); CreatePart("LeftEye", (PrimitiveType)0, _head, new Vector3(-0.08f, 0.03f, 0.15f), new Vector3(0.06f, 0.06f, 0.04f), _eyeMaterial); CreatePart("RightEye", (PrimitiveType)0, _head, new Vector3(0.08f, 0.03f, 0.15f), new Vector3(0.06f, 0.06f, 0.04f), _eyeMaterial); BuildShadowWisps(); BuildMistShells(); _built = true; } } internal void UpdatePose(BrackenVisualState state, Vector3 localVelocity, Transform? lookTarget, bool stareDown) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) if (_built) { Vector2 val = new Vector2(localVelocity.x, localVelocity.z); float magnitude = ((Vector2)(ref val)).magnitude; float num = Mathf.Clamp01(magnitude / 6.5f); float num2 = Time.time * Mathf.Lerp(2f, 7.5f, num); float num3 = Mathf.Sin(num2); float num4 = Mathf.Sin(num2 + MathF.PI); float num5 = ((state == BrackenVisualState.Stalk || state == BrackenVisualState.Evade || state == BrackenVisualState.Spawn) ? 1f : 0f); float num6 = ((state == BrackenVisualState.Anger) ? 1f : 0f); float num7 = ((state == BrackenVisualState.Kill) ? 1f : 0f); float num8 = ((state == BrackenVisualState.Stunned) ? 1f : 0f); _visualRoot.localPosition = new Vector3(0f, 0.16f + Mathf.Lerp(-0.15f, 0f, num6), 0f); _hips.localRotation = Quaternion.Euler(Mathf.Lerp(24f, 2f, num6) + Mathf.Lerp(0f, 10f, num7), 0f, Mathf.Lerp(0f, 6f * localVelocity.x, 0.8f)); _chest.localRotation = Quaternion.Euler(Mathf.Lerp(-14f, -2f, num6) + Mathf.Lerp(0f, 22f, num7), stareDown ? Mathf.Lerp(0f, 18f, num + 0.2f) : 0f, Mathf.Lerp(0f, -8f * localVelocity.x, 0.5f)); float num9 = Mathf.Lerp(12f, 42f, num) + num6 * 14f; float num10 = Mathf.Lerp(8f, 34f, num) + num6 * 10f; _leftUpperArm.localRotation = Quaternion.Euler(num3 * num9 - 36f - num7 * 28f, 0f, -18f); _leftLowerArm.localRotation = Quaternion.Euler(-28f - num7 * 52f, 0f, 0f); _rightUpperArm.localRotation = Quaternion.Euler(num4 * num9 - 36f - num7 * 28f, 0f, 18f); _rightLowerArm.localRotation = Quaternion.Euler(-28f - num7 * 52f, 0f, 0f); _leftUpperLeg.localRotation = Quaternion.Euler(num4 * num10, 0f, -2f); _leftLowerLeg.localRotation = Quaternion.Euler(Mathf.Max(0f, 0f - num4) * 26f + num5 * 8f, 0f, 0f); _rightUpperLeg.localRotation = Quaternion.Euler(num3 * num10, 0f, 2f); _rightLowerLeg.localRotation = Quaternion.Euler(Mathf.Max(0f, 0f - num3) * 26f + num5 * 8f, 0f, 0f); if (num8 > 0f) { _hips.localRotation = Quaternion.Euler(45f, 0f, 12f); _chest.localRotation = Quaternion.Euler(-18f, 0f, -18f); _leftUpperArm.localRotation = Quaternion.Euler(-72f, 0f, -30f); _rightUpperArm.localRotation = Quaternion.Euler(-72f, 0f, 30f); } UpdateHeadRotation(lookTarget, num5, num6, stareDown); UpdateCarryAnchor(num5, num6, num7); UpdateAtmosphere(num, num6, num7, num8); } } private void UpdateHeadRotation(Transform? lookTarget, float crouch, float anger, bool stareDown) { //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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0076: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Euler(Mathf.Lerp(18f, -4f, anger), 0f, 0f); if ((Object)(object)lookTarget != (Object)null) { Vector3 val2 = _head.parent.InverseTransformPoint(lookTarget.position); if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f) { float num = Mathf.Atan2(val2.x, val2.z) * 57.29578f; float y = val2.y; Vector2 val3 = new Vector2(val2.x, val2.z); float num2 = (0f - Mathf.Atan2(y, ((Vector2)(ref val3)).magnitude)) * 57.29578f; val = Quaternion.Euler(Mathf.Clamp(num2 + Mathf.Lerp(16f, -6f, anger) + crouch * 10f, -35f, 35f), Mathf.Clamp(num, -55f, 55f), stareDown ? (Mathf.Sin(Time.time * 7f) * 3f) : 0f); } } _head.localRotation = Quaternion.Slerp(_head.localRotation, val, 10f * Time.deltaTime); } private void UpdateCarryAnchor(float crouch, float anger, float kill) { //IL_001e: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) _carryAnchor.localPosition = Vector3.Lerp(new Vector3(0f, -0.08f - crouch * 0.04f, 0.38f), new Vector3(0f, -0.18f, 0.5f), Mathf.Clamp01(kill + anger * 0.45f)); _carryAnchor.localRotation = Quaternion.Slerp(_carryAnchor.localRotation, Quaternion.Euler(78f - kill * 12f, 180f, 0f), 10f * Time.deltaTime); } private void UpdateAtmosphere(float moveLerp, float anger, float kill, float stunned) { //IL_0093: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; float num = 0.35f + moveLerp * 0.45f + anger * 0.3f + kill * 0.18f; float num2 = Mathf.Sin(time * 2.4f + 0.5f); float num3 = Mathf.Cos(time * 1.7f + 1.3f); float num4 = Mathf.Sin(time * 3.8f + 2.1f); _visualRoot.localScale = new Vector3(1.02f + num2 * 0.03f * num, 1f + num3 * 0.02f * num, 1.05f + num4 * 0.04f * num); Transform chest = _chest; chest.localRotation *= Quaternion.Euler(num2 * 2.2f * num, num3 * 2.7f * num, num4 * 1.2f * num); Transform head = _head; head.localRotation *= Quaternion.Euler(num3 * 2.5f * num, num2 * 4.5f * num, num4 * 1.1f * num); for (int i = 0; i < _shadowWisps.Length; i++) { Transform val = _shadowWisps[i]; float num5 = time * (1.15f + (float)i * 0.12f); Vector3 val2 = new Vector3(Mathf.Sin(num5 + (float)i) * 0.05f, Mathf.Sin(num5 * 0.8f + (float)i * 0.5f) * 0.08f, Mathf.Cos(num5 * 1.2f + (float)i) * 0.06f) * (0.55f + num); float num6 = 1f + Mathf.Sin(num5 * 1.7f + (float)i) * 0.18f + anger * 0.08f - stunned * 0.06f; val.localPosition = _shadowWispBasePositions[i] + val2; val.localScale = _shadowWispBaseScales[i] * num6; val.localRotation = Quaternion.Euler(0f, num5 * 28f, num2 * 18f); } for (int j = 0; j < _mistShells.Length; j++) { Transform val3 = _mistShells[j]; float num7 = time * (1.45f + (float)j * 0.18f) + (float)j * 0.73f; float num8 = 1f + Mathf.Sin(num7) * 0.12f + Mathf.Cos(num7 * 1.6f) * 0.08f; val3.localScale = _mistShellBaseScales[j] * (num8 + num * 0.08f); val3.localRotation = Quaternion.Euler(Mathf.Sin(num7 * 1.2f) * 6f, num7 * 18f, Mathf.Cos(num7) * 5f); } } private void CreatePart(string name, PrimitiveType primitiveType, Transform parent, Vector3 localPosition, Vector3 localScale, Material material) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) GameObject val = GameObject.CreatePrimitive(primitiveType); ((Object)val).name = name; val.transform.SetParent(parent, false); val.transform.localPosition = localPosition; val.transform.localRotation = Quaternion.identity; val.transform.localScale = localScale; val.layer = ((Component)this).gameObject.layer; Collider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } MeshRenderer component2 = val.GetComponent(); ((Renderer)component2).sharedMaterial = material; ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)component2).receiveShadows = true; } private void BuildShadowWisps() { //IL_0018: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) (Vector3, Vector3)[] array = new(Vector3, Vector3)[6] { (new Vector3(0f, 1.42f, 0.02f), new Vector3(0.55f, 0.8f, 0.38f)), (new Vector3(0f, 1.02f, -0.04f), new Vector3(0.72f, 0.52f, 0.46f)), (new Vector3(-0.42f, 1.2f, 0.06f), new Vector3(0.28f, 0.46f, 0.28f)), (new Vector3(0.42f, 1.2f, 0.06f), new Vector3(0.28f, 0.46f, 0.28f)), (new Vector3(-0.16f, 0.62f, -0.03f), new Vector3(0.32f, 0.5f, 0.32f)), (new Vector3(0.16f, 0.62f, -0.03f), new Vector3(0.32f, 0.5f, 0.32f)) }; _shadowWisps = (Transform[])(object)new Transform[array.Length]; _shadowWispBasePositions = (Vector3[])(object)new Vector3[array.Length]; _shadowWispBaseScales = (Vector3[])(object)new Vector3[array.Length]; for (int i = 0; i < array.Length; i++) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val).name = $"ShadowWisp{i}"; val.transform.SetParent(_visualRoot, false); val.transform.localPosition = array[i].Item1; val.transform.localScale = array[i].Item2; val.layer = ((Component)this).gameObject.layer; Collider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } MeshRenderer component2 = val.GetComponent(); ((Renderer)component2).sharedMaterial = _mistMaterial; ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component2).receiveShadows = false; _shadowWisps[i] = val.transform; _shadowWispBasePositions[i] = array[i].Item1; _shadowWispBaseScales[i] = array[i].Item2; } } private void BuildMistShells() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_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) _mistShells = (Transform[])(object)new Transform[5]; _mistShellBaseScales = (Vector3[])(object)new Vector3[5]; _mistShells[0] = CreateMistShell("MistTorso", (PrimitiveType)1, _chest, Vector3.zero, new Vector3(0.64f, 0.86f, 0.5f)); _mistShells[1] = CreateMistShell("MistHead", (PrimitiveType)0, _head, Vector3.zero, new Vector3(0.48f, 0.48f, 0.48f)); _mistShells[2] = CreateMistShell("MistLeftArm", (PrimitiveType)1, _leftUpperArm, new Vector3(0f, -0.22f, 0f), new Vector3(0.24f, 0.54f, 0.24f)); _mistShells[3] = CreateMistShell("MistRightArm", (PrimitiveType)1, _rightUpperArm, new Vector3(0f, -0.22f, 0f), new Vector3(0.24f, 0.54f, 0.24f)); _mistShells[4] = CreateMistShell("MistPelvis", (PrimitiveType)0, _hips, new Vector3(0f, 0.02f, 0f), new Vector3(0.54f, 0.34f, 0.46f)); for (int i = 0; i < _mistShells.Length; i++) { _mistShellBaseScales[i] = _mistShells[i].localScale; } } private Transform CreateMistShell(string name, PrimitiveType primitiveType, Transform parent, Vector3 localPosition, Vector3 localScale) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) GameObject val = GameObject.CreatePrimitive(primitiveType); ((Object)val).name = name; val.transform.SetParent(parent, false); val.transform.localPosition = localPosition; val.transform.localRotation = Quaternion.identity; val.transform.localScale = localScale; val.layer = ((Component)this).gameObject.layer; Collider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } MeshRenderer component2 = val.GetComponent(); ((Renderer)component2).sharedMaterial = _mistMaterial; ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component2).receiveShadows = false; return val.transform; } private static Material CreateTransparentMaterial(Shader shader, Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Material val = new Material(shader) { color = color, enableInstancing = true, renderQueue = 3000 }; val.SetFloat("_Mode", 2f); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 10); val.SetInt("_ZWrite", 0); val.DisableKeyword("_ALPHATEST_ON"); val.EnableKeyword("_ALPHABLEND_ON"); val.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val.SetFloat("_Glossiness", 0f); return val; } } [DefaultExecutionOrder(-100)] internal sealed class BrackenTemplateBootstrap : MonoBehaviour { private const string EnableObjectName = "EnableObject"; private const string EnemyObjectName = "BrackenEnemy"; private const string CenterObjectName = "Center"; private const string TemplateContainerName = "EmpressBrackenTemplateContainer"; private static readonly HashSet TemplateInstanceIds = new HashSet(); private static GameObject? _templateContainer; private bool _runtimeBuilt; internal static GameObject CreateTemplate(ManualLogSource log) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) GameObject val = EnsureTemplateContainer(); GameObject val2 = new GameObject("EmpressBrackenPrefab") { layer = ResolveLayer("Enemy") }; val2.transform.SetParent(val.transform, false); TemplateInstanceIds.Add(((Object)val2).GetInstanceID()); ((Object)val2).hideFlags = (HideFlags)61; val2.transform.position = new Vector3(0f, -5000f, 0f); BuildTemplateCore(val2.transform); log.LogInfo((object)"Created Empress Bracken template core."); return val2; } private static GameObject EnsureTemplateContainer() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if ((Object)(object)_templateContainer != (Object)null) { return _templateContainer; } _templateContainer = new GameObject("EmpressBrackenTemplateContainer"); ((Object)_templateContainer).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)_templateContainer); _templateContainer.SetActive(false); return _templateContainer; } private void Start() { if (IsTemplateInstance(((Component)this).gameObject) || _runtimeBuilt) { return; } _runtimeBuilt = true; try { BuildRuntimeInstance(); } catch (Exception arg) { EmpressBrackenPlugin.Log.LogError((object)$"Failed to finish Bracken spawn: {arg}"); } } private static void BuildTemplateCore(Transform root) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) int layer = ResolveLayer("Enemy"); ((Component)root).gameObject.layer = layer; TrySetTag(((Component)root).gameObject, "Enemy"); EnemyParent val = ((Component)root).gameObject.AddComponent(); PhotonView val2 = ((Component)root).gameObject.AddComponent(); val2.Synchronization = (ViewSynchronization)3; ((Behaviour)val2).enabled = false; ((Component)root).gameObject.AddComponent(); GameObject val3 = new GameObject("EnableObject"); val3.transform.SetParent(root, false); val3.layer = layer; TrySetTag(val3, "Enemy"); GameObject val4 = new GameObject("BrackenEnemy"); val4.transform.SetParent(val3.transform, false); val4.transform.localPosition = Vector3.zero; val4.layer = layer; val4.SetActive(false); TrySetTag(val4, "Enemy"); GameObject val5 = new GameObject("Center"); val5.transform.SetParent(val4.transform, false); val5.transform.localPosition = new Vector3(0f, 1.32f, 0f); PhotonView val6 = val4.AddComponent(); val6.Synchronization = (ViewSynchronization)3; ((Behaviour)val6).enabled = false; CapsuleCollider val7 = val4.AddComponent(); val7.center = new Vector3(0f, 1.32f, 0f); val7.height = 2.7f; val7.radius = 0.42f; EnemyStateSpawn stateSpawn = val4.AddComponent(); EnemyStateStunned stateStunned = val4.AddComponent(); Enemy val8 = val4.AddComponent(); val.enemyName = "Empress Bracken"; val.difficulty = (Difficulty)1; val.actionMultiplier = 1.4f; val.overchargeMultiplier = 1.15f; val.EnableObject = val3; val.SpawnedTimeMin = 80f; val.SpawnedTimeMax = 120f; val.DespawnedTimeMin = 20f; val.DespawnedTimeMax = 42f; RepoEnemyAccess.SetSetupDone(val, value: false); RepoEnemyAccess.SetEnemyParentEnemy(val, val8); RepoEnemyAccess.SetEnemyParent(val8, val); RepoEnemyAccess.SetPhotonView(val8, val6); val8.CenterTransform = val5.transform; val8.KillLookAtTransform = val5.transform; val8.CustomValuableSpawnTransform = val5.transform; RepoEnemyAccess.SetStateSpawn(val8, stateSpawn); RepoEnemyAccess.SetHasStateSpawn(val8, value: true); RepoEnemyAccess.SetStateStunned(val8, stateStunned); RepoEnemyAccess.SetHasStateStunned(val8, value: true); RepoEnemyAccess.SetVisionMask(val8, LayerMask.op_Implicit(LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "HideTriggers" }))); val8.CurrentState = (EnemyState)1; RepoEnemyAccess.SetTargetPlayerViewId(val8, -1); RepoEnemyAccess.SetStateSpawnEnemy(stateSpawn, val8); RepoEnemyAccess.SetStateStunnedEnemy(stateStunned, val8); val4.SetActive(true); val2.ObservedComponents = new List { (Component)(object)val }; val6.ObservedComponents = new List { (Component)(object)val8 }; SetLayerRecursively(root, layer); TrySetTagRecursively(root, "Enemy"); } private void BuildRuntimeInstance() { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown if (!TryResolveCore(out EnemyParent enemyParent, out Enemy enemy, out EnemyStateSpawn stateSpawn, out PhotonView rootPhotonView, out PhotonView enemyPhotonView, out Transform centerTransform)) { throw new InvalidOperationException("Bracken core components were not present on spawned clone."); } SetHideFlagsRecursively(((Component)this).transform, (HideFlags)0); ((Behaviour)rootPhotonView).enabled = true; ((Behaviour)enemyPhotonView).enabled = true; EnemyNavMeshAgent val = EnsureRuntimeNavMeshAgent(enemy); BrackenShadowVisual visual = ((Component)enemy).GetComponent() ?? ((Component)enemy).gameObject.AddComponent(); BrackenAudioController audio = ((Component)enemy).GetComponent() ?? ((Component)enemy).gameObject.AddComponent(); BrackenFlowermanBrain brackenFlowermanBrain = ((Component)enemy).GetComponent() ?? ((Component)enemy).gameObject.AddComponent(); brackenFlowermanBrain.Initialize(enemyParent, enemy, val, visual, audio, centerTransform); RepoEnemyAccess.SetEnemyParentEnemy(enemyParent, enemy); RepoEnemyAccess.SetEnemyParent(enemy, enemyParent); RepoEnemyAccess.SetPhotonView(enemy, enemyPhotonView); enemy.CenterTransform = centerTransform; enemy.KillLookAtTransform = centerTransform; enemy.CustomValuableSpawnTransform = centerTransform; RepoEnemyAccess.SetNavMeshAgent(enemy, val); RepoEnemyAccess.SetHasNavMeshAgent(enemy, value: true); RepoEnemyAccess.SetStateSpawn(enemy, stateSpawn); RepoEnemyAccess.SetHasStateSpawn(enemy, value: true); RepoEnemyAccess.SetTargetPlayerViewId(enemy, -1); RepoEnemyAccess.SetStateSpawnEnemy(stateSpawn, enemy); stateSpawn.OnSpawn.RemoveListener(new UnityAction(brackenFlowermanBrain.HandleSpawnEvent)); stateSpawn.OnSpawn.AddListener(new UnityAction(brackenFlowermanBrain.HandleSpawnEvent)); rootPhotonView.ObservedComponents = new List { (Component)(object)enemyParent }; enemyPhotonView.ObservedComponents = new List { (Component)(object)enemy, (Component)(object)brackenFlowermanBrain }; } private bool TryResolveCore(out EnemyParent enemyParent, out Enemy enemy, out EnemyStateSpawn stateSpawn, out PhotonView rootPhotonView, out PhotonView enemyPhotonView, out Transform centerTransform) { enemyParent = ((Component)this).GetComponent(); rootPhotonView = ((Component)this).GetComponent(); enemy = ((Component)this).GetComponentInChildren(true); stateSpawn = ((Component)this).GetComponentInChildren(true); PhotonView val = (((Object)(object)enemy != (Object)null) ? ((Component)enemy).GetComponent() : null); Transform val2 = (((Object)(object)enemy != (Object)null && (Object)(object)enemy.CenterTransform != (Object)null) ? enemy.CenterTransform : ((Component)this).transform.Find("EnableObject/BrackenEnemy/Center")); enemyPhotonView = val; centerTransform = val2; return (Object)(object)enemyParent != (Object)null && (Object)(object)enemy != (Object)null && (Object)(object)stateSpawn != (Object)null && (Object)(object)rootPhotonView != (Object)null && (Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null; } private static EnemyNavMeshAgent EnsureRuntimeNavMeshAgent(Enemy enemy) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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) NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)enemy).transform.position, ref val, 8f, -1)) { ((Component)enemy).transform.position = ((NavMeshHit)(ref val)).position; } NavMeshAgent val2 = ((Component)enemy).GetComponent() ?? ((Component)enemy).gameObject.AddComponent(); ConfigureNavMeshAgent(val2); EnemyNavMeshAgent val3 = ((Component)enemy).GetComponent() ?? ((Component)enemy).gameObject.AddComponent(); val3.updateRotation = false; ((Behaviour)val3).enabled = false; NavMeshHit val4 = default(NavMeshHit); if (!((Behaviour)val2).enabled && NavMesh.SamplePosition(((Component)enemy).transform.position, ref val4, 6f, -1)) { ((Behaviour)val2).enabled = true; val2.Warp(((NavMeshHit)(ref val4)).position); } return val3; } private static void ConfigureNavMeshAgent(NavMeshAgent navMeshAgent) { navMeshAgent.speed = 6f; navMeshAgent.acceleration = 48f; navMeshAgent.angularSpeed = 220f; navMeshAgent.stoppingDistance = 1.15f; navMeshAgent.radius = 0.42f; navMeshAgent.height = 2.55f; navMeshAgent.autoTraverseOffMeshLink = true; navMeshAgent.obstacleAvoidanceType = (ObstacleAvoidanceType)4; } private static void SetHideFlagsRecursively(Transform root, HideFlags hideFlags) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) ((Object)((Component)root).gameObject).hideFlags = hideFlags; foreach (Transform item in root) { Transform root2 = item; SetHideFlagsRecursively(root2, hideFlags); } } internal static bool IsTemplateInstance(GameObject gameObject) { Transform val = gameObject.transform; while ((Object)(object)val.parent != (Object)null) { val = val.parent; } return TemplateInstanceIds.Contains(((Object)((Component)val).gameObject).GetInstanceID()); } private static int ResolveLayer(string layerName) { int num = LayerMask.NameToLayer(layerName); return (num >= 0) ? num : 0; } private static void SetLayerRecursively(Transform root, int layer) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown ((Component)root).gameObject.layer = layer; foreach (Transform item in root) { Transform root2 = item; SetLayerRecursively(root2, layer); } } private static void TrySetTagRecursively(Transform root, string tag) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown TrySetTag(((Component)root).gameObject, tag); foreach (Transform item in root) { Transform root2 = item; TrySetTagRecursively(root2, tag); } } private static void TrySetTag(GameObject gameObject, string tag) { try { gameObject.tag = tag; } catch (UnityException) { } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("omniscye.empressbracken", "Empress Bracken", "4.0.6")] internal sealed class EmpressBrackenPlugin : BaseUnityPlugin { private static readonly FieldInfo EnemySetupField = AccessTools.Field(typeof(EnemyContent), "_setup"); private static readonly FieldInfo SpawnObjectsField = AccessTools.Field(typeof(EnemyContent), "_spawnObjects"); internal const string PluginGuid = "omniscye.empressbracken"; internal const string PluginName = "Empress Bracken"; internal const string PluginVersion = "4.0.6"; internal const string TemplatePrefabName = "EmpressBrackenPrefab"; private static Harmony? _harmony; private static bool _registered; internal static ManualLogSource Log { get; private set; } = null; internal static string PluginDirectory { get; private set; } = string.Empty; private void Awake() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? string.Empty; ((Component)this).transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); if (_harmony == null) { _harmony = new Harmony("omniscye.empressbracken"); } PatchTemplateGuards(_harmony); ((MonoBehaviour)this).StartCoroutine(BrackenAudioBank.LoadAudioAsync(PluginDirectory, ((BaseUnityPlugin)this).Logger)); RegisterEnemy(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Empress Bracken v4.0.6"); } private void RegisterEnemy() { if (!_registered) { GameObject item = BrackenTemplateBootstrap.CreateTemplate(((BaseUnityPlugin)this).Logger); RarityPreset val = ScriptableObject.CreateInstance(); ((Object)val).hideFlags = (HideFlags)61; ((Object)val).name = "Rarity - Empress Bracken"; val.chance = 100f; EnemySetup val2 = ScriptableObject.CreateInstance(); ((Object)val2).hideFlags = (HideFlags)61; ((Object)val2).name = "Enemy - Empress Bracken"; val2.spawnObjects = new List(); val2.levelsCompletedCondition = false; val2.levelsCompletedMin = 0; val2.levelsCompletedMax = 10; val2.rarityPreset = val; val2.runsPlayed = 0; EnemyContent val3 = ScriptableObject.CreateInstance(); ((Object)val3).hideFlags = (HideFlags)61; ((Object)val3).name = "EnemyContentEmpressBracken"; EnemySetupField.SetValue(val3, val2); SpawnObjectsField.SetValue(val3, new List { item }); Enemies.RegisterEnemy(val3); _registered = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Registered Empress Bracken through REPOLib."); } } private static void PatchTemplateGuards(Harmony harmony) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown harmony.Patch((MethodBase)AccessTools.Method(typeof(EnemyParent), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EmpressBrackenPlugin), "SkipTemplateEnemyParentAwake", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(EnemyParent), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EmpressBrackenPlugin), "SkipTemplateEnemyParentUpdate", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Enemy), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EmpressBrackenPlugin), "SkipTemplateEnemyAwake", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Enemy), "Start", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EmpressBrackenPlugin), "SkipTemplateEnemyStart", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Enemy), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EmpressBrackenPlugin), "SkipTemplateEnemyUpdate", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(EnemyNavMeshAgent), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EmpressBrackenPlugin), "SkipTemplateEnemyNavMeshAgentAwake", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(EnemyNavMeshAgent), "OnEnable", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EmpressBrackenPlugin), "SkipTemplateEnemyNavMeshAgentOnEnable", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(EnemyNavMeshAgent), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EmpressBrackenPlugin), "SkipTemplateEnemyNavMeshAgentUpdate", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(EnemyStateSpawn), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EmpressBrackenPlugin), "SkipTemplateEnemyStateSpawnUpdate", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(EnemyStateStunned), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EmpressBrackenPlugin), "SkipTemplateEnemyStateStunnedUpdate", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static bool SkipTemplateEnemyParentAwake(EnemyParent __instance) { return !BrackenTemplateBootstrap.IsTemplateInstance(((Component)__instance).gameObject); } private static bool SkipTemplateEnemyParentUpdate(EnemyParent __instance) { return !BrackenTemplateBootstrap.IsTemplateInstance(((Component)__instance).gameObject); } private static bool SkipTemplateEnemyAwake(Enemy __instance) { return !BrackenTemplateBootstrap.IsTemplateInstance(((Component)__instance).gameObject); } private static bool SkipTemplateEnemyStart(Enemy __instance) { return !BrackenTemplateBootstrap.IsTemplateInstance(((Component)__instance).gameObject); } private static bool SkipTemplateEnemyUpdate(Enemy __instance) { return !BrackenTemplateBootstrap.IsTemplateInstance(((Component)__instance).gameObject); } private static bool SkipTemplateEnemyNavMeshAgentAwake(EnemyNavMeshAgent __instance) { return !BrackenTemplateBootstrap.IsTemplateInstance(((Component)__instance).gameObject); } private static bool SkipTemplateEnemyNavMeshAgentOnEnable(EnemyNavMeshAgent __instance) { return !BrackenTemplateBootstrap.IsTemplateInstance(((Component)__instance).gameObject); } private static bool SkipTemplateEnemyNavMeshAgentUpdate(EnemyNavMeshAgent __instance) { return !BrackenTemplateBootstrap.IsTemplateInstance(((Component)__instance).gameObject); } private static bool SkipTemplateEnemyStateSpawnUpdate(EnemyStateSpawn __instance) { return !BrackenTemplateBootstrap.IsTemplateInstance(((Component)__instance).gameObject); } private static bool SkipTemplateEnemyStateStunnedUpdate(EnemyStateStunned __instance) { return !BrackenTemplateBootstrap.IsTemplateInstance(((Component)__instance).gameObject); } } internal static class RepoEnemyAccess { private static readonly FieldRef EnemyParentEnemyRef = AccessTools.FieldRefAccess("Enemy"); private static readonly FieldRef EnemyParentFirstSpawnPointRef = AccessTools.FieldRefAccess("firstSpawnPoint"); private static readonly FieldRef EnemyParentSetupDoneRef = AccessTools.FieldRefAccess("SetupDone"); private static readonly FieldRef EnemyParentSpawnedRef = AccessTools.FieldRefAccess("Spawned"); private static readonly FieldRef LevelPointInStartRoomRef = AccessTools.FieldRefAccess("inStartRoom"); private static readonly FieldRef EnemyEnemyParentRef = AccessTools.FieldRefAccess("EnemyParent"); private static readonly FieldRef EnemyHasNavMeshAgentRef = AccessTools.FieldRefAccess("HasNavMeshAgent"); private static readonly FieldRef EnemyHasStateSpawnRef = AccessTools.FieldRefAccess("HasStateSpawn"); private static readonly FieldRef EnemyHasStateStunnedRef = AccessTools.FieldRefAccess("HasStateStunned"); private static readonly FieldRef EnemyMasterClientRef = AccessTools.FieldRefAccess("MasterClient"); private static readonly FieldRef EnemyNavMeshAgentRef = AccessTools.FieldRefAccess("NavMeshAgent"); private static readonly FieldRef EnemyPhotonViewRef = AccessTools.FieldRefAccess("PhotonView"); private static readonly FieldRef EnemyStateSpawnRef = AccessTools.FieldRefAccess("StateSpawn"); private static readonly FieldRef EnemyStateStunnedRef = AccessTools.FieldRefAccess("StateStunned"); private static readonly FieldRef EnemyTargetPlayerAvatarRef = AccessTools.FieldRefAccess("TargetPlayerAvatar"); private static readonly FieldRef EnemyTargetPlayerViewIdRef = AccessTools.FieldRefAccess("TargetPlayerViewID"); private static readonly FieldRef EnemyVisionMaskRef = AccessTools.FieldRefAccess("VisionMask"); private static readonly FieldRef EnemyNavMeshAgentAgentRef = AccessTools.FieldRefAccess("Agent"); private static readonly FieldRef EnemyStateSpawnEnemyRef = AccessTools.FieldRefAccess("Enemy"); private static readonly FieldRef EnemyStateStunnedEnemyRef = AccessTools.FieldRefAccess("enemy"); private static readonly FieldRef PlayerAvatarDisabledRef = AccessTools.FieldRefAccess("isDisabled"); private static readonly FieldRef PlayerAvatarDeadSetRef = AccessTools.FieldRefAccess("deadSet"); private static readonly FieldRef PlayerDeathHeadTriggeredRef = AccessTools.FieldRefAccess("triggered"); internal static bool GetSetupDone(EnemyParent enemyParent) { return EnemyParentSetupDoneRef.Invoke(enemyParent); } internal static void SetSetupDone(EnemyParent enemyParent, bool value) { EnemyParentSetupDoneRef.Invoke(enemyParent) = value; } internal static LevelPoint? GetFirstSpawnPoint(EnemyParent enemyParent) { return EnemyParentFirstSpawnPointRef.Invoke(enemyParent); } internal static bool GetSpawned(EnemyParent enemyParent) { return EnemyParentSpawnedRef.Invoke(enemyParent); } internal static bool IsInStartRoom(LevelPoint levelPoint) { return LevelPointInStartRoomRef.Invoke(levelPoint); } internal static void SetEnemyParentEnemy(EnemyParent enemyParent, Enemy enemy) { EnemyParentEnemyRef.Invoke(enemyParent) = enemy; } internal static void SetEnemyParent(Enemy enemy, EnemyParent enemyParent) { EnemyEnemyParentRef.Invoke(enemy) = enemyParent; } internal static void SetPhotonView(Enemy enemy, PhotonView photonView) { EnemyPhotonViewRef.Invoke(enemy) = photonView; } internal static void SetNavMeshAgent(Enemy enemy, EnemyNavMeshAgent navMeshAgent) { EnemyNavMeshAgentRef.Invoke(enemy) = navMeshAgent; } internal static void SetHasNavMeshAgent(Enemy enemy, bool value) { EnemyHasNavMeshAgentRef.Invoke(enemy) = value; } internal static void SetStateSpawn(Enemy enemy, EnemyStateSpawn stateSpawn) { EnemyStateSpawnRef.Invoke(enemy) = stateSpawn; } internal static void SetHasStateSpawn(Enemy enemy, bool value) { EnemyHasStateSpawnRef.Invoke(enemy) = value; } internal static EnemyStateStunned? GetStateStunned(Enemy enemy) { return EnemyStateStunnedRef.Invoke(enemy); } internal static void SetStateStunned(Enemy enemy, EnemyStateStunned stateStunned) { EnemyStateStunnedRef.Invoke(enemy) = stateStunned; } internal static void SetHasStateStunned(Enemy enemy, bool value) { EnemyHasStateStunnedRef.Invoke(enemy) = value; } internal static void SetVisionMask(Enemy enemy, LayerMask visionMask) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) EnemyVisionMaskRef.Invoke(enemy) = visionMask; } internal static void SetTargetPlayerAvatar(Enemy enemy, PlayerAvatar? player) { EnemyTargetPlayerAvatarRef.Invoke(enemy) = player; } internal static void SetTargetPlayerViewId(Enemy enemy, int viewId) { EnemyTargetPlayerViewIdRef.Invoke(enemy) = viewId; } internal static void SetTargetPlayer(Enemy enemy, PlayerAvatar? player, int viewId) { SetTargetPlayerAvatar(enemy, player); SetTargetPlayerViewId(enemy, viewId); } internal static bool GetMasterClient(Enemy enemy) { return EnemyMasterClientRef.Invoke(enemy); } internal static NavMeshAgent GetAgent(EnemyNavMeshAgent enemyNavMeshAgent) { return EnemyNavMeshAgentAgentRef.Invoke(enemyNavMeshAgent); } internal static void SetStateSpawnEnemy(EnemyStateSpawn stateSpawn, Enemy enemy) { EnemyStateSpawnEnemyRef.Invoke(stateSpawn) = enemy; } internal static void SetStateStunnedEnemy(EnemyStateStunned stateStunned, Enemy enemy) { EnemyStateStunnedEnemyRef.Invoke(stateStunned) = enemy; } internal static bool IsDisabled(PlayerAvatar player) { return PlayerAvatarDisabledRef.Invoke(player); } internal static bool IsDeadSet(PlayerAvatar player) { return PlayerAvatarDeadSetRef.Invoke(player); } internal static bool IsTriggered(PlayerDeathHead head) { return PlayerDeathHeadTriggeredRef.Invoke(head); } } }