Decompiled source of Snapshot v1.3.0

Snapshot-SilkSong.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Media;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GlobalEnums;
using HarmonyLib;
using HutongGames.PlayMaker;
using Snapshot;
using Snapshot_SilkSong.BattleState;
using Snapshot_SilkSong.BossState;
using Snapshot_SilkSong.CocoonState;
using Snapshot_SilkSong.EnemyState;
using Snapshot_SilkSong.PlayerState;
using Snapshot_SilkSong.SceneState;
using Snapshot_SilkSong.States;
using Snapshot_SilkSong.Utils;
using Snapshot_SilkSong.Utils.Snapshot_SilkSong.Patches;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Snapshot-SilkSong")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Snapshot-SilkSong")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f85d419e-1185-482b-b0ea-8b3437cbf87b")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.3.0.0")]
public static class DeepCopier
{
	public static T DeepCopy<T>(T obj)
	{
		if (obj == null)
		{
			return default(T);
		}
		if (obj.GetType().IsValueType || obj is string)
		{
			return obj;
		}
		try
		{
			using MemoryStream memoryStream = new MemoryStream();
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			((IFormatter)binaryFormatter).Serialize((Stream)memoryStream, (object)obj);
			memoryStream.Seek(0L, SeekOrigin.Begin);
			return (T)((IFormatter)binaryFormatter).Deserialize((Stream)memoryStream);
		}
		catch (Exception ex)
		{
			throw new InvalidOperationException("Deep Copy failed: " + ex.Message, ex);
		}
	}
}
namespace Snapshot
{
	public class MemorySnapshot
	{
		public PlayerState playerState;

		public SceneState sceneState;

		public EnemyState enemyState;

		public BattleState battleState;

		public PersistentState persistentState;

		public BossState bossState;

		public CocoonState cocoonState;

		public bool isActive;

		public DateTime timestamp;

		public MemorySnapshot()
		{
			playerState = new PlayerState();
			sceneState = new SceneState();
			enemyState = new EnemyState();
			battleState = new BattleState();
			persistentState = new PersistentState();
			bossState = new BossState();
			cocoonState = new CocoonState();
			isActive = false;
			timestamp = DateTime.Now;
		}
	}
	public class Manager
	{
		[CompilerGenerated]
		private sealed class <EnableFsmAfterDelay>d__4 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <EnableFsmAfterDelay>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					StateController.IsFsmEnabled = true;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LoadCoroutine>d__6 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Manager <>4__this;

			public string slotName;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadCoroutine>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_014d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0157: Expected O, but got Unknown
				int num = <>1__state;
				Manager manager = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					manager.loadCoroutineRunning = true;
					Debug.Log((object)"Start to load the Snapshot");
					StateController.IsFsmEnabled = false;
					<>2__current = SceneState.LoadSceneStateCoroutine(manager.snapshots[slotName].sceneState);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					PlayerState.LoadPlayerState(manager.snapshots[slotName].playerState);
					CocoonState.LoadCocoonState(manager.snapshots[slotName].cocoonState, slotName);
					BossState.LoadBossState(manager.snapshots[slotName].bossState, slotName);
					BattleState.LoadBattleState(manager.snapshots[slotName].battleState, slotName);
					EnemyState.LoadEnemyState(manager.snapshots[slotName].enemyState, slotName);
					PersistentState.LoadPersistentState(manager.snapshots[slotName].persistentState, slotName);
					FSMState.LoadFSMState(manager.snapshots[slotName]);
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					StateController.IsFsmEnabled = true;
					manager.loadCoroutineRunning = false;
					ToolItemManager.SendEquippedChangedEvent(true);
					HeroController.instance.AddGeo(0);
					HeroController.instance.AddShards(0);
					HeroController.instance.AddSilk(0, false);
					HeroController.instance.AddHealth(0);
					Debug.Log((object)"Over loaded");
					return false;
				}
			}

			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 bool loadCoroutineRunning;

		private Dictionary<string, MemorySnapshot> snapshots;

		public Manager()
		{
			snapshots = new Dictionary<string, MemorySnapshot>();
		}

		public void Save(string slotName)
		{
			Debug.Log((object)"Start to save the Snapshot");
			StateController.IsFsmEnabled = false;
			ObjectFinder.EnsureDontDestroyOnLoadObject("", slotName);
			Debug.Log((object)slotName);
			try
			{
				if (!snapshots.ContainsKey(slotName))
				{
					snapshots[slotName] = new MemorySnapshot();
				}
				PlayerState.SavePlayerState(snapshots[slotName].playerState);
				SceneState.SaveSceneState(snapshots[slotName].sceneState);
				CocoonState.SaveCocoonState(snapshots[slotName].cocoonState, slotName);
				BossState.SaveBossState(snapshots[slotName].bossState, slotName);
				BattleState.SaveBattleState(snapshots[slotName].battleState, slotName);
				EnemyState.SaveEnemyState(snapshots[slotName].enemyState, slotName);
				PersistentState.SavePersistentState(snapshots[slotName].persistentState, slotName);
				FSMState.SaveFSMState(snapshots[slotName]);
				snapshots[slotName].isActive = true;
				snapshots[slotName].timestamp = DateTime.Now;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Failed to save game state: " + ex.Message));
			}
			((MonoBehaviour)GameManager.instance).StartCoroutine(EnableFsmAfterDelay());
			Debug.Log((object)"Over saved");
		}

		[IteratorStateMachine(typeof(<EnableFsmAfterDelay>d__4))]
		private IEnumerator EnableFsmAfterDelay()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <EnableFsmAfterDelay>d__4(0);
		}

		public void Load(string slotName)
		{
			if (!loadCoroutineRunning && snapshots.ContainsKey(slotName) && snapshots[slotName].isActive)
			{
				((MonoBehaviour)GameManager.instance).StartCoroutine(LoadCoroutine(slotName));
			}
		}

		[IteratorStateMachine(typeof(<LoadCoroutine>d__6))]
		private IEnumerator LoadCoroutine(string slotName)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadCoroutine>d__6(0)
			{
				<>4__this = this,
				slotName = slotName
			};
		}
	}
	[Serializable]
	[BepInPlugin("Lingkong.Snapshot.SilkSong", "Silk Sogn Shapshot", "1.3.0.0")]
	public class Snapshot : BaseUnityPlugin
	{
		private static Manager manager;

		private ConfigManagers configManager;

		private void Awake()
		{
			Harmony.CreateAndPatchAll(typeof(Snapshot), (string)null);
			Harmony.CreateAndPatchAll(typeof(Manager), (string)null);
			Harmony.CreateAndPatchAll(typeof(StatePatches), (string)null);
			configManager = new ConfigManagers();
		}

		private void Start()
		{
			manager = new Manager();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Snapshot Plugin Loaded.");
		}

		private void Update()
		{
			//IL_0027: 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)
			foreach (ConfigManagers.HotkeySlot value in configManager.slots.Values)
			{
				if (configManager.CheckHotkey(value.SaveKey, value.SaveKeyCtrlModifier))
				{
					SaveSnapshot(value.SlotName);
				}
				if (configManager.CheckHotkey(value.LoadKey, value.LoadKeyCtrlModifier))
				{
					LoadSnapshot(value.SlotName);
				}
			}
		}

		private void SaveSnapshot(string slot)
		{
			manager.Save(slot);
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Saved snapshot to slot " + slot));
			if (configManager.PlaySoundOnSave)
			{
				SystemSounds.Beep.Play();
			}
		}

		private void LoadSnapshot(string slot)
		{
			manager.Load(slot);
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded snapshot from slot " + slot));
			if (configManager.PlaySoundOnLoad)
			{
				SystemSounds.Beep.Play();
			}
		}
	}
}
namespace Snapshot_SilkSong.SceneState
{
	public class SceneState
	{
		[CompilerGenerated]
		private sealed class <LoadSceneStateCoroutine>d__4 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public SceneState sceneState;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadSceneStateCoroutine>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					GameManager instance = GameManager.instance;
					HeroController instance2 = HeroController.instance;
					if ((Object)(object)instance2 == (Object)null || (Object)(object)instance == (Object)null || sceneState == null)
					{
						Debug.LogError((object)"Failed to teleport: Data Null");
						return false;
					}
					if (instance.sceneName != sceneState.currentScene)
					{
						<>2__current = WaitForSceneLoadAndTeleport(sceneState.currentScene, sceneState.position);
						<>1__state = 1;
						return true;
					}
					((Component)instance2).transform.position = sceneState.position;
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				case 1:
					<>1__state = -1;
					break;
				case 2:
					<>1__state = -1;
					break;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <WaitForSceneLoadAndTeleport>d__5 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public string targetScene;

			public Vector3 targetPosition;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <WaitForSceneLoadAndTeleport>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Expected O, but got Unknown
				//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: 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: Expected O, but got Unknown
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Expected O, but got Unknown
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					SceneLoadInfo val = new SceneLoadInfo
					{
						SceneName = targetScene,
						EntryGateName = "left1",
						HeroLeaveDirection = (GatePosition)5,
						EntryDelay = 0f,
						Visualization = (SceneLoadVisualizations)0,
						AlwaysUnloadUnusedAssets = true,
						EntrySkip = true
					};
					GameManager.instance.BeginSceneTransition(val);
					<>2__current = (object)new WaitWhile((Func<bool>)delegate
					{
						GameManager instance2 = GameManager.instance;
						HeroController instance3 = HeroController.instance;
						if ((Object)(object)instance2 == (Object)null || (Object)(object)instance3 == (Object)null)
						{
							return true;
						}
						return instance2.IsInSceneTransition || !instance3.isHeroInPosition || instance3.cState.transitioning;
					});
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)delegate
					{
						HeroController instance = HeroController.instance;
						return (Object)(object)instance != (Object)null && instance.CanInput();
					});
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					if (targetPosition != Vector3.zero && (Object)(object)HeroController.instance != (Object)null)
					{
						((Component)HeroController.instance).transform.position = targetPosition;
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public string currentScene;

		public string entryGate;

		public Vector3 position;

		public static void SaveSceneState(SceneState sceneState)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			GameManager instance = GameManager.instance;
			HeroController instance2 = HeroController.instance;
			sceneState.currentScene = instance.GetSceneNameString();
			sceneState.entryGate = instance.GetEntryGateName();
			sceneState.position = ((Component)instance2).transform.position;
		}

		[IteratorStateMachine(typeof(<LoadSceneStateCoroutine>d__4))]
		public static IEnumerator LoadSceneStateCoroutine(SceneState sceneState)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadSceneStateCoroutine>d__4(0)
			{
				sceneState = sceneState
			};
		}

		[IteratorStateMachine(typeof(<WaitForSceneLoadAndTeleport>d__5))]
		private static IEnumerator WaitForSceneLoadAndTeleport(string targetScene, Vector3 targetPosition)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitForSceneLoadAndTeleport>d__5(0)
			{
				targetScene = targetScene,
				targetPosition = targetPosition
			};
		}
	}
}
namespace Snapshot_SilkSong.PlayerState
{
	public class PlayerState
	{
		public Dictionary<string, object> basicProperties = new Dictionary<string, object>();

		public Vector3 position;

		public Dictionary<string, bool> abilityStates;

		public ToolCrestsData ToolEquips;

		public FloatingCrestSlotsData ExtraToolEquips;

		public ToolItemsData Tools;

		public ToolItemLiquidsData ToolLiquids;

		public EnemyJournalKillData EnemyJournalKillData;

		public QuestCompletionData QuestCompletionData;

		public QuestRumourData QuestRumourData;

		public CollectableItemsData Collectables;

		public CollectableRelicsData Relics;

		public CollectableMementosData MementosDeposited;

		public MateriumItemsData MateriumCollected;

		public int[] mossBerryValueList;

		public int[] GrubFarmerMimicValueList;

		public PlayerState()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			basicProperties = new Dictionary<string, object>();
			abilityStates = new Dictionary<string, bool>();
			Tools = new ToolItemsData();
			ToolLiquids = new ToolItemLiquidsData();
			EnemyJournalKillData = new EnemyJournalKillData();
			QuestCompletionData = new QuestCompletionData();
			QuestRumourData = new QuestRumourData();
			Collectables = new CollectableItemsData();
			Relics = new CollectableRelicsData();
			MementosDeposited = new CollectableMementosData();
			MateriumCollected = new MateriumItemsData();
			mossBerryValueList = Array.Empty<int>();
			GrubFarmerMimicValueList = Array.Empty<int>();
			ToolEquips = new ToolCrestsData();
			ExtraToolEquips = new FloatingCrestSlotsData();
		}

		public static void SavePlayerState(PlayerState playerState)
		{
			PlayerData instance = PlayerData.instance;
			_ = HeroController.instance;
			if (instance == null)
			{
				return;
			}
			Type typeFromHandle = typeof(PlayerData);
			FieldInfo[] fields = typeFromHandle.GetFields(BindingFlags.Instance | BindingFlags.Public);
			PropertyInfo[] properties = typeFromHandle.GetProperties(BindingFlags.Instance | BindingFlags.Public);
			playerState.basicProperties.Clear();
			FieldInfo[] array = fields;
			foreach (FieldInfo fieldInfo in array)
			{
				if (fieldInfo.FieldType.IsValueType || fieldInfo.FieldType == typeof(string))
				{
					try
					{
						object value = fieldInfo.GetValue(instance);
						playerState.basicProperties[fieldInfo.Name] = DeepCopier.DeepCopy(value);
					}
					catch (Exception ex)
					{
						Debug.LogWarning((object)("Failed to save field " + fieldInfo.Name + ": " + ex.Message));
					}
				}
			}
			PropertyInfo[] array2 = properties;
			foreach (PropertyInfo propertyInfo in array2)
			{
				if (propertyInfo.CanRead && propertyInfo.CanWrite && (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType == typeof(string)))
				{
					try
					{
						object value2 = propertyInfo.GetValue(instance);
						playerState.basicProperties[propertyInfo.Name] = DeepCopier.DeepCopy(value2);
					}
					catch (Exception ex2)
					{
						Debug.LogWarning((object)("Failed to save property " + propertyInfo.Name + ": " + ex2.Message));
					}
				}
			}
			playerState.ToolEquips = DeepCopier.DeepCopy<ToolCrestsData>(instance.ToolEquips);
			playerState.ExtraToolEquips = DeepCopier.DeepCopy<FloatingCrestSlotsData>(instance.ExtraToolEquips);
			playerState.Tools = DeepCopier.DeepCopy<ToolItemsData>(instance.Tools);
			playerState.ToolLiquids = DeepCopier.DeepCopy<ToolItemLiquidsData>(instance.ToolLiquids);
			playerState.EnemyJournalKillData = DeepCopier.DeepCopy<EnemyJournalKillData>(instance.EnemyJournalKillData);
			playerState.QuestCompletionData = DeepCopier.DeepCopy<QuestCompletionData>(instance.QuestCompletionData);
			playerState.QuestRumourData = DeepCopier.DeepCopy<QuestRumourData>(instance.QuestRumourData);
			playerState.Collectables = DeepCopier.DeepCopy<CollectableItemsData>(instance.Collectables);
			playerState.Relics = DeepCopier.DeepCopy<CollectableRelicsData>(instance.Relics);
			playerState.MementosDeposited = DeepCopier.DeepCopy<CollectableMementosData>(instance.MementosDeposited);
			playerState.MateriumCollected = DeepCopier.DeepCopy<MateriumItemsData>(instance.MateriumCollected);
			playerState.mossBerryValueList = DeepCopier.DeepCopy(instance.mossBerryValueList);
			playerState.GrubFarmerMimicValueList = DeepCopier.DeepCopy(instance.GrubFarmerMimicValueList);
		}

		public static void LoadPlayerState(PlayerState playerState)
		{
			PlayerData instance = PlayerData.instance;
			_ = HeroController.instance;
			if (instance == null)
			{
				return;
			}
			Type typeFromHandle = typeof(PlayerData);
			FieldInfo[] fields = typeFromHandle.GetFields(BindingFlags.Instance | BindingFlags.Public);
			PropertyInfo[] properties = typeFromHandle.GetProperties(BindingFlags.Instance | BindingFlags.Public);
			FieldInfo[] array = fields;
			foreach (FieldInfo fieldInfo in array)
			{
				if (playerState.basicProperties.ContainsKey(fieldInfo.Name) && (fieldInfo.FieldType.IsValueType || fieldInfo.FieldType == typeof(string)))
				{
					try
					{
						object value = playerState.basicProperties[fieldInfo.Name];
						fieldInfo.SetValue(instance, value);
					}
					catch (Exception ex)
					{
						Debug.LogWarning((object)("Failed to load field " + fieldInfo.Name + ": " + ex.Message));
					}
				}
			}
			PropertyInfo[] array2 = properties;
			foreach (PropertyInfo propertyInfo in array2)
			{
				if (playerState.basicProperties.ContainsKey(propertyInfo.Name) && propertyInfo.CanRead && propertyInfo.CanWrite && (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType == typeof(string)))
				{
					try
					{
						object value2 = playerState.basicProperties[propertyInfo.Name];
						propertyInfo.SetValue(instance, value2);
					}
					catch (Exception ex2)
					{
						Debug.LogWarning((object)("Failed to load property " + propertyInfo.Name + ": " + ex2.Message));
					}
				}
			}
			instance.ToolEquips = DeepCopier.DeepCopy<ToolCrestsData>(playerState.ToolEquips);
			instance.ExtraToolEquips = DeepCopier.DeepCopy<FloatingCrestSlotsData>(playerState.ExtraToolEquips);
			instance.Tools = DeepCopier.DeepCopy<ToolItemsData>(playerState.Tools);
			instance.ToolLiquids = DeepCopier.DeepCopy<ToolItemLiquidsData>(playerState.ToolLiquids);
			instance.EnemyJournalKillData = DeepCopier.DeepCopy<EnemyJournalKillData>(playerState.EnemyJournalKillData);
			instance.QuestCompletionData = DeepCopier.DeepCopy<QuestCompletionData>(playerState.QuestCompletionData);
			instance.QuestRumourData = DeepCopier.DeepCopy<QuestRumourData>(playerState.QuestRumourData);
			instance.Collectables = DeepCopier.DeepCopy<CollectableItemsData>(playerState.Collectables);
			instance.Relics = DeepCopier.DeepCopy<CollectableRelicsData>(playerState.Relics);
			instance.MementosDeposited = DeepCopier.DeepCopy<CollectableMementosData>(playerState.MementosDeposited);
			instance.MateriumCollected = DeepCopier.DeepCopy<MateriumItemsData>(playerState.MateriumCollected);
			instance.mossBerryValueList = DeepCopier.DeepCopy(playerState.mossBerryValueList);
			instance.GrubFarmerMimicValueList = DeepCopier.DeepCopy(playerState.GrubFarmerMimicValueList);
		}
	}
}
namespace Snapshot_SilkSong.EnemyState
{
	public class EnemyState
	{
		public List<ObjectInfo> enemyList = new List<ObjectInfo>();

		public static void SaveEnemyState(EnemyState enemyState, string path)
		{
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			ObjectFinder.EnsureDontDestroyOnLoadObject(path, "EnemyState");
			enemyState.enemyList.ForEach(delegate(ObjectInfo info)
			{
				Object.DestroyImmediate((Object)(object)info.targetObject);
			});
			enemyState.enemyList.Clear();
			foreach (ObjectInfo enemy in enemyState.enemyList)
			{
				if ((Object)(object)enemy.targetObject != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)enemy.targetObject);
				}
			}
			List<ObjectInfo> list = FindHealthManagerInDirectChildren();
			if (list == null || list.Count == 0)
			{
				return;
			}
			foreach (ObjectInfo item2 in list)
			{
				GameObject targetObject = item2.targetObject;
				GameObject obj = Object.Instantiate<GameObject>(targetObject, GameObject.Find(path + "/EnemyState").transform);
				obj.SetActive(false);
				((Object)obj).name = ((Object)targetObject).name;
				string path2 = item2.path;
				Scene scene = targetObject.scene;
				ObjectInfo item = new ObjectInfo(obj, path2, ((Scene)(ref scene)).name, item2.isActive, targetObject.transform);
				enemyState.enemyList.Add(item);
			}
			Object.DontDestroyOnLoad((Object)(object)GameObject.Find(path).transform);
		}

		public static void LoadEnemyState(EnemyState enemyState, string path)
		{
			//IL_009b: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			FindHealthManagerInDirectChildren().ForEach(delegate(ObjectInfo obj)
			{
				if ((Object)(object)obj.targetObject != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)obj.targetObject);
				}
			});
			if (enemyState.enemyList == null || enemyState.enemyList.Count == 0)
			{
				return;
			}
			foreach (ObjectInfo enemy in enemyState.enemyList)
			{
				if (!((Object)(object)enemy.targetObject == (Object)null))
				{
					GameObject obj2 = Object.Instantiate<GameObject>(enemy.targetObject);
					ObjectFinder.PlaceGameObjectToPath(obj2, enemy.path, enemy.sceneName);
					((Object)obj2).name = ((Object)enemy.targetObject).name;
					obj2.transform.localPosition = enemy.savedLocalPosition;
					obj2.transform.localRotation = enemy.savedLocalRotation;
					obj2.transform.localScale = enemy.savedLocalScale;
					obj2.SetActive(enemy.isActive);
				}
			}
		}

		public static List<ObjectInfo> FindHealthManagerInDirectChildren()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			List<ObjectInfo> list = new List<ObjectInfo>();
			for (int i = 0; i < SceneManager.sceneCount; i++)
			{
				Scene sceneAt = SceneManager.GetSceneAt(i);
				if (((Scene)(ref sceneAt)).name == "DontDestroyOnLoad" || ((Scene)(ref sceneAt)).name == "HideAndDontSave")
				{
					continue;
				}
				GameObject[] array = Object.FindObjectsByType<GameObject>((FindObjectsInactive)1, (FindObjectsSortMode)0);
				foreach (GameObject val in array)
				{
					if ((Object)(object)val == (Object)null || val.gameObject.scene != sceneAt)
					{
						continue;
					}
					HealthManager component = val.GetComponent<HealthManager>();
					ActiveCorpse component2 = val.GetComponent<ActiveCorpse>();
					if ((Object)(object)component == (Object)null && (Object)(object)component2 == (Object)null)
					{
						continue;
					}
					bool flag = false;
					foreach (Transform item in val.transform)
					{
						if ((Object)(object)((Component)item).GetComponent<HeroController>() != (Object)null)
						{
							flag = true;
							break;
						}
					}
					if (!flag)
					{
						GameObject gameObject = val.gameObject;
						string gameObjectPath = ObjectFinder.GetGameObjectPath(gameObject);
						Scene scene = gameObject.scene;
						list.Add(new ObjectInfo(gameObject, gameObjectPath, ((Scene)(ref scene)).name, gameObject.activeSelf, gameObject.transform));
					}
				}
			}
			return list;
		}
	}
}
namespace Snapshot_SilkSong.Utils
{
	public class ConfigManagers : MonoBehaviour
	{
		public class HotkeySlot
		{
			public string SlotName { get; set; }

			public KeyCode SaveKey { get; set; }

			public KeyCode LoadKey { get; set; }

			public bool SaveKeyCtrlModifier { get; set; }

			public bool LoadKeyCtrlModifier { get; set; }
		}

		private static ConfigFile config;

		public Dictionary<string, HotkeySlot> slots = new Dictionary<string, HotkeySlot>();

		public bool PlaySoundOnSave { get; private set; }

		public bool PlaySoundOnLoad { get; private set; }

		public ConfigManagers()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			config = new ConfigFile(Utility.CombinePaths(new string[2]
			{
				Paths.ConfigPath,
				"Snapshot.cfg"
			}), true);
			LoadConfig();
		}

		private void LoadConfig()
		{
			LoadSoundConfig();
			LoadHotkeyConfig();
		}

		private void LoadSoundConfig()
		{
			ConfigEntry<bool> val = config.Bind<bool>("Sound", "PlaySoundOnSave", true, "保存时播放音效");
			ConfigEntry<bool> val2 = config.Bind<bool>("Sound", "PlaySoundOnLoad", true, "加载时播放音效");
			PlaySoundOnSave = val.Value;
			PlaySoundOnLoad = val2.Value;
		}

		private void LoadHotkeyConfig()
		{
			slots.Clear();
			string[] array = new string[4] { "1", "2", "f1", "f2" };
			foreach (string text in array)
			{
				ConfigEntry<string> val = config.Bind<string>(text, "SaveKey", text, "保存按键");
				ConfigEntry<string> val2 = config.Bind<string>(text, "LoadKey", "ctrl, " + text, "加载按键");
				slots[text] = ParseHotkeyConfig(text, val.Value, val2.Value);
			}
		}

		private HotkeySlot ParseHotkeyConfig(string slotName, string saveKeyStr, string loadKeyStr)
		{
			//IL_0018: 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)
			HotkeySlot obj = new HotkeySlot
			{
				SlotName = slotName
			};
			ParseKeyCombo(saveKeyStr, out var key, out var ctrlModifier);
			obj.SaveKey = key;
			obj.SaveKeyCtrlModifier = ctrlModifier;
			ParseKeyCombo(loadKeyStr, out var key2, out var ctrlModifier2);
			obj.LoadKey = key2;
			obj.LoadKeyCtrlModifier = ctrlModifier2;
			return obj;
		}

		private void ParseKeyCombo(string keyCombo, out KeyCode key, out bool ctrlModifier)
		{
			ctrlModifier = false;
			key = (KeyCode)0;
			if (string.IsNullOrWhiteSpace(keyCombo))
			{
				return;
			}
			List<string> list = (from p in keyCombo.ToLower().Split(new char[3] { ',', '+', ' ' }, StringSplitOptions.RemoveEmptyEntries)
				select p.Trim() into p
				where !string.IsNullOrEmpty(p)
				select p).ToList();
			if (list.Count != 0)
			{
				HashSet<string> ctrlKeywords = new HashSet<string> { "ctrl", "control" };
				Dictionary<string, KeyCode> obj = new Dictionary<string, KeyCode>
				{
					["1"] = (KeyCode)49,
					["2"] = (KeyCode)50,
					["3"] = (KeyCode)51,
					["4"] = (KeyCode)52,
					["5"] = (KeyCode)53,
					["6"] = (KeyCode)54,
					["7"] = (KeyCode)55,
					["8"] = (KeyCode)56,
					["9"] = (KeyCode)57,
					["0"] = (KeyCode)48,
					["num0"] = (KeyCode)256,
					["num1"] = (KeyCode)257,
					["num2"] = (KeyCode)258,
					["num3"] = (KeyCode)259,
					["num4"] = (KeyCode)260,
					["num5"] = (KeyCode)261,
					["num6"] = (KeyCode)262,
					["num7"] = (KeyCode)263,
					["num8"] = (KeyCode)264,
					["num9"] = (KeyCode)265,
					["enter"] = (KeyCode)13,
					["return"] = (KeyCode)13,
					["esc"] = (KeyCode)27,
					["escape"] = (KeyCode)27,
					["space"] = (KeyCode)32,
					["tab"] = (KeyCode)9,
					["backspace"] = (KeyCode)8,
					["delete"] = (KeyCode)127,
					["insert"] = (KeyCode)277,
					["home"] = (KeyCode)278,
					["end"] = (KeyCode)279,
					["pageup"] = (KeyCode)280,
					["pagedown"] = (KeyCode)281,
					["up"] = (KeyCode)273,
					["down"] = (KeyCode)274,
					["left"] = (KeyCode)276,
					["right"] = (KeyCode)275
				};
				ctrlModifier = list.Any((string p) => ctrlKeywords.Contains(p));
				string text = list.Last((string p) => !ctrlKeywords.Contains(p));
				if (!obj.TryGetValue(text, out key) && !Enum.TryParse<KeyCode>(text, ignoreCase: true, out key) && (text.Length != 1 || !char.IsLetterOrDigit(text[0]) || !Enum.TryParse<KeyCode>(text.ToUpper(), out key)))
				{
					Debug.LogWarning((object)("Undefined Key: " + text));
				}
			}
		}

		public bool CheckHotkey(KeyCode key, bool requireCtrl)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if ((int)key == 0)
			{
				return false;
			}
			bool flag = Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305);
			if (requireCtrl && !flag)
			{
				return false;
			}
			if (!requireCtrl && flag)
			{
				return false;
			}
			return Input.GetKeyDown(key);
		}
	}
	public static class StateController
	{
		public static bool IsFsmEnabled = true;

		public static long counter = 0L;

		public static bool ShouldExecute()
		{
			return IsFsmEnabled;
		}
	}
	public class ObjectFinder
	{
		public static void EnsureDontDestroyOnLoadObject(string path, string name)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			if (!((Object)(object)GameObject.Find(string.IsNullOrEmpty(path) ? name : (path + "/" + name)) != (Object)null))
			{
				GameObject val = (string.IsNullOrEmpty(path) ? null : EnsureParentPath(path));
				GameObject val2 = new GameObject(name);
				Object.DontDestroyOnLoad((Object)(object)val2);
				if ((Object)(object)val != (Object)null)
				{
					val2.transform.SetParent(val.transform);
				}
			}
		}

		private static GameObject EnsureParentPath(string path)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			if (string.IsNullOrEmpty(path))
			{
				return null;
			}
			string text = "";
			Transform val = null;
			string[] array = path.Split(new char[1] { '/' });
			foreach (string text2 in array)
			{
				if (string.IsNullOrEmpty(text2))
				{
					continue;
				}
				text = text + ((text.Length > 0) ? "/" : "") + text2;
				GameObject val2 = GameObject.Find(text);
				if ((Object)(object)val2 == (Object)null)
				{
					val2 = new GameObject(text2);
					Object.DontDestroyOnLoad((Object)(object)val2);
					if ((Object)(object)val != (Object)null)
					{
						val2.transform.SetParent(val);
					}
				}
				val = val2.transform;
			}
			if (val == null)
			{
				return null;
			}
			return ((Component)val).gameObject;
		}

		public static string GetGameObjectPath(GameObject obj)
		{
			string text = ((Object)obj).name;
			Transform parent = obj.transform.parent;
			while ((Object)(object)parent != (Object)null)
			{
				text = ((Object)parent).name + "/" + text;
				parent = parent.parent;
			}
			return text;
		}

		public static void PlaceGameObjectToPath(GameObject obj, string path, string sceneName)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			if (string.IsNullOrEmpty(path))
			{
				return;
			}
			string[] array = path.Split(new char[1] { '/' });
			Scene val = SceneManager.GetActiveScene();
			if (!string.IsNullOrEmpty(sceneName))
			{
				Scene sceneByName = SceneManager.GetSceneByName(sceneName);
				if (((Scene)(ref sceneByName)).IsValid() && ((Scene)(ref sceneByName)).isLoaded)
				{
					val = sceneByName;
					if (obj.scene != val)
					{
						SceneManager.MoveGameObjectToScene(obj, val);
					}
				}
				else
				{
					Debug.LogWarning((object)("Scene '" + sceneName + "' is not loaded, using active scene instead."));
				}
			}
			if (array.Length == 1)
			{
				obj.transform.SetParent((Transform)null, false);
				((Object)obj).name = array[0];
				return;
			}
			Transform val2 = null;
			for (int i = 0; i < array.Length - 1; i++)
			{
				string text = array[i];
				if ((Object)(object)val2 == (Object)null)
				{
					GameObject[] rootGameObjects = ((Scene)(ref val)).GetRootGameObjects();
					GameObject val3 = null;
					GameObject[] array2 = rootGameObjects;
					foreach (GameObject val4 in array2)
					{
						if (((Object)val4).name == text)
						{
							val3 = val4;
							break;
						}
					}
					if ((Object)(object)val3 == (Object)null)
					{
						GameObject val5 = new GameObject(text);
						val5.transform.position = Vector3.zero;
						val5.transform.rotation = Quaternion.identity;
						val5.transform.localScale = Vector3.one;
						val2 = val5.transform;
						SceneManager.MoveGameObjectToScene(val5, val);
					}
					else
					{
						val2 = val3.transform;
					}
					continue;
				}
				Transform val6 = null;
				for (int k = 0; k < val2.childCount; k++)
				{
					if (((Object)val2.GetChild(k)).name == text)
					{
						val6 = val2.GetChild(k);
						break;
					}
				}
				if ((Object)(object)val6 == (Object)null)
				{
					GameObject val7 = new GameObject(text);
					val7.transform.SetParent(val2, false);
					val7.transform.localPosition = Vector3.zero;
					val7.transform.localRotation = Quaternion.identity;
					val7.transform.localScale = Vector3.one;
					val2 = val7.transform;
				}
				else
				{
					val2 = val6;
				}
			}
			if ((Object)(object)val2 != (Object)null)
			{
				obj.transform.SetParent(val2, false);
			}
			else
			{
				obj.transform.SetParent((Transform)null, false);
			}
			((Object)obj).name = array[^1];
		}

		public static void DeleteHealthManagerImmediate(GameObject rootObject)
		{
			if ((Object)(object)rootObject == (Object)null)
			{
				return;
			}
			HealthManager[] componentsInChildren = rootObject.GetComponentsInChildren<HealthManager>(true);
			if (componentsInChildren.Length == 0)
			{
				return;
			}
			HealthManager[] array = componentsInChildren;
			foreach (HealthManager val in array)
			{
				if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null)
				{
					GetGameObjectPath(((Component)val).gameObject);
					Object.DestroyImmediate((Object)(object)((Component)val).gameObject);
				}
			}
		}

		public static GameObject FindGameObjectByPath(string sceneName, string path)
		{
			GameObject val = GameObject.Find(path);
			if ((Object)(object)val == (Object)null)
			{
				val = FindGameObjectInHierarchy(path);
			}
			return val;
		}

		private static GameObject FindGameObjectInHierarchy(string path)
		{
			string[] array = path.Split(new char[1] { '/' });
			GameObject val = null;
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (!string.IsNullOrEmpty(text))
				{
					if ((Object)(object)val == (Object)null)
					{
						val = GameObject.Find(text);
					}
					else
					{
						Transform val2 = val.transform.Find(text);
						val = (((Object)(object)val2 != (Object)null) ? ((Component)val2).gameObject : null);
					}
					if ((Object)(object)val == (Object)null)
					{
						break;
					}
				}
			}
			return val;
		}
	}
	[Serializable]
	public class ObjectInfo
	{
		public GameObject targetObject;

		public string path;

		public string sceneName;

		public bool isActive;

		public Vector3 savedLocalPosition;

		public Quaternion savedLocalRotation;

		public Vector3 savedLocalScale;

		public ObjectInfo(GameObject gameObject, string path, string sceneName, bool isActive, Transform originalTransform)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			targetObject = gameObject;
			this.path = path;
			this.sceneName = sceneName;
			this.isActive = isActive;
			savedLocalPosition = originalTransform.localPosition;
			savedLocalRotation = originalTransform.localRotation;
			savedLocalScale = originalTransform.localScale;
		}
	}
}
namespace Snapshot_SilkSong.Utils.Snapshot_SilkSong.Patches
{
	[HarmonyPatch]
	public class StatePatches
	{
		private static bool Prefix_OtherType(string typeName, string methodName)
		{
			_ = typeName + "." + methodName;
			return StateController.ShouldExecute();
		}

		[HarmonyPatch(typeof(PlayMakerFSM), "OnDisable")]
		[HarmonyPrefix]
		private static bool Prefix_PlayMakerFSM_OnDisable()
		{
			return Prefix_OtherType("PlayMakerFSM", "OnDisable");
		}

		[HarmonyPatch(typeof(PlayMakerFSM), "OnEnable")]
		[HarmonyPrefix]
		private static bool Prefix_Fsm_OnEnable()
		{
			return Prefix_OtherType("Fsm", "OnEnable");
		}

		[HarmonyPatch(typeof(PlayMakerFSM), "AddEventHandlerComponents")]
		[HarmonyPrefix]
		private static bool Prefix_Fsm_AddEventHandlerComponents()
		{
			return Prefix_OtherType("Fsm", "AddEventHandlerComponents");
		}

		[HarmonyPatch(typeof(PlayMakerFSM), "Start")]
		[HarmonyPrefix]
		private static bool Prefix_PlayMakerFSM_Awake()
		{
			return Prefix_OtherType("PlayMakerFSM", "Start");
		}

		[HarmonyPatch(typeof(HealthManager), "Awake")]
		[HarmonyPrefix]
		private static bool Prefix_PlayMakerFSM_Awake(HealthManager __instance)
		{
			Object.Destroy((Object)(object)((Component)__instance).GetComponent<TagDamageTaker>());
			return true;
		}

		[HarmonyPatch(typeof(HealthManager), "HealToMax")]
		[HarmonyPrefix]
		private static bool PrefixHealthManager_HealToMax()
		{
			return Prefix_OtherType("HealthManager", "HealToMax");
		}

		[HarmonyPatch(typeof(HealthManager), "AddPhysicalPusher")]
		[HarmonyPrefix]
		private static bool Prefix_HealthManager_AddPhysicalPusher()
		{
			return Prefix_OtherType("HealthManager", "AddPhysicalPusher");
		}
	}
}
namespace Snapshot_SilkSong.States
{
	public class FSMState
	{
		public static void SaveFSMState(MemorySnapshot memorySnapshot)
		{
			foreach (ObjectInfo enemy in memorySnapshot.enemyState.enemyList)
			{
				string text = enemy.sceneName + "/" + enemy.path;
				GameObject targetObject = enemy.targetObject;
				if ((Object)(object)targetObject == (Object)null)
				{
					Debug.LogWarning((object)("TargetObject is null for path: " + text));
					continue;
				}
				GameObject val = ObjectFinder.FindGameObjectByPath(enemy.sceneName, enemy.path);
				if ((Object)(object)val != (Object)null)
				{
					SyncAllFSMs(val, targetObject);
					SynciTweens(val, targetObject);
				}
				else
				{
					Debug.LogWarning((object)("Cannot find source GameObject for path: " + text));
				}
			}
		}

		public static void LoadFSMState(MemorySnapshot memorySnapshot)
		{
			foreach (ObjectInfo enemy in memorySnapshot.enemyState.enemyList)
			{
				string text = enemy.sceneName + "/" + enemy.path;
				GameObject targetObject = enemy.targetObject;
				if (!((Object)(object)targetObject == (Object)null))
				{
					GameObject val = ObjectFinder.FindGameObjectByPath(enemy.sceneName, enemy.path);
					if ((Object)(object)val != (Object)null)
					{
						SyncAllFSMs(targetObject, val);
						SynciTweens(targetObject, val);
					}
					else
					{
						Debug.LogWarning((object)("Cannot find source GameObject for path: " + text));
					}
				}
			}
		}

		private static void CopyFsmVariables(FsmVariables source, FsmVariables target)
		{
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			FsmFloat[] floatVariables = source.FloatVariables;
			FsmFloat[] floatVariables2 = target.FloatVariables;
			for (int i = 0; i < floatVariables.Length; i++)
			{
				floatVariables2[i].Value = floatVariables[i].Value;
			}
			FsmInt[] intVariables = source.IntVariables;
			FsmInt[] intVariables2 = target.IntVariables;
			for (int j = 0; j < intVariables.Length; j++)
			{
				intVariables2[j].Value = intVariables[j].Value;
			}
			FsmBool[] boolVariables = source.BoolVariables;
			FsmBool[] boolVariables2 = target.BoolVariables;
			for (int k = 0; k < boolVariables.Length; k++)
			{
				boolVariables2[k].Value = boolVariables[k].Value;
			}
			FsmString[] stringVariables = source.StringVariables;
			FsmString[] stringVariables2 = target.StringVariables;
			for (int l = 0; l < stringVariables.Length; l++)
			{
				stringVariables2[l].Value = stringVariables[l].Value;
			}
			FsmVector3[] vector3Variables = source.Vector3Variables;
			FsmVector3[] vector3Variables2 = target.Vector3Variables;
			for (int m = 0; m < vector3Variables.Length; m++)
			{
				vector3Variables2[m].Value = vector3Variables[m].Value;
			}
		}

		private static void SyncAllFSMs(GameObject source, GameObject target)
		{
			PlayMakerFSM[] components = source.GetComponents<PlayMakerFSM>();
			PlayMakerFSM[] components2 = target.GetComponents<PlayMakerFSM>();
			for (int i = 0; i < components.Length && i < components2.Length; i++)
			{
				Fsm fsm = components[i].Fsm;
				Fsm fsm2 = components2[i].Fsm;
				CopyFsmVariables(fsm.Variables, fsm2.Variables);
				string activeStateName = fsm.ActiveStateName;
				if (!string.IsNullOrEmpty(activeStateName))
				{
					fsm2.StartState = activeStateName;
				}
			}
		}

		private static void SynciTweens(GameObject source, GameObject target)
		{
			iTween[] components = source.GetComponents<iTween>();
			iTween[] components2 = target.GetComponents<iTween>();
			for (int i = 0; i < components.Length && i < components2.Length; i++)
			{
				SynciTweenParams(components[i], components2[i]);
			}
		}

		private static void SynciTweenParams(iTween source, iTween target)
		{
			FieldInfo[] fields = typeof(iTween).GetFields(BindingFlags.Instance | BindingFlags.NonPublic);
			string[] array = new string[12]
			{
				"time", "delay", "percentage", "namedcolorvalue", "loopType", "easeType", "space", "isLocal", "useRealTime", "physics",
				"reverse", "loop"
			};
			foreach (string fieldName in array)
			{
				FieldInfo fieldInfo = Array.Find(fields, (FieldInfo f) => f.Name == fieldName);
				if (fieldInfo != null)
				{
					try
					{
						object value = fieldInfo.GetValue(source);
						fieldInfo.SetValue(target, value);
					}
					catch
					{
					}
				}
			}
			FieldInfo field = typeof(iTween).GetField("tweenArguments", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null && field.GetValue(source) is Hashtable hashtable)
			{
				Hashtable hashtable2 = new Hashtable();
				foreach (DictionaryEntry item in hashtable)
				{
					if (item.Value == null)
					{
						hashtable2[item.Key] = null;
						continue;
					}
					Type type = item.Value.GetType();
					if (type.IsValueType || type == typeof(string))
					{
						hashtable2[item.Key] = item.Value;
						continue;
					}
					object? value2 = item.Value;
					Object val = (Object)((value2 is Object) ? value2 : null);
					if (val != null)
					{
						hashtable2[item.Key] = val;
					}
				}
				field.SetValue(target, hashtable2);
			}
			FieldInfo field2 = typeof(iTween).GetField("isRunning", BindingFlags.Instance | BindingFlags.NonPublic);
			FieldInfo field3 = typeof(iTween).GetField("percentage", BindingFlags.Instance | BindingFlags.NonPublic);
			FieldInfo field4 = typeof(iTween).GetField("running", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(field2 == null) && !(field3 == null))
			{
				bool flag = (bool)field2.GetValue(source);
				float num = (float)field3.GetValue(source);
				field2.SetValue(target, flag);
				field3.SetValue(target, num);
				if (field4 != null)
				{
					field4.SetValue(target, flag);
				}
			}
		}
	}
	public class PersistentState
	{
		public List<ObjectInfo> persistentList = new List<ObjectInfo>();

		public static void SavePersistentState(PersistentState persistentState, string path)
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			ObjectFinder.EnsureDontDestroyOnLoadObject(path, "PersistentState");
			foreach (ObjectInfo persistent in persistentState.persistentList)
			{
				if ((Object)(object)persistent.targetObject != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)persistent.targetObject);
				}
			}
			persistentState.persistentList.Clear();
			List<ObjectInfo> list = FindPersistentBoolItemInDirectChildren();
			if (list == null || list.Count == 0)
			{
				return;
			}
			foreach (ObjectInfo item2 in list)
			{
				GameObject targetObject = item2.targetObject;
				GameObject obj = Object.Instantiate<GameObject>(targetObject, GameObject.Find(path + "/PersistentState").transform);
				obj.SetActive(false);
				((Object)obj).name = ((Object)targetObject).name;
				string path2 = item2.path;
				Scene scene = targetObject.scene;
				ObjectInfo item = new ObjectInfo(obj, path2, ((Scene)(ref scene)).name, item2.isActive, targetObject.transform);
				persistentState.persistentList.Add(item);
			}
			Object.DontDestroyOnLoad((Object)(object)GameObject.Find(path).transform);
		}

		public static void LoadPersistentState(PersistentState persistentState, string path)
		{
			//IL_009b: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			FindPersistentBoolItemInDirectChildren().ForEach(delegate(ObjectInfo obj)
			{
				if ((Object)(object)obj.targetObject != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)obj.targetObject);
				}
			});
			if (persistentState.persistentList == null || persistentState.persistentList.Count == 0)
			{
				return;
			}
			foreach (ObjectInfo persistent in persistentState.persistentList)
			{
				if (!((Object)(object)persistent.targetObject == (Object)null))
				{
					GameObject obj2 = Object.Instantiate<GameObject>(persistent.targetObject);
					ObjectFinder.PlaceGameObjectToPath(obj2, persistent.path, persistent.sceneName);
					((Object)obj2).name = ((Object)persistent.targetObject).name;
					obj2.transform.localPosition = persistent.savedLocalPosition;
					obj2.transform.localRotation = persistent.savedLocalRotation;
					obj2.transform.localScale = persistent.savedLocalScale;
					obj2.SetActive(persistent.isActive);
				}
			}
		}

		public static List<ObjectInfo> FindPersistentBoolItemInDirectChildren()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_015d: Unknown result type (might be due to invalid IL or missing references)
			List<ObjectInfo> list = new List<ObjectInfo>();
			for (int i = 0; i < SceneManager.sceneCount; i++)
			{
				Scene sceneAt = SceneManager.GetSceneAt(i);
				if (((Scene)(ref sceneAt)).name == "DontDestroyOnLoad" || ((Scene)(ref sceneAt)).name == "HideAndDontSave")
				{
					continue;
				}
				PersistentBoolItem[] array = Object.FindObjectsByType<PersistentBoolItem>((FindObjectsInactive)1, (FindObjectsSortMode)0);
				foreach (PersistentBoolItem val in array)
				{
					if ((Object)(object)val == (Object)null || ((Component)val).gameObject.scene != sceneAt)
					{
						continue;
					}
					bool flag = false;
					Transform parent = ((Component)val).transform.parent;
					while ((Object)(object)parent != (Object)null)
					{
						HealthManager component = ((Component)parent).GetComponent<HealthManager>();
						BattleScene component2 = ((Component)parent).GetComponent<BattleScene>();
						string name = ((Object)((Component)val).gameObject).name;
						if ((Object)(object)component != (Object)null || (Object)(object)component2 != (Object)null || name == "Battle Scene")
						{
							flag = true;
							break;
						}
						parent = parent.parent;
					}
					if (flag)
					{
						continue;
					}
					bool flag2 = false;
					foreach (Transform item in ((Component)val).transform)
					{
						if ((Object)(object)((Component)item).GetComponent<HeroController>() != (Object)null)
						{
							flag2 = true;
							break;
						}
					}
					if (!flag2)
					{
						GameObject gameObject = ((Component)val).gameObject;
						string gameObjectPath = ObjectFinder.GetGameObjectPath(gameObject);
						Scene scene = gameObject.scene;
						list.Add(new ObjectInfo(gameObject, gameObjectPath, ((Scene)(ref scene)).name, gameObject.activeSelf, gameObject.transform));
					}
				}
			}
			return list;
		}
	}
}
namespace Snapshot_SilkSong.CocoonState
{
	public class CocoonState
	{
		public List<ObjectInfo> CocoonSceneList;

		public CocoonState()
		{
			CocoonSceneList = new List<ObjectInfo>();
		}

		public static void SaveCocoonState(CocoonState cocoonState, string path)
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			ObjectFinder.EnsureDontDestroyOnLoadObject(path, "CocoonStates");
			foreach (ObjectInfo cocoonScene in cocoonState.CocoonSceneList)
			{
				if ((Object)(object)cocoonScene.targetObject != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)cocoonScene.targetObject);
				}
			}
			cocoonState.CocoonSceneList.Clear();
			List<ObjectInfo> list = FindCocoonScene();
			if (list == null || list.Count == 0)
			{
				return;
			}
			foreach (ObjectInfo item2 in list)
			{
				GameObject targetObject = item2.targetObject;
				GameObject obj = Object.Instantiate<GameObject>(targetObject, GameObject.Find(path + "CocoonStates/").transform);
				obj.SetActive(false);
				((Object)obj).name = ((Object)targetObject).name;
				string path2 = item2.path;
				Scene scene = targetObject.scene;
				ObjectInfo item = new ObjectInfo(obj, path2, ((Scene)(ref scene)).name, item2.isActive, targetObject.transform);
				cocoonState.CocoonSceneList.Add(item);
			}
			Object.DontDestroyOnLoad((Object)(object)GameObject.Find(path).transform);
		}

		public static void LoadCocoonState(CocoonState cocoonState, string path)
		{
			//IL_00b6: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			foreach (ObjectInfo item in FindCocoonScene())
			{
				if ((Object)(object)item.targetObject != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)item.targetObject);
				}
			}
			if (cocoonState.CocoonSceneList == null || cocoonState.CocoonSceneList.Count == 0)
			{
				return;
			}
			foreach (ObjectInfo cocoonScene in cocoonState.CocoonSceneList)
			{
				if (!((Object)(object)cocoonScene.targetObject == (Object)null))
				{
					GameObject obj = Object.Instantiate<GameObject>(cocoonScene.targetObject);
					((Object)obj).name = ((Object)cocoonScene.targetObject).name;
					ObjectFinder.PlaceGameObjectToPath(obj, cocoonScene.path, cocoonScene.sceneName);
					obj.transform.localPosition = cocoonScene.savedLocalPosition;
					obj.transform.localRotation = cocoonScene.savedLocalRotation;
					obj.transform.localScale = cocoonScene.savedLocalScale;
					obj.SetActive(true);
				}
			}
		}

		public static List<ObjectInfo> FindCocoonScene()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			List<ObjectInfo> list = new List<ObjectInfo>();
			for (int i = 0; i < SceneManager.sceneCount; i++)
			{
				Scene sceneAt = SceneManager.GetSceneAt(i);
				if (!(((Scene)(ref sceneAt)).name == "DontDestroyOnLoad") && !(((Scene)(ref sceneAt)).name == "HideAndDontSave"))
				{
					GameObject[] rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects();
					for (int j = 0; j < rootGameObjects.Length; j++)
					{
						FindCocoonObjectsRecursive(rootGameObjects[j], sceneAt, list);
					}
				}
			}
			return list;
		}

		private static void FindCocoonObjectsRecursive(GameObject currentObj, Scene scene, List<ObjectInfo> cocoonList)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)currentObj).name == "Hornet Cocoon Corpse(Clone)")
			{
				string gameObjectPath = ObjectFinder.GetGameObjectPath(currentObj);
				cocoonList.Add(new ObjectInfo(currentObj, gameObjectPath, ((Scene)(ref scene)).name, currentObj.activeSelf, currentObj.transform));
			}
			foreach (Transform item in currentObj.transform)
			{
				FindCocoonObjectsRecursive(((Component)item).gameObject, scene, cocoonList);
			}
		}
	}
}
namespace Snapshot_SilkSong.BossState
{
	public class BossState
	{
		public List<ObjectInfo> BossSceneList;

		public BossState()
		{
			BossSceneList = new List<ObjectInfo>();
		}

		public static void SaveBossState(BossState bossState, string path)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			ObjectFinder.EnsureDontDestroyOnLoadObject(path, "BossStates");
			foreach (ObjectInfo bossScene in bossState.BossSceneList)
			{
				if ((Object)(object)bossScene.targetObject != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)bossScene.targetObject);
				}
			}
			bossState.BossSceneList.Clear();
			List<ObjectInfo> list = FindBossScene();
			if (list == null || list.Count == 0)
			{
				return;
			}
			foreach (ObjectInfo item2 in list)
			{
				GameObject targetObject = item2.targetObject;
				GameObject obj = Object.Instantiate<GameObject>(targetObject, GameObject.Find(path + "BossStates/").transform);
				ObjectFinder.DeleteHealthManagerImmediate(obj);
				obj.SetActive(false);
				((Object)obj).name = ((Object)targetObject).name;
				string path2 = item2.path;
				Scene scene = targetObject.scene;
				ObjectInfo item = new ObjectInfo(obj, path2, ((Scene)(ref scene)).name, item2.isActive, targetObject.transform);
				bossState.BossSceneList.Add(item);
			}
			Object.DontDestroyOnLoad((Object)(object)GameObject.Find(path).transform);
		}

		public static void LoadBossState(BossState bossState, string path)
		{
			//IL_00b6: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			foreach (ObjectInfo item in FindBossScene())
			{
				if ((Object)(object)item.targetObject != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)item.targetObject);
				}
			}
			if (bossState.BossSceneList == null || bossState.BossSceneList.Count == 0)
			{
				return;
			}
			foreach (ObjectInfo bossScene in bossState.BossSceneList)
			{
				if (!((Object)(object)bossScene.targetObject == (Object)null))
				{
					GameObject obj = Object.Instantiate<GameObject>(bossScene.targetObject);
					((Object)obj).name = ((Object)bossScene.targetObject).name;
					ObjectFinder.PlaceGameObjectToPath(obj, bossScene.path, bossScene.sceneName);
					obj.transform.localPosition = bossScene.savedLocalPosition;
					obj.transform.localRotation = bossScene.savedLocalRotation;
					obj.transform.localScale = bossScene.savedLocalScale;
					obj.SetActive(true);
				}
			}
		}

		public static List<ObjectInfo> FindBossScene()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			List<ObjectInfo> list = new List<ObjectInfo>();
			for (int i = 0; i < SceneManager.sceneCount; i++)
			{
				Scene sceneAt = SceneManager.GetSceneAt(i);
				if (((Scene)(ref sceneAt)).name == "DontDestroyOnLoad" || ((Scene)(ref sceneAt)).name == "HideAndDontSave")
				{
					continue;
				}
				GameObject[] rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects();
				for (int j = 0; j < rootGameObjects.Length; j++)
				{
					Transform[] componentsInChildren = rootGameObjects[j].GetComponentsInChildren<Transform>(true);
					foreach (Transform val in componentsInChildren)
					{
						if (((Object)((Component)val).gameObject).name == "Boss Scene")
						{
							GameObject gameObject = ((Component)val).gameObject;
							string gameObjectPath = ObjectFinder.GetGameObjectPath(gameObject);
							Debug.Log((object)("Found Boss Scene: " + gameObjectPath));
							Scene scene = gameObject.scene;
							list.Add(new ObjectInfo(gameObject, gameObjectPath, ((Scene)(ref scene)).name, gameObject.activeSelf, gameObject.transform));
						}
					}
				}
			}
			return list;
		}
	}
}
namespace Snapshot_SilkSong.BattleState
{
	public class BattleState
	{
		public List<ObjectInfo> BattleSceneList;

		public BattleState()
		{
			BattleSceneList = new List<ObjectInfo>();
		}

		public static void SaveBattleState(BattleState battleState, string path)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			ObjectFinder.EnsureDontDestroyOnLoadObject(path, "BattleStates");
			foreach (ObjectInfo battleScene in battleState.BattleSceneList)
			{
				if ((Object)(object)battleScene.targetObject != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)battleScene.targetObject);
				}
			}
			battleState.BattleSceneList.Clear();
			List<ObjectInfo> list = FindBattleScene();
			if (list == null || list.Count == 0)
			{
				return;
			}
			foreach (ObjectInfo item2 in list)
			{
				GameObject targetObject = item2.targetObject;
				GameObject obj = Object.Instantiate<GameObject>(targetObject, GameObject.Find(path + "BattleStates/").transform);
				ObjectFinder.DeleteHealthManagerImmediate(obj);
				obj.SetActive(false);
				((Object)obj).name = ((Object)targetObject).name;
				string path2 = item2.path;
				Scene scene = targetObject.scene;
				ObjectInfo item = new ObjectInfo(obj, path2, ((Scene)(ref scene)).name, item2.isActive, targetObject.transform);
				battleState.BattleSceneList.Add(item);
			}
			Object.DontDestroyOnLoad((Object)(object)GameObject.Find(path).transform);
		}

		public static void LoadBattleState(BattleState battleState, string path)
		{
			//IL_00b6: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			foreach (ObjectInfo item in FindBattleScene())
			{
				if ((Object)(object)item.targetObject != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)item.targetObject);
				}
			}
			if (battleState.BattleSceneList == null || battleState.BattleSceneList.Count == 0)
			{
				return;
			}
			foreach (ObjectInfo battleScene in battleState.BattleSceneList)
			{
				if (!((Object)(object)battleScene.targetObject == (Object)null))
				{
					GameObject obj = Object.Instantiate<GameObject>(battleScene.targetObject);
					((Object)obj).name = ((Object)battleScene.targetObject).name;
					ObjectFinder.PlaceGameObjectToPath(obj, battleScene.path, battleScene.sceneName);
					obj.transform.localPosition = battleScene.savedLocalPosition;
					obj.transform.localRotation = battleScene.savedLocalRotation;
					obj.transform.localScale = battleScene.savedLocalScale;
					obj.SetActive(true);
				}
			}
		}

		public static List<ObjectInfo> FindBattleScene()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			List<ObjectInfo> list = new List<ObjectInfo>();
			for (int i = 0; i < SceneManager.sceneCount; i++)
			{
				Scene sceneAt = SceneManager.GetSceneAt(i);
				if (((Scene)(ref sceneAt)).name == "DontDestroyOnLoad" || ((Scene)(ref sceneAt)).name == "HideAndDontSave")
				{
					continue;
				}
				BattleScene[] array = Object.FindObjectsByType<BattleScene>((FindObjectsInactive)1, (FindObjectsSortMode)0);
				foreach (BattleScene val in array)
				{
					if ((Object)(object)val == (Object)null)
					{
						continue;
					}
					GameObject gameObject = ((Component)val).gameObject;
					if (!(gameObject.scene != sceneAt))
					{
						string gameObjectPath = ObjectFinder.GetGameObjectPath(gameObject);
						if (!gameObjectPath.Contains("Boss Scene"))
						{
							Scene scene = gameObject.scene;
							list.Add(new ObjectInfo(gameObject, gameObjectPath, ((Scene)(ref scene)).name, gameObject.activeSelf, gameObject.transform));
						}
					}
				}
			}
			return list;
		}
	}
}