Decompiled source of Horse Appraiser v1.0.0

HorseAppraiser.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.UI;
using Stunlock.Core;
using TMPro;
using Unity.Entities;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: SecurityPermission((SecurityAction)8, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : System.Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class RefSafetyRulesAttribute : System.Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HorseAppraiser
{
	public enum OverallRatingStyle
	{
		Score10,
		PercentOfMax,
		Both
	}
	[BepInPlugin("com.zeeCameLsnake.HorseAppraiser", "Horse Appraiser", "1.0.0")]
	public class HorseAppraiserPlugin : BasePlugin
	{
		public const string PluginGUID = "com.zeeCameLsnake.HorseAppraiser";

		public const string PluginName = "Horse Appraiser";

		public const string PluginVersion = "1.0.0";

		internal static ManualLogSource Log;

		private Harmony _harmony;

		public static ConfigEntry<bool> ConfigEnabled;

		public static ConfigEntry<bool> ConfigShowStatPercent;

		public static ConfigEntry<bool> ConfigColorStats;

		public static ConfigEntry<bool> ConfigShowOverallRating;

		public static ConfigEntry<OverallRatingStyle> ConfigOverallRatingStyle;

		public static ConfigEntry<string> ConfigOverallPrefix;

		public static ConfigEntry<bool> ConfigShowLegend;

		public static ConfigEntry<bool> ConfigDebugLogging;

		public static ConfigEntry<float> ConfigWeightMaxSpeed;

		public static ConfigEntry<float> ConfigWeightAcceleration;

		public static ConfigEntry<float> ConfigWeightRotationSpeed;

		public static ConfigEntry<float> ConfigGoodScore;

		public static ConfigEntry<float> ConfigMidScore;

		public static ConfigEntry<string> ConfigColorGood;

		public static ConfigEntry<string> ConfigColorMid;

		public static ConfigEntry<string> ConfigColorBad;

		private const float ConfigCheckInterval = 1f;

		private static ConfigFile _config;

		private static System.DateTime _configWriteTime;

		private static float _lastConfigCheckTime = -1f;

		public override void Load()
		{
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Expected O, but got Unknown
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Expected O, but got Unknown
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			_config = ((BasePlugin)this).Config;
			ConfigEnabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable or disable Horse Appraiser.");
			ConfigShowStatPercent = ((BasePlugin)this).Config.Bind<bool>("General", "ShowStatPercent", true, "Show each stat as percentage of its maximum (e.g. '9,5  87%').");
			ConfigColorStats = ((BasePlugin)this).Config.Bind<bool>("General", "ColorStats", true, "Color the stat values green/yellow/red depending on where they lie within the spawn range.");
			ConfigShowOverallRating = ((BasePlugin)this).Config.Bind<bool>("General", "ShowOverallRating", true, "Show the weighted overall rating behind the horse name in the window header.");
			ConfigOverallRatingStyle = ((BasePlugin)this).Config.Bind<OverallRatingStyle>("General", "OverallRatingStyle", OverallRatingStyle.Both, "How the overall rating is shown. Score10 = rating from 0 to 10 based on where the stats lie within the spawn range (e.g. '5,0 / 10'). PercentOfMax = plain average percentage of the stat maximums (e.g. '87%'), not affected by the weights. Both = PercentOfMax followed by Score10.");
			ConfigOverallPrefix = ((BasePlugin)this).Config.Bind<string>("General", "OverallPrefix", "★", "Symbol or text shown in front of the overall rating. Leave empty for none.");
			ConfigShowLegend = ((BasePlugin)this).Config.Bind<bool>("General", "ShowLegend", true, "Show a short explanation of the colors, percentages and rating at the bottom of the horse window.");
			ConfigDebugLogging = ((BasePlugin)this).Config.Bind<bool>("General", "DebugLogging", false, "Write the raw stat data of every inspected horse and the horse window layout to the BepInEx log (once each).");
			ConfigWeightMaxSpeed = BindWeight("MaxSpeed", "Max Speed");
			ConfigWeightAcceleration = BindWeight("Acceleration", "Acceleration");
			ConfigWeightRotationSpeed = BindWeight("RotationSpeed", "Rotation Speed");
			ConfigGoodScore = ((BasePlugin)this).Config.Bind<float>("Thresholds", "GoodScore", 67f, "A stat counts as good (green) from this position within its spawn range, in percent (0 = lowest roll, 100 = best roll).");
			ConfigMidScore = ((BasePlugin)this).Config.Bind<float>("Thresholds", "MidScore", 34f, "A stat counts as mid (yellow) from this position within its spawn range, in percent. Below it is bad (red).");
			ConfigColorGood = ((BasePlugin)this).Config.Bind<string>("Colors", "Good", "#4CD964", "Color for good stats (hex).");
			ConfigColorMid = ((BasePlugin)this).Config.Bind<string>("Colors", "Mid", "#FFD60A", "Color for mid stats (hex).");
			ConfigColorBad = ((BasePlugin)this).Config.Bind<string>("Colors", "Bad", "#FF453A", "Color for bad stats (hex).");
			try
			{
				_configWriteTime = File.GetLastWriteTimeUtc(((BasePlugin)this).Config.ConfigFilePath);
			}
			catch
			{
			}
			bool flag = default(bool);
			try
			{
				_harmony = new Harmony("com.zeeCameLsnake.HorseAppraiser");
				_harmony.PatchAll();
			}
			catch (System.Exception ex)
			{
				ManualLogSource log = Log;
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Harmony patching failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<System.Exception>(ex);
				}
				log.LogError(val);
			}
			ManualLogSource log2 = Log;
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(23, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("Horse Appraiser");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" v");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("1.0.0");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" loaded successfully.");
			}
			log2.LogInfo(val2);
		}

		private ConfigEntry<float> BindWeight(string key, string statName)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			return ((BasePlugin)this).Config.Bind<float>("Weights", key, 10f, new ConfigDescription("How much " + statName + " counts in the overall rating score shown behind the horse name (0 = ignored, 10 = full weight). Weights only affect the rating behind the star (e.g. '5,0 / 10'), not the single stat values, their colors or the overall percentage. Only the ratio between the weights matters, e.g. 10 / 5 / 5 makes Max Speed count twice as much as each other stat. Decimals are allowed but must use a dot (e.g. 7.5).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), System.Array.Empty<object>()));
		}

		public override bool Unload()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			return true;
		}

		internal static void CheckConfigReload()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			if (Time.unscaledTime - _lastConfigCheckTime < 1f)
			{
				return;
			}
			_lastConfigCheckTime = Time.unscaledTime;
			try
			{
				System.DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc(_config.ConfigFilePath);
				if (!(lastWriteTimeUtc == _configWriteTime))
				{
					_config.Reload();
					_configWriteTime = File.GetLastWriteTimeUtc(_config.ConfigFilePath);
					Log.LogInfo((object)"Config file changed, settings reloaded.");
				}
			}
			catch (System.Exception ex)
			{
				ManualLogSource log = Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(22, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Config reload failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val);
			}
		}

		public static World GetClientWorld()
		{
			try
			{
				List<World> s_AllWorlds = World.s_AllWorlds;
				if (s_AllWorlds != null)
				{
					for (int i = 0; i < s_AllWorlds.Count; i++)
					{
						World val = s_AllWorlds[i];
						if (val != null && val.Name.StartsWith("Client"))
						{
							return val;
						}
					}
				}
			}
			catch
			{
			}
			return null;
		}
	}
	internal struct StatInput
	{
		public MountStatEntry Entry;

		public Data Data;

		public float Weight;
	}
	internal static class HorseLookup
	{
		private static float _spawnPercentage = 0.95f;

		public static Entity GetMenuHorse(out World clientWorld)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			clientWorld = HorseAppraiserPlugin.GetClientWorld();
			if (clientWorld == null)
			{
				return Entity.Null;
			}
			MountSubMenuMapper val = null;
			try
			{
				val = clientWorld.GetExistingSystemManaged<MountSubMenuMapper>();
			}
			catch
			{
			}
			return (val != null) ? val._Target : Entity.Null;
		}

		public static float GetSpawnPercentage()
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				World clientWorld;
				Entity menuHorse = GetMenuHorse(out clientWorld);
				if (menuHorse != Entity.Null && TryGetBlob(clientWorld.EntityManager, menuHorse, out var blob))
				{
					float num = blob[9];
					if (num > 0f && num <= 1f)
					{
						_spawnPercentage = num;
					}
				}
			}
			catch
			{
			}
			return _spawnPercentage;
		}

		public unsafe static bool TryGetBlob(EntityManager em, Entity horse, out float[] blob)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			blob = null;
			if (!((EntityManager)(ref em)).Exists(horse) || !((EntityManager)(ref em)).HasComponent<Mountable>(horse))
			{
				return false;
			}
			byte* ptr = ((EntityManager)(ref em)).GetComponentData<Mountable>(horse).Blob.m_data.m_Ptr;
			if (ptr == null)
			{
				return false;
			}
			float* ptr2 = (float*)ptr;
			blob = new float[11];
			for (int i = 0; i < blob.Length; i++)
			{
				blob[i] = ptr2[i];
			}
			return true;
		}
	}
	internal static class HorseRating
	{
		private static readonly Regex ColorTagRegex = new Regex("</?color[^>]*>", (RegexOptions)9);

		public static void Apply(Component container, MountStatEntry maxSpeed, MountStatEntry acceleration, MountStatEntry rotationSpeed, Data maxSpeedData, Data accelerationData, Data rotationSpeedData, bool scoreByUpgradeProgress)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			HorseAppraiserPlugin.CheckConfigReload();
			StatInput[] array = new StatInput[3]
			{
				new StatInput
				{
					Entry = maxSpeed,
					Data = maxSpeedData,
					Weight = HorseAppraiserPlugin.ConfigWeightMaxSpeed.Value
				},
				new StatInput
				{
					Entry = acceleration,
					Data = accelerationData,
					Weight = HorseAppraiserPlugin.ConfigWeightAcceleration.Value
				},
				new StatInput
				{
					Entry = rotationSpeed,
					Data = rotationSpeedData,
					Weight = HorseAppraiserPlugin.ConfigWeightRotationSpeed.Value
				}
			};
			MountSubMenu val = null;
			try
			{
				val = container.GetComponentInParent<MountSubMenu>();
			}
			catch
			{
			}
			float spawnPercentage = (scoreByUpgradeProgress ? 1f : HorseLookup.GetSpawnPercentage());
			if (HorseAppraiserPlugin.ConfigDebugLogging.Value)
			{
				DebugDump.TryLog(val, array, spawnPercentage);
			}
			bool value = HorseAppraiserPlugin.ConfigEnabled.Value;
			float num = 0f;
			float num2 = 0f;
			float num3 = 0f;
			float num4 = 0f;
			int num5 = 0;
			StatInput[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				StatInput statInput = array2[i];
				if ((Object)(object)statInput.Entry == (Object)null)
				{
					continue;
				}
				float percentOfMax = GetPercentOfMax(statInput.Data);
				float spawnScore = GetSpawnScore(statInput.Data, spawnPercentage);
				string color = GetColor(spawnScore);
				num += percentOfMax;
				num2 += spawnScore;
				num5++;
				if (statInput.Weight > 0f)
				{
					num3 += spawnScore * statInput.Weight;
					num4 += statInput.Weight;
				}
				bool colorStats = value && HorseAppraiserPlugin.ConfigColorStats.Value;
				bool flag = value && HorseAppraiserPlugin.ConfigShowStatPercent.Value;
				bool flag2 = statInput.Data.Value >= 10f || statInput.Data.ValueRange.y >= 10f;
				bool flag3 = Mathf.RoundToInt(percentOfMax) >= 100;
				int num6 = 1 + (flag3 ? 1 : 0);
				string slashPadding = (flag ? new string(' ', num6) : string.Empty);
				string valuePadding = ((!flag) ? string.Empty : (flag2 ? "<alpha=#00>.." : "<alpha=#00>."));
				if (colorStats || flag)
				{
					TextDecorator.Decorate(statInput.Entry.ValueText, (string b) => (colorStats ? Colorize(StripColor(b), color) : b) + valuePadding);
				}
				else
				{
					TextDecorator.Restore(statInput.Entry.ValueText);
				}
				if (flag)
				{
					string suffix = "  " + Colorize(FormatPercent(percentOfMax), color);
					TextDecorator.Decorate(statInput.Entry.MaxValueText, (string b) => slashPadding + b + suffix);
				}
				else
				{
					TextDecorator.Restore(statInput.Entry.MaxValueText);
				}
				LocalizedText additionalValueText = statInput.Entry.AdditionalValueText;
				bool flag4 = (Object)(object)additionalValueText != (Object)null && ((Component)additionalValueText).gameObject.activeSelf;
				BonusText.Update(additionalValueText, flag && flag4);
				StatColumns.Update(statInput.Entry, flag);
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			string text = ((value && HorseAppraiserPlugin.ConfigShowOverallRating.Value && num5 > 0) ? FormatOverall(num / (float)num5, num2 / (float)num5, (num4 > 0f) ? (num3 / num4) : (-1f), GetDecimalSeparator(array)) : null);
			if (text != null)
			{
				string suffix2 = "  " + text;
				TextDecorator.Decorate(val.HeaderText, (string b) => b + suffix2);
			}
			else
			{
				TextDecorator.Restore(val.HeaderText);
			}
		}

		private static string FormatOverall(float percentOfMax, float unweightedScore, float weightedScore, string decimalSeparator)
		{
			string prefix = HorseAppraiserPlugin.ConfigOverallPrefix.Value;
			string text = Colorize(FormatPercent(percentOfMax), GetColor(unweightedScore));
			OverallRatingStyle value = HorseAppraiserPlugin.ConfigOverallRatingStyle.Value;
			if (value == OverallRatingStyle.PercentOfMax)
			{
				return Colorize(WithPrefix(FormatPercent(percentOfMax)), GetColor(unweightedScore));
			}
			if (weightedScore < 0f)
			{
				return (value == OverallRatingStyle.Both) ? text : null;
			}
			string text2 = Colorize(WithPrefix(FormatScore10(weightedScore, decimalSeparator)), GetColor(weightedScore));
			return (value == OverallRatingStyle.Both) ? (text + "  " + text2) : text2;
			[CompilerGenerated]
			string WithPrefix(string text3)
			{
				return string.IsNullOrEmpty(prefix) ? text3 : (prefix + " " + text3);
			}
		}

		public static string BuildLegendText()
		{
			if (!HorseAppraiserPlugin.ConfigEnabled.Value || !HorseAppraiserPlugin.ConfigShowLegend.Value)
			{
				return null;
			}
			bool value = HorseAppraiserPlugin.ConfigShowOverallRating.Value;
			OverallRatingStyle value2 = HorseAppraiserPlugin.ConfigOverallRatingStyle.Value;
			List<string> val = new List<string>();
			if (HorseAppraiserPlugin.ConfigColorStats.Value)
			{
				val.Add($"{LegendLabel("Stat Color")} position within the spawn range ({Colorize("weak", HorseAppraiserPlugin.ConfigColorBad.Value)} / {Colorize("average", HorseAppraiserPlugin.ConfigColorMid.Value)} / {Colorize("strong", HorseAppraiserPlugin.ConfigColorGood.Value)} roll)");
			}
			if (HorseAppraiserPlugin.ConfigShowStatPercent.Value || (value && value2 != OverallRatingStyle.Score10))
			{
				val.Add(LegendLabel("% Values") + " share of the absolute maximum (reachable via stable upgrades)");
			}
			if (value && value2 != OverallRatingStyle.PercentOfMax)
			{
				string value3 = HorseAppraiserPlugin.ConfigOverallPrefix.Value;
				string label = (string.IsNullOrEmpty(value3) ? "Rating" : value3);
				val.Add(LegendLabel(label) + " your weighted rating, 0-10 (weights in the config)");
			}
			return (val.Count == 0) ? null : ("<line-height=100%><size=85%>" + string.Join("\n", (System.Collections.Generic.IEnumerable<string>)val) + "</size>");
		}

		private static string LegendLabel(string label)
		{
			return "<size=100%><b>" + label + ":</b></size>";
		}

		private static string FormatScore10(float score, string decimalSeparator)
		{
			float num = Mathf.Round(score) / 10f;
			if (num >= 10f)
			{
				return "10 / 10";
			}
			return num.ToString("0.0", (IFormatProvider)(object)CultureInfo.InvariantCulture).Replace(".", decimalSeparator) + " / 10";
		}

		private static string GetDecimalSeparator(StatInput[] stats)
		{
			for (int i = 0; i < stats.Length; i++)
			{
				StatInput statInput = stats[i];
				MountStatEntry entry = statInput.Entry;
				string plainText = TextDecorator.GetPlainText((entry != null) ? entry.ValueText : null);
				if (plainText.Contains(","))
				{
					return ",";
				}
				if (plainText.Contains("."))
				{
					return ".";
				}
			}
			return ".";
		}

		private static float GetPercentOfMax(Data data)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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)
			float y = data.ValueRange.y;
			if (y <= 0f)
			{
				return 0f;
			}
			return Mathf.Clamp(data.Value / y * 100f, 0f, 999f);
		}

		public static void GetSpawnRange(Data data, float spawnPercentage, out float min, out float max)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			min = data.ValueRange.x;
			max = min + (data.ValueRange.y - min) * spawnPercentage;
		}

		public static float GetSpawnScore(Data data, float spawnPercentage)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			GetSpawnRange(data, spawnPercentage, out var min, out var max);
			if (max <= min)
			{
				return 100f;
			}
			return Mathf.Clamp01((data.Value - min) / (max - min)) * 100f;
		}

		private static string GetColor(float score)
		{
			if (score >= HorseAppraiserPlugin.ConfigGoodScore.Value)
			{
				return HorseAppraiserPlugin.ConfigColorGood.Value;
			}
			if (score >= HorseAppraiserPlugin.ConfigMidScore.Value)
			{
				return HorseAppraiserPlugin.ConfigColorMid.Value;
			}
			return HorseAppraiserPlugin.ConfigColorBad.Value;
		}

		private static string FormatPercent(float percent)
		{
			return Mathf.RoundToInt(percent).ToString((IFormatProvider)(object)CultureInfo.InvariantCulture) + "%";
		}

		private static string Colorize(string text, string color)
		{
			if (!HorseAppraiserPlugin.ConfigColorStats.Value || string.IsNullOrEmpty(color))
			{
				return text;
			}
			return $"<color={color}>{text}</color>";
		}

		private static string StripColor(string text)
		{
			return string.IsNullOrEmpty(text) ? text : ColorTagRegex.Replace(text, string.Empty);
		}
	}
	internal static class BonusText
	{
		private struct Placement
		{
			public Vector2 AnchorMin;

			public Vector2 AnchorMax;

			public Vector2 Pivot;

			public Vector2 Position;
		}

		private static readonly Dictionary<System.IntPtr, Placement> _originals = new Dictionary<System.IntPtr, Placement>();

		private static bool _logged = false;

		public static void Update(LocalizedText bonus, bool moveBelow)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: 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_0128: 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_0172: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = ((bonus != null) ? ((Component)bonus).GetComponent<RectTransform>() : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			System.IntPtr pointer = ((Il2CppObjectBase)val).Pointer;
			Placement placement = default(Placement);
			if (!_originals.TryGetValue(pointer, ref placement))
			{
				placement = new Placement
				{
					AnchorMin = val.anchorMin,
					AnchorMax = val.anchorMax,
					Pivot = val.pivot,
					Position = val.anchoredPosition
				};
				_originals[pointer] = placement;
				if (!_logged && HorseAppraiserPlugin.ConfigDebugLogging.Value)
				{
					_logged = true;
					ManualLogSource log = HorseAppraiserPlugin.Log;
					bool flag = default(bool);
					BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(73, 11, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Layout] Bonus text: parent=");
						Transform parent = ((Transform)val).parent;
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>((parent != null) ? ((Object)parent).name : null);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" anchors=(");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.anchorMin.x, "0.##");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(",");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.anchorMin.y, "0.##");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")-(");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.anchorMax.x, "0.##");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(",");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.anchorMax.y, "0.##");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") ");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("pivot=(");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.pivot.x, "0.##");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(",");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.pivot.y, "0.##");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") pos=(");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.anchoredPosition.x, "0.#");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.anchoredPosition.y, "0.#");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") size=(");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.sizeDelta.x, "0.#");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val.sizeDelta.y, "0.#");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")");
					}
					log.LogInfo(val2);
				}
			}
			Placement placement2 = (moveBelow ? new Placement
			{
				AnchorMin = Vector2.zero,
				AnchorMax = Vector2.zero,
				Pivot = new Vector2(0f, 1f),
				Position = Vector2.zero
			} : placement);
			if (val.anchorMin != placement2.AnchorMin)
			{
				val.anchorMin = placement2.AnchorMin;
			}
			if (val.anchorMax != placement2.AnchorMax)
			{
				val.anchorMax = placement2.AnchorMax;
			}
			if (val.pivot != placement2.Pivot)
			{
				val.pivot = placement2.Pivot;
			}
			if (val.anchoredPosition != placement2.Position)
			{
				val.anchoredPosition = placement2.Position;
			}
		}
	}
	internal static class StatColumns
	{
		private const float MaxColumnWidth = 170f;

		private static readonly Dictionary<System.IntPtr, float> _originalWidths = new Dictionary<System.IntPtr, float>();

		private static bool _logged = false;

		public static void Update(MountStatEntry entry, bool widen)
		{
			//IL_0063: 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_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			RectTransform val = ((Il2CppObjectBase)((Component)entry).transform).TryCast<RectTransform>();
			Transform val2 = ((val != null) ? ((Transform)val).parent : null);
			HorizontalLayoutGroup val3 = ((val2 != null) ? ((Component)val2).GetComponent<HorizontalLayoutGroup>() : null);
			if ((Object)(object)val3 == (Object)null || ((HorizontalOrVerticalLayoutGroup)val3).childControlWidth)
			{
				return;
			}
			System.IntPtr pointer = ((Il2CppObjectBase)val).Pointer;
			float x = default(float);
			if (!_originalWidths.TryGetValue(pointer, ref x))
			{
				x = val.sizeDelta.x;
				_originalWidths[pointer] = x;
			}
			float num = x;
			if (widen)
			{
				int num2 = 0;
				for (int i = 0; i < val2.childCount; i++)
				{
					if (((Component)val2.GetChild(i)).gameObject.activeSelf)
					{
						num2++;
					}
				}
				RectTransform obj = ((Il2CppObjectBase)val2).TryCast<RectTransform>();
				float num3;
				if (obj == null)
				{
					num3 = 0f;
				}
				else
				{
					Rect rect = obj.rect;
					num3 = ((Rect)(ref rect)).width;
				}
				float num4 = num3;
				if (num2 > 0 && num4 > 0f)
				{
					float num5 = num4 - (float)((LayoutGroup)val3).padding.left - (float)((LayoutGroup)val3).padding.right - ((HorizontalOrVerticalLayoutGroup)val3).spacing * (float)(num2 - 1);
					num = Math.Max(x, Math.Min(170f, num5 / (float)num2));
				}
				if (!_logged && HorseAppraiserPlugin.ConfigDebugLogging.Value)
				{
					_logged = true;
					ManualLogSource log = HorseAppraiserPlugin.Log;
					bool flag = default(bool);
					BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(84, 7, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[Layout] Stat columns: parentWidth=");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<float>(num4, "0.#");
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" columns=");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(num2);
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" spacing=");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<float>(((HorizontalOrVerticalLayoutGroup)val3).spacing, "0.#");
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" ");
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("padding=(");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(((LayoutGroup)val3).padding.left);
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", ");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(((LayoutGroup)val3).padding.right);
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(") original=");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<float>(x, "0.#");
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" target=");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<float>(num, "0.#");
					}
					log.LogInfo(val4);
				}
			}
			if (Math.Abs(val.sizeDelta.x - num) > 0.5f)
			{
				val.sizeDelta = new Vector2(num, val.sizeDelta.y);
			}
		}
	}
	internal static class TextDecorator
	{
		private class Decoration
		{
			public string Base;

			public string Written;

			public Func<string, string> Build;
		}

		private static readonly Dictionary<System.IntPtr, Decoration> _decorations = new Dictionary<System.IntPtr, Decoration>();

		private static bool _isApplying = false;

		private static readonly Regex TagRegex = new Regex("<[^>]*>", (RegexOptions)8);

		public static bool IsTracked(System.IntPtr ptr)
		{
			return _decorations.ContainsKey(ptr);
		}

		public static string GetPlainText(LocalizedText textComp)
		{
			if ((Object)(object)textComp == (Object)null)
			{
				return string.Empty;
			}
			string text = null;
			Decoration decoration = default(Decoration);
			if (_decorations.TryGetValue(((Il2CppObjectBase)textComp).Pointer, ref decoration))
			{
				text = decoration.Base;
			}
			if (text == null)
			{
				TextMeshProUGUI tmp = GetTmp(textComp);
				text = ((tmp != null) ? ((TMP_Text)tmp).text : null);
			}
			return (text == null) ? string.Empty : TagRegex.Replace(text, string.Empty);
		}

		public static void Decorate(LocalizedText textComp, Func<string, string> build)
		{
			if ((Object)(object)textComp == (Object)null)
			{
				return;
			}
			TextMeshProUGUI tmp = GetTmp(textComp);
			if (!((Object)(object)tmp == (Object)null))
			{
				System.IntPtr pointer = ((Il2CppObjectBase)textComp).Pointer;
				Decoration decoration = default(Decoration);
				if (!_decorations.TryGetValue(pointer, ref decoration))
				{
					decoration = new Decoration();
					_decorations[pointer] = decoration;
				}
				decoration.Build = build;
				string text = ((TMP_Text)tmp).text;
				if (decoration.Base == null || text != decoration.Written)
				{
					decoration.Base = text;
				}
				Write(textComp, tmp, decoration, build.Invoke(decoration.Base));
			}
		}

		public static void Restore(LocalizedText textComp)
		{
			if ((Object)(object)textComp == (Object)null)
			{
				return;
			}
			System.IntPtr pointer = ((Il2CppObjectBase)textComp).Pointer;
			Decoration decoration = default(Decoration);
			if (_decorations.TryGetValue(pointer, ref decoration))
			{
				_decorations.Remove(pointer);
				TextMeshProUGUI tmp = GetTmp(textComp);
				if ((Object)(object)tmp != (Object)null && ((TMP_Text)tmp).text == decoration.Written && decoration.Base != null)
				{
					Write(textComp, tmp, null, decoration.Base);
				}
			}
		}

		public static void Reapply(LocalizedText textComp)
		{
			Decoration decoration = default(Decoration);
			if (!_isApplying && !((Object)(object)textComp == (Object)null) && _decorations.TryGetValue(((Il2CppObjectBase)textComp).Pointer, ref decoration) && decoration.Build != null)
			{
				Decorate(textComp, decoration.Build);
			}
		}

		private static TextMeshProUGUI GetTmp(LocalizedText textComp)
		{
			TextMeshProUGUI val = textComp.Text;
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)textComp).GetComponent<TextMeshProUGUI>();
			}
			return val;
		}

		private static void Write(LocalizedText textComp, TextMeshProUGUI tmp, Decoration deco, string text)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			if (((TMP_Text)tmp).text == text)
			{
				if (deco != null)
				{
					deco.Written = text;
				}
				return;
			}
			_isApplying = true;
			try
			{
				textComp.ForceSet(text);
				if (((TMP_Text)tmp).text != text)
				{
					((TMP_Text)tmp).text = text;
				}
				if (deco != null)
				{
					deco.Written = ((TMP_Text)tmp).text;
				}
			}
			catch (System.Exception ex)
			{
				ManualLogSource log = HorseAppraiserPlugin.Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(21, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Writing text failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val);
			}
			finally
			{
				_isApplying = false;
			}
		}
	}
	internal static class Legend
	{
		private const string ObjectName = "HorseAppraiser_Legend";

		private static readonly Dictionary<System.IntPtr, TextMeshProUGUI> _legends = new Dictionary<System.IntPtr, TextMeshProUGUI>();

		private static readonly HashSet<string> _layoutLogged = new HashSet<string>();

		private const float TopMargin = 12f;

		private static string _measuredText;

		private static float _measuredWidth;

		public static void Update(MountFeedableContainer container, string text)
		{
			TextMeshProUGUI val = default(TextMeshProUGUI);
			_legends.TryGetValue(((Il2CppObjectBase)container).Pointer, ref val);
			if ((Object)(object)val != (Object)null && ((Il2CppObjectBase)val).WasCollected)
			{
				val = null;
			}
			if (text == null)
			{
				if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf)
				{
					((Component)val).gameObject.SetActive(false);
				}
				return;
			}
			if ((Object)(object)val == (Object)null)
			{
				val = Create(container);
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				_legends[((Il2CppObjectBase)container).Pointer] = val;
			}
			if (!((Component)val).gameObject.activeSelf)
			{
				((Component)val).gameObject.SetActive(true);
			}
			if (((TMP_Text)val).text != text)
			{
				((TMP_Text)val).text = text;
			}
			Position(container, val);
		}

		private static TextMeshProUGUI Create(MountFeedableContainer container)
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			LocalizedText descriptionText = container.DescriptionText;
			if ((Object)(object)descriptionText == (Object)null)
			{
				return null;
			}
			GameObject gameObject = ((Component)descriptionText).gameObject;
			GameObject val = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
			((Object)val).name = "HorseAppraiser_Legend";
			LocalizedText component = val.GetComponent<LocalizedText>();
			if ((Object)(object)component != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			TextMeshProUGUI component2 = val.GetComponent<TextMeshProUGUI>();
			if ((Object)(object)component2 == (Object)null)
			{
				Object.Destroy((Object)(object)val);
				return null;
			}
			((TMP_Text)component2).margin = new Vector4(0f, 12f, 0f, 0f);
			return component2;
		}

		private static void Position(MountFeedableContainer container, TextMeshProUGUI tmp)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_0084: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			RectTransform rectTransform = ((TMP_Text)tmp).rectTransform;
			Transform parent = ((Transform)rectTransform).parent;
			if ((int)((TMP_Text)tmp).alignment != 257)
			{
				((TMP_Text)tmp).alignment = (TextAlignmentOptions)257;
			}
			if ((Object)(object)parent != (Object)null && (Object)(object)((Component)parent).GetComponent<LayoutGroup>() != (Object)null)
			{
				if (((Transform)rectTransform).GetSiblingIndex() != parent.childCount - 1)
				{
					((Transform)rectTransform).SetAsLastSibling();
				}
				RectTransform obj = ((Il2CppObjectBase)parent).TryCast<RectTransform>();
				float num;
				if (obj == null)
				{
					num = 0f;
				}
				else
				{
					Rect rect = obj.rect;
					num = ((Rect)(ref rect)).width;
				}
				float num2 = num;
				if (num2 > 0f)
				{
					num2 = Math.Min(num2, GetTextWidth(tmp));
				}
				if (num2 > 0f && Math.Abs(rectTransform.sizeDelta.x - num2) > 0.5f)
				{
					rectTransform.sizeDelta = new Vector2(num2, rectTransform.sizeDelta.y);
				}
				return;
			}
			LocalizedText descriptionText = container.DescriptionText;
			RectTransform val = ((descriptionText != null) ? ((Component)descriptionText).GetComponent<RectTransform>() : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			float num3 = 3.4028235E+38f;
			GetWorldBounds(val, out var top, out var bottom, out var centerX);
			num3 = Math.Min(num3, bottom);
			Component[] obj2 = new Component[3]
			{
				(Component)container.WaterTimerText,
				(Component)container.WaterTimerFill,
				default(Component)
			};
			Image waterTimerFill = container.WaterTimerFill;
			obj2[2] = (Component)((waterTimerFill != null) ? ((Component)waterTimerFill).transform.parent : null);
			Component[] array = (Component[])(object)obj2;
			foreach (Component val2 in array)
			{
				RectTransform val3 = ((val2 != null) ? val2.GetComponent<RectTransform>() : null);
				if (!((Object)(object)val3 == (Object)null))
				{
					GetWorldBounds(val3, out var _, out var bottom2, out var _);
					num3 = Math.Min(num3, bottom2);
				}
			}
			float num4 = (top - bottom) * 0.5f;
			rectTransform.pivot = new Vector2(0.5f, 1f);
			float preferredHeight = ((TMP_Text)tmp).preferredHeight;
			if (Math.Abs(rectTransform.sizeDelta.y - preferredHeight) > 0.5f)
			{
				rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, preferredHeight);
			}
			Vector3 val4 = default(Vector3);
			((Vector3)(ref val4))..ctor(centerX, num3 - num4, ((Transform)rectTransform).position.z);
			Vector3 val5 = ((Transform)rectTransform).position - val4;
			if (((Vector3)(ref val5)).sqrMagnitude > 0.0001f)
			{
				((Transform)rectTransform).position = val4;
			}
		}

		private static float GetTextWidth(TextMeshProUGUI tmp)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			string text = ((TMP_Text)tmp).text;
			if (text != _measuredText)
			{
				_measuredText = text;
				_measuredWidth = ((TMP_Text)tmp).GetPreferredValues(text, 1f / 0f, 1f / 0f).x + 2f;
			}
			return _measuredWidth;
		}

		private static void GetWorldBounds(RectTransform rt, out float top, out float bottom, out float centerX)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			Il2CppStructArray<Vector3> val = new Il2CppStructArray<Vector3>(4L);
			rt.GetWorldCorners(val);
			bottom = ((Il2CppArrayBase<Vector3>)(object)val)[0].y;
			top = ((Il2CppArrayBase<Vector3>)(object)val)[1].y;
			centerX = (((Il2CppArrayBase<Vector3>)(object)val)[0].x + ((Il2CppArrayBase<Vector3>)(object)val)[2].x) * 0.5f;
		}

		public static void LogLayoutOnce(Component container, LocalizedText description)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			if (!_layoutLogged.Add(((MemberInfo)((Object)container).GetIl2CppType()).Name))
			{
				return;
			}
			ManualLogSource log = HorseAppraiserPlugin.Log;
			ManualLogSource val = log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Layout] ===== ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((MemberInfo)((Object)container).GetIl2CppType()).Name);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" =====");
			}
			val.LogInfo(val2);
			if ((Object)(object)description != (Object)null)
			{
				List<string> val3 = new List<string>();
				Transform val4 = ((Component)description).transform;
				while ((Object)(object)val4 != (Object)null)
				{
					val3.Add(((Object)val4).name);
					if ((Object)(object)val4 == (Object)(object)container.transform)
					{
						break;
					}
					val4 = val4.parent;
				}
				ManualLogSource val5 = log;
				val2 = new BepInExInfoLogInterpolatedStringHandler(35, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Layout] Description parent chain: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(string.Join(" <- ", (System.Collections.Generic.IEnumerable<string>)val3));
				}
				val5.LogInfo(val2);
			}
			LogTransform(container.transform, 0);
		}

		private static void LogTransform(Transform t, int depth)
		{
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			if (depth > 7)
			{
				return;
			}
			List<string> val = new List<string>();
			System.Collections.Generic.IEnumerator<Component> enumerator = ((Component)t).GetComponents<Component>().GetEnumerator();
			try
			{
				while (((System.Collections.IEnumerator)enumerator).MoveNext())
				{
					Component current = enumerator.Current;
					if ((Object)(object)current != (Object)null)
					{
						val.Add(((MemberInfo)((Object)current).GetIl2CppType()).Name);
					}
				}
			}
			finally
			{
				((System.IDisposable)enumerator)?.Dispose();
			}
			string text = string.Empty;
			RectTransform val2 = ((Il2CppObjectBase)t).TryCast<RectTransform>();
			if ((Object)(object)val2 != (Object)null)
			{
				text = $" pos=({val2.anchoredPosition.x:0.#}, {val2.anchoredPosition.y:0.#}) size=({val2.sizeDelta.x:0.#}, {val2.sizeDelta.y:0.#}) anchors=({val2.anchorMin.x:0.##},{val2.anchorMin.y:0.##})-({val2.anchorMax.x:0.##},{val2.anchorMax.y:0.##}) pivot=({val2.pivot.x:0.##},{val2.pivot.y:0.##})";
			}
			ManualLogSource log = HorseAppraiserPlugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(20, 5, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Layout] ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(new string(' ', depth * 2));
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)t).name);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" active=");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<bool>(((Component)t).gameObject.activeSelf);
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" [");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(string.Join(", ", (System.Collections.Generic.IEnumerable<string>)val));
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("]");
			}
			log.LogInfo(val3);
			for (int i = 0; i < t.childCount; i++)
			{
				LogTransform(t.GetChild(i), depth + 1);
			}
		}
	}
	internal static class DebugDump
	{
		private static readonly HashSet<long> _loggedHorses = new HashSet<long>();

		private static readonly string[] StatNames = new string[3] { "MaxSpeed", "Acceleration", "RotationSpeed" };

		public static void TryLog(MountSubMenu menu, StatInput[] stats, float spawnPercentage)
		{
			//IL_0681: Unknown result type (might be due to invalid IL or missing references)
			//IL_0688: Expected O, but got Unknown
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: 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_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Expected O, but got Unknown
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Expected O, but got Unknown
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0563: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Expected O, but got Unknown
			//IL_061c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				World clientWorld;
				Entity menuHorse = HorseLookup.GetMenuHorse(out clientWorld);
				long num = ((long)menuHorse.Index << 32) | (uint)menuHorse.Version;
				if (!_loggedHorses.Add(num))
				{
					return;
				}
				ManualLogSource log = HorseAppraiserPlugin.Log;
				ManualLogSource val = log;
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(33, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Dump] ===== Horse entity ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(menuHorse.Index);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(":");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(menuHorse.Version);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" =====");
				}
				val.LogInfo(val2);
				ManualLogSource val3 = log;
				val2 = new BepInExInfoLogInterpolatedStringHandler(22, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Dump] Header text: '");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(GetText((menu != null) ? menu.HeaderText : null));
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'");
				}
				val3.LogInfo(val2);
				for (int i = 0; i < stats.Length; i++)
				{
					Data data = stats[i].Data;
					string text = "n/a";
					try
					{
						text = (data.AdditionalValue.HasValue ? data.AdditionalValue.value.ToString("0.###", (IFormatProvider)(object)CultureInfo.InvariantCulture) : "none");
					}
					catch
					{
					}
					ManualLogSource val4 = log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(109, 9, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Dump] UI ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(StatNames[i]);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": Value=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(data.Value));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ValueRange=(");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(data.ValueRange.x));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(data.ValueRange.y));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") Additional=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("ValueText='");
						BepInExInfoLogInterpolatedStringHandler obj2 = val2;
						MountStatEntry entry = stats[i].Entry;
						((BepInExLogInterpolatedStringHandler)obj2).AppendFormatted<string>(GetText((entry != null) ? entry.ValueText : null));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' MaxValueText='");
						BepInExInfoLogInterpolatedStringHandler obj3 = val2;
						MountStatEntry entry2 = stats[i].Entry;
						((BepInExLogInterpolatedStringHandler)obj3).AppendFormatted<string>(GetText((entry2 != null) ? entry2.MaxValueText : null));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' AdditionalValueText='");
						BepInExInfoLogInterpolatedStringHandler obj4 = val2;
						MountStatEntry entry3 = stats[i].Entry;
						((BepInExLogInterpolatedStringHandler)obj4).AppendFormatted<string>(GetText((entry3 != null) ? entry3.AdditionalValueText : null));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' ");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("(visible=");
						BepInExInfoLogInterpolatedStringHandler obj5 = val2;
						MountStatEntry entry4 = stats[i].Entry;
						bool? obj6;
						if (entry4 == null)
						{
							obj6 = null;
						}
						else
						{
							LocalizedText additionalValueText = entry4.AdditionalValueText;
							obj6 = ((additionalValueText != null) ? new bool?(((Component)additionalValueText).gameObject.activeInHierarchy) : ((bool?)null));
						}
						((BepInExLogInterpolatedStringHandler)obj5).AppendFormatted<bool?>(obj6);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")");
					}
					val4.LogInfo(val2);
					HorseRating.GetSpawnRange(data, spawnPercentage, out var min, out var max);
					ManualLogSource val5 = log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(39, 4, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Dump] Rating ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(StatNames[i]);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": SpawnRange=(");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(min));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(max));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") Score=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(HorseRating.GetSpawnScore(data, spawnPercentage)));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("%");
					}
					val5.LogInfo(val2);
				}
				if (clientWorld == null || menuHorse == Entity.Null)
				{
					return;
				}
				EntityManager entityManager = clientWorld.EntityManager;
				if (!((EntityManager)(ref entityManager)).Exists(menuHorse))
				{
					log.LogInfo((object)"[Dump] Target entity does not exist in the client world.");
					return;
				}
				if (((EntityManager)(ref entityManager)).HasComponent<PrefabGUID>(menuHorse))
				{
					ManualLogSource val6 = log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Dump] PrefabGUID: ");
						BepInExInfoLogInterpolatedStringHandler obj7 = val2;
						PrefabGUID componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(menuHorse);
						((BepInExLogInterpolatedStringHandler)obj7).AppendFormatted<int>(((PrefabGUID)(ref componentData)).GuidHash);
					}
					val6.LogInfo(val2);
				}
				if (!((EntityManager)(ref entityManager)).HasComponent<Mountable>(menuHorse))
				{
					log.LogInfo((object)"[Dump] Target entity has no Mountable component.");
					return;
				}
				Mountable componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<Mountable>(menuHorse);
				ManualLogSource val7 = log;
				val2 = new BepInExInfoLogInterpolatedStringHandler(60, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Dump] Mountable raw: MaxSpeed=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(componentData2.MaxSpeed));
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" Acceleration=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(componentData2.Acceleration));
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" RotationSpeed=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(componentData2.RotationSpeed));
				}
				val7.LogInfo(val2);
				if (!HorseLookup.TryGetBlob(entityManager, menuHorse, out var blob))
				{
					log.LogInfo((object)"[Dump] Blob pointer is null.");
					return;
				}
				for (int j = 0; j < 3; j++)
				{
					ManualLogSource val8 = log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(49, 4, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Dump] Blob ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(StatNames[j]);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": Range.Min=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(blob[j * 3]));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" Range.Max=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(blob[j * 3 + 1]));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" VisualFactor=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(blob[j * 3 + 2]));
					}
					val8.LogInfo(val2);
				}
				ManualLogSource val9 = log;
				val2 = new BepInExInfoLogInterpolatedStringHandler(61, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Dump] Blob MaxStatSpawnPercentage=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(blob[9]));
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" StatSpawnValueResolution=");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(F(blob[10]));
				}
				val9.LogInfo(val2);
			}
			catch (System.Exception ex)
			{
				ManualLogSource log2 = HorseAppraiserPlugin.Log;
				BepInExWarningLogInterpolatedStringHandler val10 = new BepInExWarningLogInterpolatedStringHandler(15, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("[Dump] failed: ");
					((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<System.Exception>(ex);
				}
				log2.LogWarning(val10);
			}
		}

		private static string GetText(LocalizedText textComp)
		{
			try
			{
				if ((Object)(object)textComp == (Object)null)
				{
					return "<null>";
				}
				TextMeshProUGUI val = textComp.Text ?? ((Component)textComp).GetComponent<TextMeshProUGUI>();
				return ((Object)(object)val != (Object)null) ? ((TMP_Text)val).text : "<no tmp>";
			}
			catch
			{
				return "<error>";
			}
		}

		private static string F(float value)
		{
			return value.ToString("0.#####", (IFormatProvider)(object)CultureInfo.InvariantCulture);
		}
	}
	[HarmonyPatch(typeof(MountFeedableContainer), "RefreshData")]
	public static class MountFeedableContainerRefreshDataPatch
	{
		public static void Postfix(MountFeedableContainer __instance, Data __0)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_001c: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			try
			{
				HorseRating.Apply((Component)(object)__instance, __instance.MaxSpeed, __instance.Acceleration, __instance.RotationSpeed, __0.MaxSpeed, __0.Acceleration, __0.RotationSpeed, scoreByUpgradeProgress: false);
			}
			catch (System.Exception ex)
			{
				ManualLogSource log = HorseAppraiserPlugin.Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("MountFeedableContainer patch failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val);
			}
			try
			{
				if (HorseAppraiserPlugin.ConfigDebugLogging.Value)
				{
					Legend.LogLayoutOnce((Component)(object)__instance, __instance.DescriptionText);
				}
				Legend.Update(__instance, HorseRating.BuildLegendText());
			}
			catch (System.Exception ex2)
			{
				ManualLogSource log2 = HorseAppraiserPlugin.Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(22, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Legend update failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex2.Message);
				}
				log2.LogWarning(val);
			}
		}
	}
	[HarmonyPatch(typeof(MountSaddleBearerContainer), "RefreshData")]
	public static class MountSaddleBearerContainerRefreshDataPatch
	{
		public static void Postfix(MountSaddleBearerContainer __instance, Data __0)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0039: 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)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (__0 != null)
				{
					if (HorseAppraiserPlugin.ConfigDebugLogging.Value)
					{
						Legend.LogLayoutOnce((Component)(object)__instance, null);
					}
					HorseRating.Apply((Component)(object)__instance, __instance.MaxSpeed, __instance.Acceleration, __instance.RotationSpeed, __0.MaxSpeed, __0.Acceleration, __0.RotationSpeed, scoreByUpgradeProgress: true);
				}
			}
			catch (System.Exception ex)
			{
				ManualLogSource log = HorseAppraiserPlugin.Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(41, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("MountSaddleBearerContainer patch failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val);
			}
		}
	}
	[HarmonyPatch(typeof(LocalizedText), "UpdateText")]
	public static class LocalizedTextUpdateTextPatch
	{
		public static void Postfix(LocalizedText __instance)
		{
			if (!((Object)(object)__instance == (Object)null) && TextDecorator.IsTracked(((Il2CppObjectBase)__instance).Pointer) && HorseAppraiserPlugin.ConfigEnabled.Value)
			{
				TextDecorator.Reapply(__instance);
			}
		}
	}
}