using System; using System.Collections.Generic; 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 UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("Aiyke")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A collection of code mods doing a variety of things for H3VR.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("h3vr_code_mod")] [assembly: AssemblyTitle("BepInEx Plugin Title")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string id = null, string name = null, string version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null) { } } } namespace plugin { [BepInPlugin("Aiyke.code_mod", "code_mod", "1.0.0")] [BepInProcess("h3vr.exe")] public class code_mod : BaseUnityPlugin { private struct em_mod { public Sosig obj; public int id; public bool trigger_hold; public float t_fire; public float t_fire2; public float t_burst; public em_mod(Sosig instance, int index) { obj = null; id = 0; trigger_hold = false; t_fire = 0f; t_fire2 = 0f; t_burst = 0f; obj = instance; id = ((Object)instance).GetInstanceID(); } } public static ConfigEntry bullet_pen_mod; public static ConfigEntry pl_in_dmg_mult; private static float pl_in_dmg_mult_prev = 0f; private static bool pl_in_dmg_mult_changed = false; public static ConfigEntry pl_out_dmg_mult; public static ConfigEntry hit_sound; public static ConfigEntry hit_sound_vol; public static ConfigEntry tracer_spin; public static ConfigEntry em_aim_mod; public static ConfigEntry em_acc_mult; public static ConfigEntry em_wpn_mod; public static ConfigEntry em_wpn_coll_mod; public static ConfigEntry em_alert_mod; public static ConfigEntry em_move_mod_amt; public static ConfigEntry em_stagger_mod; public static ConfigEntry em_suppress_mod; public static ConfigEntry red_blood; public static ConfigEntry obj_sinking; public static ConfigEntry quickbolt_all; public static ConfigEntry fix_grip_pos; public static ConfigEntry reduced_tint; public static ConfigEntry pistol_slide_tilt; public static ConfigEntry metric_box_txt; public static ConfigEntry las_vis; public static ConfigEntry expl_mod; public static ConfigEntry flash_mod; public static ConfigEntry red_hit_fx; public static ConfigEntry health_warn; public static ConfigEntry aim_assist; public static ConfigEntry aim_assist_amt; public static ConfigEntry short_teleport; public static ConfigEntry short_teleport_amt; public static ConfigEntry spectator_zoom; public static ConfigEntry spec_zoom_hold_time; public static ConfigEntry spec_zoom_aim_radius; public static ConfigEntry spec_fov_norm; public static ConfigEntry spec_fov_zoomed; private static Collider[] collider_array = (Collider[])(object)new Collider[2048]; private static bool in_radius = false; private static float time_inside_radius = 0f; private static float print_timer = 0f; private static Transform gun_transform; private static List em_states = new List(); private static bool half_frame = false; private static bool log_bullet_events = false; private static int impact_frame = 0; private static byte armor_lv = 0; private static bool flat_bullet = false; private static bool was_this_bullet_able_to_pierce_armor_normally = false; private static float low_health_warning_timer = 0f; private static float health_percent_prev = 0f; private static float half_health_warn_tmr = 0f; private static float quarter_health_warn_tmr = 0f; private static Stopwatch timer { get; } = new Stopwatch(); internal static ManualLogSource Logger { get; private set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Logger.LogMessage((object)"code_mod plugin active."); bullet_pen_mod = ((BaseUnityPlugin)this).Config.Bind("Bullets and damage", "Modified bullet penetration", true, "Modified bullet penetration system.\n12-gauge slugs kill enemies with level 1 armor in 2 shots."); pl_in_dmg_mult = ((BaseUnityPlugin)this).Config.Bind("Bullets and damage", "Incoming damage multiplier", 0.9f, "Multiplier for damage you take."); pl_out_dmg_mult = ((BaseUnityPlugin)this).Config.Bind("Bullets and damage", "Output damage multiplier", 1f, "Multiplier for damage enemies take."); hit_sound = ((BaseUnityPlugin)this).Config.Bind("Bullets and damage", "Hit confirm sound", false, "Plays a sound when you hit an enemy over 5 m away."); hit_sound_vol = ((BaseUnityPlugin)this).Config.Bind("Bullets and damage", "Hit sound volume", 0.5f, "Volume of the hit confirm sound"); tracer_spin = ((BaseUnityPlugin)this).Config.Bind("Bullets and damage", "Tracer spinning", true, "Makes tracers spin in flight."); quickbolt_all = ((BaseUnityPlugin)this).Config.Bind("Weapons other objects", "Quickbolt all", true, "Enables quick bolt operation for all bolt-action guns."); fix_grip_pos = ((BaseUnityPlugin)this).Config.Bind("Weapons other objects", "Fixed grip positions", true, "Fixes the grip positions for some guns, including the Evo3 series and some MP5s."); reduced_tint = ((BaseUnityPlugin)this).Config.Bind("Weapons other objects", "Reduced reflex sight tint", true, "Reduces the excessive tint on reflex sights added with update 118.\nDetach and re-attach to apply the effect."); pistol_slide_tilt = ((BaseUnityPlugin)this).Config.Bind("Weapons other objects", "Pistol slide pull tilt", true, "Tilts pistols upwards when the slide is all the way back."); metric_box_txt = ((BaseUnityPlugin)this).Config.Bind("Weapons other objects", "Metric ammo box text", true, "Makes cartridge boxes show metric units.\nAlso shows kinetic energy (Joules) and armor piercing power as apostrophes (')"); obj_sinking = ((BaseUnityPlugin)this).Config.Bind("Weapons other objects", "Gibs and casings sinking", true, "Makes gibs and empty casings sink into the ground after a while."); las_vis = ((BaseUnityPlugin)this).Config.Bind("Weapons other objects", "Laser visibility", 2f, "Adjusts the visibility of laser beams.\nDoes not work with built-in lasers like on the PMM."); expl_mod = ((BaseUnityPlugin)this).Config.Bind("Explosives", "Explosive damage radius multiplier", 2f, "Adjusts explosive 'splash damage' radius."); flash_mod = ((BaseUnityPlugin)this).Config.Bind("Explosives", "More blinding flash grenades", true, "Does as stated."); em_aim_mod = ((BaseUnityPlugin)this).Config.Bind("Enemies", "Chest aim", true, "Makes enemies aim for your chest instead of your head.\nThis makes crouching and/or staying behind cover more effective."); em_acc_mult = ((BaseUnityPlugin)this).Config.Bind("Enemies", "Accuracy multiplier", 1f, "Adjusts the spread and recoil of their guns."); em_wpn_mod = ((BaseUnityPlugin)this).Config.Bind("Enemies", "Full auto usage", true, "Makes enemies shoot fully automatic guns in bursts.\nWARNING: this can make combat significantly harder."); em_wpn_coll_mod = ((BaseUnityPlugin)this).Config.Bind("Enemies", "Disable gun collision when held.", true, "Makes their guns no longer act as impenetrable shields."); em_alert_mod = ((BaseUnityPlugin)this).Config.Bind("Enemies", "Better alertness", true, "Makes them realise they're being shot at more consistently.\nWithout it, they sometimes don't hear gunshots right next to them."); em_move_mod_amt = ((BaseUnityPlugin)this).Config.Bind("Enemies", "Movement while engaging multiplier", 1.5f, "Adjusts how much they hold still while engaging.\nHigher = longer."); em_stagger_mod = ((BaseUnityPlugin)this).Config.Bind("Enemies", "Stagger resistance", 1f, "Adjusts how resistant they are to confusion, staggering, or being knocked unconscious.\nHigher = less"); em_suppress_mod = ((BaseUnityPlugin)this).Config.Bind("Enemies", "Suppression resistance", 2f, "Adjusts how resistant they are to suppression.\nHigher = less"); red_blood = ((BaseUnityPlugin)this).Config.Bind("Enemies", "Ketchup", true, "Makes their 'blood' red instead of yellow."); red_hit_fx = ((BaseUnityPlugin)this).Config.Bind("Player", "Red hit flash effect", true, "Changes the hit flash colour from white to red."); health_warn = ((BaseUnityPlugin)this).Config.Bind("Player", "Low wealth warning", true, "Shows subtle periodic flashing if health is below half, and gets more intense the lower it is."); aim_assist = ((BaseUnityPlugin)this).Config.Bind("Player", "Aim assistance*", false, "Experimental aim assistance.\nIt works when you're aiming within 5 degrees of an enemy.\nIt messes up sometimes."); aim_assist_amt = ((BaseUnityPlugin)this).Config.Bind("Player", "Aim assistance amount", 0.5f, "Strength of the aim assistance."); short_teleport = ((BaseUnityPlugin)this).Config.Bind("Player", "Short teleport", true, "Enables short forward and backward teleport using the stick up and down with teleport movement mode.\nUseful for engaging from behind cover."); short_teleport_amt = ((BaseUnityPlugin)this).Config.Bind("Player", "Short teleport amount", 0.2f, "Short teleport distance (metres)"); spectator_zoom = ((BaseUnityPlugin)this).Config.Bind("Spectator", "Spectator zoom when aiming", false, "Zooms the spectator camera when aiming a loaded gun.\nTry to keep the center of the sights in the middle of your field of vision."); spec_zoom_hold_time = ((BaseUnityPlugin)this).Config.Bind("Spectator", "Aim hold time", 0.3f, "How long aiming has to be held before zooming in.\nThis prevents unwanted zooming out when shooting."); spec_zoom_aim_radius = ((BaseUnityPlugin)this).Config.Bind("Spectator", "Aim radius", 15f, "Size of the 'circle' around the spectator camera's center in which zooming can occur."); spec_fov_zoomed = ((BaseUnityPlugin)this).Config.Bind("Spectator", "Spectator zoomed in FOV", 30f, "Spectator FOV when aiming.\nSmaller = more magnification."); spec_fov_norm = ((BaseUnityPlugin)this).Config.Bind("Spectator", "Spectator normal FOV", 55f, "Normal FOV for the spectator when not aiming."); Harmony.CreateAndPatchAll(typeof(code_mod), (string)null); } private void Update() { Logger = ((BaseUnityPlugin)this).Logger; float deltaTime = Time.deltaTime; if (half_frame) { half_frame = false; } else { half_frame = true; if (Random.value < 0.5f && (Object)(object)collider_array[0] != (Object)null) { for (int i = 0; i < collider_array.Length; i++) { collider_array[i] = null; } } } if (pl_in_dmg_mult_prev != pl_in_dmg_mult.Value) { pl_in_dmg_mult_changed = true; } if (pl_in_dmg_mult.Value < 0.001f) { pl_in_dmg_mult.Value = 0.001f; } pl_in_dmg_mult_prev = pl_in_dmg_mult.Value; if (pl_out_dmg_mult.Value < 0.001f) { pl_out_dmg_mult.Value = 0.001f; } if (em_acc_mult.Value < 0.01f) { em_acc_mult.Value = 0.01f; } if (spectator_zoom.Value) { if (in_radius) { time_inside_radius += deltaTime; } else { time_inside_radius -= deltaTime; } if (time_inside_radius > spec_zoom_hold_time.Value) { GM.Options.ControlOptions.CamFOV = spec_fov_zoomed.Value; } else { GM.Options.ControlOptions.CamFOV = spec_fov_norm.Value; } } if (time_inside_radius > 1f) { time_inside_radius = 1f; } if (time_inside_radius < 0f) { time_inside_radius = 0f; } if (!GM.CurrentPlayerBody.HasAGunInHand() || !spectator_zoom.Value) { time_inside_radius = 0f; GM.Options.ControlOptions.CamFOV = spec_fov_norm.Value; } print_timer += deltaTime; if (print_timer > 1f) { print_timer = 0f; } } private static float fabs(float x) { return Mathf.Abs(x); } [HarmonyPatch(typeof(FVRFireArm), "FVRUpdate")] [HarmonyPostfix] private static void FVRFireArm_FVRUpdate_postfix(FVRFireArm __instance) { //IL_0048: 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) if (!spectator_zoom.Value || !((FVRInteractiveObject)__instance).IsHeld) { return; } gun_transform = __instance.CurrentMuzzle; Transform transform = ((Component)GM.CurrentPlayerBody.FilteredHead).transform; Transform currentMuzzle = __instance.CurrentMuzzle; if (!__instance.IsLoaded()) { in_radius = false; return; } if (Vector3.Angle(transform.forward, currentMuzzle.forward) < spec_zoom_aim_radius.Value) { in_radius = true; } else { in_radius = false; } if (!__instance.IsForegripStabilized() && !__instance.IsShoulderStabilized() && !__instance.IsTwoHandStabilized()) { in_radius = false; } } [HarmonyPatch(typeof(FVRSceneSettings), "UpdateSpectatorCamera")] [HarmonyPostfix] private static void FVRSceneSettings_UpdateSpectatorCamera_postfix(FVRSceneSettings __instance) { if (spectator_zoom.Value && !((Object)(object)__instance.m_specCam == (Object)null)) { __instance.m_specCam.fieldOfView = (__instance.m_specCam.fieldOfView * 19f + GM.Options.ControlOptions.CamFOV * 1f) / 20f; } } [HarmonyPatch(typeof(FVRFireArm), "Fire")] [HarmonyPrefix] private static bool FVRFireArm_Fire_prefix(FVRFireArm __instance, FVRFireArmChamber chamber, Transform muzzle, bool doBuzz, float velMult = 1f, float rangeOverride = -1f) { //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03db: 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_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: 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_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0442: 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_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: 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_0688: Unknown result type (might be due to invalid IL or missing references) //IL_068f: 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_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: 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_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) if (!aim_assist.Value) { return true; } bool flag = false; for (int i = 0; i < GM.CurrentMovementManager.Hands.Length; i++) { if ((Object)(object)((FVRInteractiveObject)__instance).m_hand == (Object)(object)GM.CurrentMovementManager.Hands[i]) { flag = true; break; } } if (!flag) { return true; } bool flag2 = false; if (flag2) { Logger.LogInfo((object)"> BallisticProjectile_Fire_prefix < <"); timer.Start(); } if (doBuzz && (Object)(object)((FVRInteractiveObject)__instance).m_hand != (Object)null) { ((FVRInteractiveObject)__instance).m_hand.Buzz(((FVRInteractiveObject)__instance).m_hand.Buzzer.Buzz_GunShot); if ((Object)(object)((FVRPhysicalObject)__instance).AltGrip != (Object)null && (Object)(object)((FVRInteractiveObject)((FVRPhysicalObject)__instance).AltGrip).m_hand != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)__instance).AltGrip).m_hand.Buzz(((FVRInteractiveObject)__instance).m_hand.Buzzer.Buzz_GunShot); } } if (!((FVRInteractiveObject)__instance).IsHeld && !((FVRPhysicalObject)__instance).IsKinematicLocked && !((FVRPhysicalObject)__instance).IsPivotLocked && (Object)(object)((FVRPhysicalObject)__instance).RootRigidbody != (Object)null) { ((FVRPhysicalObject)__instance).RootRigidbody.AddForceAtPosition(Vector3.Slerp(-muzzle.forward, Random.onUnitSphere, 0.1f) * Random.Range(0.4f, 0.8f), muzzle.position, (ForceMode)2); } GM.CurrentSceneSettings.OnShotFired(__instance); if (__instance.IsSuppressed()) { GM.CurrentPlayerBody.VisibleEvent(0.1f); } else { GM.CurrentPlayerBody.VisibleEvent(2f); } float chamberVelMult = AM.GetChamberVelMult(chamber.RoundType, Vector3.Distance(((Component)chamber).transform.position, muzzle.position)); float num = __instance.GetCombinedFixedDrop(__instance.AccuracyClass) * 0.0166667f; Vector2 val = __instance.GetCombinedFixedDrift(__instance.AccuracyClass) * 0.0166667f; float num2 = 5f; float num3 = num2; SosigLink val2 = null; _ = Vector3.zero; bool flag3 = false; int num4 = Physics.OverlapSphereNonAlloc(((Component)__instance).transform.position, 200f, collider_array, LayerMask.op_Implicit(AM.PLM), (QueryTriggerInteraction)2); if (flag2) { Logger.LogInfo((object)("Physics.OverlapSphereNonAlloc found " + num4 + " collidable entities within 200 m.")); Logger.LogInfo((object)"Now attempting to find closest head to barrel forward vector..."); } if (num4 == 0) { flag3 = false; if (flag2) { Logger.LogError((object)"no enemies found"); } } else { for (int j = 0; j < num4; j++) { if (!((Object)(object)collider_array[j].attachedRigidbody != (Object)null)) { continue; } if (flag2) { Logger.LogInfo((object)("[" + j + "]: " + ((Object)collider_array[j].attachedRigidbody).name)); } SosigLink component = ((Component)collider_array[j].attachedRigidbody).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && (int)component.BodyPart == 0) { Vector3 val3 = ((Component)component).transform.position - ((Component)__instance).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; num2 = Vector3.Angle(((Component)__instance).transform.forward, normalized); if (num2 < num3) { val2 = component; num3 = num2; } } } if ((Object)(object)val2 != (Object)null) { flag3 = true; if (Vector3.Distance(((Component)val2).gameObject.transform.position, muzzle.position) < 5f) { if (flag2) { Logger.LogError((object)"no enemies found"); } flag3 = false; } } else { if (flag2) { Logger.LogError((object)"no enemies found"); } flag3 = false; } } if (flag2) { Logger.LogInfo((object)"Proceeding to firing code\t-\t-\t-\t-\t-"); } for (int k = 0; k < chamber.GetRound().NumProjectiles; k++) { float num5 = chamber.GetRound().ProjectileSpread + __instance.m_internalMechanicalMOA + __instance.GetCombinedMuzzleDeviceAccuracy(); if (!((Object)(object)chamber.GetRound().BallisticProjectilePrefab != (Object)null)) { continue; } Vector3 val4 = muzzle.forward * 0.005f; GameObject val5 = Object.Instantiate(chamber.GetRound().BallisticProjectilePrefab, muzzle.position - val4, muzzle.rotation); Transform transform = val5.transform; Vector2 val6 = (Random.insideUnitCircle + Random.insideUnitCircle + Random.insideUnitCircle) * (1f / 3f) * num5; Quaternion rotation = muzzle.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; if (flag3) { transform.LookAt(((Component)val2).gameObject.transform.position); Quaternion val7 = Quaternion.Euler(eulerAngles.x, eulerAngles.y, eulerAngles.z); Quaternion rotation2 = ((Component)transform).transform.rotation; float x = ((Quaternion)(ref rotation2)).eulerAngles.x; rotation2 = ((Component)transform).transform.rotation; float y = ((Quaternion)(ref rotation2)).eulerAngles.y; rotation2 = ((Component)transform).transform.rotation; Quaternion val8 = Quaternion.Euler(x, y, ((Quaternion)(ref rotation2)).eulerAngles.z); float num6 = 0.1f; if (num3 > 3f && num3 < 5f) { num6 = 0.1f; } else if (num3 > 2f && num3 < 3f) { num6 = 0.2f; } else if (num3 > 1f && num3 < 2f) { num6 = 0.5f; } else if ((double)num3 < 1.0) { num6 = 0.7f; } num6 *= Mathf.Clamp(Random.Range(aim_assist_amt.Value - 0.1f, aim_assist_amt.Value + 0.1f), 0.1f, 1f); if (flag2) { Logger.LogInfo((object)("aim assist amount = " + (int)(num6 * 100f))); } Quaternion rotation3 = Quaternion.Lerp(val7, val8, num6); val5.transform.rotation = rotation3; rotation2 = val5.transform.rotation; Vector3 eulerAngles2 = ((Quaternion)(ref rotation2)).eulerAngles; rotation2 = muzzle.rotation; float num7 = Vector3.Angle(eulerAngles2, ((Quaternion)(ref rotation2)).eulerAngles); if (flag2) { Logger.LogInfo((object)" > Angles adjusted. <"); } if (num7 > 5f) { if (flag2) { Logger.LogError((object)"This gun just tried to shoot the ground for some reason."); } val5.transform.rotation = rotation; if (flag2) { Logger.LogInfo((object)" > Firing bullet normally instead. <"); } } val5.transform.Rotate(new Vector3(val6.x + val.y + num, val6.y + val.x, 0f)); } else { if (flag2) { Logger.LogInfo((object)" > Firing bullet normally. <"); } val5.transform.Rotate(new Vector3(val6.x + val.y + num, val6.y + val.x, Random.value * 90f)); } BallisticProjectile component2 = val5.GetComponent(); component2.Fire(component2.MuzzleVelocityBase * chamber.ChamberVelocityMultiplier * velMult * chamberVelMult, val5.transform.forward, __instance, true); if (rangeOverride > 0f) { component2.ForceSetMaxDist(rangeOverride); } } if (flag2) { timer.Stop(); Logger.LogInfo((object)("FVRFireArm_Fire_prefix exec time = " + timer.ElapsedMilliseconds + " ms\n")); timer.Reset(); } return false; } [HarmonyPatch(typeof(BallisticProjectile), "MoveBullet")] [HarmonyPrefix] private static void BallisticProjectile_MoveBullet_prefix_for_dmg(BallisticProjectile __instance) { if (__instance.Source_IFF == GM.CurrentPlayerBody.m_playerIFF && !(__instance.m_distanceTraveled > 0.1f) && __instance.IsMoving() && __instance.m_distanceTraveled <= 0.01f) { if (((Object)__instance).name.StartsWith("32FL")) { __instance.MuzzleVelocityBase = (__instance.MuzzleVelocityBase + 365f) / 2f; __instance.Mass = (__instance.Mass + 0.006f) / 2f; __instance.FrontArea = (__instance.FrontArea + 6.749E-05f) / 2f; } if (((Object)__instance).name.EndsWith("JHP(Clone)") || ((Object)__instance).name.EndsWith("SP(Clone)")) { __instance.AirDragMultiplier *= 1.5f; } __instance.Mass *= pl_out_dmg_mult.Value; } } [HarmonyPatch(typeof(BallisticProjectile), "UpdateBulletPath")] [HarmonyPostfix] private static void BallisticProjectile_UpdateBulletPath_postfix(BallisticProjectile __instance) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown if (!em_alert_mod.Value || !half_frame || __instance.Source_IFF != GM.CurrentPlayerBody.m_playerIFF || !__instance.IsMoving()) { return; } bool flag = false; if (Random.value < 0.5f) { float num = 1f + __instance.Dimensions.x * 10f + __instance.Mass * 100f + ((Vector3)(ref __instance.m_velocity)).magnitude / 300f; int num2 = Physics.OverlapSphereNonAlloc(((Component)__instance).transform.position, num, collider_array, LayerMask.op_Implicit(AM.PLM), (QueryTriggerInteraction)2); for (int i = 0; i < num2; i++) { if ((Object)(object)collider_array[i] != (Object)null && !((Object)(object)collider_array[i].attachedRigidbody == (Object)null) && !(((Object)collider_array[i].attachedRigidbody).name != "Head")) { SosigLink component = ((Component)collider_array[i].attachedRigidbody).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && component.S.m_hasPriority) { AIEvent val = new AIEvent((((Component)GM.CurrentPlayerBody).transform.position + ((Component)__instance).transform.position) / 2f, (AIEType)3, 1f, 1f); component.S.Priority.ProcessEvent(val); Sosig s = component.S; s.m_aggrolevel += 0.75f; } } } flag = true; } if (Random.value < 0.5f && !flag) { GM.CurrentSceneSettings.OnPerceiveableSound((__instance.Mass * 1000f + 50f) / 2f, (10f + ((Vector3)(ref __instance.m_velocity)).magnitude / 100f) / 3f, ((Component)__instance).transform.position, GM.CurrentPlayerBody.GetPlayerIFF(), GM.CurrentPlayerBody.PlayerEntities[0]); } } [HarmonyPatch(typeof(BallisticProjectile), "MoveBullet")] [HarmonyPrefix] private static bool BallisticProjectile_MoveBullet_prefix(BallisticProjectile __instance, float t) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_177f: Unknown result type (might be due to invalid IL or missing references) //IL_1784: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: 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_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: 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_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Invalid comparison between Unknown and I4 //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Invalid comparison between Unknown and I4 //IL_0967: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Unknown result type (might be due to invalid IL or missing references) //IL_0982: Unknown result type (might be due to invalid IL or missing references) //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_09f4: Unknown result type (might be due to invalid IL or missing references) //IL_09f5: Unknown result type (might be due to invalid IL or missing references) //IL_09f8: Unknown result type (might be due to invalid IL or missing references) //IL_09fd: Unknown result type (might be due to invalid IL or missing references) //IL_0a04: Unknown result type (might be due to invalid IL or missing references) //IL_0a0b: Invalid comparison between Unknown and I4 //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Invalid comparison between Unknown and I4 //IL_0a0f: Unknown result type (might be due to invalid IL or missing references) //IL_0a16: Invalid comparison between Unknown and I4 //IL_0901: Unknown result type (might be due to invalid IL or missing references) //IL_0907: Invalid comparison between Unknown and I4 //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Invalid comparison between Unknown and I4 //IL_090b: Unknown result type (might be due to invalid IL or missing references) //IL_0910: Unknown result type (might be due to invalid IL or missing references) //IL_0912: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Invalid comparison between Unknown and I4 //IL_0942: Unknown result type (might be due to invalid IL or missing references) //IL_0917: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_0946: Unknown result type (might be due to invalid IL or missing references) //IL_094e: Unknown result type (might be due to invalid IL or missing references) //IL_0959: Unknown result type (might be due to invalid IL or missing references) //IL_091f: Unknown result type (might be due to invalid IL or missing references) //IL_0924: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0aaa: Unknown result type (might be due to invalid IL or missing references) //IL_0ab1: Invalid comparison between Unknown and I4 //IL_0795: Unknown result type (might be due to invalid IL or missing references) //IL_07a7: Unknown result type (might be due to invalid IL or missing references) //IL_0af5: Unknown result type (might be due to invalid IL or missing references) //IL_0afc: Invalid comparison between Unknown and I4 //IL_0804: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0831: Unknown result type (might be due to invalid IL or missing references) //IL_0841: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Expected O, but got Unknown //IL_0ca9: Unknown result type (might be due to invalid IL or missing references) //IL_0cb0: Invalid comparison between Unknown and I4 //IL_0f85: Unknown result type (might be due to invalid IL or missing references) //IL_0f87: Unknown result type (might be due to invalid IL or missing references) //IL_0f89: Unknown result type (might be due to invalid IL or missing references) //IL_0f8e: Unknown result type (might be due to invalid IL or missing references) //IL_1104: Unknown result type (might be due to invalid IL or missing references) //IL_1109: Unknown result type (might be due to invalid IL or missing references) //IL_110b: Unknown result type (might be due to invalid IL or missing references) //IL_1112: Unknown result type (might be due to invalid IL or missing references) //IL_1117: Unknown result type (might be due to invalid IL or missing references) //IL_111c: Unknown result type (might be due to invalid IL or missing references) //IL_1125: Unknown result type (might be due to invalid IL or missing references) //IL_112a: Unknown result type (might be due to invalid IL or missing references) //IL_112c: Unknown result type (might be due to invalid IL or missing references) //IL_1134: Unknown result type (might be due to invalid IL or missing references) //IL_1139: Unknown result type (might be due to invalid IL or missing references) //IL_113e: Unknown result type (might be due to invalid IL or missing references) //IL_1154: Unknown result type (might be due to invalid IL or missing references) //IL_1159: Unknown result type (might be due to invalid IL or missing references) //IL_0fa4: Unknown result type (might be due to invalid IL or missing references) //IL_0faf: Unknown result type (might be due to invalid IL or missing references) //IL_0fb9: Unknown result type (might be due to invalid IL or missing references) //IL_0fbe: Unknown result type (might be due to invalid IL or missing references) //IL_0fc3: Unknown result type (might be due to invalid IL or missing references) //IL_0fc5: Unknown result type (might be due to invalid IL or missing references) //IL_0fcc: Unknown result type (might be due to invalid IL or missing references) //IL_0fd1: Unknown result type (might be due to invalid IL or missing references) //IL_0fd6: Unknown result type (might be due to invalid IL or missing references) //IL_0fdf: Unknown result type (might be due to invalid IL or missing references) //IL_0fe4: Unknown result type (might be due to invalid IL or missing references) //IL_0fe6: Unknown result type (might be due to invalid IL or missing references) //IL_0fee: Unknown result type (might be due to invalid IL or missing references) //IL_0ff3: Unknown result type (might be due to invalid IL or missing references) //IL_0ff8: Unknown result type (might be due to invalid IL or missing references) //IL_100e: Unknown result type (might be due to invalid IL or missing references) //IL_1013: Unknown result type (might be due to invalid IL or missing references) //IL_1015: Unknown result type (might be due to invalid IL or missing references) //IL_1017: Unknown result type (might be due to invalid IL or missing references) //IL_11e6: Unknown result type (might be due to invalid IL or missing references) //IL_1084: Unknown result type (might be due to invalid IL or missing references) //IL_108f: Unknown result type (might be due to invalid IL or missing references) //IL_1099: Unknown result type (might be due to invalid IL or missing references) //IL_109e: Unknown result type (might be due to invalid IL or missing references) //IL_10a3: Unknown result type (might be due to invalid IL or missing references) //IL_10a5: Unknown result type (might be due to invalid IL or missing references) //IL_10a6: Unknown result type (might be due to invalid IL or missing references) //IL_10b2: Unknown result type (might be due to invalid IL or missing references) //IL_10b7: Unknown result type (might be due to invalid IL or missing references) //IL_10b9: Unknown result type (might be due to invalid IL or missing references) //IL_10c1: Unknown result type (might be due to invalid IL or missing references) //IL_1209: Unknown result type (might be due to invalid IL or missing references) //IL_120b: Unknown result type (might be due to invalid IL or missing references) //IL_11fc: Unknown result type (might be due to invalid IL or missing references) //IL_11fe: Unknown result type (might be due to invalid IL or missing references) //IL_1203: Unknown result type (might be due to invalid IL or missing references) //IL_10d2: Unknown result type (might be due to invalid IL or missing references) //IL_10da: Unknown result type (might be due to invalid IL or missing references) //IL_10df: Unknown result type (might be due to invalid IL or missing references) //IL_10e4: Unknown result type (might be due to invalid IL or missing references) //IL_1231: Unknown result type (might be due to invalid IL or missing references) //IL_1236: Unknown result type (might be due to invalid IL or missing references) //IL_118e: Unknown result type (might be due to invalid IL or missing references) //IL_1192: Unknown result type (might be due to invalid IL or missing references) //IL_1197: Unknown result type (might be due to invalid IL or missing references) //IL_10f2: Unknown result type (might be due to invalid IL or missing references) //IL_10f7: Unknown result type (might be due to invalid IL or missing references) //IL_1241: Unknown result type (might be due to invalid IL or missing references) //IL_1248: Invalid comparison between Unknown and I4 //IL_12a8: Unknown result type (might be due to invalid IL or missing references) //IL_12af: Invalid comparison between Unknown and I4 //IL_1291: Unknown result type (might be due to invalid IL or missing references) //IL_12b3: Unknown result type (might be due to invalid IL or missing references) //IL_12ba: Invalid comparison between Unknown and I4 //IL_12e1: Unknown result type (might be due to invalid IL or missing references) //IL_12e8: Expected O, but got Unknown //IL_12eb: Unknown result type (might be due to invalid IL or missing references) //IL_161c: Unknown result type (might be due to invalid IL or missing references) //IL_1621: Unknown result type (might be due to invalid IL or missing references) //IL_1624: Unknown result type (might be due to invalid IL or missing references) //IL_162a: Invalid comparison between Unknown and I4 //IL_1301: Unknown result type (might be due to invalid IL or missing references) //IL_1306: Unknown result type (might be due to invalid IL or missing references) //IL_1308: Unknown result type (might be due to invalid IL or missing references) //IL_131f: Expected I4, but got Unknown //IL_1634: Unknown result type (might be due to invalid IL or missing references) //IL_1639: Unknown result type (might be due to invalid IL or missing references) //IL_162d: Unknown result type (might be due to invalid IL or missing references) //IL_1632: Unknown result type (might be due to invalid IL or missing references) //IL_15fc: Unknown result type (might be due to invalid IL or missing references) //IL_1604: Unknown result type (might be due to invalid IL or missing references) //IL_160f: Unknown result type (might be due to invalid IL or missing references) //IL_15d1: Unknown result type (might be due to invalid IL or missing references) //IL_15e2: Unknown result type (might be due to invalid IL or missing references) //IL_15ed: Unknown result type (might be due to invalid IL or missing references) //IL_13c2: Unknown result type (might be due to invalid IL or missing references) //IL_13c7: Unknown result type (might be due to invalid IL or missing references) //IL_13c9: Unknown result type (might be due to invalid IL or missing references) //IL_13e0: Expected I4, but got Unknown //IL_166b: Unknown result type (might be due to invalid IL or missing references) //IL_1670: Unknown result type (might be due to invalid IL or missing references) //IL_168a: Unknown result type (might be due to invalid IL or missing references) //IL_168f: Unknown result type (might be due to invalid IL or missing references) //IL_1691: Unknown result type (might be due to invalid IL or missing references) //IL_1694: Unknown result type (might be due to invalid IL or missing references) //IL_169c: Unknown result type (might be due to invalid IL or missing references) //IL_16a9: Expected I4, but got Unknown //IL_156a: Unknown result type (might be due to invalid IL or missing references) //IL_156f: Unknown result type (might be due to invalid IL or missing references) //IL_157c: Unknown result type (might be due to invalid IL or missing references) //IL_1581: Unknown result type (might be due to invalid IL or missing references) //IL_1588: Unknown result type (might be due to invalid IL or missing references) //IL_1589: Unknown result type (might be due to invalid IL or missing references) //IL_1747: Unknown result type (might be due to invalid IL or missing references) //IL_1749: Unknown result type (might be due to invalid IL or missing references) //IL_1750: Unknown result type (might be due to invalid IL or missing references) //IL_172c: Unknown result type (might be due to invalid IL or missing references) //IL_172e: Unknown result type (might be due to invalid IL or missing references) //IL_16ca: Unknown result type (might be due to invalid IL or missing references) //IL_16cf: Unknown result type (might be due to invalid IL or missing references) //IL_16d0: Unknown result type (might be due to invalid IL or missing references) //IL_16d5: Unknown result type (might be due to invalid IL or missing references) //IL_16d8: Unknown result type (might be due to invalid IL or missing references) //IL_16e0: Unknown result type (might be due to invalid IL or missing references) //IL_16ed: Expected I4, but got Unknown //IL_16f5: Unknown result type (might be due to invalid IL or missing references) //IL_16fa: Unknown result type (might be due to invalid IL or missing references) //IL_16fb: Unknown result type (might be due to invalid IL or missing references) //IL_1700: Unknown result type (might be due to invalid IL or missing references) //IL_1703: Unknown result type (might be due to invalid IL or missing references) //IL_170b: Unknown result type (might be due to invalid IL or missing references) //IL_1718: Expected I4, but got Unknown if (__instance.Source_IFF != GM.CurrentPlayerBody.m_playerIFF) { return true; } __instance.movesThisFrame++; if (__instance.movesThisFrame > 2) { return false; } if (__instance.m_velocity.y < 0f && __instance.DeletesOnStraightDown) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(__instance.m_velocity.x, 0f, __instance.m_velocity.z); if (((Vector3)(ref val)).magnitude < 0.1f && ((Component)__instance).transform.position.y < GM.CurrentSceneSettings.CatchHeight) { goto IL_1792; } } if (((Component)__instance).transform.position.y >= -350f) { Vector3 val2 = ((Component)__instance).transform.position; if (__instance.m_isInReferenceTransform && (Object)(object)__instance.m_transReference != (Object)null) { val2 = __instance.m_transReference.TransformPoint(__instance.m_localReferencePoint); } __instance.m_isInReferenceTransform = false; __instance.m_transReference = null; Vector3 normalized = ((Vector3)(ref __instance.m_velocity)).normalized; float magnitude = ((Vector3)(ref __instance.m_velocity)).magnitude; float num = magnitude * t * __instance.FlightVelocityMultiplier * __instance.m_debugFlightVelGlobal; if (__instance.needsSecondCast) { num = Mathf.Clamp(num - __instance.distMoved, 0f, num); } __instance.needsSecondCast = false; if (!Physics.Raycast(val2, normalized, ref __instance.m_hit, num, LayerMask.op_Implicit(__instance.LM), (QueryTriggerInteraction)2)) { ((Component)__instance).transform.position = val2 + __instance.m_velocity * t * __instance.FlightVelocityMultiplier * __instance.m_debugFlightVelGlobal; if (!__instance.m_hasPlayedWhoosh && __instance.Source_IFF != GM.CurrentPlayerBody.GetPlayerIFF()) { Vector3 closestValidPoint = __instance.GetClosestValidPoint(val2, ((Component)__instance).transform.position, __instance.m_cachedHead.position); float num2 = Vector3.Distance(closestValidPoint, __instance.m_cachedHead.position); if (num2 < 3f) { float num3 = Mathf.Lerp(1f, 0.2f, Mathf.Clamp(num2 - 1f, 0f, 2f) * 0.5f); Vector3 val3 = __instance.m_cachedHead.position - val2; if (Vector3.Dot(((Vector3)(ref val3)).normalized, normalized) > 0f) { __instance.m_hasPlayedWhoosh = true; SM.PlayBulletImpactHit((BulletImpactSoundType)28, closestValidPoint, num3, 1f); } } } if (!(((Vector3)(ref __instance.m_velocity)).normalized != Vector3.zero)) { } } else { __instance.m_isTumbling = true; if ((Object)(object)__instance.m_lastColliderHit != (Object)null && (Object)(object)((RaycastHit)(ref __instance.m_hit)).collider == (Object)(object)__instance.m_lastColliderHit) { __instance.needsSecondCast = true; __instance.distMoved = ((RaycastHit)(ref __instance.m_hit)).distance; ((Component)__instance).transform.position = ((RaycastHit)(ref __instance.m_hit)).point - ((RaycastHit)(ref __instance.m_hit)).normal * 0.001f; if (log_bullet_events) { Logger.LogDebug((object)"MoveBullet will now call itself."); } __instance.MoveBullet(t); return false; } bool flag = false; if ((Object)(object)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody != (Object)null) { flag = true; } __instance.m_lastColliderHit = ((RaycastHit)(ref __instance.m_hit)).collider; bool flag2 = false; IFVRDamageable component = ((Component)((Component)((RaycastHit)(ref __instance.m_hit)).collider).transform).gameObject.GetComponent(); if (component == null && flag) { component = ((Component)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody).gameObject.GetComponent(); } if (component != null) { flag2 = true; } if (__instance.DoesIgniteOnHit && Random.Range(0f, 1f) < __instance.IgnitionChance) { FVRIgnitable component2 = ((Component)((Component)((RaycastHit)(ref __instance.m_hit)).collider).transform).gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { FXM.Ignite(component2, 1f); } else if (flag) { component2 = ((Component)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody).GetComponent(); if ((Object)(object)component2 != (Object)null) { FXM.Ignite(component2, 1f); } } } if (flag && __instance.DoesVaporizeOnHit && Random.Range(0f, 1f) < __instance.VaporizeChange) { IVaporizable component3 = ((Component)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody).gameObject.GetComponent(); if (component3 != null) { component3.Vaporize(__instance.Source_IFF); } } bool flag3 = false; PMat component4 = ((Component)((Component)((RaycastHit)(ref __instance.m_hit)).collider).transform).gameObject.GetComponent(); if ((Object)(object)component4 == (Object)null && flag) { component4 = ((Component)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody).gameObject.GetComponent(); } if ((Object)(object)component4 != (Object)null && (Object)(object)component4.MatDef != (Object)null) { flag3 = true; } Rigidbody val4 = null; bool flag4 = false; if (flag) { val4 = ((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody; flag4 = true; __instance.m_isInReferenceTransform = true; __instance.m_transReference = ((Component)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody).gameObject.transform; } MatDef val5 = (flag3 ? component4.MatDef : PM.DefaultMatDef); if (__instance.GeneratesImpactSound && (int)GM.Options.SimulationOptions.HitSoundMode2 == 1) { float num4 = 0.8f; float num5 = 1f; if ((int)__instance.ImpactFXMagnitude == 4 || (int)__instance.ImpactFXMagnitude == 1) { num5 = 0.4f; num4 = 1.3f; } else if ((int)__instance.ImpactFXMagnitude == 2) { num5 = 0.7f; num4 = 1f; } num5 *= Mathf.InverseLerp(0f, __instance.m_initialMuzzleVelocity, magnitude); SM.PlayBulletImpactHit(val5.BulletImpactSound, ((RaycastHit)(ref __instance.m_hit)).point, 25f, num5, num4); if (hit_sound.Value && (int)val5.BulletImpactSound == 13 && Vector3.Distance(((RaycastHit)(ref __instance.m_hit)).point, GM.CurrentPlayerBody.Head.position) >= 5f) { SM.PlayBulletImpactHit(val5.BulletImpactSound, GM.CurrentPlayerBody.Head.position + GM.CurrentPlayerBody.Head.forward * 1f, 10f, Random.Range(0.4f, 0.7f) * hit_sound_vol.Value, 2f - (__instance.Dimensions.x + __instance.Dimensions.z + __instance.Mass * 5f)); } } if (em_alert_mod.Value) { float num6 = 5f + (__instance.Dimensions.x * 10f + __instance.Mass * 100f); byte b = 0; int num7 = Physics.OverlapSphereNonAlloc(((Component)__instance).transform.position, num6, collider_array, LayerMask.op_Implicit(AM.PLM), (QueryTriggerInteraction)2); for (int i = 0; i < num7; i++) { if (!((Object)(object)collider_array[i] != (Object)null) || (Object)(object)collider_array[i].attachedRigidbody == (Object)null || ((Object)collider_array[i].attachedRigidbody).name != "Head") { continue; } SosigLink component5 = ((Component)collider_array[i].attachedRigidbody).gameObject.GetComponent(); if ((Object)(object)component5 != (Object)null) { if (log_bullet_events) { Logger.LogInfo((object)("\tentities[" + i + "] dist = " + Vector3.Distance(((Component)__instance).transform.position, ((Component)collider_array[i]).transform.position) + " m,\tenemy = " + ((Object)component5.S).GetInstanceID())); b++; } if (component5.S.m_hasPriority) { _ = (((Component)GM.CurrentPlayerBody).transform.position + ((Component)__instance).transform.position) / 2f; AIEvent val6 = new AIEvent(((Component)collider_array[i]).transform.position, (AIEType)3, 1f, 1f); component5.S.Priority.ProcessEvent(val6); Sosig s = component5.S; s.m_aggrolevel += 0.5f; } } } if (log_bullet_events && b != 0) { ManualLogSource logger = Logger; string[] obj = new string[7] { "Bullet impact OverlapSphere (radius = ", num6.ToString(), " m) at ", Time.frameCount.ToString(), " found ", null, null }; int num8 = b; obj[5] = num8.ToString(); obj[6] = " enemies"; logger.LogInfo((object)string.Concat(obj)); } } if (!flag && __instance.GeneratesImpactDecals && (int)GM.Options.SimulationOptions.HitDecalMode2 == 1) { BulletHoleDecalType val7 = val5.BulletHoleType; if ((int)val7 != 0 && (int)__instance.BulletHoleDecalOverride != 0) { val7 = __instance.BulletHoleDecalOverride; } float num9 = Mathf.Clamp(__instance.Dimensions.x, 0.0001f, 0.02f); if ((int)val7 != 0) { FXM.SpawnBulletDecal(val7, ((RaycastHit)(ref __instance.m_hit)).point, ((RaycastHit)(ref __instance.m_hit)).normal, num9); } } BallisticMatSeries matSeries = PM.GetMatSeries(val5.BallisticType, __instance.ProjType); float ricochetLimit = matSeries.RicochetLimit; float num10 = Vector3.Angle(normalized, -((RaycastHit)(ref __instance.m_hit)).normal); bool flag5 = false; bool flag6 = false; bool flag7 = false; bool flag8 = false; float num11 = 0.5f * __instance.Mass * Mathf.Pow(magnitude, 2f) / __instance.FrontArea * 0.01f / 140f; float num12 = 0.5f * __instance.Mass * Mathf.Pow(magnitude, 2f); float num13 = 0f; Vector3 val8 = normalized; Vector3 velocity = __instance.m_velocity; bool flag9 = false; if (((int)matSeries.MaterialType == 110 || (int)matSeries.MaterialType == 61) && flag4) { flag9 = true; } if (num10 >= ricochetLimit) { flag5 = true; } float num14 = 1f - num10 / 90f; num14 = Mathf.Max(num14, matSeries.MinAngularAbsord); float num15 = Mathf.Lerp(0f, matSeries.Absorption, num14); float num16 = num11 * num14; bool flag10 = false; float num17 = 1f; if (flag9 && bullet_pen_mod.Value) { if (num16 < matSeries.PenThreshold) { if (log_bullet_events) { Logger.LogDebug((object)"> This bullet could not normally penetrate armor.\t<\t<"); } flag10 = true; } if ((int)matSeries.MaterialType == 110) { Logger.LogDebug((object)(((Object)__instance).name + " " + ((Object)__instance).GetInstanceID() + " hit Lv 1 armor")); impact_frame = Time.frameCount; armor_lv = 1; } else if ((int)matSeries.MaterialType == 61) { Logger.LogDebug((object)(((Object)__instance).name + " " + ((Object)__instance).GetInstanceID() + " hit Lv 2 armor")); impact_frame = Time.frameCount; armor_lv = 2; } else { Logger.LogDebug((object)"???"); impact_frame = Time.frameCount - 10; armor_lv = 0; } if (((Object)__instance).name.EndsWith("JHP(Clone)") || ((Object)__instance).name.EndsWith("SP(Clone)")) { if (log_bullet_events) { if (((Object)__instance).name.EndsWith("JHP(Clone)")) { Logger.LogWarning((object)(((Object)__instance).name + " " + ((Object)__instance).GetInstanceID() + " is a hollow-point, penetration reduced.")); } if (((Object)__instance).name.EndsWith("SP(Clone)")) { Logger.LogWarning((object)(((Object)__instance).name + " " + ((Object)__instance).GetInstanceID() + " is a soft-point, which is not only toxic and harmful to the environment because it's exposed lead, but it's banned under the Hague conventions.\nAlso, penetration reduced.")); } } if (flag10) { num17 = 0.5f; flat_bullet = true; } } else { flat_bullet = false; if (flag10) { if (armor_lv == 1) { num17 = 0.06f; was_this_bullet_able_to_pierce_armor_normally = false; } else if (armor_lv == 2) { num17 = 0.05f; was_this_bullet_able_to_pierce_armor_normally = false; } } } } else { was_this_bullet_able_to_pierce_armor_normally = true; } if (!bullet_pen_mod.Value || !flag10) { num17 = 1f; was_this_bullet_able_to_pierce_armor_normally = true; } Logger.LogDebug((object)("was_this_bullet_able_to_pierce_armor_normally = " + was_this_bullet_able_to_pierce_armor_normally)); if (log_bullet_events && ((int)matSeries.MaterialType == 50 || flag9)) { Logger.LogDebug((object)("matSeries.MinAngularAbsord = " + matSeries.MinAngularAbsord + ", Absorption = " + matSeries.Absorption + ", Roughness = " + matSeries.Roughness)); Logger.LogDebug((object)("impact_aspect = " + num14 + " (after limiting),\n\tabsorption = " + num15 + ",\n\tpressure2 = " + num11 + " * " + num14 + " = " + num16)); Logger.LogDebug((object)("penmod = " + num17)); } float num19; float num20; if (num16 > matSeries.PenThreshold * num17 && !__instance.IsDisabledOnFirstImpact) { flag6 = true; float num18 = Mathf.Clamp(matSeries.PenThreshold * num17 / num16 + num15, 0f, 1f); num13 = num18 * num12; num19 = num12 - num13; num20 = num18 * num11; if (flag9 && log_bullet_events) { Logger.LogWarning((object)"> bullet penetrated armor <"); Logger.LogDebug((object)("impact_force_num8 = " + num13 + ", \n\tpiercing_amount = " + num18 + ", \n\tKE after penetration = " + num19 + ", \n\tpiercing damage = " + num20 + " <")); } } else if (num13 > matSeries.ShatterThreshold || __instance.IsDisabledOnFirstImpact) { flag7 = true; num13 = num12; num19 = 0f; num20 = num11; if (flag9 && log_bullet_events) { Logger.LogDebug((object)"bullet shattered?"); } } else { num13 = num12 * num14; num19 = num12 - num13; num20 = num11 * num14; flag5 = true; float num21 = Mathf.Clamp(num13 / num12 + num15, 0f, 1f); num13 = num21 * num12; num19 = num12 - num13; num20 = num11 * num21; if (flag9 && log_bullet_events) { Logger.LogDebug((object)("bullet failed to pierce armor?\n\tKE after impact = " + num19 + "\n\tpiercing_damage_num14 = " + num11 + " * " + num21 + " = " + num19)); } } if (__instance.m_usesSubmunitions) { flag7 = true; flag8 = true; } Vector3 val9 = val8; Vector3 onUnitSphere = Random.onUnitSphere; Vector3 val10; if (flag5 && !flag7) { val10 = ((RaycastHit)(ref __instance.m_hit)).point + ((RaycastHit)(ref __instance.m_hit)).normal * 0.001f; val8 = Vector3.Lerp(Vector3.Reflect(normalized, ((RaycastHit)(ref __instance.m_hit)).normal), onUnitSphere, matSeries.Roughness); val8 = Vector3.Lerp(Vector3.ProjectOnPlane(val8, ((RaycastHit)(ref __instance.m_hit)).normal), val8, Mathf.Clamp(num14 * num14, 0.1f, 1f)); val9 = val8; if (flag9 && log_bullet_events) { Logger.LogDebug((object)("bullet bounced off " + ((object)Unsafe.As(ref matSeries.MaterialType)/*cast due to .constrained prefix*/).ToString())); } } else if (flag6 && !flag7) { if (matSeries.StopsOnPen) { num13 = num12; num19 = 0f; num20 = num11; flag8 = true; } val10 = ((RaycastHit)(ref __instance.m_hit)).point - ((RaycastHit)(ref __instance.m_hit)).normal * 0.001f; val8 = Vector3.Lerp(normalized, onUnitSphere, matSeries.Roughness * num14); if (Vector3.Angle(val8, ((RaycastHit)(ref __instance.m_hit)).normal) < 90f) { val8 = Vector3.Reflect(val8, ((RaycastHit)(ref __instance.m_hit)).normal); } if (matSeries.DownGradesOnPen) { __instance.ProjType = matSeries.DownGradesTo; } } else { val10 = ((RaycastHit)(ref __instance.m_hit)).point; val9 = Vector3.Lerp(Vector3.Reflect(normalized, ((RaycastHit)(ref __instance.m_hit)).normal), onUnitSphere, matSeries.Roughness); val9 = Vector3.Lerp(Vector3.ProjectOnPlane(val8, ((RaycastHit)(ref __instance.m_hit)).normal), val8, Mathf.Clamp(num14 * num14, 0.1f, 1f)); } float num22 = 0f; if (!flag8 && !flag7 && num19 > 0f) { num22 = Mathf.Sqrt(2f * num19) / Mathf.Sqrt(__instance.Mass); velocity = val8 * num22; if (flag9 && log_bullet_events) { Logger.LogDebug((object)("V was " + ((Vector3)(ref velocity)).magnitude + ", is now " + ((Vector3)(ref val8)).magnitude * num22)); } } ((Component)__instance).transform.position = val10; if (__instance.m_isInReferenceTransform) { __instance.m_localReferencePoint = __instance.m_transReference.InverseTransformPoint(val10); } __instance.m_velocity = velocity; if (flag8 || flag7 || num22 <= 0f || num19 <= 0f) { __instance.m_isMoving = false; __instance.m_velocity = Vector3.zero; if ((flag9 || (int)matSeries.MaterialType == 51) && log_bullet_events) { Logger.LogDebug((object)("bullet stopped in " + ((object)Unsafe.As(ref matSeries.MaterialType)/*cast due to .constrained prefix*/).ToString())); } if ((Object)(object)__instance.Trail != (Object)null) { __instance.Trail.AddPosition(((Component)__instance).transform.position); } } float num23 = num13; float num24 = 0f; if ((int)matSeries.MaterialType == 51 || (int)matSeries.MaterialType == 50) { num24 = Mathf.Clamp(num19, 0f, matSeries.PenThreshold * 2f * num14); } if (flag2) { Damage val11 = new Damage(); val11.Class = (DamageClass)1; val11.Dam_TotalKinetic = num13; if (flag6) { BallisticProjectileType projType = __instance.ProjType; switch ((int)projType) { case 0: val11.Dam_Piercing = num20 * 0.3f; val11.Dam_Blunt = num13 * 0.7f; break; case 1: val11.Dam_Piercing = num20 * 0.5f; val11.Dam_Blunt = num13 * 0.5f; break; case 2: val11.Dam_Piercing = num20 * 0.7f; val11.Dam_Blunt = num13 * 0.3f; break; case 3: val11.Dam_Piercing = num20 * 0.9f; val11.Dam_Blunt = num13 * 0.1f; break; } val11.Dam_Piercing += num24 * 1f; } else if (flag7) { BallisticProjectileType projType = __instance.ProjType; switch ((int)projType) { case 0: val11.Dam_Piercing = num20 * 0.1f; val11.Dam_Blunt = num13 * 0.9f; break; case 1: val11.Dam_Piercing = num20 * 0.3f; val11.Dam_Blunt = num13 * 0.7f; break; case 2: val11.Dam_Piercing = num20 * 0.4f; val11.Dam_Blunt = num13 * 0.6f; break; case 3: val11.Dam_Piercing = num20 * 0.5f; val11.Dam_Blunt = num13 * 0.5f; break; } } else if (flag5) { val11.Dam_Blunt = num13; } if (__instance.DoesIgniteOnHit) { val11.Dam_Thermal = 50f; } if (__instance.Source_IFF == GM.CurrentPlayerBody.GetPlayerIFF() && (GM.CurrentPlayerBody.isDamPowerUp || GM.CurrentPlayerBody.IsDamPowerDown)) { float damageMult = GM.CurrentPlayerBody.GetDamageMult(); val11.Dam_Piercing *= damageMult; val11.Dam_Blunt *= damageMult; val11.Dam_Cutting *= damageMult; val11.Dam_TotalKinetic *= damageMult; val11.Dam_Blinding *= damageMult; val11.Dam_Chilling *= damageMult; val11.Dam_EMP *= damageMult; val11.Dam_Stunning *= damageMult; val11.Dam_Thermal *= damageMult; val11.Dam_TotalEnergetic *= damageMult; } val11.point = ((RaycastHit)(ref __instance.m_hit)).point; val11.hitNormal = ((RaycastHit)(ref __instance.m_hit)).normal; val11.strikeDir = normalized; val11.damageSize = __instance.Dimensions.x; val11.Source_IFF = __instance.Source_IFF; num23 = val11.Dam_Blunt; component.Damage(val11); } if (flag4) { if (bullet_pen_mod.Value) { val4.AddForceAtPosition(normalized * Mathf.Sqrt(num23 * (num12 / 50f)), ((RaycastHit)(ref __instance.m_hit)).point, (ForceMode)0); } else { val4.AddForceAtPosition(normalized * Mathf.Sqrt(num23), ((RaycastHit)(ref __instance.m_hit)).point, (ForceMode)0); } } BallisticImpactEffectType val12 = val5.ImpactEffectType; if ((int)__instance.ImpactEffectTypeOverride != -1) { val12 = __instance.ImpactEffectTypeOverride; } Color val13 = Color.white; bool flag11 = false; if (GM.Options.SimulationOptions.TracerColorOverride > 0 && __instance.m_hasTracer) { flag11 = true; val13 = __instance.TracerRenderer.sharedMaterial.GetColor("_Color"); } if (flag7 || flag5) { if (magnitude > 100f) { FXM.SpawnImpactEffect(((RaycastHit)(ref __instance.m_hit)).point, val9, (int)val12, __instance.ImpactFXMagnitude, false, flag11, val13, __instance.OverrideImpactMat); } } else if (flag6 && magnitude > 100f) { if (flag8 || num22 == 0f) { FXM.SpawnImpactEffect(((RaycastHit)(ref __instance.m_hit)).point, -normalized, (int)val12, __instance.ImpactFXMagnitude, false, flag11, val13, __instance.OverrideImpactMat); } else { FXM.SpawnImpactEffect(((RaycastHit)(ref __instance.m_hit)).point, -normalized, (int)val12, __instance.ImpactFXMagnitude, true, flag11, val13, __instance.OverrideImpactMat); } } if (__instance.GeneratesSuppressionEvent) { __instance.GeneratesSuppressionEvent = false; GM.CurrentSceneSettings.OnSuppressingEvent(val10, normalized, __instance.Source_IFF, __instance.SuppressionIntensity, __instance.SuppressionRange); } __instance.FireSubmunitions(val9, normalized, ((RaycastHit)(ref __instance.m_hit)).point, ((Vector3)(ref __instance.m_velocity)).magnitude); __instance.m_stallFrames = Random.Range(0, 3); } __instance.m_distanceTraveled += Vector3.Distance(((Component)__instance).transform.position, val2); return false; } goto IL_1792; IL_1792: __instance.m_isMoving = false; return false; } [HarmonyPatch(typeof(SosigLink), "Damage")] [HarmonyPrefix] private static bool SosigLink_Damage_prefix(SosigLink __instance, Damage d) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Expected O, but got Unknown //IL_0adf: Unknown result type (might be due to invalid IL or missing references) //IL_0ae5: Unknown result type (might be due to invalid IL or missing references) bool flag = false; bool flag2 = false; if ((int)d.Class == 1 && d.Source_IFF == GM.CurrentPlayerBody.m_playerIFF) { flag = true; if (log_bullet_events) { Logger.LogDebug((object)("Time.frameCount - impact_frame = " + (Time.frameCount - impact_frame))); ManualLogSource logger = Logger; int num = armor_lv; logger.LogDebug((object)("armor_lv = " + num)); } if (Time.frameCount - impact_frame < 5 && armor_lv != 0 && bullet_pen_mod.Value) { if (was_this_bullet_able_to_pierce_armor_normally) { if (log_bullet_events) { Logger.LogWarning((object)"was_this_bullet_able_to_pierce_armor_normally == true; skipping damage edits."); } } else { flag2 = true; if (log_bullet_events) { Logger.LogWarning((object)"Damage override = true\t<\t<"); Logger.LogDebug((object)("Time.frameCount - impact_frame = " + (Time.frameCount - impact_frame))); Logger.LogDebug((object)("was_this_bullet_able_to_pierce_armor_normally = " + was_this_bullet_able_to_pierce_armor_normally)); } if (armor_lv == 1) { if (log_bullet_events) { Logger.LogDebug((object)"Attempting to edit damage params (lv1)..."); } if (d.Dam_Blunt > 500f) { d.Dam_Blunt = (d.Dam_Blunt + 500f) / 2f; } if (d.Dam_Blunt > 600f) { d.Dam_Blunt = 600f; } if (flat_bullet) { if (d.Dam_Blunt > 200f) { d.Dam_Blunt = (d.Dam_Blunt + 200f) / 2f; } if (d.Dam_Blunt > 300f) { d.Dam_Blunt = 300f; } } d.Dam_Piercing = (d.Dam_Piercing + d.Dam_Blunt / 10f) / 2f; } if (armor_lv == 2) { if (log_bullet_events) { Logger.LogDebug((object)"Attempting to edit damage params (lv2)..."); } if (d.Dam_Blunt > 200f) { d.Dam_Blunt = (d.Dam_Blunt + 200f + 200f) / 3f; } d.Dam_Piercing = (d.Dam_Piercing + d.Dam_Blunt / 100f) / 2f; if (d.Dam_Blunt > 200f) { d.Dam_Blunt = 200f; } if (flat_bullet) { if (d.Dam_Blunt > 50f) { d.Dam_Blunt = (d.Dam_Blunt + 50f + 50f) / 3f; } if (d.Dam_Blunt > 50f) { d.Dam_Blunt = 50f; } } } } } float num2 = Vector3.Angle(d.strikeDir, -d.hitNormal); float num3 = Mathf.Clamp((1f - num2 / 90f) * 1.5f, 0.4f, 1.5f); if (flag && bullet_pen_mod.Value) { num3 *= pl_out_dmg_mult.Value; if (num3 > 1.5f) { num3 = 1.5f; } if (num3 < 0.3f) { num3 = 0.3f; } } d.Dam_Blunt *= num3; d.Dam_Cutting *= num3; d.Dam_Piercing *= num3; d.Dam_TotalKinetic *= num3; if (__instance.S.IsFrozen) { d.Dam_Blunt *= 3f; d.Dam_Cutting *= 0.2f; d.Dam_Piercing *= 0.02f; } if ((Object)(object)__instance.S != (Object)null) { if (flag && em_alert_mod.Value) { AIEvent val = new AIEvent(GM.CurrentPlayerBody.PlayerEntities[0], (AIEType)3, 10f, 0.1f); __instance.S.Priority.ProcessEvent(val); Sosig s = __instance.S; s.m_aggrolevel += 1f; } if (__instance.S.IsInvuln) { return true; } float num4 = 1f; if (__instance.S.IsDamResist || __instance.S.IsDamMult) { num4 = __instance.S.BuffIntensity_DamResistHarm; } if (__instance.S.IsFragile) { num4 *= 100f; } d.Dam_Blunt *= num4; d.Dam_Cutting *= num4; d.Dam_Piercing *= num4; d.Dam_TotalKinetic *= num4; d.Dam_Thermal *= num4; d.Dam_Chilling *= num4; d.Dam_EMP *= num4; d.Dam_Blunt *= __instance.S.DamMult_Projectile; d.Dam_Cutting *= __instance.S.DamMult_Projectile; d.Dam_Piercing *= __instance.S.DamMult_Projectile; d.Dam_TotalKinetic *= __instance.S.DamMult_Projectile; } d.Dam_Thermal *= __instance.S.DamMult_Thermal; d.Dam_Chilling *= __instance.S.DamMult_Chilling; d.Dam_EMP *= __instance.S.DamMult_EMP; __instance.S.ProcessDamage(d, __instance); bool flag3 = false; if (__instance.m_integrity > 0f) { if (flag && log_bullet_events) { Logger.LogWarning((object)"> BULLET DAMAGED ENEMY <\t<\t<\t<"); Logger.LogDebug((object)("damage_override = " + flag2)); Logger.LogDebug((object)("impact_angle = " + num2 + ",\t impact_aspect = " + num3)); Logger.LogDebug((object)("(sosiglink damage) damage params:\n\tblunt: " + d.Dam_Blunt + "\n\tpiercing: " + d.Dam_Piercing + "\n\tkinetic: " + d.Dam_TotalKinetic + "\n\tDamMult: " + __instance.DamMult)); float num5 = d.Dam_Blunt * 0.032f; num5 += Mathf.Clamp((d.Dam_Piercing - 500f) * 0.008f, 0f, 100f); num5 += Mathf.Clamp((d.Dam_Cutting - 500f) * 0.008f, 0f, 100f); num5 += Mathf.Clamp(d.Dam_Thermal * 0.01f, 0f, 100f); num5 = Mathf.Clamp(num5 * __instance.DamMult, 0f, 100f); Logger.LogDebug((object)("integrity damage " + num5)); } flag3 = __instance.DamageIntegrity(d); } if (d.Dam_TotalKinetic > 80f) { __instance.S.RequestHitDecal(d.point, d.hitNormal, d.damageSize * 2f, __instance); } if (__instance.S.Mustard > 0f && !flag3) { float num6 = (d.Dam_Piercing + d.Dam_Cutting + d.Dam_TotalKinetic / 4f - 50f) * 0.05f; float damMult = __instance.DamMult; num6 = Mathf.Clamp(num6 * damMult, 0f, 100f); __instance.S.SetLastIFFDamageSource(d.Source_IFF); if (flag) { if (!flag2) { if (log_bullet_events) { num6 *= pl_out_dmg_mult.Value; if (num6 > 100f) { num6 = 100f; } Logger.LogDebug((object)("bleeding amount = (" + d.Dam_Piercing + " + " + d.Dam_Cutting + " + " + d.Dam_TotalKinetic / 4f + " - 50f) * 0.05f = " + num6)); } } else if (bullet_pen_mod.Value) { if (armor_lv == 1) { num6 = (d.Dam_Piercing + d.Dam_Cutting + d.Dam_TotalKinetic / 5f - 50f) * 0.05f; damMult = __instance.DamMult; num6 = Mathf.Clamp(num6 * damMult, 0f, 100f); if (num6 < 5f) { num6 = (num6 + num6 + 5f) / 3f; } num6 *= pl_out_dmg_mult.Value; if (num6 > 100f) { num6 = 100f; } if (log_bullet_events) { Logger.LogDebug((object)("bleeding amount = (" + d.Dam_Piercing + " + " + d.Dam_Cutting + " + " + d.Dam_TotalKinetic / 5f + " - 50f) * 0.05f (+ dmg mult / 2) = " + num6 + " (lv1)")); } } if (armor_lv == 2) { num6 = (d.Dam_Piercing + d.Dam_Cutting + d.Dam_TotalKinetic / 8f - 50f) * 0.05f; damMult = __instance.DamMult; num6 = Mathf.Clamp(num6 * damMult, 0f, 100f); if (num6 < 2f) { num6 = (num6 + 2f + 2f) / 3f; } num6 *= pl_out_dmg_mult.Value; if (num6 > 100f) { num6 = 100f; } if (log_bullet_events) { Logger.LogDebug((object)("bleeding amount = (" + d.Dam_Piercing + " + " + d.Dam_Cutting + " + " + d.Dam_TotalKinetic / 8f + " - 50f) * 0.05f (+ dmg mult / 2) = " + num6 + " (lv2)")); } } } if (log_bullet_events) { if (num6 < 1f) { Logger.LogError((object)"> Impact is too weak to cause bleeding. <"); } else { Logger.LogDebug((object)("bleeding amount = " + num6)); } } } __instance.S.AccurueBleedingHit(__instance, d.point, d.strikeDir, num6); } return false; } return true; } [HarmonyPatch(typeof(Sosig), "Configure")] [HarmonyPostfix] private static void Sosig_Configure_prefix(Sosig __instance) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00a9: Unknown result type (might be due to invalid IL or missing references) if (red_blood.Value) { Color val = default(Color); ((Color)(ref val))..ctor(0.7f, 0f, 0f, 1f); ((Renderer)__instance.DamageFX_SmallMustardBurst.GetComponent()).material.SetColor("_Color", val); ((Renderer)__instance.DamageFX_LargeMustardBurst.GetComponent()).material.SetColor("_Color", val); ((Renderer)__instance.DamageFX_MustardSpoutSmall.GetComponent()).material.SetColor("_Color", val); ((Renderer)__instance.DamageFX_MustardSpoutLarge.GetComponent()).material.SetColor("_Color", val); ((Renderer)__instance.DamageFX_Explosion.GetComponent()).material.SetColor("_Color", val); } } [HarmonyPatch(typeof(SosigWeapon), "TryToFireGun", new Type[] { typeof(Vector3), typeof(bool), typeof(bool), typeof(bool), typeof(float), typeof(bool) })] [HarmonyPrefix] private static bool SosigWeapon_TryToFireGun_prefix1(SosigWeapon __instance, Vector3 targetPos, bool isPanicFiring, bool targetPointIdentified, bool isClutching, float recoilMult, bool isHipfiring) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) if (!em_wpn_mod.Value) { return true; } __instance.ForcedRefireMin = 0f; if ((int)__instance.UsageState != 0) { return false; } if (__instance.m_refireTick > 0f) { if (__instance.isFullAuto) { __instance.m_refireTick -= Time.deltaTime * 1.1f; return false; } __instance.m_refireTick -= Time.deltaTime; return false; } if (!targetPointIdentified && !isPanicFiring) { return false; } Vector3 val = targetPos - __instance.Muzzle.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > __instance.RangeMinMax.y && !isPanicFiring) { return false; } float num = __instance.GetCurrentAngularLimit(magnitude); if (isHipfiring) { num *= 4f; } float num2 = Vector3.Angle(Vector3.ProjectOnPlane(val, Vector3.up), Vector3.ProjectOnPlane(__instance.Muzzle.forward, Vector3.up)); float num3 = Vector3.Angle(Vector3.ProjectOnPlane(val, ((Component)__instance).transform.right), Vector3.ProjectOnPlane(__instance.Muzzle.forward, ((Component)__instance).transform.right)); float num4 = 0.5f; if (__instance.UsesBurstLimit && __instance.m_shotsLeftTilBurstLimit < 2) { num4 = 5f; } if (magnitude < 4f) { num4 = 5f; } if (magnitude < 2f) { num4 = 10f; } if (magnitude < 1f) { num4 = num; } bool flag = false; if (__instance.isFullAuto) { if (isClutching && (__instance.timeSinceFired < 0.01f || isPanicFiring)) { flag = true; } } else if (isClutching && (__instance.timeSinceFired < 0.1f || isPanicFiring)) { flag = true; } if ((num2 > num || num3 > Mathf.Min(num, num4)) && !isPanicFiring && !flag) { return false; } if (!isPanicFiring && !flag && !__instance.GetFireClear(__instance.Muzzle.position, __instance.Muzzle.forward, __instance.RangeMinMax.y, magnitude)) { return false; } __instance.FireGun(recoilMult); return false; } [HarmonyPatch(typeof(SosigWeapon), "UpdateRecoil")] [HarmonyPostfix] private static void SosigWeapon_UpdateRecoil_postfix(SosigWeapon __instance) { //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) if (!em_wpn_mod.Value) { return; } bool flag = false; bool flag2 = false; float num = 1f * ((em_acc_mult.Value + 2f) / 3f); if ((Object)(object)__instance.RecoilP != (Object)null) { if (__instance.m_recoilX > 0f) { __instance.m_recoilX = Mathf.MoveTowards(__instance.m_recoilX, 0f, Time.deltaTime * __instance.RecoilP.RecoilPerShot.y * 4f * __instance.RecoilP.RecoilRecoveryMults.x * num); flag = true; } if (fabs(__instance.m_recoilY) > 0f) { __instance.m_recoilY = Mathf.MoveTowards(__instance.m_recoilY, 0f, Time.deltaTime * __instance.RecoilP.RecoilPerShot.y * 3f * 0.5f * __instance.RecoilP.RecoilRecoveryMults.y * num); flag = true; } if (__instance.m_recoilLinear > 0f) { __instance.m_recoilLinear = Mathf.MoveTowards(__instance.m_recoilLinear, 0f, Time.deltaTime * __instance.RecoilP.RecoilPerShot.w * 1f * __instance.RecoilP.RecoilRecoveryMults.z * num); flag2 = true; } } if (flag2) { __instance.RecoilHolder.localPosition = new Vector3(0f, 0f, __instance.m_recoilLinear); } if (flag) { if (__instance.isFullAuto) { __instance.RecoilHolder.localEulerAngles = new Vector3(__instance.m_recoilX / (2f * em_acc_mult.Value), __instance.m_recoilY / (1.5f * em_acc_mult.Value), 0f); } else { __instance.RecoilHolder.localEulerAngles = new Vector3(__instance.m_recoilX / em_acc_mult.Value, __instance.m_recoilY / em_acc_mult.Value, 0f); } } } [HarmonyPatch(typeof(SosigWeapon), "Recoil")] [HarmonyPrefix] private static bool SosigWeapon_Recoil_prefix(SosigWeapon __instance, float recoilMult) { //IL_012a: 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_0175: Unknown result type (might be due to invalid IL or missing references) if (!em_wpn_mod.Value) { return true; } if ((Object)(object)__instance.RecoilP != (Object)null) { __instance.m_recoilX += __instance.RecoilP.RecoilPerShot.x * recoilMult; __instance.m_recoilY += Random.Range(__instance.RecoilP.RecoilPerShot.x * 0.5f, (0f - __instance.RecoilP.RecoilPerShot.x) * 0.5f) * recoilMult; __instance.m_recoilLinear += __instance.RecoilP.RecoilPerShot.z; __instance.m_recoilX = Mathf.Clamp(__instance.m_recoilX, 0f, __instance.RecoilP.RecoilPerShot.y); __instance.m_recoilY = Mathf.Clamp(__instance.m_recoilY, 0f, __instance.RecoilP.RecoilPerShot.y * 0.5f); __instance.m_recoilLinear = Mathf.Clamp(__instance.m_recoilLinear, 0f, __instance.RecoilP.RecoilPerShot.w); } __instance.RecoilHolder.localPosition = new Vector3(0f, 0f, __instance.m_recoilLinear); if (__instance.isFullAuto) { __instance.RecoilHolder.localEulerAngles = new Vector3(__instance.m_recoilX / (2f * em_acc_mult.Value), __instance.m_recoilY / (1.5f * em_acc_mult.Value), 0f); return false; } __instance.RecoilHolder.localEulerAngles = new Vector3(__instance.m_recoilX, __instance.m_recoilY, 0f); return false; } [HarmonyPatch(typeof(SosigWeapon), "FireGun")] [HarmonyPrefix] private static bool SosigWeapon_FireGun_prefix(SosigWeapon __instance, float recoilMult) { //IL_0031: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0505: 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_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_05f2: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) if (!em_wpn_mod.Value) { return true; } float num = (em_acc_mult.Value + 1f) / 2f; if (__instance.m_shotsLeft <= 0) { return false; } if ((int)__instance.MechaState != 0) { return false; } if (__instance.IsHeldByBot) { __instance.SosigHoldingThis.GetEntity().ProcessLoudness(__instance.ShotLoudness); } if ((Object)(object)__instance.Muzzle == (Object)null) { return false; } __instance.timeSinceFired = 0f; if (__instance.UsesSustainedSound) { if (__instance.m_sustainEnergy <= 0f) { SM.PlayCoreSound((FVRPooledAudioType)10, __instance.AudEvent_SustainedEmit, ((Component)__instance).transform.position); } if (!__instance.AudSource_SustainedLoop.isPlaying) { __instance.AudSource_SustainedLoop.Play(); } __instance.m_sustainEnergy = __instance.SustainEnergyPerShot; } for (int i = 0; i < __instance.ProjectilesPerShot; i++) { Vector3 val = __instance.Muzzle.position; if (__instance.HasMuzzleOffsetSet) { Vector3 val2 = __instance.MuzzleOffsetSets[__instance.m_muzzleOffsetIndex]; val += ((Component)__instance).transform.right * val2.x + ((Component)__instance).transform.up * val2.y + ((Component)__instance).transform.forward * val2.z; __instance.m_muzzleOffsetIndex++; if (__instance.m_muzzleOffsetIndex >= __instance.MuzzleOffsetSets.Count) { __instance.m_muzzleOffsetIndex = 0; } } GameObject val3 = Object.Instantiate(__instance.Projectile, val, __instance.Muzzle.rotation); float num2 = __instance.ProjectileSpread; if (num2 < 0.25f) { num2 = (__instance.ProjectileSpread + 0.25f) / 2f; } num2 /= num; float num3 = 1f; if (__instance.isFullAuto) { num3 = 3f / num * (__instance.m_recoilLinear / Mathf.Clamp(__instance.RecoilP.RecoilPerShot.w, Mathf.Epsilon, 10f)); num3 = Mathf.Clamp(num3, 0.8f, 3f); } else { num3 = 1f / num * (__instance.m_recoilLinear / Mathf.Clamp(__instance.RecoilP.RecoilPerShot.w, Mathf.Epsilon, 10f)); num3 = Mathf.Clamp(num3, 1f, 2f); } if (num2 < 0.5f) { num2 = (num2 + 0.5f) / 2f; } else if (num2 > 1.5f) { num2 = (num2 + num2 + 1.5f) / 3f; } if (!__instance.IsHeldByBot) { num2 /= 2f; } val3.transform.Rotate(new Vector3(Random.Range((0f - num2) * num3, num2 * num3), Random.Range((0f - num2) * num3, num2 * num3), 0f)); BallisticProjectile component = val3.GetComponent(); component.FlightVelocityMultiplier *= __instance.FlightVelocityMultiplier; float num4 = component.MuzzleVelocityBase; if (__instance.IsHeldByBot && __instance.SosigHoldingThis.isDamPowerUp) { num4 *= __instance.SosigHoldingThis.BuffIntensity_DamPowerUpDown; } __instance.m_projRealSpeed = component.MuzzleVelocityBase * component.FlightVelocityMultiplier; if (__instance.IsHeldByBot) { component.SetSource_IFF(__instance.SosigHoldingThis.GetIFF()); } else if (((FVRInteractiveObject)__instance.O).IsHeld) { component.SetSource_IFF(GM.CurrentPlayerBody.GetPlayerIFF()); } component.Fire(num4, val3.transform.forward, (FVRFireArm)null, true); GM.CurrentSceneSettings.OnSosiggunFired(__instance); } __instance.Recoil(recoilMult); if ((Object)(object)__instance.GunShotProfile != (Object)null) { float soundTravelDistanceMultByEnvironment = SM.GetSoundTravelDistanceMultByEnvironment(__instance.PlayShotEvent(__instance.Muzzle.position)); if (__instance.IsHeldByBot) { GM.CurrentSceneSettings.OnPerceiveableSound(__instance.ShotLoudness, __instance.ShotLoudness * soundTravelDistanceMultByEnvironment, ((Component)__instance).transform.position, __instance.SosigHoldingThis.GetIFF(), __instance.SosigHoldingThis.E); } else if (((FVRInteractiveObject)__instance.O).IsHeld) { GM.CurrentSceneSettings.OnPerceiveableSound(__instance.ShotLoudness, __instance.ShotLoudness * soundTravelDistanceMultByEnvironment, ((Component)__instance).transform.position, GM.CurrentPlayerBody.GetPlayerIFF(), GM.CurrentPlayerBody.PlayerEntities[0]); } } if (__instance.UsesMuzzleFire && (!__instance.UsesMuzzleFireOnlyClose || Vector3.Distance(((Component)__instance).transform.position, GM.CurrentPlayerBody.Head.position) < 25f)) { for (int j = 0; j < __instance.PSystemsMuzzle.Length; j++) { __instance.PSystemsMuzzle[j].Emit(__instance.MuzzlePAmount); } } if (__instance.DoesFlashOnFire) { if (__instance.IsHeldByBot) { __instance.SosigHoldingThis.VisibleEvent(2f); } else if (((FVRInteractiveObject)__instance.O).IsHeld) { GM.CurrentPlayerBody.VisibleEvent(2f); } FXM.InitiateMuzzleFlash(__instance.Muzzle.position, __instance.Muzzle.forward, 0.65f, __instance.FlashOnFireColor, 1f); } else if (__instance.IsHeldByBot) { __instance.SosigHoldingThis.VisibleEvent(0.1f); } else if (((FVRInteractiveObject)__instance.O).IsHeld) { GM.CurrentPlayerBody.VisibleEvent(0.1f); } if (__instance.IsHeldByBot) { if (!__instance.SosigHoldingThis.IsInfiniteAmmo) { if (__instance.SosigHoldingThis.IsAmmoDrain) { __instance.m_shotsLeft = 0; } else { __instance.m_shotsLeft--; } } } else if (!GM.CurrentPlayerBody.IsInfiniteAmmo) { if (GM.CurrentPlayerBody.IsAmmoDrain) { __instance.m_shotsLeft = 0; } else { __instance.m_shotsLeft--; } } __instance.GenerateOrEnableCrankIfNeeded(); __instance.m_shotsSoFarThisCycle++; if (__instance.m_shotsSoFarThisCycle >= __instance.ShotsPerCycle) { if (__instance.DelayAfterFiring > 0f) { __instance.MechaState = (SosigWeaponMechaState)1; __instance.m_cycleDelay = __instance.DelayAfterFiring; } else { __instance.MechaState = (SosigWeaponMechaState)2; } __instance.m_cycleLerp = 0f; __instance.m_shotsSoFarThisCycle = 0; } if (__instance.UsesBurstLimit) { __instance.m_shotsLeftTilBurstLimit--; } __instance.m_refireTick = Mathf.Max(Random.Range(__instance.Usage_RefireRange.x, __instance.Usage_RefireRange.y), __instance.ForcedRefireMin); if (__instance.m_shotsLeftTilBurstLimit <= 0) { __instance.m_shotsLeftTilBurstLimit = Random.Range(__instance.BurstLimit, __instance.BurstLimit + 1 + __instance.BurstLimitRange); __instance.m_refireTick += Random.Range(__instance.BurstDelayRange.x, __instance.BurstDelayRange.y); } return true; } [HarmonyPatch(typeof(Sosig), "ShouldIPickANewSkirmishPoint")] [HarmonyPrefix] private static bool Sosig_ShouldIPickANewSkirmishPoint_Prefix(Sosig __instance, bool hasAGun, bool isReloading) { //IL_0098: 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) if (hasAGun || !__instance.DoIHaveAWeaponInMyHand()) { __instance.m_tickDownToPickNewSkirmishPoint -= Time.deltaTime; if (__instance.m_tickDownToPickNewSkirmishPoint <= 0f) { if (GM.CurrentAIManager.HasCPM) { __instance.m_tickDownToPickNewSkirmishPoint = 0.1f; } else { __instance.m_tickDownToPickNewSkirmishPoint = Random.Range(0.2f, 1f) * em_move_mod_amt.Value; } if (!__instance.AmIReloading()) { if ((Object)(object)__instance.m_curCoverPoint != (Object)null && __instance.m_suppressionLevel > 0.5f) { return false; } __instance.m_skirmishPoint = __instance.GetNewRandomSkirmishPoint(((Component)__instance.Agent).transform.position); } } return false; } return true; } [HarmonyPatch(typeof(Sosig), "BodyUpdate")] [HarmonyPostfix] private static void Sosig_BodyUpdate_Postfix(Sosig __instance) { __instance.m_stunTimeLeft += Time.deltaTime; __instance.m_confusedTime += Time.deltaTime; __instance.m_unconsciousTime += Time.deltaTime; __instance.m_stunTimeLeft -= Time.deltaTime * em_stagger_mod.Value; __instance.m_confusedTime -= Time.deltaTime * em_stagger_mod.Value; __instance.m_unconsciousTime -= Time.deltaTime * em_stagger_mod.Value; } [HarmonyPatch(typeof(Sosig), "SuppresionUpdate")] [HarmonyPostfix] private static void Sosig_SuppresionUpdate_Postfix(Sosig __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Invalid comparison between Unknown and I4 if (__instance.m_suppressionLevel > 0f && (int)__instance.BodyState == 0) { __instance.m_suppressionLevel += Time.deltaTime * 0.25f; __instance.m_suppressionLevel -= Time.deltaTime * 0.25f * em_suppress_mod.Value; } if (__instance.m_suppressionLevel > 0f && (int)__instance.BodyState == 1) { __instance.m_suppressionLevel += Time.deltaTime; __instance.m_suppressionLevel -= Time.deltaTime * em_suppress_mod.Value; } } [HarmonyPatch(typeof(SosigTargetPrioritySystem), "GetPredictiveTargetPoint")] [HarmonyPrefix] private static void SosigTargetPrioritySystem_GetPredictiveTargetPoint_prefix(SosigTargetPrioritySystem __instance, float speed, float maxPredict) { //IL_000e: 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_0047: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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 (em_aim_mod.Value) { float num = Vector3.Distance(__instance.GetTargetPoint(), __instance.E.SensoryFrame.position); speed = Mathf.Max(speed, 1E-05f); float num2 = num / speed * 1.8f; num2 = Mathf.Min(num2, maxPredict); Vector3 targetPoint = __instance.m_targetPoint + __instance.m_targetVel * num2; if (__instance.RecentEvents.Count != 0 && __instance.RecentEvents.ToArray().Length != 0 && (Object)(object)__instance.RecentEvents[0].Entity != (Object)null && __instance.RecentEvents[0].Entity.IFFCode == GM.CurrentPlayerBody.GetPlayerIFF()) { targetPoint = GM.CurrentPlayerBody.Torso.position; targetPoint.y -= Random.Range(0.1f, 0.4f); } __instance.m_targetPoint = targetPoint; } } [HarmonyPatch(typeof(FVRPlayerHitbox), "UpdatePositions")] [HarmonyPostfix] private static void FVRPlayerHitbox_UpdatePositions_postfix(FVRPlayerHitbox __instance) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (pl_in_dmg_mult_changed || Time.frameCount % 10 == 0) { if ((int)__instance.Type == 0) { __instance.DamageMultiplier = pl_in_dmg_mult.Value * 1.5f; } else { __instance.DamageMultiplier = pl_in_dmg_mult.Value; } pl_in_dmg_mult_changed = false; } } [HarmonyPatch(typeof(FVRPlayerHitbox), "Damage", new Type[] { typeof(Damage) })] [HarmonyPrefix] private static bool FVRPlayerHitbox_Damage_prefix(FVRPlayerHitbox __instance, Damage d) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 //IL_001a: 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_0031: Unknown result type (might be due to invalid IL or missing references) if (flash_mod.Value && d.Dam_Blinding > 0f && (int)__instance.Type == 0 && Vector3.Angle(d.strikeDir, GM.CurrentPlayerBody.Head.forward) > 90f) { GM.CurrentPlayerBody.BlindPlayer(d.Dam_Blinding); if (flash_mod.Value) { __instance.Body.PSystemBlind.Emit(10); } } if ((int)d.Class == 2) { d.Dam_TotalKinetic *= 0.5f * pl_in_dmg_mult.Value; return true; } return true; } [HarmonyPatch(typeof(GrenadeExplosion), "Awake")] [HarmonyPostfix] private static void GrenadeExplosion_Awake_postfix(GrenadeExplosion __instance) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) if (!(fabs(expl_mod.Value) < 0.01f)) { __instance.ExplosionRadius *= fabs(expl_mod.Value); __instance.ForceRadius *= fabs(expl_mod.Value); if (__instance.Curve_Dam.length == 3 && __instance.MaxDam < 2000f) { __instance.MaxDam = (__instance.MaxDam + 2000f) / 2f; } if (__instance.Curve_Dam.length == 3) { Keyframe val = __instance.Curve_Dam[1]; ((Keyframe)(ref val)).time = ((Keyframe)(ref val)).time + 1f * fabs(expl_mod.Value); Keyframe val2 = __instance.Curve_Dam[2]; ((Keyframe)(ref val2)).time = ((Keyframe)(ref val2)).time + 1f * fabs(expl_mod.Value); Keyframe val3 = __instance.Curve_Dam[2]; ((Keyframe)(ref val2)).time = ((Keyframe)(ref val3)).time * fabs(expl_mod.Value); __instance.Curve_Dam.RemoveKey(2); __instance.Curve_Dam.RemoveKey(1); __instance.Curve_Dam.AddKey(val); __instance.Curve_Dam.AddKey(val2); } } } [HarmonyPatch(typeof(Explosion), "Awake")] [HarmonyPostfix] private static void Explosion_Awake_postfix(Explosion __instance) { //IL_0050: 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_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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) if (!(fabs(expl_mod.Value) < 0.01f)) { __instance.ExplosionRadius *= fabs(expl_mod.Value); if (((Component)__instance).GetComponent().DamageCurve.length == 3) { Keyframe val = __instance.DamageCurve[1]; ((Keyframe)(ref val)).time = ((Keyframe)(ref val)).time + 1f * fabs(expl_mod.Value); Keyframe val2 = __instance.DamageCurve[2]; ((Keyframe)(ref val2)).time = ((Keyframe)(ref val2)).time + 1f * fabs(expl_mod.Value); Keyframe val3 = __instance.DamageCurve[2]; ((Keyframe)(ref val2)).time = ((Keyframe)(ref val3)).time * fabs(expl_mod.Value); __instance.DamageCurve.RemoveKey(2); __instance.DamageCurve.RemoveKey(1); __instance.DamageCurve.AddKey(val); __instance.DamageCurve.AddKey(val2); } } } [HarmonyPatch(typeof(BallisticProjectile), "FixedUpdate")] [HarmonyPostfix] private static void BallisticProjectile_FixedUpdate_postfix(BallisticProjectile __instance) { if (!tracer_spin.Value || !__instance.IsMoving() || (__instance.Source_IFF != GM.CurrentPlayerBody.m_playerIFF && half_frame)) { return; } float deltaTime = Time.deltaTime; if (!__instance.m_hasTracer) { return; } __instance.tracer.Rotate(0f, 0f, 30f + Random.value * 2f + (((Vector3)(ref __instance.m_velocity)).magnitude / 50f + 1f) * deltaTime); if (!(Random.value < 0.2f)) { return; } Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)null) { componentsInChildren[i].shadowCastingMode = (ShadowCastingMode)0; } } } [HarmonyPatch(typeof(BoltActionRifle_Handle), "Awake")] [HarmonyPostfix] private static void BoltActionRifle_Handle_Awake_postfix(BoltActionRifle_Handle __instance) { if (quickbolt_all.Value) { __instance.UsesQuickRelease = true; } } [HarmonyPatch(typeof(FVRFireArm), "Awake")] [HarmonyPostfix] private static void FVRFireArm_Awake_postfix(FVRFireArm __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) if (fix_grip_pos.Value) { Vector3 localPosition = ((FVRInteractiveObject)__instance).PoseOverride.localPosition; if (((Object)__instance).name.Contains("Evo3") || ((Object)__instance).name.Contains("Automag") || ((Object)__instance).name.Contains("MP5k") || ((Object)__instance).name.Contains("SP5k")) { localPosition.y += 0.03f; localPosition.z += 0.05f; } if (((Object)__instance).name.Contains("SACM1935")) { localPosition.y += 0.03f; localPosition.z += 0.07f; } ((FVRInteractiveObject)__instance).PoseOverride.localPosition = localPosition; } } [HarmonyPatch(typeof(FVRFireArm), "Recoil")] [HarmonyPostfix] private static void FVRFireArm_Recoil_postfix(FVRFireArm __instance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((FVRPhysicalObject)__instance).Bipod != (Object)null && ((FVRPhysicalObject)__instance).Bipod.IsBipodActive) { __instance.m_recoilX /= 5f; __instance.m_recoilY /= 4f; __instance.m_recoilLinearXY /= 7f; } } [HarmonyPatch(typeof(FVRMovementManager), "HandUpdateTeleport")] [HarmonyPostfix] private static void FVRMovementManager_HandUpdateTeleport_postfix(FVRMovementManager __instance, FVRViveHand hand) { //IL_0072: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) if (!short_teleport.Value || hand.IsInStreamlinedMode) { return; } if (hand.Input.Secondary2AxisNorthUp) { if (short_teleport_amt.Value > 1f) { short_teleport_amt.Value = 1f; } if (short_teleport_amt.Value < 0.01f) { short_teleport_amt.Value = 0.01f; } _ = ((Component)GM.CurrentPlayerBody).transform.position; Vector3 position = ((Component)GM.CurrentPlayerBody).transform.position; position = ((Component)GM.CurrentPlayerBody).transform.position + GM.CurrentPlayerBody.Head.forward * short_teleport_amt.Value; position.y = ((Component)GM.CurrentPlayerBody).transform.position.y; ((Component)GM.CurrentPlayerBody).transform.position = position; } else if (hand.Input.Secondary2AxisSouthUp) { if (short_teleport_amt.Value > 1f) { short_teleport_amt.Value = 1f; } if (short_teleport_amt.Value < 0.01f) { short_teleport_amt.Value = 0.01f; } _ = ((Component)GM.CurrentPlayerBody).transform.position; Vector3 position2 = ((Component)GM.CurrentPlayerBody).transform.position; position2 = ((Component)GM.CurrentPlayerBody).transform.position - GM.CurrentPlayerBody.Head.forward * short_teleport_amt.Value; position2.y = ((Component)GM.CurrentPlayerBody).transform.position.y; ((Component)GM.CurrentPlayerBody).transform.position = position2; } } [HarmonyPatch(typeof(Sosig), "Init")] [HarmonyPostfix] private static void Sosig_Init_postfix(Sosig __instance) { if (!em_wpn_mod.Value) { return; } em_states.Add(new em_mod(__instance, em_states.Count)); for (int i = 0; i < em_states.Count; i++) { if ((Object)(object)em_states[i].obj == (Object)null) { em_states.RemoveAt(i); } } } [HarmonyPatch(typeof(Sosig), "HandUpdate_AttackTarget")] [HarmonyPrefix] private static bool Sosig_HandUpdate_AttackTarget_prefix(Sosig __instance) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Invalid comparison between Unknown and I4 //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_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Invalid comparison between Unknown and I4 //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) if (!em_wpn_mod.Value) { return true; } if (__instance.m_isUnconscious) { return false; } Vector3 val = __instance.Priority.GetTargetPoint(); if (__instance.m_isBlinded) { val += Random.onUnitSphere * Random.Range(1f, 5f) * Time.deltaTime; } if (__instance.Priority.HasFreshTarget()) { for (int i = 0; i < __instance.Hands.Count; i++) { __instance.Hands[i].SetAimTowardPoint(val); } } else { for (int j = 0; j < __instance.Hands.Count; j++) { __instance.Hands[j].ClearAimPoint(); } } bool flag = false; if (__instance.DoIHaveAShieldInMyHand()) { flag = true; } Vector3 velocity = __instance.Agent.velocity; if (((Vector3)(ref velocity)).magnitude > __instance.HipFiringVelocityThreshold || flag) { for (int k = 0; k < __instance.Hands.Count; k++) { __instance.Hands[k].SetHandPose((SosigHandPose)1); } } else { for (int l = 0; l < __instance.Hands.Count; l++) { __instance.Hands[l].SetHandPose((SosigHandPose)2); } } for (int m = 0; m < __instance.Hands.Count; m++) { if (!__instance.Hands[m].IsHoldingObject) { continue; } if ((int)__instance.Hands[m].HeldObject.Type == 0) { if ((int)__instance.Hands[m].HeldObject.UsageState == 1) { __instance.Hands[m].SetHandPose((SosigHandPose)0); } float num = __instance.Priority.GetTimeTargetSeen() * __instance.m_combatTargetIdentificationSpeedMultiplier; float num2 = Vector3.Distance(val, ((Component)__instance).transform.position); float num3 = ((!(num2 < 50f)) ? Mathf.Lerp(1f, 6f, num2 / 300f) : Mathf.Lerp(0f, 3f, num2 / 500f)); float num4 = Mathf.Lerp(1f, 2f, __instance.m_suppressionLevel); bool flag2 = false; if (num >= num3 * num4) { flag2 = true; } float num5 = 1f; bool flag3 = false; if ((int)__instance.Hands[m].Pose == 1) { num5 += 0.8f; flag3 = true; } num5 += num4; bool flag4 = false; if (__instance.m_suppressionLevel > 0.7f) { flag4 = true; } val = __instance.Priority.GetPredictiveTargetPoint(__instance.Hands[m].HeldObject.GetRealProjSpeed(), 5f); float num6 = Mathf.Lerp(1f, 10f, num2 / 300f); float num7 = Mathf.Lerp(0.1f, 0.5f, num2 / 300f); __instance.m_aimWanderTick -= Time.deltaTime; if (__instance.m_aimWanderTick <= 0f) { __instance.m_aimWanderTick = 0.15f; __instance.m_aimWanderRandom = Random.onUnitSphere * Random.Range(num7, num6); } __instance.m_aimWander = Vector3.SmoothDamp(__instance.m_aimWander, __instance.m_aimWanderRandom, ref __instance.m_aimWanderVel, 0.15f); float num8 = 0.2f; FVRPhysicalObject o = __instance.Hands[m].HeldObject.O; if (((SosigWeaponPlayerInterface)((o is SosigWeaponPlayerInterface) ? o : null)).HasActiveShoulderStock) { num8 = 0f; } float num9 = Mathf.Lerp(1f, 0f, num * 0.1f); float num10 = 0f; if (flag3) { num10 = 0.6f; } float num11 = Mathf.Lerp(0f, 0.8f, __instance.m_suppressionLevel); float num12 = Mathf.Max(new float[4] { num9, num10, num11, num8 }); val += __instance.m_aimWander * num12; __instance.Hands[m].SetAimTowardPoint(val); if (__instance.Hands[m].HeldObject.isFullAuto && (!__instance.IsPanicFiring() || !flag4)) { for (int n = 0; n < em_states.Count; n++) { if (((Object)__instance).GetInstanceID() != em_states[n].id) { continue; } em_mod value = em_states[n]; if (value.t_fire > 0f) { if (value.t_burst > 0f) { value.t_fire2 += Time.deltaTime; val.y -= Mathf.Clamp(value.t_fire2 * 2f * (em_acc_mult.Value / 5f), 0f, 10f); __instance.Hands[m].SetAimTowardPoint(val); __instance.Hands[m].HeldObject.TryToFireGun(val, true, flag2, true, num5, flag3); value.t_burst -= Time.deltaTime; } if (value.t_burst < 0f) { value.t_fire2 = 0f; value.t_burst = 0f; } value.t_fire -= Time.deltaTime; } else { value.t_burst = Random.Range(0.2f, 0.5f); value.t_fire = Random.Range(0.6f, 1.6f); value.t_fire2 = 0f; } em_states[n] = value; } } else { __instance.Hands[m].HeldObject.TryToFireGun(val, __instance.IsPanicFiring(), flag2, flag4, num5, flag3); } continue; } return true; } return false; } [HarmonyPatch(typeof(Sosig), "SosigDies")] [HarmonyPrefix] private static void Sosig_SosigDies_prefix(Sosig __instance) { if (!em_wpn_mod.Value) { return; } for (int i = 0; i < em_states.Count; i++) { if ((Object)(object)em_states[i].obj != (Object)null && ((Object)__instance).GetInstanceID() == em_states[i].id) { em_states.RemoveAt(i); } } } [HarmonyPatch(typeof(SosigWeapon), "Update")] [HarmonyPostfix] private static void SosigWeapon_Update_postfix(SosigWeapon __instance) { //IL_0016: 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_0033: Unknown result type (might be due to invalid IL or missing references) if (!em_wpn_coll_mod.Value || !half_frame || (int)__instance.Type != 0) { return; } float num = Vector3.Distance(((Component)__instance).transform.position, ((Component)GM.CurrentPlayerBody).transform.position); if (!(Random.value < 0.5f)) { return; } Collider[] componentsInChildren = ((Component)__instance).GetComponentsInChildren(); if (componentsInChildren.Length == 0) { return; } for (int i = 0; i < componentsInChildren.Length; i++) { if (!((Object)(object)componentsInChildren[i] != (Object)null) || (!((Object)componentsInChildren[i]).name.StartsWith("Cube") && !((Object)componentsInChildren[i]).name.StartsWith("cube"))) { continue; } if (__instance.IsHeldByBot || ((FVRInteractiveObject)__instance.O).IsHeld) { if (num > 2f) { componentsInChildren[i].enabled = false; } else { componentsInChildren[i].enabled = true; } } else { componentsInChildren[i].enabled = true; } } } [HarmonyPatch(typeof(SosigWeapon), "BotDrop")] [HarmonyPostfix] private static void SosigWeapon_BotDrop_postfix(SosigWeapon __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (em_wpn_coll_mod.Value) { Rigidbody componentInChildren = ((Component)__instance).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Vector3 val = Random.onUnitSphere * 15f; val.y = fabs(val.y); val.y *= Random.Range(2f, 5f); componentInChildren.AddForce(val, (ForceMode)0); componentInChildren.AddTorque(Random.insideUnitSphere * 1f, (ForceMode)0); } } } [HarmonyPatch(typeof(CartridgeBox), "ConfigureShapeForRoundType")] [HarmonyPostfix] private static void CartridgeBox_ConfigureShapeForRoundType_postfix(CartridgeBox __instance, FireArmRoundType rt, FireArmRoundClass rc) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!metric_box_txt.Value) { return; } FVRFireArmRoundDisplayData val = ((!((Object)(object)__instance.ddd != (Object)null)) ? AM.SRoundDisplayDataDic[rt] : __instance.ddd); DisplayDataClass val2 = ((!((Object)(object)__instance.ddd != (Object)null)) ? AM.STypeDic[rt][rc] : __instance.ddd.Classes[__instance.DebugDCIndex]); FVRFireArmRound component = ((AnvilAsset)val2.ObjectID).GetGameObject().GetComponent(); string text = val.DisplayName + "\n" + val2.Name + "\n"; if ((Object)(object)component != (Object)null && (Object)(object)component.BallisticProjectilePrefab != (Object)null) { BallisticProjectile component2 = component.BallisticProjectilePrefab.GetComponent(); if ((Object)(object)component2 != (Object)null) { float num = 0.5f * component2.Mass * Mathf.Pow(component2.MuzzleVelocityBase, 2f) / component2.FrontArea * 0.01f / 140f; _ = string.Empty; if (num > 1000f) { text = val.DisplayName + " '\n" + val2.Name + "\n"; } if (num > 2000f) { text = val.DisplayName + " ''\n" + val2.Name + "\n"; } if (num > 3000f) { text = val.DisplayName + " '''\n" + val2.Name + "\n"; } string text2 = string.Empty; if (component.NumProjectiles > 1) { text2 = " x " + component.NumProjectiles; } string text3 = text; text = text3 + Mathf.RoundToInt(component2.MuzzleVelocityBase) + " m/s - " + component2.Mass * 1000f + " gms - " + Mathf.RoundToInt(0.5f * component2.Mass * component2.MuzzleVelocityBase * component2.MuzzleVelocityBase) + " J" + text2; if (val2.Name.ToLower().Contains("soft")) { text = "The use of exposed lead in projectiles is forbidden under the Hague conventions."; } } } __instance.TXT_Name.text = text; } [HarmonyPatch(typeof(FVRPlayerBody), "Start")] [HarmonyPostfix] private static void FVRPlayerBody_Start_postfix(FVRPlayerBody __instance) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (red_hit_fx.Value) { Color val = default(Color); ((Color)(ref val))..ctor(1f, 0f, 0f, 1f); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0f, 0f, 1f); MinMaxGradient startColor = default(MinMaxGradient); ((MinMaxGradient)(ref startColor))..ctor(val, val2); MainModule main = __instance.PSystemDamage.main; ((MainModule)(ref main)).startColor = startColor; MainModule main2 = __instance.PSystemDamageLight.main; ((MainModule)(ref main2)).startColor = startColor; if (flash_mod.Value) { MainModule main3 = __instance.PSystemBlind.main; ((MainModule)(ref main3)).duration = 10f; } } } [HarmonyPatch(typeof(FVRPlayerBody), "Update")] [HarmonyPostfix] private static void FVRPlayerBody_Update_postfix(FVRPlayerBody __instance) { if (!health_warn.Value) { return; } float deltaTime = Time.deltaTime; low_health_warning_timer += deltaTime; half_health_warn_tmr += deltaTime; quarter_health_warn_tmr += deltaTime; bool flag = false; if (__instance.GetPlayerHealth() < 0.1f && !flag) { if (low_health_warning_timer > 0.5f) { __instance.PSystemDamageLight.Emit(3); low_health_warning_timer = 0f; } flag = true; } if (__instance.GetPlayerHealth() < 0.2f && !flag) { if (low_health_warning_timer > 1f) { __instance.PSystemDamageLight.Emit(2); low_health_warning_timer = 0f; } flag = true; } if (__instance.GetPlayerHealth() < 0.3f && !flag) { if (low_health_warning_timer > 2f) { __instance.PSystemDamageLight.Emit(1); low_health_warning_timer = 0f; } flag = true; } if (__instance.GetPlayerHealth() < 0.5f && health_percent_prev >= 0.5f && half_health_warn_tmr > 1f) { __instance.PSystemBlind.Emit(1); half_health_warn_tmr = 0f; } if (__instance.GetPlayerHealth() < 0.25f && health_percent_prev >= 0.25f && quarter_health_warn_tmr > 1f) { __instance.PSystemBlind.Emit(1); quarter_health_warn_tmr = 0f; } health_percent_prev = __instance.GetPlayerHealth(); } [HarmonyPatch(typeof(KillAfter), "Start")] [HarmonyPostfix] private static void KillAfter_Start_postfix(KillAfter __instance) { if (!obj_sinking.Value || !((Object)__instance).name.StartsWith("Sosig_G")) { return; } Collider[] components = ((Component)__instance).gameObject.GetComponents(); if (components.Length != 0) { for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i], __instance.DieTime - Random.Range(0.1f, 1f)); } } } [HarmonyPatch(typeof(FVRFireArmRound), "FVRFixedUpdate")] [HarmonyPostfix] private static void FVRFireArmRound_FVRFixedUpdate_postfix(FVRFireArmRound __instance) { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected I4, but got Unknown if (!obj_sinking.Value || Random.value < 0.5f || !__instance.IsSpent) { return; } if (((FVRInteractiveObject)__instance).IsHeld && __instance.m_killAfter < 5f) { __instance.m_killAfter = 5f; } else { if (!__instance.m_isKillCounting) { return; } float num = 10f; SpentShellDespawnTime shellTime = GM.Options.SimulationOptions.ShellTime; switch ((int)shellTime) { case 0: num = 5f; break; case 1: num = 10f; break; case 2: num = 30f; break; case 3: num = 999999f; break; } if (GM.CurrentSceneSettings.ForcesCasingDespawn) { num = 5f; } Rigidbody[] componentsInParent = ((Component)__instance).GetComponentsInParent(); if (componentsInParent.Length == 0) { return; } Collider[] componentsInChildren = ((Component)componentsInParent[0]).GetComponentsInChildren(); if (componentsInChildren.Length != 0) { for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i], num - Random.Range(0.05f, 1f)); } } } } [HarmonyPatch(typeof(ReflexSightController), "Zero")] [HarmonyPostfix] private static void ReflexSightController_Zero_postfix(ReflexSightController __instance) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (!reduced_tint.Value) { return; } try { Logger.LogDebug((object)("ReflexSightController_Start_postfix " + ((Object)__instance).name + " " + ((Object)__instance).GetInstanceID() + "\t" + Time.frameCount)); } catch (Exception ex) { Logger.LogError((object)("ReflexSightController_Start_postfix '" + ex.Message + "'")); } if ((!((Object)(object)((FVRInteractiveObject)__instance).GameObject != (Object)null) || !((object)((FVRInteractiveObject)__instance).GameObject).ToString().ToLower().Contains("ham")) && (Object)(object)__instance != (Object)null && ((Behaviour)__instance).enabled) { __instance.reflexPropertyBlock.SetColor("_Tint", new Color(0.71f, 0.83f, 0.9f, 0.25f)); if ((Object)(object)__instance != (Object)null && ((Behaviour)__instance).enabled) { ((FVRInteractiveObject)__instance).FVRFixedUpdate(); } } } [HarmonyPatch(typeof(HandgunSlide), "UpdateSlide")] [HarmonyPostfix] private static void Handgun_UpdateSlide_postfix(HandgunSlide __instance) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (pistol_slide_tilt.Value && ((FVRInteractiveObject)__instance).IsHeld && !((Object)(object)((FVRInteractiveObject)__instance).m_hand == (Object)null) && (int)__instance.CurPos >= 4) { float num = 0f - Vector3.Dot(((Component)__instance).transform.position - ((Component)((FVRInteractiveObject)__instance).m_hand).transform.position, ((Component)__instance).transform.forward); if (num > 0f) { num = 0f; } ((Component)__instance.Handgun).transform.Rotate(new Vector3(-1f + num * 100f, 0f, 0f)); } } [HarmonyPatch(typeof(LaserLight), "UpdateActiveLaser")] [HarmonyPostfix] private static void LaserLight_UpdateActiveLaser_postfix(LaserLight __instance) { //IL_0086: 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_00ac: Unknown result type (might be due to invalid IL or missing references) las_vis.Value = fabs(las_vis.Value); __instance.lineBlock.SetFloat("_Intensity", __instance.lineBlock.GetFloat("_Intensity") * (las_vis.Value + 3f)); __instance.lineBlock.SetFloat("_IntensityClamp", __instance.lineBlock.GetFloat("_IntensityClamp") * (las_vis.Value + 2f)); Vector4 vector = __instance.lineBlock.GetVector("_LineSize"); vector.x *= las_vis.Value; __instance.lineBlock.SetVector("_LineSize", vector); ((Renderer)__instance.line).SetPropertyBlock(__instance.lineBlock); } } }