Decompiled source of CustomSols v1.1.8

CustomSols.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using NineSolsAPI;
using RCGFSM.Projectiles;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using _2_Art._2_Character.HoHoYee.DummyPlayer;

[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("CustomSols")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Example Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2ca0558969b3f90c7d59ba2243b5baee408e1785")]
[assembly: AssemblyProduct("CustomSols")]
[assembly: AssemblyTitle("CustomSols")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CustomSols
{
	public class AssetLoader
	{
		private static string assetFolder;

		public static readonly Dictionary<string, Sprite> cachePlayerSprites = new Dictionary<string, Sprite>();

		public static readonly Dictionary<string, Sprite> cacheMenuLogoSprites = new Dictionary<string, Sprite>();

		public static readonly Dictionary<string, Sprite> cacheTalismanBallSprites = new Dictionary<string, Sprite>();

		public static readonly Dictionary<string, Sprite> cacheParrySprites = new Dictionary<string, Sprite>();

		public static readonly Dictionary<string, Sprite> cacheSwordSprites = new Dictionary<string, Sprite>();

		public static readonly Dictionary<string, Sprite> cacheBowSprites = new Dictionary<string, Sprite>();

		public static readonly Dictionary<string, Sprite> cacheFooSprites = new Dictionary<string, Sprite>();

		public static readonly Dictionary<string, Sprite> cacheOnlyOneSprites = new Dictionary<string, Sprite>();

		public static readonly Dictionary<string, Sprite> cacheUISprites = new Dictionary<string, Sprite>();

		public static readonly Dictionary<string, Sprite> cacheYingZhaoSprites = new Dictionary<string, Sprite>();

		public static Color? normalHpColor = null;

		public static Color? internalHpColor = null;

		public static Color? expRingOuterColor = null;

		public static Color? expRingInnerColor = null;

		public static Color? RageBarColor = null;

		public static Color? RageBarFrameColor = null;

		public static Color? ArrowLineBColor = null;

		public static Color? ArrowGlowColor = null;

		public static Color? ChiBallLeftLineColor = null;

		public static Color? ButterflyRightLineColor = null;

		public static Color? CoreCColor = null;

		public static Color? CoreDColor = null;

		public static Color? UCCharging1Color = null;

		public static Color? UCCharging2Color = null;

		public static Color? UCSuccess1Color = null;

		public static Color? UCSuccess2Color = null;

		public static Color? AirParryColor = null;

		public static Color? UCParryColor = null;

		public static Color? DashColor = null;

		public static Vector3? NormalArrowLv1Pos = null;

		public static Vector3? NormalArrowLv2Pos = null;

		public static Vector3? NormalArrowLv3Pos = null;

		public static void Init()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: 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_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			ColorFieldNull();
			assetFolder = Path.Combine(Path.Combine(Paths.ConfigPath, "CustomSols"), CustomSols.currSkinFolder ?? "Default");
			if (!Directory.Exists(assetFolder))
			{
				return;
			}
			foreach (KeyValuePair<string, (Dictionary<string, Sprite>, Vector2, float, Func<string, (Vector2, Vector4, float?)?>)> item5 in new Dictionary<string, (Dictionary<string, Sprite>, Vector2, float, Func<string, (Vector2, Vector4, float?)?>)>
			{
				{
					"MenuLogo",
					(cacheMenuLogoSprites, new Vector2(0.5f, 0f), 8f, (Func<string, (Vector2, Vector4, float?)?>)null)
				},
				{
					"Player",
					(cachePlayerSprites, new Vector2(0.5f, 0f), 8f, (Func<string, (Vector2, Vector4, float?)?>)delegate(string filename)
					{
						//IL_0017: Unknown result type (might be due to invalid IL or missing references)
						//IL_001c: Unknown result type (might be due to invalid IL or missing references)
						//IL_004c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0051: Unknown result type (might be due to invalid IL or missing references)
						if (filename.StartsWith("SavePointPowerToYee"))
						{
							return (new Vector2(0.5f, 0.5f), Vector4.zero, (float?)null);
						}
						return filename.StartsWith("Effect_HoHoYee_Parry_Sky") ? new(Vector2, Vector4, float?)?((new Vector2(0.5f, 0.5f), Vector4.zero, (float?)null)) : null;
					})
				},
				{
					"TalismanBall",
					(cacheTalismanBallSprites, new Vector2(0.18f, -1.2f), 8f, (Func<string, (Vector2, Vector4, float?)?>)null)
				},
				{
					"Parry",
					(cacheParrySprites, new Vector2(0.5f, 0f), 8f, (Func<string, (Vector2, Vector4, float?)?>)((string filename) => (!filename.StartsWith("ParrySparkAccurate")) ? null : new(Vector2, Vector4, float?)?((new Vector2(0.5f, 0.5f), Vector4.zero, (float?)null))))
				},
				{
					"Sword",
					(cacheSwordSprites, new Vector2(0.5f, 0.5f), 8f, (Func<string, (Vector2, Vector4, float?)?>)null)
				},
				{
					"Bow",
					(cacheBowSprites, new Vector2(0.5f, 0.5f), 8f, (Func<string, (Vector2, Vector4, float?)?>)delegate(string filename)
					{
						//IL_0017: 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)
						//IL_0060: Unknown result type (might be due to invalid IL or missing references)
						//IL_0079: Unknown result type (might be due to invalid IL or missing references)
						//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
						//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
						//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
						//IL_010b: Unknown result type (might be due to invalid IL or missing references)
						//IL_013c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0155: Unknown result type (might be due to invalid IL or missing references)
						if (filename.StartsWith("Lv1光束"))
						{
							return (new Vector2(0f, 0.5f), new Vector4(212f, 0f, 212f, 0f), (float?)null);
						}
						if (filename.StartsWith("Lv2光束"))
						{
							return (new Vector2(0f, 0.5f), new Vector4(220f, 0f, 220f, 0f), (float?)null);
						}
						if (filename.StartsWith("Lv3光束"))
						{
							return (new Vector2(0f, 0.5f), new Vector4(240f, 0f, 205f, 0f), (float?)null);
						}
						if (filename.Equals("circle_mask"))
						{
							return (new Vector2(0.5f, 0.5f), new Vector4(240f, 0f, 205f, 0f), (float?)100f);
						}
						return filename.Equals("ExplosionCenter") ? new(Vector2, Vector4, float?)?((new Vector2(0.5f, 0.5f), new Vector4(240f, 0f, 205f, 0f), (float?)100f)) : null;
					})
				},
				{
					"Foo",
					(cacheFooSprites, new Vector2(0.5f, 0.5f), 8f, (Func<string, (Vector2, Vector4, float?)?>)null)
				},
				{
					"PlayerSpriteAllUseThis",
					(cacheOnlyOneSprites, new Vector2(0.5f, 0f), 8f, (Func<string, (Vector2, Vector4, float?)?>)null)
				},
				{
					"UI",
					(cacheUISprites, new Vector2(0.5f, 0.5f), 8f, (Func<string, (Vector2, Vector4, float?)?>)delegate(string filename)
					{
						//IL_0017: Unknown result type (might be due to invalid IL or missing references)
						//IL_001c: Unknown result type (might be due to invalid IL or missing references)
						//IL_004d: Unknown result type (might be due to invalid IL or missing references)
						//IL_0052: Unknown result type (might be due to invalid IL or missing references)
						//IL_0083: Unknown result type (might be due to invalid IL or missing references)
						//IL_009c: Unknown result type (might be due to invalid IL or missing references)
						//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
						//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
						//IL_0103: 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_0139: Unknown result type (might be due to invalid IL or missing references)
						//IL_0152: Unknown result type (might be due to invalid IL or missing references)
						//IL_0183: Unknown result type (might be due to invalid IL or missing references)
						//IL_0188: Unknown result type (might be due to invalid IL or missing references)
						//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
						//IL_01be: Unknown result type (might be due to invalid IL or missing references)
						//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
						//IL_01f4: 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_022a: Unknown result type (might be due to invalid IL or missing references)
						//IL_0284: Unknown result type (might be due to invalid IL or missing references)
						//IL_0289: Unknown result type (might be due to invalid IL or missing references)
						//IL_025b: Unknown result type (might be due to invalid IL or missing references)
						//IL_0260: Unknown result type (might be due to invalid IL or missing references)
						if (filename.StartsWith("ChiBallLeftLine"))
						{
							return (new Vector2(0.5f, 0.5f), Vector4.zero, (float?)2f);
						}
						if (filename.StartsWith("ButterflyRightLine"))
						{
							return (new Vector2(0.5f, 0.5f), Vector4.zero, (float?)2f);
						}
						if (filename.Equals("ArrowLineA"))
						{
							return (new Vector2(0f, 0.5f), new Vector4(94f, 0f, 125f, 0f), (float?)2f);
						}
						if (filename.StartsWith("Arrow"))
						{
							return (new Vector2(0.5f, 0.5f), Vector4.zero, (float?)1f);
						}
						if (filename.StartsWith("ParryBalls"))
						{
							return (new Vector2(0.5f, 0.5f), Vector4.zero, (float?)2f);
						}
						if (filename.StartsWith("Line_V"))
						{
							return (new Vector2(0.5f, 0.5f), new Vector4(9f, 5f, 9f, 5f), (float?)2f);
						}
						if (filename.StartsWith("CoreB_fill"))
						{
							return (new Vector2(0.5f, 0.5f), Vector4.zero, (float?)2f);
						}
						if (filename.StartsWith("Icon_Blood"))
						{
							return (new Vector2(0.5f, 0.5f), Vector4.zero, (float?)2f);
						}
						if (filename.StartsWith("Icon_BloodEmpty"))
						{
							return (new Vector2(0.5f, 0.5f), Vector4.zero, (float?)2f);
						}
						if (filename.StartsWith("CoreC"))
						{
							return (new Vector2(0.5f, 0.5f), Vector4.zero, (float?)2f);
						}
						return filename.StartsWith("CoreD") ? new(Vector2, Vector4, float?)?((new Vector2(0.5f, 0.5f), Vector4.zero, (float?)2f)) : new(Vector2, Vector4, float?)?((new Vector2(0.5f, 0.5f), Vector4.zero, (float?)8f));
					})
				},
				{
					"YingZhao",
					(cacheYingZhaoSprites, new Vector2(0.5f, 0.5f), 8f, (Func<string, (Vector2, Vector4, float?)?>)null)
				}
			})
			{
				item5.Deconstruct(out var key, out var value);
				(Dictionary<string, Sprite>, Vector2, float, Func<string, (Vector2, Vector4, float?)?>) tuple = value;
				string path = key;
				Dictionary<string, Sprite> item = tuple.Item1;
				Vector2 item2 = tuple.Item2;
				float item3 = tuple.Item3;
				Func<string, (Vector2, Vector4, float?)?> item4 = tuple.Item4;
				string text = Path.Combine(assetFolder, path);
				if (Directory.Exists(text))
				{
					LoadSpritesSync(text, item, item2, item3, item4);
				}
				else
				{
					item.Clear();
				}
			}
			LoadConfigs();
		}

		private static void LoadConfigs()
		{
			string path = Path.Combine(assetFolder, "skinConfig.json");
			if (!File.Exists(path))
			{
				return;
			}
			try
			{
				MainConfig mainConfig = JsonConvert.DeserializeObject<MainConfig>(File.ReadAllText(path));
				if (mainConfig != null)
				{
					ColorConfig colors = mainConfig.Colors;
					TrySetColor(ref normalHpColor, colors.NormalHpColor);
					TrySetColor(ref internalHpColor, colors.InternalHpColor);
					TrySetColor(ref expRingOuterColor, colors.ExpRingOuterColor);
					TrySetColor(ref expRingInnerColor, colors.ExpRingInnerColor);
					TrySetColor(ref RageBarColor, colors.RageBarColor);
					TrySetColor(ref RageBarFrameColor, colors.RageBarFrameColor);
					TrySetColor(ref ArrowLineBColor, colors.ArrowLineBColor);
					TrySetColor(ref ArrowGlowColor, colors.ArrowGlowColor);
					TrySetColor(ref ChiBallLeftLineColor, colors.ChiBallLeftLineColor);
					TrySetColor(ref ButterflyRightLineColor, colors.ButterflyRightLineColor);
					TrySetColor(ref CoreCColor, colors.CoreCColor);
					TrySetColor(ref CoreDColor, colors.CoreDColor);
					ParryConfig parry = mainConfig.Parry;
					TrySetColor(ref UCCharging1Color, parry.UCCharging1Color);
					TrySetColor(ref UCCharging2Color, parry.UCCharging2Color);
					TrySetColor(ref UCSuccess1Color, parry.UCSuccess1Color);
					TrySetColor(ref UCSuccess2Color, parry.UCSuccess2Color);
					TrySetColor(ref AirParryColor, parry.AirParryColor);
					TrySetColor(ref UCParryColor, parry.UCParryColor);
					TrySetColor(ref DashColor, parry.DashColor);
					BowConfig bow = mainConfig.Bow;
					TrySetVector3(ref NormalArrowLv1Pos, bow.NormalArrowLv1);
					TrySetVector3(ref NormalArrowLv2Pos, bow.NormalArrowLv2);
					TrySetVector3(ref NormalArrowLv3Pos, bow.NormalArrowLv3);
				}
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)("Config Load Error: " + ex.Message));
			}
		}

		private static void LoadSpritesSync(string folder, Dictionary<string, Sprite> cache, Vector2 defaultPivot, float defaultPpu, Func<string, (Vector2 pivot, Vector4 border, float? ppu)?> pivotBorderSelector = null)
		{
			//IL_002e: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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)
			cache.Clear();
			string[] files;
			try
			{
				files = Directory.GetFiles(folder, "*.png", SearchOption.TopDirectoryOnly);
			}
			catch
			{
				return;
			}
			string[] array = files;
			foreach (string obj2 in array)
			{
				string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(obj2);
				Vector2 pivot = defaultPivot;
				Vector4 border = default(Vector4);
				float pixelsPerUnit = defaultPpu;
				if (pivotBorderSelector != null)
				{
					(Vector2, Vector4, float?)? tuple = pivotBorderSelector(fileNameWithoutExtension);
					if (tuple.HasValue)
					{
						pivot = tuple.Value.Item1;
						border = tuple.Value.Item2;
						pixelsPerUnit = tuple.Value.Item3.GetValueOrDefault(defaultPpu);
					}
				}
				Sprite val = LoadSprite(obj2, pivot, pixelsPerUnit, border);
				if ((Object)(object)val != (Object)null)
				{
					cache[fileNameWithoutExtension] = val;
				}
			}
		}

		public static string[] GetAllDirectories(string directory)
		{
			try
			{
				return Directory.GetDirectories(directory, "*", SearchOption.TopDirectoryOnly);
			}
			catch
			{
				return Array.Empty<string>();
			}
		}

		public static Sprite LoadSprite(string file, Vector2 pivot, float pixelsPerUnit, Vector4 border = default(Vector4))
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				byte[] array = File.ReadAllBytes(file);
				Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
				if (ImageConversion.LoadImage(val, array))
				{
					((Texture)val).wrapMode = (TextureWrapMode)1;
					string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
					Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), pivot, pixelsPerUnit, 0u, (SpriteMeshType)0, border);
					((Object)obj).name = fileNameWithoutExtension;
					return obj;
				}
				Object.Destroy((Object)(object)val);
				return null;
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)("Error loading " + Path.GetFileName(file) + ": " + ex.Message));
				return null;
			}
		}

		private static void TrySetVector3(ref Vector3? field, float[] vectorArray)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (vectorArray != null && vectorArray.Length == 3)
			{
				field = new Vector3(vectorArray[0], vectorArray[1], vectorArray[2]);
			}
		}

		private static void TrySetColor(ref Color? field, string hexColor)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Color value = default(Color);
			if (!string.IsNullOrWhiteSpace(hexColor) && hexColor != "#" && ColorUtility.TryParseHtmlString(hexColor, ref value))
			{
				field = value;
			}
		}

		private static void ColorFieldNull()
		{
			normalHpColor = null;
			internalHpColor = null;
			expRingOuterColor = null;
			expRingInnerColor = null;
			RageBarColor = null;
			RageBarFrameColor = null;
			ArrowLineBColor = null;
			ArrowGlowColor = null;
			ChiBallLeftLineColor = null;
			ButterflyRightLineColor = null;
			CoreCColor = null;
			CoreDColor = null;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("CustomSols", "CustomSols", "1.0.0")]
	public class CustomSols : BaseUnityPlugin
	{
		private Harmony harmony;

		private Dictionary<string, SpriteRenderer> cachedSpriteRenderers = new Dictionary<string, SpriteRenderer>();

		private static bool isAssetsLoaded = false;

		public ConfigEntry<bool> openFolder;

		public ConfigEntry<bool> isToastPlayerSprite;

		public ConfigEntry<bool> isToastPlayerDummySprite;

		private ConfigEntry<float> spriteDelaySecond;

		private ConfigEntry<KeyboardShortcut> reloadShortcut;

		private ConfigEntry<string?> skins;

		public static string currSkinFolder = "";

		private string basePath = "";

		private int currentSpriteIndex = 1;

		private float spriteChangeTimer;

		public static bool arrowInit = false;

		public static bool arrowInit2 = false;

		private static string playerSpriteName = "";

		private static string playerDummySpriteName = "";

		private static readonly int TintColorID = Shader.PropertyToID("_TintColor");

		private static readonly int MainTexID = Shader.PropertyToID("_MainTex");

		public static SpriteRenderer? CurrentDummyRenderer = null;

		public static List<SpriteRenderer> DummyRenderers = new List<SpriteRenderer>();

		private ParticleSystemRenderer? _cachedUCSuccess;

		private ParticleSystemRenderer? _cachedUCCharging;

		private List<SpriteRenderer> _cachedTalismanBalls = new List<SpriteRenderer>();

		private bool _talismanSearched;

		public static readonly HashSet<string> bowSpritePaths = new HashSet<string> { "GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Yee_Skill/HoHoYee_Archery/Bow", "GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Yee_Skill/HoHoYee_Archery/Bow/Bow_A" };

		public static readonly HashSet<string> swordSpritePaths = new HashSet<string> { "HoHoYee_AttackA_PoolObject_Variant(Clone)/Sprite", "HoHoYee_AttackB_PoolObject_Variant(Clone)/Sprite", "HoHoYee_AttackC ThirdAttack Effect(Clone)/Sprite", "Yee 氣刃 chi blade(Clone)/Projectile FSM/FSM Animator/View/Sprite", "HoHoYee_AttackC ThirdAttack 劍氣玉 Effect(Clone)/Sprite", "GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/Effect_Attack/ChargeAttack/ChargeAttackSprite", "HoHoYee_Charging 蓄力攻擊特效(Clone)/ChargeAttackSprite", "HoHoYee_Charging 蓄力攻擊特效(Clone)/Super Charge Ability/childNode/ChargeAttackSprite" };

		public static CustomSols instance { get; private set; } = null;


		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
			harmony = Harmony.CreateAndPatchAll(typeof(CustomSols).Assembly, (string)null);
			SetupConfig();
			KeybindManager.Add((MonoBehaviour)(object)this, (Action)Reload, (Func<KeyboardShortcut>)(() => reloadShortcut.Value));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CustomSols is loaded!");
		}

		private void Start()
		{
			InitializeAssets();
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void InitializeAssets()
		{
			isAssetsLoaded = false;
			AssetLoader.Init();
			if (!(currSkinFolder == "Default"))
			{
				isAssetsLoaded = true;
				CacheSpriteRenderers();
				ChangeMenuLogo();
				ChangeUIChiBall();
				ImPerfectParry();
				SwordOnce();
				InitializeBowSprites();
				UpdateExpRing();
				UpdateHpBar();
				UpdatePotion();
				UpdateLineA();
				UpdateEightGua();
				UpdateArrowLine();
				UpdateRightLine();
				UpdateArrowBullet();
				YingZhaoOnce();
				AirParryColor();
			}
		}

		private void LateUpdate()
		{
			if (!isAssetsLoaded)
			{
				return;
			}
			PlayerSprite();
			AirParry();
			UCParryColor();
			PerfectParry();
			Dash();
			AirJump();
			UCAroundEffect();
			UCSuccess();
			UCCharging();
			TalismanBall();
			Foo();
			Sword();
			YingZhao();
			UpdateHeartSprite();
			UpdateArrowIcon();
			UpdateArrowColor();
			UpdateButterflySprite();
			if (isToastPlayerSprite.Value)
			{
				Player i = Player.i;
				object obj;
				if (i == null)
				{
					obj = null;
				}
				else
				{
					SpriteRenderer playerSprite = i.PlayerSprite;
					obj = ((playerSprite != null) ? playerSprite.sprite : null);
				}
				Sprite val = (Sprite)obj;
				if ((Object)(object)val != (Object)null)
				{
					CheckAndToast(val, ref playerSpriteName);
				}
			}
			if (isToastPlayerDummySprite.Value)
			{
				SpriteRenderer? currentDummyRenderer = CurrentDummyRenderer;
				Sprite val2 = ((currentDummyRenderer != null) ? currentDummyRenderer.sprite : null);
				if ((Object)(object)val2 != (Object)null)
				{
					CheckAndToast(val2, ref playerDummySpriteName, "Dummy: ");
				}
			}
		}

		private void CheckAndToast(Sprite sprite, ref string cachedName, string prefix = "")
		{
			if (!((Object)(object)sprite == (Object)null))
			{
				string name = ((Object)sprite).name;
				if (cachedName != name)
				{
					cachedName = name;
					ToastManager.Toast((object)(prefix + name));
				}
			}
		}

		private void ChangeMenuLogo()
		{
			if (!isAssetsLoaded || AssetLoader.cacheMenuLogoSprites == null || AssetLoader.cacheMenuLogoSprites.Count == 0)
			{
				return;
			}
			GameObject val = GameObject.Find("MenuLogic/MainMenuLogic/Providers/MenuUIPanel/Logo");
			if ((Object)(object)val != (Object)null)
			{
				Image component = val.GetComponent<Image>();
				if (component != null && AssetLoader.cacheMenuLogoSprites.TryGetValue("9sLOGO_1", out Sprite value))
				{
					component.sprite = value;
				}
			}
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			_cachedUCSuccess = null;
			_cachedUCCharging = null;
			_cachedTalismanBalls.Clear();
			_talismanSearched = false;
			CacheSpriteRenderers();
			ChangeMenuLogo();
			ChangeUIChiBall();
			ImPerfectParry();
			SwordOnce();
			InitializeBowSprites();
			UpdateExpRing();
			UpdateHpBar();
			UpdatePotion();
			UpdateLineA();
			UpdateEightGua();
			UpdateArrowLine();
			UpdateRightLine();
			UpdateArrowBullet();
			YingZhaoOnce();
			AirParryColor();
			arrowInit = false;
			arrowInit2 = false;
		}

		private void SetupConfig()
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			openFolder = ((BaseUnityPlugin)this).Config.Bind<bool>("Folder", "Open CustomSols Folder", false, "");
			isToastPlayerSprite = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Toast Player Sprite Name", false, "");
			isToastPlayerDummySprite = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Toast Player Dummy Sprite Name", false, "");
			spriteDelaySecond = ((BaseUnityPlugin)this).Config.Bind<float>("Sprite Delay Second", "PlayerSpriteAllUseThis Sprite Delay Second", 0.12f, "");
			reloadShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcut", "Reload Shortcut", new KeyboardShortcut((KeyCode)104, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), "");
			basePath = Path.Combine(Paths.ConfigPath, "CustomSols");
			skins = ((BaseUnityPlugin)this).Config.Bind<string>("Skin List", "Select Skin", (string)null, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueList<string>(AssetLoader.GetAllDirectories(basePath).Select(Path.GetFileName).ToArray()), Array.Empty<object>()));
			currSkinFolder = skins.Value ?? "Default";
			skins.SettingChanged += delegate
			{
				currSkinFolder = skins.Value;
				InitializeAssets();
			};
			openFolder.SettingChanged += delegate
			{
				Process.Start(basePath);
			};
		}

		private void CacheSpriteRenderers()
		{
			cachedSpriteRenderers.Clear();
			SpriteRenderer[] array = Object.FindObjectsOfType<SpriteRenderer>(true);
			foreach (SpriteRenderer val in array)
			{
				string gameObjectPath = GetGameObjectPath(((Component)val).gameObject);
				if (cachedSpriteRenderers.ContainsKey(gameObjectPath))
				{
					cachedSpriteRenderers[gameObjectPath + "_2"] = val;
				}
				else
				{
					cachedSpriteRenderers[gameObjectPath] = val;
				}
			}
		}

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

		private void ChangeUIChiBall()
		{
			if (AssetLoader.cacheUISprites == null || AssetLoader.cacheUISprites.Count == 0)
			{
				return;
			}
			string[] array = new string[5] { "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/ParryCharge/ParryBalls/ParryPoint/BG/Rotate/Fill", "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/ParryCharge/ParryBalls/ParryPoint (5)/BG/Rotate/Fill", "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/ParryCharge/ParryBalls/ParryPoint (6)/BG/Rotate/Fill", "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/ParryCharge/ParryBalls/ParryPoint (7)/BG/Rotate/Fill", "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/ParryCharge/ParryBalls/ParryPoint (8)/BG/Rotate/Fill" };
			if (!AssetLoader.cacheUISprites.TryGetValue("ParryBalls", out Sprite value))
			{
				return;
			}
			string[] array2 = array;
			foreach (string key in array2)
			{
				if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value2))
				{
					value2.sprite = value;
				}
			}
		}

		private void ImPerfectParry()
		{
			if (AssetLoader.cacheParrySprites == null || AssetLoader.cacheParrySprites.Count == 0)
			{
				return;
			}
			ParticleSystemRenderer[] array = Object.FindObjectsOfType<ParticleSystemRenderer>(true);
			foreach (ParticleSystemRenderer val in array)
			{
				if (((Object)((Component)val).transform.parent).name == "YeeParryEffect_Not Accurate(Clone)" && AssetLoader.cacheParrySprites.TryGetValue("imPerfect", out Sprite value))
				{
					((Renderer)val).materials[1].SetTexture("_MainTex", (Texture)(object)value.texture);
				}
			}
		}

		private void PerfectParry()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Invalid comparison between Unknown and I4
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (AssetLoader.cacheParrySprites != null && AssetLoader.cacheParrySprites.Count != 0 && cachedSpriteRenderers.TryGetValue("YeeParryEffectAccurate_Green(Clone)/ParrySparkAccurate0", out SpriteRenderer value) && AssetLoader.cacheParrySprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
			{
				value.sprite = value2;
				((Component)value).transform.rotation = Quaternion.Euler(0f, ((int)((Actor)Player.i).Facing == -1) ? 180f : 0f, 0f);
			}
		}

		private void AirParry()
		{
			if (AssetLoader.cachePlayerSprites != null && AssetLoader.cachePlayerSprites.Count != 0 && cachedSpriteRenderers.TryGetValue("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/AbilityChecker/Ability 識破/Effect_TAICHIParry_Air/Effect_JumpFeet", out SpriteRenderer value) && AssetLoader.cachePlayerSprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
			{
				value.sprite = value2;
			}
		}

		private void Dash()
		{
			if (AssetLoader.cachePlayerSprites != null && AssetLoader.cachePlayerSprites.Count != 0)
			{
				string text = "Effect_Roll Dodge AfterImage(Clone)/Effect_HoHoYee_AirJump0";
				if (cachedSpriteRenderers.TryGetValue(text, out SpriteRenderer value))
				{
					ApplyToRenderer(value);
				}
				if (cachedSpriteRenderers.TryGetValue(text + "_2", out SpriteRenderer value2))
				{
					ApplyToRenderer(value2);
				}
			}
		}

		private void ApplyToRenderer(SpriteRenderer renderer)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (AssetLoader.cachePlayerSprites.TryGetValue(((Object)renderer.sprite).name, out Sprite value))
			{
				renderer.sprite = value;
			}
			if (AssetLoader.DashColor.HasValue)
			{
				renderer.color = AssetLoader.DashColor.Value;
			}
		}

		private void AirJump()
		{
			if (AssetLoader.cachePlayerSprites != null && AssetLoader.cachePlayerSprites.Count != 0 && cachedSpriteRenderers.TryGetValue("Effect_AirJump(Clone)/Effect_HoHoYee_AirJump0", out SpriteRenderer value) && AssetLoader.cachePlayerSprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
			{
				value.sprite = value2;
			}
		}

		private void UCAroundEffect()
		{
			if (AssetLoader.cacheParrySprites != null && AssetLoader.cacheParrySprites.Count != 0 && cachedSpriteRenderers.TryGetValue("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Effect_TAICHIParry/Effect_ParryCounterAttack0", out SpriteRenderer value) && AssetLoader.cacheParrySprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
			{
				value.sprite = value2;
			}
		}

		private void UCSuccess()
		{
			UpdateParticleEffect("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Effect_TAICHIParry/P_Charging", ref _cachedUCSuccess, AssetLoader.UCSuccess1Color, AssetLoader.UCSuccess2Color, "UCSuccess", "UCSuccess2");
		}

		private void UCCharging()
		{
			UpdateParticleEffect("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Effect_TAICHIParry/P_Charging C", ref _cachedUCCharging, AssetLoader.UCCharging1Color, AssetLoader.UCCharging2Color, "UCCharging", "UCCharging2");
		}

		private void UpdateParticleEffect(string path, ref ParticleSystemRenderer cachedRenderer, Color? color1, Color? color2, string spriteKey1, string spriteKey2)
		{
			//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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			if (AssetLoader.cacheParrySprites == null)
			{
				return;
			}
			if ((Object)(object)cachedRenderer == (Object)null)
			{
				GameObject val = GameObject.Find(path);
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				cachedRenderer = val.GetComponent<ParticleSystemRenderer>();
				ParticleSystem component = val.GetComponent<ParticleSystem>();
				if (color1.HasValue && (Object)(object)component != (Object)null)
				{
					MainModule main = component.main;
					((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color1.Value);
				}
				if (color2.HasValue && ((Renderer)cachedRenderer).sharedMaterials.Length > 1)
				{
					((Renderer)cachedRenderer).materials[1].SetColor(TintColorID, color2.Value);
				}
			}
			if ((Object)(object)cachedRenderer != (Object)null)
			{
				Material[] materials = ((Renderer)cachedRenderer).materials;
				if (AssetLoader.cacheParrySprites.TryGetValue(spriteKey1, out Sprite value))
				{
					materials[0].SetTexture(MainTexID, (Texture)(object)value.texture);
				}
				if (materials.Length > 1 && AssetLoader.cacheParrySprites.TryGetValue(spriteKey2, out Sprite value2))
				{
					materials[1].SetTexture(MainTexID, (Texture)(object)value2.texture);
				}
			}
		}

		private void TalismanBall()
		{
			if (AssetLoader.cacheTalismanBallSprites == null)
			{
				return;
			}
			if (!_talismanSearched)
			{
				GameObject val = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Effect_Foo");
				if ((Object)(object)val != (Object)null && val.activeSelf)
				{
					for (int i = 1; i <= 5; i++)
					{
						Transform obj = val.transform.Find($"FooDots/D{i}/FooDot ({i})/JENG/Ball");
						SpriteRenderer val2 = ((obj != null) ? ((Component)obj).GetComponent<SpriteRenderer>() : null);
						if ((Object)(object)val2 != (Object)null)
						{
							_cachedTalismanBalls.Add(val2);
						}
					}
					_talismanSearched = true;
				}
			}
			foreach (SpriteRenderer cachedTalismanBall in _cachedTalismanBalls)
			{
				if ((Object)(object)cachedTalismanBall != (Object)null && (Object)(object)cachedTalismanBall.sprite != (Object)null && AssetLoader.cacheTalismanBallSprites.TryGetValue(((Object)cachedTalismanBall.sprite).name, out Sprite value))
				{
					cachedTalismanBall.sprite = value;
				}
			}
		}

		private void PlayerSprite()
		{
			Dictionary<string, Sprite> cacheOnlyOneSprites = AssetLoader.cacheOnlyOneSprites;
			Dictionary<string, Sprite> cachePlayerSprites = AssetLoader.cachePlayerSprites;
			if (cacheOnlyOneSprites != null && cacheOnlyOneSprites.Count > 0 && Player.i?.PlayerSprite != null)
			{
				spriteChangeTimer += Time.deltaTime;
				if (!cacheOnlyOneSprites.TryGetValue(currentSpriteIndex.ToString(), out var value))
				{
					return;
				}
				Player.i.PlayerSprite.sprite = value;
				if (spriteChangeTimer >= spriteDelaySecond.Value)
				{
					currentSpriteIndex++;
					if (!cacheOnlyOneSprites.ContainsKey(currentSpriteIndex.ToString()))
					{
						currentSpriteIndex = 1;
					}
					spriteChangeTimer = 0f;
				}
			}
			else
			{
				if (cachePlayerSprites == null || cachePlayerSprites.Count <= 0)
				{
					return;
				}
				Player i = Player.i;
				object obj;
				if (i == null)
				{
					obj = null;
				}
				else
				{
					SpriteRenderer playerSprite = i.PlayerSprite;
					obj = ((playerSprite != null) ? playerSprite.sprite : null);
				}
				if (obj == null)
				{
					return;
				}
				string name = ((Object)Player.i.PlayerSprite.sprite).name;
				if (cachePlayerSprites.TryGetValue(name, out var value2))
				{
					Player.i.PlayerSprite.sprite = value2;
				}
				DummyRenderers.RemoveAll((SpriteRenderer r) => (Object)(object)r == (Object)null);
				foreach (SpriteRenderer dummyRenderer in DummyRenderers)
				{
					if ((Object)(object)dummyRenderer.sprite != (Object)null && cachePlayerSprites.TryGetValue(((Object)dummyRenderer.sprite).name, out var value3))
					{
						dummyRenderer.sprite = value3;
					}
				}
			}
		}

		private void InitializeBowSprites()
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			if (AssetLoader.cacheBowSprites == null || AssetLoader.cacheBowSprites.Count == 0)
			{
				return;
			}
			foreach (string bowSpritePath in bowSpritePaths)
			{
				if (cachedSpriteRenderers.TryGetValue(bowSpritePath, out SpriteRenderer value) && AssetLoader.cacheBowSprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
				{
					value.sprite = value2;
				}
			}
			GameObject[] array = Object.FindObjectsOfType<GameObject>(true);
			foreach (GameObject val in array)
			{
				if (((Object)val).name.StartsWith("NormalArrow Shoot 穿雲 Lv"))
				{
					if (((Object)val).name.StartsWith("NormalArrow Shoot 穿雲 Lv1"))
					{
						val.transform.Find("光束").localPosition = AssetLoader.NormalArrowLv1Pos.Value;
					}
					if (((Object)val).name.StartsWith("NormalArrow Shoot 穿雲 Lv2"))
					{
						val.transform.Find("光束").localPosition = AssetLoader.NormalArrowLv2Pos.Value;
					}
					if (((Object)val).name.StartsWith("NormalArrow Shoot 穿雲 Lv3"))
					{
						val.transform.Find("光束").localPosition = AssetLoader.NormalArrowLv3Pos.Value;
					}
					UpdateBowSprite(val, "光束");
					UpdateBowSprite(val, "NormalArrow");
					UpdateBowSprite(val, "NormalArrow/ChasingArrowLight");
				}
				else if (((Object)val).name.StartsWith("ExplodingArrow Shooter 爆破發射器 Lv"))
				{
					UpdateBowSprite(val, "Exploding Arrow/ExplodingArrow/ExplodingArrow");
					UpdateBowSprite(val, "Exploding Arrow/ExplodingArrow/ChasingArrowLight");
					UpdateBowSprite(val, "Exploding Arrow/EnergyBall/Core");
				}
				else if (((Object)val).name.StartsWith("Explosion Damage 爆破箭 閃電 lv"))
				{
					Transform obj = val.transform.Find("ATTACK/Core");
					SpriteRenderer val2 = ((obj != null) ? ((Component)obj).GetComponent<SpriteRenderer>() : null);
					if ((Object)(object)val2 != (Object)null && (Object)(object)val2.sprite != (Object)null && AssetLoader.cacheBowSprites.TryGetValue("ExplosionCenter", out Sprite value3))
					{
						val2.sprite = value3;
					}
				}
				else if (((Object)val).name.StartsWith("Chasing Arrow Shooter 飛天御劍 lv"))
				{
					for (int j = 1; j <= 2; j++)
					{
						UpdateBowSprite(val, $"Circle Shooter/Arrow ({j})/ChasingArrow /ChasingArrowLight");
						UpdateBowSprite(val, $"Circle Shooter/Arrow ({j})/ChasingArrow /Parent 刺/刺/刺");
						UpdateBowSprite(val, $"Circle Shooter/Arrow ({j})/ChasingArrow /Parent 刺/刺 (1)/刺");
					}
				}
			}
		}

		public static void UpdateBowSprite(GameObject parent, string childPath)
		{
			if (!((Object)(object)parent == (Object)null))
			{
				Transform obj = parent.transform.Find(childPath);
				SpriteRenderer val = ((obj != null) ? ((Component)obj).GetComponent<SpriteRenderer>() : null);
				if ((Object)(object)val != (Object)null && (Object)(object)val.sprite != (Object)null && AssetLoader.cacheBowSprites.TryGetValue(((Object)val.sprite).name, out Sprite value))
				{
					val.sprite = value;
				}
			}
		}

		private void Sword()
		{
			if (AssetLoader.cacheSwordSprites == null || AssetLoader.cacheSwordSprites.Count == 0)
			{
				return;
			}
			foreach (string swordSpritePath in swordSpritePaths)
			{
				if (cachedSpriteRenderers.TryGetValue(swordSpritePath, out SpriteRenderer value) && (Object)(object)value != (Object)null && (Object)(object)value.sprite != (Object)null && AssetLoader.cacheSwordSprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
				{
					value.sprite = value2;
				}
			}
		}

		private void SwordOnce()
		{
			if (AssetLoader.cacheSwordSprites == null || AssetLoader.cacheSwordSprites.Count == 0)
			{
				return;
			}
			string[] array = new string[5] { "F1", "F2", "F3", "F4", "F5" };
			foreach (string text in array)
			{
				if ((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/ChargeAttackParticle/P_PowerCharged/" + text) != (Object)null && AssetLoader.cacheSwordSprites.TryGetValue("FooSmokeGlow", out Sprite value))
				{
					((Renderer)GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/ChargeAttackParticle/P_PowerCharged/" + text).GetComponent<ParticleSystemRenderer>()).materials[1].SetTexture("_MainTex", (Texture)(object)value.texture);
				}
			}
			if ((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/ChargeAttackParticle/P_PowerCharging/P_hit") != (Object)null && AssetLoader.cacheSwordSprites.TryGetValue("bubbletrail", out Sprite value2))
			{
				((Renderer)GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/ChargeAttackParticle/P_PowerCharging/P_hit").GetComponent<ParticleSystemRenderer>()).materials[1].SetTexture("_MainTex", (Texture)(object)value2.texture);
			}
		}

		private void Foo()
		{
			if (AssetLoader.cacheFooSprites == null || AssetLoader.cacheFooSprites.Count == 0)
			{
				return;
			}
			foreach (var (key, key2) in new Dictionary<string, string>
			{
				{ "FooPrefab Deposit(Clone)/Foo Charm Deposit/Animator(StartShouldDisable)/Effect_Foo/FOO", "Effect_Foo4" },
				{ "FooPrefab Deposit(Clone)/Foo Charm Deposit/Animator(StartShouldDisable)/流派/一氣貫通/Effect_一氣貫通/FOO", "Effect_Foo3" },
				{ "FooPrefab Deposit(Clone)/Foo Charm Deposit/Animator(StartShouldDisable)/流派/行雲流水/Effect_行雲流水/FOO", "Effect_Foo3" },
				{ "FooPrefab Deposit(Clone)/Foo Charm Deposit/Animator(StartShouldDisable)/流派/收放自如/Effect_收放自如/FOO", "Effect_Foo3" }
			})
			{
				if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value) && AssetLoader.cacheFooSprites.TryGetValue(key2, out Sprite value2))
				{
					value.sprite = value2;
				}
			}
		}

		private void YingZhaoOnce()
		{
			if (cachedSpriteRenderers.TryGetValue("A2_S5_ BossHorseman_GameLevel/Room/StealthGameMonster_SpearHorseMan/MonsterCore/Animator(Proxy)/Animator/SpearHorseMan/DDS/SpearHorseMan_HorseBodyD/SpearHorseMan_HorseBody_A", out SpriteRenderer value) && AssetLoader.cacheYingZhaoSprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
			{
				value.sprite = value2;
			}
			if (cachedSpriteRenderers.TryGetValue("A2_S5_ BossHorseman_GameLevel/Room/StealthGameMonster_SpearHorseMan/MonsterCore/Animator(Proxy)/Animator/SpearHorseMan/DDS/SpearHorseMan_HorseBodyD/SpearHorseMan_HorseBody_A/bone_1/bone_2/SpearHorseMan_HorseBody_B", out SpriteRenderer value3) && AssetLoader.cacheYingZhaoSprites.TryGetValue(((Object)value3.sprite).name, out Sprite value4))
			{
				value3.sprite = value4;
			}
		}

		private void YingZhao()
		{
			if (AssetLoader.cacheYingZhaoSprites != null && AssetLoader.cacheYingZhaoSprites.Count != 0)
			{
				if (cachedSpriteRenderers.TryGetValue("A2_S5_ BossHorseman_GameLevel/Room/StealthGameMonster_SpearHorseMan/MonsterCore/Animator(Proxy)/Animator/SpearHorseMan/DDS/Body_Attack_D (F)", out SpriteRenderer value) && AssetLoader.cacheYingZhaoSprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
				{
					value.sprite = value2;
				}
				if (cachedSpriteRenderers.TryGetValue("A2_S5_ BossHorseman_GameLevel/Room/StealthGameMonster_SpearHorseMan/MonsterCore/Animator(Proxy)/Animator/SpearHorseMan/DDS/SpearHorseMan_HorseBodyD", out SpriteRenderer value3) && AssetLoader.cacheYingZhaoSprites.TryGetValue(((Object)value3.sprite).name, out Sprite value4))
				{
					value3.sprite = value4;
				}
				if (cachedSpriteRenderers.TryGetValue("A2_S5_ BossHorseman_GameLevel/Room/StealthGameMonster_SpearHorseMan/MonsterCore/Animator(Proxy)/Animator/SpearHorseMan/DDS/EFFECT/SlashA", out SpriteRenderer value5) && AssetLoader.cacheYingZhaoSprites.TryGetValue(((Object)value5.sprite).name, out Sprite value6))
				{
					value5.sprite = value6;
				}
			}
		}

		private void UpdateHeartSprite()
		{
			if (AssetLoader.cacheUISprites != null && AssetLoader.cacheUISprites.Count != 0)
			{
				string key = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/EXP_RING/HUD_Heart/Heart";
				if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value) && (Object)(object)value.sprite != (Object)null && AssetLoader.cacheUISprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
				{
					value.sprite = value2;
				}
			}
		}

		private void UpdateArrowIcon()
		{
			if (AssetLoader.cacheUISprites != null && AssetLoader.cacheUISprites.Count != 0)
			{
				string key = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/ItemSelection/CurrentItemPanel spr/ItemPic";
				if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value) && (Object)(object)value.sprite != (Object)null && AssetLoader.cacheUISprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
				{
					value.sprite = value2;
				}
			}
		}

		private void UpdateArrowColor()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			if (AssetLoader.cacheUISprites == null || AssetLoader.cacheUISprites.Count == 0)
			{
				return;
			}
			if (cachedSpriteRenderers.TryGetValue("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/ItemSelection/CurrentItemPanel spr/Glow", out SpriteRenderer value) && AssetLoader.ArrowGlowColor.HasValue)
			{
				value.color = AssetLoader.ArrowGlowColor.Value;
			}
			AssetLoader.cacheUISprites.TryGetValue("BlockOutline", out Sprite value2);
			AssetLoader.cacheUISprites.TryGetValue("Block", out Sprite value3);
			if ((Object)(object)value2 == (Object)null && (Object)(object)value3 == (Object)null)
			{
				return;
			}
			for (int i = 0; i <= 7; i++)
			{
				string obj = ((i == 0) ? "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/slots/RagePart_spr" : string.Format("{0}RagePart_spr ({1})", "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/slots/", i));
				string key = obj + "/RageBar Frame";
				string key2 = obj + "/RageBar";
				if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value4) && AssetLoader.RageBarFrameColor.HasValue)
				{
					value4.color = AssetLoader.RageBarFrameColor.Value;
				}
				if (cachedSpriteRenderers.TryGetValue(key2, out SpriteRenderer value5) && AssetLoader.RageBarColor.HasValue)
				{
					value5.color = AssetLoader.RageBarColor.Value;
				}
			}
		}

		private void UpdateButterflySprite()
		{
			if (AssetLoader.cacheUISprites == null || AssetLoader.cacheUISprites.Count == 0)
			{
				return;
			}
			string[] array = new string[3] { "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/RightDown/Butterfly_UIHintPanel/TESLA BUTTERFlY/Butterfly/Butterfly", "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/RightDown/Butterfly_UIHintPanel/TESLA BUTTERFlY/Butterfly/ButterflyIcon Color", "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/RightDown/Butterfly_UIHintPanel/TESLA BUTTERFlY/Butterfly/ButterflyIcon" };
			foreach (string key in array)
			{
				if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value) && (Object)(object)value.sprite != (Object)null && (Object)(object)value.sprite != (Object)null && AssetLoader.cacheUISprites.TryGetValue(((Object)value.sprite).name, out Sprite value2) && (Object)(object)value.sprite != (Object)null && AssetLoader.cacheUISprites.TryGetValue(((Object)value.sprite).name, out Sprite _))
				{
					value.sprite = value2;
				}
			}
		}

		private void UpdateExpRing()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			if (AssetLoader.cacheUISprites != null)
			{
				string key = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/EXP_RING/CoreB(ExpUILogic)";
				if (AssetLoader.expRingOuterColor.HasValue && cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value) && AssetLoader.expRingOuterColor.HasValue)
				{
					value.color = AssetLoader.expRingOuterColor.Value;
				}
				string key2 = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/EXP_RING/CoreB(ExpUILogic)/BarFill";
				if (AssetLoader.expRingInnerColor.HasValue && cachedSpriteRenderers.TryGetValue(key2, out SpriteRenderer value2) && AssetLoader.expRingInnerColor.HasValue)
				{
					value2.color = AssetLoader.expRingInnerColor.Value;
				}
			}
		}

		private void UpdateHpBar()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			if (AssetLoader.cacheUISprites != null)
			{
				string key = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/HealthBarBase/HealthBar/BG renderer/Health";
				if (AssetLoader.normalHpColor.HasValue && cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value) && AssetLoader.normalHpColor.HasValue)
				{
					value.color = AssetLoader.normalHpColor.Value;
				}
				string key2 = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/HealthBarBase/HealthBar/BG renderer/RecoverableHealth";
				if (AssetLoader.internalHpColor.HasValue && cachedSpriteRenderers.TryGetValue(key2, out SpriteRenderer value2) && AssetLoader.internalHpColor.HasValue)
				{
					value2.color = AssetLoader.internalHpColor.Value;
				}
			}
		}

		private void UpdatePotion()
		{
			if (AssetLoader.cacheUISprites == null || AssetLoader.cacheUISprites.Count == 0)
			{
				return;
			}
			Sprite value;
			Sprite val = (AssetLoader.cacheUISprites.TryGetValue("Icon_BloodEmpty", out value) ? value : null);
			Sprite value2;
			Sprite val2 = (AssetLoader.cacheUISprites.TryGetValue("Icon_Blood", out value2) ? value2 : null);
			if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null)
			{
				return;
			}
			for (int i = 0; i <= 7; i++)
			{
				string obj = ((i == 0) ? "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/Potion/PotionIMG" : string.Format("{0}PotionIMG ({1})", "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/Potion/", i));
				string text = obj + "/GameObject";
				GameObject val3 = GameObject.Find(obj);
				if (!((Object)(object)val3 != (Object)null))
				{
					continue;
				}
				SpriteRenderer component = val3.GetComponent<SpriteRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					component.sprite = val;
				}
				GameObject val4 = GameObject.Find(text);
				if ((Object)(object)val4 != (Object)null)
				{
					SpriteRenderer component2 = val4.GetComponent<SpriteRenderer>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.sprite = val2;
					}
				}
			}
		}

		private void UpdateLineA()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			string key = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/ParryCharge/LineA";
			if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value))
			{
				if (AssetLoader.cacheUISprites.TryGetValue("ChiBallLeftLine", out Sprite value2))
				{
					value.sprite = value2;
				}
				if (AssetLoader.ChiBallLeftLineColor.HasValue)
				{
					value.color = AssetLoader.ChiBallLeftLineColor.Value;
				}
			}
		}

		private void UpdateEightGua()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			string key = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/EXP_RING/CoreC";
			if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value))
			{
				if (AssetLoader.cacheUISprites.TryGetValue("CoreC", out Sprite value2))
				{
					value.sprite = value2;
				}
				if (AssetLoader.CoreCColor.HasValue)
				{
					value.color = AssetLoader.CoreCColor.Value;
				}
			}
			string key2 = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/EXP_RING/CoreD";
			if (cachedSpriteRenderers.TryGetValue(key2, out SpriteRenderer value3))
			{
				if (AssetLoader.cacheUISprites.TryGetValue("CoreD", out Sprite value4))
				{
					value3.sprite = value4;
				}
				if (AssetLoader.CoreDColor.HasValue)
				{
					value3.color = AssetLoader.CoreDColor.Value;
				}
			}
		}

		private void UpdateArrowLine()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			string key = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/ArrowLineB (1)";
			if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value))
			{
				if (AssetLoader.cacheUISprites.TryGetValue("ArrowLineA", out Sprite value2))
				{
					value.sprite = value2;
				}
				if (AssetLoader.ArrowLineBColor.HasValue)
				{
					value.color = AssetLoader.ArrowLineBColor.Value;
				}
			}
		}

		private void UpdateRightLine()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			string key = "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/RightDown/Butterfly_UIHintPanel/LineA";
			if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value))
			{
				if (AssetLoader.cacheUISprites.TryGetValue("ButterflyRightLine", out Sprite value2))
				{
					value.sprite = value2;
				}
				if (AssetLoader.ButterflyRightLineColor.HasValue)
				{
					value.color = AssetLoader.ButterflyRightLineColor.Value;
				}
			}
		}

		private void AirParryColor()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			string key = "GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/AbilityChecker/Ability 識破/Effect_TAICHIParry_Air/YeeParryBlink/BlinkLight";
			if (AssetLoader.AirParryColor.HasValue && cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value) && AssetLoader.AirParryColor.HasValue)
			{
				value.color = AssetLoader.AirParryColor.Value;
			}
		}

		private void UCParryColor()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			string key = "GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Effect_TAICHIParry/YeeParryBlink/BlinkLight";
			if (AssetLoader.UCParryColor.HasValue && cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value) && AssetLoader.UCParryColor.HasValue)
			{
				value.color = AssetLoader.UCParryColor.Value;
			}
		}

		private void UpdateArrowBullet()
		{
			Sprite value;
			Sprite val = (AssetLoader.cacheUISprites.TryGetValue("BlockOutline", out value) ? value : null);
			Sprite value2;
			Sprite val2 = (AssetLoader.cacheUISprites.TryGetValue("Block", out value2) ? value2 : null);
			if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null)
			{
				return;
			}
			for (int i = 0; i <= 7; i++)
			{
				string obj = ((i == 0) ? "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/slots/RagePart_spr" : string.Format("{0}RagePart_spr ({1})", "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/slots/", i));
				string key = obj + "/RageBar Frame";
				string key2 = obj + "/RageBar";
				if (cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value3))
				{
					value3.sprite = val;
				}
				if (cachedSpriteRenderers.TryGetValue(key2, out SpriteRenderer value4))
				{
					value4.sprite = val2;
				}
			}
		}

		private void Reload()
		{
			_cachedUCSuccess = null;
			_cachedUCCharging = null;
			_cachedTalismanBalls.Clear();
			_talismanSearched = false;
			InitializeAssets();
			ChangeMenuLogo();
			ChangeUIChiBall();
			ImPerfectParry();
			SwordOnce();
			InitializeBowSprites();
			UpdateExpRing();
			UpdateHpBar();
			UpdatePotion();
			UpdateLineA();
			UpdateEightGua();
			UpdateArrowLine();
			UpdateRightLine();
			UpdateArrowBullet();
			YingZhaoOnce();
		}

		private void OnDestroy()
		{
			harmony.UnpatchSelf();
		}
	}
	internal static class Log
	{
		private static ManualLogSource? logSource;

		internal static void Init(ManualLogSource logSource)
		{
			Log.logSource = logSource;
		}

		internal static void Debug(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogDebug(data);
			}
		}

		internal static void Error(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogError(data);
			}
		}

		internal static void Fatal(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogFatal(data);
			}
		}

		internal static void Info(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogInfo(data);
			}
		}

		internal static void Message(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogMessage(data);
			}
		}

		internal static void Warning(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogWarning(data);
			}
		}
	}
	public class MainConfig
	{
		public ColorConfig Colors { get; set; } = new ColorConfig();


		public ParryConfig Parry { get; set; } = new ParryConfig();


		public BowConfig Bow { get; set; } = new BowConfig();

	}
	public class ColorConfig
	{
		public string NormalHpColor { get; set; } = "#FF0000";


		public string InternalHpColor { get; set; } = string.Empty;


		public string ExpRingOuterColor { get; set; } = string.Empty;


		public string ExpRingInnerColor { get; set; } = string.Empty;


		public string RageBarColor { get; set; } = string.Empty;


		public string RageBarFrameColor { get; set; } = string.Empty;


		public string ArrowLineBColor { get; set; } = string.Empty;


		public string ArrowGlowColor { get; set; } = string.Empty;


		public string ChiBallLeftLineColor { get; set; } = string.Empty;


		public string ButterflyRightLineColor { get; set; } = string.Empty;


		public string CoreCColor { get; set; } = string.Empty;


		public string CoreDColor { get; set; } = string.Empty;

	}
	public class ParryConfig
	{
		public string UCCharging1Color { get; set; } = string.Empty;


		public string UCCharging2Color { get; set; } = string.Empty;


		public string UCSuccess1Color { get; set; } = string.Empty;


		public string UCSuccess2Color { get; set; } = string.Empty;


		public string AirParryColor { get; set; } = string.Empty;


		public string UCParryColor { get; set; } = string.Empty;


		public string DashColor { get; set; } = string.Empty;

	}
	public class BowConfig
	{
		public float[] NormalArrowLv1 { get; set; } = new float[3];


		public float[] NormalArrowLv2 { get; set; } = new float[3];


		public float[] NormalArrowLv3 { get; set; } = new float[3];

	}
	[HarmonyPatch]
	public class Patches
	{
		[HarmonyPatch(typeof(PlayerArrowProjectileFollower), "Update")]
		[HarmonyPrefix]
		private static bool HookArrow(PlayerArrowProjectileFollower __instance)
		{
			if (AssetLoader.cacheBowSprites == null || AssetLoader.cacheBowSprites.Count == 0)
			{
				return true;
			}
			string[] array = new string[3] { "Projectile FSM/FSM Animator/View/ChasingArrow /ChasingArrowLight", "Projectile FSM/FSM Animator/View/ChasingArrow /Parent 刺/刺/刺", "Projectile FSM/FSM Animator/View/ChasingArrow /Parent 刺/刺 (1)/刺" };
			foreach (string text in array)
			{
				Transform obj = ((Component)__instance).transform.Find(text);
				SpriteRenderer val = ((obj != null) ? ((Component)obj).GetComponent<SpriteRenderer>() : null);
				if ((Object)(object)val != (Object)null && AssetLoader.cacheBowSprites.TryGetValue(((Object)val.sprite).name, out Sprite value))
				{
					val.sprite = value;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(PoolManager), "Borrow", new Type[]
		{
			typeof(PoolObject),
			typeof(Vector3),
			typeof(Quaternion),
			typeof(Transform),
			typeof(Action<PoolObject>)
		})]
		[HarmonyPostfix]
		public static void Postfix(ref PoolObject __result, PoolObject prefab, Vector3 position, Quaternion rotation, Transform parent = null, Action<PoolObject> handler = null)
		{
			if (!CustomSols.arrowInit || !CustomSols.arrowInit2)
			{
				if (((Object)prefab).name == "ExplodingArrow Shooter 爆破發射器 Lv3")
				{
					GameObject gameObject = ((Component)__result).gameObject;
					CustomSols.UpdateBowSprite(gameObject, "Exploding Arrow/ExplodingArrow/ExplodingArrow");
					CustomSols.UpdateBowSprite(gameObject, "Exploding Arrow/ExplodingArrow/ChasingArrowLight");
					CustomSols.UpdateBowSprite(gameObject, "Exploding Arrow/EnergyBall/Core");
					CustomSols.arrowInit = true;
				}
				if (((Object)prefab).name == "Explosion Damage 爆破箭 閃電 lv3")
				{
					CustomSols.UpdateBowSprite(((Component)__result).gameObject, "ATTACK/Core");
					CustomSols.arrowInit2 = true;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "SetPlayerView")]
		private static void CatchCutsceneDummy(bool active)
		{
			if (!active)
			{
				if ((Object)(object)Player.i == (Object)null || (Object)(object)Player.i.replacePlayer == (Object)null)
				{
					return;
				}
				SpriteRenderer componentInChildren = ((Component)((Component)Player.i.replacePlayer).transform.parent).GetComponentInChildren<SpriteRenderer>(true);
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					if (!CustomSols.DummyRenderers.Contains(componentInChildren))
					{
						CustomSols.DummyRenderers.Add(componentInChildren);
					}
					CustomSols.CurrentDummyRenderer = componentInChildren;
				}
			}
			else
			{
				CustomSols.CurrentDummyRenderer = null;
			}
		}

		private static void AddToDummyList(SpriteRenderer renderer)
		{
			if ((Object)(object)renderer != (Object)null && !CustomSols.DummyRenderers.Contains(renderer))
			{
				CustomSols.DummyRenderers.Add(renderer);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(_2dxFX_Twist), "OnEnable")]
		private static void CatchRootDummy(_2dxFX_Twist __instance)
		{
			AddToDummyList(((Component)((Component)__instance).transform).GetComponentInChildren<SpriteRenderer>(true));
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ScaleFollowByPlayerFacing), "OnEnable")]
		private static void CatchElevatorDummy(ScaleFollowByPlayerFacing __instance)
		{
			AddToDummyList(((Component)((Component)__instance).transform).GetComponentInChildren<SpriteRenderer>(true));
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(_2dxFX_NewTeleportation2), "OnEnable")]
		private static void CatchLevelUpDummy(_2dxFX_NewTeleportation2 __instance)
		{
			AddToDummyList(((Component)((Component)__instance).transform).GetComponentInChildren<SpriteRenderer>(true));
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(_2dxFX_GoldFX), "OnEnable")]
		private static void CatchHealDummy(_2dxFX_GoldFX __instance)
		{
			SpriteRenderer[] componentsInChildren = ((Component)((Component)__instance).transform.parent).GetComponentsInChildren<SpriteRenderer>(true);
			if (componentsInChildren == null || componentsInChildren.Length == 0)
			{
				return;
			}
			SpriteRenderer[] array = componentsInChildren;
			foreach (SpriteRenderer item in array)
			{
				if (!CustomSols.DummyRenderers.Contains(item))
				{
					CustomSols.DummyRenderers.Add(item);
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CustomSols";

		public const string PLUGIN_NAME = "CustomSols";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}