using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.AI; [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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("REPOJP")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("zabuMod")] [assembly: AssemblyTitle("zabuMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPOJP.HuntsmanEyesOpened { [BepInPlugin("REPOJP.HuntsmanEyesOpened", "HuntsmanEyesOpened", "1.1.3")] public sealed class HuntsmanEyesOpenedPlugin : BaseUnityPlugin { public const string PluginGuid = "REPOJP.HuntsmanEyesOpened"; public const string PluginName = "HuntsmanEyesOpened"; public const string PluginVersion = "1.1.3"; internal static HuntsmanEyesOpenedPlugin Instance; internal static ManualLogSource Log; internal static ConfigEntry ViewAngle; internal static ConfigEntry MaxSightDistance; internal static ConfigEntry KeepTouchReaction; internal static ConfigEntry KeepVanillaSoundReaction; internal static ConfigEntry EnforceSoundInvestigate; internal static ConfigEntry SoundInvestigateRange; internal static ConfigEntry DamagePerShot; internal static ConfigEntry KnockbackMultiplier; internal static ConfigEntry MinTimeBetweenAttacks; internal static ConfigEntry VisualAttackDelay; private Harmony harmony; private void Awake() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown try { Instance = this; Log = ((BaseUnityPlugin)this).Logger; ((Component)this).transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); BindConfig(); harmony = new Harmony("REPOJP.HuntsmanEyesOpened"); harmony.PatchAll(Assembly.GetExecutingAssembly()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"HuntsmanEyesOpened 1.1.3 loaded"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to initialize HuntsmanEyesOpened\n" + ex)); } } private void OnDestroy() { try { if (harmony != null) { harmony.UnpatchSelf(); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to unpatch HuntsmanEyesOpened\n" + ex)); } } private void BindConfig() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Expected O, but got Unknown ViewAngle = ((BaseUnityPlugin)this).Config.Bind("Vision", "ViewAngle", 90f, new ConfigDescription("Frontal view angle in degrees.正面視野角", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 179f), Array.Empty())); MaxSightDistance = ((BaseUnityPlugin)this).Config.Bind("Vision", "MaxSightDistance", 18f, new ConfigDescription("Maximum sight distance.最大視認距離", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 100f), Array.Empty())); KeepTouchReaction = ((BaseUnityPlugin)this).Config.Bind("Reaction", "KeepTouchReaction", true, "Keep vanilla touch reaction.バニラ接触反応を維持"); KeepVanillaSoundReaction = ((BaseUnityPlugin)this).Config.Bind("Reaction", "KeepVanillaSoundReaction", false, "Enable vanilla sound reaction instead of forced custom investigation.強制調査ではなくバニラ音反応を使用"); EnforceSoundInvestigate = ((BaseUnityPlugin)this).Config.Bind("Reaction", "EnforceSoundInvestigate", true, "Always investigate the heard sound position when custom sound reaction is active.独自音反応時に音位置への調査移動を徹底"); SoundInvestigateRange = ((BaseUnityPlugin)this).Config.Bind("Reaction", "SoundInvestigateRange", 100f, new ConfigDescription("Maximum range for forced sound investigation. 0 means unlimited.強制音調査を行う最大距離 0は無制限", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); MinTimeBetweenAttacks = ((BaseUnityPlugin)this).Config.Bind("Reaction", "MinTimeBetweenAttacks", 5f, new ConfigDescription("Minimum time between attacks in seconds.攻撃間の最短時間", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 10f), Array.Empty())); VisualAttackDelay = ((BaseUnityPlugin)this).Config.Bind("Reaction", "VisualAttackDelay", 0f, new ConfigDescription("Delay from discovery to attack in seconds.発見から攻撃までの秒数", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); DamagePerShot = ((BaseUnityPlugin)this).Config.Bind("Shot", "DamagePerShot", 50, new ConfigDescription("Damage per shot.1発あたりのダメージ量", (AcceptableValueBase)(object)new AcceptableValueRange(0, 9999), Array.Empty())); KnockbackMultiplier = ((BaseUnityPlugin)this).Config.Bind("Shot", "KnockbackMultiplier", 10f, new ConfigDescription("Knockback multiplier.ノックバック倍率", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 20f), Array.Empty())); } } internal static class HuntsmanVisionCore { private struct VisualTrackData { public int TargetId; public float FirstSeenTime; public Vector3 LastPoint; } private struct SoundInvestigationData { public Vector3 Point; public Vector3 DestinationPoint; public bool PathfindOnly; public float CreatedTime; public float LastIssuedTime; public bool Active; } private struct ShotResult { public bool HitPlayer; public PlayerAvatar Player; public Vector3 HitPoint; public Vector3 VisualPoint; } private static readonly FieldRef FieldStateImpulse = AccessTools.FieldRefAccess("stateImpulse"); private static readonly FieldRef FieldStateTimer = AccessTools.FieldRefAccess("stateTimer"); private static readonly FieldRef FieldShootFast = AccessTools.FieldRefAccess("shootFast"); private static readonly FieldRef FieldShotsFired = AccessTools.FieldRefAccess("shotsFired"); private static readonly FieldRef FieldShotsFiredMax = AccessTools.FieldRefAccess("shotsFiredMax"); private static readonly FieldRef FieldInvestigatePoint = AccessTools.FieldRefAccess("investigatePoint"); private static readonly FieldRef FieldInvestigatePathfindOnly = AccessTools.FieldRefAccess("investigatePathfindOnly"); private static readonly FieldRef FieldInvestigatePointHasTransform = AccessTools.FieldRefAccess("investigatePointHasTransform"); private static readonly FieldRef FieldInvestigatePointTransform = AccessTools.FieldRefAccess("investigatePointTransform"); private static readonly FieldRef FieldInvestigatePointTransformPrevious = AccessTools.FieldRefAccess("investigatePointTransformPrevious"); private static readonly FieldRef FieldLeaveInterruptCounter = AccessTools.FieldRefAccess("leaveInterruptCounter"); private static readonly FieldRef FieldLeaveInterruptTimer = AccessTools.FieldRefAccess("leaveInterruptTimer"); private static readonly FieldRef FieldPhotonView = AccessTools.FieldRefAccess("photonView"); private static readonly FieldRef FieldPlayerHealth = AccessTools.FieldRefAccess("health"); private static readonly MethodInfo MethodUpdateState = AccessTools.Method(typeof(EnemyHunter), "UpdateState", (Type[])null, (Type[])null); private static readonly MethodInfo MethodShootRpc = AccessTools.Method(typeof(EnemyHunter), "ShootRPC", (Type[])null, (Type[])null); private static readonly MethodInfo MethodPlayerHealthHurtOtherFive = AccessTools.Method(typeof(PlayerHealth), "HurtOther", new Type[5] { typeof(int), typeof(Vector3), typeof(bool), typeof(int), typeof(bool) }, (Type[])null); private static readonly MethodInfo MethodPlayerHealthHurtOtherFour = AccessTools.Method(typeof(PlayerHealth), "HurtOther", new Type[4] { typeof(int), typeof(Vector3), typeof(bool), typeof(int) }, (Type[])null); private const float VisionCheckInterval = 0.05f; private const float MaxShotDistance = 50f; private const float PendingSoundMemorySeconds = 12f; private const float SoundInvestigationCompleteDistance = 1.25f; private const float ReissueInvestigateInterval = 0.25f; private static readonly Dictionary NextVisionCheckTime = new Dictionary(); private static readonly Dictionary NextAllowedAttackTime = new Dictionary(); private static readonly Dictionary VisualTrackMap = new Dictionary(); private static readonly Dictionary SoundInvestigationMap = new Dictionary(); internal static bool ShouldKeepTouchReaction() { return HuntsmanEyesOpenedPlugin.KeepTouchReaction.Value; } internal static bool ShouldBlockAimByCooldown(EnemyHunter hunter) { if (!ShouldProcessHunter(hunter)) { return false; } return !CanStartNextAttack(hunter); } internal static void HandleUpdate(EnemyHunter hunter) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!ShouldProcessHunter(hunter)) { ClearVisualTrack(hunter); ClearSoundInvestigation(hunter); return; } if (CanUseVisionInCurrentState(hunter) && ShouldRunVisionCheck(hunter)) { if (TryFindVisiblePlayer(hunter, out var bestPlayer, out var bestPoint)) { HandleVisibleTarget(hunter, bestPlayer, bestPoint); return; } ClearVisualTrack(hunter); } MaintainSoundInvestigation(hunter); } internal static bool HandleOnInvestigate(EnemyHunter hunter) { //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) if (!ShouldProcessHunter(hunter)) { return true; } Vector3 onInvestigateTriggeredPosition = hunter.enemy.StateInvestigate.onInvestigateTriggeredPosition; bool onInvestigateTriggeredPathfindOnly = hunter.enemy.StateInvestigate.onInvestigateTriggeredPathfindOnly; if ((int)hunter.currentState == 9 && Vector3.Distance(((Component)hunter).transform.position, onInvestigateTriggeredPosition) < 5f) { FieldLeaveInterruptCounter.Invoke(hunter) = FieldLeaveInterruptCounter.Invoke(hunter) + 1; FieldLeaveInterruptTimer.Invoke(hunter) = 3f; } if (HuntsmanEyesOpenedPlugin.KeepVanillaSoundReaction.Value) { return true; } if (!HuntsmanEyesOpenedPlugin.EnforceSoundInvestigate.Value) { return false; } if (!IsWithinSoundInvestigateRange(hunter, onInvestigateTriggeredPosition)) { return false; } RegisterSoundInvestigation(hunter, onInvestigateTriggeredPosition, onInvestigateTriggeredPathfindOnly); if (CanStartForcedInvestigationNow(hunter)) { BeginForcedSoundInvestigate(hunter, onInvestigateTriggeredPosition, onInvestigateTriggeredPathfindOnly); } return false; } internal static bool HandleStateShoot(EnemyHunter hunter) { //IL_0041: 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_00cd: Unknown result type (might be due to invalid IL or missing references) if (!ShouldProcessHunter(hunter) || (Object)(object)hunter.gunAimTransform == (Object)null) { return true; } if (FieldStateImpulse.Invoke(hunter)) { ShotResult shotResult = BuildShotResult(hunter); SendShootVisual(hunter, shotResult.VisualPoint); if (shotResult.HitPlayer && (Object)(object)shotResult.Player != (Object)null) { ApplyCustomPlayerHit(hunter, shotResult.Player, shotResult.HitPoint); } RegisterAttackTime(hunter); FieldStateImpulse.Invoke(hunter) = false; FieldStateTimer.Invoke(hunter) = (HasActiveSoundInvestigation(hunter) ? 0.05f : 2f); hunter.enemy.NavMeshAgent.Warp(((Component)hunter.enemy.Rigidbody).transform.position, false); hunter.enemy.NavMeshAgent.ResetPath(); } FieldStateTimer.Invoke(hunter) = FieldStateTimer.Invoke(hunter) - Time.deltaTime; if (FieldStateTimer.Invoke(hunter) <= 0f) { InvokeUpdateState(hunter, (State)7); } return false; } internal static void GuardUpdateState(EnemyHunter hunter, ref State state) { if (ShouldProcessHunter(hunter)) { if ((int)state == 5 && ShouldBlockAimByCooldown(hunter)) { state = (State)3; } else if (HasActiveSoundInvestigation(hunter) && ((int)state == 1 || (int)state == 2 || (int)state == 8 || (int)state == 9) && (IsSoundInvestigationCompleted(hunter) || IsSoundInvestigationPathInvalid(hunter))) { ClearSoundInvestigation(hunter); } } } private static bool ShouldProcessHunter(EnemyHunter hunter) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 if ((Object)(object)hunter == (Object)null || (Object)(object)hunter.enemy == (Object)null || (Object)(object)hunter.enemy.Rigidbody == (Object)null) { return false; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return false; } if (hunter.enemy.IsStunned()) { return false; } if ((int)hunter.enemy.CurrentState == 11) { return false; } if (hunter.enemy.Rigidbody.timeSinceStun > 0f && hunter.enemy.Rigidbody.timeSinceStun <= 1.5f) { return false; } return true; } private static bool CanUseVisionInCurrentState(EnemyHunter hunter) { //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_000e: Invalid comparison between Unknown and I4 //IL_0012: 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_0016: Invalid comparison between Unknown and I4 State currentState = hunter.currentState; State val = currentState; if (val - 1 <= 3 || val - 7 <= 2) { return true; } return false; } private static bool CanStartForcedInvestigationNow(EnemyHunter hunter) { //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_000e: Invalid comparison between Unknown and I4 //IL_0012: 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_0016: Invalid comparison between Unknown and I4 State currentState = hunter.currentState; State val = currentState; if (val - 1 <= 3 || val - 7 <= 2) { return true; } return false; } private static bool ShouldRunVisionCheck(EnemyHunter hunter) { int instanceID = ((Object)hunter).GetInstanceID(); if (NextVisionCheckTime.TryGetValue(instanceID, out var value) && Time.time < value) { return false; } NextVisionCheckTime[instanceID] = Time.time + 0.05f; return true; } private static void BeginImmediateVisualAttack(EnemyHunter hunter, PlayerAvatar player, Vector3 targetPoint) { //IL_0003: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 SetInvestigateTarget(hunter, player, targetPoint, pathfindOnly: false, shootFast: true); SyncInvestigationPoint(hunter, targetPoint); if ((int)hunter.currentState != 5 && (int)hunter.currentState != 6) { InvokeUpdateState(hunter, (State)5); } ClearVisualTrack(hunter); } private static void HandleVisibleTarget(EnemyHunter hunter, PlayerAvatar player, Vector3 targetPoint) { //IL_0003: 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_0023: Unknown result type (might be due to invalid IL or missing references) UpdateVisualTrack(hunter, player, targetPoint); if (CanStartNextAttack(hunter) && HasReachedVisualAttackDelay(hunter, player)) { BeginImmediateVisualAttack(hunter, player, targetPoint); } else { BeginVisualTrackOnly(hunter, player, targetPoint); } } private static void BeginVisualTrackOnly(EnemyHunter hunter, PlayerAvatar player, Vector3 targetPoint) { //IL_0003: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 SetInvestigateTarget(hunter, player, targetPoint, pathfindOnly: false, shootFast: true); SyncInvestigationPoint(hunter, targetPoint); if ((int)hunter.currentState != 3 && (int)hunter.currentState != 4 && (int)hunter.currentState != 6) { InvokeUpdateState(hunter, (State)3); } } private static void BeginForcedSoundInvestigate(EnemyHunter hunter, Vector3 investigatePoint, bool pathfindOnly) { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Vector3 destinationPoint = investigatePoint; if (TryGetSoundInvestigation(hunter, out var data)) { destinationPoint = data.DestinationPoint; pathfindOnly = true; } else if (!TryGetReachableInvestigationPoint(hunter, investigatePoint, out destinationPoint)) { destinationPoint = investigatePoint; } SetInvestigateTarget(hunter, null, destinationPoint, pathfindOnly: true, shootFast: false); SyncInvestigationPoint(hunter, destinationPoint); ClearVisualTrack(hunter); MarkSoundInvestigationIssued(hunter); if ((int)hunter.currentState != 3) { InvokeUpdateState(hunter, (State)3); } else { ForceInvestigateImpulse(hunter); } } private static void RegisterSoundInvestigation(EnemyHunter hunter, Vector3 point, bool pathfindOnly) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0036: 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) if (!((Object)(object)hunter == (Object)null)) { if (!TryGetReachableInvestigationPoint(hunter, point, out var destinationPoint)) { destinationPoint = point; } SoundInvestigationData soundInvestigationData = default(SoundInvestigationData); soundInvestigationData.Point = point; soundInvestigationData.DestinationPoint = destinationPoint; soundInvestigationData.PathfindOnly = pathfindOnly; soundInvestigationData.CreatedTime = Time.time; soundInvestigationData.LastIssuedTime = 0f; soundInvestigationData.Active = true; SoundInvestigationData value = soundInvestigationData; SoundInvestigationMap[((Object)hunter).GetInstanceID()] = value; } } private static void MarkSoundInvestigationIssued(EnemyHunter hunter) { if (!((Object)(object)hunter == (Object)null)) { int instanceID = ((Object)hunter).GetInstanceID(); if (SoundInvestigationMap.TryGetValue(instanceID, out var value)) { value.LastIssuedTime = Time.time; SoundInvestigationMap[instanceID] = value; } } } private static void MaintainSoundInvestigation(EnemyHunter hunter) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Invalid comparison between Unknown and I4 //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (TryGetSoundInvestigation(hunter, out var data)) { if (Time.time - data.CreatedTime > 12f) { ClearSoundInvestigation(hunter); } else if (IsSoundInvestigationCompleted(hunter)) { ClearSoundInvestigation(hunter); } else if (IsSoundInvestigationPathInvalid(hunter)) { ClearSoundInvestigation(hunter); } else if ((int)hunter.currentState != 3 && (int)hunter.currentState != 4 && CanStartForcedInvestigationNow(hunter) && !(Time.time - data.LastIssuedTime < 0.25f)) { BeginForcedSoundInvestigate(hunter, data.Point, data.PathfindOnly); } } } private static bool TryGetSoundInvestigation(EnemyHunter hunter, out SoundInvestigationData data) { data = default(SoundInvestigationData); if ((Object)(object)hunter == (Object)null) { return false; } if (!SoundInvestigationMap.TryGetValue(((Object)hunter).GetInstanceID(), out data)) { return false; } return data.Active; } private static bool HasActiveSoundInvestigation(EnemyHunter hunter) { SoundInvestigationData data; return TryGetSoundInvestigation(hunter, out data); } private static bool IsSoundInvestigationCompleted(EnemyHunter hunter) { //IL_001e: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Invalid comparison between Unknown and I4 //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Invalid comparison between Unknown and I4 if (!TryGetSoundInvestigation(hunter, out var data)) { return false; } if (Vector3.Distance(((Component)hunter).transform.position, data.DestinationPoint) <= 1.25f) { return true; } if ((Object)(object)hunter.enemy != (Object)null && (Object)(object)hunter.enemy.NavMeshAgent != (Object)null && (int)hunter.currentState == 4 && hunter.enemy.NavMeshAgent.CanReach(data.DestinationPoint, 1.25f)) { return true; } if (((int)hunter.currentState == 1 || (int)hunter.currentState == 2) && Time.time - data.LastIssuedTime > 0.25f) { return true; } return false; } private static bool IsSoundInvestigationPathInvalid(EnemyHunter hunter) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_00b0: 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_00d1: Invalid comparison between Unknown and I4 if (!TryGetSoundInvestigation(hunter, out var data)) { return false; } if ((Object)(object)hunter == (Object)null || (Object)(object)hunter.enemy == (Object)null || (Object)(object)hunter.enemy.NavMeshAgent == (Object)null) { return true; } if ((int)hunter.currentState != 4) { return false; } if (Time.time - data.LastIssuedTime < 0.75f) { return false; } if (!hunter.enemy.NavMeshAgent.HasPath()) { return true; } NavMeshPath val = hunter.enemy.NavMeshAgent.CalculatePath(data.DestinationPoint); if (val == null) { return true; } if ((int)val.status == 2) { return true; } return false; } private static bool TryGetReachableInvestigationPoint(EnemyHunter hunter, Vector3 point, out Vector3 destinationPoint) { //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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) destinationPoint = point; if ((Object)(object)hunter == (Object)null || (Object)(object)hunter.enemy == (Object)null || (Object)(object)hunter.enemy.NavMeshAgent == (Object)null) { return false; } NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(point, ref val, 5f, -1)) { destinationPoint = ((NavMeshHit)(ref val)).position; return true; } if (NavMesh.SamplePosition(point, ref val, 12f, -1)) { destinationPoint = ((NavMeshHit)(ref val)).position; return true; } NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)hunter).transform.position, ref val2, 3f, -1)) { destinationPoint = ((NavMeshHit)(ref val2)).position; return true; } return false; } private static void ForceInvestigateImpulse(EnemyHunter hunter) { if (!((Object)(object)hunter == (Object)null)) { FieldStateImpulse.Invoke(hunter) = true; FieldStateTimer.Invoke(hunter) = 0f; } } private static void ClearSoundInvestigation(EnemyHunter hunter) { if (!((Object)(object)hunter == (Object)null)) { SoundInvestigationMap.Remove(((Object)hunter).GetInstanceID()); } } private static bool IsWithinSoundInvestigateRange(EnemyHunter hunter, Vector3 investigatePoint) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(HuntsmanEyesOpenedPlugin.SoundInvestigateRange.Value, 0f, 100f); if (num <= 0f) { return true; } return Vector3.Distance(((Component)hunter).transform.position, investigatePoint) <= num; } private static void UpdateVisualTrack(EnemyHunter hunter, PlayerAvatar player, Vector3 targetPoint) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) int instanceID = ((Object)hunter).GetInstanceID(); int num = (((Object)(object)player != (Object)null) ? ((Object)player).GetInstanceID() : 0); if (!VisualTrackMap.TryGetValue(instanceID, out var value) || value.TargetId != num) { VisualTrackData visualTrackData = default(VisualTrackData); visualTrackData.TargetId = num; visualTrackData.FirstSeenTime = Time.time; visualTrackData.LastPoint = targetPoint; value = visualTrackData; } else { value.LastPoint = targetPoint; } VisualTrackMap[instanceID] = value; } private static bool HasReachedVisualAttackDelay(EnemyHunter hunter, PlayerAvatar player) { if (!VisualTrackMap.TryGetValue(((Object)hunter).GetInstanceID(), out var value)) { return false; } int num = (((Object)(object)player != (Object)null) ? ((Object)player).GetInstanceID() : 0); if (value.TargetId != num) { return false; } float num2 = Mathf.Clamp(HuntsmanEyesOpenedPlugin.VisualAttackDelay.Value, 0f, 5f); return Time.time >= value.FirstSeenTime + num2; } private static void ClearVisualTrack(EnemyHunter hunter) { if (!((Object)(object)hunter == (Object)null)) { VisualTrackMap.Remove(((Object)hunter).GetInstanceID()); } } private static void SetInvestigateTarget(EnemyHunter hunter, PlayerAvatar player, Vector3 targetPoint, bool pathfindOnly, bool shootFast) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_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_006f: 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) FieldInvestigatePathfindOnly.Invoke(hunter) = pathfindOnly; FieldInvestigatePoint.Invoke(hunter) = targetPoint; FieldShootFast.Invoke(hunter) = shootFast; Transform playerTargetTransform = GetPlayerTargetTransform(player); if ((Object)(object)playerTargetTransform != (Object)null && !pathfindOnly) { FieldInvestigatePointHasTransform.Invoke(hunter) = true; FieldInvestigatePointTransform.Invoke(hunter) = playerTargetTransform; FieldInvestigatePointTransformPrevious.Invoke(hunter) = playerTargetTransform.position; } else { FieldInvestigatePointHasTransform.Invoke(hunter) = false; FieldInvestigatePointTransform.Invoke(hunter) = null; FieldInvestigatePointTransformPrevious.Invoke(hunter) = Vector3.zero; } } private static bool TryFindVisiblePlayer(EnemyHunter hunter, out PlayerAvatar bestPlayer, out Vector3 bestPoint) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) bestPlayer = null; bestPoint = Vector3.zero; if ((Object)(object)hunter.investigateRayTransform == (Object)null) { return false; } Vector3 position = hunter.investigateRayTransform.position; Vector3 forward = hunter.investigateRayTransform.forward; float num = Mathf.Clamp(HuntsmanEyesOpenedPlugin.MaxSightDistance.Value, 1f, 100f); float num2 = Mathf.Clamp(HuntsmanEyesOpenedPlugin.ViewAngle.Value, 1f, 179f) * 0.5f; float num3 = float.MaxValue; PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val in array) { if (!IsValidPlayerTarget(val)) { continue; } Transform playerTargetTransform = GetPlayerTargetTransform(val); if (!((Object)(object)playerTargetTransform == (Object)null)) { Vector3 position2 = playerTargetTransform.position; Vector3 val2 = position2 - position; float magnitude = ((Vector3)(ref val2)).magnitude; if (!(magnitude <= 0.001f) && !(magnitude > num) && !(Vector3.Angle(forward, val2) > num2) && HasClearSightToPlayer(val, position, position2) && magnitude < num3) { num3 = magnitude; bestPlayer = val; bestPoint = position2; } } } return (Object)(object)bestPlayer != (Object)null; } private static bool IsValidPlayerTarget(PlayerAvatar player) { if ((Object)(object)player == (Object)null || (Object)(object)player.playerHealth == (Object)null) { return false; } int num = 0; try { num = FieldPlayerHealth.Invoke(player.playerHealth); } catch { return false; } return num > 0; } private static Transform GetPlayerTargetTransform(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { return null; } if ((Object)(object)player.PlayerVisionTarget != (Object)null && (Object)(object)player.PlayerVisionTarget.VisionTransform != (Object)null) { return player.PlayerVisionTarget.VisionTransform; } return ((Component)player).transform; } private static bool HasClearSightToPlayer(PlayerAvatar player, Vector3 origin, Vector3 targetPoint) { //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_0029: 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_0032: Unknown result type (might be due to invalid IL or missing references) Vector3 val = targetPoint - origin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 0.001f) { return false; } RaycastHit[] array = Physics.RaycastAll(origin, ((Vector3)(ref val)).normalized, magnitude, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()), (QueryTriggerInteraction)1); if (array == null || array.Length == 0) { return true; } Array.Sort(array, CompareHitsByDistance); for (int i = 0; i < array.Length; i++) { Transform transform = ((RaycastHit)(ref array[i])).transform; if (!((Object)(object)transform == (Object)null)) { if (IsTransformFromPlayer(player, transform)) { return true; } if (!((Object)(object)((Component)transform).GetComponentInParent() != (Object)null)) { return false; } } } return true; } private static bool IsTransformFromPlayer(PlayerAvatar player, Transform hitTransform) { if ((Object)(object)player == (Object)null || (Object)(object)hitTransform == (Object)null) { return false; } if ((Object)(object)((Component)hitTransform).GetComponentInParent() == (Object)(object)player) { return true; } PlayerController componentInParent = ((Component)hitTransform).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.playerAvatarScript == (Object)(object)player) { return true; } PlayerTumble componentInParent2 = ((Component)hitTransform).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)componentInParent2.playerAvatar == (Object)(object)player) { return true; } return false; } private static int CompareHitsByDistance(RaycastHit x, RaycastHit y) { return ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance); } private static ShotResult BuildShotResult(EnemyHunter hunter) { //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_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_0022: 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_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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00ae: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: 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_0176: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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) ShotResult result = default(ShotResult); Vector3 position = hunter.gunAimTransform.position; Vector3 forward = hunter.gunAimTransform.forward; result.VisualPoint = (result.HitPoint = position + forward * 50f) - forward * 0.1f; float num = 1f; if (FieldShootFast.Invoke(hunter)) { num = 1.5f; } if (Vector3.Distance(((Component)hunter).transform.position, FieldInvestigatePoint.Invoke(hunter)) > 10f) { num = 0.5f; } RaycastHit[] array = Physics.SphereCastAll(position, num, forward, 50f, LayerMask.GetMask(new string[2] { "Player", "PhysGrabObject" }), (QueryTriggerInteraction)1); if (array != null && array.Length != 0) { Array.Sort(array, CompareHitsByDistance); for (int i = 0; i < array.Length; i++) { PlayerAvatar player = TryGetPlayerFromHit(array[i]); if (!IsValidPlayerTarget(player)) { continue; } Transform playerTargetTransform = GetPlayerTargetTransform(player); if (!((Object)(object)playerTargetTransform == (Object)null)) { Vector3 val = ((((RaycastHit)(ref array[i])).point != Vector3.zero) ? ((RaycastHit)(ref array[i])).point : playerTargetTransform.position); if (HasClearSightToPlayer(player, position, val)) { result.HitPlayer = true; result.Player = player; result.HitPoint = val; result.VisualPoint = GetSafeVisualPoint(position, forward, val); return result; } } } } RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(position, forward, ref val2, 50f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetShouldHits()), (QueryTriggerInteraction)1)) { result.HitPoint = ((RaycastHit)(ref val2)).point; result.VisualPoint = ((RaycastHit)(ref val2)).point - forward * 0.1f; } return result; } private static PlayerAvatar TryGetPlayerFromHit(RaycastHit hit) { if ((Object)(object)((RaycastHit)(ref hit)).transform == (Object)null) { return null; } if (((Component)((RaycastHit)(ref hit)).transform).gameObject.layer == LayerMask.NameToLayer("Player")) { PlayerController componentInParent = ((Component)((RaycastHit)(ref hit)).transform).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { return componentInParent.playerAvatarScript; } return ((Component)((RaycastHit)(ref hit)).transform).GetComponentInParent(); } PlayerTumble componentInParent2 = ((Component)((RaycastHit)(ref hit)).transform).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { return componentInParent2.playerAvatar; } return null; } private static Vector3 GetSafeVisualPoint(Vector3 origin, Vector3 forward, Vector3 targetPoint) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0048: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) float num = 1.25f; Vector3 val = targetPoint - ((Vector3)(ref forward)).normalized * num; if (Vector3.Distance(origin, val) < 0.5f) { val = origin + ((Vector3)(ref forward)).normalized * 0.5f; } return val; } private static void SendShootVisual(EnemyHunter hunter, Vector3 hitPosition) { //IL_0033: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) PhotonView val = FieldPhotonView.Invoke(hunter); if (SemiFunc.IsMultiplayer() && (Object)(object)val != (Object)null) { val.RPC("ShootRPC", (RpcTarget)0, new object[1] { hitPosition }); } else if (MethodShootRpc != null) { MethodShootRpc.Invoke(hunter, new object[2] { hitPosition, (object)default(PhotonMessageInfo) }); } } private static void ApplyCustomPlayerHit(EnemyHunter hunter, PlayerAvatar player, Vector3 hitPoint) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null) && !((Object)(object)player.playerHealth == (Object)null) && !((Object)(object)hunter.hurtCollider == (Object)null)) { int num = Mathf.Max(0, HuntsmanEyesOpenedPlugin.DamagePerShot.Value); if (num > 0) { ApplyPlayerDamage(player, num); } ApplyKnockbackAndTumble(hunter, player, hitPoint); } } private static void ApplyPlayerDamage(PlayerAvatar player, int damage) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null || (Object)(object)player.playerHealth == (Object)null || damage <= 0) { return; } try { if (MethodPlayerHealthHurtOtherFive != null) { MethodPlayerHealthHurtOtherFive.Invoke(player.playerHealth, new object[5] { damage, ((Component)player).transform.position, true, -1, false }); } else if (MethodPlayerHealthHurtOtherFour != null) { MethodPlayerHealthHurtOtherFour.Invoke(player.playerHealth, new object[4] { damage, ((Component)player).transform.position, true, -1 }); } else { HuntsmanEyesOpenedPlugin.Log.LogError((object)"PlayerHealth.HurtOther method was not found"); } } catch (Exception ex) { HuntsmanEyesOpenedPlugin.Log.LogError((object)("Failed to apply Huntsman custom damage\n" + ex)); } } private static void ApplyKnockbackAndTumble(EnemyHunter hunter, PlayerAvatar player, Vector3 hitPoint) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: 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_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hunter == (Object)null || (Object)(object)player == (Object)null || (Object)(object)player.localCamera == (Object)null || (Object)(object)player.tumble == (Object)null) { return; } HurtCollider hurtCollider = hunter.hurtCollider; if ((Object)(object)hurtCollider == (Object)null) { return; } float num = Mathf.Max(0f, HuntsmanEyesOpenedPlugin.KnockbackMultiplier.Value); Vector3 val = (((Object)(object)hunter.gunAimTransform != (Object)null) ? hunter.gunAimTransform.position : ((Component)hunter).transform.position); Vector3 val2 = ((Component)player.localCamera).transform.position - val; Vector3 normalized = ((Vector3)(ref val2)).normalized; normalized = SemiFunc.ClampDirection(normalized, ((Component)hunter).transform.forward, hurtCollider.hitSpread); bool flag = false; if (hurtCollider.playerTumbleTime > 0f && (Object)(object)player.playerHealth != (Object)null && FieldPlayerHealth.Invoke(player.playerHealth) > 0) { player.tumble.TumbleRequest(true, false); player.tumble.TumbleOverrideTime(hurtCollider.playerTumbleTime); if (hurtCollider.playerTumbleImpactHurtTime > 0f) { player.tumble.ImpactHurtSet(hurtCollider.playerTumbleImpactHurtTime, hurtCollider.playerTumbleImpactHurtDamage); } if (hurtCollider.playerTumbleEnemyHurtDisableTime > 0f) { player.tumble.OverrideEnemyHurt(hurtCollider.playerTumbleEnemyHurtDisableTime); } flag = true; } if (flag) { if (hurtCollider.playerTumbleForce > 0f) { player.tumble.TumbleForce(normalized * hurtCollider.playerTumbleForce * num); } if (hurtCollider.playerTumbleTorque > 0f) { Vector3 torqueAxisVector = GetTorqueAxisVector(player, hurtCollider.playerTumbleTorqueAxis); val2 = ((Component)player.localCamera).transform.position - val; Vector3 val3 = Vector3.Cross(((Vector3)(ref val2)).normalized, torqueAxisVector) * hurtCollider.playerTumbleTorque * num; player.tumble.TumbleTorque(val3); } } else if (hurtCollider.playerHitForce > 0f) { player.ForceImpulse(normalized * hurtCollider.playerHitForce * num); } } private static Vector3 GetTorqueAxisVector(PlayerAvatar player, TorqueAxis axis) { //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_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected I4, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_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_007b: 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_0085: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) return (Vector3)((int)axis switch { 0 => ((Component)player).transform.up, 1 => -((Component)player).transform.up, 2 => -((Component)player).transform.right, 3 => ((Component)player).transform.right, 4 => ((Component)player).transform.forward, 5 => -((Component)player).transform.forward, _ => ((Component)player).transform.up, }); } private static bool CanStartNextAttack(EnemyHunter hunter) { if (!NextAllowedAttackTime.TryGetValue(((Object)hunter).GetInstanceID(), out var value)) { return true; } return Time.time >= value; } private static void RegisterAttackTime(EnemyHunter hunter) { float num = Mathf.Clamp(HuntsmanEyesOpenedPlugin.MinTimeBetweenAttacks.Value, 0.01f, 10f); NextAllowedAttackTime[((Object)hunter).GetInstanceID()] = Time.time + num; } private static void SyncInvestigationPoint(EnemyHunter hunter, Vector3 point) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) PhotonView val = FieldPhotonView.Invoke(hunter); if (SemiFunc.IsMultiplayer() && (Object)(object)val != (Object)null) { val.RPC("UpdateInvestigationPoint", (RpcTarget)1, new object[1] { point }); } } private static void InvokeUpdateState(EnemyHunter hunter, State state) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (MethodUpdateState != null) { MethodUpdateState.Invoke(hunter, new object[1] { state }); } } } [HarmonyPatch(typeof(EnemyHunter), "Update")] internal static class EnemyHunterUpdatePatch { private static void Postfix(EnemyHunter __instance) { try { HuntsmanVisionCore.HandleUpdate(__instance); } catch (Exception ex) { HuntsmanEyesOpenedPlugin.Log.LogError((object)("Update postfix failed\n" + ex)); } } } [HarmonyPatch(typeof(EnemyHunter), "OnInvestigate")] internal static class EnemyHunterOnInvestigatePatch { private static bool Prefix(EnemyHunter __instance) { try { return HuntsmanVisionCore.HandleOnInvestigate(__instance); } catch (Exception ex) { HuntsmanEyesOpenedPlugin.Log.LogError((object)("OnInvestigate override failed\n" + ex)); return true; } } } [HarmonyPatch(typeof(EnemyHunter), "UpdateState")] internal static class EnemyHunterUpdateStatePatch { private static void Prefix(EnemyHunter __instance, ref State _state) { try { HuntsmanVisionCore.GuardUpdateState(__instance, ref _state); } catch (Exception ex) { HuntsmanEyesOpenedPlugin.Log.LogError((object)("UpdateState guard failed\n" + ex)); } } } [HarmonyPatch(typeof(EnemyHunter), "OnTouchPlayer")] internal static class EnemyHunterOnTouchPlayerPatch { private static bool Prefix() { return HuntsmanVisionCore.ShouldKeepTouchReaction(); } } [HarmonyPatch(typeof(EnemyHunter), "OnTouchPlayerGrabbedObject")] internal static class EnemyHunterOnTouchPlayerGrabbedObjectPatch { private static bool Prefix() { return HuntsmanVisionCore.ShouldKeepTouchReaction(); } } [HarmonyPatch(typeof(EnemyHunter), "OnGrabbed")] internal static class EnemyHunterOnGrabbedPatch { private static bool Prefix() { return HuntsmanVisionCore.ShouldKeepTouchReaction(); } } [HarmonyPatch(typeof(EnemyHunter), "StateShoot")] internal static class EnemyHunterStateShootPatch { private static bool Prefix(EnemyHunter __instance) { try { return HuntsmanVisionCore.HandleStateShoot(__instance); } catch (Exception ex) { HuntsmanEyesOpenedPlugin.Log.LogError((object)("StateShoot override failed\n" + ex)); return true; } } } }