using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sodalite.ModPanel;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("NeverSuppressed")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("NeverSuppressed")]
[assembly: AssemblyTitle("NeverSuppressed")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.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 NeverSuppressed
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "NeverSuppressed";
public const string PLUGIN_NAME = "NeverSuppressed";
public const string PLUGIN_VERSION = "0.0.1";
}
}
namespace NGA
{
public class NGA_GasCan : C4
{
public override void Start()
{
((C4)this).Start();
((C4)this).SetArmed(true);
FXM.RegisterC4((C4)(object)this);
}
public override void BeginInteraction(FVRViveHand hand)
{
((C4)this).BeginInteraction(hand);
base.cooldown = 0f;
((FVRPhysicalObject)this).RootRigidbody.isKinematic = false;
}
public override void OnCollisionEnter(Collision col)
{
((C4)this).OnCollisionEnter(col);
if (base.cooldown > 0.5f && (Object)(object)col.collider.attachedRigidbody == (Object)null)
{
((FVRInteractiveObject)this).ForceBreakInteraction();
((FVRPhysicalObject)this).RootRigidbody.isKinematic = true;
}
}
}
}
namespace NGAspace
{
[BepInPlugin("NGA.HardcoreSosigAI", "HardcoreSosigAI", "1.2.0")]
[BepInDependency("nrgill28.Sodalite", "1.4.1")]
[BepInProcess("h3vr.exe")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
private static ConfigEntry<bool> disableFriendlyEntityAttention;
private static ConfigEntry<bool> tuneEntityRecognitionTime;
private static ConfigEntry<float> speedEntityRecognitionTime;
private static ConfigEntry<bool> tuneAdsSpeed;
private static ConfigEntry<float> speedAds;
private static ConfigEntry<bool> tuneSuppressionWhileArmed;
private static ConfigEntry<float> chanceSuppressedWhileArmed;
private static ConfigEntry<bool> tuneSuppressionOverride;
private static ConfigEntry<float> chanceSuppressionOverride;
public void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading HardcoreSosigAI...");
Log = ((BaseUnityPlugin)this).Logger;
SetUpConfigFields();
DoHarmonyPatches();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded HardcoreSosigAI Successfully!");
}
private void HandleSettingChanged(object sender, EventArgs e)
{
throw new NotImplementedException();
}
private void SetUpConfigFields()
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Expected O, but got Unknown
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Expected O, but got Unknown
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Expected O, but got Unknown
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"Binding configs...");
tuneEntityRecognitionTime = ((BaseUnityPlugin)this).Config.Bind<bool>("AI.ReactionTime.EntityRecognition", "TuneEntityRecognitionTime", true, "If true, allows tuning of how fast AI recognizes entities (people & things).");
disableFriendlyEntityAttention = ((BaseUnityPlugin)this).Config.Bind<bool>("AI.ReactionTime.EntityRecognition", "DisableFriendlyEntityAttention", true, "If true, targets with friendly IFFs are completely ignored.");
speedEntityRecognitionTime = ((BaseUnityPlugin)this).Config.Bind<float>("AI.ReactionTime.EntityRecognition", "speedEntityRecognitionTime", 100f, new ConfigDescription("Float multiplier [0.01f, 100f], changes the speed of recognition. Game default 1f yeilds-> 1s recognition time. Using 100f->0.01s.", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 100f, 0.5f), new object[0]));
tuneAdsSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("AI.ReactionTime.AdsSpeed", "TuneAdsSpeed", true, "If true, allows tuning of sosig aim down sights speed.");
speedAds = ((BaseUnityPlugin)this).Config.Bind<float>("AI.ReactionTime.AdsSpeed", "SpeedAds", 100f, new ConfigDescription("Float in [0.01,1000] describing speed multiplier of ADS speed. Game default: 0.5f.", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0.5f, 1000f, 10f), new object[0]));
tuneSuppressionOverride = ((BaseUnityPlugin)this).Config.Bind<bool>("AI.Suppression", "TuneSuppressionOverride", false, "If enabled, overrides other suppression configs and tunes how sosigs react to suppression events under all circumstances.");
chanceSuppressionOverride = ((BaseUnityPlugin)this).Config.Bind<float>("AI.Suppression.Override", "ChanceSuppressionOverride", 0f, new ConfigDescription("Integer in [0,100] describing the % chance any will be suppressed, overrides all other configs.", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 100f, 1f), new object[0]));
tuneSuppressionWhileArmed = ((BaseUnityPlugin)this).Config.Bind<bool>("AI.Suppression", "TuneSuppressionWhileArmed", true, "If enabled, you can tune how sosigs react to suppression events if they're holding a gun with the fields below.");
chanceSuppressedWhileArmed = ((BaseUnityPlugin)this).Config.Bind<float>("AI.Suppression.WhileArmed", "ChanceSuppressedWhileArmed", 100f, new ConfigDescription("Integer in [0,100] describing the % chance an armed sosig will be suppressed by and during a suppression event.", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 100f, 1f), new object[0]));
}
private void DoHarmonyPatches()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Expected O, but got Unknown
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Expected O, but got Unknown
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Expected O, but got Unknown
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Expected O, but got Unknown
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading harmony patches...");
Harmony val = new Harmony("NGA.HardcoreSosigAI");
MethodInfo methodInfo = AccessTools.Method(typeof(Sosig), "SuppresionEvent", (Type[])null, (Type[])null);
MethodInfo methodInfo2 = AccessTools.Method(typeof(Plugin), "SuppresionEvent_MyPatch", (Type[])null, (Type[])null);
MethodInfo methodInfo3 = AccessTools.Method(typeof(Sosig), "SuppresionUpdate", (Type[])null, (Type[])null);
MethodInfo methodInfo4 = AccessTools.Method(typeof(Plugin), "SuppresionUpdate_MyPatch", (Type[])null, (Type[])null);
MethodInfo methodInfo5 = AccessTools.Method(typeof(Sosig), "StateBailCheck_ShouldISkirmish", (Type[])null, (Type[])null);
MethodInfo methodInfo6 = AccessTools.Method(typeof(Plugin), "StateBailCheck_ShouldISkirmish_MyPatch", (Type[])null, (Type[])null);
MethodInfo methodInfo7 = AccessTools.Method(typeof(Sosig), "BrainUpdate_Skirmish", (Type[])null, (Type[])null);
MethodInfo methodInfo8 = AccessTools.Method(typeof(Plugin), "BrainUpdate_Skirmish_MyPatch", (Type[])null, (Type[])null);
MethodInfo methodInfo9 = AccessTools.Method(typeof(SosigHand), "Hold", (Type[])null, (Type[])null);
MethodInfo methodInfo10 = AccessTools.Method(typeof(Plugin), "Hold_MyPatch", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val.Patch((MethodBase)methodInfo3, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val.Patch((MethodBase)methodInfo5, new HarmonyMethod(methodInfo6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val.Patch((MethodBase)methodInfo7, new HarmonyMethod(methodInfo8), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val.Patch((MethodBase)methodInfo9, new HarmonyMethod(methodInfo10), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
public static void Hold_MyPatch(SosigHand __instance)
{
//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_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_0066: 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_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_00c0: 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_0094: 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_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Invalid comparison between Unknown and I4
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Invalid comparison between Unknown and I4
//IL_0180: 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_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Invalid comparison between Unknown and I4
//IL_0370: Unknown result type (might be due to invalid IL or missing references)
//IL_0371: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_0374: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_0377: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Unknown result type (might be due to invalid IL or missing references)
//IL_037a: Unknown result type (might be due to invalid IL or missing references)
//IL_0385: Unknown result type (might be due to invalid IL or missing references)
//IL_038b: Invalid comparison between Unknown and I4
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Invalid comparison between Unknown and I4
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_0394: Invalid comparison between Unknown and I4
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Invalid comparison between Unknown and I4
//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0500: Unknown result type (might be due to invalid IL or missing references)
//IL_0505: Unknown result type (might be due to invalid IL or missing references)
//IL_0507: Unknown result type (might be due to invalid IL or missing references)
//IL_0509: Unknown result type (might be due to invalid IL or missing references)
//IL_050b: Unknown result type (might be due to invalid IL or missing references)
//IL_0510: Unknown result type (might be due to invalid IL or missing references)
//IL_0515: Unknown result type (might be due to invalid IL or missing references)
//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Invalid comparison between Unknown and I4
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_0364: Unknown result type (might be due to invalid IL or missing references)
//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Invalid comparison between Unknown and I4
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
//IL_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_0411: Unknown result type (might be due to invalid IL or missing references)
//IL_0416: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0423: Unknown result type (might be due to invalid IL or missing references)
//IL_0425: Unknown result type (might be due to invalid IL or missing references)
//IL_0427: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
//IL_0434: Unknown result type (might be due to invalid IL or missing references)
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_044b: Unknown result type (might be due to invalid IL or missing references)
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_044f: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
//IL_0463: 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_04ee: Unknown result type (might be due to invalid IL or missing references)
//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0480: Unknown result type (might be due to invalid IL or missing references)
//IL_0485: Unknown result type (might be due to invalid IL or missing references)
//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
//IL_04db: Unknown result type (might be due to invalid IL or missing references)
//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0644: Unknown result type (might be due to invalid IL or missing references)
//IL_0651: Unknown result type (might be due to invalid IL or missing references)
//IL_065b: Unknown result type (might be due to invalid IL or missing references)
//IL_066b: Unknown result type (might be due to invalid IL or missing references)
//IL_0672: Unknown result type (might be due to invalid IL or missing references)
//IL_0677: Unknown result type (might be due to invalid IL or missing references)
//IL_0699: 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_06b1: Unknown result type (might be due to invalid IL or missing references)
//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
//IL_05df: 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_05f6: Unknown result type (might be due to invalid IL or missing references)
//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
//IL_061d: Unknown result type (might be due to invalid IL or missing references)
//IL_0622: Unknown result type (might be due to invalid IL or missing references)
//IL_0638: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.IsHoldingObject || (Object)(object)__instance.HeldObject == (Object)null || (Object)(object)__instance.Root == (Object)null)
{
return;
}
__instance.UpdateGunHandlingPose();
Vector3 position = __instance.Target.position;
Quaternion rotation = __instance.Target.rotation;
Vector3 position2 = __instance.HeldObject.RecoilHolder.position;
Quaternion rotation2 = __instance.HeldObject.RecoilHolder.rotation;
if (((FVRInteractiveObject)__instance.HeldObject.O).IsHeld)
{
float num = Vector3.Distance(position, position2);
if (num > 0.7f)
{
__instance.DropHeldObject();
return;
}
}
else
{
float num2 = Vector3.Distance(position, position2);
if (num2 < 0.2f)
{
__instance.m_timeAwayFromTarget = 0f;
}
else
{
__instance.m_timeAwayFromTarget += Time.deltaTime;
if (__instance.m_timeAwayFromTarget > 1f)
{
__instance.HeldObject.O.RootRigidbody.position = position;
__instance.HeldObject.O.RootRigidbody.rotation = rotation;
}
}
}
if (((int)__instance.HeldObject.Type == 1 || (int)__instance.HeldObject.Type == 2) && __instance.HeldObject.O.MP.IsMeleeWeapon)
{
Vector3 val = __instance.Target.position - __instance.m_lastPos;
val *= 1f / Time.deltaTime;
__instance.HeldObject.O.SetFakeHand(val, __instance.Target.position);
}
float num3 = 0f;
float num4 = 0f;
float num5 = 0f;
if ((Object)(object)__instance.m_posedToward != (Object)null && (int)__instance.Pose != 3)
{
if (__instance.HasActiveAimPoint)
{
if ((int)__instance.Pose == 2)
{
num3 = __instance.vertOffsets[__instance.m_curFiringPose_Aimed];
num4 = __instance.forwardOffsets[__instance.m_curFiringPose_Aimed];
num5 = __instance.tiltLerpOffsets[__instance.m_curFiringPose_Aimed];
}
else if ((int)__instance.Pose == 1)
{
num3 = __instance.vertOffsets[__instance.m_curFiringPose_Hip];
num4 = __instance.forwardOffsets[__instance.m_curFiringPose_Hip];
num5 = __instance.tiltLerpOffsets[__instance.m_curFiringPose_Hip];
}
}
Transform transform = ((Component)__instance.S.Links[1]).transform;
float num6 = 4f;
if (__instance.S.IsFrozen)
{
num6 = 0.25f;
}
if (__instance.S.IsSpeedUp)
{
num6 = 8f;
}
__instance.Target.position = Vector3.Lerp(position, __instance.m_posedToward.position + transform.up * num3 + __instance.m_posedToward.forward * num4, Time.deltaTime * num6);
__instance.Target.rotation = Quaternion.Slerp(rotation, __instance.m_posedToward.rotation, Time.deltaTime * num6);
}
Vector3 val2 = position2;
Quaternion val3 = rotation2;
Vector3 val4 = position;
Quaternion val5 = rotation;
if (__instance.HasActiveAimPoint && ((int)__instance.Pose == 1 || (int)__instance.Pose == 2))
{
float num7 = 0f;
float num8 = 0f;
if ((int)__instance.Pose == 1)
{
num7 = __instance.HeldObject.Hipfire_HorizontalLimit;
num8 = __instance.HeldObject.Hipfire_VerticalLimit;
}
if ((int)__instance.Pose == 2)
{
num7 = __instance.HeldObject.Aim_HorizontalLimit;
num8 = __instance.HeldObject.Aim_VerticalLimit;
}
Vector3 val6 = __instance.m_aimTowardPoint - position;
Vector3 forward = __instance.Target.forward;
Vector3 val7 = Vector3.RotateTowards(forward, Vector3.ProjectOnPlane(val6, __instance.Target.right), num8 * 0.0174533f, 0f);
Vector3 val8 = Vector3.RotateTowards(val7, val6, num7 * 0.0174533f, 0f);
if (num5 > 0f)
{
Vector3 localPosition = ((Component)__instance.Target).transform.localPosition;
localPosition.z = 0f;
localPosition.y = 0f;
((Vector3)(ref localPosition)).Normalize();
Vector3 val9 = Vector3.Slerp(__instance.Target.up, localPosition.x * -__instance.Target.right, num5);
val5 = Quaternion.LookRotation(val8, val9);
}
else
{
val5 = Quaternion.LookRotation(val8, __instance.Target.up);
}
}
Vector3 val10 = val4 - val2;
Quaternion val11 = val5 * Quaternion.Inverse(val3);
float deltaTime = Time.deltaTime;
float num9 = default(float);
Vector3 val12 = default(Vector3);
((Quaternion)(ref val11)).ToAngleAxis(ref num9, ref val12);
float num10 = 0.5f;
if (__instance.S.IsConfused)
{
num10 = 0.1f;
}
if (__instance.S.IsStunned || __instance.S.IsUnconscious)
{
num10 = 0.02f;
}
if (num9 > 180f)
{
num9 -= 360f;
}
float num11 = 0.5f;
if (tuneAdsSpeed.Value)
{
num11 = speedAds.Value;
}
if (num9 != 0f)
{
Vector3 val13 = deltaTime * num9 * val12 * __instance.S.AttachedRotationMultiplier * __instance.HeldObject.PosRotMult * num10;
__instance.HeldObject.O.RootRigidbody.angularVelocity = Vector3.MoveTowards(__instance.HeldObject.O.RootRigidbody.angularVelocity, val13, __instance.S.AttachedRotationFudge * num11 * Time.fixedDeltaTime);
}
Vector3 val14 = val10 * __instance.S.AttachedPositionMultiplier * 0.5f * __instance.HeldObject.PosStrengthMult * deltaTime;
__instance.HeldObject.O.RootRigidbody.velocity = Vector3.MoveTowards(__instance.HeldObject.O.RootRigidbody.velocity, val14, __instance.S.AttachedPositionFudge * num11 * deltaTime);
__instance.m_lastPos = __instance.Target.position;
}
public static void BrainUpdate_Skirmish_MyPatch(Sosig __instance)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Invalid comparison between Unknown and I4
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Invalid comparison between Unknown and I4
//IL_00b8: 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_0129: 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_019c: 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_01bb: 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_01c5: 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_0198: 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)
//IL_010a: 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_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: 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_03b5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
if (__instance.m_hasPriority)
{
__instance.Priority.Compute(__instance.m_suppressionLevel, 1f);
}
if (__instance.StateBailCheck_Equipment())
{
return;
}
__instance.WeaponEquipCycle();
__instance.EquipmentScanCycle(new Vector3(__instance.EquipmentPickupDistance, 3f, __instance.EquipmentPickupDistance), 1.5f);
if (!__instance.Priority.HasFreshTarget())
{
__instance.SetCurrentOrder((SosigOrder)3);
return;
}
bool flag = __instance.DoIHaveAGun();
bool flag2 = __instance.DoIHaveAWeaponInMyHand();
bool flag3 = __instance.AmIReloading();
bool flag4 = true;
Vector3 val = __instance.m_skirmishPoint;
if ((int)__instance.FallbackOrder == 7)
{
float num = Vector3.Distance(__instance.Priority.GetTargetPoint(), ((Component)__instance.Agent).transform.position);
bool flag5 = false;
if (flag && __instance.AmIOutOfRange(num))
{
flag5 = true;
}
if (num > __instance.m_assaultPointOverridesSkirmishPointWhenFurtherThan || flag5)
{
val = __instance.m_assaultPoint;
flag4 = false;
}
}
else if ((int)__instance.FallbackOrder == 10)
{
float num2 = Vector3.Distance(__instance.Priority.GetTargetPoint(), ((Component)__instance.Agent).transform.position);
bool flag6 = false;
if (flag && __instance.AmIOutOfRange(num2))
{
flag6 = true;
}
if (num2 > __instance.m_pathToPointOverridesSkirmishPointWhenFurtherThan || flag6)
{
val = __instance.m_pathToPoint;
flag4 = false;
}
}
if (flag4)
{
__instance.ShouldIPickANewSkirmishPoint(flag, flag3);
val = __instance.m_skirmishPoint;
}
__instance.TryToGetTo(val);
__instance.m_faceTowards = __instance.Priority.GetTargetPoint() - ((Component)__instance.Agent).transform.position;
__instance.m_faceTowards.y = 0f;
__instance.SetHandObjectUsage((SosigObjectUsageFocus)2);
__instance.SetMovementState((SosigMovementState)2);
if (flag)
{
if (__instance.m_suppressionLevel > 0.2f && !__instance.Agent.isOnOffMeshLink)
{
if ((Object)(object)__instance.m_curCoverPoint != (Object)null)
{
float num3 = Vector3.Distance(__instance.m_curCoverPoint.Pos, ((Component)__instance).transform.position);
if (num3 > 2f)
{
__instance.SetMovementSpeed((SosigMoveSpeed)4);
}
else
{
__instance.SetMovementSpeed((SosigMoveSpeed)3);
}
}
else
{
__instance.SetMovementSpeed((SosigMoveSpeed)2);
}
}
else if (flag3)
{
__instance.SetMovementSpeed((SosigMoveSpeed)3);
}
else
{
__instance.SetMovementSpeed((SosigMoveSpeed)4);
}
}
else
{
__instance.SetMovementSpeed((SosigMoveSpeed)4);
}
if (__instance.CanSpeakState())
{
if (flag3 && __instance.Speech.OnReloading.Count > 0)
{
__instance.Speak_State(__instance.Speech.OnReloading);
}
else if ((__instance.IsHealing || __instance.IsInvuln) && __instance.Speech.OnMedic.Count > 0)
{
__instance.Speak_State(__instance.Speech.OnMedic);
}
else
{
__instance.Speak_State(__instance.Speech.OnSkirmish);
}
}
if (__instance.HasABrain && !__instance.Agent.isOnOffMeshLink && (__instance.m_suppressionLevel > 0.2f || !flag2 || flag3))
{
if (flag3 || !flag2 || __instance.m_suppressionLevel > 0.8f)
{
__instance.SetBodyPose((SosigBodyPose)2);
}
else
{
__instance.SetBodyPose((SosigBodyPose)1);
}
return;
}
Vector3 velocity = __instance.Agent.velocity;
if (((Vector3)(ref velocity)).magnitude > 0.4f)
{
__instance.SetBodyPose((SosigBodyPose)0);
}
else
{
__instance.SetBodyPose((SosigBodyPose)1);
}
}
public static void SuppresionEvent_MyPatch(Sosig __instance, Vector3 pos, Vector3 dir, int IFF, float intensity, float range)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Invalid comparison between Unknown and I4
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: 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_01ee: 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_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)
if (tuneSuppressionOverride.Value)
{
float num = Mathf.Clamp(chanceSuppressionOverride.Value, 0f, 100f) / 100f;
if (Random.value <= num)
{
__instance.m_suppressionLevel = 0f;
return;
}
}
if ((int)__instance.CurrentOrder == 0 || !__instance.HasABrain || __instance.m_isUnconscious || !__instance.CanBeSuppresed || __instance.m_isInvuln || __instance.m_isDamResist || __instance.DoIHaveAShieldInMyHand())
{
return;
}
if (tuneSuppressionWhileArmed.Value && __instance.DoIHaveAWeaponAtAll())
{
float num2 = Mathf.Clamp(chanceSuppressedWhileArmed.Value, 0f, 100f) / 100f;
if (Random.value <= num2)
{
__instance.m_suppressionLevel = 0f;
return;
}
}
if ((IFF < 0 || IFF == __instance.E.IFFCode) & __instance.DoIHaveAWeaponAtAll())
{
return;
}
__instance.m_lastSuppresionEventPoint = pos;
if (!(__instance.m_suppressionLevel >= 1f))
{
float num3 = Vector3.Distance(pos, ((Component)__instance).transform.position);
num3 = Mathf.Clamp(num3 - 1f, 0f, range);
float num4 = intensity * ((range - num3) / range);
if (num4 > 0f)
{
dir.y = 0f;
dir.z += 0.0001f;
((Vector3)(ref dir)).Normalize();
__instance.m_suppressionDir = Vector3.Lerp(__instance.m_suppressionDir, dir, 0.5f);
((Vector3)(ref __instance.m_suppressionDir)).Normalize();
__instance.m_suppressionLevel += Mathf.Clamp(num4, 0f, 1f) * __instance.SuppressionMult;
}
}
}
public static void SuppresionUpdate_MyPatch(Sosig __instance)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Invalid comparison between Unknown and I4
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Invalid comparison between Unknown and I4
if (__instance.m_isInvuln || __instance.m_isDamResist)
{
__instance.m_suppressionLevel = 0f;
}
if (__instance.DoIHaveAWeaponAtAll())
{
__instance.m_suppressionLevel = 0f;
return;
}
if (__instance.m_suppressionLevel > 0f && (int)__instance.BodyState == 0)
{
__instance.m_suppressionLevel -= Time.deltaTime * 0.25f;
}
if (__instance.m_suppressionLevel > 0f && (int)__instance.BodyState == 1)
{
__instance.m_suppressionLevel -= Time.deltaTime * 1f;
}
}
public static bool StateBailCheck_ShouldISkirmish_MyPatch(Sosig __instance)
{
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Invalid comparison between Unknown and I4
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Invalid comparison between Unknown and I4
if (__instance.m_isBlinded)
{
return false;
}
if (__instance.Priority.HasFreshTarget())
{
if (__instance.Priority.IsTargetEntity() && !__instance.Priority.GetTargetEntity().IsPassiveEntity)
{
if (!disableFriendlyEntityAttention.Value || __instance.Priority.GetTargetEntity().IFFCode != __instance.GetIFF())
{
float num = 1f;
if ((int)__instance.CurrentOrder == 3)
{
num = 1f;
}
if (__instance.m_entityRecognition < 1f)
{
float num2 = 1f;
if (tuneEntityRecognitionTime.Value)
{
num2 = Mathf.Clamp(speedEntityRecognitionTime.Value, 0.01f, 100f);
}
__instance.m_entityRecognition += Time.deltaTime * num * num2;
}
if (__instance.m_entityRecognition >= 1f)
{
__instance.SetCurrentOrder((SosigOrder)2);
return true;
}
}
}
else if (__instance.m_entityRecognition > 0f)
{
__instance.m_entityRecognition -= Time.deltaTime;
}
if ((int)__instance.CurrentOrder != 3 && __instance.m_aggrolevel >= 1f)
{
if ((Object)(object)__instance.Priority.GetTargetEntity() != (Object)null && __instance.Priority.GetTargetEntity().IsPassiveEntity)
{
__instance.Priority.DisregardEntity(__instance.Priority.GetTargetEntity());
}
__instance.SetCurrentOrder((SosigOrder)3);
__instance.m_investigateCooldown = Random.Range(8f, 11f);
return true;
}
}
else if (__instance.m_entityRecognition > 0f)
{
__instance.m_entityRecognition -= Time.deltaTime;
}
return false;
}
}
}