using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon.Math;
using Pigeon.Movement;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("EnhancedSettings")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0.11+cbab9723619afe7f2afbde0d59db454dfe491b33")]
[assembly: AssemblyProduct("EnhancedSettings")]
[assembly: AssemblyTitle("EnhancedSettings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[HarmonyPatch]
public static class AimFOVPatches
{
[HarmonyPatch(typeof(PlayerLook), "UpdateAiming")]
[HarmonyPrefix]
public static bool UpdateAimingPrefix(PlayerLook __instance)
{
try
{
if (!SparrohPlugin.aimFOVChange.Value && SparrohPlugin.isAimingPLField != null && SparrohPlugin.aimStateChangeTimeField != null && SparrohPlugin.aimDurationPLField != null && SparrohPlugin.aimFOVPLField != null && SparrohPlugin.defaultFOVGetter != null && SparrohPlugin.fovField != null)
{
if ((bool)SparrohPlugin.isAimingPLField.GetValue(__instance))
{
float num = (float)SparrohPlugin.aimStateChangeTimeField.GetValue(__instance);
num = Mathf.Min(num + Time.deltaTime / (float)SparrohPlugin.aimDurationPLField.GetValue(__instance), 1f);
SparrohPlugin.aimStateChangeTimeField.SetValue(__instance, num);
float num2 = (float)SparrohPlugin.defaultFOVGetter.Invoke(__instance, null);
SparrohPlugin.aimFOVPLField.SetValue(__instance, num2);
SparrohPlugin.fovField.SetValue(__instance, Mathf.LerpUnclamped(num2, num2, EaseFunctions.EaseInOutCubic(num)));
}
else if ((float)SparrohPlugin.aimStateChangeTimeField.GetValue(__instance) > 0f)
{
float num3 = (float)SparrohPlugin.aimStateChangeTimeField.GetValue(__instance);
num3 = Mathf.Max(num3 - Time.deltaTime / (float)SparrohPlugin.aimDurationPLField.GetValue(__instance), 0f);
SparrohPlugin.aimStateChangeTimeField.SetValue(__instance, num3);
float num4 = (float)SparrohPlugin.defaultFOVGetter.Invoke(__instance, null);
SparrohPlugin.aimFOVPLField.SetValue(__instance, num4);
SparrohPlugin.fovField.SetValue(__instance, Mathf.LerpUnclamped(num4, num4, EaseFunctions.EaseInOutCubic(num3)));
}
return false;
}
return true;
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogError((object)("Error in UpdateAimingPrefix: " + ex.Message));
return true;
}
}
[HarmonyPatch(typeof(PlayerLook), "UpdateCameraFOV")]
[HarmonyPostfix]
public static void UpdateCameraFOVPostfix(PlayerLook __instance)
{
try
{
if (!SparrohPlugin.aimFOVChange.Value && SparrohPlugin.isAimingPLField != null && SparrohPlugin.fovField != null && SparrohPlugin.defaultFOVGetter != null)
{
object value = SparrohPlugin.isAimingPLField.GetValue(__instance);
bool flag = default(bool);
int num;
if (value is bool)
{
flag = (bool)value;
num = 1;
}
else
{
num = 0;
}
if (((uint)num & (flag ? 1u : 0u)) != 0)
{
SparrohPlugin.fovField.SetValue(__instance, SparrohPlugin.defaultFOVGetter.Invoke(__instance, null));
}
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogError((object)("Error in UpdateCameraFOVPostfix: " + ex.Message));
}
}
}
public static class DataLogWaypointPatches
{
private static Dictionary<string, Transform> datalogPings = new Dictionary<string, Transform>();
private static FieldInfo logIDField;
public static void Initialize()
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
try
{
SceneManager.sceneLoaded += OnSceneLoaded;
logIDField = typeof(TextLogInteractable).GetField("logID", BindingFlags.Instance | BindingFlags.NonPublic);
MethodInfo method = typeof(PlayerData).GetMethod("OnDataLogOpened", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method2 = typeof(DataLogWaypointPatches).GetMethod("PlayerDataOnDataLogOpened_Postfix", BindingFlags.Static | BindingFlags.Public);
if (method != null && method2 != null)
{
new Harmony("sparroh.enhancedsettings").Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogError((object)("Error initializing DataLogWaypointPatches: " + ex.Message));
}
}
private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Expected O, but got Unknown
try
{
Harmony val = new Harmony("sparroh.enhancedsettings");
MethodInfo method = typeof(TextLogWindow).GetMethod("Setup", new Type[1] { typeof(string) });
MethodInfo method2 = typeof(ImageLogWindow).GetMethod("Setup", new Type[1] { typeof(string) });
MethodInfo method3 = typeof(DataLogWaypointPatches).GetMethod("TextLogWindowSetup_Postfix", BindingFlags.Static | BindingFlags.Public);
MethodInfo method4 = typeof(DataLogWaypointPatches).GetMethod("ImageLogWindowSetup_Postfix", BindingFlags.Static | BindingFlags.Public);
if (method != null && method2 != null && method3 != null && method4 != null)
{
val.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val.Patch((MethodBase)method2, (HarmonyMethod)null, new HarmonyMethod(method4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
if (!SparrohPlugin.dataLogWaypoints.Value)
{
return;
}
TextLogInteractable[] array = Object.FindObjectsOfType<TextLogInteractable>();
int num = 0;
TextLogInteractable[] array2 = array;
foreach (TextLogInteractable val2 in array2)
{
if (logIDField.GetValue(val2) is string text && PlayerData.Instance != null && PlayerData.Instance.discoveredDataLogs != null && !PlayerData.Instance.discoveredDataLogs.Contains(text))
{
Highlighter instance = Highlighter.Instance;
if (instance != null)
{
instance.AddWaypointPing(((Component)val2).transform);
}
datalogPings[text] = ((Component)val2).transform;
num++;
}
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogError((object)("Error in OnSceneLoaded: " + ex.Message));
}
}
public static void TextLogWindowSetup_Postfix(string id)
{
try
{
if (SparrohPlugin.dataLogWaypoints.Value && datalogPings.TryGetValue(id, out var value))
{
Highlighter instance = Highlighter.Instance;
if (instance != null)
{
instance.RemovePing(value);
}
datalogPings.Remove(id);
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogError((object)("Error in TextLogWindowSetup_Postfix: " + ex.Message));
}
}
public static void ImageLogWindowSetup_Postfix(string id)
{
try
{
if (SparrohPlugin.dataLogWaypoints.Value && datalogPings.TryGetValue(id, out var value))
{
Highlighter instance = Highlighter.Instance;
if (instance != null)
{
instance.RemovePing(value);
}
datalogPings.Remove(id);
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogError((object)("Error in ImageLogWindowSetup_Postfix: " + ex.Message));
}
}
public static void PlayerDataOnDataLogOpened_Postfix(string id)
{
try
{
if (SparrohPlugin.dataLogWaypoints.Value && datalogPings.TryGetValue(id, out var value))
{
Highlighter instance = Highlighter.Instance;
if (instance != null)
{
instance.RemovePing(value);
}
datalogPings.Remove(id);
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogError((object)("Error in PlayerDataOnDataLogOpened_Postfix: " + ex.Message));
}
}
}
internal static class DisableCountdown
{
internal static class DropPodFields
{
public static readonly FieldInfo LaunchCountdownTime = typeof(DropPod).GetField("launchCountdownTime", BindingFlags.Instance | BindingFlags.NonPublic);
}
[HarmonyPatch(typeof(DropPod), "StartCountdown_ClientRpc")]
[HarmonyPrefix]
private static void SkipDropPodLaunchCountdown(DropPod __instance)
{
try
{
if (SparrohPlugin.skipMissionCountdown.Value && DropPodFields.LaunchCountdownTime != null)
{
DropPodFields.LaunchCountdownTime.SetValue(__instance, 0f);
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogError((object)("Error in SkipDropPodLaunchCountdown: " + ex.Message));
}
}
}
internal static class IntroSkip
{
internal class IntroPatches
{
[HarmonyPatch(typeof(StartMenu), "Awake")]
[HarmonyPrefix]
private static bool SkipIntroPrefix(StartMenu __instance)
{
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
if (!SparrohPlugin.skipIntro.Value)
{
return true;
}
Traverse val = Traverse.Create(typeof(StartMenu));
if (!val.Field("hasInitialized").GetValue<bool>())
{
try
{
Traverse val2 = Traverse.Create((object)__instance);
val.Field("hasInitialized").SetValue((object)true);
Type type = AccessTools.TypeByName("GameManager");
if (type != null)
{
object value = val2.Field("settingsWindow").GetValue();
Window val3 = (Window)((value is Window) ? value : null);
if ((Object)(object)val3 != (Object)null)
{
Traverse.Create(type).Method("InitializeSettingRecursive", new Type[1] { typeof(Transform) }, (object[])null).GetValue(new object[1] { ((Component)val3).transform });
}
}
object value2 = val2.Field("initializeScreen").GetValue();
GameObject val4 = (GameObject)((value2 is GameObject) ? value2 : null);
if ((Object)(object)val4 != (Object)null)
{
val4.SetActive(false);
}
object value3 = val2.Field("startScreen").GetValue();
RectTransform val5 = (RectTransform)((value3 is RectTransform) ? value3 : null);
if ((Object)(object)val5 != (Object)null)
{
((Component)val5).gameObject.SetActive(true);
}
object value4 = val2.Field("bootingScreen").GetValue();
GameObject val6 = (GameObject)((value4 is GameObject) ? value4 : null);
if ((Object)(object)val6 != (Object)null)
{
val6.SetActive(false);
}
object value5 = val2.Field("splashScreen").GetValue();
GameObject val7 = (GameObject)((value5 is GameObject) ? value5 : null);
if ((Object)(object)val7 != (Object)null)
{
val7.SetActive(false);
}
object value6 = val2.Field("initializeBar").GetValue();
GameObject val8 = (GameObject)((value6 is GameObject) ? value6 : null);
if ((Object)(object)val8 != (Object)null)
{
val8.SetActive(false);
}
object value7 = val2.Field("logText").GetValue();
TextMeshProUGUI val9 = (TextMeshProUGUI)((value7 is TextMeshProUGUI) ? value7 : null);
if ((Object)(object)val9 != (Object)null)
{
((Component)val9).gameObject.SetActive(false);
}
object value8 = val2.Field("initializeStuff").GetValue();
GameObject val10 = (GameObject)((value8 is GameObject) ? value8 : null);
if ((Object)(object)val10 != (Object)null)
{
val10.SetActive(false);
}
object value9 = val2.Field("verifiedText").GetValue();
TextMeshProUGUI val11 = (TextMeshProUGUI)((value9 is TextMeshProUGUI) ? value9 : null);
if ((Object)(object)val11 != (Object)null)
{
((Component)val11).gameObject.SetActive(false);
}
object value10 = val2.Field("loadingBar").GetValue();
Image val12 = (Image)((value10 is Image) ? value10 : null);
if ((Object)(object)val12 != (Object)null)
{
((Component)val12).gameObject.SetActive(false);
}
object value11 = val2.Field("initializeWipe").GetValue();
RectTransform val13 = (RectTransform)((value11 is RectTransform) ? value11 : null);
if ((Object)(object)val13 != (Object)null)
{
val13.anchoredPosition = new Vector2(0f, -2160f);
}
object value12 = val2.Field("wipeChild").GetValue();
RectTransform val14 = (RectTransform)((value12 is RectTransform) ? value12 : null);
if ((Object)(object)val14 != (Object)null)
{
val14.anchoredPosition = new Vector2(0f, 2160f);
}
Type type2 = AccessTools.TypeByName("PlayerData");
if (type2 != null)
{
object value13 = Traverse.Create(type2).Field("Instance").GetValue();
if (value13 != null)
{
object value14 = Traverse.Create(value13).Property("ProfileConfig", (object[])null).GetValue();
if (value14 != null)
{
object value15 = Traverse.Create(value14).Property("CurrentProfile", (object[])null).GetValue();
if (value15 != null)
{
bool flag = (bool)Traverse.Create(value15).Method("IsValid", Array.Empty<object>()).GetValue();
int num = (int)Traverse.Create(value13).Method("GetFlag", new Type[1] { typeof(string) }, (object[])null).GetValue();
if (!flag && num == 0)
{
Traverse.Create(value13).Method("SetFlag", new Type[2]
{
typeof(string),
typeof(int)
}, (object[])null).GetValue(new object[2] { "autohub", 1 });
val2.Method("Host", Array.Empty<object>()).GetValue();
}
}
}
}
}
if ((Object)(object)val13 != (Object)null)
{
((Component)val13).gameObject.SetActive(false);
}
Type type3 = AccessTools.TypeByName("PlayerInput");
if (type3 != null)
{
Traverse.Create(type3).Method("UnlockCursor", Array.Empty<object>()).GetValue();
}
}
catch (Exception arg)
{
SparrohPlugin.Logger.LogError((object)$"Error in SkipIntroPrefix: {arg}");
}
}
return true;
}
[HarmonyPatch(typeof(StartMenu), "Awake")]
[HarmonyPostfix]
private static void SkipIntroPostfix(StartMenu __instance)
{
try
{
if (!SparrohPlugin.skipIntro.Value || !Traverse.Create(typeof(StartMenu)).Field("hasInitialized").GetValue<bool>())
{
return;
}
Traverse val = Traverse.Create((object)__instance);
if (val.Field("isMusicPlaying").GetValue<bool>())
{
return;
}
Type type = AccessTools.TypeByName("Global");
if (!(type != null))
{
return;
}
PropertyInfo property = type.GetProperty("AreAllBanksLoaded");
if (property != null && (bool)property.GetValue(null, null))
{
object value = val.Field("music").GetValue();
if (value != null && value.GetType().ToString().Contains("AK.Wwise.Event"))
{
Traverse.Create(value).Method("Post", new Type[1] { typeof(GameObject) }, (object[])null).GetValue(new object[1] { ((Component)__instance).gameObject });
val.Field("isMusicPlaying").SetValue((object)true);
}
}
}
catch (Exception arg)
{
SparrohPlugin.Logger.LogError((object)$"Error in SkipIntroPostfix: {arg}");
}
}
}
}
[HarmonyPatch]
public static class BounceShotgunPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(BounceShotgun), "OnActiveUpdate")]
public static void OnActiveUpdate_Postfix(BounceShotgun __instance)
{
if (SparrohPlugin.showJackrabbitBounceIndicators.Value)
{
return;
}
List<LineRenderer> value = Traverse.Create((object)__instance).Field<List<LineRenderer>>("bounceLines").Value;
if (value == null)
{
return;
}
for (int i = 0; i < value.Count; i++)
{
if (((Component)value[i]).gameObject.activeSelf)
{
((Component)value[i]).gameObject.SetActive(false);
}
}
}
}
public class SingleplayerPause : MonoBehaviour
{
private static bool menuWasOpen = false;
private static bool isPaused = false;
private static readonly List<AI> pausedAI = new List<AI>();
private static readonly Dictionary<AI, bool> aiOriginalEnabled = new Dictionary<AI, bool>();
private static readonly Dictionary<NavMeshAgent, bool> navAgentOriginalEnabled = new Dictionary<NavMeshAgent, bool>();
private static readonly List<SimpleProjectileBullet> pausedProjectiles = new List<SimpleProjectileBullet>();
private static readonly Dictionary<SimpleProjectileBullet, bool> projectileOriginalEnabled = new Dictionary<SimpleProjectileBullet, bool>();
private static readonly List<EnemyCore> pausedEnemyCores = new List<EnemyCore>();
private static readonly Dictionary<EnemyCore, bool> enemyCoreOriginalEnabled = new Dictionary<EnemyCore, bool>();
private static readonly List<EnemyBrain> overclockedEnemies = new List<EnemyBrain>();
private static readonly List<EnemyBrain> pausedEnemyBrains = new List<EnemyBrain>();
private static readonly Dictionary<EnemyBrain, bool> enemyBrainOriginalEnabled = new Dictionary<EnemyBrain, bool>();
private static readonly List<EnemyBrain> deactivatedOverclockedBrains = new List<EnemyBrain>();
private static readonly List<MonoBehaviour> pausedWeaponArms = new List<MonoBehaviour>();
private static readonly Dictionary<MonoBehaviour, bool> weaponArmOriginalEnabled = new Dictionary<MonoBehaviour, bool>();
private static readonly List<Hornet> pausedHornets = new List<Hornet>();
private static readonly Dictionary<Hornet, bool> hornetOriginalEnabled = new Dictionary<Hornet, bool>();
private static readonly List<ExplosiveEnemyPart> pausedExplosives = new List<ExplosiveEnemyPart>();
private static readonly List<float> explosiveFuseTimes = new List<float>();
private static bool wasSpawningEnabled;
private static bool isPausedMod = false;
public static bool IsPaused = false;
private void Update()
{
if ((Object)(object)Menu.Instance == (Object)null || !SparrohPlugin.enableSingleplayerPause.Value)
{
return;
}
bool isOpen = Menu.Instance.IsOpen;
bool flag = IsSingleplayer();
if (isPaused && !flag)
{
ResumePause();
}
if (flag)
{
bool flag2 = false;
if ((Object)(object)GameManager.Instance != (Object)null && (Object)(object)GameManager.Instance.WindowSystem != (Object)null)
{
for (int i = 0; i < GameManager.Instance.WindowSystem.Count; i++)
{
if (GameManager.Instance.WindowSystem[i] is MissionSelectWindow)
{
flag2 = true;
break;
}
}
}
if (isOpen && !menuWasOpen && !isPaused && !flag2)
{
StartPause();
}
else if (!isOpen && menuWasOpen && isPaused)
{
ResumePause();
}
else if (isOpen && isPaused && flag2)
{
ResumePause();
}
}
menuWasOpen = isOpen;
}
private void LateUpdate()
{
if ((Object)(object)Menu.Instance == (Object)null || !SparrohPlugin.enableSingleplayerPause.Value)
{
return;
}
bool flag = false;
if ((Object)(object)GameManager.Instance != (Object)null && (Object)(object)GameManager.Instance.WindowSystem != (Object)null)
{
for (int i = 0; i < GameManager.Instance.WindowSystem.Count; i++)
{
if (GameManager.Instance.WindowSystem[i] is MissionSelectWindow)
{
flag = true;
break;
}
}
}
if (flag || Menu.Instance.IsOpen || isPaused)
{
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
}
else
{
Cursor.lockState = (CursorLockMode)1;
Cursor.visible = false;
}
}
private void StartPause()
{
try
{
isPaused = true;
isPausedMod = true;
IsPaused = true;
AI[] array = Object.FindObjectsOfType<AI>(true);
foreach (AI val in array)
{
try
{
if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null && ((Component)val).gameObject.activeInHierarchy)
{
pausedAI.Add(val);
aiOriginalEnabled[val] = ((Behaviour)val).enabled;
((Behaviour)val).enabled = false;
if ((Object)(object)val.NavAgent != (Object)null)
{
navAgentOriginalEnabled[val.NavAgent] = ((Behaviour)val.NavAgent).enabled;
((Behaviour)val.NavAgent).enabled = false;
}
((MonoBehaviour)val).StopAllCoroutines();
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogError((object)("Failed to pause AI " + (((val != null) ? ((Object)val).name : null) ?? "null") + ": " + ex.Message));
}
}
SimpleProjectileBullet[] array2 = Object.FindObjectsOfType<SimpleProjectileBullet>(true);
foreach (SimpleProjectileBullet val2 in array2)
{
if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null && ((Component)val2).gameObject.activeInHierarchy && ((Behaviour)val2).isActiveAndEnabled)
{
pausedProjectiles.Add(val2);
projectileOriginalEnabled[val2] = ((Behaviour)val2).enabled;
((Behaviour)val2).enabled = false;
}
}
EnemyCore[] array3 = Object.FindObjectsOfType<EnemyCore>(true);
foreach (EnemyCore val3 in array3)
{
if ((Object)(object)val3 != (Object)null && (Object)(object)((Component)val3).gameObject != (Object)null && ((Component)val3).gameObject.activeInHierarchy)
{
pausedEnemyCores.Add(val3);
enemyCoreOriginalEnabled[val3] = ((Behaviour)val3).enabled;
((Behaviour)val3).enabled = false;
((MonoBehaviour)val3).StopAllCoroutines();
EnemyBrain componentInParent = ((Component)val3).GetComponentInParent<EnemyBrain>();
if (componentInParent != null && componentInParent.Overclocked > 0f)
{
overclockedEnemies.Add(componentInParent);
}
}
}
EnemyBrain[] array4 = Object.FindObjectsOfType<EnemyBrain>(true);
foreach (EnemyBrain val4 in array4)
{
if ((Object)(object)val4 != (Object)null && (Object)(object)((Component)val4).gameObject != (Object)null && ((Component)val4).gameObject.activeInHierarchy)
{
pausedEnemyBrains.Add(val4);
enemyBrainOriginalEnabled[val4] = ((Behaviour)val4).enabled;
if (val4.Overclocked > 0f)
{
deactivatedOverclockedBrains.Add(val4);
}
val4.Overclocked = 0f;
((Behaviour)val4).enabled = false;
((MonoBehaviour)val4).StopAllCoroutines();
}
}
Type[] array5 = new Type[3]
{
typeof(GunArmTip),
typeof(AutocannonArmTip),
typeof(BladeArmTip)
};
for (int i = 0; i < array5.Length; i++)
{
MonoBehaviour[] array6 = Object.FindObjectsOfType(array5[i], true) as MonoBehaviour[];
foreach (MonoBehaviour val5 in array6)
{
if ((Object)(object)val5 != (Object)null && (Object)(object)((Component)val5).gameObject != (Object)null && ((Component)val5).gameObject.activeInHierarchy)
{
pausedWeaponArms.Add(val5);
weaponArmOriginalEnabled[val5] = ((Behaviour)val5).enabled;
((Behaviour)val5).enabled = false;
}
}
}
Hornet[] array7 = Object.FindObjectsOfType<Hornet>(true);
foreach (Hornet val6 in array7)
{
if ((Object)(object)val6 != (Object)null && (Object)(object)((Component)val6).gameObject != (Object)null && ((Component)val6).gameObject.activeInHierarchy && ((Behaviour)val6).isActiveAndEnabled)
{
pausedHornets.Add(val6);
hornetOriginalEnabled[val6] = ((Behaviour)val6).enabled;
((Behaviour)val6).enabled = false;
}
}
ExplosiveEnemyPart[] array8 = Object.FindObjectsOfType<ExplosiveEnemyPart>(true);
FieldInfo field = typeof(ExplosiveEnemyPart).GetField("startFuseTime", BindingFlags.Instance | BindingFlags.NonPublic);
ExplosiveEnemyPart[] array9 = array8;
foreach (ExplosiveEnemyPart val7 in array9)
{
if ((Object)(object)val7 != (Object)null && (Object)(object)((Component)val7).gameObject != (Object)null && ((Component)val7).gameObject.activeInHierarchy)
{
float num = (float)field.GetValue(val7);
if (num > 0f)
{
pausedExplosives.Add(val7);
explosiveFuseTimes.Add(Time.time - num);
}
}
}
if ((Object)(object)EnemyManager.Instance != (Object)null)
{
wasSpawningEnabled = true;
EnemyManager.Instance.DisableSpawning();
}
}
catch (Exception ex2)
{
SparrohPlugin.Logger.LogError((object)("Failed at start pause: " + ex2.Message));
isPaused = false;
}
}
private void ResumePause()
{
isPaused = false;
isPausedMod = false;
IsPaused = false;
foreach (AI item in pausedAI)
{
if ((Object)(object)item != (Object)null)
{
if (aiOriginalEnabled.TryGetValue(item, out var value))
{
((Behaviour)item).enabled = value;
}
if ((Object)(object)item.NavAgent != (Object)null && navAgentOriginalEnabled.TryGetValue(item.NavAgent, out value))
{
((Behaviour)item.NavAgent).enabled = value;
}
}
}
foreach (SimpleProjectileBullet pausedProjectile in pausedProjectiles)
{
if ((Object)(object)pausedProjectile != (Object)null && projectileOriginalEnabled.TryGetValue(pausedProjectile, out var value2))
{
((Behaviour)pausedProjectile).enabled = value2;
}
}
foreach (EnemyCore pausedEnemyCore in pausedEnemyCores)
{
if ((Object)(object)pausedEnemyCore != (Object)null && enemyCoreOriginalEnabled.TryGetValue(pausedEnemyCore, out var value3))
{
((Behaviour)pausedEnemyCore).enabled = value3;
}
}
foreach (EnemyBrain overclockedEnemy in overclockedEnemies)
{
_ = overclockedEnemy;
}
foreach (EnemyBrain pausedEnemyBrain in pausedEnemyBrains)
{
if ((Object)(object)pausedEnemyBrain != (Object)null && enemyBrainOriginalEnabled.TryGetValue(pausedEnemyBrain, out var value4))
{
((Behaviour)pausedEnemyBrain).enabled = value4;
}
}
foreach (MonoBehaviour pausedWeaponArm in pausedWeaponArms)
{
if ((Object)(object)pausedWeaponArm != (Object)null && weaponArmOriginalEnabled.TryGetValue(pausedWeaponArm, out var value5))
{
((Behaviour)pausedWeaponArm).enabled = value5;
}
}
foreach (EnemyBrain deactivatedOverclockedBrain in deactivatedOverclockedBrains)
{
if ((Object)(object)deactivatedOverclockedBrain != (Object)null)
{
deactivatedOverclockedBrain.Overclocked = 1f;
}
}
foreach (Hornet pausedHornet in pausedHornets)
{
if ((Object)(object)pausedHornet != (Object)null && hornetOriginalEnabled.TryGetValue(pausedHornet, out var value6))
{
((Behaviour)pausedHornet).enabled = value6;
}
}
FieldInfo field = typeof(ExplosiveEnemyPart).GetField("startFuseTime", BindingFlags.Instance | BindingFlags.NonPublic);
for (int i = 0; i < pausedExplosives.Count; i++)
{
ExplosiveEnemyPart val = pausedExplosives[i];
if ((Object)(object)val != (Object)null)
{
float num = explosiveFuseTimes[i];
field.SetValue(val, Time.time - num);
}
}
pausedAI.Clear();
aiOriginalEnabled.Clear();
navAgentOriginalEnabled.Clear();
pausedProjectiles.Clear();
projectileOriginalEnabled.Clear();
pausedEnemyCores.Clear();
enemyCoreOriginalEnabled.Clear();
overclockedEnemies.Clear();
pausedEnemyBrains.Clear();
enemyBrainOriginalEnabled.Clear();
deactivatedOverclockedBrains.Clear();
pausedWeaponArms.Clear();
weaponArmOriginalEnabled.Clear();
pausedHornets.Clear();
hornetOriginalEnabled.Clear();
pausedExplosives.Clear();
explosiveFuseTimes.Clear();
if (wasSpawningEnabled && (Object)(object)EnemyManager.Instance != (Object)null)
{
EnemyManager.Instance.EnableSpawning();
}
}
private static bool IsSingleplayer()
{
if ((Object)(object)NetworkManager.Singleton != (Object)null)
{
return NetworkManager.Singleton.ConnectedClients.Count <= 1;
}
if ((Object)(object)GameManager.Instance != (Object)null)
{
return GameManager.players.Count <= 1;
}
return true;
}
}
internal static class RegionBypassPatches
{
[HarmonyPatch(typeof(Option), "OnEnable")]
[HarmonyPrefix]
private static void Option_OnEnable_Prefix(Option __instance)
{
if (!(__instance.ID == "LobbyDistance"))
{
return;
}
Traverse.Create((object)__instance).Field<float>("maxValue").Value = 3f;
Transform val = ((Component)__instance).gameObject.transform.Find("ScrollRect/ScrollBar");
if ((Object)(object)val != (Object)null)
{
ScrollBar component = ((Component)val).GetComponent<ScrollBar>();
if ((Object)(object)component != (Object)null)
{
component.SetSnapPoints(4, 0);
}
}
}
[HarmonyPatch(typeof(Option), "SaveValue", new Type[] { typeof(float) })]
[HarmonyPostfix]
private static void Option_SaveValue_Postfix(Option __instance, float value)
{
if (!(__instance.ID == "LobbyDistance"))
{
return;
}
string text = Mathf.RoundToInt(value) switch
{
0 => "Close",
1 => "Medium",
2 => "Far",
3 => "Worldwide",
_ => "Unknown",
};
Transform val = ((Component)__instance).transform.Find("Num");
if ((Object)(object)val != (Object)null)
{
TextMeshProUGUI component = ((Component)val).GetComponent<TextMeshProUGUI>();
if ((Object)(object)component != (Object)null)
{
((TMP_Text)component).text = text;
}
}
}
}
public enum BounceIndicatorColor
{
[Description("Standard orange color (highest priority, default)")]
Orange,
[Description("Clean white color")]
White,
[Description("Bright green color")]
Green,
[Description("Deep blue color")]
Blue,
[Description("Vibrant red color")]
Red,
[Description("Sunny yellow color")]
Yellow,
[Description("Royal purple color")]
Purple,
[Description("Aqua cyan color")]
Cyan,
[Description("Use a custom color specified by hex code")]
Custom
}
[BepInPlugin("sparroh.enhancedsettings", "EnhancedSettings", "1.3.0")]
[MycoMod(/*Could not decode attribute arguments.*/)]
public class SparrohPlugin : BaseUnityPlugin
{
public const string PluginGUID = "sparroh.enhancedsettings";
public const string PluginName = "EnhancedSettings";
public const string PluginVersion = "1.3.0";
internal static ManualLogSource Logger;
internal static ConfigEntry<bool> aimFOVChange;
internal static ConfigEntry<bool> sprintFOVChange;
internal static ConfigEntry<bool> toggleAim;
internal static ConfigEntry<bool> toggleCrouch;
internal static ConfigEntry<bool> showJackrabbitBounceIndicators;
internal static ConfigEntry<bool> enableAllBounceIndicators;
internal static ConfigEntry<BounceIndicatorColor> bounceIndicatorColor;
internal static ConfigEntry<string> bounceIndicatorCustomColor;
internal static ConfigEntry<bool> enableSingleplayerPause;
internal static ConfigEntry<bool> skipIntro;
internal static ConfigEntry<bool> skipMissionCountdown;
internal static ConfigEntry<bool> resizePopups;
internal static ConfigEntry<bool> dataLogWaypoints;
internal static ConfigEntry<bool> skinRandomizer;
private FileSystemWatcher disableAimFOVWatcher;
private FileSystemWatcher disableSprintFOVWatcher;
private FileSystemWatcher toggleAimWatcher;
private FileSystemWatcher toggleCrouchWatcher;
internal static bool isAimToggled;
internal static InputAction aimAction;
internal static MethodInfo defaultFOVGetter;
internal static FieldInfo isAimingPLField;
internal static FieldInfo fovField;
internal static FieldInfo aimFOVPLField;
internal static FieldInfo aimDurationPLField;
internal static FieldInfo aimStateChangeTimeField;
internal static FieldInfo isAimInputHeldField;
internal static FieldInfo lastPressedAimTimeField;
internal static FieldInfo lastPressedFireTimeField;
internal static FieldInfo playerField;
internal static MethodInfo isAimingGetter;
internal static MethodInfo wantsToFireGetter;
internal static MethodInfo lastFireTimeGetter;
private GameManager gameManager;
internal static SparrohPlugin Instance { get; set; }
private void Awake()
{
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Expected O, but got Unknown
Instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
aimFOVChange = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Aim FOV Change", true, "If true, enables FOV zoom changes when aiming.");
sprintFOVChange = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Sprint FOV Change", true, "If true, enables FOV changes while sprinting.");
toggleAim = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Toggle Aim", false, "If true, aim becomes a toggle (press to enter/exit) instead of hold.");
toggleCrouch = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Toggle Crouch", false, "If true, enables toggle crouch functionality (hold crouch by pressing slide button).");
showJackrabbitBounceIndicators = ((BaseUnityPlugin)this).Config.Bind<bool>("Bounce Indicators", "Jackrabbit Bounce Indicator", true, "Show jackrabbit bounce indicators");
enableAllBounceIndicators = ((BaseUnityPlugin)this).Config.Bind<bool>("Bounce Indicators", "All Bounce Indicators", false, "Show bounce/ricochet prediction lines for all weapons with bounces >= 1.");
bounceIndicatorColor = ((BaseUnityPlugin)this).Config.Bind<BounceIndicatorColor>("Bounce Indicators", "Bounce Indicator Color", BounceIndicatorColor.Orange, "Select the color for bounce/ricochet prediction lines");
bounceIndicatorCustomColor = ((BaseUnityPlugin)this).Config.Bind<string>("Bounce Indicators", "Bounce Indicator Custom Color", "#FF8000", "Hex color code when 'Custom' is selected (format: #RRGGBB or RRGGBB)");
enableSingleplayerPause = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Singleplayer Pause", false, "Enable singleplayer pause functionality");
skipIntro = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Skip Intro", false, "Skip the intro sequence on startup");
skipMissionCountdown = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Skip Mission Countdown", false, "If true, skips the countdown timer before mission start.");
resizePopups = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Resize Item Popups", false, "If true, reduces the size of item upgrade popups and repositions them.");
dataLogWaypoints = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Data Log Waypoints", true, "If true, shows waypoints for undiscovered data logs.");
skinRandomizer = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Skin Randomizer", false, "If true, randomly equips favorite skins on mission start.");
aimFOVChange.SettingChanged += OnAimFOVChanged;
enableAllBounceIndicators.SettingChanged += OnEnableAllBounceIndicatorsChanged;
enableSingleplayerPause.SettingChanged += OnEnableSingleplayerPauseChanged;
sprintFOVChange.SettingChanged += OnSprintFOVChanged;
toggleAim.SettingChanged += OnToggleAimChanged;
toggleCrouch.SettingChanged += OnToggleCrouchChanged;
skipMissionCountdown.SettingChanged += OnSkipMissionCountdownChanged;
resizePopups.SettingChanged += OnResizePopupsChanged;
bounceIndicatorColor.SettingChanged += OnBounceIndicatorColorChanged;
bounceIndicatorCustomColor.SettingChanged += OnBounceIndicatorCustomColorChanged;
try
{
SetupFileWatchers();
}
catch (Exception ex)
{
Logger.LogError((object)("Error setting up file watchers: " + ex.Message));
}
try
{
SetupAccessTools();
}
catch (Exception ex2)
{
Logger.LogError((object)("Error setting up access tools: " + ex2.Message));
}
try
{
Harmony harmony = new Harmony("sparroh.enhancedsettings");
ApplyAimFOVPatches(harmony);
ApplySprintFOVPatches(harmony);
ApplyToggleAimPatches(harmony);
ApplyToggleCrouchPatches(harmony);
ApplyDisableBounceIndicatorPatches(harmony);
ApplyRegionBypassPatches(harmony);
ApplyAllBounceIndicatorsPatches(harmony);
ApplySingleplayerPausePatches();
ApplySkipIntroPatches(harmony);
ApplyCountdownSkipPatches(harmony);
ApplyDataLogWaypointPatches(harmony);
ApplySkinRandomizerPatches(harmony);
}
catch (Exception ex3)
{
Logger.LogError((object)("Error applying patches: " + ex3.Message));
}
Logger.LogInfo((object)"EnhancedSettings loaded successfully.");
}
private void SetupFileWatchers()
{
string configPath = Paths.ConfigPath;
disableAimFOVWatcher = new FileSystemWatcher(configPath, "sparroh.enhancedsettings.cfg");
disableAimFOVWatcher.Changed += delegate
{
((ConfigEntryBase)aimFOVChange).ConfigFile.Reload();
};
disableAimFOVWatcher.EnableRaisingEvents = true;
disableSprintFOVWatcher = disableAimFOVWatcher;
toggleAimWatcher = disableAimFOVWatcher;
toggleCrouchWatcher = disableAimFOVWatcher;
}
private void SetupAccessTools()
{
defaultFOVGetter = AccessTools.PropertyGetter(typeof(PlayerLook), "DefaultFOV");
isAimingPLField = AccessTools.Field(typeof(PlayerLook), "isAiming");
fovField = AccessTools.Field(typeof(PlayerLook), "_fov");
aimFOVPLField = AccessTools.Field(typeof(PlayerLook), "aimFOV");
aimDurationPLField = AccessTools.Field(typeof(PlayerLook), "aimDuration");
aimStateChangeTimeField = AccessTools.Field(typeof(PlayerLook), "aimStateChangeTime");
isAimInputHeldField = AccessTools.Field(typeof(Gun), "isAimInputHeld");
lastPressedAimTimeField = AccessTools.Field(typeof(Gun), "lastPressedAimTime");
lastPressedFireTimeField = AccessTools.Field(typeof(Gun), "lastPressedFireTime");
playerField = AccessTools.Field(typeof(Gun), "player");
isAimingGetter = AccessTools.PropertyGetter(typeof(Gun), "IsAiming");
wantsToFireGetter = AccessTools.PropertyGetter(typeof(Gun), "WantsToFire");
lastFireTimeGetter = AccessTools.PropertyGetter(typeof(Gun), "LastFireTime");
}
private void ApplyAimFOVPatches(Harmony harmony)
{
harmony.PatchAll(typeof(AimFOVPatches));
}
private void ApplySprintFOVPatches(Harmony harmony)
{
harmony.PatchAll(typeof(SprintFOVPatches));
}
private void ApplyToggleAimPatches(Harmony harmony)
{
harmony.PatchAll(typeof(ToggleAimPatches));
}
private void ApplyToggleCrouchPatches(Harmony harmony)
{
harmony.PatchAll(typeof(ToggleCrouchPatches));
harmony.PatchAll(typeof(EndCrouchPatches));
harmony.PatchAll(typeof(EndSlidePatches));
}
private void ApplyDisableBounceIndicatorPatches(Harmony harmony)
{
harmony.PatchAll(typeof(BounceShotgunPatches));
}
private void ApplyRegionBypassPatches(Harmony harmony)
{
harmony.PatchAll(typeof(RegionBypassPatches));
}
private void ApplyAllBounceIndicatorsPatches(Harmony harmony)
{
harmony.PatchAll(typeof(GunBouncePatches));
}
private void ApplySingleplayerPausePatches()
{
((Component)this).gameObject.AddComponent<SingleplayerPause>();
}
private void ApplySkipIntroPatches(Harmony harmony)
{
harmony.PatchAll(typeof(IntroSkip.IntroPatches));
}
private void ApplyCountdownSkipPatches(Harmony harmony)
{
harmony.PatchAll(typeof(DisableCountdown));
}
private void ApplyDataLogWaypointPatches(Harmony harmony)
{
DataLogWaypointPatches.Initialize();
}
private void ApplySkinRandomizerPatches(Harmony harmony)
{
harmony.PatchAll(typeof(DropPodPatches));
}
private void OnAimFOVChanged(object sender, EventArgs e)
{
}
private void OnSprintFOVChanged(object sender, EventArgs e)
{
}
private void OnToggleAimChanged(object sender, EventArgs e)
{
ConfigureAimSubscription();
}
private void OnToggleCrouchChanged(object sender, EventArgs e)
{
if (!toggleCrouch.Value)
{
ToggleCrouchPatches.isToggleOn = false;
}
}
private void OnEnableAllBounceIndicatorsChanged(object sender, EventArgs e)
{
}
private void OnEnableSingleplayerPauseChanged(object sender, EventArgs e)
{
}
private void OnSkipMissionCountdownChanged(object sender, EventArgs e)
{
}
private void OnResizePopupsChanged(object sender, EventArgs e)
{
}
private void OnBounceIndicatorColorChanged(object sender, EventArgs e)
{
UpdateBounceIndicatorColors();
}
private void OnBounceIndicatorCustomColorChanged(object sender, EventArgs e)
{
if (bounceIndicatorColor.Value == BounceIndicatorColor.Custom)
{
UpdateBounceIndicatorColors();
}
}
private Color GetSelectedColor()
{
//IL_0049: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: 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)
switch (bounceIndicatorColor.Value)
{
case BounceIndicatorColor.Orange:
return new Color(1f, 0.5f, 0f);
case BounceIndicatorColor.White:
return new Color(1f, 1f, 1f);
case BounceIndicatorColor.Green:
return new Color(0f, 1f, 0f);
case BounceIndicatorColor.Blue:
return new Color(0f, 0f, 1f);
case BounceIndicatorColor.Red:
return new Color(1f, 0f, 0f);
case BounceIndicatorColor.Yellow:
return new Color(1f, 1f, 0f);
case BounceIndicatorColor.Purple:
return new Color(1f, 0f, 1f);
case BounceIndicatorColor.Cyan:
return new Color(0f, 1f, 1f);
case BounceIndicatorColor.Custom:
{
string text = bounceIndicatorCustomColor.Value;
if (!text.StartsWith("#"))
{
text = "#" + text;
}
Color result = default(Color);
if (ColorUtility.TryParseHtmlString(text, ref result))
{
return result;
}
return new Color(1f, 0f, 0f);
}
default:
return new Color(1f, 0f, 0f);
}
}
private void UpdateBounceIndicatorColors()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
Color selectedColor = GetSelectedColor();
if (AllBounceIndicators.BounceLines != null)
{
foreach (KeyValuePair<Gun, List<LineRenderer>> bounceLine in AllBounceIndicators.BounceLines)
{
List<LineRenderer> value = bounceLine.Value;
for (int i = 0; i < value.Count; i++)
{
if ((Object)(object)value[i] != (Object)null && (Object)(object)((Renderer)value[i]).material != (Object)null)
{
((Renderer)value[i]).material.color = selectedColor;
Color val = selectedColor * 0.5f;
val.a = 1f;
((Renderer)value[i]).material.SetColor("_EmissionColor", val);
value[i].startColor = selectedColor;
value[i].endColor = selectedColor;
}
}
}
}
AllBounceIndicators.BounceLinePrefab = null;
}
internal static void ConfigureAimSubscription()
{
if (aimAction != null)
{
aimAction.started -= OnAimStarted;
if (toggleAim.Value)
{
aimAction.started += OnAimStarted;
}
else
{
isAimToggled = false;
}
}
}
internal static void OnAimStarted(CallbackContext context)
{
if (toggleAim.Value)
{
isAimToggled = !isAimToggled;
}
}
private void Update()
{
if (!resizePopups.Value || !((Object)(object)gameManager == (Object)null))
{
return;
}
try
{
gameManager = GameManager.Instance;
if ((Object)(object)gameManager != (Object)null)
{
ResizePopup.Initialize(gameManager);
}
}
catch (Exception ex)
{
Logger.LogError((object)("Error accessing GameManager or initializing resize popup: " + ex.Message));
}
}
private void OnDestroy()
{
if (disableAimFOVWatcher != null)
{
disableAimFOVWatcher.EnableRaisingEvents = false;
disableAimFOVWatcher.Dispose();
}
if (aimAction != null)
{
aimAction.started -= OnAimStarted;
}
}
}
public static class ResizePopup
{
private class SmallPopup : MonoBehaviour
{
private Vector2 originalPosition;
private bool hasStoredOriginalPos;
private void Start()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
RectTransform component = ((Component)this).GetComponent<RectTransform>();
if ((Object)(object)component != (Object)null)
{
originalPosition = component.anchoredPosition;
hasStoredOriginalPos = true;
}
}
private void Update()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.localScale = new Vector3(0.5f, 0.5f, 1f);
RectTransform component = ((Component)this).GetComponent<RectTransform>();
if ((Object)(object)component != (Object)null && hasStoredOriginalPos)
{
component.anchoredPosition = new Vector2(originalPosition.x + 200f, originalPosition.y);
}
}
}
private class PopupMonitor : MonoBehaviour
{
[CompilerGenerated]
private sealed class <MonitorListCoroutine>d__4 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public PopupMonitor <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <MonitorListCoroutine>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
int num = <>1__state;
PopupMonitor popupMonitor = <>4__this;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
}
else
{
<>1__state = -1;
}
if (popupMonitor.upgradePopupsList != null)
{
int count = popupMonitor.upgradePopupsList.Count;
if (count > popupMonitor.previousCount)
{
object obj = popupMonitor.upgradePopupsList[count - 1];
if (obj != null)
{
object obj2 = ((obj is MonoBehaviour) ? obj : null);
GameObject val = ((obj2 != null) ? ((Component)obj2).gameObject : null);
if ((Object)(object)val != (Object)null && (Object)(object)val.GetComponent<SmallPopup>() == (Object)null)
{
val.AddComponent<SmallPopup>();
}
}
popupMonitor.previousCount = count;
}
}
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private FieldInfo upgradePopupsField;
private IList upgradePopupsList;
private int previousCount;
private void Start()
{
try
{
upgradePopupsField = AccessTools.Field(typeof(GameManager), "upgradePopups");
if (!(upgradePopupsField == null))
{
upgradePopupsList = upgradePopupsField.GetValue(GameManager.Instance) as IList;
if (upgradePopupsList != null)
{
previousCount = upgradePopupsList.Count;
((MonoBehaviour)this).StartCoroutine(MonitorListCoroutine());
}
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogError((object)("Error in PopupMonitor.Start: " + ex.Message));
}
}
[IteratorStateMachine(typeof(<MonitorListCoroutine>d__4))]
private IEnumerator MonitorListCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <MonitorListCoroutine>d__4(0)
{
<>4__this = this
};
}
}
public static void Initialize(GameManager gameManager)
{
if ((Object)(object)((Component)gameManager).gameObject.GetComponent<PopupMonitor>() == (Object)null)
{
((Component)gameManager).gameObject.AddComponent<PopupMonitor>();
}
}
}
[HarmonyPatch]
public static class DropPodPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(DropPod), "StartCountdown_ClientRpc")]
public static void StartCountdown_ClientRpc_Postfix()
{
if (SparrohPlugin.skinRandomizer.Value)
{
RandomizeFavoriteSkins();
}
}
private static void RandomizeFavoriteSkins()
{
if ((Object)(object)Player.LocalPlayer == (Object)null)
{
return;
}
List<IUpgradable> list = new List<IUpgradable> { (IUpgradable)(object)Player.LocalPlayer.Character };
if ((Object)(object)DropPod.Instance != (Object)null)
{
list.Add((IUpgradable)(object)DropPod.Instance);
}
foreach (IUpgradable item in list)
{
RandomizeSkinsForGear(item);
}
}
private static void RandomizeSkinsForGear(IUpgradable gear)
{
GearData gearData = PlayerData.GetGearData(gear);
if (gearData == null)
{
return;
}
if (typeof(GearData).GetField("equippedSkins", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(gearData) is List<UpgradeEquipData> list)
{
list.Clear();
}
List<UpgradeInstance> list2 = new List<UpgradeInstance>();
List<UpgradeInstance> list3 = new List<UpgradeInstance>();
List<UpgradeInstance> list4 = new List<UpgradeInstance>();
SkinEnumerator val = default(SkinEnumerator);
((SkinEnumerator)(ref val))..ctor(gear);
SkinUpgradeProperty_VFXCrab val3 = default(SkinUpgradeProperty_VFXCrab);
bool flag = default(bool);
SkinUpgradeProperty_GunCrab val4 = default(SkinUpgradeProperty_GunCrab);
while (((SkinEnumerator)(ref val)).MoveNext())
{
UpgradeInstance upgrade = ((SkinEnumerator)(ref val)).Upgrade;
if (!upgrade.Favorite)
{
continue;
}
Upgrade upgrade2 = upgrade.Upgrade;
SkinUpgrade val2 = (SkinUpgrade)(object)((upgrade2 is SkinUpgrade) ? upgrade2 : null);
if (!((Object)(object)val2 == (Object)null))
{
bool flag2 = val2.HasProperty<SkinUpgradeProperty_VFXCrab>(upgrade.Seed, ref val3, ref flag);
bool flag3 = val2.HasProperty<SkinUpgradeProperty_GunCrab>(upgrade.Seed, ref val4, ref flag);
if (flag2)
{
list4.Add(upgrade);
}
else if (flag3)
{
list3.Add(upgrade);
}
else
{
list2.Add(upgrade);
}
}
}
SelectAndEquipRandom(list2, gearData);
SelectAndEquipRandom(list3, gearData);
SelectAndEquipRandom(list4, gearData);
}
private static void SelectAndEquipRandom(List<UpgradeInstance> skins, GearData gearData)
{
if (skins.Count == 0)
{
return;
}
int index = Random.Range(0, skins.Count);
UpgradeInstance val = skins[index];
gearData.EquipUpgrade(val, (sbyte)0, (sbyte)0, (byte)0);
if (gearData.Gear == Player.LocalPlayer.Character)
{
Player.LocalPlayer.ApplySkins();
}
else
{
IUpgradable gear = gearData.Gear;
DropPod val2 = (DropPod)(object)((gear is DropPod) ? gear : null);
if (val2 != null)
{
val2.ApplyGearSkins();
}
else
{
Upgrade upgrade = val.Upgrade;
SkinUpgrade val3 = (SkinUpgrade)(object)((upgrade is SkinUpgrade) ? upgrade : null);
if ((Object)(object)val3 != (Object)null)
{
val3.Apply(gearData.Gear, val.Seed, Player.LocalPlayer, (List<Material>)null);
}
gearData.Gear.OnUpgradesChanged((HexMap)null, (ModuleEquipSlots)null);
}
}
Player.LocalPlayer.ApplySkins();
}
}
[HarmonyPatch]
public static class SprintFOVPatches
{
[HarmonyPatch(typeof(PlayerLook), "AddFOV")]
[HarmonyPrefix]
public static bool Prefix(ref float value)
{
if (SparrohPlugin.sprintFOVChange.Value)
{
return true;
}
StackFrame[] frames = new StackTrace().GetFrames();
for (int i = 0; i < frames.Length; i++)
{
MethodBase method = frames[i].GetMethod();
if (method?.ReflectedType?.Name == "Player" && method.Name.Contains("Update"))
{
return false;
}
}
return true;
}
}
[HarmonyPatch]
public static class ToggleAimPatches
{
[HarmonyPatch(typeof(PlayerInput), "Initialize")]
[HarmonyPostfix]
public static void PlayerInputInitializePostfix()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
PlayerControls controls = PlayerInput.Controls;
object aimAction;
if (controls == null)
{
aimAction = null;
}
else
{
PlayerActions player = controls.Player;
aimAction = ((PlayerActions)(ref player)).Aim;
}
SparrohPlugin.aimAction = (InputAction)aimAction;
SparrohPlugin.ConfigureAimSubscription();
}
[HarmonyPatch(typeof(Gun), "OnAimInputPerformed")]
[HarmonyPrefix]
public static bool SkipPrefix()
{
return !SparrohPlugin.toggleAim.Value;
}
[HarmonyPatch(typeof(Gun), "OnAimInputCancelled")]
[HarmonyPrefix]
public static bool SkipPrefixCancelled()
{
return !SparrohPlugin.toggleAim.Value;
}
[HarmonyPatch(typeof(Gun), "HandleAim")]
[HarmonyPrefix]
public static void HandleAimPrefix(Gun __instance)
{
if (SparrohPlugin.toggleAim.Value)
{
_ = (bool)SparrohPlugin.isAimInputHeldField.GetValue(__instance);
SparrohPlugin.isAimInputHeldField.SetValue(__instance, SparrohPlugin.isAimToggled);
if (SparrohPlugin.isAimToggled)
{
SparrohPlugin.lastPressedAimTimeField.SetValue(__instance, Time.time);
}
}
}
[HarmonyPatch(typeof(Gun), "Update")]
[HarmonyPostfix]
public static void UpdatePostfix(Gun __instance)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
if (SparrohPlugin.toggleAim.Value)
{
bool flag = (bool)SparrohPlugin.isAimingGetter.Invoke(__instance, null);
bool flag2 = (bool)SparrohPlugin.wantsToFireGetter.Invoke(__instance, null);
float num = (float)SparrohPlugin.lastFireTimeGetter.Invoke(__instance, null);
float num2 = (float)SparrohPlugin.lastPressedFireTimeField.GetValue(__instance);
Player val = (Player)SparrohPlugin.playerField.GetValue(__instance);
if ((Object)(object)val != (Object)null && !flag && !flag2 && Time.time - Mathf.Max(num, num2) > 0.5f)
{
val.ResumeSprint();
}
}
}
[HarmonyPatch(typeof(Player), "Resurrect_ClientRpc")]
[HarmonyPostfix]
public static void ResetTogglePostfix()
{
SparrohPlugin.isAimToggled = false;
}
}
[HarmonyPatch]
public static class ToggleCrouchPatches
{
public static bool isToggleOn;
[HarmonyPatch(typeof(Player), "Update")]
[HarmonyPrefix]
public static void Prefix(Player __instance)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (!SparrohPlugin.toggleCrouch.Value)
{
return;
}
PlayerActions player = PlayerInput.Controls.Player;
if (((PlayerActions)(ref player)).Slide.WasPressedThisFrame())
{
PropertyInfo? property = typeof(Player).GetProperty("Crouching");
PropertyInfo property2 = typeof(Player).GetProperty("Sliding");
bool num = (bool)property.GetValue(__instance);
bool flag = (bool)property2.GetValue(__instance);
if (num || flag || isToggleOn)
{
isToggleOn = false;
}
else
{
isToggleOn = true;
}
}
}
}
[HarmonyPatch]
public static class EndCrouchPatches
{
[HarmonyPatch(typeof(Player), "EndCrouch")]
[HarmonyPrefix]
private static bool Prefix()
{
if (SparrohPlugin.toggleCrouch.Value)
{
return !ToggleCrouchPatches.isToggleOn;
}
return true;
}
}
[HarmonyPatch]
public static class EndSlidePatches
{
[HarmonyPatch(typeof(Player), "EndSlide")]
[HarmonyPrefix]
private static bool Prefix()
{
if (SparrohPlugin.toggleCrouch.Value)
{
return !ToggleCrouchPatches.isToggleOn;
}
return true;
}
}
internal static class AllBounceIndicators
{
internal static Dictionary<Gun, List<LineRenderer>> BounceLines = new Dictionary<Gun, List<LineRenderer>>();
internal static Dictionary<Gun, int> CachedBounces = new Dictionary<Gun, int>();
internal static LineRenderer BounceLinePrefab;
private static Color GetSelectedColor()
{
//IL_0049: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: 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)
switch (SparrohPlugin.bounceIndicatorColor.Value)
{
case BounceIndicatorColor.Orange:
return new Color(1f, 0.5f, 0f);
case BounceIndicatorColor.White:
return new Color(1f, 1f, 1f);
case BounceIndicatorColor.Green:
return new Color(0f, 1f, 0f);
case BounceIndicatorColor.Blue:
return new Color(0f, 0f, 1f);
case BounceIndicatorColor.Red:
return new Color(1f, 0f, 0f);
case BounceIndicatorColor.Yellow:
return new Color(1f, 1f, 0f);
case BounceIndicatorColor.Purple:
return new Color(1f, 0f, 1f);
case BounceIndicatorColor.Cyan:
return new Color(0f, 1f, 1f);
case BounceIndicatorColor.Custom:
{
string text = SparrohPlugin.bounceIndicatorCustomColor.Value;
if (!text.StartsWith("#"))
{
text = "#" + text;
}
Color result = default(Color);
if (ColorUtility.TryParseHtmlString(text, ref result))
{
return result;
}
return new Color(1f, 0f, 0f);
}
default:
return new Color(1f, 0f, 0f);
}
}
public static LineRenderer CreateBounceLinePrefab()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("BounceIndicatorPrefab");
LineRenderer obj = val.AddComponent<LineRenderer>();
Color selectedColor = GetSelectedColor();
Material val2 = new Material(Shader.Find("Sprites/Default"));
val2.color = selectedColor;
Color val3 = selectedColor * 0.5f;
val3.a = 1f;
val2.SetColor("_EmissionColor", val3);
((Renderer)obj).material = val2;
obj.startWidth = 0.01f;
obj.endWidth = 0.01f;
obj.startColor = selectedColor;
obj.endColor = selectedColor;
obj.positionCount = 2;
obj.useWorldSpace = true;
val.SetActive(false);
Object.DontDestroyOnLoad((Object)(object)val);
return obj;
}
}
[HarmonyPatch]
public static class GunBouncePatches
{
private static readonly PropertyInfo IsOwnerProperty = typeof(NetworkBehaviour).GetProperty("IsOwner");
private static readonly PropertyInfo ActiveProperty = typeof(Gun).GetProperty("Active");
private static int GetBounces(Gun gun)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
_ = ((object)gun).GetType().Name;
try
{
Type type = ((object)gun.GunData).GetType();
FieldInfo field = type.GetField("bounces", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
return (int)field.GetValue(gun.GunData);
}
PropertyInfo property = type.GetProperty("bounces", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (property != null)
{
return (int)property.GetValue(gun.GunData);
}
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (FieldInfo fieldInfo in fields)
{
if (fieldInfo.Name.ToLower().Contains("bounce") || fieldInfo.Name.ToLower().Contains("ricochet"))
{
object value = fieldInfo.GetValue(gun.GunData);
if (value is int result)
{
return result;
}
if (value is float num)
{
return (int)num;
}
}
}
UpgradeStatChanges val = new UpgradeStatChanges();
IEnumerator<StatInfo> enumerator = ((IGear)gun).EnumerateSecondaryStats(val);
int num2 = 0;
while (enumerator.MoveNext())
{
float result2;
if (enumerator.Current.name.ToLower().Contains("bounce"))
{
return (int)(float.TryParse(enumerator.Current.value, out result2) ? result2 : 0f);
}
num2++;
}
IEnumerator<StatInfo> enumerator2 = ((IGear)gun).EnumeratePrimaryStats(val);
num2 = 0;
while (enumerator2.MoveNext())
{
float result3;
if (enumerator2.Current.name.ToLower().Contains("bounce"))
{
return (int)(float.TryParse(enumerator2.Current.value, out result3) ? result3 : 0f);
}
num2++;
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogInfo((object)(" ERROR: GetBounces exception: " + ex.Message));
}
return 0;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Gun), "Enable")]
public static void Enable_Postfix(Gun __instance)
{
int bounces = GetBounces(__instance);
AllBounceIndicators.CachedBounces[__instance] = bounces;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Gun), "Update")]
public static void Update_Postfix(Gun __instance)
{
try
{
if ((bool)IsOwnerProperty.GetValue(__instance) && (bool)ActiveProperty.GetValue(__instance))
{
HandleBounceIndicators(__instance);
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogInfo((object)("ERROR: Update postfix failed: " + ex.Message));
}
}
private static void HandleBounceIndicators(Gun gun)
{
if (!AllBounceIndicators.CachedBounces.TryGetValue(gun, out var value))
{
value = 0;
}
bool value2 = SparrohPlugin.enableAllBounceIndicators.Value;
_ = ((object)gun).GetType().Name;
if (!value2 || value < 1)
{
return;
}
if (!AllBounceIndicators.BounceLines.ContainsKey(gun))
{
AllBounceIndicators.BounceLines[gun] = new List<LineRenderer>();
}
List<LineRenderer> list = AllBounceIndicators.BounceLines[gun];
if ((Object)(object)AllBounceIndicators.BounceLinePrefab == (Object)null)
{
AllBounceIndicators.BounceLinePrefab = AllBounceIndicators.CreateBounceLinePrefab();
}
int num = gun.GunData.bulletsPerShot * value;
while (list.Count < num)
{
LineRenderer item = Object.Instantiate<LineRenderer>(AllBounceIndicators.BounceLinePrefab);
list.Add(item);
}
Traverse obj = Traverse.Create((object)gun);
obj.Method("PrepareFireData", Array.Empty<object>()).GetValue();
object value3 = obj.Field("player").GetValue();
bool num2 = (bool)value3?.GetType().GetProperty("IsSprinting")?.GetValue(value3);
bool flag = (bool)value3?.GetType().GetProperty("IsFireLocked")?.GetValue(value3);
if (num2 || flag)
{
for (int i = 0; i < list.Count; i++)
{
if (((Component)list[i]).gameObject.activeSelf)
{
((Component)list[i]).gameObject.SetActive(false);
}
}
}
else
{
UpdateBounceLines(gun);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Gun), "Disable")]
public static void Disable_Postfix(Gun __instance)
{
if (AllBounceIndicators.BounceLines.TryGetValue(__instance, out var value))
{
for (int i = 0; i < value.Count; i++)
{
((Component)value[i]).gameObject.SetActive(false);
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Gun), "OnDestroy")]
public static void OnDestroy_Postfix(Gun __instance)
{
if (AllBounceIndicators.BounceLines.TryGetValue(__instance, out var value))
{
for (int i = 0; i < value.Count; i++)
{
if ((Object)(object)value[i] != (Object)null)
{
Object.Destroy((Object)(object)((Component)value[i]).gameObject);
}
}
AllBounceIndicators.BounceLines.Remove(__instance);
}
AllBounceIndicators.CachedBounces.Remove(__instance);
}
private static Vector3 CalculateSpreadDirection(Vector3 baseDirection, int bulletIndex, int totalBullets, Gun gun)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0403: Unknown result type (might be due to invalid IL or missing references)
//IL_0408: Unknown result type (might be due to invalid IL or missing references)
//IL_040a: Unknown result type (might be due to invalid IL or missing references)
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
//IL_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_031f: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_0327: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_0418: 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_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_038d: Unknown result type (might be due to invalid IL or missing references)
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
if (totalBullets <= 1)
{
return baseDirection;
}
Vector3 val2;
try
{
GunData gunData = gun.GunData;
object obj = ((object)gunData).GetType().GetField("spreadData")?.GetValue(gunData);
if (obj != null)
{
Type type = obj.GetType();
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
List<string> list = new List<string>();
MethodInfo[] array = methods;
foreach (MethodInfo methodInfo in array)
{
list.Add(methodInfo.Name);
}
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
List<string> list2 = new List<string>();
FieldInfo[] array2 = fields;
foreach (FieldInfo fieldInfo in array2)
{
list2.Add(fieldInfo.Name);
}
List<MethodInfo> list3 = new List<MethodInfo>();
array = methods;
foreach (MethodInfo methodInfo2 in array)
{
if (methodInfo2.Name.Contains("Spread"))
{
list3.Add(methodInfo2);
}
}
foreach (MethodInfo item in list3)
{
try
{
ParameterInfo[] parameters = item.GetParameters();
object[] array3 = null;
if (parameters.Length == 2 && parameters[0].ParameterType == typeof(int) && parameters[1].ParameterType == typeof(int))
{
array3 = new object[2] { bulletIndex, totalBullets };
}
else if (parameters.Length == 3 && parameters[0].ParameterType == typeof(Vector3) && parameters[1].ParameterType == typeof(int) && parameters[2].ParameterType == typeof(int))
{
array3 = new object[3] { baseDirection, bulletIndex, totalBullets };
}
if (array3 != null)
{
object obj2 = item.Invoke(obj, array3);
if (obj2 is Vector3)
{
Vector3 val = (Vector3)obj2;
return ((Vector3)(ref val)).normalized;
}
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogInfo((object)("Method " + item.Name + " failed: " + ex.Message));
}
}
PropertyInfo property = type.GetProperty("spreadAngle");
FieldInfo field = type.GetField("spreadAngle");
float num = 0f;
if (property != null)
{
num = (float)property.GetValue(obj);
}
else if (field != null)
{
num = (float)field.GetValue(obj);
}
if (num > 0f)
{
float num2 = num * ((float)Math.PI / 180f);
float num3 = (float)bulletIndex * ((float)Math.PI * 2f) / (float)totalBullets;
float num4 = (float)bulletIndex * num2 / (float)totalBullets;
float num5 = num4 * Mathf.Sin(num3);
val2 = new Vector3(num4 * Mathf.Cos(num3), num5, 1f);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
return Quaternion.LookRotation(baseDirection) * normalized;
}
MethodInfo method = type.GetMethod("CalculateSpread", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (method != null)
{
object obj3 = method.Invoke(obj, new object[4] { baseDirection, bulletIndex, totalBullets, gun });
if (obj3 is Vector3)
{
Vector3 val3 = (Vector3)obj3;
return ((Vector3)(ref val3)).normalized;
}
}
}
}
catch (Exception ex2)
{
SparrohPlugin.Logger.LogInfo((object)("Error examining spread data: " + ex2.Message));
}
float num6 = 15f * ((float)Math.PI / 180f);
float num7 = (float)bulletIndex * ((float)Math.PI * 2f) / (float)totalBullets;
float num8 = (float)(bulletIndex + 1) * num6 / (float)totalBullets;
float num9 = Mathf.Sin(num8);
float num10 = Mathf.Cos(num8);
val2 = new Vector3(num9 * Mathf.Cos(num7), num9 * Mathf.Sin(num7), num10);
Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
return Quaternion.LookRotation(baseDirection) * normalized2;
}
private static void UpdateBounceLines(Gun gun)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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_008d: 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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: 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_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: 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_0158: 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_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
if (!AllBounceIndicators.BounceLines.TryGetValue(gun, out var value))
{
return;
}
try
{
object value2 = Traverse.Create((object)gun).Field("fireData").GetValue();
Vector3 val = (Vector3)value2.GetType().GetField("firePosition").GetValue(value2);
Quaternion val2 = (Quaternion)value2.GetType().GetField("bulletRotation").GetValue(value2);
int bulletsPerShot = gun.GunData.bulletsPerShot;
int num = 0;
if (AllBounceIndicators.CachedBounces.TryGetValue(gun, out var value3))
{
num = value3;
}
int i = 0;
RaycastHit val6 = default(RaycastHit);
RaycastHit val7 = default(RaycastHit);
for (int j = 0; j < bulletsPerShot; j++)
{
if (i >= value.Count)
{
break;
}
Vector3 val3 = val;
Vector3 val4 = CalculateSpreadDirection(val2 * Vector3.forward, j, bulletsPerShot, gun);
Vector3 val5 = val;
if (!Physics.Raycast(val3, val4, ref val6, 50f, LayerMask.GetMask(new string[3] { "Default", "Terrain", "Environment" })))
{
continue;
}
val3 = ((RaycastHit)(ref val6)).point;
val4 = Vector3.Reflect(val4, ((RaycastHit)(ref val6)).normal);
for (int k = 0; k < num; k++)
{
if (i >= value.Count)
{
break;
}
val5 = val3;
if (Physics.Raycast(val3, val4, ref val7, 50f, LayerMask.GetMask(new string[3] { "Default", "Terrain", "Environment" })))
{
Vector3 point = ((RaycastHit)(ref val7)).point;
Vector3[] positions = (Vector3[])(object)new Vector3[2] { val5, point };
value[i].SetPositions(positions);
((Component)value[i]).gameObject.SetActive(true);
val3 = point;
val4 = Vector3.Reflect(val4, ((RaycastHit)(ref val7)).normal);
i++;
continue;
}
Vector3 val8 = val3 + val4 * 15f;
Vector3[] positions2 = (Vector3[])(object)new Vector3[2] { val5, val8 };
value[i].SetPositions(positions2);
((Component)value[i]).gameObject.SetActive(true);
i++;
break;
}
}
for (; i < value.Count; i++)
{
((Component)value[i]).gameObject.SetActive(false);
}
}
catch (Exception ex)
{
SparrohPlugin.Logger.LogInfo((object)("ERROR: UpdateBounceLines failed: " + ex.Message));
}
}
}
[CompilerGenerated]
[ExcludeFromCodeCoverage]
internal static class GitVersionInformation
{
public const string AssemblySemFileVer = "0.0.1.0";
public const string AssemblySemVer = "0.0.1.0";
public const string BranchName = "master";
public const string BuildMetaData = "";
public const string CommitDate = "2025-12-26";
public const string CommitsSinceVersionSource = "12";
public const string EscapedBranchName = "master";
public const string FullBuildMetaData = "Branch.master.Sha.cbab9723619afe7f2afbde0d59db454dfe491b33";
public const string FullSemVer = "0.0.1-12";
public const string InformationalVersion = "0.0.1-12+Branch.master.Sha.cbab9723619afe7f2afbde0d59db454dfe491b33";
public const string Major = "0";
public const string MajorMinorPatch = "0.0.1";
public const string Minor = "0";
public const string Patch = "1";
public const string PreReleaseLabel = "";
public const string PreReleaseLabelWithDash = "";
public const string PreReleaseNumber = "12";
public const string PreReleaseTag = "12";
public const string PreReleaseTagWithDash = "-12";
public const string SemVer = "0.0.1-12";
public const string Sha = "cbab9723619afe7f2afbde0d59db454dfe491b33";
public const string ShortSha = "cbab972";
public const string UncommittedChanges = "10";
public const string VersionSourceSha = "";
public const string WeightedPreReleaseNumber = "55012";
}
namespace EnhancedSettings
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "EnhancedSettings";
public const string PLUGIN_NAME = "EnhancedSettings";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}