Decompiled source of MoreHolos v1.3.2

MoreHolos.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Unity.Mono;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Shooterlatro.Core;
using Shooterlatro.Game;
using Shooterlatro.Gameplay;
using Shooterlatro.Player;
using Shooterlatro.Progression;
using Shooterlatro.Score;
using Shooterlatro.Shop;
using Shooterlatro.UI;
using Shooterlatro.Upgrades;
using Shooterlatro.Upgrades.Mechanics;
using Shooterlatro.Weapons;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreHolos")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Lucky Shot More Holos Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreHolos")]
[assembly: AssemblyTitle("MoreHolos")]
[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 MoreHolos
{
	[BepInPlugin("com.example.moreholos", "MoreHolos", "1.3.2")]
	public class MoreHolosPlugin : BaseUnityPlugin
	{
		private Harmony harmony;

		public static HoloItemData rewindHoloData;

		public static HoloItemData chronoHoloData;

		public static HoloItemData midasHoloData;

		public static HoloItemData magnetHoloData;

		public static HoloItemData ultimateRewindHoloData;

		private static float chronoSlowdownTimer;

		private static float chronoVisualTimer;

		private static bool chronoTriggeredThisRound;

		private static bool wasRoundActive;

		private void Awake()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			CreateHoloInstances();
			harmony = new Harmony("com.example.moreholos");
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreHolos loaded successfully! Added Rewind, Chrono, Midas, Magnet, and Ultimate Rewind Holos.");
		}

		public static void CreateHoloInstances()
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Expected O, but got Unknown
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: 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_031f: Expected O, but got Unknown
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Expected O, but got Unknown
			//IL_03f7: 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)
			if (!((Object)(object)rewindHoloData != (Object)null))
			{
				rewindHoloData = ScriptableObject.CreateInstance<HoloItemData>();
				rewindHoloData.catalogId = "rewind_holo";
				rewindHoloData.includeInShopSync = true;
				rewindHoloData.includeInCrateSync = true;
				rewindHoloData.isPhysical = true;
				rewindHoloData.titleKey = "Rewind Holo";
				rewindHoloData.descriptionKey = "If you miss a shot, rewinds 5 seconds back [10 second cooldown]";
				RewindHoloMechanic rewindHoloMechanic = ScriptableObject.CreateInstance<RewindHoloMechanic>();
				FieldInfo field = typeof(HoloMechanic).GetField("hudProcEnabled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null)
				{
					field.SetValue(rewindHoloMechanic, true);
				}
				rewindHoloData.mechanic = (HoloMechanic)(object)rewindHoloMechanic;
				ShopItemData val = new ShopItemData();
				val.type = (ShopItemType)0;
				val.rarity = (ItemRarity)2;
				val.cost = 7f;
				val.sellValue = 3f;
				val.nameKey = "Rewind Holo";
				val.descriptionKey = "If you miss a shot, rewinds 5 seconds back [10 second cooldown]";
				rewindHoloData.shopItem = val;
				chronoHoloData = ScriptableObject.CreateInstance<HoloItemData>();
				chronoHoloData.catalogId = "chrono_holo";
				chronoHoloData.includeInShopSync = true;
				chronoHoloData.includeInCrateSync = true;
				chronoHoloData.isPhysical = true;
				chronoHoloData.titleKey = "Chrono Holo";
				chronoHoloData.descriptionKey = "On first x10 multiplier in a round, triggers a 5s time slowdown";
				GenericHoloMechanic genericHoloMechanic = ScriptableObject.CreateInstance<GenericHoloMechanic>();
				if (field != null)
				{
					field.SetValue(genericHoloMechanic, true);
				}
				chronoHoloData.mechanic = (HoloMechanic)(object)genericHoloMechanic;
				ShopItemData val2 = new ShopItemData();
				val2.type = (ShopItemType)0;
				val2.rarity = (ItemRarity)2;
				val2.cost = 7f;
				val2.sellValue = 3f;
				val2.nameKey = "Chrono Holo";
				val2.descriptionKey = "On first x10 multiplier in a round, triggers a 5s time slowdown";
				chronoHoloData.shopItem = val2;
				midasHoloData = ScriptableObject.CreateInstance<HoloItemData>();
				midasHoloData.catalogId = "midas_holo";
				midasHoloData.includeInShopSync = true;
				midasHoloData.includeInCrateSync = true;
				midasHoloData.isPhysical = true;
				midasHoloData.titleKey = "Midas Holo";
				midasHoloData.descriptionKey = "Hit targets have 30% chance to turn gold (+50% health, awards +2 currency on kill)";
				GenericHoloMechanic genericHoloMechanic2 = ScriptableObject.CreateInstance<GenericHoloMechanic>();
				if (field != null)
				{
					field.SetValue(genericHoloMechanic2, true);
				}
				midasHoloData.mechanic = (HoloMechanic)(object)genericHoloMechanic2;
				ShopItemData val3 = new ShopItemData();
				val3.type = (ShopItemType)0;
				val3.rarity = (ItemRarity)2;
				val3.cost = 7f;
				val3.sellValue = 3f;
				val3.nameKey = "Midas Holo";
				val3.descriptionKey = "Hit targets have 30% chance to turn gold (+50% health, awards +2 currency on kill)";
				midasHoloData.shopItem = val3;
				magnetHoloData = ScriptableObject.CreateInstance<HoloItemData>();
				magnetHoloData.catalogId = "magnet_holo";
				magnetHoloData.includeInShopSync = true;
				magnetHoloData.includeInCrateSync = true;
				magnetHoloData.isPhysical = true;
				magnetHoloData.titleKey = "Magnet Holo";
				magnetHoloData.descriptionKey = "Slowly pulls active targets closer to the center of your screen";
				GenericHoloMechanic genericHoloMechanic3 = ScriptableObject.CreateInstance<GenericHoloMechanic>();
				if (field != null)
				{
					field.SetValue(genericHoloMechanic3, true);
				}
				magnetHoloData.mechanic = (HoloMechanic)(object)genericHoloMechanic3;
				ShopItemData val4 = new ShopItemData();
				val4.type = (ShopItemType)0;
				val4.rarity = (ItemRarity)2;
				val4.cost = 7f;
				val4.sellValue = 3f;
				val4.nameKey = "Magnet Holo";
				val4.descriptionKey = "Slowly pulls active targets closer to the center of your screen";
				magnetHoloData.shopItem = val4;
				ultimateRewindHoloData = ScriptableObject.CreateInstance<HoloItemData>();
				ultimateRewindHoloData.catalogId = "ultimate_rewind_holo";
				ultimateRewindHoloData.includeInShopSync = true;
				ultimateRewindHoloData.includeInCrateSync = true;
				ultimateRewindHoloData.isPhysical = true;
				ultimateRewindHoloData.titleKey = "Ultimate Rewind Holo";
				ultimateRewindHoloData.descriptionKey = "If you miss, rewinds 10s back [15s cooldown]. Pulls crosshair slightly to targets.";
				RewindHoloMechanic rewindHoloMechanic2 = ScriptableObject.CreateInstance<RewindHoloMechanic>();
				if (field != null)
				{
					field.SetValue(rewindHoloMechanic2, true);
				}
				ultimateRewindHoloData.mechanic = (HoloMechanic)(object)rewindHoloMechanic2;
				ShopItemData val5 = new ShopItemData();
				val5.type = (ShopItemType)0;
				val5.rarity = (ItemRarity)4;
				val5.cost = 10f;
				val5.sellValue = 5f;
				val5.nameKey = "Ultimate Rewind Holo";
				val5.descriptionKey = "If you miss, rewinds 10s back [15s cooldown]. Pulls crosshair slightly to targets.";
				ultimateRewindHoloData.shopItem = val5;
			}
		}

		private void Update()
		{
			//IL_01c8: 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_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: 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_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: 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_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: 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_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: 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_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: 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_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0537: Unknown result type (might be due to invalid IL or missing references)
			//IL_059e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: 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)
			bool flag = (Object)(object)GameManager.Instance != (Object)null && GameManager.Instance.IsRoundActive;
			if (flag && !wasRoundActive)
			{
				chronoTriggeredThisRound = false;
				chronoSlowdownTimer = 0f;
				chronoVisualTimer = 0f;
			}
			wasRoundActive = flag;
			if (flag && (IsRewindHoloEquipped() || IsHoloEquipped("ultimate_rewind_holo")))
			{
				if (Time.unscaledTime - RewindHoloMechanic.lastSnapshotTime >= 0.1f)
				{
					RewindHoloMechanic.lastSnapshotTime = Time.unscaledTime;
					RewindHoloMechanic.RecordSnapshot();
				}
			}
			else if (RewindHoloMechanic.snapshots.Count > 0)
			{
				RewindHoloMechanic.snapshots.Clear();
			}
			if (flag && IsHoloEquipped("chrono_holo") && !chronoTriggeredThisRound && (Object)(object)ScoreManager.Instance != (Object)null && ScoreManager.Instance.StreakBonus >= 10f)
			{
				chronoTriggeredThisRound = true;
				chronoSlowdownTimer = 5f;
				chronoVisualTimer = 5f;
				Time.timeScale = 0.4f;
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Chrono Holo triggered! Time slowed down to 0.4x.");
			}
			if (chronoSlowdownTimer > 0f)
			{
				if (flag)
				{
					if (Time.timeScale > 0f)
					{
						Time.timeScale = 0.4f;
						chronoSlowdownTimer -= Time.unscaledDeltaTime;
						if (chronoSlowdownTimer <= 0f)
						{
							Time.timeScale = 1f;
							((BaseUnityPlugin)this).Logger.LogInfo((object)"Chrono Holo slowdown ended.");
						}
					}
				}
				else
				{
					chronoSlowdownTimer = 0f;
					chronoVisualTimer = 0f;
					if (Time.timeScale > 0f)
					{
						Time.timeScale = 1f;
					}
				}
			}
			Target[] array;
			if (flag && IsHoloEquipped("magnet_holo"))
			{
				Weapon instance = Weapon.Instance;
				if ((Object)(object)instance != (Object)null && (Object)(object)instance.AimCamera != (Object)null)
				{
					Camera aimCamera = instance.AimCamera;
					Vector3 position = ((Component)aimCamera).transform.position;
					Vector3 forward = ((Component)aimCamera).transform.forward;
					array = Object.FindObjectsByType<Target>((FindObjectsSortMode)0);
					foreach (Target val in array)
					{
						if ((Object)(object)val != (Object)null && val.IsAlive)
						{
							Vector3 val2 = Vector3.Project(((Component)val).transform.position - position, forward);
							Vector3 val3 = position + val2;
							Vector3 val4 = val3 - ((Component)val).transform.position;
							if (((Vector3)(ref val4)).magnitude > 0.01f)
							{
								((Component)val).transform.position = Vector3.Lerp(((Component)val).transform.position, val3, 1f * Time.deltaTime);
							}
						}
					}
				}
			}
			if (!flag || !IsHoloEquipped("ultimate_rewind_holo"))
			{
				return;
			}
			PlayerCameraController val5 = Object.FindAnyObjectByType<PlayerCameraController>();
			Weapon instance2 = Weapon.Instance;
			if (!((Object)(object)val5 != (Object)null) || !((Object)(object)instance2 != (Object)null) || !((Object)(object)instance2.AimCamera != (Object)null) || !((Behaviour)val5).isActiveAndEnabled)
			{
				return;
			}
			Camera aimCamera2 = instance2.AimCamera;
			Target[] array2 = Object.FindObjectsByType<Target>((FindObjectsSortMode)0);
			Target val6 = null;
			float num = float.MaxValue;
			array = array2;
			foreach (Target val7 in array)
			{
				if ((Object)(object)val7 != (Object)null && val7.IsAlive)
				{
					Vector3 val8 = ((Component)val7).transform.position - ((Component)aimCamera2).transform.position;
					Vector3 normalized = ((Vector3)(ref val8)).normalized;
					float num2 = Vector3.Angle(((Component)aimCamera2).transform.forward, normalized);
					if (num2 < num && num2 < 25f)
					{
						num = num2;
						val6 = val7;
					}
				}
			}
			if (!((Object)(object)val6 != (Object)null))
			{
				return;
			}
			MethodInfo method = typeof(PlayerCameraController).GetMethod("GetAimAngleToWorldPoint", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (!(method != null))
			{
				return;
			}
			Vector3 position2 = ((Component)val6).transform.position;
			if (!(method.Invoke(val5, new object[1] { position2 }) is Vector2 val9))
			{
				return;
			}
			float x = val9.x;
			float y = val9.y;
			FieldInfo field = typeof(PlayerCameraController).GetField("_yaw", BindingFlags.Instance | BindingFlags.NonPublic);
			FieldInfo field2 = typeof(PlayerCameraController).GetField("_pitch", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null && field2 != null)
			{
				float num3 = (float)field.GetValue(val5);
				float num4 = (float)field2.GetValue(val5);
				float num5 = 4f * Time.deltaTime;
				float num6 = Mathf.LerpAngle(num3, x, num5);
				float num7 = Mathf.Lerp(num4, y, num5);
				field.SetValue(val5, num6);
				field2.SetValue(val5, num7);
				bool num8 = (bool)typeof(PlayerCameraController).GetField("limitRotation", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).GetValue(val5);
				float num9 = (float)typeof(PlayerCameraController).GetField("maxYawDegrees", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).GetValue(val5);
				float num10 = (float)typeof(PlayerCameraController).GetField("maxPitchDegrees", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).GetValue(val5);
				Quaternion val10 = (Quaternion)typeof(PlayerCameraController).GetField("_startRotation", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val5);
				if (num8)
				{
					num6 = Mathf.Clamp(num6, 0f - num9, num9);
					num7 = Mathf.Clamp(num7, 0f - num10, num10);
					field.SetValue(val5, num6);
					field2.SetValue(val5, num7);
				}
				else
				{
					num7 = Mathf.Clamp(num7, -89f, 89f);
					field2.SetValue(val5, num7);
				}
				Quaternion val11 = Quaternion.AngleAxis(num6, Vector3.up);
				Quaternion val12 = Quaternion.AngleAxis(num7, Vector3.right);
				((Component)val5).transform.localRotation = val10 * val11 * val12;
			}
		}

		public static bool IsHoloEquipped(string catalogId)
		{
			if ((Object)(object)HoloItemManager.Instance == (Object)null)
			{
				return false;
			}
			try
			{
				FieldInfo field = typeof(HoloItemManager).GetField("_equipped", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null && field.GetValue(HoloItemManager.Instance) is IEnumerable enumerable)
				{
					foreach (object item in enumerable)
					{
						if (item == null)
						{
							continue;
						}
						FieldInfo field2 = item.GetType().GetField("Data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
						if (field2 != null)
						{
							object? value = field2.GetValue(item);
							HoloItemData val = (HoloItemData)((value is HoloItemData) ? value : null);
							if ((Object)(object)val != (Object)null && val.catalogId == catalogId)
							{
								return true;
							}
						}
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[MoreHolos] Error checking equipped holos: " + ex.Message));
			}
			return false;
		}

		public static bool IsRewindHoloEquipped()
		{
			return IsHoloEquipped("rewind_holo");
		}

		private void OnGUI()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: 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_0320: Expected O, but got Unknown
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Expected O, but got Unknown
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_013b: 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_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			if (RewindHoloMechanic.rewindVisualTimer > 0f)
			{
				float num = RewindHoloMechanic.rewindVisualTimer / 2.5f;
				Color color = GUI.color;
				float num2 = Mathf.PingPong(RewindHoloMechanic.rewindVisualTimer * 4f, 1f);
				float num3 = 0.2f * num + 0.1f * num2 * num;
				if (RewindHoloMechanic.isUltimateRewindActive)
				{
					GUI.color = new Color(1f, 0f, 0.15f, num3);
				}
				else
				{
					GUI.color = new Color(0f, 0.75f, 1f, num3);
				}
				GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = color;
				for (int i = 0; i < 3; i++)
				{
					float num4 = (Mathf.Sin(RewindHoloMechanic.rewindVisualTimer * 12f + (float)i * 2f) * 0.5f + 0.5f) * (float)Screen.height;
					float num5 = Random.Range(3f, 12f);
					Color color2 = GUI.color;
					if (RewindHoloMechanic.isUltimateRewindActive)
					{
						GUI.color = new Color(1f, 0.1f, 0.1f, num * 0.15f);
					}
					else
					{
						GUI.color = new Color(0f, 0.8f, 1f, num * 0.12f);
					}
					GUI.DrawTexture(new Rect(0f, num4, (float)Screen.width, num5), (Texture)(object)Texture2D.whiteTexture);
					GUI.color = color2;
				}
				GUIStyle val = new GUIStyle(GUI.skin.label);
				val.alignment = (TextAnchor)4;
				int num6 = 36;
				float num7 = 1f + Mathf.Sin(RewindHoloMechanic.rewindVisualTimer * 10f) * 0.15f;
				val.fontSize = (int)((float)num6 * num7);
				val.fontStyle = (FontStyle)1;
				if (RewindHoloMechanic.isUltimateRewindActive)
				{
					val.normal.textColor = new Color(1f, 0.2f, 0.2f, num);
				}
				else
				{
					val.normal.textColor = new Color(1f, 1f, 1f, num);
				}
				GUIStyle val2 = new GUIStyle(val);
				val2.normal.textColor = new Color(0f, 0f, 0f, num * 0.7f);
				string text = (RewindHoloMechanic.isUltimateRewindActive ? "<< ULTIMATE TEMPORAL REWIND >>" : "<< REWINDING TIME >>");
				GUI.Label(new Rect(2f, 2f, (float)Screen.width, (float)Screen.height), text, val2);
				GUI.Label(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), text, val);
				RewindHoloMechanic.rewindVisualTimer -= Time.unscaledDeltaTime;
			}
			if (chronoVisualTimer > 0f)
			{
				Color color3 = GUI.color;
				GUI.color = new Color(0.5f, 0f, 1f, chronoVisualTimer / 5f * 0.2f);
				GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = color3;
				GUIStyle val3 = new GUIStyle(GUI.skin.label);
				val3.alignment = (TextAnchor)4;
				val3.fontSize = 28;
				val3.fontStyle = (FontStyle)0;
				val3.normal.textColor = new Color(0.7f, 0.3f, 1f, chronoVisualTimer / 5f);
				GUIStyle val4 = new GUIStyle(val3);
				val4.normal.textColor = new Color(0f, 0f, 0f, chronoVisualTimer / 5f * 0.7f);
				float num8 = 300f;
				float num9 = 50f;
				float num10 = ((float)Screen.width - num8) / 2f;
				float num11 = (float)Screen.height - 100f;
				GUI.Label(new Rect(num10 + 2f, num11 + 2f, num8, num9), "slowdown..", val4);
				GUI.Label(new Rect(num10, num11, num8, num9), "slowdown..", val3);
				if (Time.timeScale > 0f)
				{
					chronoVisualTimer -= Time.unscaledDeltaTime;
				}
			}
		}

		private void OnDestroy()
		{
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	public class MidasGoldComponent : MonoBehaviour
	{
		private SpriteRenderer sr;

		private void Start()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			sr = ((Component)this).GetComponentInChildren<SpriteRenderer>();
			if ((Object)(object)sr != (Object)null)
			{
				sr.color = new Color(1f, 0.85f, 0f, 1f);
			}
		}

		private void Update()
		{
			//IL_0014: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)sr != (Object)null && sr.color != new Color(1f, 0.85f, 0f, 1f))
			{
				sr.color = new Color(1f, 0.85f, 0f, 1f);
			}
		}

		private void OnDisable()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)sr != (Object)null)
			{
				sr.color = Color.white;
			}
			Object.Destroy((Object)(object)this);
		}
	}
	[HarmonyPatch(typeof(HoloCatalogDatabase), "LoadDefault")]
	internal class HoloCatalogDatabasePatch
	{
		private static void Postfix(HoloCatalogDatabase __result)
		{
			if (!((Object)(object)__result != (Object)null))
			{
				return;
			}
			MoreHolosPlugin.CreateHoloInstances();
			List<HoloItemData> obj = new List<HoloItemData>
			{
				MoreHolosPlugin.rewindHoloData,
				MoreHolosPlugin.chronoHoloData,
				MoreHolosPlugin.midasHoloData,
				MoreHolosPlugin.magnetHoloData,
				MoreHolosPlugin.ultimateRewindHoloData
			};
			List<HoloItemData> list = new List<HoloItemData>(__result.Holos);
			bool flag = false;
			foreach (HoloItemData holo in obj)
			{
				if ((Object)(object)holo == (Object)null || list.Any((HoloItemData h) => (Object)(object)h != (Object)null && h.catalogId == holo.catalogId))
				{
					continue;
				}
				if (__result.Holos.Count > 0)
				{
					HoloItemData val = __result.Holos[0];
					if (val.shopItem != null && holo.shopItem != null)
					{
						holo.shopItem.icon = val.shopItem.icon;
						holo.shopItem.animationProfile = val.shopItem.animationProfile;
					}
					holo.physicalPrefab = val.physicalPrefab;
					holo.equipVFX = val.equipVFX;
					holo.activateVFX = val.activateVFX;
					holo.deactivateVFX = val.deactivateVFX;
				}
				list.Add(holo);
				flag = true;
				Debug.Log((object)("[MoreHolos] Successfully injected " + holo.catalogId + " into catalog database!"));
			}
			if (flag)
			{
				__result.SetHolos(list);
			}
		}
	}
	[HarmonyPatch(typeof(ShopManager), "RebuildRuntimeItems")]
	internal class ShopManagerRebuildRuntimeItemsPatch
	{
		private static void Prefix(ShopManager __instance)
		{
			if (!((Object)(object)__instance != (Object)null))
			{
				return;
			}
			MoreHolosPlugin.CreateHoloInstances();
			FieldInfo field = typeof(ShopManager).GetField("shopItemAssets", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(field != null) || !(field.GetValue(__instance) is List<ScriptableObject> list))
			{
				return;
			}
			List<HoloItemData> list2 = new List<HoloItemData>
			{
				MoreHolosPlugin.rewindHoloData,
				MoreHolosPlugin.chronoHoloData,
				MoreHolosPlugin.midasHoloData,
				MoreHolosPlugin.magnetHoloData,
				MoreHolosPlugin.ultimateRewindHoloData
			};
			HoloItemData val = null;
			foreach (ScriptableObject item in list)
			{
				HoloItemData val2 = (HoloItemData)(object)((item is HoloItemData) ? item : null);
				if ((Object)(object)val2 != (Object)null && val2.shopItem != null)
				{
					val = val2;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				HoloItemData[] array = Resources.FindObjectsOfTypeAll<HoloItemData>();
				foreach (HoloItemData val3 in array)
				{
					if ((Object)(object)val3 != (Object)null && val3.shopItem != null)
					{
						val = val3;
						break;
					}
				}
			}
			foreach (HoloItemData item2 in list2)
			{
				if ((Object)(object)item2 != (Object)null)
				{
					if ((Object)(object)val != (Object)null && item2.shopItem != null && (Object)(object)item2.shopItem.icon == (Object)null)
					{
						item2.shopItem.icon = val.shopItem.icon;
						item2.shopItem.animationProfile = val.shopItem.animationProfile;
						item2.physicalPrefab = val.physicalPrefab;
						item2.equipVFX = val.equipVFX;
						item2.activateVFX = val.activateVFX;
						item2.deactivateVFX = val.deactivateVFX;
					}
					if (!list.Contains((ScriptableObject)(object)item2))
					{
						list.Add((ScriptableObject)(object)item2);
						Debug.Log((object)("[MoreHolos] Injected " + item2.catalogId + " into shopItemAssets!"));
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(CrateManager), "OpenCrate", new Type[]
	{
		typeof(CrateItemData),
		typeof(bool),
		typeof(bool),
		typeof(bool)
	})]
	internal class CrateManagerOpenCratePatch
	{
		private static void Prefix(CrateItemData crateData)
		{
			if (!((Object)(object)crateData != (Object)null) || crateData.candidateHolos == null)
			{
				return;
			}
			MoreHolosPlugin.CreateHoloInstances();
			foreach (HoloItemData item in new List<HoloItemData>
			{
				MoreHolosPlugin.rewindHoloData,
				MoreHolosPlugin.chronoHoloData,
				MoreHolosPlugin.midasHoloData,
				MoreHolosPlugin.magnetHoloData,
				MoreHolosPlugin.ultimateRewindHoloData
			})
			{
				if ((Object)(object)item != (Object)null && !crateData.candidateHolos.Contains(item))
				{
					crateData.candidateHolos.Add(item);
					Debug.Log((object)("[MoreHolos] Dynamically injected " + item.catalogId + " into crate candidate pool!"));
				}
			}
		}
	}
	[HarmonyPatch(typeof(ShopEntryView), "ResolveHoloRarityColor")]
	internal class ResolveHoloRarityColorPatch
	{
		private static bool Prefix(ItemRarity rarity, ref Color __result)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0019: 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)
			if ((int)rarity == 4)
			{
				__result = new Color(1f, 0.08f, 0.08f, 1f);
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(CrateOpeningUI), "ResolveRarityColor")]
	internal class CrateResolveRarityColorPatch
	{
		private static bool Prefix(ItemRarity rarity, ref Color __result)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0019: 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)
			if ((int)rarity == 4)
			{
				__result = new Color(1f, 0.08f, 0.08f, 1f);
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(ShopPresentation), "GetDisplayRarity")]
	internal class GetDisplayRarityPatch
	{
		private static bool Prefix(ItemRarity rarity, ref string __result)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			if ((int)rarity == 4)
			{
				__result = "Mythic";
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(ShopEntryView), "ResolveHoloMaterial")]
	internal class ResolveHoloMaterialPatch
	{
		private static bool Prefix(ShopEntryView __instance, ItemRarity rarity, ref Material __result)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			if ((int)rarity == 4 && (Object)(object)__instance != (Object)null)
			{
				FieldInfo field = typeof(ShopEntryView).GetField("legendaryHoloIconMaterial", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null)
				{
					object? value = field.GetValue(__instance);
					__result = (Material)((value is Material) ? value : null);
					return false;
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(RarityMaterialPalette), "Resolve")]
	internal class PaletteResolvePatch
	{
		private static bool Prefix(RarityMaterialPalette __instance, ItemRarity rarity, ref Material __result)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			if ((int)rarity == 4 && (Object)(object)__instance != (Object)null)
			{
				FieldInfo field = typeof(RarityMaterialPalette).GetField("legendary", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null)
				{
					object? value = field.GetValue(__instance);
					__result = (Material)((value is Material) ? value : null);
					return false;
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Weapon), "OnBulletMissRegistered")]
	internal class BulletMissPatch
	{
		private static void Postfix()
		{
			if (MoreHolosPlugin.IsRewindHoloEquipped() || MoreHolosPlugin.IsHoloEquipped("ultimate_rewind_holo"))
			{
				RewindHoloMechanic.TriggerRewind();
			}
		}
	}
	[HarmonyPatch(typeof(Target), "OnShotHit")]
	internal class TargetOnShotHitPatch
	{
		private static void Postfix(Target __instance, ShotHitContext context)
		{
			if ((Object)(object)__instance == (Object)null || !__instance.IsAlive || !MoreHolosPlugin.IsHoloEquipped("midas_holo") || !((Object)(object)((Component)__instance).GetComponent<MidasGoldComponent>() == (Object)null) || !(Random.value < 0.3f))
			{
				return;
			}
			((Component)__instance).gameObject.AddComponent<MidasGoldComponent>();
			FieldInfo field = typeof(Target).GetField("_lifetime", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(field != null))
			{
				return;
			}
			object? value = field.GetValue(__instance);
			TargetLifetime val = (TargetLifetime)((value is TargetLifetime) ? value : null);
			if ((Object)(object)val != (Object)null)
			{
				FieldInfo field2 = typeof(TargetLifetime).GetField("_hp", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field2 != null)
				{
					float num = (float)field2.GetValue(val);
					field2.SetValue(val, num * 1.5f);
					Debug.Log((object)$"[MoreHolos] Midas Holo: Target turned gold! HP increased to {num * 1.5f}");
				}
			}
		}
	}
	[HarmonyPatch(typeof(TargetManager), "HandleTargetKilled")]
	internal class TargetManagerHandleTargetKilledPatch
	{
		private static void Prefix(TargetKilledContext context)
		{
			if (context == null || (Object)(object)context.Target == (Object)null)
			{
				return;
			}
			Target component = context.Target.GetComponent<Target>();
			if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).GetComponent<MidasGoldComponent>() != (Object)null)
			{
				if ((Object)(object)ScoreManager.Instance != (Object)null)
				{
					ScoreManager.Instance.AddCurrency(2);
					Debug.Log((object)"[MoreHolos] Midas Holo: Gold target destroyed! Awarded +2 currency.");
				}
				FieldInfo field = typeof(Target).GetField("_isShiny", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					field.SetValue(component, false);
				}
			}
		}
	}
	public class GenericHoloMechanic : HoloMechanic
	{
	}
	public struct TargetSnapshot
	{
		public int instanceId;

		public Vector3 position;

		public float hp;

		public float lifetimeTimer;
	}
	public struct Snapshot
	{
		public float timestamp;

		public float remainingSeconds;

		public float yaw;

		public float pitch;

		public double score;

		public float multiplier;

		public int currency;

		public int consecutiveMisses;

		public int ppm_roundShotsMissed;

		public int ppm_roundTargetsDestroyed;

		public int ppm_roundNormalShotsFired;

		public int ppm_roundNormalShotsMissed;

		public int ppm_roundSpecialShotsFired;

		public int ppm_roundSpecialShotsMissed;

		public List<BulletItemData> magazine;

		public List<TargetSnapshot> targets;
	}
	public class RewindHoloMechanic : HoloMechanic, IHoloShotMissed
	{
		public static List<Snapshot> snapshots = new List<Snapshot>();

		public static float lastSnapshotTime = 0f;

		public static float lastRewindTime = -99f;

		public static float rewindVisualTimer = 0f;

		public static bool isUltimateRewindActive = false;

		public void OnShotMissed(ShotMissedContext ctx)
		{
			TriggerRewind();
		}

		public static void RecordSnapshot()
		{
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GameManager.Instance == (Object)null || !GameManager.Instance.IsRoundActive)
			{
				return;
			}
			Weapon instance = Weapon.Instance;
			PlayerCameraController val = Object.FindAnyObjectByType<PlayerCameraController>();
			ScoreManager instance2 = ScoreManager.Instance;
			PlayerProgressManager instance3 = PlayerProgressManager.Instance;
			FairTargetSpawner val2 = Object.FindAnyObjectByType<FairTargetSpawner>();
			if ((Object)(object)instance == (Object)null || (Object)(object)val == (Object)null || (Object)(object)instance2 == (Object)null || (Object)(object)instance3 == (Object)null || (Object)(object)val2 == (Object)null)
			{
				return;
			}
			float yaw = 0f;
			float pitch = 0f;
			FieldInfo field = typeof(PlayerCameraController).GetField("_yaw", BindingFlags.Instance | BindingFlags.NonPublic);
			FieldInfo field2 = typeof(PlayerCameraController).GetField("_pitch", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				yaw = (float)field.GetValue(val);
			}
			if (field2 != null)
			{
				pitch = (float)field2.GetValue(val);
			}
			int progressField = GetProgressField(instance3, "_roundShotsMissed");
			int progressField2 = GetProgressField(instance3, "_roundTargetsDestroyed");
			int progressField3 = GetProgressField(instance3, "_roundNormalShotsFired");
			int progressField4 = GetProgressField(instance3, "_roundNormalShotsMissed");
			int progressField5 = GetProgressField(instance3, "_roundSpecialShotsFired");
			int progressField6 = GetProgressField(instance3, "_roundSpecialShotsMissed");
			List<TargetSnapshot> list = new List<TargetSnapshot>();
			Target[] array = Object.FindObjectsByType<Target>((FindObjectsSortMode)0);
			foreach (Target val3 in array)
			{
				if (!((Object)(object)val3 != (Object)null) || !((Component)val3).gameObject.activeInHierarchy || !val3.IsAlive)
				{
					continue;
				}
				float hp = 1f;
				float lifetimeTimer = 0f;
				FieldInfo field3 = typeof(Target).GetField("_lifetime", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field3 != null)
				{
					object? value = field3.GetValue(val3);
					TargetLifetime val4 = (TargetLifetime)((value is TargetLifetime) ? value : null);
					if ((Object)(object)val4 != (Object)null)
					{
						FieldInfo field4 = typeof(TargetLifetime).GetField("_hp", BindingFlags.Instance | BindingFlags.NonPublic);
						FieldInfo field5 = typeof(TargetLifetime).GetField("_timer", BindingFlags.Instance | BindingFlags.NonPublic);
						if (field4 != null)
						{
							hp = (float)field4.GetValue(val4);
						}
						if (field5 != null)
						{
							lifetimeTimer = (float)field5.GetValue(val4);
						}
					}
				}
				list.Add(new TargetSnapshot
				{
					instanceId = ((Object)((Component)val3).gameObject).GetInstanceID(),
					position = ((Component)val3).transform.position,
					hp = hp,
					lifetimeTimer = lifetimeTimer
				});
			}
			List<BulletItemData> list2 = new List<BulletItemData>();
			if (instance.BulletMagazine != null)
			{
				list2.AddRange(instance.BulletMagazine);
			}
			float num = 60f;
			FieldInfo field6 = typeof(FairTargetSpawner).GetField("roundDurationSeconds", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field6 != null)
			{
				num = (float)field6.GetValue(val2);
			}
			float remainingSeconds = num;
			FieldInfo field7 = typeof(FairTargetSpawner).GetField("_roundTimer", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field7 != null)
			{
				float num2 = (float)field7.GetValue(val2);
				remainingSeconds = Mathf.Max(0f, num - num2);
			}
			int consecutiveMisses = 0;
			FieldInfo field8 = typeof(ScoreManager).GetField("_consecutiveMisses", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field8 != null)
			{
				consecutiveMisses = (int)field8.GetValue(instance2);
			}
			Snapshot item = new Snapshot
			{
				timestamp = Time.unscaledTime,
				remainingSeconds = remainingSeconds,
				yaw = yaw,
				pitch = pitch,
				score = instance2.CurrentScore,
				multiplier = instance2.StreakBonus,
				currency = instance2.Currency,
				consecutiveMisses = consecutiveMisses,
				ppm_roundShotsMissed = progressField,
				ppm_roundTargetsDestroyed = progressField2,
				ppm_roundNormalShotsFired = progressField3,
				ppm_roundNormalShotsMissed = progressField4,
				ppm_roundSpecialShotsFired = progressField5,
				ppm_roundSpecialShotsMissed = progressField6,
				magazine = list2,
				targets = list
			};
			snapshots.Add(item);
			float num3 = (MoreHolosPlugin.IsHoloEquipped("ultimate_rewind_holo") ? 10f : 5f);
			while (snapshots.Count > 0 && Time.unscaledTime - snapshots[0].timestamp > num3)
			{
				snapshots.RemoveAt(0);
			}
		}

		public static void TriggerRewind()
		{
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			bool flag = MoreHolosPlugin.IsHoloEquipped("ultimate_rewind_holo");
			float num = (flag ? 15f : 10f);
			if (Time.unscaledTime - lastRewindTime < num || snapshots.Count == 0)
			{
				return;
			}
			lastRewindTime = Time.unscaledTime;
			rewindVisualTimer = 2.5f;
			isUltimateRewindActive = flag;
			Snapshot snapshot = snapshots[0];
			snapshots.Clear();
			Weapon instance = Weapon.Instance;
			PlayerCameraController val = Object.FindAnyObjectByType<PlayerCameraController>();
			ScoreManager instance2 = ScoreManager.Instance;
			PlayerProgressManager instance3 = PlayerProgressManager.Instance;
			FairTargetSpawner val2 = Object.FindAnyObjectByType<FairTargetSpawner>();
			if ((Object)(object)val != (Object)null)
			{
				FieldInfo field = typeof(PlayerCameraController).GetField("_yaw", BindingFlags.Instance | BindingFlags.NonPublic);
				FieldInfo field2 = typeof(PlayerCameraController).GetField("_pitch", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					field.SetValue(val, snapshot.yaw);
				}
				if (field2 != null)
				{
					field2.SetValue(val, snapshot.pitch);
				}
			}
			if ((Object)(object)val2 != (Object)null)
			{
				FieldInfo field3 = typeof(FairTargetSpawner).GetField("_roundTimer", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field3 != null)
				{
					float num2 = 60f;
					FieldInfo field4 = typeof(FairTargetSpawner).GetField("roundDurationSeconds", BindingFlags.Instance | BindingFlags.NonPublic);
					if (field4 != null)
					{
						num2 = (float)field4.GetValue(val2);
					}
					float num3 = Mathf.Max(0f, num2 - snapshot.remainingSeconds);
					field3.SetValue(val2, num3);
				}
			}
			if ((Object)(object)instance != (Object)null)
			{
				FieldInfo field5 = typeof(Weapon).GetField("_bulletMagazine", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field5 != null)
				{
					field5.SetValue(instance, new List<BulletItemData>(snapshot.magazine));
				}
				MethodInfo method = typeof(Weapon).GetMethod("PublishAmmoChanged", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (method != null)
				{
					method.Invoke(instance, null);
				}
			}
			if ((Object)(object)instance2 != (Object)null)
			{
				FieldInfo field6 = typeof(ScoreManager).GetField("currentScore", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldInfo field7 = typeof(ScoreManager).GetField("streakBonus", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldInfo field8 = typeof(ScoreManager).GetField("currency", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldInfo field9 = typeof(ScoreManager).GetField("_consecutiveMisses", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field6 != null)
				{
					field6.SetValue(instance2, snapshot.score);
				}
				if (field7 != null)
				{
					field7.SetValue(instance2, snapshot.multiplier);
				}
				if (field8 != null)
				{
					field8.SetValue(instance2, snapshot.currency);
				}
				if (field9 != null)
				{
					field9.SetValue(instance2, snapshot.consecutiveMisses);
				}
				MethodInfo method2 = typeof(ScoreManager).GetMethod("UpdateDecoys", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				MethodInfo method3 = typeof(ScoreManager).GetMethod("RefreshIntegrityStamp", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (method2 != null)
				{
					method2.Invoke(instance2, null);
				}
				if (method3 != null)
				{
					method3.Invoke(instance2, null);
				}
			}
			if ((Object)(object)instance3 != (Object)null)
			{
				SetProgressField(instance3, "_roundShotsMissed", snapshot.ppm_roundShotsMissed);
				SetProgressField(instance3, "_roundTargetsDestroyed", snapshot.ppm_roundTargetsDestroyed);
				SetProgressField(instance3, "_roundNormalShotsFired", snapshot.ppm_roundNormalShotsFired);
				SetProgressField(instance3, "_roundNormalShotsMissed", snapshot.ppm_roundNormalShotsMissed);
				SetProgressField(instance3, "_roundSpecialShotsFired", snapshot.ppm_roundSpecialShotsFired);
				SetProgressField(instance3, "_roundSpecialShotsMissed", snapshot.ppm_roundSpecialShotsMissed);
			}
			Target[] array = Object.FindObjectsByType<Target>((FindObjectsSortMode)0);
			Dictionary<int, TargetSnapshot> dictionary = new Dictionary<int, TargetSnapshot>();
			foreach (TargetSnapshot target in snapshot.targets)
			{
				dictionary[target.instanceId] = target;
			}
			Target[] array2 = array;
			foreach (Target val3 in array2)
			{
				if (!((Object)(object)val3 != (Object)null) || !((Component)val3).gameObject.activeInHierarchy || !val3.IsAlive)
				{
					continue;
				}
				int instanceID = ((Object)((Component)val3).gameObject).GetInstanceID();
				if (!dictionary.TryGetValue(instanceID, out var value))
				{
					continue;
				}
				((Component)val3).transform.position = value.position;
				FieldInfo field10 = typeof(Target).GetField("_lifetime", BindingFlags.Instance | BindingFlags.NonPublic);
				if (!(field10 != null))
				{
					continue;
				}
				object? value2 = field10.GetValue(val3);
				TargetLifetime val4 = (TargetLifetime)((value2 is TargetLifetime) ? value2 : null);
				if ((Object)(object)val4 != (Object)null)
				{
					FieldInfo field11 = typeof(TargetLifetime).GetField("_hp", BindingFlags.Instance | BindingFlags.NonPublic);
					FieldInfo field12 = typeof(TargetLifetime).GetField("_timer", BindingFlags.Instance | BindingFlags.NonPublic);
					if (field11 != null)
					{
						field11.SetValue(val4, value.hp);
					}
					if (field12 != null)
					{
						field12.SetValue(val4, value.lifetimeTimer);
					}
				}
			}
			Debug.Log((object)$"[MoreHolos] Rewind Holo triggered! Restored state from {(flag ? 10f : 5f)} seconds ago.");
		}

		private static int GetProgressField(PlayerProgressManager ppm, string fieldName)
		{
			FieldInfo field = typeof(PlayerProgressManager).GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				return (int)field.GetValue(ppm);
			}
			return 0;
		}

		private static void SetProgressField(PlayerProgressManager ppm, string fieldName, int value)
		{
			FieldInfo field = typeof(PlayerProgressManager).GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(ppm, value);
			}
		}
	}
}