Decompiled source of CustomSols v1.1.2

CustomSols.dll

Decompiled a month 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;

[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+28fa3dbeecb5e8608f92333eb93c6ab09b56cb40")]
[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 Color? normalHpColor = null;

		public static Color? internalHpColor = null;

		public static Color? expRingOuterColor = null;

		public static Color? expRingInnerColor = null;

		public static Vector3? NormalArrowLv1Pos = null;

		public static Vector3? NormalArrowLv2Pos = null;

		public static Vector3? NormalArrowLv3Pos = null;

		public static void Init()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			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?)?>)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));
					})
				}
			})
			{
				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);
				}
			}
			string path2 = Path.Combine(assetFolder, "UI", "color.json");
			if (File.Exists(path2))
			{
				ColorConfig colorConfig = JsonConvert.DeserializeObject<ColorConfig>(File.ReadAllText(path2));
				TrySetColor(ref normalHpColor, colorConfig.NormalHpColor);
				TrySetColor(ref internalHpColor, colorConfig.InternalHpColor);
				TrySetColor(ref expRingOuterColor, colorConfig.ExpRingOuterColor);
				TrySetColor(ref expRingInnerColor, colorConfig.ExpRingInnerColor);
			}
			string path3 = Path.Combine(assetFolder, "Bow", "bow.json");
			if (!File.Exists(path3))
			{
				return;
			}
			try
			{
				BowConfig bowConfig = JsonConvert.DeserializeObject<BowConfig>(File.ReadAllText(path3));
				TrySetVector3(ref NormalArrowLv1Pos, bowConfig.NormalArrowLv1);
				TrySetVector3(ref NormalArrowLv2Pos, bowConfig.NormalArrowLv2);
				TrySetVector3(ref NormalArrowLv3Pos, bowConfig.NormalArrowLv3);
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)("Failed to load bow.json: " + 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			cache.Clear();
			string[] allFilesWithExtensions = GetAllFilesWithExtensions(folder, "png");
			foreach (string text in allFilesWithExtensions)
			{
				string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
				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(text, pivot, pixelsPerUnit, border);
				if ((Object)(object)val != (Object)null && !cache.ContainsKey(fileNameWithoutExtension))
				{
					cache.Add(fileNameWithoutExtension, val);
				}
				else if ((Object)(object)val == (Object)null)
				{
					ToastManager.Toast((object)("Failed to load sprite: " + fileNameWithoutExtension + " from " + text));
				}
			}
		}

		public static string[] GetAllFilesWithExtensions(string directory, params string[] extensions)
		{
			string directory2 = directory;
			try
			{
				return extensions.SelectMany((string ext) => Directory.GetFiles(directory2, "*." + ext, SearchOption.TopDirectoryOnly)).ToArray();
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)("Failed to access directory " + directory2 + ": " + ex.Message));
				return Array.Empty<string>();
			}
		}

		public static string[] GetAllDirectories(string directory)
		{
			try
			{
				return Directory.GetDirectories(directory, "*", SearchOption.TopDirectoryOnly);
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)("Failed to access directory " + directory + ": " + ex.Message));
				return Array.Empty<string>();
			}
		}

		public static Sprite LoadSprite(string file, Vector2 pivot, float pixelsPerUnit, Vector4 border = default(Vector4))
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!File.Exists(file))
				{
					ToastManager.Toast((object)("File does not exist: " + file));
					return null;
				}
				byte[] array = File.ReadAllBytes(file);
				Texture2D val = new Texture2D(2, 2);
				string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
				if (ImageConversion.LoadImage(val, array))
				{
					Sprite obj = (((fileNameWithoutExtension.StartsWith("Lv") && fileNameWithoutExtension.Contains("光束")) || fileNameWithoutExtension.Equals("Line_V")) ? Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), pivot, pixelsPerUnit, 0u, (SpriteMeshType)0, border) : 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;
				}
				ToastManager.Toast((object)("Failed to load sprite: " + file));
				return null;
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)("Exception loading " + 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]);
			}
			else
			{
				ToastManager.Toast((object)("Invalid Vector3 data: " + JsonConvert.SerializeObject((object)vectorArray)));
			}
		}

		private static void TrySetColor(ref Color? field, string hexColor)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			Color? val = ParseColor(hexColor);
			if (val.HasValue)
			{
				field = val.Value;
			}
		}

		private static Color? ParseColor(string hexColor)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrWhiteSpace(hexColor) || hexColor == "#")
			{
				return null;
			}
			Color value = default(Color);
			if (ColorUtility.TryParseHtmlString(hexColor, ref value))
			{
				return value;
			}
			return null;
		}
	}
	public class ColorConfig
	{
		public string NormalHpColor { get; set; }

		public string InternalHpColor { get; set; }

		public string ExpRingOuterColor { get; set; }

		public string ExpRingInnerColor { get; set; }
	}
	public class BowConfig
	{
		public float[] NormalArrowLv1 { get; set; }

		public float[] NormalArrowLv2 { get; set; }

		public float[] NormalArrowLv3 { get; set; }
	}
	[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;

		private ConfigEntry<float> spriteDelaySecond;

		private ConfigEntry<Color> UCChargingColor;

		private ConfigEntry<Color> UCSuccessColor;

		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;

		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();
			isAssetsLoaded = true;
			CacheSpriteRenderers();
			ChangeMenuLogo();
			ChangeUIChiBall();
			ImPerfectParry();
			SwordOnce();
			InitializeBowSprites();
			UpdateExpRing();
			UpdateHpBar();
			UpdatePotion();
			UpdateLineA();
			UpdateEightGua();
			UpdateArrowLine();
			UpdateRightLine();
			UpdateArrowBullet();
		}

		private void LateUpdate()
		{
			if (isAssetsLoaded)
			{
				PlayerSprite();
				PerfectParry();
				Dash();
				AirJump();
				UCAroundEffect();
				UCSuccess();
				UCCharging();
				TalismanBall();
				Foo();
				Sword();
				UpdateHeartSprite();
				UpdateArrowIcon();
				UpdateButterflySprite();
				if (isToastPlayerSprite.Value && (Object)(object)Player.i?.PlayerSprite != (Object)null)
				{
					ToastManager.Toast((object)((Object)Player.i.PlayerSprite.sprite).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)
		{
			CacheSpriteRenderers();
			ChangeMenuLogo();
			ChangeUIChiBall();
			ImPerfectParry();
			SwordOnce();
			InitializeBowSprites();
			UpdateExpRing();
			UpdateHpBar();
			UpdatePotion();
			UpdateLineA();
			UpdateEightGua();
			UpdateArrowLine();
			UpdateRightLine();
			UpdateArrowBullet();
			arrowInit = false;
			arrowInit2 = false;
		}

		private void SetupConfig()
		{
			//IL_008c: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: 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, "");
			spriteDelaySecond = ((BaseUnityPlugin)this).Config.Bind<float>("Sprite Delay Second", "PlayerSpriteAllUseThis Sprite Delay Second", 0.12f, "");
			UCChargingColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Color", "UCCharging Color", new Color(1f, 0.837f, 0f, 1f), "");
			UCSuccessColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Color", "UCSuccess Color", new Color(1f, 0.718f, 1f, 1f), "");
			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);
				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/PlayerUI 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 Dash()
		{
			if (AssetLoader.cachePlayerSprites != null && AssetLoader.cachePlayerSprites.Count != 0 && cachedSpriteRenderers.TryGetValue("Effect_Roll Dodge AfterImage(Clone)/Effect_HoHoYee_AirJump0", out SpriteRenderer value) && AssetLoader.cachePlayerSprites.TryGetValue(((Object)value.sprite).name, out Sprite value2))
			{
				value.sprite = value2;
			}
		}

		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()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			if (AssetLoader.cacheParrySprites != null && AssetLoader.cacheParrySprites.Count != 0)
			{
				GameObject val = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Effect_TAICHIParry/P_Charging");
				if (val != null && AssetLoader.cacheParrySprites.TryGetValue("UCSuccess", out Sprite value))
				{
					((Renderer)val.GetComponent<ParticleSystemRenderer>()).materials[0].SetTexture("_MainTex", (Texture)(object)value.texture);
					val.GetComponent<ParticleSystem>().startColor = UCSuccessColor.Value;
				}
			}
		}

		private void UCCharging()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			if (AssetLoader.cacheParrySprites != null && AssetLoader.cacheParrySprites.Count != 0)
			{
				GameObject val = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Effect_TAICHIParry/P_Charging C");
				if (val != null && AssetLoader.cacheParrySprites.TryGetValue("UCCharging", out Sprite value))
				{
					((Renderer)val.GetComponent<ParticleSystemRenderer>()).materials[0].SetTexture("_MainTex", (Texture)(object)value.texture);
					val.GetComponent<ParticleSystem>().startColor = UCChargingColor.Value;
				}
			}
		}

		private void TalismanBall()
		{
			if (AssetLoader.cacheTalismanBallSprites == null || AssetLoader.cacheTalismanBallSprites.Count == 0)
			{
				return;
			}
			GameObject val = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Effect_Foo");
			if (val == null || !val.activeSelf)
			{
				return;
			}
			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 && !string.IsNullOrEmpty(((Object)val2.sprite).name) && AssetLoader.cacheTalismanBallSprites.TryGetValue(((Object)val2.sprite).name, out Sprite value))
				{
					val2.sprite = value;
				}
			}
		}

		private void PlayerSprite()
		{
			Dictionary<string, Sprite> cacheOnlyOneSprites = AssetLoader.cacheOnlyOneSprites;
			if (cacheOnlyOneSprites != null && cacheOnlyOneSprites.Count > 0 && Player.i?.PlayerSprite != null)
			{
				spriteChangeTimer += Time.deltaTime;
				if (!AssetLoader.cacheOnlyOneSprites.TryGetValue(currentSpriteIndex.ToString(), out Sprite value))
				{
					return;
				}
				Player.i.PlayerSprite.sprite = value;
				if (spriteChangeTimer >= spriteDelaySecond.Value)
				{
					currentSpriteIndex++;
					if (!AssetLoader.cacheOnlyOneSprites.ContainsKey(currentSpriteIndex.ToString()))
					{
						currentSpriteIndex = 1;
					}
					spriteChangeTimer = 0f;
				}
				return;
			}
			cacheOnlyOneSprites = AssetLoader.cachePlayerSprites;
			if (cacheOnlyOneSprites != null && cacheOnlyOneSprites.Count > 0)
			{
				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 && AssetLoader.cachePlayerSprites.TryGetValue(((Object)Player.i.PlayerSprite.sprite).name, out Sprite value2))
				{
					Player.i.PlayerSprite.sprite = value2;
				}
			}
		}

		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 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 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_006e: Unknown result type (might be due to invalid IL or missing references)
			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/CoreB(ExpUILogic)";
				if (AssetLoader.expRingOuterColor.HasValue && cachedSpriteRenderers.TryGetValue(key, out SpriteRenderer value))
				{
					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))
				{
					value2.color = AssetLoader.expRingInnerColor.Value;
				}
			}
		}

		private void UpdateHpBar()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			if (AssetLoader.cacheUISprites != null && AssetLoader.cacheUISprites.Count != 0)
			{
				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))
				{
					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))
				{
					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()
		{
			if ((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/ParryCharge/LineA") != (Object)null && AssetLoader.cacheUISprites.TryGetValue("ChiBallLeftLine", out Sprite value))
			{
				GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/ParryCharge/LineA").GetComponent<SpriteRenderer>().sprite = value;
			}
		}

		private void UpdateEightGua()
		{
			if ((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/EXP_RING/CoreC") != (Object)null && AssetLoader.cacheUISprites.TryGetValue("CoreC", out Sprite value))
			{
				GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/EXP_RING/CoreC").GetComponent<SpriteRenderer>().sprite = value;
			}
			if ((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/EXP_RING/CoreD") != (Object)null && AssetLoader.cacheUISprites.TryGetValue("CoreD", out Sprite value2))
			{
				GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/EXP_RING/CoreD").GetComponent<SpriteRenderer>().sprite = value2;
			}
		}

		private void UpdateArrowLine()
		{
			if ((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/ArrowLineB (1)") != (Object)null && AssetLoader.cacheUISprites.TryGetValue("ArrowLineA", out Sprite value))
			{
				GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/ArrowLineB (1)").GetComponent<SpriteRenderer>().sprite = value;
			}
		}

		private void UpdateRightLine()
		{
			if ((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/RightDown/Butterfly_UIHintPanel/LineA") != (Object)null && AssetLoader.cacheUISprites.TryGetValue("ButterflyRightLine", out Sprite value))
			{
				GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/RightDown/Butterfly_UIHintPanel/LineA").GetComponent<SpriteRenderer>().sprite = value;
			}
		}

		private void UpdateArrowBullet()
		{
			if ((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/slots/RagePart_spr/RageBar Frame") != (Object)null && AssetLoader.cacheUISprites.TryGetValue("BlockOutline", out Sprite value))
			{
				GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/slots/RagePart_spr/RageBar Frame").GetComponent<SpriteRenderer>().sprite = value;
			}
			if ((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/slots/RagePart_spr/RageBar") != (Object)null && AssetLoader.cacheUISprites.TryGetValue("Block", out Sprite value2))
			{
				GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftDown/Bow UI Area/RageUI renderer/slots/RagePart_spr/RageBar").GetComponent<SpriteRenderer>().sprite = value2;
			}
			AssetLoader.cacheUISprites.TryGetValue("BlockOutline", out Sprite value3);
			AssetLoader.cacheUISprites.TryGetValue("Block", out Sprite value4);
			if ((Object)(object)value3 == (Object)null && (Object)(object)value4 == (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 text = obj + "/RageBar Frame";
				string text2 = obj + "/RageBar";
				GameObject val = GameObject.Find(text);
				if (!((Object)(object)val != (Object)null))
				{
					continue;
				}
				SpriteRenderer component = val.GetComponent<SpriteRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					component.sprite = value3;
				}
				GameObject val2 = GameObject.Find(text2);
				if ((Object)(object)val2 != (Object)null)
				{
					SpriteRenderer component2 = val2.GetComponent<SpriteRenderer>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.sprite = value4;
					}
				}
			}
		}

		private void Reload()
		{
			InitializeAssets();
			ChangeMenuLogo();
			ChangeUIChiBall();
			ImPerfectParry();
			SwordOnce();
			InitializeBowSprites();
			UpdateExpRing();
			UpdateHpBar();
			UpdatePotion();
			UpdateLineA();
			UpdateEightGua();
			UpdateArrowLine();
			UpdateRightLine();
			UpdateArrowBullet();
		}

		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);
			}
		}
	}
	[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;
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CustomSols";

		public const string PLUGIN_NAME = "CustomSols";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}