Decompiled source of Atlyssyay v1.0.0

BepInEx/plugins/DialogButtonTextIncrease.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("DialogButtonTextIncrease")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BtnTxtIncr")]
[assembly: AssemblyTitle("DialogButtonTextIncrease")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DialogButtonTextIncrease
{
	[BepInPlugin("DialogButtonTextIncrease", "BtnTxtIncr", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(DialogManager), "Create_DialogSelectionButton")]
		public static class DialogManager_Create_DialogSelectionButton
		{
			public static void Postfix(ref DialogManager __instance)
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Expected O, but got Unknown
				FieldInfo fieldInfo = AccessTools.Field(typeof(DialogManager), "_selectionContainer");
				if (fieldInfo == null)
				{
					Logger.LogWarning((object)"Failed to get _selectionContainer");
					return;
				}
				try
				{
					object value = fieldInfo.GetValue(__instance);
					Transform val = (Transform)value;
					Text[] componentsInChildren = ((Component)val).GetComponentsInChildren<Text>();
					if (componentsInChildren == null)
					{
						Logger.LogWarning((object)"Text components were null.");
						return;
					}
					Text[] array = componentsInChildren;
					foreach (Text val2 in array)
					{
						val2.resizeTextForBestFit = true;
					}
				}
				catch (Exception)
				{
					Logger.LogWarning((object)"Failed to cast _selectionContainer");
				}
			}
		}

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin DialogButtonTextIncrease is loaded!");
			Harmony val = new Harmony("DialogButtonTextIncrease");
			val.PatchAll();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "DialogButtonTextIncrease";

		public const string PLUGIN_NAME = "BtnTxtIncr";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

BepInEx/plugins/Localyssation.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Localyssation.Patches;
using Newtonsoft.Json;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("Localyssation")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Localyssation")]
[assembly: AssemblyTitle("Localyssation")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace Localyssation
{
	internal static class LangAdjustables
	{
		public interface ILangAdjustable
		{
			void AdjustToLanguage(Language newLanguage);
		}

		public class LangAdjustableUIText : MonoBehaviour, ILangAdjustable
		{
			public Text text;

			public Func<int, string> newTextFunc;

			public bool textAutoShrinkable = true;

			public bool textAutoShrunk = false;

			public bool orig_resizeTextForBestFit = false;

			public int orig_resizeTextMaxSize;

			public int orig_resizeTextMinSize;

			public void Awake()
			{
				text = ((Component)this).GetComponent<Text>();
				Localyssation.instance.onLanguageChanged += onLanguageChanged;
			}

			public void Start()
			{
				AdjustToLanguage(Localyssation.currentLanguage);
			}

			private void onLanguageChanged(Language newLanguage)
			{
				AdjustToLanguage(newLanguage);
			}

			public void AdjustToLanguage(Language newLanguage)
			{
				if (newTextFunc != null)
				{
					text.text = newTextFunc(text.fontSize);
				}
				if (newLanguage.info.autoShrinkOverflowingText == textAutoShrunk)
				{
					return;
				}
				if (newLanguage.info.autoShrinkOverflowingText)
				{
					if (textAutoShrinkable)
					{
						orig_resizeTextForBestFit = text.resizeTextForBestFit;
						orig_resizeTextMaxSize = text.resizeTextMaxSize;
						orig_resizeTextMinSize = text.resizeTextMinSize;
						text.resizeTextMaxSize = text.fontSize;
						text.resizeTextMinSize = Math.Min(2, text.resizeTextMinSize);
						text.resizeTextForBestFit = true;
						textAutoShrunk = true;
					}
				}
				else
				{
					text.resizeTextForBestFit = orig_resizeTextForBestFit;
					text.resizeTextMaxSize = orig_resizeTextMaxSize;
					text.resizeTextMinSize = orig_resizeTextMinSize;
					textAutoShrunk = false;
				}
			}

			public void OnDestroy()
			{
				Localyssation.instance.onLanguageChanged -= onLanguageChanged;
			}
		}

		public class LangAdjustableUIDropdown : MonoBehaviour, ILangAdjustable
		{
			public Dropdown dropdown;

			public List<Func<int, string>> newTextFuncs;

			public void Awake()
			{
				dropdown = ((Component)this).GetComponent<Dropdown>();
				Localyssation.instance.onLanguageChanged += onLanguageChanged;
				if (Object.op_Implicit((Object)(object)dropdown.itemText))
				{
					((Component)dropdown.itemText).gameObject.AddComponent<LangAdjustableUIText>();
				}
				if (Object.op_Implicit((Object)(object)dropdown.captionText))
				{
					((Component)dropdown.captionText).gameObject.AddComponent<LangAdjustableUIText>();
				}
			}

			public void Start()
			{
				AdjustToLanguage(Localyssation.currentLanguage);
			}

			private void onLanguageChanged(Language newLanguage)
			{
				AdjustToLanguage(newLanguage);
			}

			public void AdjustToLanguage(Language newLanguage)
			{
				if (newTextFuncs.Count == dropdown.options.Count)
				{
					for (int i = 0; i < dropdown.options.Count; i++)
					{
						OptionData val = dropdown.options[i];
						val.text = newTextFuncs[i](-1);
					}
					dropdown.RefreshShownValue();
				}
			}

			public void OnDestroy()
			{
				Localyssation.instance.onLanguageChanged -= onLanguageChanged;
			}
		}

		public static List<ILangAdjustable> nonMonoBehaviourAdjustables = new List<ILangAdjustable>();

		public static void Init()
		{
			Localyssation.instance.onLanguageChanged += delegate(Language newLanguage)
			{
				List<ILangAdjustable> list = new List<ILangAdjustable>(nonMonoBehaviourAdjustables);
				foreach (ILangAdjustable item in list)
				{
					item.AdjustToLanguage(newLanguage);
				}
			};
		}

		public static Func<int, string> GetStringFunc(string key, string defaultValue = "SAME_AS_KEY")
		{
			return (int fontSize) => Localyssation.GetString(key, fontSize, defaultValue);
		}

		public static void RegisterText(Text text, Func<int, string> newTextFunc)
		{
			if (!Object.op_Implicit((Object)(object)((Component)text).GetComponent<LangAdjustableUIText>()))
			{
				LangAdjustableUIText langAdjustableUIText = ((Component)text).gameObject.AddComponent<LangAdjustableUIText>();
				langAdjustableUIText.newTextFunc = newTextFunc;
			}
		}

		public static void RegisterDropdown(Dropdown dropdown, List<Func<int, string>> newTextFuncs)
		{
			if (!Object.op_Implicit((Object)(object)((Component)dropdown).GetComponent<LangAdjustableUIDropdown>()))
			{
				LangAdjustableUIDropdown langAdjustableUIDropdown = ((Component)dropdown).gameObject.AddComponent<LangAdjustableUIDropdown>();
				langAdjustableUIDropdown.newTextFuncs = newTextFuncs;
			}
		}
	}
	[BepInPlugin("com.themysticsword.localyssation", "Localyssation", "0.0.2")]
	public class Localyssation : BaseUnityPlugin
	{
		private delegate string TextEditTagFunc(string str, string arg, int fontSize);

		public const string PLUGIN_GUID = "com.themysticsword.localyssation";

		public const string PLUGIN_NAME = "Localyssation";

		public const string PLUGIN_VERSION = "0.0.2";

		public static Localyssation instance;

		internal static Assembly assembly;

		internal static string dllPath;

		public static Language defaultLanguage;

		public static Language currentLanguage;

		public static Dictionary<string, Language> languages = new Dictionary<string, Language>();

		public static readonly List<Language> languagesList = new List<Language>();

		internal static ManualLogSource logger;

		internal static ConfigFile config;

		internal static ConfigEntry<string> configLanguage;

		internal static ConfigEntry<bool> configCreateDefaultLanguageFiles;

		internal static ConfigEntry<KeyCode> configReloadLanguageKeybind;

		public const string GET_STRING_DEFAULT_VALUE_ARG_UNSPECIFIED = "SAME_AS_KEY";

		private static Dictionary<string, TextEditTagFunc> textEditTags = new Dictionary<string, TextEditTagFunc>
		{
			{
				"firstupper",
				delegate(string str, string arg, int fontSize)
				{
					if (str.Length > 0)
					{
						string text2 = str[0].ToString();
						str = str.Remove(0, 1);
						str = str.Insert(0, text2.ToUpper());
					}
					return str;
				}
			},
			{
				"firstlower",
				delegate(string str, string arg, int fontSize)
				{
					if (str.Length > 0)
					{
						string text = str[0].ToString();
						str = str.Remove(0, 1);
						str = str.Insert(0, text.ToLower());
					}
					return str;
				}
			},
			{
				"scale",
				delegate(string str, string arg, int fontSize)
				{
					if (fontSize > 0)
					{
						try
						{
							float num2 = float.Parse(arg, CultureInfo.InvariantCulture);
							str = $"<size={Math.Round((float)fontSize * num2)}>{str}</size>";
						}
						catch
						{
						}
					}
					else
					{
						str = "<scalefallback=" + arg + ">" + str + "</scalefallback>";
					}
					return str;
				}
			},
			{
				"scalefallback",
				delegate(string str, string arg, int fontSize)
				{
					if (fontSize > 0)
					{
						try
						{
							float num = float.Parse(arg, CultureInfo.InvariantCulture);
							str = $"<size={Math.Round((float)fontSize * num)}>{str}</size>";
						}
						catch
						{
						}
					}
					return str;
				}
			}
		};

		private static List<string> defaultAppliedTextEditTags = new List<string> { "firstupper", "firstlower", "scale" };

		public event Action<Language> onLanguageChanged;

		internal void CallOnLanguageChanged(Language newLanguage)
		{
			if (this.onLanguageChanged != null)
			{
				this.onLanguageChanged(newLanguage);
			}
		}

		private void Awake()
		{
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			instance = this;
			logger = ((BaseUnityPlugin)this).Logger;
			config = ((BaseUnityPlugin)this).Config;
			assembly = Assembly.GetExecutingAssembly();
			dllPath = new Uri(assembly.CodeBase).LocalPath;
			defaultLanguage = CreateDefaultLanguage();
			RegisterLanguage(defaultLanguage);
			ChangeLanguage(defaultLanguage);
			LoadLanguagesFromFileSystem();
			configLanguage = config.Bind<string>("General", "Language", defaultLanguage.info.code, "Currently selected language's code");
			if (languages.TryGetValue(configLanguage.Value, out var value))
			{
				ChangeLanguage(value);
			}
			configCreateDefaultLanguageFiles = config.Bind<bool>("Developers", "Create Default Language Files", false, "If enabled, files for the default game language will be created in the mod's directory on game load");
			configReloadLanguageKeybind = config.Bind<KeyCode>("Developers", "Reload Language Keybind", (KeyCode)0, "When you press this button, your current language's files will be reloaded mid-game");
			Harmony val = new Harmony("com.themysticsword.localyssation");
			val.PatchAll();
			val.PatchAll(typeof(GameLoadPatches));
			val.PatchAll(typeof(ReplaceTextPatches));
			val.PatchAll(typeof(CreateUIPatches));
			OnSceneLoaded.Init();
			LangAdjustables.Init();
		}

		private void Update()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (UnityInput.Current.GetKeyDown(configReloadLanguageKeybind.Value))
			{
				currentLanguage.LoadFromFileSystem(forceOverwrite: true);
				CallOnLanguageChanged(currentLanguage);
			}
		}

		public static void LoadLanguagesFromFileSystem()
		{
			string[] files = Directory.GetFiles(Paths.PluginPath, "localyssationLanguage.json", SearchOption.AllDirectories);
			string[] array = files;
			foreach (string path in array)
			{
				string directoryName = Path.GetDirectoryName(path);
				Language language = new Language();
				language.fileSystemPath = directoryName;
				if (language.LoadFromFileSystem())
				{
					RegisterLanguage(language);
				}
			}
		}

		public static void RegisterLanguage(Language language)
		{
			if (languages.TryGetValue(language.info.code, out var value))
			{
				value.info = language.info;
				{
					foreach (KeyValuePair<string, string> @string in language.strings)
					{
						value.strings[@string.Key] = @string.Value;
					}
					return;
				}
			}
			languages[language.info.code] = language;
			languagesList.Add(language);
		}

		public static void ChangeLanguage(Language newLanguage)
		{
			if (currentLanguage != newLanguage)
			{
				currentLanguage = newLanguage;
				instance.CallOnLanguageChanged(newLanguage);
			}
		}

		internal static Language CreateDefaultLanguage()
		{
			Language language = new Language();
			language.info.code = "en-US";
			language.info.name = "English (US)";
			language.fileSystemPath = Path.Combine(Path.GetDirectoryName(dllPath), "defaultLanguage");
			language.strings = new Dictionary<string, string>
			{
				{ "GAME_LOADING", "Loading..." },
				{ "EXP_COUNTER_MAX", "MAX" },
				{ "MAIN_MENU_BUTTON_SINGLEPLAY", "Singleplayer" },
				{ "MAIN_MENU_BUTTON_SINGLEPLAY_TOOLTIP", "Start a Singleplayer Game." },
				{ "MAIN_MENU_BUTTON_MULTIPLAY", "Multiplayer" },
				{ "MAIN_MENU_BUTTON_MULTIPLAY_TOOLTIP", "Start a Netplay Game." },
				{ "MAIN_MENU_BUTTON_MULTIPLAY_DISABLED_TOOLTIP", "Multiplayer is disabled on this demo." },
				{ "MAIN_MENU_BUTTON_SETTINGS", "Settings" },
				{ "MAIN_MENU_BUTTON_SETTINGS_TOOLTIP", "Configure Game Settings." },
				{ "MAIN_MENU_BUTTON_QUIT", "Quit" },
				{ "MAIN_MENU_BUTTON_QUIT_TOOLTIP", "End The Application." },
				{ "CHARACTER_SELECT_HEADER", "Character Select" },
				{ "CHARACTER_SELECT_HEADER_GAME_MODE_SINGLEPLAYER", "Singleplayer" },
				{ "CHARACTER_SELECT_HEADER_GAME_MODE_HOST_MULTIPLAYER_PUBLIC", "Host Game (Public)" },
				{ "CHARACTER_SELECT_HEADER_GAME_MODE_HOST_MULTIPLAYER_FRIENDS", "Host Game (Friends)" },
				{ "CHARACTER_SELECT_HEADER_GAME_MODE_HOST_MULTIPLAYER_PRIVATE", "Host Game (Private)" },
				{ "CHARACTER_SELECT_HEADER_GAME_MODE_JOIN_MULTIPLAYER", "Join Game" },
				{ "CHARACTER_SELECT_HEADER_GAME_MODE_LOBBY_QUERY", "Lobby Query" },
				{ "CHARACTER_SELECT_BUTTON_CREATE_CHARACTER", "Create Character" },
				{ "CHARACTER_SELECT_BUTTON_DELETE_CHARACTER", "Delete Character" },
				{ "CHARACTER_SELECT_BUTTON_SELECT_CHARACTER", "Select Character" },
				{ "CHARACTER_SELECT_BUTTON_RETURN", "Return" },
				{ "CHARACTER_SELECT_DATA_ENTRY_EMPTY_SLOT", "Empty Slot" },
				{ "FORMAT_CHARACTER_SELECT_DATA_ENTRY_INFO", "Lv-{0} {1} {2}" },
				{ "CHARACTER_SELECT_CHARACTER_DELETE_PROMPT_TEXT", "Type in the character's name to confirm." },
				{ "CHARACTER_SELECT_CHARACTER_DELETE_PROMPT_PLACEHOLDER_TEXT", "Enter Nickname..." },
				{ "CHARACTER_SELECT_CHARACTER_DELETE_BUTTON_CONFIRM", "Delete Character" },
				{ "CHARACTER_SELECT_CHARACTER_DELETE_BUTTON_RETURN", "Return" },
				{ "CHARACTER_CREATION_HEADER", "Character Creation" },
				{ "CHARACTER_CREATION_HEADER_RACE_NAME", "Race Select" },
				{ "CHARACTER_CREATION_RACE_DESCRIPTOR_HEADER_INITIAL_SKILL", "Initial Skill" },
				{ "CHARACTER_CREATION_BUTTON_SET_TO_DEFAULTS", "Defaults" },
				{ "CHARACTER_CREATION_CHARACTER_NAME_PLACEHOLDER_TEXT", "Enter Name..." },
				{ "CHARACTER_CREATION_BUTTON_CREATE_CHARACTER", "Create Character" },
				{ "CHARACTER_CREATION_BUTTON_RETURN", "Return" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEADER_COLOR", "Color" },
				{ "CHARACTER_CREATION_CUSTOMIZER_COLOR_BODY_HEADER", "Body" },
				{ "CHARACTER_CREATION_CUSTOMIZER_COLOR_BODY_TEXTURE", "Texture" },
				{ "CHARACTER_CREATION_CUSTOMIZER_COLOR_HAIR_HEADER", "Hair" },
				{ "CHARACTER_CREATION_CUSTOMIZER_COLOR_HAIR_LOCK_COLOR", "Lock Color" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEADER_HEAD", "Head" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEAD_HEAD_WIDTH", "Head Width" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEAD_HEAD_MOD", "Modify" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEAD_VOICE_PITCH", "Voice Pitch" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEAD_HAIR_STYLE", "Hair" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEAD_EARS", "Ears" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEAD_EYES", "Eyes" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEAD_MOUTH", "Mouth" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEADER_BODY", "Body" },
				{ "CHARACTER_CREATION_CUSTOMIZER_BODY_HEIGHT", "Height" },
				{ "CHARACTER_CREATION_CUSTOMIZER_BODY_WIDTH", "Width" },
				{ "CHARACTER_CREATION_CUSTOMIZER_BODY_CHEST", "Chest" },
				{ "CHARACTER_CREATION_CUSTOMIZER_BODY_ARMS", "Arms" },
				{ "CHARACTER_CREATION_CUSTOMIZER_BODY_BELLY", "Belly" },
				{ "CHARACTER_CREATION_CUSTOMIZER_BODY_BOTTOM", "Bottom" },
				{ "CHARACTER_CREATION_CUSTOMIZER_BODY_TAIL", "Tail" },
				{ "CHARACTER_CREATION_CUSTOMIZER_BODY_TOGGLE_LEFT_HANDED", "Mirror Body" },
				{ "CHARACTER_CREATION_CUSTOMIZER_HEADER_TRAIT", "Trait" },
				{ "CHARACTER_CREATION_CUSTOMIZER_TRAIT_EQUIPMENT", "Equipment" },
				{ "CHARACTER_CREATION_CUSTOMIZER_TRAIT_WEAPON_LOADOUT", "Weapon" },
				{ "CHARACTER_CREATION_CUSTOMIZER_TRAIT_GEAR_DYE", "Dye" },
				{ "CHARACTER_CREATION_CUSTOMIZER_TRAIT_ATTRIBUTES", "Attributes" },
				{ "CHARACTER_CREATION_CUSTOMIZER_TRAIT_RESET_ATTRIBUTE_POINTS", "Reset Points" },
				{ "SETTINGS_TAB_BUTTON_VIDEO", "Display" },
				{ "SETTINGS_TAB_BUTTON_AUDIO", "Audio" },
				{ "SETTINGS_TAB_BUTTON_INPUT", "Input" },
				{ "SETTINGS_TAB_BUTTON_NETWORK", "Interface" },
				{ "SETTINGS_VIDEO_HEADER_GAME_EFFECT_SETTINGS", "Display Sensitive Settings" },
				{ "SETTINGS_VIDEO_CELL_PROPORTIONS_TOGGLE", "Limit Player Character Proportions" },
				{ "SETTINGS_VIDEO_CELL_JIGGLE_BONES_TOGGLE", "Disable Suggestive Jiggle Bones" },
				{ "SETTINGS_VIDEO_CELL_CLEAR_UNDERCLOTHES_TOGGLE", "Enable Clear Clothing" },
				{ "SETTINGS_VIDEO_HEADER_VIDEO_SETTINGS", "Video Settings" },
				{ "SETTINGS_VIDEO_CELL_FULLSCREEN_TOGGLE", "Fullscreen Mode" },
				{ "SETTINGS_VIDEO_CELL_VERTICAL_SYNC", "Vertical Sync / Lock 60 FPS" },
				{ "SETTINGS_VIDEO_CELL_ANISOTROPIC_FILTERING", "Anisotropic Filtering" },
				{ "SETTINGS_VIDEO_CELL_SCREEN_RESOLUTION", "Screen Resolution" },
				{ "SETTINGS_VIDEO_CELL_ANTI_ALIASING", "Anti Aliasing" },
				{ "SETTINGS_VIDEO_CELL_ANTI_ALIASING_OPTION_1", "Disabled" },
				{ "SETTINGS_VIDEO_CELL_ANTI_ALIASING_OPTION_2", "2x Multi Sampling" },
				{ "SETTINGS_VIDEO_CELL_ANTI_ALIASING_OPTION_3", "4x Multi Sampling" },
				{ "SETTINGS_VIDEO_CELL_ANTI_ALIASING_OPTION_4", "8x Multi Sampling" },
				{ "SETTINGS_VIDEO_CELL_TEXTURE_FILTERING", "Texture Filtering" },
				{ "SETTINGS_VIDEO_CELL_TEXTURE_FILTERING_OPTION_1", "Bilnear (Smooth)" },
				{ "SETTINGS_VIDEO_CELL_TEXTURE_FILTERING_OPTION_2", "Nearest (Crunchy)" },
				{ "SETTINGS_VIDEO_CELL_TEXTURE_QUALITY", "Texture Quality" },
				{ "SETTINGS_VIDEO_CELL_TEXTURE_QUALITY_OPTION_1", "High" },
				{ "SETTINGS_VIDEO_CELL_TEXTURE_QUALITY_OPTION_2", "Medium" },
				{ "SETTINGS_VIDEO_CELL_TEXTURE_QUALITY_OPTION_3", "Low" },
				{ "SETTINGS_VIDEO_CELL_TEXTURE_QUALITY_OPTION_4", "Very Low" },
				{ "SETTINGS_VIDEO_HEADER_CAMERA_SETTINGS", "Camera Display Settings" },
				{ "SETTINGS_VIDEO_CELL_FIELD_OF_VIEW", "Field Of View" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_SMOOTHING", "Camera Smoothing" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_HORIZ", "Camera X Position" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_VERT", "Camera Y Position" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_RENDER_DISTANCE", "Render Distance" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_RENDER_DISTANCE_OPTION_1", "Very Near" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_RENDER_DISTANCE_OPTION_2", "Near" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_RENDER_DISTANCE_OPTION_3", "Far" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_RENDER_DISTANCE_OPTION_4", "Very Far" },
				{ "SETTINGS_VIDEO_HEADER_POST_PROCESSING", "Post Processing" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_BITCRUSH_SHADER", "Enable Bitcrush Shader" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_WATER_EFFECT", "Enable Underwater Distortion Shader" },
				{ "SETTINGS_VIDEO_CELL_CAMERA_SHAKE", "Enable Screen Shake" },
				{ "SETTINGS_VIDEO_CELL_WEAPON_GLOW", "Disable Weapon Glow Effect" },
				{ "SETTINGS_AUDIO_HEADER_AUDIO_SETTINGS", "Audio Settings" },
				{ "SETTINGS_AUDIO_CELL_MASTER_VOLUME", "Master Volume" },
				{ "SETTINGS_AUDIO_CELL_MUTE_APPLICATION", "Mute Application" },
				{ "SETTINGS_AUDIO_CELL_MUTE_MUSIC", "Mute Music" },
				{ "SETTINGS_AUDIO_HEADER_AUDIO_CHANNEL_SETTINGS", "Audio Channels" },
				{ "SETTINGS_AUDIO_CELL_GAME_VOLUME", "Game Volume" },
				{ "SETTINGS_AUDIO_CELL_GUI_VOLUME", "GUI Volume" },
				{ "SETTINGS_AUDIO_CELL_AMBIENCE_VOLUME", "Ambience Volume" },
				{ "SETTINGS_AUDIO_CELL_MUSIC_VOLUME", "Music Volume" },
				{ "SETTINGS_AUDIO_CELL_VOICE_VOLUME", "Voice Volume" },
				{ "SETTINGS_INPUT_HEADER_INPUT_SETTINGS", "Input Settings" },
				{ "SETTINGS_INPUT_CELL_AXIS_TYPE", "Analog Stick Axis Type" },
				{ "SETTINGS_INPUT_CELL_AXIS_TYPE_OPTION_1", "WASD (8 Directional)" },
				{ "SETTINGS_INPUT_CELL_AXIS_TYPE_OPTION_2", "Xbox" },
				{ "SETTINGS_INPUT_CELL_AXIS_TYPE_OPTION_3", "Playstation 4" },
				{ "SETTINGS_INPUT_HEADER_CAMERA_CONTROL", "Camera Control" },
				{ "SETTINGS_INPUT_CELL_CAMERA_SENSITIVITY", "Axis Sensitivity" },
				{ "SETTINGS_INPUT_CELL_INVERT_X_CAMERA_AXIS", "Invert X Axis" },
				{ "SETTINGS_INPUT_CELL_INVERT_Y_CAMERA_AXIS", "Invert Y Axis" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_RESET_CAMERA", "Reset Camera" },
				{ "SETTINGS_INPUT_HEADER_MOVEMENT", "Movement" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_UP", "Up" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_DOWN", "Down" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_LEFT", "Left" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_RIGHT", "Right" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_JUMP", "Jump" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_DASH", "Dash" },
				{ "SETTINGS_INPUT_HEADER_STRAFING", "Strafing" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_LOCK_DIRECTION", "Strafe" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_MODE", "Strafe / Aim Mode" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_MODE_OPTION_1", "Hold Strafe Key" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_MODE_OPTION_2", "Toggle Strafe Key" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_WEAPON", "Strafe While Holding Weapon" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_CASTING", "Strafe While Casting Offensive Skills" },
				{ "SETTINGS_INPUT_HEADER_ACTION", "Action" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_ATTACK", "Attack" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_CHARGE_ATTACK", "Charge Attack" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_BLOCK", "Block" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_TARGET", "Lock On" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_INTERACT", "Interact" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_PVP_FLAG", "PvP Flag Toggle" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_01", "Skill Slot 1" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_02", "Skill Slot 2" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_03", "Skill Slot 3" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_04", "Skill Slot 4" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_05", "Skill Slot 5" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_06", "Skill Slot 6" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_RECALL", "Recall" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_QUICKSWAP_WEAPON", "Quickswap Weapon" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_SHEATHE_WEAPON", "Sheathe / Unsheathe Weapon" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_SIT", "Sit" },
				{ "SETTINGS_INPUT_HEADER_CONSUMABLE_SLOTS", "Consumable Quick Slots" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_01", "Quick Slot 1" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_02", "Quick Slot 2" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_03", "Quick Slot 3" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_04", "Quick Slot 4" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_05", "Quick Slot 5" },
				{ "SETTINGS_INPUT_HEADER_INTERFACE", "Interface" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_HOST_CONSOLE", "Host Console" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_LEXICON", "Open Lexicon" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_TAB_MENU", "Open Tab Menu" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_STATS_TAB", "Stats Tab" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_SKILLS_TAB", "Skills Tab" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_ITEM_TAB", "Item Tab" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_QUEST_TAB", "Quest Tab" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_WHO_TAB", "Who Tab" },
				{ "SETTINGS_INPUT_CELL_KEYBINDING_HIDE_UI", "Hide Game UI" },
				{ "SETTINGS_NETWORK_HEADER_UI_SETTINGS", "UI Settings" },
				{ "SETTINGS_NETWORK_CELL_LOCALYSSATION_LANGUAGE", "Language" },
				{ "SETTINGS_NETWORK_CELL_DISPLAY_CREEP_NAMETAGS", "Display Enemy Nametags" },
				{ "SETTINGS_NETWORK_CELL_DISPLAY_LOCAL_NAMETAG", "Display Local Character Name Tag" },
				{ "SETTINGS_NETWORK_CELL_DISPLAY_HOST_TAG", "Display [HOST] Tag on Host Character" },
				{ "SETTINGS_NETWORK_CELL_HIDE_DUNGEON_MINIMAP", "Hide Dungeon Minimap" },
				{ "SETTINGS_NETWORK_CELL_HIDE_FPS_COUNTER", "Hide FPS Counter" },
				{ "SETTINGS_NETWORK_CELL_HIDE_PING_COUNTER", "Hide Ping Counter" },
				{ "SETTINGS_NETWORK_HEADER_CLIENT_SETTINGS", "Client Settings" },
				{ "SETTINGS_NETWORK_CELL_ENABLE_PVP_ON_MAP_ENTER", "Flag for PvP when available" },
				{ "SETTINGS_BUTTON_RESET_TO_DEFAULTS", "Reset to Defaults" },
				{ "SETTINGS_BUTTON_RESET", "Reset" },
				{ "SETTINGS_BUTTON_CANCEL", "Cancel" },
				{ "SETTINGS_BUTTON_APPLY", "Apply" },
				{ "FORMAT_EQUIP_ITEM_RARITY", "[{0}]" },
				{ "FORMAT_EQUIP_LEVEL_REQUIREMENT", "Lv-{0}" },
				{ "FORMAT_EQUIP_CLASS_REQUIREMENT", "Class: {0}" },
				{ "FORMAT_EQUIP_WEAPON_CONDITION", "\n<color=lime>- <color=yellow>{0}%</color> chance to apply {1}.</color>" },
				{ "EQUIP_TOOLTIP_TYPE_HELM", "Helm (Armor)" },
				{ "EQUIP_TOOLTIP_TYPE_CHESTPIECE", "Chestpiece (Armor)" },
				{ "EQUIP_TOOLTIP_TYPE_LEGGINGS", "Leggings (Armor)" },
				{ "EQUIP_TOOLTIP_TYPE_CAPE", "Cape (Armor)" },
				{ "EQUIP_TOOLTIP_TYPE_RING", "Ring (Armor)" },
				{ "FORMAT_EQUIP_TOOLTIP_TYPE_WEAPON", "{0} (Weapon)" },
				{ "EQUIP_TOOLTIP_TYPE_SHIELD", "Shield" },
				{ "FORMAT_EQUIP_STATS_DAMAGE_SCALED", "<color=#c5e384>({0} - {1})</color> Damage" },
				{ "FORMAT_EQUIP_STATS_DAMAGE_SCALED_POWERFUL", "<color=#efcc00>({0} - {1})</color> Damage" },
				{ "FORMAT_EQUIP_STATS_DAMAGE_COMPARE_BASE", "\n<color=grey>(Base Damage: {0} - {1})</color>" },
				{ "FORMAT_EQUIP_STATS_DAMAGE_UNSCALED", "({0} - {1}) Damage" },
				{ "FORMAT_EQUIP_STATS_BLOCK_THRESHOLD", "Block threshold: {0} damage" },
				{ "TAB_MENU_CELL_STATS_HEADER", "Stats" },
				{ "TAB_MENU_CELL_STATS_ATTRIBUTE_POINT_COUNTER", "Points" },
				{ "TAB_MENU_CELL_STATS_BUTTON_APPLY_ATTRIBUTE_POINTS", "Apply" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_NICK_NAME", "Nickname" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_RACE_NAME", "Race" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_CLASS_NAME", "Class" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_LEVEL_COUNTER", "Level" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_EXPERIENCE", "Experience" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_MAX_HEALTH", "Health" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_MAX_MANA", "Mana" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_MAX_STAMINA", "Stamina" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_ATTACK", "Attack Power" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_RANGED_POWER", "Dex Power" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_PHYS_CRITICAL", "Phys. Crit %" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_POW", "Mgk. Power" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_CRIT", "Mgk. Crit %" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_DEFENSE", "Defense" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_DEF", "Mgk. Defense" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_EVASION", "Evasion %" },
				{ "TAB_MENU_CELL_STATS_INFO_CELL_MOVE_SPD", "Mov Spd %" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_BEGIN", "<b>Base Stat:</b> <i>" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_CRIT", "%</i> (Critical %)" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_EVASION", "%</i> (Evasion %)" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_ATTACK_POW", "{0}</i> (Attack Power)" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_MP", "{0}</i> (Max Mana)" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_HP", "{0}</i> (Max Health)" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_RANGE_POW", "{0}</i> (Dex Power)" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_MAGIC_CRIT", "%</i> (Magic Critical %)" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAGIC_DEF", "{0}</i> (Magic Defense)" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_DEFENSE", "{0}</i> (Defense)" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAGIC_POW", "{0}</i> (Magic Power)" },
				{ "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_STAM", "{0}</i> (Max Stamina)" },
				{ "FORMAT_QUEST_REQUIRED_LEVEL", "(lv-{0})" },
				{ "QUEST_TYPE_CLASS", "(Class Tome)" },
				{ "QUEST_TYPE_MASTERY", "(Mastery Scroll)" },
				{ "QUEST_MENU_SUMMARY_NO_QUESTS", "No Quests in Quest Log." },
				{ "QUEST_MENU_HEADER_UNSELECTED", "Select a Quest." },
				{ "FORMAT_QUEST_MENU_CELL_QUEST_LOG_COUNTER", "Quest Log: ({0} / {1})" },
				{ "FORMAT_QUEST_MENU_CELL_FINISHED_QUEST_COUNTER", "Completed Quests: {0}" },
				{ "FORMAT_QUEST_MENU_CELL_REWARD_EXP", "{0} exp" },
				{ "FORMAT_QUEST_MENU_CELL_REWARD_CURRENCY", "{0} Crowns" },
				{ "QUEST_MENU_CELL_SLOT_EMPTY", "Empty Slot" },
				{ "QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_ACCEPT", "Accept Quest" },
				{ "QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_LOCKED", "Quest Locked" },
				{ "QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_INCOMPLETE", "Quest Incomplete" },
				{ "QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_TURN_IN", "Complete Quest" },
				{ "QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_UNSELECTED", "Select a Quest" },
				{ "FORMAT_QUEST_PROGRESS", "{0}: ({1} / {2})" },
				{ "FORMAT_QUEST_PROGRESS_CREEPS_KILLED", "{0} slain" }
			};
			return language;
		}

		public static string GetStringRaw(string key, string defaultValue = "SAME_AS_KEY")
		{
			if (currentLanguage.strings.TryGetValue(key, out var value))
			{
				return value;
			}
			if (defaultLanguage.strings.TryGetValue(key, out value))
			{
				return value;
			}
			return (defaultValue == "SAME_AS_KEY") ? key : defaultValue;
		}

		public static string ApplyTextEditTags(string str, int fontSize = -1, List<string> appliedTextEditTags = null)
		{
			if (appliedTextEditTags == null)
			{
				appliedTextEditTags = defaultAppliedTextEditTags;
			}
			string text = str;
			foreach (KeyValuePair<string, TextEditTagFunc> textEditTag in textEditTags)
			{
				if (!appliedTextEditTags.Contains(textEditTag.Key))
				{
					continue;
				}
				while (true)
				{
					string text2 = "<" + textEditTag.Key;
					int num = text.IndexOf(text2);
					if (num == -1)
					{
						break;
					}
					int num2 = text.IndexOf(">", num + text2.Length);
					if (num2 == -1)
					{
						break;
					}
					string text3 = "</" + textEditTag.Key + ">";
					int num3 = text.IndexOf(text3, num2 + 1);
					if (num3 == -1)
					{
						break;
					}
					string text4 = text.Substring(num + 1, num2 - 1);
					string arg = "";
					if (text4.Contains("="))
					{
						string[] array = text4.Split(new char[1] { '=' });
						if (array.Length == 2)
						{
							arg = array[1];
						}
					}
					string text5 = "";
					if (num2 + 1 <= num3 - 1)
					{
						text5 = text.Substring(num2 + 1, num3 - num2 - 1);
					}
					string value = textEditTag.Value(text5, arg, fontSize);
					text = text.Remove(num3, text3.Length).Remove(num, num2 - num + 1);
					text = text.Remove(num, text5.Length).Insert(num, value);
				}
			}
			return text;
		}

		public static string GetString(string key, int fontSize = -1, string defaultValue = "SAME_AS_KEY")
		{
			return ApplyTextEditTags(GetStringRaw(key, defaultValue), fontSize);
		}

		public static string GetFormattedString(string formatKey, int fontSize = -1, params object[] formatArgs)
		{
			return ApplyTextEditTags(string.Format(GetStringRaw(formatKey), formatArgs), fontSize);
		}
	}
	public class Language
	{
		public class LanguageInfo
		{
			public string code = "";

			public string name = "";

			public bool autoShrinkOverflowingText = false;
		}

		public LanguageInfo info = new LanguageInfo();

		public string fileSystemPath;

		public Dictionary<string, string> strings = new Dictionary<string, string>();

		public void RegisterKey(string key, string defaultValue)
		{
			if (!strings.ContainsKey(key))
			{
				strings[key] = defaultValue;
			}
		}

		public bool LoadFromFileSystem(bool forceOverwrite = false)
		{
			if (string.IsNullOrEmpty(fileSystemPath))
			{
				return false;
			}
			string path = Path.Combine(fileSystemPath, "localyssationLanguage.json");
			string path2 = Path.Combine(fileSystemPath, "strings.tsv");
			string text = Path.Combine(fileSystemPath, "stringScaleFactors.tsv");
			try
			{
				info = JsonConvert.DeserializeObject<LanguageInfo>(File.ReadAllText(path));
				foreach (Dictionary<string, string> item in TSVUtil.parseTsvWithHeaders(File.ReadAllText(path2)))
				{
					if (!forceOverwrite)
					{
						RegisterKey(item["key"], item["value"]);
					}
					else
					{
						strings[item["key"]] = item["value"];
					}
				}
				return true;
			}
			catch (Exception ex)
			{
				Localyssation.logger.LogError((object)ex);
				return false;
			}
		}

		public bool WriteToFileSystem()
		{
			if (string.IsNullOrEmpty(fileSystemPath))
			{
				return false;
			}
			try
			{
				Directory.CreateDirectory(fileSystemPath);
				string path = Path.Combine(fileSystemPath, "localyssationLanguage.json");
				File.WriteAllText(path, JsonConvert.SerializeObject((object)info, (Formatting)1));
				string path2 = Path.Combine(fileSystemPath, "strings.tsv");
				List<List<string>> list = strings.Select((KeyValuePair<string, string> x) => new List<string> { x.Key, x.Value }).ToList();
				list.Insert(0, new List<string> { "key", "value" });
				File.WriteAllText(path2, TSVUtil.makeTsv(list));
				return true;
			}
			catch (Exception ex)
			{
				Localyssation.logger.LogError((object)ex);
				return false;
			}
		}
	}
	public static class TSVUtil
	{
		public static string makeTsv(List<List<string>> rows, string delimeter = "\t")
		{
			List<string> list = new List<string>();
			List<string> list2 = null;
			for (int i = 0; i < rows.Count; i++)
			{
				List<string> list3 = rows[i];
				for (int j = 0; j < list3.Count; j++)
				{
					list3[j] = list3[j].Replace("\n", "\\n").Replace("\t", "\\t");
				}
				string text = string.Join(delimeter, list3);
				if (list2 == null)
				{
					list2 = list3;
				}
				else if (list2.Count != list3.Count)
				{
					Localyssation.logger.LogError((object)$"Row {i} has {list3.Count} columns, which does not match header column count (${list2.Count})");
					Localyssation.logger.LogError((object)("Row content: " + text));
					return string.Join(delimeter, list2);
				}
				list.Add(text);
			}
			return string.Join("\n", list);
		}

		public static List<List<string>> parseTsv(string tsv, string delimeter = "\t")
		{
			List<List<string>> list = new List<List<string>>();
			List<string> list2 = null;
			string[] array = tsv.Split(new string[1] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i];
				if (text.EndsWith("\r"))
				{
					text = text.Substring(0, text.Length - 2);
				}
				List<string> list3 = new List<string>(Split(text, delimeter));
				for (int j = 0; j < list3.Count; j++)
				{
					list3[j] = list3[j].Replace("\\n", "\n").Replace("\\t", "\t");
				}
				if (list2 == null)
				{
					list2 = list3;
				}
				else if (list2.Count != list3.Count)
				{
					Localyssation.logger.LogError((object)$"Row {i} has {list3.Count} columns, which does not match header column count (${list2.Count})");
					Localyssation.logger.LogError((object)("Row content: " + text));
					return new List<List<string>> { list2 };
				}
				list.Add(list3);
			}
			return list;
		}

		public static List<Dictionary<string, string>> parseTsvWithHeaders(string tsv, string delimeter = "\t")
		{
			List<List<string>> list = parseTsv(tsv, delimeter);
			List<Dictionary<string, string>> list2 = new List<Dictionary<string, string>>();
			if (list.Count <= 0)
			{
				return list2;
			}
			List<string> headerRow = list[0];
			for (int i = 1; i < list.Count; i++)
			{
				Dictionary<string, string> item = list[i].Select((string x, int y) => new KeyValuePair<string, string>(headerRow[y], x)).ToDictionary((KeyValuePair<string, string> x) => x.Key, (KeyValuePair<string, string> x) => x.Value);
				list2.Add(item);
			}
			return list2;
		}

		public static List<string> Split(string str, string delimeter)
		{
			List<string> list = new List<string>();
			bool flag = delimeter.StartsWith("\\");
			int num = 0;
			int num2 = 0;
			while (true)
			{
				int num3 = str.IndexOf(delimeter, num2);
				if (num3 == -1)
				{
					list.Add(str.Substring(num, str.Length - num));
					break;
				}
				num2 = num3 + delimeter.Length;
				if (!flag || (num3 > 0 && str[num3 - 1] != '\\'))
				{
					list.Add(str.Substring(num, num3 - num));
					num = num2;
				}
				if (num2 >= str.Length)
				{
					list.Add(str.Substring(num, str.Length - num));
					break;
				}
			}
			return list;
		}
	}
	public static class Util
	{
		public static string GetChildTransformPath(Transform transform, int depth = 0)
		{
			string text = ((Object)transform).name;
			if (depth > 0)
			{
				Transform parent = transform.parent;
				if ((Object)(object)parent != (Object)null)
				{
					text = GetChildTransformPath(parent, depth - 1) + "/" + text;
				}
			}
			return text;
		}
	}
	public static class KeyUtil
	{
		public static string Normalize(string key)
		{
			return new string((from x in key.ToUpper().Replace(" ", "_").Replace("/", "_")
				where Enumerable.Contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789", x)
				select x).ToArray());
		}

		public static string GetForAsset(ScriptableItem asset)
		{
			return "ITEM_" + Normalize(asset._itemName);
		}

		public static string GetForAsset(ScriptableWeaponType asset)
		{
			return "WEAPON_TYPE_" + Normalize(asset._weaponTypeName);
		}

		public static string GetForAsset(ScriptableCreep asset)
		{
			return "CREEP_" + Normalize(asset._creepName);
		}

		public static string GetForAsset(ScriptableQuest asset)
		{
			return "QUEST_" + Normalize(asset._questName);
		}

		public static string GetForAsset(QuestTriggerRequirement asset)
		{
			return "QUEST_TRIGGER_" + Normalize(asset._questTriggerTag);
		}

		public static string GetForAsset(ScriptableCondition asset)
		{
			return "CONDITION_" + Normalize(asset._conditionName);
		}

		public static string GetForAsset(ScriptableStatModifier asset)
		{
			return "STAT_MODIFIER_" + Normalize(asset._modifierTag);
		}

		public static string GetForAsset(ScriptablePlayerRace asset)
		{
			return "RACE_" + Normalize(asset._raceName);
		}

		public static string GetForAsset(ScriptableCombatElement asset)
		{
			return "COMBAT_ELEMENT_" + Normalize(asset._elementName);
		}

		public static string GetForAsset(ScriptablePlayerBaseClass asset)
		{
			return "PLAYER_CLASS_" + Normalize(asset._className);
		}

		public static string GetForAsset(ScriptableSkill asset)
		{
			return "SKILL_" + Normalize(asset._skillName);
		}

		public static string GetForAsset(ScriptableStatAttribute asset)
		{
			return "STAT_ATTRIBUTE_" + Normalize(asset._attributeName);
		}

		public static string GetForAsset(ItemRarity asset)
		{
			return "ITEM_RARITY_" + Normalize(((object)(ItemRarity)(ref asset)).ToString());
		}

		public static string GetForAsset(DamageType asset)
		{
			return "DAMAGE_TYPE_" + Normalize(((object)(DamageType)(ref asset)).ToString());
		}

		public static string GetForAsset(ScriptableDialogData asset)
		{
			return Normalize(((Object)asset).name.ToString()) ?? "";
		}
	}
	internal static class OnSceneLoaded
	{
		public static void Init()
		{
			SceneManager.sceneLoaded += SceneManager_sceneLoaded;
		}

		private static void SceneManager_sceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//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)
			string name = ((Scene)(ref scene)).name;
			string text = name;
			if (!(text == "00_bootStrapper"))
			{
				if (text == "01_rootScene")
				{
				}
				return;
			}
			List<GameObject> source = GetRootGameObjects();
			GameObject val = source.First((GameObject x) => ((Object)x).name == "Canvas_loading");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			Text[] componentsInChildren = val.GetComponentsInChildren<Text>();
			foreach (Text val2 in componentsInChildren)
			{
				if (val2.text == "Loading...")
				{
					LangAdjustables.RegisterText(val2, LangAdjustables.GetStringFunc("GAME_LOADING", val2.text));
					val2.alignment = (TextAnchor)5;
				}
			}
			List<GameObject> GetRootGameObjects()
			{
				List<GameObject> list = new List<GameObject>();
				((Scene)(ref scene)).GetRootGameObjects(list);
				return list;
			}
		}
	}
}
namespace Localyssation.Patches
{
	internal static class CreateUIPatches
	{
		private static Dropdown languageDropdown;

		[HarmonyPatch(typeof(SettingsManager), "Start")]
		[HarmonyPostfix]
		public static void SettingsManager_Start(SettingsManager __instance)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected O, but got Unknown
			Transform val = ((Component)__instance).transform.Find("Canvas_SettingsMenu/_dolly_settingsMenu/_dolly_videoSettingsTab/_backdrop_videoSettings/Scroll View/Viewport/Content/_cell_screenResolution");
			Transform val2 = ((Component)__instance).transform.Find("Canvas_SettingsMenu/_dolly_settingsMenu/_dolly_networkSettingsTab/Image/Scroll View/Viewport/Content");
			Transform val3 = val2.Find("_header_uiSettings");
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val3))
			{
				return;
			}
			GameObject val4 = Object.Instantiate<GameObject>(((Component)val).gameObject, val2);
			((Object)val4).name = "_cell_localyssationLanguage";
			val4.transform.SetSiblingIndex(val3.GetSiblingIndex() + 1);
			languageDropdown = val4.GetComponentInChildren<Dropdown>();
			((Object)((Component)languageDropdown).gameObject).name = "Dropdown_localyssationLanguage";
			languageDropdown.ClearOptions();
			languageDropdown.onValueChanged = new DropdownEvent();
			List<OptionData> list = new List<OptionData>();
			int num = 0;
			int value = 0;
			foreach (Language languages in Localyssation.languagesList)
			{
				list.Add(new OptionData(languages.info.name));
				if (languages == Localyssation.currentLanguage)
				{
					value = num;
				}
				num++;
			}
			languageDropdown.AddOptions(list);
			languageDropdown.value = value;
			((UnityEvent<int>)(object)languageDropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int valueIndex)
			{
				Localyssation.ChangeLanguage(Localyssation.languagesList[valueIndex]);
			});
			LangAdjustables.RegisterText(((Component)val4.transform.Find("Text")).GetComponent<Text>(), LangAdjustables.GetStringFunc("SETTINGS_NETWORK_CELL_LOCALYSSATION_LANGUAGE", "Language"));
		}

		[HarmonyPatch(typeof(SettingsManager), "Save_SettingsData")]
		[HarmonyPostfix]
		public static void SettingsManager_Save_SettingsData(SettingsManager __instance)
		{
			if (Object.op_Implicit((Object)(object)languageDropdown))
			{
				Language language = Localyssation.languagesList[languageDropdown.value];
				Localyssation.ChangeLanguage(language);
				Localyssation.configLanguage.Value = language.info.code;
			}
		}

		[HarmonyPatch(typeof(SettingsManager), "Load_SettingsData")]
		[HarmonyPostfix]
		public static void SettingsManager_Load_SettingsData(SettingsManager __instance)
		{
			if (Object.op_Implicit((Object)(object)languageDropdown) && Localyssation.languages.TryGetValue(Localyssation.configLanguage.Value, out var value))
			{
				Localyssation.ChangeLanguage(value);
				languageDropdown.value = Localyssation.languagesList.IndexOf(value);
			}
		}
	}
	internal static class GameLoadPatches
	{
		[HarmonyPatch(typeof(GameManager), "Cache_ScriptableAssets")]
		[HarmonyPostfix]
		public static void GameManager_Cache_ScriptableAssets(GameManager __instance)
		{
			//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_082f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0834: Unknown result type (might be due to invalid IL or missing references)
			//IL_083b: Unknown result type (might be due to invalid IL or missing references)
			foreach (ScriptableItem value3 in __instance._cachedScriptableItems.Values)
			{
				string forAsset = KeyUtil.GetForAsset(value3);
				Localyssation.defaultLanguage.RegisterKey(forAsset + "_NAME", value3._itemName);
				Localyssation.defaultLanguage.RegisterKey(forAsset + "_DESCRIPTION", value3._itemDescription);
			}
			foreach (ScriptableCreep value4 in __instance._cachedScriptableCreeps.Values)
			{
				string forAsset2 = KeyUtil.GetForAsset(value4);
				Localyssation.defaultLanguage.RegisterKey(forAsset2 + "_NAME", value4._creepName);
				Localyssation.defaultLanguage.RegisterKey(forAsset2 + "_NAME_VARIANT_MANY", value4._creepName + "s");
			}
			foreach (ScriptableQuest value5 in __instance._cachedScriptableQuests.Values)
			{
				string forAsset3 = KeyUtil.GetForAsset(value5);
				Localyssation.defaultLanguage.RegisterKey(forAsset3 + "_NAME", value5._questName);
				Localyssation.defaultLanguage.RegisterKey(forAsset3 + "_DESCRIPTION", value5._questDescription);
				Localyssation.defaultLanguage.RegisterKey(forAsset3 + "_COMPLETE_RETURN_MESSAGE", value5._questCompleteReturnMessage);
				QuestTriggerRequirement[] questTriggerRequirements = value5._questObjective._questTriggerRequirements;
				foreach (QuestTriggerRequirement val in questTriggerRequirements)
				{
					Localyssation.defaultLanguage.RegisterKey(KeyUtil.GetForAsset(val) + "_PREFIX", val._prefix);
					Localyssation.defaultLanguage.RegisterKey(KeyUtil.GetForAsset(val) + "_SUFFIX", val._suffix);
				}
			}
			foreach (ScriptableCondition value6 in __instance._cachedScriptableConditions.Values)
			{
				string text = KeyUtil.GetForAsset(value6) ?? "";
				Localyssation.defaultLanguage.RegisterKey(text + "_NAME", value6._conditionName);
				Localyssation.defaultLanguage.RegisterKey($"{text}_{value6._conditionRank}_DESCRIPTION", value6._conditionDescription);
			}
			foreach (ScriptableStatModifier value7 in __instance._cachedScriptableStatModifiers.Values)
			{
				string forAsset4 = KeyUtil.GetForAsset(value7);
				Localyssation.defaultLanguage.RegisterKey(forAsset4 + "_TAG", value7._modifierTag);
			}
			foreach (ScriptablePlayerRace value8 in __instance._cachedScriptableRaces.Values)
			{
				string forAsset5 = KeyUtil.GetForAsset(value8);
				Localyssation.defaultLanguage.RegisterKey(forAsset5 + "_NAME", value8._raceName);
				Localyssation.defaultLanguage.RegisterKey(forAsset5 + "_DESCRIPTION", value8._raceDescription);
				Localyssation.defaultLanguage.RegisterKey(forAsset5 + "_MISC", value8._miscName);
			}
			foreach (ScriptableCombatElement value9 in __instance._cachedScriptableCombatElements.Values)
			{
				string forAsset6 = KeyUtil.GetForAsset(value9);
				Localyssation.defaultLanguage.RegisterKey(forAsset6 + "_NAME", value9._elementName);
			}
			Localyssation.defaultLanguage.RegisterKey("PLAYER_CLASS_EMPTY_NAME", GameManager._current._statLogics._emptyClassName);
			foreach (ScriptablePlayerBaseClass value10 in __instance._cachedScriptablePlayerClasses.Values)
			{
				string forAsset7 = KeyUtil.GetForAsset(value10);
				Localyssation.defaultLanguage.RegisterKey(forAsset7 + "_NAME", value10._className);
			}
			foreach (ScriptableSkill value11 in __instance._cachedScriptableSkills.Values)
			{
				string forAsset8 = KeyUtil.GetForAsset(value11);
				Localyssation.defaultLanguage.RegisterKey(forAsset8 + "_NAME", value11._skillName);
				Localyssation.defaultLanguage.RegisterKey(forAsset8 + "_DESCRIPTION", value11._skillDescription);
			}
			ScriptableStatAttribute[] statAttributes = GameManager._current._statLogics._statAttributes;
			foreach (ScriptableStatAttribute val2 in statAttributes)
			{
				string forAsset9 = KeyUtil.GetForAsset(val2);
				Localyssation.defaultLanguage.RegisterKey(forAsset9 + "_NAME", val2._attributeName);
				Localyssation.defaultLanguage.RegisterKey(forAsset9 + "_DESCRIPTOR", val2._attributeDescriptor);
			}
			ScriptableWeaponType[] array = Resources.LoadAll<ScriptableWeaponType>("");
			foreach (ScriptableWeaponType val3 in array)
			{
				string forAsset10 = KeyUtil.GetForAsset(val3);
				Localyssation.defaultLanguage.RegisterKey(forAsset10 + "_NAME", val3._weaponTypeName);
			}
			ScriptableDialogData[] array2 = Resources.LoadAll<ScriptableDialogData>("");
			foreach (ScriptableDialogData val4 in array2)
			{
				string forAsset11 = KeyUtil.GetForAsset(val4);
				Localyssation.defaultLanguage.RegisterKey(forAsset11 + "_NAME_TAG", val4._nameTag);
				Dictionary<DialogBranch[], string> dictionary = new Dictionary<DialogBranch[], string>
				{
					{ val4._dialogBranches, "BRANCH" },
					{ val4._introductionBranches, "INTRODUCTION_BRANCH" }
				};
				foreach (KeyValuePair<DialogBranch[], string> item in dictionary)
				{
					DialogBranch[] key = item.Key;
					string value = item.Value;
					for (int m = 0; m < key.Length; m++)
					{
						DialogBranch branch = key[m];
						RegisterKeysForDialogBranch(forAsset11, $"{value}_{m}", branch);
					}
				}
				Dictionary<string[], string> dictionary2 = new Dictionary<string[], string>
				{
					{ val4._shopkeepResponses, "SHOPKEEP_RESPONSE" },
					{ val4._shopkeepRejections, "SHOPKEEP_REJECTION" },
					{ val4._questAcceptResponses, "QUEST_ACCEPT_RESPONSE" },
					{ val4._questCompleteResponses, "QUEST_COMPLETE_RESPONSE" }
				};
				foreach (KeyValuePair<string[], string> item2 in dictionary2)
				{
					string[] key2 = item2.Key;
					string value2 = item2.Value;
					for (int n = 0; n < key2.Length; n++)
					{
						string key3 = key2[n];
						ReplaceTextPatches.dialogManagerQuickSentencesHack[key3] = $"{forAsset11}_{value2}_{n}";
					}
				}
			}
			foreach (ItemRarity value12 in Enum.GetValues(typeof(ItemRarity)))
			{
				ItemRarity asset = value12;
				Localyssation.defaultLanguage.RegisterKey(KeyUtil.GetForAsset(asset), ((object)(ItemRarity)(ref asset)).ToString());
			}
			foreach (DamageType value13 in Enum.GetValues(typeof(DamageType)))
			{
				DamageType asset2 = value13;
				Localyssation.defaultLanguage.RegisterKey(KeyUtil.GetForAsset(asset2), ((object)(DamageType)(ref asset2)).ToString());
			}
			if (Localyssation.configCreateDefaultLanguageFiles.Value)
			{
				((MonoBehaviour)Localyssation.instance).StartCoroutine(RegisterSceneSpecificStrings());
			}
			Localyssation.defaultLanguage.strings["FORMAT_QUEST_MENU_CELL_REWARD_CURRENCY"] = "{0} " + GameManager._current._statLogics._currencyName;
			if (Localyssation.configCreateDefaultLanguageFiles.Value)
			{
				Localyssation.defaultLanguage.WriteToFileSystem();
			}
		}

		private static void RegisterKeysForDialogBranch(string dialogDataKey, string keySuffixBranch, DialogBranch branch)
		{
			for (int i = 0; i < branch.dialogs.Length; i++)
			{
				Dialog val = branch.dialogs[i];
				Localyssation.defaultLanguage.RegisterKey($"{dialogDataKey}_{keySuffixBranch}_DIALOG_{i}_INPUT", val._dialogInput);
				if (val._altInputs != null && val._altInputs.Length != 0)
				{
					for (int j = 0; j < val._altInputs.Length; j++)
					{
						Localyssation.defaultLanguage.RegisterKey($"{dialogDataKey}_{keySuffixBranch}_DIALOG_{i}_INPUT_ALT_{j}", val._altInputs[j]);
					}
				}
				for (int k = 0; k < val._dialogSelections.Length; k++)
				{
					DialogSelection val2 = val._dialogSelections[k];
					Localyssation.defaultLanguage.RegisterKey($"{dialogDataKey}_{keySuffixBranch}_DIALOG_{i}_SELECTION_{k}", val2._selectionCaption);
				}
			}
		}

		private static IEnumerator RegisterSceneSpecificStrings()
		{
			List<string> excludedSceneNames = new List<string> { "00_bootStrapper", "01_rootScene" };
			for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
			{
				string scenePath = SceneUtility.GetScenePathByBuildIndex(i);
				if (excludedSceneNames.Any((string x) => scenePath.Contains(x)))
				{
					continue;
				}
				yield return SceneManager.LoadSceneAsync(scenePath, (LoadSceneMode)1);
				Scene scene = SceneManager.GetSceneByPath(scenePath);
				if (((Scene)(ref scene)).IsValid())
				{
					string sceneName = ((Scene)(ref scene)).name;
					DialogTrigger[] array = Object.FindObjectsOfType<DialogTrigger>(true);
					foreach (DialogTrigger dialogTrigger in array)
					{
						int num;
						if (dialogTrigger._useLocalDialogBranch)
						{
							Scene scene2 = ((Component)dialogTrigger).gameObject.scene;
							num = ((((Scene)(ref scene2)).name == sceneName) ? 1 : 0);
						}
						else
						{
							num = 0;
						}
						if (num != 0)
						{
							string key = KeyUtil.GetForAsset(dialogTrigger._scriptDialogData);
							RegisterKeysForDialogBranch(key, KeyUtil.Normalize("LOCAL_BRANCH_" + sceneName + "_" + Util.GetChildTransformPath(((Component)dialogTrigger).transform, 2)), dialogTrigger._localDialogBranch);
						}
					}
					yield return SceneManager.UnloadSceneAsync(scene);
				}
				scene = default(Scene);
			}
			yield return Resources.UnloadUnusedAssets();
			Localyssation.defaultLanguage.WriteToFileSystem();
		}
	}
	internal static class ReplaceTextPatches
	{
		private static List<string> fallbackTextEditTags = new List<string> { "scalefallback" };

		internal static Dictionary<string, string> dialogManagerQuickSentencesHack = new Dictionary<string, string>();

		internal static IEnumerable<CodeInstruction> SimpleStringReplaceTranspiler(IEnumerable<CodeInstruction> instructions, Dictionary<string, string> stringReplacements)
		{
			//IL_001b: 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)
			//IL_003c: Expected O, but got Unknown
			List<string> replacedStrings = new List<string>();
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction instr) => instr.opcode == OpCodes.Ldstr && stringReplacements.ContainsKey((string)instr.operand) && !replacedStrings.Contains((string)instr.operand)), (string)null)
			}).Repeat((Action<CodeMatcher>)delegate(CodeMatcher matcher)
			{
				string key = (string)matcher.Instruction.operand;
				matcher.Advance(1);
				matcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate<Func<string, string>>((Func<string, string>)((string origString) => Localyssation.GetString(stringReplacements[key], -1, key))) });
				replacedStrings.Add(key);
			}, (Action<string>)null).InstructionEnumeration();
		}

		internal static int GetIntOperand(CodeMatcher matcher)
		{
			object obj = matcher.Operand;
			if (obj == null)
			{
				obj = int.Parse(matcher.Opcode.Name.Substring(matcher.Opcode.Name.Length - 1));
			}
			return (int)obj;
		}

		public static void RemapAllTextUnderObject(GameObject gameObject, Dictionary<string, string> textRemaps, Action<Transform, string> onRemap = null)
		{
			Text[] componentsInChildren = gameObject.GetComponentsInChildren<Text>();
			foreach (Text val in componentsInChildren)
			{
				if (!TryRemapSingle(((Component)val).transform, val))
				{
					Transform parent = ((Component)val).transform.parent;
					if (Object.op_Implicit((Object)(object)parent))
					{
						TryRemapSingle(parent, val);
					}
				}
			}
			bool TryRemapSingle(Transform lookupNameTransform, Text text)
			{
				if (textRemaps.TryGetValue(((Object)lookupNameTransform).name, out var value))
				{
					LangAdjustables.RegisterText(text, LangAdjustables.GetStringFunc(value, text.text));
					if (onRemap != null)
					{
						onRemap(lookupNameTransform, value);
					}
					return true;
				}
				return false;
			}
		}

		public static void RemapChildTextsByPath(Transform parentTransform, Dictionary<string, string> textRemaps, Action<Transform, string> onRemap = null)
		{
			foreach (KeyValuePair<string, string> textRemap in textRemaps)
			{
				Transform val = parentTransform.Find(textRemap.Key);
				if (Object.op_Implicit((Object)(object)val))
				{
					Text component = ((Component)val).GetComponent<Text>();
					if (Object.op_Implicit((Object)(object)component))
					{
						LangAdjustables.RegisterText(component, LangAdjustables.GetStringFunc(textRemap.Value, component.text));
						onRemap?.Invoke(val, textRemap.Value);
					}
				}
			}
		}

		public static void RemapAllInputPlaceholderTextUnderObject(GameObject gameObject, Dictionary<string, string> textRemaps, Action<Transform, string> onRemap = null)
		{
			InputField[] componentsInChildren = gameObject.GetComponentsInChildren<InputField>();
			foreach (InputField val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)val.placeholder))
				{
					Text component = ((Component)val.placeholder).GetComponent<Text>();
					if (Object.op_Implicit((Object)(object)component) && textRemaps.TryGetValue(((Object)val).name, out var value))
					{
						LangAdjustables.RegisterText(component, LangAdjustables.GetStringFunc(value, component.text));
						onRemap?.Invoke(((Component)val).transform, value);
					}
				}
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static void Text_set_text(Text __instance, ref string value)
		{
			if ((Object)(object)__instance != (Object)null && value != null && value.Contains("scalefallback"))
			{
				value = Localyssation.ApplyTextEditTags(value, __instance.fontSize, fallbackTextEditTags);
			}
		}

		[HarmonyPatch(typeof(MainMenuManager), "Awake")]
		[HarmonyPostfix]
		public static void MainMenuManager_Awake(MainMenuManager __instance)
		{
			Transform parent = ((Component)__instance).transform.parent;
			if (!Object.op_Implicit((Object)(object)parent))
			{
				return;
			}
			Transform val = parent.Find("_mainMenu/Canvas_MainMenu");
			if (Object.op_Implicit((Object)(object)val))
			{
				Transform val2 = val.Find("_dolly_selectBar");
				Transform obj_text_toolTipHelp = val.Find("_backdrop_lowBar/_text_toolTipHelp");
				if (Object.op_Implicit((Object)(object)val2))
				{
					RemapAllTextUnderObject(((Component)val2).gameObject, new Dictionary<string, string>
					{
						{ "_button_singleplay", "MAIN_MENU_BUTTON_SINGLEPLAY" },
						{ "_button_multiplay", "MAIN_MENU_BUTTON_MULTIPLAY" },
						{ "_button_settings", "MAIN_MENU_BUTTON_SETTINGS" },
						{ "_button_quit", "MAIN_MENU_BUTTON_QUIT" }
					}, delegate(Transform textParent, string key)
					{
						//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
						//IL_0102: Expected O, but got Unknown
						//IL_0106: 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)
						if (Object.op_Implicit((Object)(object)obj_text_toolTipHelp))
						{
							Text tooltipText = ((Component)obj_text_toolTipHelp).GetComponent<Text>();
							EventTrigger component = ((Component)textParent).GetComponent<EventTrigger>();
							if (Object.op_Implicit((Object)(object)component))
							{
								for (int i = 0; i < component.triggers.Count; i++)
								{
									Entry val9 = component.triggers[i];
									foreach (PersistentCall call in ((UnityEventBase)val9.callback).m_PersistentCalls.m_Calls)
									{
										if (call.methodName == "set_text" && call.arguments.stringArgument != "" && call.target == (Object)(object)tooltipText)
										{
											Entry val10 = new Entry();
											val10.eventID = val9.eventID;
											((UnityEvent<BaseEventData>)(object)val10.callback).AddListener((UnityAction<BaseEventData>)delegate
											{
												tooltipText.text = Localyssation.GetString(key + "_TOOLTIP", tooltipText.fontSize, call.arguments.stringArgument);
											});
											component.triggers.Add(val10);
											return;
										}
									}
								}
							}
						}
					});
				}
			}
			Transform val3 = parent.Find("_characterSelectMenu/Canvas_characterSelect");
			if (Object.op_Implicit((Object)(object)val3))
			{
				RemapAllTextUnderObject(((Component)val3).gameObject, new Dictionary<string, string>
				{
					{ "_text_header", "CHARACTER_SELECT_HEADER" },
					{ "_button_createCharacter", "CHARACTER_SELECT_BUTTON_CREATE_CHARACTER" },
					{ "_button_deleteCharacter", "CHARACTER_SELECT_BUTTON_DELETE_CHARACTER" },
					{ "_button_select", "CHARACTER_SELECT_BUTTON_SELECT_CHARACTER" },
					{ "_button_return", "CHARACTER_SELECT_BUTTON_RETURN" },
					{ "_text_characterDeletePrompt", "CHARACTER_SELECT_CHARACTER_DELETE_PROMPT_TEXT" },
					{ "_button_confirmDeleteCharacter", "CHARACTER_SELECT_CHARACTER_DELETE_BUTTON_CONFIRM" },
					{ "_button_deletePrompt_return", "CHARACTER_SELECT_CHARACTER_DELETE_BUTTON_RETURN" }
				});
				RemapAllInputPlaceholderTextUnderObject(((Component)val3).gameObject, new Dictionary<string, string> { { "_input_characterDeleteConfirm", "CHARACTER_SELECT_CHARACTER_DELETE_PROMPT_PLACEHOLDER_TEXT" } });
			}
			Transform val4 = parent.Find("_characterSelectMenu/Canvas_characterCreation");
			if (Object.op_Implicit((Object)(object)val4))
			{
				RemapAllTextUnderObject(((Component)val4).gameObject, new Dictionary<string, string>
				{
					{ "_text_header", "CHARACTER_CREATION_HEADER" },
					{ "_header_raceName_01", "CHARACTER_CREATION_HEADER" },
					{ "_header_initialSkill", "CHARACTER_CREATION_RACE_DESCRIPTOR_HEADER_INITIAL_SKILL" },
					{ "_button_createCharacter", "CHARACTER_CREATION_BUTTON_CREATE_CHARACTER" },
					{ "_button_return", "CHARACTER_CREATION_BUTTON_RETURN" }
				});
				RemapAllInputPlaceholderTextUnderObject(((Component)val3).gameObject, new Dictionary<string, string> { { "_input_characterName", "CHARACTER_CREATION_CHARACTER_NAME_PLACEHOLDER_TEXT" } });
				Transform val5 = ((Component)val4).transform.Find("_dolly_customizer/_customizer_color");
				Transform val6 = ((Component)val4).transform.Find("_dolly_customizer/_customizer_head");
				Transform val7 = ((Component)val4).transform.Find("_dolly_customizer/_customizer_body");
				Transform val8 = ((Component)val4).transform.Find("_dolly_customizer/_customizer_trait");
				if (Object.op_Implicit((Object)(object)val5))
				{
					RemapAllTextUnderObject(((Component)val5).gameObject, new Dictionary<string, string>
					{
						{ "_customizer_header", "CHARACTER_CREATION_CUSTOMIZER_HEADER_COLOR" },
						{ "Image_01", "CHARACTER_CREATION_CUSTOMIZER_COLOR_BODY_HEADER" },
						{ "_characterButtonSelector", "CHARACTER_CREATION_CUSTOMIZER_COLOR_BODY_TEXTURE" },
						{ "Image", "CHARACTER_CREATION_CUSTOMIZER_COLOR_HAIR_HEADER" },
						{ "Toggle_lockColor", "CHARACTER_CREATION_CUSTOMIZER_COLOR_HAIR_LOCK_COLOR" },
						{ "_button_defaultColor", "CHARACTER_CREATION_BUTTON_SET_TO_DEFAULTS" }
					});
				}
				if (Object.op_Implicit((Object)(object)val6))
				{
					RemapAllTextUnderObject(((Component)val6).gameObject, new Dictionary<string, string>
					{
						{ "_customizer_header", "CHARACTER_CREATION_CUSTOMIZER_HEADER_HEAD" },
						{ "_characterSlider_headWidth", "CHARACTER_CREATION_CUSTOMIZER_HEAD_HEAD_WIDTH" },
						{ "_characterSlider_headMod", "CHARACTER_CREATION_CUSTOMIZER_HEAD_HEAD_MOD" },
						{ "_characterSlider_voicePitch", "CHARACTER_CREATION_CUSTOMIZER_HEAD_VOICE_PITCH" },
						{ "_characterButtons_hairStyle", "CHARACTER_CREATION_CUSTOMIZER_HEAD_HAIR_STYLE" },
						{ "_characterButtons_ears", "CHARACTER_CREATION_CUSTOMIZER_HEAD_EARS" },
						{ "_characterButtons_eyes", "CHARACTER_CREATION_CUSTOMIZER_HEAD_EYES" },
						{ "_characterButtons_mouth", "CHARACTER_CREATION_CUSTOMIZER_HEAD_MOUTH" }
					});
				}
				if (Object.op_Implicit((Object)(object)val7))
				{
					RemapAllTextUnderObject(((Component)val7).gameObject, new Dictionary<string, string>
					{
						{ "_customizer_header", "CHARACTER_CREATION_CUSTOMIZER_HEADER_BODY" },
						{ "_characterSlider_height", "CHARACTER_CREATION_CUSTOMIZER_BODY_HEIGHT" },
						{ "_characterSlider_width", "CHARACTER_CREATION_CUSTOMIZER_BODY_WIDTH" },
						{ "_characterSlider_chest", "CHARACTER_CREATION_CUSTOMIZER_BODY_CHEST" },
						{ "_characterSlider_arms", "CHARACTER_CREATION_CUSTOMIZER_BODY_ARMS" },
						{ "_characterSlider_belly", "CHARACTER_CREATION_CUSTOMIZER_BODY_BELLY" },
						{ "_characterSlider_bottom", "CHARACTER_CREATION_CUSTOMIZER_BODY_BOTTOM" },
						{ "_characterButtonSelector_tail", "CHARACTER_CREATION_CUSTOMIZER_BODY_TAIL" },
						{ "_toggle_leftHanded", "CHARACTER_CREATION_CUSTOMIZER_BODY_TOGGLE_LEFT_HANDED" },
						{ "_button_defaultBody", "CHARACTER_CREATION_BUTTON_SET_TO_DEFAULTS" }
					});
				}
				if (Object.op_Implicit((Object)(object)val8))
				{
					RemapAllTextUnderObject(((Component)val8).gameObject, new Dictionary<string, string>
					{
						{ "_customizer_header", "CHARACTER_CREATION_CUSTOMIZER_HEADER_TRAIT" },
						{ "_header_equipment", "CHARACTER_CREATION_CUSTOMIZER_TRAIT_EQUIPMENT" },
						{ "_selector_weaponLoadout", "CHARACTER_CREATION_CUSTOMIZER_TRAIT_WEAPON_LOADOUT" },
						{ "_selector_gearDye", "CHARACTER_CREATION_CUSTOMIZER_TRAIT_GEAR_DYE" },
						{ "_header_attributes", "CHARACTER_CREATION_CUSTOMIZER_TRAIT_ATTRIBUTES" },
						{ "_text_strengthAttribute", "STAT_ATTRIBUTE_STRENGTH_NAME" },
						{ "_text_mindAttribute", "STAT_ATTRIBUTE_MIND_NAME" },
						{ "_text_dexterityAttribute", "STAT_ATTRIBUTE_DEXTERITY_NAME" },
						{ "_text_vitalityAttribute", "STAT_ATTRIBUTE_VITALITY_NAME" },
						{ "_button_resetAtbPoints", "CHARACTER_CREATION_CUSTOMIZER_TRAIT_RESET_ATTRIBUTE_POINTS" }
					});
				}
			}
		}

		[HarmonyPatch(typeof(CharacterSelectManager), "Handle_HeaderText")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> CharacterSelectManager_Handle_HeaderText_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			return SimpleStringReplaceTranspiler(instructions, new Dictionary<string, string>
			{
				{ "Singleplayer", "CHARACTER_SELECT_HEADER_GAME_MODE_SINGLEPLAYER" },
				{ "Host Game (Public)", "CHARACTER_SELECT_HEADER_GAME_MODE_HOST_MULTIPLAYER_PUBLIC" },
				{ "Host Game (Friends)", "CHARACTER_SELECT_HEADER_GAME_MODE_HOST_MULTIPLAYER_FRIENDS" },
				{ "Host Game (Private)", "CHARACTER_SELECT_HEADER_GAME_MODE_HOST_MULTIPLAYER_PRIVATE" },
				{ "Join Game", "CHARACTER_SELECT_HEADER_GAME_MODE_JOIN_MULTIPLAYER" },
				{ "Lobby Query", "CHARACTER_SELECT_HEADER_GAME_MODE_LOBBY_QUERY" }
			});
		}

		[HarmonyPatch(typeof(CharacterSelectListDataEntry), "Update")]
		[HarmonyPostfix]
		public static void CharacterSelectListDataEntry_Update(CharacterSelectListDataEntry __instance)
		{
			if (__instance._characterFileData._isEmptySlot)
			{
				__instance._characterNicknameText.text = Localyssation.GetString("CHARACTER_SELECT_DATA_ENTRY_EMPTY_SLOT", __instance._characterNicknameText.fontSize, __instance._characterNicknameText.text);
				return;
			}
			int fontSize = __instance._characterInfoText.fontSize;
			string text = "";
			string @string = Localyssation.GetString("PLAYER_CLASS_EMPTY_NAME", fontSize, GameManager._current._statLogics._emptyClassName);
			ScriptablePlayerRace val = GameManager._current.LocateRace(__instance._characterFileData._appearanceProfile._setRaceTag);
			if (Object.op_Implicit((Object)(object)val))
			{
				text = Localyssation.GetString(KeyUtil.GetForAsset(val) + "_NAME", fontSize, val._raceName);
			}
			if (!string.IsNullOrEmpty(__instance._characterFileData._statsProfile._classID))
			{
				ScriptablePlayerBaseClass val2 = GameManager._current.LocateClass(__instance._characterFileData._statsProfile._classID);
				if (Object.op_Implicit((Object)(object)val2))
				{
					@string = Localyssation.GetString(KeyUtil.GetForAsset(val2) + "_NAME", fontSize, val2._className);
				}
			}
			__instance._characterInfoText.text = Localyssation.GetFormattedString("FORMAT_CHARACTER_SELECT_DATA_ENTRY_INFO", __instance._characterInfoText.fontSize, __instance._characterFileData._statsProfile._currentLevel, text, @string);
		}

		[HarmonyPatch(typeof(CharacterCreationManager), "Handle_InterfaceParameters")]
		[HarmonyPostfix]
		public static void CharacterCreationManager_Handle_InterfaceParameters(CharacterCreationManager __instance)
		{
			ScriptablePlayerRace val = __instance._scriptablePlayerRaces[__instance._currentRaceSelected];
			if (Object.op_Implicit((Object)(object)val))
			{
				string forAsset = KeyUtil.GetForAsset(val);
				__instance._raceDescriptionHeader.text = Localyssation.GetString(forAsset + "_NAME", __instance._raceDescriptionHeader.fontSize, __instance._raceDescriptionHeader.text) ?? "";
				__instance._raceDescriptorField.text = Localyssation.GetString(forAsset + "_DESCRIPTION", __instance._raceDescriptorField.fontSize, __instance._raceDescriptorField.text) ?? "";
				__instance._colorMiscTag.text = Localyssation.GetString(forAsset + "_MISC", __instance._colorMiscTag.fontSize, __instance._colorMiscTag.text) ?? "";
				__instance._miscTag.text = Localyssation.GetString(forAsset + "_MISC", __instance._miscTag.fontSize, __instance._miscTag.text) ?? "";
				if (val._racialSkills.Length >= 1)
				{
					string forAsset2 = KeyUtil.GetForAsset(val._racialSkills[0]);
					__instance._raceInitialSkillTag.text = Localyssation.GetString(forAsset2 + "_NAME", __instance._raceInitialSkillTag.fontSize, __instance._raceInitialSkillTag.text) ?? "";
					__instance._raceInitialSkillDescriptor.text = Localyssation.GetString(forAsset2 + "_DESCRIPTION", __instance._raceInitialSkillDescriptor.fontSize, __instance._raceInitialSkillDescriptor.text) ?? "";
				}
			}
		}

		[HarmonyPatch(typeof(SettingsManager), "Start")]
		[HarmonyPostfix]
		public static void SettingsManager_Start(SettingsManager __instance)
		{
			RemapAllTextUnderObject(((Component)__instance).gameObject, new Dictionary<string, string>
			{
				{ "Button_videoTab", "SETTINGS_TAB_BUTTON_VIDEO" },
				{ "_header_GameEffectSettings", "SETTINGS_VIDEO_HEADER_GAME_EFFECT_SETTINGS" },
				{ "_cell_proportionsToggle", "SETTINGS_VIDEO_CELL_PROPORTIONS_TOGGLE" },
				{ "_cell_jiggleBonesToggle", "SETTINGS_VIDEO_CELL_JIGGLE_BONES_TOGGLE" },
				{ "_cell_clearUnderclothesToggle", "SETTINGS_VIDEO_CELL_CLEAR_UNDERCLOTHES_TOGGLE" },
				{ "_header_videoSettings", "SETTINGS_VIDEO_HEADER_VIDEO_SETTINGS" },
				{ "_cell_fullscreenToggle", "SETTINGS_VIDEO_CELL_FULLSCREEN_TOGGLE" },
				{ "_cell_verticalSync", "SETTINGS_VIDEO_CELL_VERTICAL_SYNC" },
				{ "_cell_anisotropicFiltering", "SETTINGS_VIDEO_CELL_ANISOTROPIC_FILTERING" },
				{ "_cell_screenResolution", "SETTINGS_VIDEO_CELL_SCREEN_RESOLUTION" },
				{ "_cell_antiAliasing", "SETTINGS_VIDEO_CELL_ANTI_ALIASING" },
				{ "_cell_textureFiltering", "SETTINGS_VIDEO_CELL_TEXTURE_FILTERING" },
				{ "_cell_textureQuality", "SETTINGS_VIDEO_CELL_TEXTURE_QUALITY" },
				{ "_header_CameraSettings", "SETTINGS_VIDEO_HEADER_CAMERA_SETTINGS" },
				{ "_cell_fieldOfView", "SETTINGS_VIDEO_CELL_FIELD_OF_VIEW" },
				{ "_cell_cameraSmoothing", "SETTINGS_VIDEO_CELL_CAMERA_SMOOTHING" },
				{ "_cell_cameraHoriz", "SETTINGS_VIDEO_CELL_CAMERA_HORIZ" },
				{ "_cell_cameraVert", "SETTINGS_VIDEO_CELL_CAMERA_VERT" },
				{ "_cell_cameraRenderDistance", "SETTINGS_VIDEO_CELL_CAMERA_RENDER_DISTANCE" },
				{ "_header_PostProcessing", "SETTINGS_VIDEO_HEADER_POST_PROCESSING" },
				{ "_cell_cameraBitcrushShader", "SETTINGS_VIDEO_CELL_CAMERA_BITCRUSH_SHADER" },
				{ "_cell_cameraWaterEffect", "SETTINGS_VIDEO_CELL_CAMERA_WATER_EFFECT" },
				{ "_cell_cameraShake", "SETTINGS_VIDEO_CELL_CAMERA_SHAKE" },
				{ "_cell_weaponGlow", "SETTINGS_VIDEO_CELL_WEAPON_GLOW" },
				{ "Button_audioTab", "SETTINGS_TAB_BUTTON_AUDIO" },
				{ "_header_audioSettings", "SETTINGS_AUDIO_HEADER_AUDIO_SETTINGS" },
				{ "_cell_masterVolume", "SETTINGS_AUDIO_CELL_MASTER_VOLUME" },
				{ "_cell_muteApplication", "SETTINGS_AUDIO_CELL_MUTE_APPLICATION" },
				{ "_cell_muteMusic", "SETTINGS_AUDIO_CELL_MUTE_MUSIC" },
				{ "_header_audioChannelSettings", "SETTINGS_AUDIO_HEADER_AUDIO_CHANNEL_SETTINGS" },
				{ "_cell_gameVolume", "SETTINGS_AUDIO_CELL_GAME_VOLUME" },
				{ "_cell_guiVolume", "SETTINGS_AUDIO_CELL_GUI_VOLUME" },
				{ "_cell_ambienceVolume", "SETTINGS_AUDIO_CELL_AMBIENCE_VOLUME" },
				{ "_cell_musicVolume", "SETTINGS_AUDIO_CELL_MUSIC_VOLUME" },
				{ "_cell_voiceVolume", "SETTINGS_AUDIO_CELL_VOICE_VOLUME" },
				{ "Button_inputTab", "SETTINGS_TAB_BUTTON_INPUT" },
				{ "Image_05", "SETTINGS_INPUT_HEADER_INPUT_SETTINGS" },
				{ "_cell_axisType", "SETTINGS_INPUT_CELL_AXIS_TYPE" },
				{ "_cell_resetToDefaults", "SETTINGS_BUTTON_RESET_TO_DEFAULTS" },
				{ "Image_06", "SETTINGS_INPUT_HEADER_CAMERA_CONTROL" },
				{ "_cell_cameraSensitivity", "SETTINGS_INPUT_CELL_CAMERA_SENSITIVITY" },
				{ "Button_01", "SETTINGS_BUTTON_RESET" },
				{ "_cell_invertXCameraAxis", "SETTINGS_INPUT_CELL_INVERT_X_CAMERA_AXIS" },
				{ "_cell_invertYCameraAxis", "SETTINGS_INPUT_CELL_INVERT_Y_CAMERA_AXIS" },
				{ "_cell_keybinding_37", "SETTINGS_INPUT_CELL_KEYBINDING_RESET_CAMERA" },
				{ "Header_Movement", "SETTINGS_INPUT_HEADER_MOVEMENT" },
				{ "_cell_keybinding_up", "SETTINGS_INPUT_CELL_KEYBINDING_UP" },
				{ "_cell_keybinding_down", "SETTINGS_INPUT_CELL_KEYBINDING_DOWN" },
				{ "_cell_keybinding_left", "SETTINGS_INPUT_CELL_KEYBINDING_LEFT" },
				{ "_cell_keybinding_right", "SETTINGS_INPUT_CELL_KEYBINDING_RIGHT" },
				{ "_cell_keybinding_jump", "SETTINGS_INPUT_CELL_KEYBINDING_JUMP" },
				{ "_cell_keybinding_dash", "SETTINGS_INPUT_CELL_KEYBINDING_DASH" },
				{ "Header_Strafing", "SETTINGS_INPUT_HEADER_STRAFING" },
				{ "_cell_keybinding_lockDirection", "SETTINGS_INPUT_CELL_KEYBINDING_LOCK_DIRECTION" },
				{ "_cell_strafeMode", "SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_MODE" },
				{ "_cell_strafeWeapon", "SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_WEAPON" },
				{ "_cell_strafeCasting", "SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_CASTING" },
				{ "Header_Action", "SETTINGS_INPUT_HEADER_ACTION" },
				{ "_cell_keybinding_attack", "SETTINGS_INPUT_CELL_KEYBINDING_ATTACK" },
				{ "_cell_keybinding_chargeAttack", "SETTINGS_INPUT_CELL_KEYBINDING_CHARGE_ATTACK" },
				{ "_cell_keybinding_block", "SETTINGS_INPUT_CELL_KEYBINDING_BLOCK" },
				{ "_cell_keybinding_target", "SETTINGS_INPUT_CELL_KEYBINDING_TARGET" },
				{ "_cell_keybinding_interact", "SETTINGS_INPUT_CELL_KEYBINDING_INTERACT" },
				{ "_cell_keybinding_pvpFlag", "SETTINGS_INPUT_CELL_KEYBINDING_PVP_FLAG" },
				{ "_cell_keybinding_skillSlot01", "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_01" },
				{ "_cell_keybinding_skillSlot02", "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_02" },
				{ "_cell_keybinding_skillSlot03", "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_03" },
				{ "_cell_keybinding_skillSlot04", "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_04" },
				{ "_cell_keybinding_skillSlot05", "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_05" },
				{ "_cell_keybinding_skillSlot06", "SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_06" },
				{ "_cell_keybinding_recall", "SETTINGS_INPUT_CELL_KEYBINDING_RECALL" },
				{ "_cell_keybinding_quickswapWeapon", "SETTINGS_INPUT_CELL_KEYBINDING_QUICKSWAP_WEAPON" },
				{ "_cell_keybinding_sheatheWeapon", "SETTINGS_INPUT_CELL_KEYBINDING_SHEATHE_WEAPON" },
				{ "_cell_keybinding_sit", "SETTINGS_INPUT_CELL_KEYBINDING_SIT" },
				{ "Header_ConsumableSlots", "SETTINGS_INPUT_HEADER_CONSUMABLE_SLOTS" },
				{ "_cell_keybinding_quickSlot01", "SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_01" },
				{ "_cell_keybinding_quickSlot02", "SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_02" },
				{ "_cell_keybinding_quickSlot03", "SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_03" },
				{ "_cell_keybinding_quickSlot04", "SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_04" },
				{ "_cell_keybinding_quickSlot05", "SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_05" },
				{ "Header_Interface", "SETTINGS_INPUT_HEADER_INTERFACE" },
				{ "_cell_keybinding_38", "SETTINGS_INPUT_CELL_KEYBINDING_HOST_CONSOLE" },
				{ "_cell_keybinding_lexicon", "SETTINGS_INPUT_CELL_KEYBINDING_LEXICON" },
				{ "_cell_keybinding_tabMenu", "SETTINGS_INPUT_CELL_KEYBINDING_TAB_MENU" },
				{ "_cell_keybinding_statsTab", "SETTINGS_INPUT_CELL_KEYBINDING_STATS_TAB" },
				{ "_cell_keybinding_skillsTab", "SETTINGS_INPUT_CELL_KEYBINDING_SKILLS_TAB" },
				{ "_cell_keybinding_itemTab", "SETTINGS_INPUT_CELL_KEYBINDING_ITEM_TAB" },
				{ "_cell_keybinding_questTab", "SETTINGS_INPUT_CELL_KEYBINDING_QUEST_TAB" },
				{ "_cell_keybinding_whoTab", "SETTINGS_INPUT_CELL_KEYBINDING_WHO_TAB" },
				{ "_cell_keybinding_hideUI", "SETTINGS_INPUT_CELL_KEYBINDING_HIDE_UI" },
				{ "Button_networkTab", "SETTINGS_TAB_BUTTON_NETWORK" },
				{ "_header_uiSettings", "SETTINGS_NETWORK_HEADER_UI_SETTINGS" },
				{ "_cell_displayCreepNametags", "SETTINGS_NETWORK_CELL_DISPLAY_CREEP_NAMETAGS" },
				{ "_cell_displayLocalNametag", "SETTINGS_NETWORK_CELL_DISPLAY_LOCAL_NAMETAG" },
				{ "_cell_displayHostTag", "SETTINGS_NETWORK_CELL_DISPLAY_HOST_TAG" },
				{ "_cell_hideDungeonMinimap", "SETTINGS_NETWORK_CELL_HIDE_DUNGEON_MINIMAP" },
				{ "_cell_hideFPSCounter", "SETTINGS_NETWORK_CELL_HIDE_FPS_COUNTER" },
				{ "_cell_hidePingCounter", "SETTINGS_NETWORK_CELL_HIDE_PING_COUNTER" },
				{ "_header_clientSettings", "SETTINGS_NETWORK_HEADER_CLIENT_SETTINGS" },
				{ "_cell_enablePvPOnMapEnter", "SETTINGS_NETWORK_CELL_ENABLE_PVP_ON_MAP_ENTER" },
				{ "Button_cancelSettings", "SETTINGS_BUTTON_CANCEL" },
				{ "Button_applySettings", "SETTINGS_BUTTON_APPLY" }
			}, delegate(Transform textParent, string key)
			{
				Dropdown componentInChildren = ((Component)textParent).GetComponentInChildren<Dropdown>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					List<Func<int, string>> list = new List<Func<int, string>>();
					for (int i = 0; i < componentInChildren.options.Count; i++)
					{
						OptionData val = componentInChildren.options[i];
						string key2 = $"{key}_OPTION_{i + 1}";
						if (Localyssation.defaultLanguage.strings.TryGetValue(key2, out var _))
						{
							list.Add(LangAdjustables.GetStringFunc(key2, val.text));
						}
					}
					if (list.Count == componentInChildren.options.Count)
					{
						LangAdjustables.RegisterDropdown(componentInChildren, list);
					}
				}
			});
		}

		[HarmonyPatch(typeof(EquipToolTip), "Apply_EquipStats")]
		[HarmonyPostfix]
		public static void EquipToolTip_Apply_EquipStats(EquipToolTip __instance, ScriptableEquipment _scriptEquip, ItemData _itemData)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)_scriptEquip))
			{
				return;
			}
			string forAsset = KeyUtil.GetForAsset((ScriptableItem)(object)_scriptEquip);
			if (!string.IsNullOrEmpty(((ScriptableItem)_scriptEquip)._itemName))
			{
				((TooltipElement)__instance)._toolTipName.text = ((TooltipElement)__instance)._toolTipName.text.Replace(((ScriptableItem)_scriptEquip)._itemName, Localyssation.GetString(forAsset + "_NAME", ((TooltipElement)__instance)._toolTipName.fontSize, ((TooltipElement)__instance)._toolTipName.text));
			}
			((TooltipElement)__instance)._toolTipSubName.text = Localyssation.GetFormattedString("FORMAT_EQUIP_ITEM_RARITY", ((TooltipElement)__instance)._toolTipSubName.fontSize, Localyssation.GetString(KeyUtil.GetForAsset(((ScriptableItem)_scriptEquip)._itemRarity), ((TooltipElement)__instance)._toolTipSubName.fontSize, ((object)(ItemRarity)(ref ((ScriptableItem)_scriptEquip)._itemRarity)).ToString()));
			if (!string.IsNullOrEmpty(((ScriptableItem)_scriptEquip)._itemDescription))
			{
				((TooltipElement)__instance)._toolTipDescription.text = Localyssation.GetString(forAsset + "_DESCRIPTION", ((TooltipElement)__instance)._toolTipDescription.fontSize, ((TooltipElement)__instance)._toolTipDescription.text);
			}
			if (Object.op_Implicit((Object)(object)_scriptEquip._classRequirement))
			{
				__instance._equipClassRequirement.text = Localyssation.GetFormattedString("FORMAT_EQUIP_CLASS_REQUIREMENT", __instance._equipClassRequirement.fontSize, Localyssation.GetString(KeyUtil.GetForAsset(_scriptEquip._classRequirement) + "_NAME", __instance._equipClassRequirement.fontSize, __instance._equipClassRequirement.text));
			}
			if (!(((object)_scriptEquip).GetType() == typeof(ScriptableWeapon)))
			{
				return;
			}
			ScriptableWeapon val = (ScriptableWeapon)_scriptEquip;
			if (Object.op_Implicit((Object)(object)val._weaponConditionSlot._scriptableCondition))
			{
				Text toolTipDescription = ((TooltipElement)__instance)._toolTipDescription;
				toolTipDescription.text += Localyssation.GetFormattedString("FORMAT_EQUIP_WEAPON_CONDITION", ((TooltipElement)__instance)._toolTipDescription.fontSize, val._weaponConditionSlot._chance * 100f, Localyssation.GetString(KeyUtil.GetForAsset(val._weaponConditionSlot._scriptableCondition) + "_NAME", ((TooltipElement)__instance)._toolTipDescription.fontSize, val._weaponConditionSlot._scriptableCondition._conditionName));
			}
			if (Enum.TryParse<DamageType>(__instance._equipWeaponDamageType.text, out DamageType result))
			{
				__instance._equipWeaponDamageType.text = __instance._equipWeaponDamageType.text.Replace(((object)(DamageType)(ref result)).ToString(), Localyssation.GetString(KeyUtil.GetForAsset(result), __instance._equipWeaponDamageType.fontSize, ((object)(DamageType)(ref result)).ToString()));
			}
			if (Object.op_Implicit((Object)(object)val._combatElement))
			{
				if (!string.IsNullOrEmpty(val._combatElement._elementName))
				{
					__instance._equipElementText.text = __instance._equipElementText.text.Replace(val._combatElement._elementName, Localyssation.GetString(KeyUtil.GetForAsset(val._combatElement) + "_NAME", __instance._equipElementText.fontSize, val._combatElement._elementName));
				}
			}
			else
			{
				__instance._equipElementText.text = __instance._equipElementText.text.Replace("Normal", Localyssation.GetString("COMBAT_ELEMENT_NORMAL_NAME", __instance._equipElementText.fontSize, "Normal"));
			}
		}

		[HarmonyPatch(typeof(EquipToolTip), "Apply_EquipStats")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> EquipToolTip_Apply_EquipStats_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			return SimpleStringReplaceTranspiler(instructions, new Dictionary<string, string>
			{
				{ "Lv-{0}", "FORMAT_EQUIP_LEVEL_REQUIREMENT" },
				{ "Helm (Armor)", "EQUIP_TOOLTIP_TYPE_HELM" },
				{ "Chestpiece (Armor)", "EQUIP_TOOLTIP_TYPE_CHESTPIECE" },
				{ "Leggings (Armor)", "EQUIP_TOOLTIP_TYPE_LEGGINGS" },
				{ "Cape (Armor)", "EQUIP_TOOLTIP_TYPE_CAPE" },
				{ "Ring (Armor)", "EQUIP_TOOLTIP_TYPE_RING" },
				{ "Shield", "EQUIP_TOOLTIP_TYPE_SHIELD" },
				{ "<color=#efcc00>({0} - {1})</color> Damage", "FORMAT_EQUIP_STATS_DAMAGE_SCALED_POWERFUL" },
				{ "<color=#c5e384>({0} - {1})</color> Damage", "FORMAT_EQUIP_STATS_DAMAGE_SCALED" },
				{ "\n<color=grey>(Base Damage: {0} - {1})</color>", "FORMAT_EQUIP_STATS_DAMAGE_COMPARE_BASE" },
				{ "({0} - {1}) Damage", "FORMAT_EQUIP_STATS_DAMAGE_UNSCALED" },
				{ "Block threshold: {0} damage", "FORMAT_EQUIP_STATS_BLOCK_THRESHOLD" }
			});
		}

		[HarmonyPatch(typeof(StatsMenuCell), "Cell_OnAwake")]
		[HarmonyPostfix]
		public static void StatsMenuCell_Cell_OnAwake(StatsMenuCell __instance)
		{
			RemapAllTextUnderObject(((Component)__instance).gameObject, new Dictionary<string, string>
			{
				{ "_text_statsHeader", "TAB_MENU_CELL_STATS_HEADER" },
				{ "_text_attributePointCounter (1)", "TAB_MENU_CELL_STATS_ATTRIBUTE_POINT_COUNTER" },
				{ "_button_applyAttributePoints", "TAB_MENU_CELL_STATS_BUTTON_APPLY_ATTRIBUTE_POINTS" }
			});
			RemapChildTextsByPath(((Component)__instance).transform, new Dictionary<string, string>
			{
				{ "_infoStatPanel/_statInfoCell_nickName/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_NICK_NAME" },
				{ "_infoStatPanel/_statInfoCell_raceName/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_RACE_NAME" },
				{ "_infoStatPanel/_statInfoCell_className/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_CLASS_NAME" },
				{ "_infoStatPanel/_statInfoCell_levelCounter/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_LEVEL_COUNTER" },
				{ "_infoStatPanel/_statInfoCell_experience/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_EXPERIENCE" },
				{ "_infoStatPanel/_statInfoCell_maxHealth/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAX_HEALTH" },
				{ "_infoStatPanel/_statInfoCell_maxMana/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAX_MANA" },
				{ "_infoStatPanel/_statInfoCell_maxStamina/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAX_STAMINA" },
				{ "_infoStatPanel/_statInfoCell_attack/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_ATTACK" },
				{ "_infoStatPanel/_statInfoCell_rangedPower/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_RANGED_POWER" },
				{ "_infoStatPanel/_statInfoCell_physCritical/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_PHYS_CRITICAL" },
				{ "_infoStatPanel/_statInfoCell_magicPow/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_POW" },
				{ "_infoStatPanel/_statInfoCell_magicCrit/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_CRIT" },
				{ "_infoStatPanel/_statInfoCell_defense/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_DEFENSE" },
				{ "_infoStatPanel/_statInfoCell_magicDef/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_DEF" },
				{ "_infoStatPanel/_statInfoCell_evasion/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_EVASION" },
				{ "_infoStatPanel/_statInfoCell_moveSpd/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MOVE_SPD" }
			});
		}

		[HarmonyPatch(typeof(StatsMenuCell), "Apply_StatsCellData")]
		[HarmonyPostfix]
		public static void StatsMenuCell_Apply_StatsCellData(StatsMenuCell __instance)
		{
			if (!TabMenu._current._isOpen && !((TabMenuCell)__instance)._mainPlayer._bufferingStatus)
			{
				return;
			}
			if (!string.IsNullOrEmpty(((TabMenuCell)__instance)._mainPlayer._pVisual._playerAppearanceStruct._setRaceTag))
			{
				ScriptablePlayerRace val = GameManager._current.LocateRace(((TabMenuCell)__instance)._mainPlayer._pVisual._playerAppearanceStruct._setRaceTag);
				if (Object.op_Implicit((Object)(object)val))
				{
					__instance._statsCell_raceTag.text = Localyssation.GetString(KeyUtil.GetForAsset(val) + "_NAME", __instance._statsCell_raceTag.fontSize, __instance._statsCell_raceTag.text);
				}
			}
			if (((TabMenuCell)__instance)._mainPlayer._pStats._currentLevel >= GameManager._current._statLogics._maxMainLevel)
			{
				__instance._statsCell_experience.text = Localyssation.GetString("EXP_COUNTER_MAX", __instance._statsCell_experience.fontSize, __instance._statsCell_experience.text);
			}
			int fontSize = __instance._statsCell_baseClassTag.fontSize;
			string text = ((!Object.op_Implicit((Object)(object)((TabMenuCell)__instance)._mainPlayer._pStats._class)) ? Localyssation.GetString("PLAYER_CLASS_EMPTY_NAME", fontSize, GameManager._current._statLogics._emptyClassName) : Localyssation.GetString(KeyUtil.GetForAsset(((TabMenuCell)__instance)._mainPlayer._pStats._class) + "_NAME", fontSize, ((TabMenuCell)__instance)._mainPlayer._pStats._class._className));
			__instance._statsCell_baseClassTag.text = text;
		}

		[HarmonyPatch(typeof(StatsMenuCell), "ToolTip_DisplayBaseStat")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> StatsMenuCell_ToolTip_DisplayBaseStat_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			return SimpleStringReplaceTranspiler(instructions, new Dictionary<string, string>
			{
				{ "<b>Base Stat:</b> <i>", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_BEGIN" },
				{ "%</i> (Critical %)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_CRIT" },
				{ "%</i> (Evasion %)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_EVASION" },
				{ "{0}</i> (Attack Power)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_ATTACK_POW" },
				{ "{0}</i> (Max Mana)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_MP" },
				{ "{0}</i> (Max Health)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_HP" },
				{ "{0}</i> (Dex Power)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_RANGE_POW" },
				{ "%</i> (Magic Critical %)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_MAGIC_CRIT" },
				{ "{0}</i> (Magic Defense)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAGIC_DEF" },
				{ "{0}</i> (Defense)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_DEFENSE" },
				{ "{0}</i> (Magic Power)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAGIC_POW" },
				{ "{0}</i> (Max Stamina)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_STAM" }
			});
		}

		[HarmonyPatch(typeof(AttributeListDataEntry), "Handle_AttributeData")]
		[HarmonyPostfix]
		public static void AttributeListDataEntry_Handle_AttributeData(AttributeListDataEntry __instance)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)GameManager._current) && Object.op_Implicit((Object)(object)Player._mainPlayer) && !string.IsNullOrEmpty(__instance._pStats._playerAttributes[((ListDataEntry)__instance)._dataID]._attributeName))
			{
				string forAsset = KeyUtil.GetForAsset(__instance._gm._statLogics._statAttributes[((ListDataEntry)__instance)._dataID]);
				((ListDataEntry)__instance)._dataNameText.text = Localyssation.GetString(forAsset + "_NAME", ((ListDataEntry)__instance)._dataNameText.fontSize, ((ListDataEntry)__instance)._dataNameText.text);
			}
		}

		[HarmonyPatch(typeof(AttributeListDataEntry), "Init_TooltipInfo")]
		[HarmonyPostfix]
		public static void AttributeListDataEntry_Init_TooltipInfo(AttributeListDataEntry __instance)
		{
			if (!string.IsNullOrEmpty(__instance._scriptableAttribute._attributeDescriptor))
			{
				string forAsset = KeyUtil.GetForAsset(__instance._scriptableAttribute);
				ToolTipManager._current.Apply_GenericToolTip(Localyssation.GetString(forAsset + "_DESCRIPTOR", -1, __instance._scriptableAttribute._attributeDescriptor));
			}
		}

		[HarmonyPatch(typeof(QuestListDataEntry), "Update")]
		[HarmonyPostfix]
		public static void QuestListDataEntry_Update(QuestListDataEntry __instance)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Invalid comparison between Unknown and I4
			string forAsset = KeyUtil.GetForAsset(__instance._scriptableQuest);
			string @string = Localyssation.GetString(forAsset + "_NAME", ((ListDataEntry)__instance)._dataNameText.fontSize);
			if ((int)__instance._scriptableQuest._questSubType == 0 || (int)__instance._scriptableQuest._questSubType == 1)
			{
				@string = @string + " " + Localyssation.GetFormattedString("FORMAT_QUEST_REQUIRED_LEVEL", ((ListDataEntry)__instance)._dataNameText.fontSize, __instance._scriptableQuest._questLevel);
				string text = ((ListDataEntry)__instance)._dataNameText.text.Substring(0, ((ListDataEntry)__instance)._dataNameText.text.IndexOf(">") + 1);
				((ListDataEntry)__instance)._dataNameText.text = text + @string + "</color>";
			}
			else
			{
				@string = @string + " " + Localyssation.GetString("QUEST_TYPE_" + ((object)(QuestSubType)(ref __instance._scriptableQuest._questSubType)).ToString().ToUpper(), ((ListDataEntry)__instance)._dataNameText.fontSize);
				((ListDataEntry)__instance)._dataNameText.text = "<color=#f7e98e>" + @string + "</color>";
			}
		}

		[HarmonyPatch(typeof(QuestMenuCell), "Handle_CellUpdate")]
		[HarmonyPostfix]
		public static void QuestMenuCell_Handle_CellUpdate(QuestMenuCell __instance)
		{
			if (!Object.op_Implicit((Object)(object)Player._mainPlayer))
			{
				return;
			}
			__instance._questLogCounterText.text = Localyssation.GetFormattedString("FORMAT_QUEST_MENU_CELL_QUEST_LOG_COUNTER", __instance._questLogCounterText.fontSize, __instance._pQuest._questProgressData.Count, __instance._pQuest._questLogLimit);
			int num = 0;
			if (ProfileDataManager._current._characterFile._questProgressProfile._finishedQuests != null)
			{
				num = ProfileDataManager._current._characterFile._questProgressProfile._finishedQuests.Length;
			}
			__instance._finishedQuestCounterText.text = Localyssation.GetFormattedString("FORMAT_QUEST_MENU_CELL_FINISHED_QUEST_COUNTER", __instance._finishedQuestCounterText.fontSize, num);
			string text = "";
			if (__instance._pQuest._questProgressData.Count > 0 && Object.op_Implicit((Object)(object)__instance._selectedQuest))
			{
				for (int i = 0; i < __instance._pQuest._questProgressData.Count; i++)
				{
					if (QuestTrackerManager._current._refreshingElements)
					{
						break;
					}
					QuestProgressStruct val = __instance._pQuest._questProgressData[i];
					if (val._questTag == __instance._selectedQuest._questName)
					{
						if (val._questComplete)
						{
							string forAsset = KeyUtil.GetForAsset(__instance._selectedQuest);
							string @string = Localyssation.GetString(forAsset + "_COMPLETE_RETURN_MESSAGE", __instance._questErrandsText.fontSize, __instance._selectedQuest._questCompleteReturnMessage);
							text = text.Insert(0, "<color=yellow>" + @string + "</color>\n\n");
						}
						text += QuestTrackerManager._current._questTrackElements[i]._trackElementText.text;
					}
				}
			}
			__instance._questErrandsText.text = text;
		}

		[HarmonyPatch(typeof(QuestMenuCell), "Select_QuestSlot")]
		[HarmonyPostfix]
		public static void QuestMenuCell_Select_QuestSlot(QuestMenuCell __instance, ScriptableQuest _scriptQuest)
		{
			string forAsset = KeyUtil.GetForAsset(_scriptQuest);
			__instance._questHeaderText.text = Localyssation.GetString(forAsset + "_NAME", __instance._questHeaderText.fontSize, __instance._questHeaderText.text) + " " + Localyssation.GetFormattedString("FORMAT_QUEST_REQUIRED_LEVEL", __instance._questHeaderText.fontSize, _scriptQuest._questLevel);
			__instance._questSummaryText.text = Localyssation.GetString(forAsset + "_DESCRIPTION", __instance._questSummaryText.fontSize, __instance._questSummaryText.text);
			int num = (int)((float)(int)GameManager._current._statLogics._experienceCurve.Evaluate((float)_scriptQuest._questLevel) * _scriptQuest._questExperiencePercentage);
			if (num > 0)
			{
				__instance._rewardsPanelText_experience.text = Localyssation.GetFormattedString("FORMAT_QUEST_MENU_CELL_REWARD_EXP", __instance._rewardsPanelText_experience.fontSize, num);
			}
			if (_scriptQuest._questCurrencyReward > 0)
			{
				__instance._rewardsPanelText_currency.text = Localyssation.GetFormattedString("FORMAT_QUEST_MENU_CELL_REWARD_CURRENCY", __instance._rewardsPanelText_currency.fontSize, num);
			}
		}

		[HarmonyPatch(typeof(QuestMenuCell), "Clear_DisplayQuestData")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> QuestMenuCell_Clear_DisplayQuestData_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			return SimpleStringReplaceTranspiler(instructions, new Dictionary<string, string>
			{
				{ "No Quests in Quest Log.", "QUEST_MENU_SUMMARY_NO_QUESTS" },
				{ "Select a Quest.", "QUEST_MENU_HEADER_UNSELECTED" }
			});
		}

		[HarmonyPatch(typeof(QuestMenuCellSlot), "Update")]
		[HarmonyPostfix]
		public static void QuestMenuCellSlot_Update(QuestMenuCellSlot __instance)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00aa: Expected I4, but got Unknown
			if (Object.op_Implicit((Object)(object)__instance._scriptQuest))
			{
				int fontSize = __instance._slotTag.fontSize;
				string @string = Localyssation.GetString(KeyUtil.GetForAsset(__instance._scriptQuest) + "_NAME", fontSize, __instance._scriptQuest._questName);
				string formattedString = Localyssation.GetFormattedString("FORMAT_QUEST_REQUIRED_LEVEL", fontSize, __instance._scriptQuest._questLevel);
				__instance._slotTag.text = @string + "\n" + formattedString;
				QuestSubType questSubType = __instance._scriptQuest._questSubType;
				QuestSubType val = questSubType;
				switch (val - 1)
				{
				case 0:
					__instance._slotTag.text = "<color=cyan>" + @string + "</color>\n<color=cyan>" + formattedString + "</color>";
					break;
				case 1:
					__instance._slotTag.text = "<color=#f7e98e>" + @string + "</color>\n<color=#f7e98e>" + Localyssation.GetString("QUEST_TYPE_CLASS", fontSize) + "</color>";
					break;
				case 2:
					__instance._slotTag.text = "<color=#f7e98e>" + @string + "</color>\n<color=#f7e98e>" + Localyssation.GetString("QUEST_TYPE_MASTERY", fontSize) + "</color>";
					break;
				}
			}
			else
			{
				__instance._slotTag.text = Localyssation.GetString("QUEST_MENU_CELL_SLOT_EMPTY", __instance._slotTag.fontSize, __instance._slotTag.text);
			}
		}

		[HarmonyPatch(typeof(QuestSelectionManager), "Handle_Expbar")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> QuestSelectionManager_Handle_Expbar_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			return SimpleStringReplaceTranspiler(instructions, new Dictionary<string, string> { { "MAX", "EXP_COUNTER_MAX" } });
		}

		[HarmonyPatch(typeof(QuestSelectionManager), "Handle_QuestSelectionConditions")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> QuestSelectionManager_Handle_QuestSelectionConditions_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			return SimpleStringReplaceTranspiler(instructions, new Dictionary<string, string>
			{
				{ "Quest Incomplete", "QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_INCOMPLETE" },
				{ "Complete Quest", "QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_TURN_IN" },
				{ "Select a Quest", "QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_UNSELECTED" }
			});
		}

		[HarmonyPatch(typeof(QuestSelectionManager), "Select_QuestEntry")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> QuestSelectionManager_Select_QuestEntry_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			return SimpleStringReplaceTranspiler(instructions, new Dictionary<string, string>
			{
				{ "Accept Quest", "QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_ACCEPT" },
				{ "Quest Locked", "QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_LOCKED" }
			});
		}

		internal static string GetCreepKillRequirementText(ScriptableCreep creep, int requirement, int fontSize = -1)
		{
			string text = "FORMAT_QUEST_PROGRESS_CREEPS_KILLED";
			string text2 = KeyUtil.GetForAsset(creep) + "_NAME";
			if (requirement > 1)
			{
				if (Localyssation.currentLanguage.strings.ContainsKey($"{text2}_VARIANT_{requirement}"))
				{
					text2 = $"{text2}_VARIANT_{requirement}";
				}
				else if (Localyssation.currentLanguage.strings.ContainsKey(text2 + "_VARIANT_MANY"))
				{
					text2 += "_VARIANT_MANY";
				}
				if (Localyssation.currentLanguage.strings.ContainsKey($"{text}_VARIANT_{requirement}"))
				{
					text = $"{text}_VARIANT_{requirement}";
				}
				else if (Localyssation.currentLanguage.strings.ContainsKey(text + "_VARIANT_MANY"))
				{
					text += "_VARIANT_MANY";
				}
			}
			if (Localyssation.currentLanguage.strings.ContainsKey(text2 + "_VARIANT_QUEST_KILLED"))
			{
				text2 += "_VARIANT_QUEST_KILLED";
			}
			return Localyssation.GetFormattedString(text, fontSize, Localyssation.GetString(text2, fontSize));
		}

		[HarmonyPatch(typeof(QuestTrackElement), "Handle_QuestTrackInfo")]
		[HarmonyPostfix]
		public static void QuestTrackElement_Handle_QuestTrackInfo(QuestTrackElement __instance)
		{
			string forAsset = KeyUtil.GetForAsset(__instance._scriptQuest);
			if (!string.IsNullOrEmpty(__instance._scriptQuest._questName))
			{
				__instance._trackQuestNameText.text = __instance._trackQuestNameText.text.Replace(__instance._scriptQuest._questName, Localyssation.GetString(forAsset + "_NAME", __instance._trackQuestNameText.fontSize, __instance._scriptQuest._questName));
			}
			PlayerQuesting component = ((Component)Player._mainPlayer).GetComponent<PlayerQuesting>();
			string[] trackElementText;
			int c;
			int fontSize;
			if (component._questProgressData.Count > 0)
			{
				QuestProgressStruct val = component._questProgressData[__instance._questIndex];
				trackElementText = __instance._trackElementText.text.Split(new string[1] { "\n" }, StringSplitOptions.None);
				c = 0;
				fontSize = __instance._trackElementText.fontSize;
				for (int i = 0; i < __instance._scriptQuest._questObjective._questItemRequirements.Length; i++)
				{
					QuestItemRequirement val2 = __instance._scriptQuest._questObjective._questItemRequirements[i];
					string key = KeyUtil.GetForAsset(val2._questItem) + "_NAME";
					ReplaceTrackElementText(Localyssation.GetString(key, fontSize, val2._questItem._itemName), val._itemProgressValues[i], val2._itemsNeeded);
				}
				for (int j = 0; j < __instance._scriptQuest._questObjective._questCreepRequirements.Length; j++)
				{
					QuestCreepRequirement val3 = __instance._scriptQuest._questObjective._questCreepRequirements[j];
					ReplaceTrackElementText(GetCreepKillRequirementText(val3._questCreep, val3._creepsKilled, fontSize), val._creepKillProgressValues[j], val3._creepsKilled);
				}
				for (int k = 0; k < __instance._scriptQuest._questObjective._questTriggerRequirements.Length; k++)
				{
					QuestTriggerRequirement val4 = __instance._scriptQuest._questObjective._questTriggerRequirements[k];
					string forAsset2 = KeyUtil.GetForAsset(val4);
					ReplaceTrackElementText(Localyssation.GetString(forAsset2 + "_PREFIX", fontSize, val4._pref