Decompiled source of More Colours v1.0.1

MoreColours.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 System.Text;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MoreColours")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreColours")]
[assembly: AssemblyTitle("MoreColours")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace MoreColours;

internal static class Applier
{
	private class RowOrig
	{
		public Color typing;

		public Color typed;

		public Color score;
	}

	private class VitalsOrig
	{
		public Color hFill;

		public Color hTrail;

		public Color fFill;

		public Color fTrail;

		public Color pFill;

		public Color pTrail;

		public Color fireFill;

		public Color fireTrail;

		public Color hIcon;

		public Color fIcon;
	}

	private class BossOrig
	{
		public Color trail;

		public Color timer;

		public Color name;
	}

	public static bool Dirty = true;

	private static GameInfo _giCaptured;

	private static Color _oRed;

	private static Color _oGreen;

	private static Color _oOrange;

	private static Color _oMini;

	private static Color _oCommon;

	private static Color _oRare;

	private static Color _oLegend;

	private static Gradient _oDrip;

	private static Gradient _customDrip;

	private static int _dripHash;

	private static readonly List<PlayerKillScore> KillScores = new List<PlayerKillScore>();

	private static readonly Dictionary<BonusScoreRow, RowOrig> RowOrigs = new Dictionary<BonusScoreRow, RowOrig>();

	private static readonly Dictionary<PlayerKillScore, Color> MultOrigs = new Dictionary<PlayerKillScore, Color>();

	private static readonly Dictionary<VitalsUI, VitalsOrig> Vitals = new Dictionary<VitalsUI, VitalsOrig>();

	private static readonly Dictionary<CloseItemsUI, Color> RadarOrigs = new Dictionary<CloseItemsUI, Color>();

	private static float _nextRadarScan;

	private static readonly Dictionary<BossUI, BossOrig> Bosses = new Dictionary<BossUI, BossOrig>();

	private static TextMeshProUGUI _moneyText;

	private static Color _moneyOrig;

	private static readonly Dictionary<Graphic, Color> GraphicOrigs = new Dictionary<Graphic, Color>();

	private static float _nextHudScan;

	private static readonly List<WeaponUI> WeaponUIs = new List<WeaponUI>();

	private static readonly List<CanvasManager> Canvases = new List<CanvasManager>();

	private static readonly List<ItemUI> ItemUIs = new List<ItemUI>();

	private static readonly List<NpcUI> NpcUIs = new List<NpcUI>();

	private static readonly List<VoiceUI> VoiceUIs = new List<VoiceUI>();

	private static readonly List<PlayerInventory> Inventories = new List<PlayerInventory>();

	private static readonly List<TMP_Text> VersionTexts = new List<TMP_Text>();

	private static ModSettings S => MoreColoursPlugin.S;

	private static void Tint(Graphic g, ColorOv ov)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)g == (Object)null))
		{
			if (!GraphicOrigs.TryGetValue(g, out var value))
			{
				value = g.color;
				GraphicOrigs[g] = value;
			}
			g.color = ((ov != null && ov.on) ? ov.c : value);
		}
	}

	public static Color OrigOf(Graphic g, Color fallback)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)g == (Object)null)
		{
			return fallback;
		}
		if (!GraphicOrigs.TryGetValue(g, out var value))
		{
			return g.color;
		}
		return value;
	}

	public static void RegisterKillScore(PlayerKillScore ks)
	{
		//IL_00c9: 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_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: 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)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: 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_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: 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_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)ks == (Object)null || KillScores.Contains(ks))
		{
			return;
		}
		KillScores.Add(ks);
		BonusScoreRow main = Refl.Get<BonusScoreRow>(ks, typeof(PlayerKillScore), "_mainBonusScoreRow");
		CaptureRow(main);
		List<BonusScoreRow> list = Refl.Get<List<BonusScoreRow>>(ks, typeof(PlayerKillScore), "_bonusRows");
		if (list != null)
		{
			foreach (BonusScoreRow item in list)
			{
				CaptureRow(item);
			}
		}
		TextMeshProUGUI val = Refl.Get<TextMeshProUGUI>(ks, typeof(PlayerKillScore), "_multiplierText");
		if ((Object)(object)val != (Object)null && !MultOrigs.ContainsKey(ks))
		{
			MultOrigs[ks] = ((Graphic)val).color;
		}
		VanillaCache van = S.van;
		if (!van.hasPopup && (Object)(object)main != (Object)null && RowOrigs.TryGetValue(main, out var value))
		{
			van.popupMainTyping = value.typing;
			van.popupMainTyped = value.typed;
			van.popupMainScore = value.score;
			if ((Object)(object)val != (Object)null)
			{
				van.popupMult = (MultOrigs.TryGetValue(ks, out var value2) ? value2 : ((Graphic)val).color);
			}
			BonusScoreRow val2 = list?.FirstOrDefault((Func<BonusScoreRow, bool>)((BonusScoreRow r) => (Object)(object)r != (Object)null && (Object)(object)r != (Object)(object)main));
			if ((Object)(object)val2 != (Object)null && RowOrigs.TryGetValue(val2, out var value3))
			{
				van.popupBonusTyping = value3.typing;
				van.popupBonusTyped = value3.typed;
				van.popupBonusScore = value3.score;
			}
			van.hasPopup = true;
			van.v2 = true;
			MoreColoursPlugin.CfgDirty = true;
		}
		Dirty = true;
	}

	private static void CaptureRow(BonusScoreRow row)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: 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_0079: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)row == (Object)null) && !RowOrigs.ContainsKey(row))
		{
			RowOrigs[row] = new RowOrig
			{
				typing = Refl.Get<Color>(row, typeof(BonusScoreRow), "_typingColor"),
				typed = Refl.Get<Color>(row, typeof(BonusScoreRow), "_typedColor"),
				score = (((Object)(object)row.ScoreText != (Object)null) ? ((Graphic)row.ScoreText).color : Color.white)
			};
		}
	}

	public static void RegisterVitals(VitalsUI v)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: 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)
		//IL_0078: 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_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: 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_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)v == (Object)null) && !Vitals.ContainsKey(v))
		{
			VitalsOrig vitalsOrig = new VitalsOrig
			{
				hFill = ImgColor(v, "_healthPercent"),
				hTrail = ImgColor(v, "_healthPercentLerped"),
				fFill = ImgColor(v, "_fullnessPercent"),
				fTrail = ImgColor(v, "_fullnessPercentLerped"),
				pFill = ImgColor(v, "_poisonPercent"),
				pTrail = ImgColor(v, "_poisonPercentLerped"),
				fireFill = ImgColor(v, "_firePercent"),
				fireTrail = ImgColor(v, "_firePercentLerped"),
				hIcon = Refl.Get<Color>(v, typeof(VitalsUI), "_healthColor"),
				fIcon = Refl.Get<Color>(v, typeof(VitalsUI), "_fullnessColor")
			};
			Vitals[v] = vitalsOrig;
			VanillaCache van = S.van;
			if (!van.hasVitals)
			{
				van.vHealthFill = vitalsOrig.hFill;
				van.vHealthTrail = vitalsOrig.hTrail;
				van.vHungerFill = vitalsOrig.fFill;
				van.vHungerTrail = vitalsOrig.fTrail;
				van.vPoisonFill = vitalsOrig.pFill;
				van.vPoisonTrail = vitalsOrig.pTrail;
				van.vFireFill = vitalsOrig.fireFill;
				van.vFireTrail = vitalsOrig.fireTrail;
				van.vHealthIcon = vitalsOrig.hIcon;
				van.vHungerIcon = vitalsOrig.fIcon;
				van.hasVitals = true;
				MoreColoursPlugin.CfgDirty = true;
			}
			Dirty = true;
		}
	}

	private static Color ImgColor(VitalsUI v, string field)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		Image val = Refl.Get<Image>(v, typeof(VitalsUI), field);
		if (!((Object)(object)val != (Object)null))
		{
			return Color.white;
		}
		return ((Graphic)val).color;
	}

	public static void Apply()
	{
		CleanDead();
		ApplyPalette();
		ApplyKillScores();
		ApplyVitals();
		ApplyRadar();
		ApplyBoss();
		ApplyMoney();
		ApplyHud();
	}

	private static void CleanDead()
	{
		KillScores.RemoveAll((PlayerKillScore k) => (Object)(object)k == (Object)null);
		foreach (BonusScoreRow item in RowOrigs.Keys.Where((BonusScoreRow r) => (Object)(object)r == (Object)null).ToList())
		{
			RowOrigs.Remove(item);
		}
		foreach (PlayerKillScore item2 in MultOrigs.Keys.Where((PlayerKillScore r) => (Object)(object)r == (Object)null).ToList())
		{
			MultOrigs.Remove(item2);
		}
		foreach (VitalsUI item3 in Vitals.Keys.Where((VitalsUI r) => (Object)(object)r == (Object)null).ToList())
		{
			Vitals.Remove(item3);
		}
		foreach (CloseItemsUI item4 in RadarOrigs.Keys.Where((CloseItemsUI r) => (Object)(object)r == (Object)null).ToList())
		{
			RadarOrigs.Remove(item4);
		}
		foreach (BossUI item5 in Bosses.Keys.Where((BossUI r) => (Object)(object)r == (Object)null).ToList())
		{
			Bosses.Remove(item5);
		}
		foreach (Graphic item6 in GraphicOrigs.Keys.Where((Graphic r) => (Object)(object)r == (Object)null).ToList())
		{
			GraphicOrigs.Remove(item6);
		}
	}

	private static Color Pick(ColorOv ov, Color orig)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		if (ov == null || !ov.on)
		{
			return orig;
		}
		return ov.c;
	}

	private static void ApplyPalette()
	{
		//IL_00d9: 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_00fe: 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_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: 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_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: 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)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: 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_0090: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		GameInfo s = Refl.GetS<GameInfo>(typeof(GameInfo), "_instance");
		if ((Object)(object)s == (Object)null)
		{
			return;
		}
		Type typeFromHandle = typeof(GameInfo);
		if ((Object)(object)s != (Object)(object)_giCaptured)
		{
			_giCaptured = s;
			_oRed = Refl.Get<Color>(s, typeFromHandle, "_redColor");
			_oGreen = Refl.Get<Color>(s, typeFromHandle, "_greenColor");
			_oOrange = Refl.Get<Color>(s, typeFromHandle, "_orangeColor");
			_oMini = Refl.Get<Color>(s, typeFromHandle, "_minBossColor");
			_oCommon = Refl.Get<Color>(s, typeFromHandle, "_commonColor");
			_oRare = Refl.Get<Color>(s, typeFromHandle, "_rareColor");
			_oLegend = Refl.Get<Color>(s, typeFromHandle, "_legendaryColor");
			_oDrip = Refl.Get<Gradient>(s, typeFromHandle, "_dripGradient");
		}
		Refl.Set(s, typeFromHandle, "_redColor", Pick(S.palRed, _oRed));
		Refl.Set(s, typeFromHandle, "_greenColor", Pick(S.palGreen, _oGreen));
		Refl.Set(s, typeFromHandle, "_orangeColor", Pick(S.palOrange, _oOrange));
		Refl.Set(s, typeFromHandle, "_minBossColor", Pick(S.palMiniBoss, _oMini));
		Refl.Set(s, typeFromHandle, "_commonColor", Pick(S.palCommon, _oCommon));
		Refl.Set(s, typeFromHandle, "_rareColor", Pick(S.palRare, _oRare));
		Refl.Set(s, typeFromHandle, "_legendaryColor", Pick(S.palLegendary, _oLegend));
		if (S.dripOn && S.dripStops != null && S.dripStops.Count >= 2)
		{
			int num = StopsHash();
			if (_customDrip == null || num != _dripHash)
			{
				_customDrip = BuildGradient(S.dripStops);
				_dripHash = num;
			}
			Refl.Set(s, typeFromHandle, "_dripGradient", _customDrip);
		}
		else if (_oDrip != null)
		{
			Refl.Set(s, typeFromHandle, "_dripGradient", _oDrip);
		}
	}

	private static int StopsHash()
	{
		//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)
		int num = 17;
		foreach (Color dripStop in S.dripStops)
		{
			num = num * 31 + ((object)dripStop/*cast due to .constrained prefix*/).GetHashCode();
		}
		return num;
	}

	public static Gradient BuildGradient(List<Color> stops)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		Gradient val = new Gradient();
		int num = Mathf.Clamp(stops.Count, 2, 8);
		GradientColorKey[] array = (GradientColorKey[])(object)new GradientColorKey[num];
		for (int i = 0; i < num; i++)
		{
			array[i] = new GradientColorKey(stops[i], (num == 1) ? 0f : ((float)i / (float)(num - 1)));
		}
		val.colorKeys = array;
		val.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
		{
			new GradientAlphaKey(1f, 0f),
			new GradientAlphaKey(1f, 1f)
		};
		val.mode = (GradientMode)0;
		return val;
	}

	private static void ApplyKillScores()
	{
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		foreach (PlayerKillScore killScore in KillScores)
		{
			if ((Object)(object)killScore == (Object)null)
			{
				continue;
			}
			BonusScoreRow val = Refl.Get<BonusScoreRow>(killScore, typeof(PlayerKillScore), "_mainBonusScoreRow");
			ApplyRow(val, S.scoreMainTyping, S.scoreMainTyped, S.scoreMainScore);
			List<BonusScoreRow> list = Refl.Get<List<BonusScoreRow>>(killScore, typeof(PlayerKillScore), "_bonusRows");
			if (list != null)
			{
				foreach (BonusScoreRow item in list)
				{
					if (!((Object)(object)item == (Object)(object)val))
					{
						ApplyRow(item, S.scoreBonusTyping, S.scoreBonusTyped, S.scoreBonusScore);
					}
				}
			}
			TextMeshProUGUI val2 = Refl.Get<TextMeshProUGUI>(killScore, typeof(PlayerKillScore), "_multiplierText");
			if ((Object)(object)val2 != (Object)null && MultOrigs.TryGetValue(killScore, out var value))
			{
				((Graphic)val2).color = Pick(S.scoreMultiplier, value);
			}
		}
	}

	private static void ApplyRow(BonusScoreRow row, ColorOv typing, ColorOv typed, ColorOv score)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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)
		if ((Object)(object)row == (Object)null)
		{
			return;
		}
		CaptureRow(row);
		if (RowOrigs.TryGetValue(row, out var value))
		{
			Refl.Set(row, typeof(BonusScoreRow), "_typingColor", Pick(typing, value.typing));
			Refl.Set(row, typeof(BonusScoreRow), "_typedColor", Pick(typed, value.typed));
			if ((Object)(object)row.ScoreText != (Object)null)
			{
				((Graphic)row.ScoreText).color = Pick(score, value.score);
			}
		}
	}

	private static void ApplyVitals()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: 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_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: 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_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: 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)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		foreach (KeyValuePair<VitalsUI, VitalsOrig> vital in Vitals)
		{
			VitalsUI key = vital.Key;
			VitalsOrig value = vital.Value;
			if (!((Object)(object)key == (Object)null) && value != null)
			{
				SetImg(key, "_healthPercent", Pick(S.healthFill, value.hFill));
				SetImg(key, "_healthPercentLerped", Pick(S.healthTrail, value.hTrail));
				SetImg(key, "_fullnessPercent", Pick(S.hungerFill, value.fFill));
				SetImg(key, "_fullnessPercentLerped", Pick(S.hungerTrail, value.fTrail));
				SetImg(key, "_poisonPercent", Pick(S.poisonFill, value.pFill));
				SetImg(key, "_poisonPercentLerped", Pick(S.poisonTrail, value.pTrail));
				SetImg(key, "_firePercent", Pick(S.fireFill, value.fireFill));
				SetImg(key, "_firePercentLerped", Pick(S.fireTrail, value.fireTrail));
				Refl.Set(key, typeof(VitalsUI), "_healthColor", Pick(S.healthIconLow, value.hIcon));
				Refl.Set(key, typeof(VitalsUI), "_fullnessColor", Pick(S.hungerIconLow, value.fIcon));
				Image val = Refl.Get<Image>(key, typeof(VitalsUI), "_healthPercent");
				if ((Object)(object)val != (Object)null)
				{
					key.SetPlayerHp(val.fillAmount);
				}
				Image val2 = Refl.Get<Image>(key, typeof(VitalsUI), "_fullnessPercent");
				if ((Object)(object)val2 != (Object)null)
				{
					key.SetPlayerFullness(val2.fillAmount);
				}
			}
		}
	}

	private static void SetImg(VitalsUI v, string field, Color c)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		Image val = Refl.Get<Image>(v, typeof(VitalsUI), field);
		if ((Object)(object)val != (Object)null)
		{
			((Graphic)val).color = c;
		}
	}

	private static void ApplyRadar()
	{
		//IL_007c: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		if (RadarOrigs.Count == 0 || RadarOrigs.Keys.Any((CloseItemsUI k) => (Object)(object)k == (Object)null))
		{
			if (Time.unscaledTime < _nextRadarScan)
			{
				return;
			}
			_nextRadarScan = Time.unscaledTime + 3f;
			CloseItemsUI[] array = Resources.FindObjectsOfTypeAll<CloseItemsUI>();
			foreach (CloseItemsUI val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Scene scene = ((Component)val).gameObject.scene;
				if (((Scene)(ref scene)).IsValid() && !RadarOrigs.ContainsKey(val))
				{
					Color val2 = Refl.Get<Color>(val, typeof(CloseItemsUI), "_aliveColor");
					RadarOrigs[val] = val2;
					if (!S.van.hasRadar)
					{
						S.van.radarAlive = val2;
						S.van.hasRadar = true;
						MoreColoursPlugin.CfgDirty = true;
					}
				}
			}
		}
		foreach (KeyValuePair<CloseItemsUI, Color> radarOrig in RadarOrigs)
		{
			if (!((Object)(object)radarOrig.Key == (Object)null))
			{
				Refl.Set(radarOrig.Key, typeof(CloseItemsUI), "_aliveColor", Pick(S.radarAlive, radarOrig.Value));
			}
		}
	}

	public static void RegisterBoss(BossUI b)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)b == (Object)null)
		{
			return;
		}
		if (!Bosses.ContainsKey(b))
		{
			BossOrig bossOrig = new BossOrig
			{
				trail = BossImgColor(b, "_bossHealthLerped"),
				timer = BossImgColor(b, "_timeLeftImage"),
				name = BossTextColor(b, "_bossNameText")
			};
			Bosses[b] = bossOrig;
			if (!S.van.hasBoss)
			{
				S.van.bossTrail = bossOrig.trail;
				S.van.bossTimer = bossOrig.timer;
				S.van.bossName = bossOrig.name;
				S.van.hasBoss = true;
				MoreColoursPlugin.CfgDirty = true;
			}
		}
		Dirty = true;
	}

	private static Color BossImgColor(BossUI b, string field)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		Image val = Refl.Get<Image>(b, typeof(BossUI), field);
		if (!((Object)(object)val != (Object)null))
		{
			return Color.white;
		}
		return ((Graphic)val).color;
	}

	private static Color BossTextColor(BossUI b, string field)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		TextMeshProUGUI val = Refl.Get<TextMeshProUGUI>(b, typeof(BossUI), field);
		if (!((Object)(object)val != (Object)null))
		{
			return Color.white;
		}
		return ((Graphic)val).color;
	}

	private static void ApplyBoss()
	{
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Invalid comparison between Unknown and I4
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		foreach (KeyValuePair<BossUI, BossOrig> boss in Bosses)
		{
			BossUI key = boss.Key;
			BossOrig value = boss.Value;
			if ((Object)(object)key == (Object)null || value == null)
			{
				continue;
			}
			Image val = Refl.Get<Image>(key, typeof(BossUI), "_bossHealthLerped");
			if ((Object)(object)val != (Object)null)
			{
				((Graphic)val).color = Pick(S.bossTrail, value.trail);
			}
			Image val2 = Refl.Get<Image>(key, typeof(BossUI), "_timeLeftImage");
			if ((Object)(object)val2 != (Object)null)
			{
				((Graphic)val2).color = Pick(S.bossTimer, value.timer);
			}
			TextMeshProUGUI val3 = Refl.Get<TextMeshProUGUI>(key, typeof(BossUI), "_bossNameText");
			if ((Object)(object)val3 != (Object)null)
			{
				((Graphic)val3).color = Pick(S.bossName, value.name);
			}
			Image val4 = Refl.Get<Image>(key, typeof(BossUI), "_bossHealth");
			if ((Object)(object)val4 != (Object)null && Object.op_Implicit((Object)(object)BossManager.Boss))
			{
				bool flag = (int)BossManager.Boss.BossType == 2;
				ColorOv colorOv = (flag ? S.bossBar : S.miniBossBar);
				if (colorOv != null && colorOv.on)
				{
					((Graphic)val4).color = colorOv.c;
				}
				else if ((Object)(object)Refl.GetS<GameInfo>(typeof(GameInfo), "_instance") != (Object)null)
				{
					((Graphic)val4).color = (flag ? GameInfo.RedColor : GameInfo.MiniBossColor);
				}
			}
		}
	}

	private static void ApplyHud()
	{
		if (Time.unscaledTime >= _nextHudScan || WeaponUIs.Any((WeaponUI x) => (Object)(object)x == (Object)null) || Canvases.Any((CanvasManager x) => (Object)(object)x == (Object)null) || ItemUIs.Any((ItemUI x) => (Object)(object)x == (Object)null) || NpcUIs.Any((NpcUI x) => (Object)(object)x == (Object)null) || VoiceUIs.Any((VoiceUI x) => (Object)(object)x == (Object)null) || Inventories.Any((PlayerInventory x) => (Object)(object)x == (Object)null))
		{
			_nextHudScan = Time.unscaledTime + 4f;
			Rescan<WeaponUI>(WeaponUIs);
			Rescan<CanvasManager>(Canvases);
			Rescan<ItemUI>(ItemUIs);
			Rescan<NpcUI>(NpcUIs);
			Rescan<VoiceUI>(VoiceUIs);
			Rescan<PlayerInventory>(Inventories);
			RescanVersionTexts();
		}
		foreach (WeaponUI weaponUI in WeaponUIs)
		{
			if (!((Object)(object)weaponUI == (Object)null))
			{
				Tint((Graphic)(object)Refl.Get<TextMeshProUGUI>(weaponUI, typeof(WeaponUI), "_inspectedNameText"), S.inspectName);
				Tint((Graphic)(object)Refl.Get<TextMeshProUGUI>(weaponUI, typeof(WeaponUI), "_descriptionText"), S.inspectBody);
			}
		}
		foreach (TMP_Text versionText in VersionTexts)
		{
			Tint((Graphic)(object)versionText, S.versionText);
		}
		foreach (ItemUI itemUI in ItemUIs)
		{
			if (!((Object)(object)itemUI == (Object)null))
			{
				Tint((Graphic)(object)Refl.Get<TextMeshProUGUI>(itemUI, typeof(ItemUI), "_itemInfoText"), S.promptText);
			}
		}
		foreach (NpcUI npcUI in NpcUIs)
		{
			if (!((Object)(object)npcUI == (Object)null))
			{
				Tint((Graphic)(object)Refl.Get<TextMeshProUGUI>(npcUI, typeof(NpcUI), "_npcText"), S.npcText);
			}
		}
		foreach (VoiceUI voiceUI in VoiceUIs)
		{
			if ((Object)(object)voiceUI == (Object)null)
			{
				continue;
			}
			RectTransform val = Refl.Get<RectTransform>(voiceUI, typeof(VoiceUI), "_audioVolRect");
			if (!((Object)(object)val == (Object)null))
			{
				Image[] componentsInChildren = ((Component)val).GetComponentsInChildren<Image>(true);
				for (int num = 0; num < componentsInChildren.Length; num++)
				{
					Tint((Graphic)(object)componentsInChildren[num], S.voiceIndicator);
				}
			}
		}
		foreach (PlayerInventory inventory in Inventories)
		{
			if ((Object)(object)inventory == (Object)null)
			{
				continue;
			}
			List<InventorySlot> list = Refl.Get<List<InventorySlot>>(inventory, typeof(PlayerInventory), "_itemSlots");
			if (list != null)
			{
				foreach (InventorySlot item in list)
				{
					TintSlot(item);
				}
			}
			TintSlot((InventorySlot)(object)Refl.Get<BaitSlot>(inventory, typeof(PlayerInventory), "_baitSlot"));
		}
	}

	private static void TintSlot(InventorySlot slot)
	{
		if (!((Object)(object)slot == (Object)null))
		{
			Tint((Graphic)(object)Refl.Get<Image>(slot, typeof(InventorySlot), "_outline"), S.hotbarOutline);
			TMP_Text[] componentsInChildren = ((Component)slot).GetComponentsInChildren<TMP_Text>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Tint((Graphic)(object)componentsInChildren[i], S.hotbarNumber);
			}
		}
	}

	private static void Rescan<T>(List<T> list) where T : Component
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		list.Clear();
		T[] array = Resources.FindObjectsOfTypeAll<T>();
		foreach (T val in array)
		{
			if ((Object)(object)val != (Object)null)
			{
				Scene scene = ((Component)val).gameObject.scene;
				if (((Scene)(ref scene)).IsValid())
				{
					list.Add(val);
				}
			}
		}
	}

	private static void RescanVersionTexts()
	{
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		VersionTexts.Clear();
		string version = Application.version;
		foreach (CanvasManager canvase in Canvases)
		{
			if (!((Object)(object)canvase == (Object)null))
			{
				TextMeshProUGUI val = Refl.Get<TextMeshProUGUI>(canvase, typeof(CanvasManager), "_versionText");
				if ((Object)(object)val != (Object)null)
				{
					AddVersionText((TMP_Text)(object)val);
				}
			}
		}
		if (string.IsNullOrEmpty(version))
		{
			return;
		}
		TMP_Text[] array = Resources.FindObjectsOfTypeAll<TMP_Text>();
		foreach (TMP_Text val2 in array)
		{
			if ((Object)(object)val2 == (Object)null)
			{
				continue;
			}
			Scene scene = ((Component)val2).gameObject.scene;
			if (((Scene)(ref scene)).IsValid())
			{
				string text = val2.text;
				if (!string.IsNullOrEmpty(text) && text.Length < 40 && text.Contains(version))
				{
					AddVersionText(val2);
				}
			}
		}
	}

	private static void AddVersionText(TMP_Text t)
	{
		if ((Object)(object)t == (Object)null)
		{
			return;
		}
		if (!VersionTexts.Contains(t))
		{
			VersionTexts.Add(t);
		}
		Transform parent = t.transform.parent;
		if ((Object)(object)parent == (Object)null)
		{
			return;
		}
		TMP_Text[] componentsInChildren = ((Component)parent).GetComponentsInChildren<TMP_Text>(true);
		foreach (TMP_Text val in componentsInChildren)
		{
			if ((Object)(object)val != (Object)null && !VersionTexts.Contains(val))
			{
				VersionTexts.Add(val);
			}
		}
	}

	private static void ApplyMoney()
	{
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		PlayerUI s = Refl.GetS<PlayerUI>(typeof(PlayerUI), "_instance");
		if ((Object)(object)s == (Object)null)
		{
			return;
		}
		MoneyUI val = Refl.Get<MoneyUI>(s, typeof(PlayerUI), "_moneyUI");
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		TextMeshProUGUI val2 = Refl.Get<TextMeshProUGUI>(val, typeof(MoneyUI), "_moneyText");
		if ((Object)(object)val2 == (Object)null)
		{
			return;
		}
		if ((Object)(object)val2 != (Object)(object)_moneyText)
		{
			_moneyText = val2;
			_moneyOrig = ((Graphic)val2).color;
			if (!S.van.hasMoney)
			{
				S.van.moneyCounter = _moneyOrig;
				S.van.hasMoney = true;
				MoreColoursPlugin.CfgDirty = true;
			}
		}
		((Graphic)val2).color = Pick(S.moneyCounter, _moneyOrig);
	}
}
[Serializable]
public class ColorOv
{
	public bool on;

	public Color c = Color.white;

	public ColorOv()
	{
	}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
	//IL_0006: Unknown result type (might be due to invalid IL or missing references)


	public ColorOv(string hex)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		on = true;
		c = Hex(hex);
	}

	public static Color Hex(string hex)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		if (!hex.StartsWith("#"))
		{
			hex = "#" + hex;
		}
		Color result = default(Color);
		if (!ColorUtility.TryParseHtmlString(hex, ref result))
		{
			return Color.white;
		}
		return result;
	}

	public ColorOv Copy()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		return new ColorOv
		{
			on = on,
			c = c
		};
	}
}
[Serializable]
public class VanillaCache
{
	public bool v2;

	public bool hasPopup;

	public Color popupMult = Color.white;

	public Color popupMainScore;

	public Color popupMainTyped;

	public Color popupMainTyping;

	public Color popupBonusScore;

	public Color popupBonusTyped;

	public Color popupBonusTyping;

	public bool hasVitals;

	public Color vHealthFill;

	public Color vHealthTrail;

	public Color vHungerFill;

	public Color vHungerTrail;

	public Color vPoisonFill;

	public Color vPoisonTrail;

	public Color vFireFill;

	public Color vFireTrail;

	public Color vHealthIcon;

	public Color vHungerIcon;

	public bool hasRadar;

	public Color radarAlive;

	public bool hasMoney;

	public Color moneyCounter;

	public bool hasBoss;

	public Color bossTrail;

	public Color bossTimer;

	public Color bossName;

	public bool hasHud;

	public Color inspectName;

	public Color inspectBody;

	public Color promptText;

	public Color npcText;

	public Color versionText;

	public Color voiceIndicator;

	public bool hasHotbar;

	public Color hotbarNumber;

	public Color hotbarOutline;
}
[Serializable]
public class ModSettings
{
	public int version = 2;

	public ColorOv palRed = new ColorOv();

	public ColorOv palGreen = new ColorOv();

	public ColorOv palOrange = new ColorOv();

	public ColorOv palMiniBoss = new ColorOv();

	public ColorOv palCommon = new ColorOv();

	public ColorOv palRare = new ColorOv();

	public ColorOv palLegendary = new ColorOv();

	public ColorOv scoreMultiplier = new ColorOv();

	public ColorOv scoreMainScore = new ColorOv();

	public ColorOv scoreMainTyped = new ColorOv();

	public ColorOv scoreMainTyping = new ColorOv();

	public ColorOv scoreBonusScore = new ColorOv();

	public ColorOv scoreBonusTyped = new ColorOv();

	public ColorOv scoreBonusTyping = new ColorOv();

	public ColorOv hitMarker = new ColorOv();

	public ColorOv hitMarkerKill = new ColorOv();

	public ColorOv dmgNumber = new ColorOv();

	public ColorOv dmgNumberKill = new ColorOv();

	public ColorOv moneyCounter = new ColorOv();

	public ColorOv healthFill = new ColorOv();

	public ColorOv healthTrail = new ColorOv();

	public ColorOv hungerFill = new ColorOv();

	public ColorOv hungerTrail = new ColorOv();

	public ColorOv poisonFill = new ColorOv();

	public ColorOv poisonTrail = new ColorOv();

	public ColorOv fireFill = new ColorOv();

	public ColorOv fireTrail = new ColorOv();

	public ColorOv healthIconLow = new ColorOv();

	public ColorOv hungerIconLow = new ColorOv();

	public ColorOv bossBar = new ColorOv();

	public ColorOv miniBossBar = new ColorOv();

	public ColorOv bossTrail = new ColorOv();

	public ColorOv bossTimer = new ColorOv();

	public ColorOv bossName = new ColorOv();

	public ColorOv chatServer = new ColorOv();

	public ColorOv chatNames = new ColorOv();

	public ColorOv inspectName = new ColorOv();

	public ColorOv inspectBody = new ColorOv();

	public ColorOv inspectBonus = new ColorOv();

	public ColorOv hotbarNumber = new ColorOv();

	public ColorOv hotbarOutline = new ColorOv();

	public ColorOv lookAtText = new ColorOv();

	public ColorOv promptText = new ColorOv();

	public ColorOv npcText = new ColorOv();

	public ColorOv versionText = new ColorOv();

	public ColorOv voiceIndicator = new ColorOv();

	public ColorOv radarAlive = new ColorOv();

	public ColorOv itemDotNormal = new ColorOv();

	public ColorOv caughtFishText = new ColorOv();

	public bool dripOn;

	public List<Color> dripStops = DefaultDrip();

	public VanillaCache van = new VanillaCache();

	public static List<Color> DefaultDrip()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		return new List<Color>
		{
			ColorOv.Hex("FF5555"),
			ColorOv.Hex("FFD24C"),
			ColorOv.Hex("55FF88"),
			ColorOv.Hex("55AAFF"),
			ColorOv.Hex("D06CFF")
		};
	}

	public void CopyStyleFrom(ModSettings o)
	{
		FieldInfo[] fields = typeof(ModSettings).GetFields(BindingFlags.Instance | BindingFlags.Public);
		foreach (FieldInfo fieldInfo in fields)
		{
			if (fieldInfo.FieldType == typeof(ColorOv))
			{
				ColorOv colorOv = (ColorOv)fieldInfo.GetValue(o);
				fieldInfo.SetValue(this, (colorOv != null) ? colorOv.Copy() : new ColorOv());
			}
		}
		dripOn = o.dripOn;
		dripStops = ((o.dripStops != null) ? new List<Color>(o.dripStops) : DefaultDrip());
	}

	public void AllOff()
	{
		FieldInfo[] fields = typeof(ModSettings).GetFields(BindingFlags.Instance | BindingFlags.Public);
		foreach (FieldInfo fieldInfo in fields)
		{
			if (fieldInfo.FieldType == typeof(ColorOv) && fieldInfo.GetValue(this) is ColorOv colorOv)
			{
				colorOv.on = false;
			}
		}
		dripOn = false;
	}
}
internal static class ConfigIO
{
	private const BindingFlags Fl = BindingFlags.Instance | BindingFlags.Public;

	public static string Dir => Path.Combine(Paths.ConfigPath, "MoreColours");

	public static string FilePath => Path.Combine(Dir, "MoreColours.cfg");

	public static string PresetDir => Path.Combine(Dir, "presets");

	public static string ToText(ModSettings s, bool withVanilla)
	{
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("# More Colours");
		FieldInfo[] fields = typeof(ModSettings).GetFields(BindingFlags.Instance | BindingFlags.Public);
		foreach (FieldInfo fieldInfo in fields)
		{
			object value = fieldInfo.GetValue(s);
			if (fieldInfo.FieldType == typeof(ColorOv))
			{
				ColorOv colorOv = ((ColorOv)value) ?? new ColorOv();
				stringBuilder.AppendLine(fieldInfo.Name + " = " + (colorOv.on ? "on" : "off") + " #" + ColorUtility.ToHtmlStringRGBA(colorOv.c));
			}
			else if (fieldInfo.FieldType == typeof(bool))
			{
				stringBuilder.AppendLine(fieldInfo.Name + " = " + (((bool)value) ? "on" : "off"));
			}
			else if (fieldInfo.FieldType == typeof(int))
			{
				stringBuilder.AppendLine(fieldInfo.Name + " = " + value);
			}
			else if (fieldInfo.FieldType == typeof(List<Color>))
			{
				List<Color> source = ((List<Color>)value) ?? new List<Color>();
				stringBuilder.AppendLine(fieldInfo.Name + " = " + string.Join(",", source.Select((Color c) => "#" + ColorUtility.ToHtmlStringRGBA(c)).ToArray()));
			}
			else
			{
				if (!(fieldInfo.FieldType == typeof(VanillaCache) && withVanilla))
				{
					continue;
				}
				VanillaCache obj = ((VanillaCache)value) ?? new VanillaCache();
				FieldInfo[] fields2 = typeof(VanillaCache).GetFields(BindingFlags.Instance | BindingFlags.Public);
				foreach (FieldInfo fieldInfo2 in fields2)
				{
					if (fieldInfo2.FieldType == typeof(bool))
					{
						stringBuilder.AppendLine("van." + fieldInfo2.Name + " = " + (((bool)fieldInfo2.GetValue(obj)) ? "on" : "off"));
					}
					else if (fieldInfo2.FieldType == typeof(Color))
					{
						stringBuilder.AppendLine("van." + fieldInfo2.Name + " = #" + ColorUtility.ToHtmlStringRGBA((Color)fieldInfo2.GetValue(obj)));
					}
				}
			}
		}
		return stringBuilder.ToString();
	}

	private static bool Truthy(string s)
	{
		if (!(s == "on") && !(s == "true"))
		{
			return s == "1";
		}
		return true;
	}

	private static bool Hex(string s, out Color c)
	{
		return ColorUtility.TryParseHtmlString(s.StartsWith("#") ? s : ("#" + s), ref c);
	}

	public static void FromText(ModSettings s, string text)
	{
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		if (string.IsNullOrEmpty(text))
		{
			return;
		}
		string[] array = text.Split(new char[1] { '\n' });
		for (int i = 0; i < array.Length; i++)
		{
			string text2 = array[i].Trim();
			if (text2.Length == 0 || text2[0] == '#')
			{
				continue;
			}
			int num = text2.IndexOf('=');
			if (num <= 0)
			{
				continue;
			}
			string text3 = text2.Substring(0, num).Trim();
			string text4 = text2.Substring(num + 1).Trim();
			if (text3.StartsWith("van."))
			{
				FieldInfo field = typeof(VanillaCache).GetField(text3.Substring(4), BindingFlags.Instance | BindingFlags.Public);
				if (!(field == null))
				{
					Color c;
					if (field.FieldType == typeof(bool))
					{
						field.SetValue(s.van, Truthy(text4));
					}
					else if (field.FieldType == typeof(Color) && Hex(text4, out c))
					{
						field.SetValue(s.van, c);
					}
				}
				continue;
			}
			FieldInfo field2 = typeof(ModSettings).GetField(text3, BindingFlags.Instance | BindingFlags.Public);
			if (field2 == null)
			{
				continue;
			}
			int result;
			if (field2.FieldType == typeof(ColorOv))
			{
				ColorOv colorOv = ((ColorOv)field2.GetValue(s)) ?? new ColorOv();
				string[] array2 = text4.Split(new char[2] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
				if (array2.Length != 0)
				{
					colorOv.on = Truthy(array2[0]);
				}
				if (array2.Length > 1 && Hex(array2[1], out var c2))
				{
					colorOv.c = c2;
				}
				field2.SetValue(s, colorOv);
			}
			else if (field2.FieldType == typeof(bool))
			{
				field2.SetValue(s, Truthy(text4));
			}
			else if (field2.FieldType == typeof(int) && int.TryParse(text4, out result))
			{
				field2.SetValue(s, result);
			}
			else
			{
				if (!(field2.FieldType == typeof(List<Color>)))
				{
					continue;
				}
				List<Color> list = new List<Color>();
				string[] array3 = text4.Split(new char[1] { ',' });
				for (int j = 0; j < array3.Length; j++)
				{
					if (Hex(array3[j].Trim(), out var c3))
					{
						list.Add(c3);
					}
				}
				if (list.Count >= 2)
				{
					field2.SetValue(s, list);
				}
			}
		}
	}

	public static ModSettings Load()
	{
		ModSettings modSettings = new ModSettings();
		try
		{
			if (File.Exists(FilePath))
			{
				FromText(modSettings, File.ReadAllText(FilePath));
			}
		}
		catch (Exception ex)
		{
			MoreColoursPlugin.Log.LogWarning((object)("config load failed: " + ex.Message));
		}
		if (modSettings.dripStops == null || modSettings.dripStops.Count < 2)
		{
			modSettings.dripStops = ModSettings.DefaultDrip();
		}
		if (modSettings.van == null)
		{
			modSettings.van = new VanillaCache();
		}
		if (!modSettings.van.v2)
		{
			modSettings.van = new VanillaCache
			{
				v2 = true
			};
		}
		return modSettings;
	}

	public static void Save(ModSettings s)
	{
		try
		{
			Directory.CreateDirectory(Dir);
			File.WriteAllText(FilePath, ToText(s, withVanilla: true));
		}
		catch (Exception ex)
		{
			MoreColoursPlugin.Log.LogWarning((object)("config save failed: " + ex.Message));
		}
	}

	private static string Sanitize(string name)
	{
		char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
		foreach (char oldChar in invalidFileNameChars)
		{
			name = name.Replace(oldChar, '_');
		}
		return name.Trim();
	}

	public static void SavePreset(string name, ModSettings s)
	{
		try
		{
			Directory.CreateDirectory(PresetDir);
			File.WriteAllText(Path.Combine(PresetDir, Sanitize(name) + ".txt"), ToText(s, withVanilla: false));
		}
		catch (Exception ex)
		{
			MoreColoursPlugin.Log.LogWarning((object)("preset save failed: " + ex.Message));
		}
	}

	public static ModSettings LoadPreset(string name)
	{
		try
		{
			string path = Path.Combine(PresetDir, Sanitize(name) + ".txt");
			if (!File.Exists(path))
			{
				return null;
			}
			ModSettings modSettings = new ModSettings();
			FromText(modSettings, File.ReadAllText(path));
			return modSettings;
		}
		catch (Exception ex)
		{
			MoreColoursPlugin.Log.LogWarning((object)("preset load failed: " + ex.Message));
		}
		return null;
	}

	public static void DeletePreset(string name)
	{
		try
		{
			string path = Path.Combine(PresetDir, Sanitize(name) + ".txt");
			if (File.Exists(path))
			{
				File.Delete(path);
			}
		}
		catch (Exception ex)
		{
			MoreColoursPlugin.Log.LogWarning((object)("preset delete failed: " + ex.Message));
		}
	}

	public static string[] ListPresets()
	{
		try
		{
			if (Directory.Exists(PresetDir))
			{
				return (from n in Directory.GetFiles(PresetDir, "*.txt").Select(Path.GetFileNameWithoutExtension)
					orderby n
					select n).ToArray();
			}
		}
		catch
		{
		}
		return Array.Empty<string>();
	}
}
internal static class Presets
{
	public static readonly string[] Names = new string[8] { "Vanilla", "Synthwave", "Ocean Deep", "Toxic Sludge", "Blood Moon", "Monochrome", "Pastel Pond", "Gold Rush" };

	private static ColorOv C(string hex)
	{
		return new ColorOv(hex);
	}

	private static List<Color> G(params string[] hex)
	{
		return hex.Select((string h) => ColorOv.Hex(h)).ToList();
	}

	public static ModSettings Get(string name)
	{
		switch (name)
		{
		case "Vanilla":
			return new ModSettings();
		case "Synthwave":
		{
			ModSettings modSettings = new ModSettings();
			modSettings.palRed = C("FF2E63");
			modSettings.palGreen = C("08F7A8");
			modSettings.palOrange = C("FF6EC7");
			modSettings.palMiniBoss = C("9D4EDD");
			modSettings.palCommon = C("6C7BFF");
			modSettings.palRare = C("C77DFF");
			modSettings.palLegendary = C("00E5FF");
			modSettings.scoreMultiplier = C("00E5FF");
			modSettings.scoreMainScore = C("FF6EC7");
			modSettings.scoreMainTyped = C("FF6EC7");
			modSettings.scoreMainTyping = C("6C7BFF");
			modSettings.scoreBonusScore = C("08F7A8");
			modSettings.scoreBonusTyped = C("F8F7FF");
			modSettings.scoreBonusTyping = C("6C7BFF");
			modSettings.hitMarker = C("00E5FF");
			modSettings.hitMarkerKill = C("FF2E63");
			modSettings.dmgNumber = C("F8F7FF");
			modSettings.dmgNumberKill = C("FF2E63");
			modSettings.moneyCounter = C("08F7A8");
			modSettings.healthFill = C("FF2E63");
			modSettings.healthTrail = C("FFD3E0");
			modSettings.hungerFill = C("FF9E00");
			modSettings.hungerTrail = C("FFE3B3");
			modSettings.poisonFill = C("9D4EDD");
			modSettings.fireFill = C("FF6EC7");
			modSettings.healthIconLow = C("FF2E63");
			modSettings.hungerIconLow = C("FF9E00");
			modSettings.bossBar = C("FF2E63");
			modSettings.miniBossBar = C("9D4EDD");
			modSettings.bossName = C("00E5FF");
			modSettings.chatServer = C("00E5FF");
			modSettings.chatNames = C("FF6EC7");
			modSettings.inspectName = C("FF6EC7");
			modSettings.inspectBody = C("F8F7FF");
			modSettings.hotbarNumber = C("00E5FF");
			modSettings.hotbarOutline = C("FF6EC7");
			modSettings.lookAtText = C("00E5FF");
			modSettings.promptText = C("C77DFF");
			modSettings.npcText = C("08F7A8");
			modSettings.radarAlive = C("FF6EC7");
			modSettings.caughtFishText = C("00E5FF");
			modSettings.bossTrail = C("FFD3E0");
			modSettings.bossTimer = C("00E5FF");
			modSettings.poisonTrail = C("D9BBF5");
			modSettings.fireTrail = C("FFC9EC");
			modSettings.inspectBonus = C("6C7BFF");
			modSettings.versionText = C("6C7BFF");
			modSettings.voiceIndicator = C("08F7A8");
			modSettings.itemDotNormal = C("F8F7FF");
			modSettings.dripOn = true;
			modSettings.dripStops = G("FF71CE", "B967FF", "01CDFE", "05FFA1");
			return modSettings;
		}
		case "Ocean Deep":
		{
			ModSettings modSettings = new ModSettings();
			modSettings.palRed = C("FF6B6B");
			modSettings.palGreen = C("3DDC97");
			modSettings.palOrange = C("FFD166");
			modSettings.palMiniBoss = C("4CC9F0");
			modSettings.palCommon = C("90E0EF");
			modSettings.palRare = C("00B4D8");
			modSettings.palLegendary = C("0077B6");
			modSettings.scoreMultiplier = C("CAF0F8");
			modSettings.scoreMainScore = C("48CAE4");
			modSettings.scoreMainTyped = C("48CAE4");
			modSettings.scoreMainTyping = C("55809E");
			modSettings.scoreBonusScore = C("3DDC97");
			modSettings.scoreBonusTyped = C("E9F7FB");
			modSettings.scoreBonusTyping = C("55809E");
			modSettings.hitMarker = C("CAF0F8");
			modSettings.hitMarkerKill = C("4CC9F0");
			modSettings.dmgNumber = C("E9F7FB");
			modSettings.dmgNumberKill = C("00B4D8");
			modSettings.moneyCounter = C("3DDC97");
			modSettings.healthFill = C("FF6B6B");
			modSettings.healthTrail = C("FFD3D3");
			modSettings.hungerFill = C("FFD166");
			modSettings.hungerTrail = C("FFEBC9");
			modSettings.poisonFill = C("3DDC97");
			modSettings.fireFill = C("FF9F68");
			modSettings.healthIconLow = C("FF6B6B");
			modSettings.hungerIconLow = C("FFD166");
			modSettings.bossBar = C("FF6B6B");
			modSettings.miniBossBar = C("4CC9F0");
			modSettings.bossName = C("CAF0F8");
			modSettings.chatServer = C("4CC9F0");
			modSettings.chatNames = C("48CAE4");
			modSettings.inspectName = C("48CAE4");
			modSettings.inspectBody = C("E9F7FB");
			modSettings.hotbarNumber = C("CAF0F8");
			modSettings.hotbarOutline = C("48CAE4");
			modSettings.lookAtText = C("CAF0F8");
			modSettings.promptText = C("90E0EF");
			modSettings.npcText = C("3DDC97");
			modSettings.radarAlive = C("4CC9F0");
			modSettings.caughtFishText = C("48CAE4");
			modSettings.bossTrail = C("CAF0F8");
			modSettings.bossTimer = C("90E0EF");
			modSettings.poisonTrail = C("C7F5E2");
			modSettings.fireTrail = C("FFDCC4");
			modSettings.inspectBonus = C("55809E");
			modSettings.versionText = C("55809E");
			modSettings.voiceIndicator = C("3DDC97");
			modSettings.itemDotNormal = C("E9F7FB");
			modSettings.dripOn = true;
			modSettings.dripStops = G("CAF0F8", "48CAE4", "0096C7", "023E8A", "48CAE4");
			return modSettings;
		}
		case "Toxic Sludge":
		{
			ModSettings modSettings = new ModSettings();
			modSettings.palRed = C("D7263D");
			modSettings.palGreen = C("9EF01A");
			modSettings.palOrange = C("CCFF33");
			modSettings.palMiniBoss = C("70E000");
			modSettings.palCommon = C("A7C957");
			modSettings.palRare = C("70E000");
			modSettings.palLegendary = C("38B000");
			modSettings.scoreMultiplier = C("CCFF33");
			modSettings.scoreMainScore = C("9EF01A");
			modSettings.scoreMainTyped = C("9EF01A");
			modSettings.scoreMainTyping = C("6A994E");
			modSettings.scoreBonusScore = C("CCFF33");
			modSettings.scoreBonusTyped = C("F2FFDE");
			modSettings.scoreBonusTyping = C("6A994E");
			modSettings.hitMarker = C("CCFF33");
			modSettings.hitMarkerKill = C("D7263D");
			modSettings.dmgNumber = C("F2FFDE");
			modSettings.dmgNumberKill = C("D7263D");
			modSettings.moneyCounter = C("9EF01A");
			modSettings.healthFill = C("70E000");
			modSettings.healthTrail = C("D9FFB0");
			modSettings.hungerFill = C("CCFF33");
			modSettings.hungerTrail = C("F2FFB0");
			modSettings.poisonFill = C("9EF01A");
			modSettings.fireFill = C("FF8800");
			modSettings.healthIconLow = C("70E000");
			modSettings.hungerIconLow = C("CCFF33");
			modSettings.bossBar = C("D7263D");
			modSettings.miniBossBar = C("70E000");
			modSettings.bossName = C("CCFF33");
			modSettings.chatServer = C("70E000");
			modSettings.chatNames = C("9EF01A");
			modSettings.inspectName = C("9EF01A");
			modSettings.inspectBody = C("F2FFDE");
			modSettings.hotbarNumber = C("CCFF33");
			modSettings.hotbarOutline = C("9EF01A");
			modSettings.lookAtText = C("CCFF33");
			modSettings.promptText = C("A7C957");
			modSettings.npcText = C("9EF01A");
			modSettings.radarAlive = C("9EF01A");
			modSettings.caughtFishText = C("9EF01A");
			modSettings.bossTrail = C("F2FFDE");
			modSettings.bossTimer = C("CCFF33");
			modSettings.poisonTrail = C("E4FFB0");
			modSettings.fireTrail = C("FFD9A0");
			modSettings.inspectBonus = C("6A994E");
			modSettings.versionText = C("6A994E");
			modSettings.voiceIndicator = C("9EF01A");
			modSettings.itemDotNormal = C("F2FFDE");
			modSettings.dripOn = true;
			modSettings.dripStops = G("CCFF33", "70E000", "007200", "9EF01A");
			return modSettings;
		}
		case "Blood Moon":
		{
			ModSettings modSettings = new ModSettings();
			modSettings.palRed = C("FF0A0A");
			modSettings.palGreen = C("FF7B00");
			modSettings.palOrange = C("FF3C00");
			modSettings.palMiniBoss = C("8D0801");
			modSettings.palCommon = C("BF4342");
			modSettings.palRare = C("A4161A");
			modSettings.palLegendary = C("FF0A0A");
			modSettings.scoreMultiplier = C("FFB3B3");
			modSettings.scoreMainScore = C("FF0A0A");
			modSettings.scoreMainTyped = C("FF0A0A");
			modSettings.scoreMainTyping = C("8D5B5B");
			modSettings.scoreBonusScore = C("FF7B00");
			modSettings.scoreBonusTyped = C("FFE3E3");
			modSettings.scoreBonusTyping = C("8D5B5B");
			modSettings.hitMarker = C("FFB3B3");
			modSettings.hitMarkerKill = C("FF0A0A");
			modSettings.dmgNumber = C("FFE3E3");
			modSettings.dmgNumberKill = C("FF0A0A");
			modSettings.moneyCounter = C("FF7B00");
			modSettings.healthFill = C("FF0A0A");
			modSettings.healthTrail = C("FFD1D1");
			modSettings.hungerFill = C("FF7B00");
			modSettings.hungerTrail = C("FFD9B3");
			modSettings.poisonFill = C("8D0801");
			modSettings.fireFill = C("FF3C00");
			modSettings.healthIconLow = C("FF0A0A");
			modSettings.hungerIconLow = C("FF7B00");
			modSettings.bossBar = C("FF0A0A");
			modSettings.miniBossBar = C("8D0801");
			modSettings.bossName = C("FFB3B3");
			modSettings.chatServer = C("8D0801");
			modSettings.chatNames = C("FF0A0A");
			modSettings.inspectName = C("FF0A0A");
			modSettings.inspectBody = C("FFE3E3");
			modSettings.hotbarNumber = C("FFB3B3");
			modSettings.hotbarOutline = C("FF0A0A");
			modSettings.lookAtText = C("FFB3B3");
			modSettings.promptText = C("BF4342");
			modSettings.npcText = C("FF7B00");
			modSettings.radarAlive = C("FF0A0A");
			modSettings.caughtFishText = C("FF3C00");
			modSettings.bossTrail = C("FFB3B3");
			modSettings.bossTimer = C("FF7B00");
			modSettings.poisonTrail = C("D9A5A5");
			modSettings.fireTrail = C("FFC4A5");
			modSettings.inspectBonus = C("8D5B5B");
			modSettings.versionText = C("8D5B5B");
			modSettings.voiceIndicator = C("FF7B00");
			modSettings.itemDotNormal = C("FFE3E3");
			modSettings.dripOn = true;
			modSettings.dripStops = G("FF0A0A", "8D0801", "FF3C00", "FFB3B3");
			return modSettings;
		}
		case "Monochrome":
		{
			ModSettings modSettings = new ModSettings();
			modSettings.palRed = C("E0E0E0");
			modSettings.palGreen = C("FFFFFF");
			modSettings.palOrange = C("BDBDBD");
			modSettings.palMiniBoss = C("9E9E9E");
			modSettings.palCommon = C("757575");
			modSettings.palRare = C("BDBDBD");
			modSettings.palLegendary = C("FFFFFF");
			modSettings.scoreMultiplier = C("FFFFFF");
			modSettings.scoreMainScore = C("FFFFFF");
			modSettings.scoreMainTyped = C("FFFFFF");
			modSettings.scoreMainTyping = C("616161");
			modSettings.scoreBonusScore = C("BDBDBD");
			modSettings.scoreBonusTyped = C("E0E0E0");
			modSettings.scoreBonusTyping = C("616161");
			modSettings.hitMarker = C("FFFFFF");
			modSettings.hitMarkerKill = C("9E9E9E");
			modSettings.dmgNumber = C("E0E0E0");
			modSettings.dmgNumberKill = C("FFFFFF");
			modSettings.moneyCounter = C("FFFFFF");
			modSettings.healthFill = C("E0E0E0");
			modSettings.healthTrail = C("FFFFFF");
			modSettings.hungerFill = C("9E9E9E");
			modSettings.hungerTrail = C("E0E0E0");
			modSettings.poisonFill = C("757575");
			modSettings.fireFill = C("BDBDBD");
			modSettings.healthIconLow = C("FFFFFF");
			modSettings.hungerIconLow = C("BDBDBD");
			modSettings.bossBar = C("E0E0E0");
			modSettings.miniBossBar = C("9E9E9E");
			modSettings.bossName = C("FFFFFF");
			modSettings.chatServer = C("9E9E9E");
			modSettings.chatNames = C("E0E0E0");
			modSettings.inspectName = C("FFFFFF");
			modSettings.inspectBody = C("E0E0E0");
			modSettings.hotbarNumber = C("FFFFFF");
			modSettings.hotbarOutline = C("E0E0E0");
			modSettings.lookAtText = C("FFFFFF");
			modSettings.promptText = C("BDBDBD");
			modSettings.npcText = C("E0E0E0");
			modSettings.radarAlive = C("E0E0E0");
			modSettings.caughtFishText = C("FFFFFF");
			modSettings.bossTrail = C("FFFFFF");
			modSettings.bossTimer = C("BDBDBD");
			modSettings.poisonTrail = C("BDBDBD");
			modSettings.fireTrail = C("E0E0E0");
			modSettings.inspectBonus = C("616161");
			modSettings.versionText = C("616161");
			modSettings.voiceIndicator = C("FFFFFF");
			modSettings.itemDotNormal = C("E0E0E0");
			modSettings.dripOn = true;
			modSettings.dripStops = G("FFFFFF", "9E9E9E", "424242", "9E9E9E");
			return modSettings;
		}
		case "Pastel Pond":
		{
			ModSettings modSettings = new ModSettings();
			modSettings.palRed = C("FFADAD");
			modSettings.palGreen = C("CAFFBF");
			modSettings.palOrange = C("FFD6A5");
			modSettings.palMiniBoss = C("BDB2FF");
			modSettings.palCommon = C("FDFFB6");
			modSettings.palRare = C("A0C4FF");
			modSettings.palLegendary = C("FFC6FF");
			modSettings.scoreMultiplier = C("FFFFFC");
			modSettings.scoreMainScore = C("FFC6FF");
			modSettings.scoreMainTyped = C("FFC6FF");
			modSettings.scoreMainTyping = C("BDB2FF");
			modSettings.scoreBonusScore = C("CAFFBF");
			modSettings.scoreBonusTyped = C("FFFFFC");
			modSettings.scoreBonusTyping = C("BDB2FF");
			modSettings.hitMarker = C("9BF6FF");
			modSettings.hitMarkerKill = C("FFADAD");
			modSettings.dmgNumber = C("FFFFFC");
			modSettings.dmgNumberKill = C("FFADAD");
			modSettings.moneyCounter = C("CAFFBF");
			modSettings.healthFill = C("FFADAD");
			modSettings.healthTrail = C("FFE3E3");
			modSettings.hungerFill = C("FFD6A5");
			modSettings.hungerTrail = C("FFF0DC");
			modSettings.poisonFill = C("CAFFBF");
			modSettings.fireFill = C("FFD6A5");
			modSettings.healthIconLow = C("FFADAD");
			modSettings.hungerIconLow = C("FFD6A5");
			modSettings.bossBar = C("FFADAD");
			modSettings.miniBossBar = C("BDB2FF");
			modSettings.bossName = C("FFC6FF");
			modSettings.chatServer = C("BDB2FF");
			modSettings.chatNames = C("FFADAD");
			modSettings.inspectName = C("FFC6FF");
			modSettings.inspectBody = C("FFFFFC");
			modSettings.hotbarNumber = C("9BF6FF");
			modSettings.hotbarOutline = C("FFC6FF");
			modSettings.lookAtText = C("9BF6FF");
			modSettings.promptText = C("BDB2FF");
			modSettings.npcText = C("CAFFBF");
			modSettings.radarAlive = C("FFC6FF");
			modSettings.caughtFishText = C("A0C4FF");
			modSettings.bossTrail = C("FFFFFC");
			modSettings.bossTimer = C("9BF6FF");
			modSettings.poisonTrail = C("E4FFDC");
			modSettings.fireTrail = C("FFEBD4");
			modSettings.inspectBonus = C("BDB2FF");
			modSettings.versionText = C("BDB2FF");
			modSettings.voiceIndicator = C("CAFFBF");
			modSettings.itemDotNormal = C("FFFFFC");
			modSettings.dripOn = true;
			modSettings.dripStops = G("FFADAD", "FFD6A5", "CAFFBF", "9BF6FF", "BDB2FF", "FFC6FF");
			return modSettings;
		}
		case "Gold Rush":
		{
			ModSettings modSettings = new ModSettings();
			modSettings.palRed = C("C1121F");
			modSettings.palGreen = C("FFD700");
			modSettings.palOrange = C("FFB700");
			modSettings.palMiniBoss = C("BC6C25");
			modSettings.palCommon = C("DDA15E");
			modSettings.palRare = C("FFB700");
			modSettings.palLegendary = C("FFD700");
			modSettings.scoreMultiplier = C("FFF3B0");
			modSettings.scoreMainScore = C("FFD700");
			modSettings.scoreMainTyped = C("FFD700");
			modSettings.scoreMainTyping = C("9C7A2D");
			modSettings.scoreBonusScore = C("FFB700");
			modSettings.scoreBonusTyped = C("FFF3B0");
			modSettings.scoreBonusTyping = C("9C7A2D");
			modSettings.hitMarker = C("FFF3B0");
			modSettings.hitMarkerKill = C("C1121F");
			modSettings.dmgNumber = C("FFF3B0");
			modSettings.dmgNumberKill = C("C1121F");
			modSettings.moneyCounter = C("FFD700");
			modSettings.healthFill = C("C1121F");
			modSettings.healthTrail = C("FFD9D9");
			modSettings.hungerFill = C("FFB700");
			modSettings.hungerTrail = C("FFE8B0");
			modSettings.poisonFill = C("606C38");
			modSettings.fireFill = C("FF7B00");
			modSettings.healthIconLow = C("C1121F");
			modSettings.hungerIconLow = C("FFB700");
			modSettings.bossBar = C("C1121F");
			modSettings.miniBossBar = C("BC6C25");
			modSettings.bossName = C("FFD700");
			modSettings.chatServer = C("BC6C25");
			modSettings.chatNames = C("FFD700");
			modSettings.inspectName = C("FFD700");
			modSettings.inspectBody = C("FFF3B0");
			modSettings.hotbarNumber = C("FFF3B0");
			modSettings.hotbarOutline = C("FFD700");
			modSettings.lookAtText = C("FFF3B0");
			modSettings.promptText = C("DDA15E");
			modSettings.npcText = C("FFB700");
			modSettings.radarAlive = C("FFD700");
			modSettings.caughtFishText = C("FFD700");
			modSettings.bossTrail = C("FFF3B0");
			modSettings.bossTimer = C("FFB700");
			modSettings.poisonTrail = C("D6DDA8");
			modSettings.fireTrail = C("FFD1A8");
			modSettings.inspectBonus = C("9C7A2D");
			modSettings.versionText = C("9C7A2D");
			modSettings.voiceIndicator = C("FFD700");
			modSettings.itemDotNormal = C("FFF3B0");
			modSettings.dripOn = true;
			modSettings.dripStops = G("FFF3B0", "FFD700", "BC6C25", "FFD700");
			return modSettings;
		}
		default:
			return null;
		}
	}
}
[BepInPlugin("com.pro75turbo.morecolours", "More Colours", "1.0.1")]
public class MoreColoursPlugin : BaseUnityPlugin
{
	public const string Guid = "com.pro75turbo.morecolours";

	public const string Version = "1.0.1";

	public static MoreColoursPlugin Instance;

	public static ModSettings S;

	public static bool CfgDirty;

	public static float LastEdit = -999f;

	internal static ManualLogSource Log;

	private Harmony _harmony;

	private float _nextApply;

	private float _nextPeriodic;

	private void Awake()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		Instance = this;
		Log = ((BaseUnityPlugin)this).Logger;
		S = ConfigIO.Load();
		_harmony = new Harmony("com.pro75turbo.morecolours");
		Patches.ApplyAll(_harmony);
		Log.LogInfo((object)"More Colours 1.0.1 loaded - find it in Options > Colours.");
	}

	private void Update()
	{
		if (Applier.Dirty && Time.unscaledTime >= _nextApply)
		{
			_nextApply = Time.unscaledTime + 0.05f;
			Applier.Dirty = false;
			try
			{
				Applier.Apply();
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Apply failed: " + ex));
			}
		}
		if (Time.unscaledTime >= _nextPeriodic)
		{
			_nextPeriodic = Time.unscaledTime + 3f;
			Applier.Dirty = true;
		}
		if (CfgDirty && Time.unscaledTime - LastEdit > 1f)
		{
			CfgDirty = false;
			ConfigIO.Save(S);
		}
	}

	private void OnDestroy()
	{
		if (CfgDirty)
		{
			CfgDirty = false;
			ConfigIO.Save(S);
		}
	}

	private void OnApplicationQuit()
	{
		if (CfgDirty)
		{
			CfgDirty = false;
			ConfigIO.Save(S);
		}
	}
}
internal static class NativePanel
{
	private static GameObject _root;

	private static PanelController _ctrl;

	public static bool Built => (Object)(object)_root != (Object)null;

	public static bool Visible
	{
		get
		{
			if ((Object)(object)_root != (Object)null)
			{
				return _root.activeSelf;
			}
			return false;
		}
	}

	public static bool TryBuild(GameObject screen, List<GameObject> contentPanels, Button tabTemplate)
	{
		if (Built)
		{
			return true;
		}
		try
		{
			Build(contentPanels, tabTemplate);
			MoreColoursPlugin.Log.LogInfo((object)"native Colours panel built");
			return true;
		}
		catch (Exception ex)
		{
			MoreColoursPlugin.Log.LogWarning((object)("native panel build failed: " + ex));
			if ((Object)(object)_root != (Object)null)
			{
				Object.Destroy((Object)(object)_root);
			}
			_root = null;
			_ctrl = null;
			return false;
		}
	}

	private static void Build(List<GameObject> contentPanels, Button tabTemplate)
	{
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Expected O, but got Unknown
		ButtonManager val = Refl.GetS<ButtonManager>(typeof(ButtonManager), "_instance");
		if ((Object)(object)val == (Object)null)
		{
			val = Resources.FindObjectsOfTypeAll<ButtonManager>().FirstOrDefault();
		}
		if ((Object)(object)val == (Object)null)
		{
			throw new Exception("ButtonManager not found");
		}
		Slider val2 = Refl.Get<Slider>(val, typeof(ButtonManager), "_masterVolSlider");
		Toggle val3 = Refl.Get<Toggle>(val, typeof(ButtonManager), "_invertXToggle");
		TMP_InputField inputDonor = Refl.Get<TMP_InputField>(val, typeof(ButtonManager), "_masterVolInputField");
		if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null)
		{
			throw new Exception("widget donors missing (slider/toggle)");
		}
		GameObject val4 = null;
		float num = 0f;
		foreach (GameObject contentPanel in contentPanels)
		{
			Transform transform = contentPanel.transform;
			RectTransform val5 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			if (!((Object)(object)val5 == (Object)null))
			{
				Rect rect = val5.rect;
				float width = ((Rect)(ref rect)).width;
				rect = val5.rect;
				float num2 = width * ((Rect)(ref rect)).height;
				if (num2 > num)
				{
					num = num2;
					val4 = contentPanel;
				}
			}
		}
		if ((Object)(object)val4 == (Object)null)
		{
			throw new Exception("no donor content panel");
		}
		_root = Object.Instantiate<GameObject>(val4, val4.transform.parent);
		((Object)_root).name = "ColoursPanel";
		_root.SetActive(false);
		StripLocalization(_root);
		LayoutGroup[] components = _root.GetComponents<LayoutGroup>();
		for (int i = 0; i < components.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)components[i]);
		}
		List<GameObject> list = new List<GameObject>();
		foreach (Transform item in _root.transform)
		{
			Transform val6 = item;
			if ((Object)(object)((Component)val6).GetComponentInChildren<TMP_Text>(true) != (Object)null || (Object)(object)((Component)val6).GetComponentInChildren<Selectable>(true) != (Object)null)
			{
				list.Add(((Component)val6).gameObject);
			}
		}
		foreach (GameObject item2 in list)
		{
			Object.DestroyImmediate((Object)(object)item2);
		}
		_ctrl = _root.AddComponent<PanelController>();
		_ctrl.Init(tabTemplate, val2, val3, inputDonor);
	}

	public static void Show()
	{
		if (!((Object)(object)_root == (Object)null))
		{
			_root.transform.SetAsLastSibling();
			_root.SetActive(true);
			if ((Object)(object)_ctrl != (Object)null)
			{
				_ctrl.OnShown();
			}
		}
	}

	public static void Hide()
	{
		if ((Object)(object)_root != (Object)null)
		{
			_root.SetActive(false);
		}
	}

	public static void StripLocalization(GameObject go)
	{
		Component[] componentsInChildren = go.GetComponentsInChildren<Component>(true);
		foreach (Component val in componentsInChildren)
		{
			if ((Object)(object)val != (Object)null && ((object)val).GetType().FullName.IndexOf("Localiz", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				Object.DestroyImmediate((Object)(object)val);
			}
		}
	}

	public static void KillPersistent(UnityEventBase ev)
	{
		if (ev != null)
		{
			int persistentEventCount = ev.GetPersistentEventCount();
			for (int i = 0; i < persistentEventCount; i++)
			{
				ev.SetPersistentListenerState(i, (UnityEventCallState)0);
			}
		}
	}
}
internal static class GameSprites
{
	public static Sprite Ring;

	public static Sprite RingTrail;

	public static Sprite IconHealth;

	public static Sprite IconHunger;

	public static Sprite IconPoison;

	public static Sprite IconFire;

	public static Sprite ItemDot;

	public static Sprite HitMarker;

	public static Sprite BossBar;

	public static Sprite BossFillSprite;

	public static Sprite BossTrailSprite;

	public static Sprite BossTimerSprite;

	public static Material BossFillMat;

	public static Material BossTrailMat;

	public static Material BossTimerMat;

	public static Type BossFillType = (Type)3;

	public static FillMethod BossFillMethod = (FillMethod)0;

	public static int BossFillOrigin;

	public static bool BossFillClockwise = true;

	public static FillMethod RingFillMethod = (FillMethod)4;

	public static int RingFillOrigin = 2;

	public static bool RingFillClockwise = true;

	private static bool _logged;

	public static void TryHarvest()
	{
		try
		{
			Harvest();
		}
		catch (Exception ex)
		{
			MoreColoursPlugin.Log.LogWarning((object)("sprite harvest failed: " + ex.Message));
		}
	}

	private static void Harvest()
	{
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Invalid comparison between Unknown and I4
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0416: Unknown result type (might be due to invalid IL or missing references)
		//IL_041b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0556: Unknown result type (might be due to invalid IL or missing references)
		//IL_055b: Unknown result type (might be due to invalid IL or missing references)
		//IL_045a: Unknown result type (might be due to invalid IL or missing references)
		//IL_045f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0477: Unknown result type (might be due to invalid IL or missing references)
		//IL_047c: Unknown result type (might be due to invalid IL or missing references)
		//IL_065c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0661: Unknown result type (might be due to invalid IL or missing references)
		//IL_0668: Unknown result type (might be due to invalid IL or missing references)
		//IL_066d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0499: Unknown result type (might be due to invalid IL or missing references)
		//IL_049e: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0818: Unknown result type (might be due to invalid IL or missing references)
		//IL_081d: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0843: Unknown result type (might be due to invalid IL or missing references)
		//IL_0848: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aeb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0afb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b1b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b36: Unknown result type (might be due to invalid IL or missing references)
		//IL_0989: Unknown result type (might be due to invalid IL or missing references)
		//IL_098e: Unknown result type (might be due to invalid IL or missing references)
		//IL_086e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0873: Unknown result type (might be due to invalid IL or missing references)
		//IL_0728: Unknown result type (might be due to invalid IL or missing references)
		//IL_072d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_0899: Unknown result type (might be due to invalid IL or missing references)
		//IL_089e: Unknown result type (might be due to invalid IL or missing references)
		//IL_074b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0742: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a38: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a3d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0750: 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_09bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_076e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0765: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0773: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_08f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		ModSettings s = MoreColoursPlugin.S;
		s.van.v2 = true;
		if ((Object)(object)Ring == (Object)null || !s.van.hasVitals)
		{
			VitalsUI val = Resources.FindObjectsOfTypeAll<VitalsUI>().FirstOrDefault();
			if ((Object)(object)val != (Object)null)
			{
				Image val2 = Refl.Get<Image>(val, typeof(VitalsUI), "_healthPercent");
				Image val3 = Refl.Get<Image>(val, typeof(VitalsUI), "_healthPercentLerped");
				Image val4 = Refl.Get<Image>(val, typeof(VitalsUI), "_healthImage");
				Image val5 = Refl.Get<Image>(val, typeof(VitalsUI), "_fullnessImage");
				Image val6 = Refl.Get<Image>(val, typeof(VitalsUI), "_poisonImage");
				Image val7 = Refl.Get<Image>(val, typeof(VitalsUI), "_fireImage");
				if ((Object)(object)val2 != (Object)null)
				{
					Ring = val2.sprite;
					if ((int)val2.type == 3)
					{
						RingFillMethod = val2.fillMethod;
						RingFillOrigin = val2.fillOrigin;
						RingFillClockwise = val2.fillClockwise;
					}
				}
				if ((Object)(object)val3 != (Object)null)
				{
					RingTrail = val3.sprite;
				}
				if ((Object)(object)val4 != (Object)null)
				{
					IconHealth = val4.sprite;
				}
				if ((Object)(object)val5 != (Object)null)
				{
					IconHunger = val5.sprite;
				}
				if ((Object)(object)val6 != (Object)null)
				{
					IconPoison = val6.sprite;
				}
				if ((Object)(object)val7 != (Object)null)
				{
					IconFire = val7.sprite;
				}
				if (!s.van.hasVitals)
				{
					VanillaCache van = s.van;
					if ((Object)(object)val2 != (Object)null)
					{
						van.vHealthFill = ((Graphic)val2).color;
					}
					if ((Object)(object)val3 != (Object)null)
					{
						van.vHealthTrail = ((Graphic)val3).color;
					}
					Image val8 = Refl.Get<Image>(val, typeof(VitalsUI), "_fullnessPercent");
					Image val9 = Refl.Get<Image>(val, typeof(VitalsUI), "_fullnessPercentLerped");
					Image val10 = Refl.Get<Image>(val, typeof(VitalsUI), "_poisonPercent");
					Image val11 = Refl.Get<Image>(val, typeof(VitalsUI), "_poisonPercentLerped");
					Image val12 = Refl.Get<Image>(val, typeof(VitalsUI), "_firePercent");
					Image val13 = Refl.Get<Image>(val, typeof(VitalsUI), "_firePercentLerped");
					if ((Object)(object)val8 != (Object)null)
					{
						van.vHungerFill = ((Graphic)val8).color;
					}
					if ((Object)(object)val9 != (Object)null)
					{
						van.vHungerTrail = ((Graphic)val9).color;
					}
					if ((Object)(object)val10 != (Object)null)
					{
						van.vPoisonFill = ((Graphic)val10).color;
					}
					if ((Object)(object)val11 != (Object)null)
					{
						van.vPoisonTrail = ((Graphic)val11).color;
					}
					if ((Object)(object)val12 != (Object)null)
					{
						van.vFireFill = ((Graphic)val12).color;
					}
					if ((Object)(object)val13 != (Object)null)
					{
						van.vFireTrail = ((Graphic)val13).color;
					}
					van.vHealthIcon = Refl.Get<Color>(val, typeof(VitalsUI), "_healthColor");
					van.vHungerIcon = Refl.Get<Color>(val, typeof(VitalsUI), "_fullnessColor");
					van.hasVitals = true;
					MoreColoursPlugin.CfgDirty = true;
				}
			}
		}
		if (!s.van.hasPopup)
		{
			PlayerKillScore val14 = Resources.FindObjectsOfTypeAll<PlayerKillScore>().FirstOrDefault();
			if ((Object)(object)val14 != (Object)null)
			{
				VanillaCache van2 = s.van;
				BonusScoreRow main = Refl.Get<BonusScoreRow>(val14, typeof(PlayerKillScore), "_mainBonusScoreRow");
				List<BonusScoreRow> list = Refl.Get<List<BonusScoreRow>>(val14, typeof(PlayerKillScore), "_bonusRows");
				TMP_Text val15 = Refl.Get<TMP_Text>(val14, typeof(PlayerKillScore), "_multiplierText");
				if ((Object)(object)main != (Object)null)
				{
					van2.popupMainTyping = Refl.Get<Color>(main, typeof(BonusScoreRow), "_typingColor");
					van2.popupMainTyped = Refl.Get<Color>(main, typeof(BonusScoreRow), "_typedColor");
					if ((Object)(object)main.ScoreText != (Object)null)
					{
						van2.popupMainScore = ((Graphic)main.ScoreText).color;
					}
				}
				BonusScoreRow val16 = list?.FirstOrDefault((Func<BonusScoreRow, bool>)((BonusScoreRow r) => (Object)(object)r != (Object)null && (Object)(object)r != (Object)(object)main));
				if ((Object)(object)val16 != (Object)null)
				{
					van2.popupBonusTyping = Refl.Get<Color>(val16, typeof(BonusScoreRow), "_typingColor");
					van2.popupBonusTyped = Refl.Get<Color>(val16, typeof(BonusScoreRow), "_typedColor");
					if ((Object)(object)val16.ScoreText != (Object)null)
					{
						van2.popupBonusScore = ((Graphic)val16.ScoreText).color;
					}
				}
				if ((Object)(object)val15 != (Object)null)
				{
					van2.popupMult = ((Graphic)val15).color;
				}
				van2.hasPopup = true;
				van2.v2 = true;
				MoreColoursPlugin.CfgDirty = true;
			}
		}
		if ((Object)(object)ItemDot == (Object)null || !s.van.hasRadar)
		{
			CloseItemsUI val17 = Resources.FindObjectsOfTypeAll<CloseItemsUI>().FirstOrDefault();
			if ((Object)(object)val17 != (Object)null)
			{
				Image val18 = Refl.Get<Image>(val17, typeof(CloseItemsUI), "_dotPrefab");
				if ((Object)(object)val18 != (Object)null)
				{
					ItemDot = val18.sprite;
				}
				if (!s.van.hasRadar)
				{
					s.van.radarAlive = Refl.Get<Color>(val17, typeof(CloseItemsUI), "_aliveColor");
					s.van.hasRadar = true;
					MoreColoursPlugin.CfgDirty = true;
				}
			}
		}
		if ((Object)(object)HitMarker == (Object)null)
		{
			OnHitUI val19 = Resources.FindObjectsOfTypeAll<OnHitUI>().FirstOrDefault();
			Image val20 = (((Object)(object)val19 != (Object)null) ? Refl.Get<Image>(val19, typeof(OnHitUI), "_hitMarkerPrefab") : null);
			if ((Object)(object)val20 != (Object)null)
			{
				HitMarker = val20.sprite;
			}
		}
		if (!s.van.hasBoss || (Object)(object)BossBar == (Object)null)
		{
			BossUI val21 = Resources.FindObjectsOfTypeAll<BossUI>().FirstOrDefault();
			if ((Object)(object)val21 != (Object)null)
			{
				Image val22 = Refl.Get<Image>(val21, typeof(BossUI), "_bossHealth");
				Image val23 = Refl.Get<Image>(val21, typeof(BossUI), "_timeLeftImage");
				if ((Object)(object)val22 != (Object)null)
				{
					BossBar = val22.sprite;
					BossFillSprite = val22.sprite;
					BossFillMat = ((Graphic)val22).material;
					BossFillType = val22.type;
					BossFillMethod = val22.fillMethod;
					BossFillOrigin = val22.fillOrigin;
					BossFillClockwise = val22.fillClockwise;
				}
				if ((Object)(object)val23 != (Object)null)
				{
					BossTimerSprite = val23.sprite;
					BossTimerMat = ((Graphic)val23).material;
				}
				Image val24 = Refl.Get<Image>(val21, typeof(BossUI), "_bossHealthLerped");
				if ((Object)(object)val24 != (Object)null)
				{
					BossTrailSprite = val24.sprite;
					BossTrailMat = ((Graphic)val24).material;
				}
				Image val25 = Refl.Get<Image>(val21, typeof(BossUI), "_timeLeftImage");
				TMP_Text val26 = Refl.Get<TMP_Text>(val21, typeof(BossUI), "_bossNameText");
				if ((Object)(object)val24 != (Object)null)
				{
					s.van.bossTrail = ((Graphic)val24).color;
					s.van.bossTimer = (((Object)(object)val25 != (Object)null) ? ((Graphic)val25).color : Color.white);
					s.van.bossName = (((Object)(object)val26 != (Object)null) ? ((Graphic)val26).color : Color.white);
					s.van.hasBoss = true;
					MoreColoursPlugin.CfgDirty = true;
				}
			}
		}
		if (!s.van.hasHud)
		{
			WeaponUI val27 = Resources.FindObjectsOfTypeAll<WeaponUI>().FirstOrDefault();
			CanvasManager val28 = Resources.FindObjectsOfTypeAll<CanvasManager>().FirstOrDefault();
			ItemUI val29 = Resources.FindObjectsOfTypeAll<ItemUI>().FirstOrDefault();
			NpcUI val30 = Resources.FindObjectsOfTypeAll<NpcUI>().FirstOrDefault();
			VoiceUI val31 = Resources.FindObjectsOfTypeAll<VoiceUI>().FirstOrDefault();
			if ((Object)(object)val27 != (Object)null)
			{
				s.van.inspectName = TextCol(val27, typeof(WeaponUI), "_inspectedNameText");
				s.van.inspectBody = TextCol(val27, typeof(WeaponUI), "_descriptionText");
			}
			if ((Object)(object)val28 != (Object)null)
			{
				s.van.versionText = TextCol(val28, typeof(CanvasManager), "_versionText");
			}
			if ((Object)(object)val29 != (Object)null)
			{
				s.van.promptText = TextCol(val29, typeof(ItemUI), "_itemInfoText");
			}
			if ((Object)(object)val30 != (Object)null)
			{
				s.van.npcText = TextCol(val30, typeof(NpcUI), "_npcText");
			}
			if ((Object)(object)val31 != (Object)null)
			{
				RectTransform val32 = Refl.Get<RectTransform>(val31, typeof(VoiceUI), "_audioVolRect");
				Image val33 = (((Object)(object)val32 != (Object)null) ? ((Component)val32).GetComponentInChildren<Image>(true) : null);
				if ((Object)(object)val33 != (Object)null)
				{
					s.van.voiceIndicator = ((Graphic)val33).color;
				}
			}
			if ((Object)(object)val27 != (Object)null || (Object)(object)val28 != (Object)null)
			{
				s.van.hasHud = true;
				MoreColoursPlugin.CfgDirty = true;
			}
		}
		if (!s.van.hasHotbar)
		{
			InventorySlot val34 = Resources.FindObjectsOfTypeAll<InventorySlot>().FirstOrDefault();
			if ((Object)(object)val34 != (Object)null)
			{
				Image val35 = Refl.Get<Image>(val34, typeof(InventorySlot), "_outline");
				TMP_Text val36 = Refl.Get<TMP_Text>(val34, typeof(InventorySlot), "_itemText");
				if ((Object)(object)val35 != (Object)null)
				{
					s.van.hotbarOutline = ((Graphic)val35).color;
				}
				TMP_Text[] componentsInChildren = ((Component)val34).GetComponentsInChildren<TMP_Text>(true);
				foreach (TMP_Text val37 in componentsInChildren)
				{
					if ((Object)(object)val37 != (Object)(object)val36)
					{
						s.van.hotbarNumber = ((Graphic)val37).color;
						break;
					}
				}
				s.van.hasHotbar = true;
				MoreColoursPlugin.CfgDirty = true;
			}
		}
		if (!s.van.hasMoney)
		{
			MoneyUI val38 = Resources.FindObjectsOfTypeAll<MoneyUI>().FirstOrDefault();
			TMP_Text val39 = (((Object)(object)val38 != (Object)null) ? Refl.Get<TMP_Text>(val38, typeof(MoneyUI), "_moneyText") : null);
			if ((Object)(object)val39 != (Object)null)
			{
				s.van.moneyCounter = ((Graphic)val39).color;
				s.van.hasMoney = true;
				MoreColoursPlugin.CfgDirty = true;
			}
		}
		if (!_logged)
		{
			_logged = true;
			MoreColoursPlugin.Log.LogInfo((object)($"harvest: ring={(Object)(object)Ring != (Object)null} icons={(Object)(object)IconHealth != (Object)null} itemDot={(Object)(object)ItemDot != (Object)null} hitMarker={(Object)(object)HitMarker != (Object)null} " + $"popupVan={s.van.hasPopup} (mainTyped=#{ColorUtility.ToHtmlStringRGBA(s.van.popupMainTyped)} bonusScore=#{ColorUtility.ToHtmlStringRGBA(s.van.popupBonusScore)} " + "bonusTyped=#" + ColorUtility.ToHtmlStringRGBA(s.van.popupBonusTyped) + " mult=#" + ColorUtility.ToHtmlStringRGBA(s.van.popupMult) + ") " + $"vitalsVan={s.van.hasVitals} hudVan={s.van.hasHud} hotbarVan={s.van.hasHotbar}"));
		}
	}

	private static Color TextCol(object obj, Type t, string field)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		TMP_Text val = Refl.Get<TMP_Text>(obj, t, field);
		if (!((Object)(object)val != (Object)null))
		{
			return Color.white;
		}
		return ((Graphic)val).color;
	}
}
internal class PanelController : MonoBehaviour
{
	private class RowUI
	{
		public ColorOv ov;

		public Color van;

		public Image swatch;

		public Image bg;

		public Toggle toggle;
	}

	private Button _btnDonor;

	private Slider _sliderDonor;

	private Toggle _toggleDonor;

	private TMP_InputField _inputDonor;

	private TMP_Text _labelDonor;

	private float _fs;

	private RectTransform _rowsRoot;

	private RectTransform _pickerRoot;

	private RectTransform _stageRoot;

	private TMP_Text _sectionLabel;

	private readonly List<GameObject> _rows = new List<GameObject>();

	private readonly List<RowUI> _rowUIs = new List<RowUI>();

	private int _section;

	private ColorOv _sel;

	private Color _selVan = Color.white;

	private string _selName = "";

	private int _selStop = -1;

	private Slider _sR;

	private Slider _sG;

	private Slider _sB;

	private Slider _sA;

	private TMP_InputField _hexInput;

	private Image _bigSwatch;

	private TMP_Text _pickerTitle;

	private Button _resetBtn;

	private Image _paletteImage;

	private RectTransform _paletteMarker;

	private Color[] _paletteColors;

	private bool _paletteTried;

	private float _confirmResetUntil;

	private TMP_InputField _presetNameInput;

	private static readonly string[] Sections = new string[13]
	{
		"Palette", "Score Popup", "Combat", "Money & Bait", "Vitals", "Boss", "Chat", "Inspect", "Hotbar", "HUD",
		"Slot Machine", "Drip Text", "Presets"
	};

	private static readonly Color GuessPopupOrange = new Color(1f, 0.42f, 0.08f);

	private static readonly Color GuessTyping = new Color(0.66f, 0.66f, 0.66f);

	private static readonly Color GuessHealth = new Color(0.88f, 0.3f, 0.3f);

	private static readonly Color GuessHunger = new Color(0.91f, 0.64f, 0.24f);

	private static readonly Color GuessTrail = Color.white;

	private static readonly Color VanBonusGrey = new Color(0.5f, 0.5f, 0.5f);

	private float _rowY;

	private const float RowH = 0.082f;

	private readonly List<GameObject> _stageObjs = new List<GameObject>();

	private float _stageT;

	private TMP_Text _pvMult;

	private TMP_Text _pvMainScore;

	private TMP_Text _pvMainText;

	private TMP_Text[] _pvBonusScore;

	private TMP_Text[] _pvBonusText;

	private TMP_Text _pvMoney;

	private TMP_Text _pvMoneyFloat;

	private TMP_Text _pvBait;

	private RectTransform _pvMarker;

	private Image[] _pvMarkerParts;

	private TMP_Text _pvDmg;

	private Image _pvHpRing;

	private Image _pvHpTrailRing;

	private Image _pvHpIcon;

	private Image _pvHuRing;

	private Image _pvHuTrailRing;

	private Image _pvHuIcon;

	private Image _pvPoRing;

	private Image _pvPoTrailRing;

	private Image _pvPoIcon;

	private Image _pvFiRing;

	private Image _pvFiTrailRing;

	private Image _pvFiIcon;

	private float _pvHpTrailPct = 1f;

	private float _pvHuTrailPct = 1f;

	private float _pvPoTrailPct = 0.5f;

	private float _pvFiTrailPct = 0.5f;

	private TMP_Text _pvLookAt;

	private TMP_Text _pvCaught;

	private TMP_Text _pvPrompt;

	private TMP_Text _pvPrompt2;

	private TMP_Text _pvNpc;

	private TMP_Text _pvVersion;

	private Image _pvDotNormal;

	private Image _pvDotAlive;

	private Image _pvVoice;

	private TMP_Text _pvInspName;

	private TMP_Text _pvInspBody;

	private TMP_Text[] _pvSlotNums;

	private Image[] _pvSlotOutlines;

	private TMP_Text _pvDrip;

	private TMP_Text _pvChat1;

	private TMP_Text _pvChat2;

	private TMP_Text _pvPalFloat;

	private TMP_Text[] _pvPalLabels;

	private Image _pvBossFill;

	private Image _pvBossTrail;

	private Image _pvBossTimer;

	private Image _pvMiniFill;

	private TMP_Text _pvBossName;

	private float _pvBossTrailHp = 1f;

	private Image[] _pvRarity;

	private static readonly string MainLine = "Killed Perch";

	private static readonly string[] BonusLines = new string[3] { "Longshot", "Fly Fishing", "One Shot One Kill" };

	private static readonly float[] BonusMults = new float[3] { 1.3f, 1.25f, 1.25f };

	private static Gradient _cachedDripG;

	private static int _cachedDripHash;

	private static Sprite _ringSprite;

	private static readonly Dictionary<string[], Sprite> IconCache = new Dictionary<string[], Sprite>();

	private static readonly string[] HeartMap = new string[8] { ".XX....XX.", "XXXX..XXXX", "XXXXXXXXXX", "XXXXXXXXXX", ".XXXXXXXX.", "..XXXXXX..", "...XXXX...", "....XX...." };

	private static readonly string[] ForkMap = new string[9] { "X.X.X", "X.X.X", "X.X.X", "XXXXX", ".XXX.", "..X..", "..X..", "..X..", "..X.." };

	private static readonly string[] SkullMap = new string[8] { ".XXXXXXX.", "XXXXXXXXX", "XXXXXXXXX", "XX.XXX.XX", "XX.XXX.XX", "XXXXXXXXX", ".XXXXXXX.", ".X.X.X.X." };

	private static readonly string[] FlameMap = new string[9] { "....X....", "...XX....", "...XXX...", "..XXXX...", "..XXXXX..", ".XXXXXXX.", ".XXXXXXX.", ".XXXXXXX.", "..XXXXX.." };

	private static ModSettings S => MoreColoursPlugin.S;

	private static Color VanMult
	{
		get
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!S.van.hasPopup)
			{
				return Color.white;
			}
			return S.van.popupMult;
		}
	}

	private static Color VanMainScore
	{
		get
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!S.van.hasPopup)
			{
				return GuessPopupOrange;
			}
			return S.van.popupMainScore;
		}
	}

	private static Color VanMainTyped
	{
		get
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!S.van.hasPopup)
			{
				return GuessPopupOrange;
			}
			return S.van.popupMainTyped;
		}
	}

	private static Color VanMainTyping
	{
		get
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!S.van.hasPopup)
			{
				return GuessTyping;
			}
			return S.van.popupMainTyping;
		}
	}

	private static Color VanBonusScore
	{
		get
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!S.van.hasPopup)
			{
				return Color.white;
			}
			return S.van.popupBonusScore;
		}
	}

	private static Color VanBonusTyped
	{
		get
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!S.van.hasPopup)
			{
				return Color.white;
			}
			return S.van.popupBonusTyped;
		}
	}

	private static Color VanBonusTyping
	{
		get
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!S.van.hasPopup)
			{
				return GuessTyping;
			}
			return S.van.popupBonusTyping;
		}
	}

	private static Color VanHealth
	{
		get
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!S.van.hasVitals)
			{
				return GuessHealth;
			}
			return S.van.vHealthFill;
		}
	}

	private static Color VanHealthTrail
	{
		get
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!S.van.hasVitals)
			{
				return GuessTrail;
			}
			return S.van.vHealthTrail;
		}
	}

	private static Color VanHunger
	{
		get
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL