using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Localyssation.Exporter; using Localyssation.LangAdjutable; using Localyssation.LanguageModule; using Localyssation.Patches; using Localyssation.Patches.ReplaceFont; using Localyssation.Patches.ReplaceText; using Localyssation.Util; using Microsoft.CodeAnalysis; using Mirror; using MonoMod.Utils; using Nessie.ATLYSS.EasySettings; using Nessie.ATLYSS.EasySettings.UIElements; using Newtonsoft.Json; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using YamlDotNet.Core; using YamlDotNet.Serialization; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 Localyssation { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("org.sallys-workshop.localyssation", "Localyssation", "2.4.4")] public class Localyssation : BaseUnityPlugin { private delegate string TextEditTagFunc(string str, string arg, int fontSize); public static Localyssation instance; internal static Assembly assembly; internal static string dllPath; internal static ManualLogSource logger; internal static bool settingsTabReady = false; internal static bool languagesLoaded = false; internal static bool settingsTabSetup = false; public const string GET_STRING_DEFAULT_VALUE_ARG_UNSPECIFIED = "SAME_AS_KEY"; private static readonly Dictionary textEditTags = new Dictionary { { "firstupper", 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.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 num = float.Parse(arg, CultureInfo.InvariantCulture); str = $"{str}"; } catch { } } else { str = "" + str + ""; } return str; } }, { "scalefallback", delegate(string str, string arg, int fontSize) { if (fontSize > 0) { try { float num = float.Parse(arg, CultureInfo.InvariantCulture); str = $"{str}"; } catch { } } return str; } } }; private static readonly List defaultAppliedTextEditTags = new List { "firstupper", "firstlower", "scale" }; public static bool ShowTranslation { get; private set; } = true; public event Action OnLanguageChanged; internal void CallOnLanguageChanged(Language newLanguage) { this.OnLanguageChanged?.Invoke(newLanguage); } private void Awake() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown instance = this; logger = ((BaseUnityPlugin)this).Logger; assembly = Assembly.GetExecutingAssembly(); dllPath = new Uri(assembly.CodeBase).LocalPath; LanguageManager.Init(); FontManager.LoadFontBundlesFromFileSystem(); LocalyssationConfig.Init(((BaseUnityPlugin)this).Config); if (LocalyssationConfig.TranslatorMode && LocalyssationConfig.LogVanillaFonts) { FontHelper.DetectVanillaFonts(); } SettingsGUI.Init(); Harmony val = new Harmony("org.sallys-workshop.localyssation"); val.PatchAll(); val.PatchAll(typeof(GameLoadPatches)); FRUtil.PatchAll(val); RTUtil.PatchAll(val); SettingsGUI.Init(); OnSceneLoaded.Init(); LangAdjustables.Init(); } private void Update() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (LocalyssationConfig.TranslatorMode) { if (Input.GetKeyDown(LocalyssationConfig.ReloadLanguageKeybind)) { LanguageManager.CurrentLanguage.LoadFromFileSystem(forceOverwrite: true); CallOnLanguageChanged(LanguageManager.CurrentLanguage); RTReplacer.RefreshQuestInfo(); RTReplacer.RefreshQuestTrack(); } if (Input.GetKeyDown(LocalyssationConfig.ReloadFontBundlesKeybind)) { FontManager.LoadFontBundlesFromFileSystem(); CallOnLanguageChanged(LanguageManager.CurrentLanguage); } if (Input.GetKeyDown(LocalyssationConfig.SwitchTranslationKeybind)) { ShowTranslation = !ShowTranslation; CallOnLanguageChanged(LanguageManager.CurrentLanguage); } if (Input.GetKeyDown(LocalyssationConfig.ShowTranslationKey)) { LocalyssationConfig.ShowTranslationKeyEnabled = !LocalyssationConfig.ShowTranslationKeyEnabled; CallOnLanguageChanged(LanguageManager.CurrentLanguage); RTReplacer.RefreshQuestInfo(); RTReplacer.RefreshQuestTrack(); } } } public static string GetStringRaw(string key, string defaultValue = "SAME_AS_KEY") { if (ShowTranslation && LanguageManager.CurrentLanguage.TryGetString(key, out var value)) { return value; } if (LanguageManager.DefaultLanguage.TryGetString(key, out value)) { return value; } return (defaultValue == "SAME_AS_KEY") ? key : defaultValue; } public static string ApplyTextEditTags(string str, int fontSize = -1, List appliedTextEditTags = null) { if (appliedTextEditTags == null) { appliedTextEditTags = defaultAppliedTextEditTags; } string text = str; foreach (KeyValuePair textEditTag in textEditTags) { if (!appliedTextEditTags.Contains(textEditTag.Key)) { continue; } while (true) { if (text == null) { return ""; } 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 = ""; 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('='); 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, string defaultValue = "SAME_AS_KEY", int fontSize = -1) { if (LocalyssationConfig.ShowTranslationKeyEnabled) { return key; } return ApplyTextEditTags(GetStringRaw(key, defaultValue), fontSize); } public static string GetString(TranslationKey translationKey, string defaultValue = "SAME_AS_KEY", int fontSize = -1) { if (LocalyssationConfig.ShowTranslationKeyEnabled) { return translationKey.ToString(); } return ApplyTextEditTags(GetStringRaw(translationKey.ToString(), defaultValue), fontSize); } public static string Format(TranslationKey formatKey, params object[] args) { return string.Format(GetString(formatKey), args.Select((object x) => (x is TranslationKey translationKey) ? translationKey.Localize() : x).ToArray()); } public static string GetDefaultString(string key) { if (!LanguageManager.DefaultLanguage.TryGetString(key, out var value)) { return ""; } return value; } public static void LogDebug(object data) { } } public static class MyPluginInfo { public const string PLUGIN_GUID = "org.sallys-workshop.localyssation"; public const string PLUGIN_NAME = "Localyssation"; public const string PLUGIN_VERSION = "2.4.4"; public const string ATLYSS_VERSION = "12026.a3"; } internal static class I18nKeys { internal static class CharacterCreation { public static readonly string HEADER = Create("CHARACTER_CREATION_HEADER", "Character Creation"); public static readonly string HEADER_RACE_NAME = Create("CHARACTER_CREATION_HEADER_RACE_NAME", "Race Select"); public static readonly string RACE_DESCRIPTOR_HEADER_INITIAL_SKILL = Create("CHARACTER_CREATION_RACE_DESCRIPTOR_HEADER_INITIAL_SKILL", "Initial Skill"); public static readonly string BUTTON_SET_TO_DEFAULTS = Create("CHARACTER_CREATION_BUTTON_SET_TO_DEFAULTS", "Defaults"); public static readonly string CHARACTER_NAME_PLACEHOLDER_TEXT = Create("CHARACTER_CREATION_CHARACTER_NAME_PLACEHOLDER_TEXT", "Enter Name..."); public static readonly string BUTTON_CREATE_CHARACTER = Create("CHARACTER_CREATION_BUTTON_CREATE_CHARACTER", "Create Character"); public static readonly string BUTTON_RETURN = Create("CHARACTER_CREATION_BUTTON_RETURN", "Return"); public static readonly string CUSTOMIZER_HEADER_COLOR = Create("CHARACTER_CREATION_CUSTOMIZER_HEADER_COLOR", "Color"); public static readonly string CUSTOMIZER_COLOR_BODY_HEADER = Create("CHARACTER_CREATION_CUSTOMIZER_COLOR_BODY_HEADER", "Body"); public static readonly string CUSTOMIZER_COLOR_BODY_TEXTURE = Create("CHARACTER_CREATION_CUSTOMIZER_COLOR_BODY_TEXTURE", "Texture"); public static readonly string CUSTOMIZER_COLOR_HAIR_HEADER = Create("CHARACTER_CREATION_CUSTOMIZER_COLOR_HAIR_HEADER", "Hair"); public static readonly string CUSTOMIZER_COLOR_HAIR_LOCK_COLOR = Create("CHARACTER_CREATION_CUSTOMIZER_COLOR_HAIR_LOCK_COLOR", "Lock Color"); public static readonly string CUSTOMIZER_COLOR_HUE = Create("CHARACTER_CREATION_CUSTOMIZER_COLOR_HUE", "Hue"); public static readonly string CUSTOMIZER_COLOR_BRIGHTNESS = Create("CHARACTER_CREATION_CUSTOMIZER_COLOR_BRIGHTNESS", "Brightness"); public static readonly string CUSTOMIZER_COLOR_CONTRAST = Create("CHARACTER_CREATION_CUSTOMIZER_COLOR_CONTRAST", "Contrast"); public static readonly string CUSTOMIZER_COLOR_SATURATION = Create("CHARACTER_CREATION_CUSTOMIZER_COLOR_SATURATION", "Saturation"); public static readonly string CUSTOMIZER_HEADER_HEAD = Create("CHARACTER_CREATION_CUSTOMIZER_HEADER_HEAD", "Head"); public static readonly string CUSTOMIZER_HEAD_HEAD_WIDTH = Create("CHARACTER_CREATION_CUSTOMIZER_HEAD_HEAD_WIDTH", "Head Width"); public static readonly string CUSTOMIZER_HEAD_HEAD_MOD = Create("CHARACTER_CREATION_CUSTOMIZER_HEAD_HEAD_MOD", "Modify"); public static readonly string CUSTOMIZER_HEAD_VOICE_PITCH = Create("CHARACTER_CREATION_CUSTOMIZER_HEAD_VOICE_PITCH", "Voice Pitch"); public static readonly string CUSTOMIZER_HEAD_HAIR_STYLE = Create("CHARACTER_CREATION_CUSTOMIZER_HEAD_HAIR_STYLE", "Hair"); public static readonly string CUSTOMIZER_HEAD_EARS = Create("CHARACTER_CREATION_CUSTOMIZER_HEAD_EARS", "Ears"); public static readonly string CUSTOMIZER_HEAD_EYES = Create("CHARACTER_CREATION_CUSTOMIZER_HEAD_EYES", "Eyes"); public static readonly string CUSTOMIZER_HEAD_MOUTH = Create("CHARACTER_CREATION_CUSTOMIZER_HEAD_MOUTH", "Mouth"); public static readonly string CUSTOMIZER_HEADER_BODY = Create("CHARACTER_CREATION_CUSTOMIZER_HEADER_BODY", "Body"); public static readonly string CUSTOMIZER_BODY_HEIGHT = Create("CHARACTER_CREATION_CUSTOMIZER_BODY_HEIGHT", "Height"); public static readonly string CUSTOMIZER_BODY_WIDTH = Create("CHARACTER_CREATION_CUSTOMIZER_BODY_WIDTH", "Width"); public static readonly string CUSTOMIZER_BODY_CHEST = Create("CHARACTER_CREATION_CUSTOMIZER_BODY_CHEST", "Chest"); public static readonly string CUSTOMIZER_BODY_ARMS = Create("CHARACTER_CREATION_CUSTOMIZER_BODY_ARMS", "Arms"); public static readonly string CUSTOMIZER_BODY_BELLY = Create("CHARACTER_CREATION_CUSTOMIZER_BODY_BELLY", "Belly"); public static readonly string CUSTOMIZER_BODY_BOTTOM = Create("CHARACTER_CREATION_CUSTOMIZER_BODY_BOTTOM", "Bottom"); public static readonly string CUSTOMIZER_BODY_TAIL = Create("CHARACTER_CREATION_CUSTOMIZER_BODY_TAIL", "Tail"); public static readonly string CUSTOMIZER_BODY_TOGGLE_LEFT_HANDED = Create("CHARACTER_CREATION_CUSTOMIZER_BODY_TOGGLE_LEFT_HANDED", "Mirror Body"); public static readonly string CUSTOMIZER_HEADER_TRAIT = Create("CHARACTER_CREATION_CUSTOMIZER_HEADER_TRAIT", "Trait"); public static readonly string CUSTOMIZER_TRAIT_EQUIPMENT = Create("CHARACTER_CREATION_CUSTOMIZER_TRAIT_EQUIPMENT", "Equipment"); public static readonly string CUSTOMIZER_TRAIT_WEAPON_LOADOUT = Create("CHARACTER_CREATION_CUSTOMIZER_TRAIT_WEAPON_LOADOUT", "Weapon"); public static readonly string CUSTOMIZER_TRAIT_GEAR_DYE = Create("CHARACTER_CREATION_CUSTOMIZER_TRAIT_GEAR_DYE", "Dye"); public static readonly string CUSTOMIZER_TRAIT_ATTRIBUTES = Create("CHARACTER_CREATION_CUSTOMIZER_TRAIT_ATTRIBUTES", "Attributes"); public static readonly string CUSTOMIZER_TRAIT_UNSPENT_POINTS = Create("CHARACTER_CREATION_CUSTOMIZER_TRAIT_UNSPENT_POINTS", "Unspent Points"); public static readonly string CUSTOMIZER_TRAIT_RESET_ATTRIBUTE_POINTS = Create("CHARACTER_CREATION_CUSTOMIZER_TRAIT_RESET_ATTRIBUTE_POINTS", "Reset Points"); internal static void Init() { } } internal static class CharacterSelect { public static readonly string HEADER = Create("CHARACTER_SELECT_HEADER", "Character Select"); public static readonly string HEADER_GAME_MODE_SINGLEPLAYER = Create("CHARACTER_SELECT_HEADER_GAME_MODE_SINGLEPLAYER", "Singleplayer"); public static readonly string HEADER_GAME_MODE_HOST_MULTIPLAYER_PUBLIC = Create("CHARACTER_SELECT_HEADER_GAME_MODE_HOST_MULTIPLAYER_PUBLIC", "Host Game (Public)"); public static readonly string HEADER_GAME_MODE_HOST_MULTIPLAYER_FRIENDS = Create("CHARACTER_SELECT_HEADER_GAME_MODE_HOST_MULTIPLAYER_FRIENDS", "Host Game (Friends)"); public static readonly string HEADER_GAME_MODE_HOST_MULTIPLAYER_PRIVATE = Create("CHARACTER_SELECT_HEADER_GAME_MODE_HOST_MULTIPLAYER_PRIVATE", "Host Game (Private)"); public static readonly string HEADER_GAME_MODE_JOIN_MULTIPLAYER = Create("CHARACTER_SELECT_HEADER_GAME_MODE_JOIN_MULTIPLAYER", "Join Game"); public static readonly string HEADER_GAME_MODE_LOBBY_QUERY = Create("CHARACTER_SELECT_HEADER_GAME_MODE_LOBBY_QUERY", "Lobby Connect"); public static readonly string BUTTON_CREATE_CHARACTER = Create("CHARACTER_SELECT_BUTTON_CREATE_CHARACTER", "Create Character"); public static readonly string BUTTON_DELETE_CHARACTER = Create("CHARACTER_SELECT_BUTTON_DELETE_CHARACTER", "Delete Character"); public static readonly string BUTTON_SELECT_CHARACTER = Create("CHARACTER_SELECT_BUTTON_SELECT_CHARACTER", "Select Character"); public static readonly string BUTTON_RETURN = Create("CHARACTER_SELECT_BUTTON_RETURN", "Return"); public static readonly string DATA_ENTRY_EMPTY_SLOT = Create("CHARACTER_SELECT_DATA_ENTRY_EMPTY_SLOT", "Empty Slot"); public static readonly string FILE_NUMBER_FORMAT = Create("CHARACTER_SELECT_FILE_NUMBER_FORMAT", "File {0}"); public static readonly string FORMAT_DATA_ENTRY_INFO = Create("FORMAT_CHARACTER_SELECT_DATA_ENTRY_INFO", "Lv-{0} {1} {2}"); public static readonly string CHARACTER_DELETE_PROMPT_TEXT = Create("CHARACTER_SELECT_CHARACTER_DELETE_PROMPT_TEXT", "Type in the character's name to confirm."); public static readonly string CHARACTER_DELETE_PROMPT_PLACEHOLDER_TEXT = Create("CHARACTER_SELECT_CHARACTER_DELETE_PROMPT_PLACEHOLDER_TEXT", "Enter Nickname..."); public static readonly string CHARACTER_DELETE_BUTTON_CONFIRM = Create("CHARACTER_SELECT_CHARACTER_DELETE_BUTTON_CONFIRM", "Delete Character"); public static readonly string CHARACTER_DELETE_BUTTON_RETURN = Create("CHARACTER_SELECT_CHARACTER_DELETE_BUTTON_RETURN", "Return"); internal static void Init() { } } public static class ChatBehaviour { public static readonly TranslationKey DISABLE_GLOBAL_CHANNEL_MESSAGE = Create("DISABLE_GLOBAL_CHANNEL_MESSAGE", "Disabled #Global Chat Channel."); public static readonly TranslationKey ENABLE_GLOBAL_CHANNEL_MESSAGE = Create("ENABLE_GLOBAL_CHANNEL_MESSAGE", "Enabled #Global Chat Channel."); public static readonly TranslationKey DISABLE_PARTY_CHANNEL_MESSAGE = Create("DISABLE_PARTY_CHANNEL_MESSAGE", "Disabled #Party Chat Channel."); public static readonly TranslationKey ENABLE_PARTY_CHANNEL_MESSAGE = Create("ENABLE_PARTY_CHANNEL_MESSAGE", "Enabled #Party Chat Channel."); public static readonly TranslationKey DISABLE_ROOM_CHANNEL_MESSAGE = Create("DISABLE_ROOM_CHANNEL_MESSAGE", "Disabled #Room Chat Channel."); public static readonly TranslationKey ENABLE_ROOM_CHANNEL_MESSAGE = Create("ENABLE_ROOM_CHANNEL_MESSAGE", "Enabled #Room Chat Channel."); public static readonly TranslationKey CHANNEL_SWTICH_MESSAGE_FORMAT = Create("CHANNEL_SWTICH_MESSAGE_FORMAT", "{0} Entered #{1}."); public static readonly TranslationKey GLOBAL_CHANNEL_DISABLED = Create("GLOBAL_CHANNEL_DISABLED", "#Global chat is disabled."); public static readonly TranslationKey PARTY_CHANNEL_DISABLED = Create("PARTY_CHANNEL_DISABLED", "#Party chat is disabled."); public static readonly TranslationKey ROOM_CHANNEL_DISABLED = Create("ROOM_CHANNEL_DISABLED", "#Room chat is disabled."); public static readonly TranslationKey ENTER_A_ROOM_HINT = Create("ENTER_A_ROOM_HINT", "Enter a room to send messages to a room channel."); private static TranslationKey Create(string key, string english) { return I18nKeys.Create("CHAT_BEHAVIOUR_" + key, english); } public static void Init() { } } internal static class ChatMessage { public static readonly TranslationKey RECIEVE_DUNGEON_KEY = Create("RECIEVE_DUNGEON_KEY", "You received a dungeon key."); public static readonly TranslationKey DUNGEON_KEY_DISSIPATES = Create("DUNGEON_KEY_DISSIPATES", "A dungeon key dissipates..."); public static readonly TranslationKey UNMUTE_PLAYER_FORMAT = Create("UNMUTE_PLAYER_FORMAT", "Unmuted {0}."); public static readonly TranslationKey MUTE_PLAYER_FORMAT = Create("MUTE_PLAYER_FORMAT", "Muted {0}."); internal static void Init() { } private static TranslationKey Create(string key, string defaultValue) { return I18nKeys.Create("CHAT_MESSAGE_" + key, defaultValue); } } public static class DeathPrompt { public static readonly TranslationKey USER_TIER_PROMPT_FORMAT = Create("USER_TIER_PROMPT_FORMAT", "Use Tear (x{0})"); public static readonly TranslationKey DEATH_PROMPT_HEADER = Create("DEATH_PROMPT_HEADER", "You died."); public static readonly TranslationKey DEATH_PROMPT_RELEASE_SOUL_BUTTON = Create("DEATH_PROMPT_RELEASE_SOUL_BUTTON", "Release Soul"); internal static void Init() { } } internal static class Enchanter { public static readonly TranslationKey HEADER = create("HEADER", "- Item Enchant -"); public static readonly TranslationKey BUTTON_CLEAR_SELECTION = create("BUTTON_CLEAR_SELECTION", "Clear Selection"); public static readonly string[] BUTTON_TRANSMUTE = ((IEnumerable)(object)new DamageType[3] { (DamageType)1, default(DamageType), (DamageType)2 }).SelectMany((DamageType type) => new bool[2] { true, false }.Select((bool free) => generateTransmuteButton(type, free))).ToArray(); public static readonly TranslationKey BUTTON_ENCHANT_REROLL = create("BUTTON_ENCHANT_REROLL", "Re-roll Enchant"); public static readonly TranslationKey BUTTON_ENCHANT_ENCHANT = create("BUTTON_ENCHANT_ENCHANT", "Enchant Item"); public static readonly TranslationKey BUTTON_ENCHANT_UNABLE = create("BUTTON_ENCHANT_UNABLE", "Cannot enchant"); public static readonly TranslationKey STATUS_NO_ENCHANT = create("STATUS_NO_ENCHANT", "No enchantment applied on this item"); public static readonly TranslationKey STATUS_UNABLE_TO_ENCHANT = create("STATUS_UNABLE_TO_ENCHANT", "Item cannot be enchanted"); public static readonly TranslationKey BUTTON_ENCHANT_INSERT_ITEM = create("BUTTON_ENCHANT_INSERT_ITEM", "Insert item to enchant"); public static readonly TranslationKey STATUS_CURRENT_ENCHANTMENT = create("STATUS_CURRENT_ENCHANTMENT", "Current enchantment: "); public static readonly TranslationKey GET_NEW_ENCHANTMENT_FORMAT = create("GET_NEW_ENCHANTMENT_FORMAT", "You got the {0} enchantment!"); public static readonly TranslationKey TRANSMUTE_TO_STRENGTH_FORMAT = create("TRANSMUTE_TO_STRENGTH_FORMAT", "Your {0} now scales off Strength!"); public static readonly TranslationKey TRANSMUTE_TO_DEXTERITY_FORMAT = create("TRANSMUTE_TO_DEXTERITY_FORMAT", "Your {0} now scales off Dexterity!"); public static readonly TranslationKey TRANSMUTE_TO_MIND_FORMAT = create("TRANSMUTE_TO_MIND_FORMAT", "Your {0} now scales off Mind!"); public static readonly TranslationKey NOT_ENOUGH_TRANSMUTE_STONES_STRENGTH = create("NOT_ENOUGH_TRANSMUTE_STONES_STRENGTH", "Not enough Might Stones"); public static readonly TranslationKey NOT_ENOUGH_TRANSMUTE_STONES_DEXTERITY = create("NOT_ENOUGH_TRANSMUTE_STONES_DEXTERITY", "Not enough Agility Stones"); public static readonly TranslationKey NOT_ENOUGH_TRANSMUTE_STONES_MIND = create("NOT_ENOUGH_TRANSMUTE_STONES_MIND", "Not enough Flux Stones"); public static readonly TranslationKey CANNOT_TRANSMUTE_WEAPON = create("CANNOT_TRANSMUTE_WEAPON", "Cannot Transmute Weapon"); internal static void Init() { } private static TranslationKey create(string key, string value = "") { return Create("ENCHANTER_GUI_" + key.ToUpper(), value); } public unsafe static string TransmuteButtonKey(DamageType type, bool free) { return "BUTTON_TRANSMUTE_" + ((object)(*(DamageType*)(&type))/*cast due to .constrained prefix*/).ToString().ToUpper() + "_" + (free ? "FREE" : "FORMAT"); } private unsafe static string generateTransmuteButton(DamageType type, bool free) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 return create(TransmuteButtonKey(type, free), ((int)type == 2 && free) ? "Apply Flux Stone (Free)" : ("Transmute " + ((object)(*(DamageType*)(&type))/*cast due to .constrained prefix*/).ToString() + " " + (free ? "(Free)" : "(x{0})"))); } } internal static class Enums { public static readonly IDictionary ITEM_RARITY = CreateEnumKeys((Func)null, (Func)null, (IDictionary)null); public static readonly IDictionary DAMAGE_TYPE = CreateEnumKeys((Func)null, (Func)null, (IDictionary)null); public static readonly IDictionary SKILL_CONTROL_TYPE = CreateEnumKeys((Func)null, (Func)null, (IDictionary)null); public static readonly IDictionary COMBAT_COLLIDER_TYPE = CreateEnumKeys((Func)null, (Func)null, (IDictionary)null); private static readonly IDictionary __ITEM_TYPE_VALUES = new Dictionary { { (ItemType)0, "Equipment" }, { (ItemType)1, "Consumables" }, { (ItemType)2, "Trade Items" } }; public static readonly IDictionary ITEM_TYPE = __ITEM_TYPE_VALUES.ToDictionary((KeyValuePair kv) => Create(KeyUtil.GetForAsset(kv.Key).ToString(), kv.Value), (KeyValuePair kv) => kv.Value); public static readonly IDictionary ZONE_TYPE = CreateEnumKeys((Func)null, (Func)null, (IDictionary)null); public unsafe static readonly IDictionary SKILL_TOOLTIP_REQUIREMENT = CreateEnumKeys((Func)null, (Func)((SkillToolTipRequirement skillToolTipRequirement) => ((object)(*(SkillToolTipRequirement*)(&skillToolTipRequirement))/*cast due to .constrained prefix*/).ToString().ToLower()), (IDictionary)null); public static readonly IDictionary QUEST_SUB_TYPE = CreateEnumKeys((Func)null, (Func)((QuestSubType questSubType) => ""), (IDictionary)new Dictionary { { (QuestSubType)2, "Class Tome" }, { (QuestSubType)3, "Skill Scroll" } }); private static readonly IDictionary __SHOP_TABS = new Dictionary { { (ShopTab)0, "Equipment" }, { (ShopTab)1, "Consumables" }, { (ShopTab)2, "Trade Items" }, { (ShopTab)3, "Sold Items" } }; public static readonly IDictionary SHOP_TAB = __SHOP_TABS.ToDictionary((KeyValuePair kv) => Create(KeyUtil.GetForAsset(kv.Key).ToString(), kv.Value), (KeyValuePair kv) => kv.Value); internal static void Init() { } private static IDictionary CreateEnumKeys(Func keyOverride = null, Func valueOverride = null, IDictionary valueOverrideDict = null) where TEnum : Enum { if (keyOverride == null) { keyOverride = defaultGetString; } if (valueOverride == null) { valueOverride = (TEnum item) => item.ToString(); } Func _valueOverride = valueOverride; if (valueOverrideDict != null) { _valueOverride = (TEnum item) => valueOverrideDict.TryGetValue(item, out var value) ? value : valueOverride(item); } return Enum.GetValues(typeof(TEnum)).OfType().ToDictionary((TEnum item) => Create(keyOverride(item).ToString(), _valueOverride(item)), _valueOverride); static TranslationKey defaultGetString(TEnum item) { MethodInfo methodInfo = (from m in typeof(KeyUtil).GetMethods() where m.Name == "GetForAsset" select m).FirstOrDefault(delegate(MethodInfo m) { ParameterInfo[] parameters = m.GetParameters(); return parameters.Length == 1 && parameters[0].ParameterType == typeof(TEnum); }); return (TranslationKey)methodInfo.Invoke(null, new object[1] { item }); } } } internal static class Equipment { public static readonly string TOOLTIP_GAMBLE_ITEM_NAME = Create("EQUIP_TOOLTIP_GAMBLE_ITEM_NAME", "Mystery Gear"); public static readonly string TOOLTIP_GAMBLE_ITEM_RARITY = Create("EQUIP_TOOLTIP_GAMBLE_ITEM_RARITY", "[Unknown]"); public static readonly string TOOLTIP_GAMBLE_ITEM_TYPE = Create("EQUIP_TOOLTIP_GAMBLE_ITEM_TYPE", "???"); public static readonly string TOOLTIP_GAMBLE_ITEM_DESCRIPTION = Create("EQUIP_TOOLTIP_GAMBLE_ITEM_DESCRIPTION", "You can't really see what this is until you buy it."); public static readonly string FORMAT_LEVEL_REQUIREMENT = Create("FORMAT_EQUIP_LEVEL_REQUIREMENT", "Lv-{0}"); public static readonly string FORMAT_CLASS_REQUIREMENT = Create("FORMAT_EQUIP_CLASS_REQUIREMENT", "Class: {0}"); public static readonly string FORMAT_WEAPON_CONDITION = Create("FORMAT_EQUIP_WEAPON_CONDITION", "\n- {0}% chance to apply {1}."); public static readonly string TOOLTIP_TYPE_HELM = Create("EQUIP_TOOLTIP_TYPE_HELM", "Helm (Armor)"); public static readonly string TOOLTIP_TYPE_CHESTPIECE = Create("EQUIP_TOOLTIP_TYPE_CHESTPIECE", "Chestpiece (Armor)"); public static readonly string TOOLTIP_TYPE_LEGGINGS = Create("EQUIP_TOOLTIP_TYPE_LEGGINGS", "Leggings (Armor)"); public static readonly string TOOLTIP_TYPE_CAPE = Create("EQUIP_TOOLTIP_TYPE_CAPE", "Cape (Armor)"); public static readonly string TOOLTIP_TYPE_RING = Create("EQUIP_TOOLTIP_TYPE_RING", "Ring (Armor)"); public static readonly string TOOLTIP_TYPE_TRINKET = Create("EQUIP_TOOLTIP_TYPE_TRINKET", "Trinket (Armor)"); public static readonly string FORMAT_TOOLTIP_TYPE_WEAPON = Create("FORMAT_EQUIP_TOOLTIP_TYPE_WEAPON", "{0} (Weapon)"); public static readonly string TOOLTIP_TYPE_SHIELD = Create("EQUIP_TOOLTIP_TYPE_SHIELD", "Shield (Off Hand)"); public static readonly string STATS_DAMAGE = Create("EQUIP_TOOLTIP_STATS_DAMAGE", "Damage"); public static readonly string STATS_BASE_DAMAGE = Create("EQUIP_TOOLTIP_STATS_BASE_DAMAGE", "Base Damage"); public static readonly string VANITY_DISSIPATE_HELMET = Create("VANITY_DISSIPATE_HELMET", "The Vanity in the Helmet Slot dissipates."); public static readonly string VANITY_DISSIPATE_CHEST = Create("VANITY_DISSIPATE_CHEST", "The Vanity in the Chestpiece Slot dissipates."); public static readonly string VANITY_DISSIPATE_LEGGINGS = Create("VANITY_DISSIPATE_LEGGINGS", "The Vanity in the Leggings Slot dissipates."); public static readonly string VANITY_DISSIPATE_CAPE = Create("VANITY_DISSIPATE_CAPE", "The Vanity in the Cape Slot dissipates."); public static readonly string VANITY_DISSIPATE_SHIELD = Create("VANITY_DISSIPATE_SHIELD", "The Vanity in the Shield Slot dissipates."); public static readonly string FORMAT_STATS_BLOCK_THRESHOLD = Create("FORMAT_EQUIP_STATS_BLOCK_THRESHOLD", "Block threshold: {0} damage"); public static readonly string FORMAT_WEAPON_DAMAGE_TYPE = Create("FORMAT_EQUIP_STATS_WEAPON_DAMAGE_TYPE", "{0} Weapon"); public static readonly string FORMAT_WEAPON_TRANSMUTE_TYPE = Create("FORMAT_EQUIP_STATS_WEAPON_TRASMUTE_TYPE", "Damage Transmute: {0}"); public static readonly string COMPARE = Create("EQUIP_TOOLTIP_COMPARE", "Compare Gear"); public static readonly string STAT_DISPLAY_DEFENSE = Create(statDisplayKey("defense"), "Defense"); public static readonly string STAT_DISPLAY_MAGIC_DEFENSE = Create(statDisplayKey("magicDefense"), "Mgk. Defense"); public static readonly string STAT_DISPLAY_MAX_HEALTH = Create(statDisplayKey("maxHealth"), "Max Health"); public static readonly string STAT_DISPLAY_MAX_MANA = Create(statDisplayKey("maxMana"), "Max Mana"); public static readonly string STAT_DISPLAY_MAX_STAMINA = Create(statDisplayKey("maxStamina"), "Max Stamina"); public static readonly string STAT_DISPLAY_ATTACK_POWER = Create(statDisplayKey("attackPower"), "Attack Power"); public static readonly string STAT_DISPLAY_MAGIC_POWER = Create(statDisplayKey("magicPower"), "Mgk. Power"); public static readonly string STAT_DISPLAY_DEX_POWER = Create(statDisplayKey("dexPower"), "Dex Power"); public static readonly string STAT_DISPLAY_CRITICAL = Create(statDisplayKey("critical"), "Phys. Critical"); public static readonly string STAT_DISPLAY_MAGIC_CRITICAL = Create(statDisplayKey("magicCritical"), "Mgk. Critical"); public static readonly string STAT_DISPLAY_EVASION = Create(statDisplayKey("evasion"), "Evasion"); public static readonly string STAT_DISPLAY_RESIST_FIRE = Create(statDisplayKey("resistFire"), "Fire Resist"); public static readonly string STAT_DISPLAY_RESIST_WATER = Create(statDisplayKey("resistWater"), "Water Resist"); public static readonly string STAT_DISPLAY_RESIST_NATURE = Create(statDisplayKey("resistNature"), "Nature Resist"); public static readonly string STAT_DISPLAY_RESIST_EARTH = Create(statDisplayKey("resistEarth"), "Earth Resist"); public static readonly string STAT_DISPLAY_RESIST_HOLY = Create(statDisplayKey("resistHoly"), "Holy Resist"); public static readonly string STAT_DISPLAY_RESIST_SHADOW = Create(statDisplayKey("resistShadow"), "Shadow Resist"); internal static void Init() { } public static string statDisplayKey(string stat) { return "ITEM_STAT_DISPLAY_" + KeyUtil.Normalize(Regex.Replace(stat, "[A-Z]", (Match x) => $"_{x}")); } } internal static class ErrorMessages { public static readonly TranslationKey QUEST_LOG_FULL = Create("QUEST_LOG_FULL", "Quest Log Full"); public static readonly TranslationKey QUEST_ALREADY_IN_LOG = Create("ALREADY_ON_THIS_QUEST", "Already on this Quest"); public static readonly TranslationKey LEVEL_REQUIRED = Create("LEVEL_REQUIRED", "Level Required - "); public static readonly TranslationKey UNABLE_TO_UPGRADE_FORMAT = Create("UNABLE_TO_UPGRADE_FORMAT", "Unable to upgrade to {0}. Level Req: {1}"); internal static void Init() { } private static TranslationKey Create(string key, string english) { return I18nKeys.Create("ERROR_MESSAGE_" + key, english); } } internal static class Feedback { public static readonly string DROP_ITEM_FORMAT = Create("DROP_ITEM_FORMAT", "Dropped {0}. (-{1})"); public static readonly string PICKUP_ITEM_FORMAT = Create("PICKUP_ITEM_FORMAT", "Picked up {0}. (+{1})"); public static readonly string OBTAINED_ATTRIBUTE_POINTS = Create("OBTAINED_ATTRIBUTE_POINTS", "Obtained Attribute Points. (+{0})"); public static readonly string CHAT_LEVELED_UP_PEER = Create("CHAT_LEVELED_UP_PEER", "{0} leveled up to {1}."); public static readonly string CHAT_LEVELED_UP_LOCAL = Create("CHAT_LEVELED_UP_LOCAL", "You are now level {0}!"); public static readonly string CHAT_PROFESSION_LEVELED_UP_PEER = Create("CHAT_PROFESSION_LEVELED_UP_PEER", "{0} leveled {1} to {2}."); public static readonly string CHAT_PROFESSION_LEVELED_UP_LOCAL = Create("CHAT_PROFESSION_LEVELED_UP_LOCAL", "You leveled {0} to {1}!"); public static readonly string EXPERIENCE_GAINED_FORMAT = Create("EXPERIENCE_GAINED_FORMAT", "Gained {0} experience. (+{1})"); internal static void Init() { } private static string Create(string key, string defaultString) { if (!key.StartsWith("FEEDBACK_")) { key = "FEEDBACK_" + key; } I18nKeys.Create(key, defaultString); return key; } } internal static class HostConsole { public static readonly string CHARACTER_FILE_SAVED = Create("MESSAGES_CHARACTER_FILE_SAVED", "Character file saved..."); public static readonly string SETTINGS_PROFILE_SAVED = Create("MESSAGES_SETTINGS_PROFILE_SAVED", "Settings profile saved..."); internal static void Init() { } } internal static class IntroAndTags { public static readonly string INTRO_DIALOG_LINE_1 = Create("INTRO_DIALOG_LINE_1", "Your time is not over yet, little one..."); public static readonly string INTRO_DIALOG_LINE_2 = Create("INTRO_DIALOG_LINE_2", "This world is broken, in need of your help."); public static readonly string INTRO_DIALOG_LINE_3 = Create("INTRO_DIALOG_LINE_3", "I plea for your soul, and your strength..."); public static readonly string INTRO_DIALOG_LINE_4 = Create("INTRO_DIALOG_LINE_4", "For centuries, the world was blanketed in a thick, toxic fog, forcing all life to retreat deep underground..."); public static readonly string INTRO_DIALOG_LINE_5 = Create("INTRO_DIALOG_LINE_5", "After generations of darkness, the fog has finally receded, revealing a world reclaimed by nature—and overrun by ancient, hostile forces."); public static readonly string INTRO_DIALOG_LINE_6 = Create("INTRO_DIALOG_LINE_6", "Now, the surface beckons once more."); public static readonly string INTRO_DIALOG_LINE_7 = Create("INTRO_DIALOG_LINE_7", "As a Dauntless, you must venture into the wild ruins of ATLYSS, face the dangers that await, and carve out a new path for your people."); public static readonly string INTRO_DIALOG_LINE_8 = Create("INTRO_DIALOG_LINE_8", "Your journey begins now..."); public static readonly string PLAYER_NAMETAG_PREFIX_HOST = Create("PLAYER_NAMETAG_PREFIX_HOST", "[HOST] "); public static readonly string PLAYER_NAMETAG_SUFFIX_AFK = Create("PLAYER_NAMETAG_SUFFIX_AFK", " (AFK)"); public static readonly string WHO_LIST_HOST = Create("WHO_LIST_HOST", "Host"); public static readonly string GAMEPAD_LAYOUT_HEADER = Create("GAMEPAD_LAYOUT_HEADER", "Gamepad Layout"); public static readonly string GAMEPAD_LAYOUT_DPAD_UP = Create("GAMEPAD_LAYOUT_DPAD_UP", "Zoom in camera\nItem Quickslot"); public static readonly string GAMEPAD_LAYOUT_DPAD_DOWN = Create("GAMEPAD_LAYOUT_DPAD_DOWN", "Zoom out camera\nItem Quickslot"); public static readonly string GAMEPAD_LAYOUT_DPAD_LEFT = Create("GAMEPAD_LAYOUT_DPAD_LEFT", "Recall\nItem Quickslot"); public static readonly string GAMEPAD_LAYOUT_DPAD_RIGHT = Create("GAMEPAD_LAYOUT_DPAD_RIGHT", "Sit down\nItem Quickslot"); public static readonly string GAMEPAD_LAYOUT_SOUTH = Create("GAMEPAD_LAYOUT_SOUTH", "Confirm / Jump"); public static readonly string GAMEPAD_LAYOUT_EAST = Create("GAMEPAD_LAYOUT_EAST", "Cancel / Dash\nSkill Slot"); public static readonly string GAMEPAD_LAYOUT_WEST = Create("GAMEPAD_LAYOUT_WEST", "Interact\nSkill Slot"); public static readonly string GAMEPAD_LAYOUT_NORTH = Create("GAMEPAD_LAYOUT_NORTH", "Swap Loadout\nSkill Slot"); public static readonly string GAMEPAD_LAYOUT_LT = Create("GAMEPAD_LAYOUT_LT", "Block (Hold)\nUI Select -"); public static readonly string GAMEPAD_LAYOUT_RT = Create("GAMEPAD_LAYOUT_RT", "Attack (Hold)\nUI Select +"); public static readonly string GAMEPAD_LAYOUT_START = Create("GAMEPAD_LAYOUT_START", "Tab Menu"); public static readonly string GAMEPAD_LAYOUT_SELECT = Create("GAMEPAD_LAYOUT_SELECT", "Open Chat"); public static readonly string GAMEPAD_LAYOUT_SHOULDERS = Create("GAMEPAD_LAYOUT_SHOULDERS", "Skill / Item Slot Selection (Hold)\nUI Navigation"); public static readonly string GAMEPAD_LAYOUT_RIGHT_STICK = Create("GAMEPAD_LAYOUT_RIGHT_STICK", "Reposition Camera\nLock on (Press)"); public static readonly string GAMEPAD_LAYOUT_LEFT_STICK = Create("GAMEPAD_LAYOUT_LEFT_STICK", "Movement\nSheathe Weapon (Press)"); public static readonly string TOOLTIP_GENERIC_HELMET = Create("TOOLTIP_GENERIC_HELMET", "Helmet"); public static readonly string TOOLTIP_GENERIC_CHESTPIECE = Create("TOOLTIP_GENERIC_CHESTPIECE", "Chestpiece"); public static readonly string TOOLTIP_GENERIC_LEGGINGS = Create("TOOLTIP_GENERIC_LEGGINGS", "Leggings"); public static readonly string TOOLTIP_GENERIC_CAPE = Create("TOOLTIP_GENERIC_CAPE", "Cape"); public static readonly string TOOLTIP_GENERIC_RING = Create("TOOLTIP_GENERIC_RING", "Ring"); public static readonly string TOOLTIP_GENERIC_TRINKET = Create("TOOLTIP_GENERIC_TRINKET", "Trinket"); public static readonly string TOOLTIP_GENERIC_SHIELD = Create("TOOLTIP_GENERIC_SHIELD", "Shield"); public static readonly string TOOLTIP_GENERIC_WEAPON = Create("TOOLTIP_GENERIC_WEAPON", "Weapon"); public static readonly string TOOLTIP_ILLUSION_PREFIX = Create("TOOLTIP_ILLUSION_PREFIX", "Illusion: "); internal static void Init() { } } internal static class Item { public static readonly string FORMAT_ITEM_RARITY = Create("FORMAT_ITEM_RARITY", "[{0}]"); public static readonly string FORMAT_ITEM_TOOLTIP_VENDOR_VALUE_COUNTER = Create("FORMAT_ITEM_TOOLTIP_VENDOR_VALUE_COUNTER", "{0}"); public static readonly string FORMAT_ITEM_TOOLTIP_VENDOR_VALUE_COUNTER_MULTIPLE = Create("FORMAT_ITEM_TOOLTIP_VENDOR_VALUE_COUNTER_MULTIPLE", "(x{0} each) {1}"); public static readonly string TOOLTIP_GAMBLE_ITEM_NAME = Create("ITEM_TOOLTIP_GAMBLE_ITEM_NAME", "Mystery Item"); public static readonly string TOOLTIP_GAMBLE_ITEM_RARITY = Create("ITEM_TOOLTIP_GAMBLE_ITEM_RARITY", "[Unknown]"); public static readonly string TOOLTIP_GAMBLE_ITEM_DESC = Create("ITEM_TOOLTIP_GAMBLE_ITEM_DESCRIPTION", "You can't really see what this is until you buy it."); public static readonly string TOOLTIP_CONSUMABLE_DESCRIPTION_HEALTH_APPLY = Create("ITEM_TOOLTIP_CONSUMABLE_DESCRIPTION_HEALTH_APPLY", "Recovers {0} Health."); public static readonly string TOOLTIP_CONSUMABLE_DESCRIPTION_MANA_APPLY = Create("ITEM_TOOLTIP_CONSUMABLE_DESCRIPTION_MANA_APPLY", "Recovers {0} Mana."); public static readonly string TOOLTIP_CONSUMABLE_DESCRIPTION_STAMINA_APPLY = Create("ITEM_TOOLTIP_CONSUMABLE_DESCRIPTION_STAMINA_APPLY", "Recovers {0} Stamina."); public static readonly string TOOLTIP_CONSUMABLE_DESCRIPTION_EXP_GAIN = Create("ITEM_TOOLTIP_CONSUMABLE_DESCRIPTION_EXP_GAIN", "Gain {0} Experience on use."); internal static void Init() { } } internal static class Lore { public static readonly string CROWN = Create("CROWN", "crown"); public static readonly string CROWN_PLURAL = Create("CROWN_PLURAL", "crowns"); public static readonly string GAME_LOADING = Create("GAME_LOADING", "Loading..."); public static readonly string EXP_COUNTER_MAX = Create("EXP_COUNTER_MAX", "MAX"); public static readonly string COMBAT_ELEMENT_NORMAL_NAME = Create("COMBAT_ELEMENT_NORMAL_NAME", "Normal"); public static readonly string FORMAT_MAP_ZONE = Create("MAP_ZONE_FORMAT", "- {0} Zone -"); public static readonly string INTERACT_TELEPORT = Create("INTERACT_TELEPORT", "TELEPORT"); public static readonly string INTERACT_REEL = Create("INTERACT_REEL", "REEL"); public static readonly string INTERACT_REVIVE = Create("INTERACT_REVIVE", "REVIVE"); public static readonly string INTERACT_INTERACT = Create("INTERACT_INTERACT", "INTERACT"); public static readonly string INTERACT_HOLD = Create("INTERACT_HOLD", "HOLD"); public static readonly string INTERACT_OPEN = Create("INTERACT_OPEN", "OPEN"); public static readonly string INTERACT_PICK_UP = Create("INTERACT_PICK_UP", "PICK UP"); public static readonly string INTERACT_FISH = Create("INTERACT_FISH", "FISH"); public static readonly string INTERACT_CANCEL = Create("INTERACT_CANCEL", "CANCEL"); public static readonly string WORLDPORTAL_SELECT_WAYPOINT = Create("WORLDPORTAL_SELECT_WAYPOINT", "- Select Waypoint -"); public static readonly string WORLDPORTAL_TITLE = Create("WORLDPORTAL_TITLE", "World Portal"); public static readonly string WORLDPORTAL_TELEPORT = Create("WORLDPORTAL_TELEPORT", "Teleport"); public static readonly string DUNGEON_PORTAL_ENTER_PARTY = Create("DUNGEON_PORTAL_ENTER_PARTY", "Join Party"); public static readonly string DUNGEON_PORTAL_ENTER_LEVELED_FORMAT = Create("DUNGEON_PORTAL_ENTER_LEVELED_FORMAT", "Enter Dungeon (LV {0}-{1})"); internal static void Init() { } } internal static class MainMenu { public static readonly string BUTTON_SINGLEPLAY = Create("MAIN_MENU_BUTTON_SINGLEPLAY", "Singleplayer"); public static readonly string BUTTON_SINGLEPLAY_TOOLTIP = Create("MAIN_MENU_BUTTON_SINGLEPLAY_TOOLTIP", "Start a Singleplayer Game."); public static readonly string BUTTON_MULTIPLAY = Create("MAIN_MENU_BUTTON_MULTIPLAY", "Multiplayer"); public static readonly string BUTTON_MULTIPLAY_TOOLTIP = Create("MAIN_MENU_BUTTON_MULTIPLAY_TOOLTIP", "Start a Netplay Game."); public static readonly string BUTTON_MULTIPLAY_DISABLED_TOOLTIP = Create("MAIN_MENU_BUTTON_MULTIPLAY_DISABLED_TOOLTIP", "Multiplayer is disabled on this demo."); public static readonly string BUTTON_SETTINGS = Create("MAIN_MENU_BUTTON_SETTINGS", "Settings"); public static readonly string BUTTON_SETTINGS_TOOLTIP = Create("MAIN_MENU_BUTTON_SETTINGS_TOOLTIP", "Configure Game Settings."); public static readonly string BUTTON_QUIT = Create("MAIN_MENU_BUTTON_QUIT", "Quit"); public static readonly string BUTTON_QUIT_TOOLTIP = Create("MAIN_MENU_BUTTON_QUIT_TOOLTIP", "End The Application."); public static readonly string PAGER = Create("MAIN_MENU_PAGER", "Page ( {0} / 15 )"); public static readonly string BUTTON_JOIN_SERVER = Create("MAIN_MENU_BUTTON_JOIN_SERVER", "Join"); public static readonly string BUTTON_HOST_SERVER = Create("MAIN_MENU_BUTTON_HOST_SERVER", "Host"); public static readonly string BUTTON_RETURN = Create("MAIN_MENU_BUTTON_RETURN", "Return"); internal static void Init() { } } internal static class Quest { public static readonly string FORMAT_REQUIRED_LEVEL = Create("FORMAT_QUEST_REQUIRED_LEVEL", "(lv-{0})"); public static readonly string MENU_SUMMARY_NO_QUESTS = Create("QUEST_MENU_SUMMARY_NO_QUESTS", "No Quests in Quest Log."); public static readonly string MENU_HEADER_UNSELECTED = Create("QUEST_MENU_HEADER_UNSELECTED", "Select a Quest."); public static readonly string FORMAT_MENU_CELL_LOG_COUNTER = Create("FORMAT_QUEST_MENU_CELL_QUEST_LOG_COUNTER", "Quest Log: ({0} / {1})"); public static readonly string FORMAT_MENU_CELL_FINISHED_COUNTER = Create("FORMAT_QUEST_MENU_CELL_FINISHED_QUEST_COUNTER", "Completed Quests: {0}"); public static readonly string MENU_CELL_REWARD_HEADER = Create("QUEST_MENU_CELL_REWARD_HEADER", "Rewards:"); public static readonly string MENU_CELL_OBJECTIVE_ITEM_HEADER = Create("QUEST_MENU_CELL_OBJECTIVE_ITEM_HEADER", "Objective Item:"); public static readonly string FORMAT_MENU_CELL_REWARD_EXP = Create("FORMAT_QUEST_MENU_CELL_REWARD_EXP", "{0} exp"); public static readonly string FORMAT_MENU_CELL_REWARD_CURRENCY = Create("FORMAT_QUEST_MENU_CELL_REWARD_CURRENCY", "{0} Crowns"); public static readonly string MENU_CELL_SLOT_EMPTY = Create("QUEST_MENU_CELL_SLOT_EMPTY", "Empty Slot"); public static readonly string HEADER_QUEST_SELECTION = Create("QUEST_SELECTION_HEADER", "Quest Selection"); public static readonly string SELECTION_MANAGER_ACCEPT_BUTTON_ACCEPT = Create("QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_ACCEPT", "Accept Quest"); public static readonly string SELECTION_MANAGER_ACCEPT_BUTTON_LOCKED = Create("QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_LOCKED", "Quest Locked"); public static readonly string SELECTION_MANAGER_ACCEPT_BUTTON_INCOMPLETE = Create("QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_INCOMPLETE", "Quest Incomplete"); public static readonly string SELECTION_MANAGER_ACCEPT_BUTTON_TURN_IN = Create("QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_TURN_IN", "Complete Quest"); public static readonly string SELECTION_MANAGER_ACCEPT_BUTTON_UNSELECTED = Create("QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_UNSELECTED", "Select a Quest"); public static readonly string FORMAT_PROGRESS = Create("FORMAT_QUEST_PROGRESS", "{0}: ({1} / {2})"); public static readonly string FORMAT_PROGRESS_CREEPS_KILLED = Create("FORMAT_QUEST_PROGRESS_CREEPS_KILLED", "{0} slain"); public static readonly string TYPE_CLASS = Create("QUEST_TYPE_CLASS", "Class"); public static readonly TranslationKey RETRIEVED_QUEST_OBJECTIVE_ITEM_FORMAT = Create("QUEST_RETRIEVED_QUEST_OBJECTIVE_ITEM_FORMAT", "Retrieved Quest Objective Item: {0}."); public static readonly TranslationKey GAME_LOGIC_ACCEPT_QUEST_FORMAT = Create("QUEST_GAME_LOGIC_ACCEPT_QUEST_FORMAT", "Accepted Quest: {0}."); internal static void Init() { } } internal static class ScriptableStatusCondition { public static readonly string DURATION_FORMAT = Create("SCRIPTABLE_STATUS_CONDITION_DURATION_FORMAT", "Lasts for {0} sec."); public static readonly string RATE_FORMAT = Create("SCRIPTABLE_STATUS_CONDITION_RATE_FORMAT", "every {0} sec."); internal static void Init() { } } internal static class Settings { internal static class Audio { public static readonly string HEADER_AUDIO_SETTINGS = Create("SETTINGS_AUDIO_HEADER_AUDIO_SETTINGS", "Audio Settings"); public static readonly string CELL_MASTER_VOLUME = Create("SETTINGS_AUDIO_CELL_MASTER_VOLUME", "Master Volume"); public static readonly string CELL_MUTE_APPLICATION = Create("SETTINGS_AUDIO_CELL_MUTE_APPLICATION", "Mute Application"); public static readonly string CELL_MUTE_MUSIC = Create("SETTINGS_AUDIO_CELL_MUTE_MUSIC", "Mute Music"); public static readonly string HEADER_AUDIO_CHANNEL_SETTINGS = Create("SETTINGS_AUDIO_HEADER_AUDIO_CHANNEL_SETTINGS", "Audio Channels"); public static readonly string CELL_GAME_VOLUME = Create("SETTINGS_AUDIO_CELL_GAME_VOLUME", "Game Volume"); public static readonly string CELL_GUI_VOLUME = Create("SETTINGS_AUDIO_CELL_GUI_VOLUME", "GUI Volume"); public static readonly string CELL_AMBIENCE_VOLUME = Create("SETTINGS_AUDIO_CELL_AMBIENCE_VOLUME", "Ambience Volume"); public static readonly string CELL_MUSIC_VOLUME = Create("SETTINGS_AUDIO_CELL_MUSIC_VOLUME", "Music Volume"); public static readonly string CELL_VOICE_VOLUME = Create("SETTINGS_AUDIO_CELL_VOICE_VOLUME", "Voice Volume"); internal static void Init() { } } internal static class Input { public static readonly string HEADER_INPUT_SETTINGS = Create("SETTINGS_INPUT_HEADER_INPUT_SETTINGS", "Input Settings"); public static readonly string CELL_AXIS_TYPE = Create("SETTINGS_INPUT_CELL_AXIS_TYPE", "Analog Stick Axis Type"); public static readonly string CELL_AXIS_TYPE_OPTION_1 = Create("SETTINGS_INPUT_CELL_AXIS_TYPE_OPTION_1", "WASD (8 Directional)"); public static readonly string CELL_AXIS_TYPE_OPTION_2 = Create("SETTINGS_INPUT_CELL_AXIS_TYPE_OPTION_2", "Xbox"); public static readonly string CELL_AXIS_TYPE_OPTION_3 = Create("SETTINGS_INPUT_CELL_AXIS_TYPE_OPTION_3", "Playstation 4"); public static readonly string GAME_PAD_WIP = Create("SETTINGS_INPUT_GAME_PAD_WIP", "*Gamepad Input is a work in progress.\r\nVarious menu elements are incomplete."); public static readonly string HEADER_CAMERA_CONTROL = Create("SETTINGS_INPUT_HEADER_CAMERA_CONTROL", "Camera Control"); public static readonly string CELL_CAMERA_SENSITIVITY = Create("SETTINGS_INPUT_CELL_CAMERA_SENSITIVITY", "Axis Sensitivity"); public static readonly string CELL_INVERT_X_CAMERA_AXIS = Create("SETTINGS_INPUT_CELL_INVERT_X_CAMERA_AXIS", "Invert X Axis"); public static readonly string CELL_INVERT_Y_CAMERA_AXIS = Create("SETTINGS_INPUT_CELL_INVERT_Y_CAMERA_AXIS", "Invert Y Axis"); public static readonly string CELL_KEYBINDING_RESET_CAMERA = Create("SETTINGS_INPUT_CELL_KEYBINDING_RESET_CAMERA", "Reset Camera"); public static readonly string HEADER_MOVEMENT = Create("SETTINGS_INPUT_HEADER_MOVEMENT", "Movement"); public static readonly string CELL_KEYBINDING_UP = Create("SETTINGS_INPUT_CELL_KEYBINDING_UP", "Up"); public static readonly string CELL_KEYBINDING_DOWN = Create("SETTINGS_INPUT_CELL_KEYBINDING_DOWN", "Down"); public static readonly string CELL_KEYBINDING_LEFT = Create("SETTINGS_INPUT_CELL_KEYBINDING_LEFT", "Left"); public static readonly string CELL_KEYBINDING_RIGHT = Create("SETTINGS_INPUT_CELL_KEYBINDING_RIGHT", "Right"); public static readonly string CELL_KEYBINDING_JUMP = Create("SETTINGS_INPUT_CELL_KEYBINDING_JUMP", "Jump"); public static readonly string CELL_KEYBINDING_DASH = Create("SETTINGS_INPUT_CELL_KEYBINDING_DASH", "Dash"); public static readonly string CELL_ANALOG_DIRECTION_MODE = Create("SETTINGS_INPUT_CELL_ANALOG_DIRECTION_MODE", "Detect Analog Stick"); public static readonly string HEADER_STRAFING = Create("SETTINGS_INPUT_HEADER_STRAFING", "Strafing"); public static readonly string CELL_KEYBINDING_LOCK_DIRECTION = Create("SETTINGS_INPUT_CELL_KEYBINDING_LOCK_DIRECTION", "Strafe"); public static readonly string CELL_KEYBINDING_STRAFE_MODE = Create("SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_MODE", "Strafe / Aim Mode"); public static readonly string CELL_KEYBINDING_STRAFE_MODE_OPTION_1 = Create("SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_MODE_OPTION_1", "Hold Strafe Key"); public static readonly string CELL_KEYBINDING_STRAFE_MODE_OPTION_2 = Create("SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_MODE_OPTION_2", "Toggle Strafe Key"); public static readonly string CELL_KEYBINDING_STRAFE_WEAPON = Create("SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_WEAPON", "Strafe While Holding Weapon"); public static readonly string CELL_STRAFE_WEAPON_MOVE_ATTACK = Create("SETTINGS_INPUT_CELL_STRAFE_WEAPON_MOVE_ATTACK", "Strafe While Attacking + Movement"); public static readonly string CELL_KEYBINDING_STRAFE_CASTING = Create("SETTINGS_INPUT_CELL_KEYBINDING_STRAFE_CASTING", "Strafe While Casting Offensive Skills"); public static readonly string HEADER_ACTION = Create("SETTINGS_INPUT_HEADER_ACTION", "Action"); public static readonly string CELL_KEYBINDING_ATTACK = Create("SETTINGS_INPUT_CELL_KEYBINDING_ATTACK", "Attack"); public static readonly string CELL_KEYBINDING_CHARGE_ATTACK = Create("SETTINGS_INPUT_CELL_KEYBINDING_CHARGE_ATTACK", "Charge Attack"); public static readonly string CELL_KEYBINDING_BLOCK = Create("SETTINGS_INPUT_CELL_KEYBINDING_BLOCK", "Block"); public static readonly string CELL_KEYBINDING_TARGET = Create("SETTINGS_INPUT_CELL_KEYBINDING_TARGET", "Lock On"); public static readonly string CELL_KEYBINDING_INTERACT = Create("SETTINGS_INPUT_CELL_KEYBINDING_INTERACT", "Interact"); public static readonly string CELL_KEYBINDING_PVP_FLAG = Create("SETTINGS_INPUT_CELL_KEYBINDING_PVP_FLAG", "PvP Flag Toggle"); public static readonly string CELL_KEYBINDING_SKILL_SLOT_01 = Create("SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_01", "Skill Slot 1"); public static readonly string CELL_KEYBINDING_SKILL_SLOT_02 = Create("SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_02", "Skill Slot 2"); public static readonly string CELL_KEYBINDING_SKILL_SLOT_03 = Create("SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_03", "Skill Slot 3"); public static readonly string CELL_KEYBINDING_SKILL_SLOT_04 = Create("SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_04", "Skill Slot 4"); public static readonly string CELL_KEYBINDING_SKILL_SLOT_05 = Create("SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_05", "Skill Slot 5"); public static readonly string CELL_KEYBINDING_SKILL_SLOT_06 = Create("SETTINGS_INPUT_CELL_KEYBINDING_SKILL_SLOT_06", "Skill Slot 6"); public static readonly string CELL_KEYBINDING_RECALL = Create("SETTINGS_INPUT_CELL_KEYBINDING_RECALL", "Recall"); public static readonly string CELL_KEYBINDING_QUICKSWAP_WEAPON = Create("SETTINGS_INPUT_CELL_KEYBINDING_QUICKSWAP_WEAPON", "Quickswap Weapon"); public static readonly string CELL_KEYBINDING_SHEATHE_WEAPON = Create("SETTINGS_INPUT_CELL_KEYBINDING_SHEATHE_WEAPON", "Sheathe / Unsheathe Weapon"); public static readonly string CELL_KEYBINDING_SIT = Create("SETTINGS_INPUT_CELL_KEYBINDING_SIT", "Sit"); public static readonly string HEADER_CONSUMABLE_SLOTS = Create("SETTINGS_INPUT_HEADER_CONSUMABLE_SLOTS", "Consumable Quick Slots"); public static readonly string CELL_KEYBINDING_QUICK_SLOT_01 = Create("SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_01", "Quick Slot 1"); public static readonly string CELL_KEYBINDING_QUICK_SLOT_02 = Create("SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_02", "Quick Slot 2"); public static readonly string CELL_KEYBINDING_QUICK_SLOT_03 = Create("SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_03", "Quick Slot 3"); public static readonly string CELL_KEYBINDING_QUICK_SLOT_04 = Create("SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_04", "Quick Slot 4"); public static readonly string CELL_KEYBINDING_QUICK_SLOT_05 = Create("SETTINGS_INPUT_CELL_KEYBINDING_QUICK_SLOT_05", "Quick Slot 5"); public static readonly string HEADER_INTERFACE = Create("SETTINGS_INPUT_HEADER_INTERFACE", "Interface"); public static readonly string CELL_KEYBINDING_HOST_CONSOLE = Create("SETTINGS_INPUT_CELL_KEYBINDING_HOST_CONSOLE", "Host Console"); public static readonly string CELL_KEYBINDING_LEXICON = Create("SETTINGS_INPUT_CELL_KEYBINDING_LEXICON", "Open Lexicon"); public static readonly string CELL_KEYBINDING_TAB_MENU = Create("SETTINGS_INPUT_CELL_KEYBINDING_TAB_MENU", "Open Tab Menu"); public static readonly string CELL_KEYBINDING_STATS_TAB = Create("SETTINGS_INPUT_CELL_KEYBINDING_STATS_TAB", "Stats Tab"); public static readonly string CELL_KEYBINDING_SKILLS_TAB = Create("SETTINGS_INPUT_CELL_KEYBINDING_SKILLS_TAB", "Skills Tab"); public static readonly string CELL_KEYBINDING_ITEM_TAB = Create("SETTINGS_INPUT_CELL_KEYBINDING_ITEM_TAB", "Item Tab"); public static readonly string CELL_KEYBINDING_QUEST_TAB = Create("SETTINGS_INPUT_CELL_KEYBINDING_QUEST_TAB", "Quest Tab"); public static readonly string CELL_KEYBINDING_WHO_TAB = Create("SETTINGS_INPUT_CELL_KEYBINDING_WHO_TAB", "Who Tab"); public static readonly string CELL_KEYBINDING_HIDE_UI = Create("SETTINGS_INPUT_CELL_KEYBINDING_HIDE_UI", "Hide Game UI"); public static readonly string HEADER_RESET_BINDINGS = Create("SETTINGS_INPUT_HEADER_RESET_BINDINGS", "Reset Bindings"); public static readonly string CELL_RESET_BINDINGS = Create("SETTINGS_INPUT_CELL_RESET_BINDINGS", "Reset Bindings"); internal static void init() { } } public static class Mod { public static readonly TranslationKey HEADER_GENERAL = CreateSectionHeader("HEADER_GENERAL", "General"); public static readonly TranslationKey LANGUAGE = Create(ConfigDefinitions.Language); public static readonly TranslationKey TRANSLATOR_MODE = Create(ConfigDefinitions.TraslatorMode); public static readonly TranslationKey CREATE_DEFAULT_LANGUAGE_FILES = Create(ConfigDefinitions.CreateDefaultLanguageFiles); public static readonly TranslationKey SHOW_TRANSLATION_KEY = Create(ConfigDefinitions.ShowTranslationKey); public static readonly TranslationKey EXPORT_EXTRA = Create(ConfigDefinitions.ExportExtra); public static readonly TranslationKey RELOAD_LANGUAGE_KEYBIND = Create(ConfigDefinitions.ReloadLanguageKeybind); public static readonly TranslationKey LOG_VANILLA_FONTS = Create(ConfigDefinitions.LogVanillaFonts); public static readonly TranslationKey RELOAD_FONT_BUNDLES_KEYBIND = Create(ConfigDefinitions.ReloadFontBundlesKeybind); public static readonly TranslationKey SWITCH_TRANSLATION_KEYBIND = Create(ConfigDefinitions.SwitchTranslationKeybind); public static readonly TranslationKey ADD_MISSING_KEYS_TO_CURRENT_LANGUAGE = Create("ADD_MISSING_KEYS_TO_CURRENT_LANGUAGE", "Add Missing Keys to Current Language"); public static readonly TranslationKey LOG_UNTRANSLATED_STRINGS = Create("LOG_UNTRANSLATED_STRINGS", "Log Untranslated Strings"); internal static void Init() { } private static TranslationKey CreateSectionHeader(string key, string defaultValue = "") { return I18nKeys.Create("SETTINGS_MOD_" + key, defaultValue); } private static TranslationKey Create(string key, string defaultValue = "") { return I18nKeys.Create("SETTINGS_MOD_CELL_LOCALYSSATION_" + key, defaultValue); } private static TranslationKey Create(ConfigDefinition configEntry) { return Create(KeyUtil.Normalize(configEntry.Key), configEntry.Key); } } internal static class Network { public static readonly string HEADER_GAME_SETTINGS = Create("SETTINGS_NETWORK_HEADER_GAME_SETTINGS", "Game Settings"); public static readonly string CELL_ENABLE_PVP_ON_MAP_ENTER = Create("SETTINGS_NETWORK_CELL_ENABLE_PVP_ON_MAP_ENTER", "Flag for PvP when available"); public static readonly string CELL_PERSIST_DISCONNECT_HOTKEY = Create("SETTINGS_NETWORK_CELL_PERSIST_DISCONNECT_HOTKEY", "Persist (Ctrl + F12) disconnect hotkey in-game"); public static readonly string CELL_ENABLE_UNICODE = Create("SETTINGS_NETWORK_CELL_ENABLE_UNICODE", "(Hosting) Allow Unicode"); public static readonly string HEADER_NAMETAG_SETTINGS = Create("SETTINGS_NETWORK_HEADER_NAMETAG_SETTINGS", "Nametag Settings"); public static readonly string CELL_DISPLAY_GLOBAL_NICKNAME_TAGS = Create("SETTINGS_NETWORK_CELL_DISPLAY_GLOBAL_NICKNAME_TAGS", "Display Global Nametags (@XX)"); public static readonly string CELL_DISPLAY_LOCAL_NAMETAG = Create("SETTINGS_NETWORK_CELL_DISPLAY_LOCAL_NAMETAG", "Display Local Character Name Tag"); public static readonly string CELL_DISPLAY_HOST_TAG = Create("SETTINGS_NETWORK_CELL_DISPLAY_HOST_TAG", "Display [HOST] Tag on Host Character"); public static readonly string HEADER_UI_SETTINGS = Create("SETTINGS_NETWORK_HEADER_UI_SETTINGS", "UI Settings"); public static readonly string CELL_HIDE_FPS_COUNTER = Create("SETTINGS_NETWORK_CELL_HIDE_FPS_COUNTER", "Hide FPS Counter"); public static readonly string CELL_HIDE_PING_COUNTER = Create("SETTINGS_NETWORK_CELL_HIDE_PING_COUNTER", "Hide Ping Counter"); public static readonly string CELL_HIDE_STAT_POINT_COUNTER = Create("SETTINGS_NETWORK_CELL_HIDE_STAT_POINT_COUNTER", "Hide Stat Point Notice Panel"); public static readonly string CELL_HIDE_SKILL_POINT_COUNTER = Create("SETTINGS_NETWORK_CELL_HIDE_SKILL_POINT_COUNTER", "Hide Skill Point Notice Panel"); public static readonly string CELL_HIDE_QUEST_TRACKER = Create("SETTINGS_NETWORK_CELL_HIDE_QUEST_TRACKER", "Hide Quest Tracker"); public static readonly string CELL_HIDE_MINIMAP = Create("SETTINGS_NETWORK_CELL_HIDE_MINIMAP", "Hide Minimap"); public static readonly string CELL_HIDE_DAMAGE_VALUE_NUMBER_ICONS = Create("SETTINGS_NETWORK_CELL_HIDE_VALUE_NUMBER_ICONS", "Hide Value Number Icons"); public static readonly string CELL_HIDE_PEER_COUNTER = Create("SETTINGS_NETWORK_CELL_HIDE_PEER_COUNTER", "Hide Player Instance Counter"); public static readonly string CELL_HIDE_NPC_HEAD_ICONS = Create("SETTINGS_NETWORK_CELL_HIDE_NPC_HEAD_ICONS", "Hide NPC Head Icons"); public static readonly string CELL_DISPLAY_SKILL_SLOT_COOLDOWN_COUNTERS = Create("SETTINGS_NETWORK_CELL_DISPLAY_SKILL_SLOT_COOLDOWN_COUNTERS", "Display Action Slot Cooldown Counters"); public static readonly string HEADER_CHATBOX_SETTINGS = Create("SETTINGS_NETWORK_HEADER_CHATBOX_SETTINGS", "Chatbox Settings"); public static readonly string CELL_DEFAULT_CHANNEL = Create("SETTINGS_NETWORK_CELL_DEFAULT_CHANNEL", "Default #Room Channel"); public static readonly string CELL_FADE_CHAT_TEXT = Create("SETTINGS_NETWORK_CELL_FADE_CHAT_TEXT", "Fade Chat Text"); public static readonly string CELL_FADE_GAME_FEED_TEXT = Create("SETTINGS_NETWORK_CELL_FADE_GAME_FEED_TEXT", "Fade Game Feed Text"); internal static void Init() { } } internal static class Video { public static readonly string HEADER_ACCESSIBILITY_SETTINGS = Create("SETTINGS_VIDEO_HEADER_ACCESSIBILITY_SETTINGS", "Accesibility Settings"); public static readonly string CELL_PROPORTIONS_TOGGLE = Create("SETTINGS_VIDEO_CELL_PROPORTIONS_TOGGLE", "Limit Player Character Proportions"); public static readonly string CELL_JIGGLE_BONES_TOGGLE = Create("SETTINGS_VIDEO_CELL_JIGGLE_BONES_TOGGLE", "Disable Suggestive Jiggle Bones"); public static readonly string CELL_CLEAR_UNDERCLOTHES_TOGGLE = Create("SETTINGS_VIDEO_CELL_CLEAR_UNDERCLOTHES_TOGGLE", "Enable Clear Clothing"); public static readonly string HEADER_VIDEO_SETTINGS = Create("SETTINGS_VIDEO_HEADER_VIDEO_SETTINGS", "Video Settings"); public static readonly string CELL_SCREEN_MODE = CreateCell("SCREEN_MODE", "Screen Mode"); public static readonly TranslationKey[] CELL_SCREEN_MODE_OPTIONS = CreateOptions(CELL_SCREEN_MODE, new string[3] { "Windowed", "Fullscreen", "Fullscreen (Borderless)" }); public static readonly string CELL_FULLSCREEN_TOGGLE = Create("SETTINGS_VIDEO_CELL_FULLSCREEN_TOGGLE", "Fullscreen Mode"); public static readonly string CELL_VERTICAL_SYNC = Create("SETTINGS_VIDEO_CELL_VERTICAL_SYNC", "Vertical Sync / Lock 60 FPS"); public static readonly string CELL_ANISOTROPIC_FILTERING = Create("SETTINGS_VIDEO_CELL_ANISOTROPIC_FILTERING", "Anisotropic Filtering"); public static readonly string CELL_SCREEN_RESOLUTION = Create("SETTINGS_VIDEO_CELL_SCREEN_RESOLUTION", "Screen Resolution"); public static readonly string CELL_ANTI_ALIASING = Create("SETTINGS_VIDEO_CELL_ANTI_ALIASING", "Anti Aliasing"); public static readonly TranslationKey[] CELL_ANTI_ALIASING_OPTIONS = CreateOptions(CELL_ANTI_ALIASING, new string[4] { "Disabled", "2x Multi Sampling", "4x Multi Sampling", "8x Multi Sampling" }); public static readonly string CELL_TEXTURE_FILTERING = Create("SETTINGS_VIDEO_CELL_TEXTURE_FILTERING", "Texture Filtering"); public static readonly TranslationKey[] CELL_TEXTURE_FILTERING_OPTIONS = CreateOptions(CELL_TEXTURE_FILTERING, new string[2] { "Bilnear (Smooth)", "Nearest (Crunchy)" }); public static readonly string CELL_TEXTURE_QUALITY = Create("SETTINGS_VIDEO_CELL_TEXTURE_QUALITY", "Texture Quality"); public static readonly TranslationKey[] CELL_TEXTURE_QUALITY_OPTIONS = CreateOptions(CELL_TEXTURE_QUALITY, new string[4] { "High", "Medium", "Low", "Very Low" }); public static readonly string HEADER_CAMERA_SETTINGS = Create("SETTINGS_VIDEO_HEADER_CAMERA_SETTINGS", "Camera Display Settings"); public static readonly string CELL_FIELD_OF_VIEW = Create("SETTINGS_VIDEO_CELL_FIELD_OF_VIEW", "Field Of View"); public static readonly string CELL_CAMERA_SMOOTHING = Create("SETTINGS_VIDEO_CELL_CAMERA_SMOOTHING", "Camera Smoothing"); public static readonly string CELL_CAMERA_HORIZ = Create("SETTINGS_VIDEO_CELL_CAMERA_HORIZ", "Camera X Position"); public static readonly string CELL_CAMERA_VERT = Create("SETTINGS_VIDEO_CELL_CAMERA_VERT", "Camera Y Position"); public static readonly string CELL_CAMERA_RENDER_DISTANCE = Create("SETTINGS_VIDEO_CELL_CAMERA_RENDER_DISTANCE", "Render Distance"); public static readonly TranslationKey[] CELL_CAMERA_RENDER_DISTANCE_OPTIONS = CreateOptions(CELL_CAMERA_RENDER_DISTANCE, new string[4] { "Very Near", "Near", "Far", "Very Far" }); public static readonly string HEADER_CURSOR_SETTINGS = Create("SETTINGS_VIDEO_HEADER_CURSOR_SETTINGS", "Cursor Settings"); public static readonly string CELL_CURSOR_GRAPHIC = Create("SETTINGS_VIDEO_CELL_CURSOR_GRAPHIC", "Cursor Graphic"); public static readonly string CELL_HARDWARE_CURSOR = Create("SETTINGS_VIDEO_CELL_HARDWARE_CURSOR", "Hardware Cursor"); public static readonly string HEADER_POST_PROCESSING = Create("SETTINGS_VIDEO_HEADER_POST_PROCESSING", "Post Processing"); public static readonly string CELL_CAMERA_BITCRUSH_SHADER = Create("SETTINGS_VIDEO_CELL_CAMERA_BITCRUSH_SHADER", "Enable Bitcrush Shader"); public static readonly string CELL_CAMERA_WATER_EFFECT = Create("SETTINGS_VIDEO_CELL_CAMERA_WATER_EFFECT", "Enable Underwater Distortion Shader"); public static readonly string CELL_CAMERA_SHAKE = Create("SETTINGS_VIDEO_CELL_CAMERA_SHAKE", "Enable Screen Shake"); public static readonly string CELL_WEAPON_GLOW = Create("SETTINGS_VIDEO_CELL_WEAPON_GLOW", "Disable Weapon Glow Effect"); public static readonly string CELL_DISABLE_GIB_EFFECT = Create("SETTINGS_VIDEO_CELL_DISABLE_GIB_EFFECT", "Disable Gib Effect"); private static string CreateCell(string key, string defaultString) { return Create("SETTINGS_VIDEO_CELL_" + key, defaultString); } private static TranslationKey[] CreateOptions(string parentKey, string[] defaultStrings) { return defaultStrings.Select((string value, int index) => Create($"{parentKey}_OPTION_{index + 1}", value)).ToArray(); } internal static void Init() { } } public static readonly TranslationKey BUTTON_VIDEO = Create("SETTINGS_TAB_BUTTON_VIDEO", "Display"); public static readonly TranslationKey BUTTON_AUDIO = Create("SETTINGS_TAB_BUTTON_AUDIO", "Audio"); public static readonly TranslationKey BUTTON_INPUT = Create("SETTINGS_TAB_BUTTON_INPUT", "Input"); public static readonly TranslationKey BUTTON_NETWORK = Create("SETTINGS_TAB_BUTTON_NETWORK", "Interface"); public static readonly TranslationKey BUTTON_MODS = Create("SETTINGS_TAB_BUTTON_MODS", "Mods"); public static readonly TranslationKey BUTTON_RESET_TO_DEFAULTS = Create("SETTINGS_BUTTON_RESET_TO_DEFAULTS", "Reset to Defaults"); public static readonly TranslationKey BUTTON_RESET = Create("SETTINGS_BUTTON_RESET", "Reset"); public static readonly TranslationKey BUTTON_CANCEL = Create("SETTINGS_BUTTON_CANCEL", "Cancel"); public static readonly TranslationKey BUTTON_APPLY = Create("SETTINGS_BUTTON_APPLY", "Apply"); internal static void Init() { Video.Init(); Audio.Init(); Input.init(); Network.Init(); Mod.Init(); } } internal static class Shop { public static readonly string BUTTON_REROLL = Create("GAMBLING_SHOP_BUTTON_REROLL", "Re-roll Stock"); public static readonly string BUTTON_SELL_SINGLE = Create("SHOP_BUTTON_SELL_SINGLE", "Sell"); public static readonly string BUTTON_SELL_QUANTITY = Create("SHOP_BUTTON_SELL_QUANTITY", "Sell Quantity"); public static readonly string BUTTON_CANCEL_SELL = Create("SHOP_BUTTON_CANCEL_SELL", "Cancel"); public static readonly string BUTTON_PURCHASE_SINGLE = Create("SHOP_BUTTON_PURCHASE_SINGLE", "Purchase"); public static readonly string BUTTON_PURCHASE_QUANTITY = Create("SHOP_BUTTON_PURCHASE_QUANTITY", "Purchase Quantity"); public static readonly string BUTTON_CANCEL_PURCHASE = Create("SHOP_BUTTON_CANCEL_PURCHASE", "Cancel"); public static readonly string ERROR_VENDOR_DOESNT_BUY = Create("ERROR_VENDOR_DOESNT_BUY", "This vendor doesn't buy items."); public static readonly string ERROR_VENDOR_DOESNT_WANT = Create("ERROR_VENDOR_DOESNT_WANT", "This vendor doesn't want this item."); public static readonly string ERROR_NO_VALUE = Create("ERROR_NO_VALUE", "No Value"); internal static void Init() { } } internal static class SkillMenu { public static readonly TranslationKey RANK_SOULBOUND = Create("SKILL_RANK_SOULBOUND", "Soulbound Skill"); public static readonly TranslationKey RANK = Create("FORMAT_SKILL_RANK", "[Rank {0} / {1}]"); public static readonly TranslationKey SKILL_POINT_COST_FORMAT = Create("SKILL_POINT_COST_FORMAT", "Point Cost: {0}"); public static readonly TranslationKey TOOLTIP_DAMAGE_TYPE = Create("FORMAT_SKILL_TOOLTIP_DAMAGE_TYPE", "{0} Skill"); public static readonly TranslationKey TOOLTIP_ITEM_COST = Create("FORMAT_SKILL_TOOLTIP_ITEM_COST", "{0} {1}"); public static readonly TranslationKey TOOLTIP_MANA_COST = Create("FORMAT_SKILL_TOOLTIP_MANA_COST", "{0} Mana"); public static readonly TranslationKey TOOLTIP_HEALTH_COST = Create("FORMAT_SKILL_TOOLTIP_HEALTH_COST", "{0} Health"); public static readonly TranslationKey TOOLTIP_STAMINA_COST = Create("FORMAT_SKILL_TOOLTIP_STAMINA_COST", "{0} Stamina"); public static readonly TranslationKey TOOLTIP_CAST_TIME_INSTANT = Create("SKILL_TOOLTIP_CAST_TIME_INSTANT", "Instant Cast"); public static readonly TranslationKey TOOLTIP_CAST_TIME = Create("FORMAT_SKILL_TOOLTIP_CAST_TIME", "{0} sec Cast"); public static readonly TranslationKey TOOLTIP_COOLDOWN = Create("FORMAT_SKILL_TOOLTIP_COOLDOWN", "{0} sec Cooldown"); public static readonly TranslationKey TOOLTIP_PASSIVE = Create("SKILL_TOOLTIP_PASSIVE", "Passive Skill"); public static readonly TranslationKey TOOLTIP_DESCRIPTOR_MANACOST = Create("FORMAT_SKILL_TOOLTIP_DESCRIPTOR_MANACOST", "Costs {0} Mana."); public static readonly TranslationKey TOOLTIP_DESCRIPTOR_HEALTHCOST = Create("FORMAT_SKILL_TOOLTIP_DESCRIPTOR_HEALTHCOST", "Costs {0} Health."); public static readonly TranslationKey TOOLTIP_DESCRIPTOR_STAMINACOST = Create("FORMAT_SKILL_TOOLTIP_DESCRIPTOR_STAMINACOST", "Costs {0} Stamina."); public static readonly TranslationKey TOOLTIP_DESCRIPTOR_COOLDOWN = Create("FORMAT_SKILL_TOOLTIP_DESCRIPTOR_COOLDOWN", "{0} sec cooldown."); public static readonly TranslationKey TOOLTIP_DESCRIPTOR_CAST_TIME = Create("FORMAT_SKILL_TOOLTIP_DESCRIPTOR_CAST_TIME", "{0} sec cast time."); public static readonly TranslationKey TOOLTIP_DESCRIPTOR_CAST_TIME_INSTANT = Create("SKILL_TOOLTIP_DESCRIPTOR_CAST_TIME_INSTANT", "instant cast time."); public static readonly TranslationKey TOOLTIP_REQUIEMENT_FORMAT = Create("FORMAT_SKILL_TOOLTIP_REQUIREMENT", " Requirement a {0} weapon."); public static readonly TranslationKey TOOLTIP_REQUIRE_SHIELD = Create("SKILL_TOOLTIP_REQUIREMENT_SHIELD", " Requires a shield."); public static readonly TranslationKey TOOLTIP_DESCRIPTOR_CONDITION_CANCEL_ON_HIT = Create("SKILL_TOOLTIP_DESCRIPTOR_CONDITION_CANCEL_ON_HIT", " Cancels if hit."); public static readonly TranslationKey TOOLTIP_DESCRIPTOR_CONDITION_IS_STACKABLE = Create("SKILL_TOOLTIO_DESCRIPTOR_CONDITION_IS_STACKABLE", " Stackable."); public static readonly TranslationKey TOOLTIP_DESCRIPTOR_CONDITION_CHANCE = Create("SKILL_TOOLTIP_DESCRIPTOR_CONDITION_CHANCE", "\n\n{0} - ({1}) ({2}% Chance)"); internal static void Init() { } } public static class SteamLobby { public static readonly TranslationKey LOBBY_HOST_HEADER = Create("LOBBY_HOST_HEADER", "Host Lobby"); public static readonly TranslationKey LOBBY_HOST_HEADER_STEAM_UNAVAILABLE = Create("LOBBY_HOST_HEADER_STEAM_UNAVAILABLE", "Steam is not Initialized."); public static readonly TranslationKey TAG_LOBBY_NAME = Create("TAG_LOBBY_NAME", "Lobby Name"); public static readonly TranslationKey TAG_LOBBY_PASSWORD = Create("TAG_LOBBY_PASSWORD", "Lobby Password"); public static readonly TranslationKey TAG_MOTD = Create("TAG_MOTD", "Message Of The Day"); public static readonly TranslationKey TAG_LOBBY_TYPE = Create("TAG_LOBBY_TYPE", "Lobby Type"); public static readonly TranslationKey TAG_MAX_PLAYERS = Create("TAG_MAX_PLAYERS", "Max Players"); public static readonly TranslationKey TAG_STREAM_MODE = Create("TAG_STREAM_MODE", "Stream Mode (Disable Chat)"); public static readonly TranslationKey TAG_LOBBY_REALM = Create("TAG_LOBBY_REALM", "Lobby Realm"); public static readonly TranslationKey BUTTON_RETURN = Create("BUTTON_RETURN", "Return"); public static readonly TranslationKey BUTTON_HOST_LOBBY = Create("BUTTON_HOST_LOBBY", "Host Lobby"); public static readonly TranslationKey PLACEHOLDER_LOBBY_NAME = Create("PLACEHOLDER_LOBBY_NAME", "Enter text..."); public static readonly TranslationKey PLACEHOLDER_LOBBY_PASSWORD = Create("PLACEHOLDER_LOBBY_PASSWORD", "Enter Password..."); public static readonly TranslationKey PLACEHOLDER_MOTD = Create("PLACEHOLDER_MOTD", "Enter Message..."); public static readonly TranslationKey LOBBY_TYPE_DESCRIPTION_PUBLIC = Create("LOBBY_TYPE_DESCRIPTION_PUBLIC", "Public lobbies will be advertised for anyone to join."); public static readonly TranslationKey LOBBY_TYPE_DESCRIPTION_FRIENDS = Create("LOBBY_TYPE_DESCRIPTION_FRIENDS", "Friend lobbies are joinable by invite or from the Steam friends list."); public static readonly TranslationKey LOBBY_TYPE_DESCRIPTION_PRIVATE = Create("LOBBY_TYPE_DESCRIPTION_PRIVATE", "Private lobbies are by invitation from Host only."); public static readonly TranslationKey CLEARED_HIDDEN_LOBBY_CACHE = Create("CLEARED_HIDDEN_LOBBY_CACHE", "Cleared hidden lobby cache..."); public static readonly TranslationKey HIDDEN_LOBBY_COUNT_FORMAT = Create("HIDDEN_LOBBY_COUNT_FORMAT", "Hidden Lobbies: {0}"); public static readonly TranslationKey STEAM_NOT_INITIALIZED = Create("STEAM_NOT_INITIALIZED", "Steam is not initialized."); public static readonly TranslationKey SEARCHING_FOR_LOBBIES = Create("SEARCHING_FOR_LOBBIES", "Searching..."); public static readonly TranslationKey NO_LOBBIES_FOUND = Create("NO_LOBBIES_FOUND", "No lobbies found."); public static readonly TranslationKey LOBBY_FOUNDED_COUNT_FORMAT_1 = Create("LOBBY_FOUNDED_COUNT_FORMAT_1", "{0} lobby found."); public static readonly TranslationKey LOBBY_FOUNDED_COUNT_FORMAT_PLURAL = Create("LOBBY_FOUNDED_COUNT_FORMAT_PLURAL", "{0} lobbies found."); public static readonly TranslationKey LOBBY_FULL = Create("LOBBY_FULL", "Lobby Full"); public static readonly TranslationKey LOBBY_PASSWORD_LOBBY = Create("LOBBY_PASSWORD_LOBBY", "Password Lobby"); public static readonly TranslationKey LOBBY_DIFFERENT_VERSION = Create("LOBBY_DIFFERENT_VERSION", "Different Version"); public static readonly TranslationKey LOBBY_INVALID = Create("LOBBY_INVALID", "Invalid Lobby"); public static readonly TranslationKey LOBBY_JOIN_FRIEND = Create("LOBBY_JOIN_FRIEND", "Join Lobby (Friend)"); public static readonly TranslationKey LOBBY_PLAYER_COUNT = Create("LOBBY_PLAYER_COUNT", "Players: "); public static readonly TranslationKey UNTITLED_LOBBY = Create("UNTITLED_LOBBY", "Untitled Lobby"); public static readonly TranslationKey LOBBY_PING_FORMAT = Create("LOBBY_PING_FORMAT", "Ping: {0}ms"); public static readonly TranslationKey MODDED_LOBBY = Create("MODDED_LOBBY", "Modded Lobby"); public static readonly TranslationKey JOIN_LOBBY = Create("JOIN_LOBBY", "Join Lobby"); public static readonly TranslationKey CLEAR_HIDDEN_LOBBY_BUTTON = Create("CLEAR_HIDDEN_LOBBY_BUTTON", "Clear Hidden Lobby Cache"); public static readonly TranslationKey LOBBY_LIST_FILTER_BASE = Create("LOBBY_LIST_FILTER", "Lobby List Filter"); public static readonly TranslationKey[] LOBBY_LIST_FILTER = CreateOptions(LOBBY_LIST_FILTER_BASE, new string[3] { "Nearby", "Far", "Worldwide" }); public static readonly TranslationKey LOBBY_TYPE_BASE = Create("LOBBY_TYPE", "Lobby Type"); public static readonly TranslationKey[] LOBBY_TYPES = CreateOptions(LOBBY_TYPE_BASE, new string[3] { "Public", "Friends", "Private" }); public static readonly TranslationKey PLACEHOLDER_LOBBY_NAME_SEARCH = Create("PLACEHOLDER_LOBBY_NAME_SEARCH", "Search Lobby Name..."); internal static void Init() { } private static TranslationKey Create(string key, string defaultValue = "") { return I18nKeys.Create("STEAM_LOBBY_" + key, defaultValue); } } internal static class Storage { public static readonly string HEADER = Create("STORAGE_HEADER_ITEM_STORAGE", "Item Storage"); internal static void Init() { } } internal static class TabMenu { public static readonly TranslationKey PAGER_FORMAT = Create("PAGER_FORMAT", "Page ( {0} / {1} )"); public static readonly TranslationKey PAGER_1_PAGE = Create("PAGER_1_PAGE", "Page ( 1 / 1 )"); public static readonly TranslationKey POINTS_AVAILABLE = Create("TAB_MENU_POINTS_AVAILABLE", "Points Available"); public static readonly TranslationKey CELL_STATS_HEADER = Create("TAB_MENU_CELL_STATS_HEADER", "Stats"); public static readonly TranslationKey CELL_STATS_ATTRIBUTE_POINT_COUNTER = Create("TAB_MENU_CELL_STATS_ATTRIBUTE_POINT_COUNTER", "Points"); public static readonly TranslationKey CELL_STATS_BUTTON_APPLY_ATTRIBUTE_POINTS = Create("TAB_MENU_CELL_STATS_BUTTON_APPLY_ATTRIBUTE_POINTS", "Apply"); public static readonly TranslationKey CELL_STATS_INFO_CELL_NICK_NAME = Create("TAB_MENU_CELL_STATS_INFO_CELL_NICK_NAME", "Nickname"); public static readonly TranslationKey CELL_STATS_INFO_CELL_RACE_NAME = Create("TAB_MENU_CELL_STATS_INFO_CELL_RACE_NAME", "Race"); public static readonly TranslationKey CELL_STATS_INFO_CELL_CLASS_NAME = Create("TAB_MENU_CELL_STATS_INFO_CELL_CLASS_NAME", "Class"); public static readonly TranslationKey CELL_STATS_INFO_CELL_LEVEL_COUNTER = Create("TAB_MENU_CELL_STATS_INFO_CELL_LEVEL_COUNTER", "Level"); public static readonly TranslationKey CELL_STATS_INFO_CELL_EXPERIENCE = Create("TAB_MENU_CELL_STATS_INFO_CELL_EXPERIENCE", "Experience"); public static readonly TranslationKey CELL_STATS_INFO_CELL_MAX_HEALTH = Create("TAB_MENU_CELL_STATS_INFO_CELL_MAX_HEALTH", "Health"); public static readonly TranslationKey CELL_STATS_INFO_CELL_MAX_MANA = Create("TAB_MENU_CELL_STATS_INFO_CELL_MAX_MANA", "Mana"); public static readonly TranslationKey CELL_STATS_INFO_CELL_MAX_STAMINA = Create("TAB_MENU_CELL_STATS_INFO_CELL_MAX_STAMINA", "Stamina"); public static readonly TranslationKey CELL_STATS_INFO_CELL_ATTACK = Create("TAB_MENU_CELL_STATS_INFO_CELL_ATTACK", "Attack Power"); public static readonly TranslationKey CELL_STATS_INFO_CELL_RANGED_POWER = Create("TAB_MENU_CELL_STATS_INFO_CELL_RANGED_POWER", "Dex Power"); public static readonly TranslationKey CELL_STATS_INFO_CELL_PHYS_CRITICAL = Create("TAB_MENU_CELL_STATS_INFO_CELL_PHYS_CRITICAL", "Phys. Crit %"); public static readonly TranslationKey CELL_STATS_INFO_CELL_MAGIC_POW = Create("TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_POW", "Mgk. Power"); public static readonly TranslationKey CELL_STATS_INFO_CELL_MAGIC_CRIT = Create("TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_CRIT", "Mgk. Crit %"); public static readonly TranslationKey CELL_STATS_INFO_CELL_DEFENSE = Create("TAB_MENU_CELL_STATS_INFO_CELL_DEFENSE", "Defense"); public static readonly TranslationKey CELL_STATS_INFO_CELL_MAGIC_DEF = Create("TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_DEF", "Mgk. Defense"); public static readonly TranslationKey CELL_STATS_INFO_CELL_EVASION = Create("TAB_MENU_CELL_STATS_INFO_CELL_EVASION", "Evasion %"); public static readonly TranslationKey CELL_STATS_INFO_CELL_MOVE_SPD = Create("TAB_MENU_CELL_STATS_INFO_CELL_MOVE_SPD", "Mov Spd %"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_BEGIN = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_BEGIN", "Base Stat: "); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_END_CRIT = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_CRIT", "% (Critical %)"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_END_EVASION = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_EVASION", "% (Evasion %)"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_ATTACK_POW = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_ATTACK_POW", "{0} (Attack Power)"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_MP = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_MP", "{0} (Max Mana)"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_HP = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_HP", "{0} (Max Health)"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_RANGE_POW = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_RANGE_POW", "{0} (Dex Power)"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_END_MAGIC_CRIT = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_MAGIC_CRIT", "% (Magic Critical %)"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAGIC_DEF = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAGIC_DEF", "{0} (Magic Defense)"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_DEFENSE = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_DEFENSE", "{0} (Defense)"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAGIC_POW = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAGIC_POW", "{0} (Magic Power)"); public static readonly TranslationKey CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_STAM = Create("TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_STAM", "{0} (Max Stamina)"); public static readonly TranslationKey CELL_SKILLS_HEADER = Create("TAB_MENU_CELL_SKILLS_HEADER", "Skills"); public static readonly TranslationKey CELL_SKILLS_SKILL_POINT_COUNTER = Create("TAB_MENU_CELL_SKILLS_SKILL_POINT_COUNTER", "Skill Points"); public static readonly TranslationKey CELL_SKILLS_CLASS_TAB_TOOLTIP_NOVICE = Create("TAB_MENU_CELL_SKILLS_CLASS_TAB_TOOLTIP_NOVICE", "General Skills"); public static readonly TranslationKey CELL_SKILLS_CLASS_TAB_TOOLTIP = Create("TAB_MENU_CELL_SKILLS_CLASS_TAB_TOOLTIP", "{0} Skills"); public static readonly TranslationKey CELL_SKILLS_CLASS_HEADER_NOVICE = Create("TAB_MENU_CELL_SKILLS_CLASS_HEADER_NOVICE", "General Skillbook"); public static readonly TranslationKey CELL_SKILLS_CLASS_HEADER_FORMAT = Create("TAB_MENU_CELL_SKILLS_CLASS_HEADER", "{0} Skillbook"); public static readonly TranslationKey CELL_OPTIONS_HEADER = Create("TAB_MENU_CELL_OPTIONS_HEADER", "Options"); public static readonly TranslationKey CELL_OPTIONS_BUTTON_SETTINGS = Create("TAB_MENU_CELL_OPTIONS_BUTTON_SETTINS", "Settings"); public static readonly TranslationKey CELL_OPTIONS_BUTTON_SAVE_FILE = Create("TAB_MENU_CELL_OPTIONS_BUTTON_SAVE_FILE", "Save File"); public static readonly TranslationKey CELL_OPTIONS_BUTTON_INVITE_TO_LOBBY = Create("TAB_MENU_CELL_OPTIONS_BUTTON_INVITE_TO_LOBBY", "Invite to Lobby"); public static readonly TranslationKey CELL_OPTIONS_BUTTON_HOST_CONSOLE = Create("TAB_MENU_CELL_OPTIONS_BUTTON_HOST_CONSOLE", "Host Console"); public static readonly TranslationKey CELL_OPTIONS_BUTTON_SAVE_AND_QUIT = Create("TAB_MENU_CELL_OPTIONS_BUTTON_SAVE_AND_QUIT", "Save & Quit"); public static readonly TranslationKey CELL_OPTIONS_CONFIRM_QUIT_HEADER = Create("TAB_MENU_CELL_OPTIONS_CONFIRM_QUIT_HEADER", "Save and Quit Game?"); public static readonly TranslationKey CELL_OPTIONS_CONFIRM_QUIT_CONFIRM = Create("TAB_MENU_CELL_OPTIONS_CONFIRM_QUIT_CONFIRM", "Confirm"); public static readonly TranslationKey CELL_OPTIONS_CONFIRM_QUIT_CANCEL = Create("TAB_MENU_CELL_OPTIONS_CONFIRM_QUIT_CANCEL", "Cancel"); public static readonly TranslationKey CELL_ITEMS_HEADER = Create("TAB_MENU_CELL_ITEMS_HEADER", "Items"); public static readonly TranslationKey CELL_ITEMS_EQUIP_TAB_HEADER_EQUIPMENT = Create("TAB_MENU_CELL_ITEMS_EQUIP_TAB_HEADER_EQUIPMENT", "Equipment"); public static readonly TranslationKey CELL_ITEMS_EQUIP_TAB_HEADER_VANITY = Create("TAB_MENU_CELL_ITEMS_EQUIP_TAB_HEADER_VANITY", "Vanity"); public static readonly TranslationKey CELL_ITEMS_EQUIP_TAB_HEADER_STAT = Create("TAB_MENU_CELL_ITEMS_EQUIP_TAB_HEADER_STAT", "Stats"); public static readonly TranslationKey CELL_ITEMS_INVENTORY_TYPE_EQUIPMENT = CreateCellItems("INVENTORY_TYPE_EQUIPMENT", "Equipment"); public static readonly TranslationKey CELL_ITEMS_INVENTORY_TYPE_CONSUMABLE = CreateCellItems("INVENTORY_TYPE_CONSUMABLE", "Consumables"); public static readonly TranslationKey CELL_ITEMS_INVENTORY_TYPE_TRADE_ITEM = CreateCellItems("INVENTORY_TYPE_TRADE_TYPE", "Trade Items"); public static readonly TranslationKey CELL_ITEMS_INVENTORY_SORT_ITEMS = CreateCellItems("INVENTORY_SORT_ITEMS", "Sort Items"); public static readonly TranslationKey DROP_ITEM_ABANDON_QUEST_FORMAT = Create("TAB_MENU_DROP_ITEM_ABANDON_QUEST_FORMAT", "Abandoned Quest: {0}"); public static readonly IDictionary CELL_ITEMS_PROMPT_BUTTONS = new string[7] { "equip", "transmogrify", "remove", "use", "split", "drop", "cancel" }.ToDictionary((string x) => x, (string x) => CreateCellItems("PROMPT_BUTTON_" + x.ToUpper(), char.ToUpper(x[0]) + x.Substring(1))); public static readonly TranslationKey CELL_QUESTS_HEADER = Create("TAB_MENU_CELL_QUESTS_HEADER", "Quests"); public static readonly TranslationKey CELL_QUESTS_BUTTON_ABANDON = Create("TAB_MENU_CELL_QUESTS_BUTTON_ABANDON", "Abandon Quest"); public static readonly TranslationKey CELL_WHO_HEADER = Create("TAB_MENU_CELL_WHO_HEADER", "Who"); public static readonly TranslationKey CELL_WHO_BUTTON_INVITE_TO_PARTY = Create("TAB_MENU_CELL_WHO_BUTTON_INVITE_TO_PARTY", "Invite to Party"); public static readonly TranslationKey CELL_WHO_BUTTON_LEAVE_PARTY = Create("TAB_MENU_CELL_WHO_BUTTON_LEAVE_PARTY", "Leave Party"); public static readonly TranslationKey CELL_WHO_BUTTON_MUTE_PEER = Create("TAB_MENU_CELL_WHO_BUTTON_MUTE_PEER", "Mute / Unmute"); public static readonly TranslationKey CELL_WHO_BUTTON_REFRESH_LIST = Create("TAB_MENU_CELL_WHO_BUTTON_REFRESH_LIST", "Refresh"); internal static void Init() { } private static TranslationKey CreateCellItems(string key, string value = "") { return Create("TAB_MENU_CELL_ITEMS_" + key, value); } } internal static readonly Dictionary TR_KEYS = new Dictionary(); public static void Init() { CharacterCreation.Init(); CharacterSelect.Init(); ChatBehaviour.Init(); ChatMessage.Init(); DeathPrompt.Init(); Enchanter.Init(); Enums.Init(); Equipment.Init(); ErrorMessages.Init(); Feedback.Init(); Item.Init(); Lore.Init(); MainMenu.Init(); Quest.Init(); ScriptableStatusCondition.Init(); Settings.Init(); SkillMenu.Init(); SteamLobby.Init(); TabMenu.Init(); Shop.Init(); IntroAndTags.Init(); } private static TranslationKey Create(string key, string defaultString = "") { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException("key is empty"); } if (string.IsNullOrEmpty(defaultString)) { defaultString = key; } if (TR_KEYS.ContainsKey(key)) { throw new ArgumentException("key `" + key + "` Already Exists!"); } TR_KEYS[key] = defaultString; return new TranslationKey(key); } private static TranslationKey[] CreateOptions(string key, string[] defaultStrings) { return (from i in Enumerable.Range(0, defaultStrings.Length) select Create(new TranslationKey(key).Option[i], defaultStrings[i])).ToArray(); } public static string GetDefaulted(string key) { if (TR_KEYS.TryGetValue(key, out var value)) { return value; } return key; } } public static class TSVUtil { public static string makeTsv(List> rows, string delimeter = "\t") { List list = new List(); List list2 = null; for (int i = 0; i < rows.Count; i++) { List 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> parseTsv(string tsv, string delimeter = "\t") { List> list = new List>(); List 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 list3 = new List(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> { list2 }; } list.Add(list3); } return list; } public static List> parseTsvWithHeaders(string tsv, string delimeter = "\t") { List> list = parseTsv(tsv, delimeter); List> list2 = new List>(); if (list.Count <= 0) { return list2; } List headerRow = list[0]; for (int i = 1; i < list.Count; i++) { Dictionary item = list[i].Select((string x, int y) => new KeyValuePair(headerRow[y], x)).ToDictionary((KeyValuePair x) => x.Key, (KeyValuePair x) => x.Value); list2.Add(item); } return list2; } public static List Split(string str, string delimeter) { List list = new List(); 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; } } } namespace Localyssation.Util { public static class ConfigDefinitions { public static readonly ConfigDefinition Language = new ConfigDefinition("General", "Language"); public static readonly ConfigDefinition TraslatorMode = new ConfigDefinition("Translators", "Translator Mode"); public static readonly ConfigDefinition CreateDefaultLanguageFiles = new ConfigDefinition("Translators", "Create Default Language Files On Load"); public static readonly ConfigDefinition ShowTranslationKey = new ConfigDefinition("Translators", "Show Translation Key"); public static readonly ConfigDefinition ExportExtra = new ConfigDefinition("Translators", "Export Extra Info"); public static readonly ConfigDefinition ReloadLanguageKeybind = new ConfigDefinition("Translators", "Reload Language Keybind"); public static readonly ConfigDefinition ReloadFontBundlesKeybind = new ConfigDefinition("Translators", "Reload Font Bundles Keybind"); public static readonly ConfigDefinition SwitchTranslationKeybind = new ConfigDefinition("Translators", "Switch Translation Keybind"); public static readonly ConfigDefinition LogVanillaFonts = new ConfigDefinition("Translators", "Log Vanilla Fonts"); } public static class LocalyssationConfig { private static ConfigFile config; private static bool showTranslationKeyEnabled; internal static ConfigEntry configLanguage { get; private set; } public static string Language => configLanguage.Value; internal static ConfigEntry configTranslatorMode { get; private set; } public static bool TranslatorMode => configTranslatorMode.Value; internal static ConfigEntry configCreateDefaultLanguageFiles { get; private set; } public static bool CreateDefaultLanguageFiles => configCreateDefaultLanguageFiles.Value; internal static ConfigEntry configShowTranslationKey { get; private set; } public static KeyCode ShowTranslationKey => configShowTranslationKey.Value; public static bool ShowTranslationKeyEnabled { get { return showTranslationKeyEnabled; } set { showTranslationKeyEnabled = value; } } internal static ConfigEntry configExportExtra { get; private set; } public static bool ExportExtra => configExportExtra.Value; internal static ConfigEntry configReloadLanguageKeybind { get; private set; } public static KeyCode ReloadLanguageKeybind => configReloadLanguageKeybind.Value; internal static ConfigEntry configReloadFontBundlesKeybind { get; private set; } public static KeyCode ReloadFontBundlesKeybind => configReloadFontBundlesKeybind.Value; internal static ConfigEntry configSwitchTranslationKeybind { get; private set; } public static KeyCode SwitchTranslationKeybind => configSwitchTranslationKeybind.Value; internal static ConfigEntry configLogVanillaFonts { get; private set; } public static bool LogVanillaFonts => configLogVanillaFonts.Value; public static void Init(ConfigFile _config) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown config = _config; configLanguage = config.Bind(ConfigDefinitions.Language, LanguageManager.DefaultLanguage.info.code, new ConfigDescription("Currently selected language's code", (AcceptableValueBase)null, Array.Empty())); if (LanguageManager.GetLanguage(Language, out var language)) { LanguageManager.ChangeLanguage(language); } configTranslatorMode = config.Bind(ConfigDefinitions.TraslatorMode, false, new ConfigDescription("Enables the features of this section", (AcceptableValueBase)null, Array.Empty())); configCreateDefaultLanguageFiles = config.Bind(ConfigDefinitions.CreateDefaultLanguageFiles, true, new ConfigDescription("If enabled, files for the default game language will be created in the mod's directory on game load", (AcceptableValueBase)null, Array.Empty())); configReloadLanguageKeybind = config.Bind(ConfigDefinitions.ReloadLanguageKeybind, (KeyCode)291, new ConfigDescription("When you press this button, your current language's files will be reloaded mid-game", (AcceptableValueBase)null, Array.Empty())); configShowTranslationKey = config.Bind(ConfigDefinitions.ShowTranslationKey, (KeyCode)289, new ConfigDescription("Button to toggle showing translation keys instead of translated string for debugging.", (AcceptableValueBase)null, Array.Empty())); configExportExtra = config.Bind(ConfigDefinitions.ExportExtra, false, new ConfigDescription("Export quest and item data and image to markdown for translation referencing.", (AcceptableValueBase)null, Array.Empty())); configReloadFontBundlesKeybind = config.Bind(ConfigDefinitions.ReloadFontBundlesKeybind, (KeyCode)290, new ConfigDescription("When you press this button, the font bundles will be reloaded mid-game", (AcceptableValueBase)null, Array.Empty())); configSwitchTranslationKeybind = config.Bind(ConfigDefinitions.SwitchTranslationKeybind, (KeyCode)292, new ConfigDescription("When you press this button, the translation mode will be switched mid-game", (AcceptableValueBase)null, Array.Empty())); configLogVanillaFonts = config.Bind(ConfigDefinitions.LogVanillaFonts, false, new ConfigDescription("Log vanilla fonts to console", (AcceptableValueBase)null, Array.Empty())); } } internal class SettingsGUI { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__15_0; public static Func, string> <>9__17_0; public static Func <>9__17_1; internal void <.ctor>b__15_0() { } internal string b__17_0(KeyValuePair kv) { return kv.Key; } internal string b__17_1(string key) { return LanguageManager.languages[key].info.name; } } private AtlyssDropdown languageDropdown; private List languageKeys; private AtlyssToggle translatorModeToggle; private AtlyssToggle createDefaultLanguageFilesToggle; private AtlyssToggle exportExtraToggle; private AtlyssToggle logVanillaFontsToggle; private AtlyssKeyButton showTranslationKeybind; private AtlyssKeyButton reloadLanguageKeybind; private AtlyssKeyButton reloadFontBundlesKeybind; private AtlyssKeyButton switchTranslationKeybind; private AtlyssButton createMissingForCurrentLangButton; private AtlyssButton logUntranslatedStringsButton; private readonly List translatorModeElements = new List(); private static SettingsGUI instance; public static void Init() { if (instance == null) { instance = new SettingsGUI(); } } private SettingsGUI() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown Settings.OnInitialized.AddListener(new UnityAction(SetupSettingsTab)); UnityEvent onApplySettings = Settings.OnApplySettings; object obj = <>c.<>9__15_0; if (obj == null) { UnityAction val = delegate { }; <>c.<>9__15_0 = val; obj = (object)val; } onApplySettings.AddListener((UnityAction)obj); } private void SetupTranslatorModeElements() { SettingsTab tab = Settings.ModTab; SetupToggles(); SetupKeybind(); SetupButton(); void RegisterTranslatorModeElement(T element, TranslationKey key) where T : BaseAtlyssElement { translatorModeElements.Add((BaseAtlyssElement)(object)element); object obj = element; BaseAtlyssLabelElement val = (BaseAtlyssLabelElement)((obj is BaseAtlyssLabelElement) ? obj : null); if (val != null) { LangAdjustables.RegisterText(val.Label, key); } object obj2 = element; AtlyssButton val2 = (AtlyssButton)((obj2 is AtlyssButton) ? obj2 : null); if (val2 != null) { LangAdjustables.RegisterText(val2.ButtonLabel, key); } } void SetupButton() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown createMissingForCurrentLangButton = tab.AddButton(Localyssation.GetString(I18nKeys.Settings.Mod.ADD_MISSING_KEYS_TO_CURRENT_LANGUAGE), new UnityAction(OnAddMissingKeyButtonPressed)); translatorModeElements.Add((BaseAtlyssElement)(object)createMissingForCurrentLangButton); logUntranslatedStringsButton = tab.AddButton(Localyssation.GetString(I18nKeys.Settings.Mod.LOG_UNTRANSLATED_STRINGS), new UnityAction(OnLogUntranslated)); translatorModeElements.Add((BaseAtlyssElement)(object)logUntranslatedStringsButton); ((Object)createMissingForCurrentLangButton.Button).name = "CreateMissingForCurrentLangButton"; ((Object)logUntranslatedStringsButton.Button).name = "LogUntranslatedStringsButton"; } void SetupKeybind() { showTranslationKeybind = tab.AddKeyButton(LocalyssationConfig.configShowTranslationKey); RegisterTranslatorModeElement(showTranslationKeybind, I18nKeys.Settings.Mod.SHOW_TRANSLATION_KEY); reloadLanguageKeybind = tab.AddKeyButton(LocalyssationConfig.configReloadLanguageKeybind); RegisterTranslatorModeElement(reloadLanguageKeybind, I18nKeys.Settings.Mod.RELOAD_LANGUAGE_KEYBIND); reloadFontBundlesKeybind = tab.AddKeyButton(LocalyssationConfig.configReloadFontBundlesKeybind); RegisterTranslatorModeElement(reloadFontBundlesKeybind, I18nKeys.Settings.Mod.RELOAD_FONT_BUNDLES_KEYBIND); switchTranslationKeybind = tab.AddKeyButton(LocalyssationConfig.configSwitchTranslationKeybind); RegisterTranslatorModeElement(switchTranslationKeybind, I18nKeys.Settings.Mod.SWITCH_TRANSLATION_KEYBIND); } void SetupToggles() { createDefaultLanguageFilesToggle = tab.AddToggle(LocalyssationConfig.configCreateDefaultLanguageFiles); RegisterTranslatorModeElement(createDefaultLanguageFilesToggle, I18nKeys.Settings.Mod.CREATE_DEFAULT_LANGUAGE_FILES); exportExtraToggle = tab.AddToggle(LocalyssationConfig.configExportExtra); RegisterTranslatorModeElement(exportExtraToggle, I18nKeys.Settings.Mod.EXPORT_EXTRA); logVanillaFontsToggle = tab.AddToggle(LocalyssationConfig.configLogVanillaFonts); RegisterTranslatorModeElement(logVanillaFontsToggle, I18nKeys.Settings.Mod.LOG_VANILLA_FONTS); } } private void SetupSettingsTab() { SettingsTab modTab = Settings.ModTab; LangAdjustables.RegisterText(modTab.TabButton.Label, I18nKeys.Settings.BUTTON_MODS); modTab.AddHeader("Localyssation: Grupo Alhénix"); languageKeys = LanguageManager.languages.Select((KeyValuePair kv) => kv.Key).ToList(); int num = languageKeys.IndexOf(LanguageManager.CurrentLanguage.info.code); languageDropdown = modTab.AddDropdown("Language", languageKeys.Select((string key) => LanguageManager.languages[key].info.name).ToList(), num); languageDropdown.OnValueChanged.AddListener((UnityAction)OnLanguageDropdownChanged); LangAdjustables.RegisterText(((BaseAtlyssLabelElement)languageDropdown).Label, I18nKeys.Settings.Mod.LANGUAGE); translatorModeToggle = modTab.AddToggle(LocalyssationConfig.configTranslatorMode); translatorModeToggle.OnValueChanged.AddListener((UnityAction)OnTranslatorModeChanged); LangAdjustables.RegisterText(((BaseAtlyssLabelElement)translatorModeToggle).Label, I18nKeys.Settings.Mod.TRANSLATOR_MODE); SetupTranslatorModeElements(); OnTranslatorModeChanged(LocalyssationConfig.TranslatorMode); Localyssation.instance.OnLanguageChanged += OnLanguageChanged; OnLanguageChange(); } private static void ChangeAtlyssSettingsElementsEnabled(T uiElement, bool enabled) where T : BaseAtlyssElement { ((Component)((BaseAtlyssElement)uiElement).Root).gameObject.SetActive(enabled); } private void OnTranslatorModeChanged(bool value) { translatorModeElements.ForEach(delegate(BaseAtlyssElement v) { ChangeAtlyssSettingsElementsEnabled(v, value); }); } private void OnLanguageDropdownChanged(int valueIndex) { string text = languageKeys[valueIndex]; LanguageManager.ChangeLanguage(text); LocalyssationConfig.configLanguage.Value = text; } private void OnAddMissingKeyButtonPressed() { foreach (KeyValuePair @string in LanguageManager.DefaultLanguage.GetStrings()) { if (!LanguageManager.CurrentLanguage.ContainsKey(@string.Key)) { LanguageManager.CurrentLanguage.RegisterKey(@string.Key, @string.Value); } } LanguageManager.CurrentLanguage.WriteToFileSystem("missing"); } private void OnLogUntranslated() { int num = 0; int num2 = 0; Localyssation.logger.LogMessage((object)("Logging strings that are the same in " + LanguageManager.DefaultLanguage.info.name + " and " + LanguageManager.CurrentLanguage.info.name + ":")); foreach (KeyValuePair @string in LanguageManager.CurrentLanguage.GetStrings()) { if (LanguageManager.DefaultLanguage.GetStrings().TryGetValue(@string.Key, out var value)) { num2++; if (@string.Value == value) { Localyssation.logger.LogMessage((object)@string.Key); } else { num++; } } } Localyssation.logger.LogMessage((object)$"Done! {num}/{num2} ({(float)num / (float)num2 * 100f:0.00}%) strings are different between the languages."); } private void OnLanguageChange() { createMissingForCurrentLangButton.ButtonLabel.text = Localyssation.GetString(I18nKeys.Settings.Mod.ADD_MISSING_KEYS_TO_CURRENT_LANGUAGE); logUntranslatedStringsButton.ButtonLabel.text = Localyssation.GetString(I18nKeys.Settings.Mod.LOG_UNTRANSLATED_STRINGS); } public void OnLanguageChanged(Language newLanguage) { OnLanguageChange(); } ~SettingsGUI() { Localyssation.instance.OnLanguageChanged -= OnLanguageChanged; } } public class FontBundle { public string fileSystemPath; public readonly Dictionary fonts = new Dictionary(); public readonly Dictionary TMPfonts = new Dictionary(); public bool LoadFromFileSystem() { if (string.IsNullOrEmpty(fileSystemPath)) { return false; } AssetBundle val = AssetBundle.LoadFromFile(fileSystemPath); Localyssation.logger.LogInfo((object)("Loading font bundle `" + fileSystemPath + "`")); Localyssation.logger.LogInfo((object)"Found Fonts:"); CollectionExtensions.Do(val.LoadAllAssets(typeof(Font)).Cast(), (Action)delegate(Font font) { Localyssation.logger.LogInfo((object)("\t- " + ((Object)font).name)); fonts.Add(((Object)font).name, font); }); Localyssation.logger.LogInfo((object)"Found TMP_FontAsset:"); CollectionExtensions.Do(val.LoadAllAssets(typeof(TMP_FontAsset)).Cast(), (Action)delegate(TMP_FontAsset font) { Localyssation.logger.LogInfo((object)("\t- " + ((Object)font).name)); TMPfonts.Add(((Object)font).name, font); }); val.Unload(false); return true; } } public static class FontManager { private static readonly Dictionary availableFonts = new Dictionary(); private static readonly Dictionary availableTMP_FontAssets = new Dictionary(); public static TMP_FontAsset UNIFONT_SDF { get; private set; } public static bool UnifontLoaded { get; private set; } = false; public static IDictionary Fonts => availableFonts; public static IDictionary TMPfonts => availableTMP_FontAssets; public static void LoadFontBundlesFromFileSystem() { availableFonts.Clear(); availableTMP_FontAssets.Clear(); Resources.UnloadUnusedAssets(); string[] files = Directory.GetFiles(Paths.PluginPath, "*.fontbundle", SearchOption.AllDirectories); Localyssation.logger.LogInfo((object)$"Found {files.Length} fontBundles"); string[] array = files; foreach (string text in array) { FontBundle fontBundle = new FontBundle { fileSystemPath = text }; if (fontBundle.LoadFromFileSystem()) { RegisterFontBundle(fontBundle); } else { Localyssation.logger.LogError((object)("Error occured when loading font bundle `" + text + "`")); } } UNIFONT_SDF = TMPfonts["unifont SDF"]; UnifontLoaded = true; CollectionExtensions.DoIf(TMPfonts.Values.SkipWhile((TMP_FontAsset font) => (Object)(object)font == (Object)(object)UNIFONT_SDF), (Func)((TMP_FontAsset font) => !font.fallbackFontAssetTable.Contains(UNIFONT_SDF)), (Action)delegate(TMP_FontAsset font) { font.fallbackFontAssetTable.Add(UNIFONT_SDF); }); } private static void RegisterFontBundle(FontBundle fontBundle) { Extensions.AddRange(availableFonts, fontBundle.fonts); Extensions.AddRange(availableTMP_FontAssets, fontBundle.TMPfonts); } } public static class FontHelper { public static void DetectVanillaFonts() { Localyssation.logger.LogInfo((object)"Fonts used by Vanilla:"); CollectionExtensions.Do(Resources.LoadAll("").Cast(), (Action)delegate(Font font) { Localyssation.logger.LogInfo((object)("\t - " + ((Object)font).name)); }); Localyssation.logger.LogInfo((object)"TMP_FontAsset used by Vanilla:"); CollectionExtensions.Do(Resources.LoadAll("").Cast(), (Action)delegate(TMP_FontAsset font) { Localyssation.logger.LogInfo((object)("\t - " + ((Object)font).name)); }); Resources.UnloadUnusedAssets(); } } public class TranslationKey { public class TranslationKeyOptionGenerator { public readonly TranslationKey baseKey; public TranslationKey this[int index] => new TranslationKey(baseKey.key + $"_OPTION_{index}"); public TranslationKeyOptionGenerator(TranslationKey _baseKey) { baseKey = _baseKey; } } public static TranslationKey EMPTY = new TranslationKey(""); public readonly string key; public TranslationKey Name => new TranslationKey(key + "_NAME"); public TranslationKey NamePlural => new TranslationKey(key + "_NAME_PLURAL"); public TranslationKey Description => new TranslationKey(key + "_DESCRIPTION"); public TranslationKeyOptionGenerator Option => new TranslationKeyOptionGenerator(this); internal TranslationKey(string _key) { key = _key; } public static implicit operator string(TranslationKey key) { return key.key; } public override string ToString() { return key; } public string Localize(string defaultString = "") { return Localyssation.GetString(key, defaultString); } public string DefaultString() { return Localyssation.GetDefaultString(key); } public TranslationKey NameByQuantity(int quantity) { return (Math.Abs(quantity) > 1) ? NamePlural : Name; } public string Format(params object[] args) { return Localyssation.Format(this, args); } } public class QuestTranslationKey : TranslationKey { public TranslationKey CompleteReturnMessage => new TranslationKey(key + "_COMPLETE_RETURN_MESSAGE"); public TranslationKey CompleteReturnMessageTrack => new TranslationKey(key + "_COMPLETE_RETURN_MESSAGE_TRACK"); public QuestTranslationKey(string _key) : base(_key) { } } public class NetTriggerTranslationKey : TranslationKey { public readonly int MessageArrayLength; public TranslationKey SingleMessage => new TranslationKey(key + "_SINGLE_MESSAGE"); public NetTriggerTranslationKey(string _key, int messageArraySize) : base(_key) { MessageArrayLength = messageArraySize; } public TranslationKey MessageArray(int index) { return new TranslationKey(key + $"_MESSAGE_ARRAY_{index}"); } } public static class KeyUtil { public static string Normalize(string key) { return new string((from x in key.ToUpper().Replace(" ", "_").Replace("/", "_") where "ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789".Contains(x) select x).ToArray()); } public static NetTriggerTranslationKey GetForAsset(NetTrigger asset) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Scene scene = ((Component)asset).gameObject.scene; string name = ((Scene)(ref scene)).name; string name2 = ((Object)asset).name; return new NetTriggerTranslationKey(Normalize(name) + "_NET_TRIGGER_" + Normalize(name2.Substring(1)), asset._triggerMessage._triggerMessageArray.Length); } public unsafe static TranslationKey GetForAsset(QuestSubType asset) { return new TranslationKey("QUEST_SUBTYPE_" + Normalize(((object)(*(QuestSubType*)(&asset))/*cast due to .constrained prefix*/).ToString())); } public static TranslationKey GetForAsset(ScriptableItem asset) { return new TranslationKey("ITEM_" + Normalize(asset._itemName)); } public static TranslationKey GetForAsset(ScriptableConditionGroup asset) { return new TranslationKey("CONDITION_GROUP_" + Normalize(asset._conditionGroupTag)); } public static TranslationKey GetForAsset(ScriptableWeaponType asset) { return new TranslationKey("WEAPON_TYPE_" + Normalize(asset._weaponTypeClassTag)); } public static TranslationKey GetForAsset(ScriptableCreep asset) { return new TranslationKey("CREEP_" + Normalize(asset._creepName)); } public static QuestTranslationKey GetForAsset(ScriptableQuest asset) { return new QuestTranslationKey("QUEST_" + Normalize(asset._questName)); } public static TranslationKey GetForAsset(QuestTriggerRequirement asset) { return new TranslationKey("QUEST_TRIGGER_" + Normalize(asset._questTriggerTag)); } public static TranslationKey GetForAsset(ScriptableCondition asset) { return new TranslationKey("CONDITION_" + Normalize(asset._conditionName)); } public static TranslationKey GetForAsset(ScriptableStatModifier asset) { return new TranslationKey("STAT_MODIFIER_" + Normalize(asset._modifierTag) + "_TAG"); } public static TranslationKey GetForAsset(ScriptablePlayerRace asset) { return new TranslationKey("RACE_" + Normalize(asset._raceName)); } public static TranslationKey GetForAsset(ScriptableCombatElement asset) { return new TranslationKey("COMBAT_ELEMENT_" + Normalize(asset._elementName)); } public static TranslationKey GetForAsset(ScriptablePlayerBaseClass asset) { return new TranslationKey("PLAYER_CLASS_" + Normalize(asset._className)); } public static TranslationKey GetForAsset(ScriptableSkill asset) { return new TranslationKey("SKILL_" + Normalize(asset._skillName)); } public static TranslationKey GetForAsset(ScriptableStatAttribute asset) { return new TranslationKey("STAT_ATTRIBUTE_" + Normalize(asset._attributeName)); } public unsafe static TranslationKey GetForAsset(ItemRarity asset) { return new TranslationKey("ITEM_RARITY_" + Normalize(((object)(*(ItemRarity*)(&asset))/*cast due to .constrained prefix*/).ToString())); } public unsafe static TranslationKey GetForAsset(DamageType asset) { return new TranslationKey("DAMAGE_TYPE_" + Normalize(((object)(*(DamageType*)(&asset))/*cast due to .constrained prefix*/).ToString())); } public unsafe static TranslationKey GetForAsset(SkillControlType asset) { return new TranslationKey("SKILL_CONTROL_TYPE_" + Normalize(((object)(*(SkillControlType*)(&asset))/*cast due to .constrained prefix*/).ToString())); } public unsafe static TranslationKey GetForAsset(CombatColliderType asset) { return new TranslationKey("COMBAT_COLLIDER_TYPE_" + Normalize(((object)(*(CombatColliderType*)(&asset))/*cast due to .constrained prefix*/).ToString())); } public static TranslationKey GetForAsset(ScriptableDialogData asset) { return new TranslationKey(Normalize(((Object)asset).name.ToString()) ?? ""); } public unsafe static TranslationKey GetForAsset(ItemType asset) { return new TranslationKey("ITEM_TOOLTIP_TYPE_" + Normalize(((object)(*(ItemType*)(&asset))/*cast due to .constrained prefix*/).ToString())); } public static TranslationKey GetForAsset(PlayerClassTier asset) { return new TranslationKey("PLAYER_CLASS_TIER_" + Normalize(asset._classTierName)); } public unsafe static TranslationKey GetForAsset(ZoneType asset) { return new TranslationKey("ZONE_TYPE_" + Normalize(((object)(*(ZoneType*)(&asset))/*cast due to .constrained prefix*/).ToString())); } public static TranslationKey GetForMapRegionTag(string regionTag) { if (!string.IsNullOrEmpty(regionTag)) { return new TranslationKey("MAP_REGION_TAG_" + Normalize(regionTag)); } return TranslationKey.EMPTY; } public unsafe static TranslationKey GetForAsset(SkillToolTipRequirement asset) { return new TranslationKey("SKILL_TOOLTIP_REQUIREMENT_" + Normalize(((object)(*(SkillToolTipRequirement*)(&asset))/*cast due to .constrained prefix*/).ToString())); } public static TranslationKey GetForMapName(string name) { return new TranslationKey("MAP_NAME_" + Normalize(name)); } public static TranslationKey GetForAsset(ScriptableShopkeep asset) { return new TranslationKey("SHOP_KEEP_" + Normalize(asset._shopName)); } public unsafe static TranslationKey GetForAsset(ShopTab shopTab) { return new TranslationKey("SHOP_TAB_" + Normalize(((object)(*(ShopTab*)(&shopTab))/*cast due to .constrained prefix*/).ToString())); } } internal static class LogHelper { public static void LogInstructions(this IEnumerable instructions, string header = "Instructions:") { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(header); int num = 0; foreach (CodeInstruction instruction in instructions) { stringBuilder.AppendLine($"{num}: {instruction}"); num++; } Localyssation.LogDebug(stringBuilder.ToString()); } } public enum VanillaFonts { [Description("Roskell")] Roskell, [Description("terminal-grotesque")] TERMINAL_GROTESQUE } public static class EnumExtensions { public static string GetDescription(this Enum value) { FieldInfo field = value.GetType().GetField(value.ToString()); DescriptionAttribute descriptionAttribute = (DescriptionAttribute)Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)); return (descriptionAttribute == null) ? value.ToString() : descriptionAttribute.Description; } } public static class PathUtil { 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 string GetPath(Transform transform) { string text = ((Object)transform).name; Transform val = transform; while ((Object)(object)val.parent != (Object)null) { val = val.parent; text = ((Object)val).name + "/" + text; } return text; } } 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 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(); foreach (Text val2 in componentsInChildren) { if (val2.text == "Loading...") { LangAdjustables.RegisterText(val2, LangAdjustables.GetStringFunc("GAME_LOADING", val2.text)); val2.alignment = (TextAnchor)5; } } List GetRootGameObjects() { List list = new List(); ((Scene)(ref scene)).GetRootGameObjects(list); return list; } } } } namespace Localyssation.Patches { internal static class GameLoadPatches { private static readonly List excludedSceneNames = new List { "00_bootStrapper", "01_rootScene" }; [HarmonyPatch(typeof(GameManager), "Cache_ScriptableAssets")] [HarmonyPostfix] public static void GameManager_Cache_ScriptableAssets(GameManager __instance) { Localyssation.logger.LogMessage((object)"Dynamically registering I18n keys for scriptables and dialogs."); if (LocalyssationConfig.ExportExtra) { ExportUtil.InitExports(); } RegisterCachedScriptableObjects(__instance._cachedScriptableItems, delegate(ScriptableItem item) { TranslationKey forAsset11 = KeyUtil.GetForAsset(item); LanguageManager.RegisterKey(forAsset11.Name, item._itemName); LanguageManager.RegisterKey(forAsset11.NamePlural, item._itemName); LanguageManager.RegisterKey(forAsset11.Description, item._itemDescription); }); CollectionExtensions.Do((IEnumerable)__instance._cachedScriptableCreeps.Values, (Action)delegate(ScriptableCreep creep) { TranslationKey forAsset11 = KeyUtil.GetForAsset(creep); LanguageManager.RegisterKey(forAsset11.Name, creep._creepName); LanguageManager.RegisterKey(forAsset11.NamePlural, creep._creepName + "s"); }); foreach (ScriptableQuest value3 in __instance._cachedScriptableQuests.Values) { QuestTranslationKey forAsset = KeyUtil.GetForAsset(value3); LanguageManager.RegisterKey(forAsset.Name, value3._questName); LanguageManager.RegisterKey(forAsset.Description, value3._questDescription); LanguageManager.RegisterKey(forAsset.CompleteReturnMessage, value3._questCompleteReturnMessage); LanguageManager.RegisterKey(forAsset.CompleteReturnMessageTrack, value3._questCompleteReturnMessage); QuestTriggerRequirement[] questTriggerRequirements = value3._questObjective._questTriggerRequirements; foreach (QuestTriggerRequirement val in questTriggerRequirements) { LanguageManager.RegisterKey($"{KeyUtil.GetForAsset(val)}_PREFIX", val._prefix); LanguageManager.RegisterKey($"{KeyUtil.GetForAsset(val)}_SUFFIX", val._suffix); } } foreach (ScriptableCondition value4 in __instance._cachedScriptableConditions.Values) { TranslationKey forAsset2 = KeyUtil.GetForAsset(value4); LanguageManager.RegisterKey(forAsset2.Name, value4._conditionName); LanguageManager.RegisterKey(forAsset2.Description, value4._conditionDescription); } foreach (ScriptableStatModifier value5 in __instance._cachedScriptableStatModifiers.Values) { TranslationKey forAsset3 = KeyUtil.GetForAsset(value5); LanguageManager.RegisterKey($"{forAsset3}", value5._modifierTag); } foreach (ScriptablePlayerRace value6 in __instance._cachedScriptableRaces.Values) { TranslationKey forAsset4 = KeyUtil.GetForAsset(value6); LanguageManager.RegisterKey(forAsset4.Name, value6._raceName); LanguageManager.RegisterKey(forAsset4.Description, value6._raceDescription); LanguageManager.RegisterKey($"{forAsset4}_MISC", value6._miscName); } foreach (ScriptableCombatElement value7 in __instance._cachedScriptableCombatElements.Values) { TranslationKey forAsset5 = KeyUtil.GetForAsset(value7); LanguageManager.RegisterKey(forAsset5.Name, value7._elementName); } LanguageManager.RegisterKey("PLAYER_CLASS_EMPTY_NAME", GameManager._current._statLogics._emptyClassName); foreach (ScriptablePlayerBaseClass value8 in __instance._cachedScriptablePlayerClasses.Values) { TranslationKey forAsset6 = KeyUtil.GetForAsset(value8); LanguageManager.RegisterKey(forAsset6.Name, value8._className); PlayerClassTier[] playerClassTiers = value8._playerClassTiers; foreach (PlayerClassTier val2 in playerClassTiers) { LanguageManager.RegisterKey(KeyUtil.GetForAsset(val2).Name, val2._classTierName); } } foreach (ScriptableSkill value9 in __instance._cachedScriptableSkills.Values) { TranslationKey forAsset7 = KeyUtil.GetForAsset(value9); LanguageManager.RegisterKey(forAsset7.Name, value9._skillName); LanguageManager.RegisterKey(forAsset7.Description, value9._skillDescription); } ScriptableStatAttribute[] statAttributes = GameManager._current._statLogics._statAttributes; foreach (ScriptableStatAttribute val3 in statAttributes) { TranslationKey forAsset8 = KeyUtil.GetForAsset(val3); LanguageManager.RegisterKey(forAsset8.Name, val3._attributeName); LanguageManager.RegisterKey($"{forAsset8}_DESCRIPTOR", val3._attributeDescriptor); } foreach (ScriptableConditionGroup value10 in GameManager._current._cachedScriptableConditionGroups.Values) { TranslationKey forAsset9 = KeyUtil.GetForAsset(value10); LanguageManager.RegisterKey($"{forAsset9}_NAME", value10._conditionGroupTag); } ScriptableWeaponType[] array = Resources.LoadAll(""); foreach (ScriptableWeaponType val4 in array) { string key = KeyUtil.GetForAsset(val4); LanguageManager.RegisterKey(key, val4._weaponTypeClassTag); } ScriptableDialogData[] array2 = Resources.LoadAll(""); foreach (ScriptableDialogData val5 in array2) { TranslationKey forAsset10 = KeyUtil.GetForAsset(val5); LanguageManager.RegisterKey($"{forAsset10}_NAME_TAG", val5._nameTag); Dictionary dictionary = new Dictionary { { val5._dialogBranches, "BRANCH" }, { val5._introductionBranches, "INTRODUCTION_BRANCH" } }; foreach (KeyValuePair item in dictionary) { DialogBranch[] key2 = item.Key; string value = item.Value; for (int num6 = 0; num6 < key2.Length; num6++) { DialogBranch branch = key2[num6]; RegisterKeysForDialogBranch(forAsset10, $"{value}_{num6}", branch); } } Dictionary dictionary2 = new Dictionary { { val5._shopkeepResponses, "SHOPKEEP_RESPONSE" }, { val5._shopkeepRejections, "SHOPKEEP_REJECTION" }, { val5._questAcceptResponses, "QUEST_ACCEPT_RESPONSE" }, { val5._questCompleteResponses, "QUEST_COMPLETE_RESPONSE" } }; foreach (KeyValuePair item2 in dictionary2) { string[] key3 = item2.Key; string value2 = item2.Value; for (int num7 = 0; num7 < key3.Length; num7++) { string text = key3[num7]; string text2 = $"{forAsset10}_{value2}_{num7}"; RTReplacer.dialogManagerQuickSentencesHack[text] = text2; LanguageManager.RegisterKey(text2, text); } } if (val5._scriptableQuests.Length != 0 && LocalyssationConfig.ExportExtra) { new ScriptableQuestExporter(val5._nameTag).Export(val5._scriptableQuests); } } Resources.LoadAll("").ToList().ForEach(delegate(ScriptableShopkeep scriptableShopkeep) { LanguageManager.RegisterKey(string.Concat(KeyUtil.GetForAsset(scriptableShopkeep), "_SHOP_NAME"), scriptableShopkeep._shopName); }); if (LocalyssationConfig.TranslatorMode && LocalyssationConfig.CreateDefaultLanguageFiles) { ((MonoBehaviour)Localyssation.instance).StartCoroutine(RegisterSceneSpecificStrings()); } LanguageManager.RegisterKey("FORMAT_QUEST_MENU_CELL_REWARD_CURRENCY", "{0} " + GameManager._current._statLogics._currencyName); if (LocalyssationConfig.ExportExtra) { new ScriptableItemExporter().Export(GameManager._current._cachedScriptableItems.Values); } if (LocalyssationConfig.TranslatorMode && LocalyssationConfig.CreateDefaultLanguageFiles) { LanguageManager.UpdateDefaultLanguageFile(); } Resources.UnloadUnusedAssets(); } private static void RegisterCachedScriptableObjects(IDictionary scriptables, Action action) { scriptables.Values.ToList().ForEach(action); } private static IEnumerator RegisterSceneSpecificStrings() { for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++) { string scenePath = SceneUtility.GetScenePathByBuildIndex(i); if (!excludedSceneNames.Any((string x) => scenePath.Contains(x))) { yield return SceneManager.LoadSceneAsync(scenePath, (LoadSceneMode)1); Scene scene = SceneManager.GetSceneByPath(scenePath); if (((Scene)(ref scene)).IsValid()) { string sceneName = ((Scene)(ref scene)).name; RegisterDialogTriggers(sceneName); RegisterMapVisualOverrideTrigger(sceneName); RegisterMapInstance(sceneName); RegisterNetTriggers(sceneName); yield return SceneManager.UnloadSceneAsync(scene); } } } yield return Resources.UnloadUnusedAssets(); LanguageManager.UpdateDefaultLanguageFile(); } private static void RegisterKeysForDialogBranch(string dialogDataKey, string keySuffixBranch, DialogBranch branch) { for (int i = 0; i < branch.dialogs.Length; i++) { Dialog val = branch.dialogs[i]; LanguageManager.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++) { LanguageManager.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]; LanguageManager.RegisterKey($"{dialogDataKey}_{keySuffixBranch}_DIALOG_{i}_SELECTION_{k}", val2._selectionCaption); } } } private static Func IsInSceneGenerator(string sceneName) { return delegate(MonoBehaviour o) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Scene scene = ((Component)o).gameObject.scene; return ((Scene)(ref scene)).name == sceneName; }; } private static void RegisterDialogTriggers(string sceneName) { CollectionExtensions.Do(from DialogTrigger o in ((IEnumerable)(object)Object.FindObjectsOfType(true)).Where(IsInSceneGenerator(sceneName)) where o._useLocalDialogBranch select o, (Action)delegate(DialogTrigger dialogTrigger) { TranslationKey forAsset = KeyUtil.GetForAsset(dialogTrigger._scriptDialogData); RegisterKeysForDialogBranch(forAsset, KeyUtil.Normalize("LOCAL_BRANCH_" + sceneName + "_" + PathUtil.GetChildTransformPath(((Component)dialogTrigger).transform, 2)), dialogTrigger._localDialogBranch); }); } private static void RegisterMapVisualOverrideTrigger(string sceneName) { CollectionExtensions.Do(((IEnumerable)(object)Object.FindObjectsOfType(true)).Where(IsInSceneGenerator(sceneName)).Cast(), (Action)delegate(MapVisualOverrideTrigger mapVisualOverrideTrigger) { string reigonName = mapVisualOverrideTrigger._reigonName; LanguageManager.RegisterKey(KeyUtil.GetForMapRegionTag(reigonName), reigonName); }); } private static void RegisterMapInstance(string sceneName) { CollectionExtensions.Do(((IEnumerable)(object)Object.FindObjectsOfType(true)).Where(IsInSceneGenerator(sceneName)).Cast(), (Action)delegate(MapInstance mapInstance) { string mapName = mapInstance._mapName; LanguageManager.RegisterKey(KeyUtil.GetForMapName(mapName), mapName); }); } private static void RegisterNetTriggers(string sceneName) { CollectionExtensions.Do(from NetTrigger netTrigger in ((IEnumerable)(object)Object.FindObjectsOfType(true)).Where(IsInSceneGenerator(sceneName)) where netTrigger._triggerMessage != null select netTrigger, (Action)delegate(NetTrigger netTrigger) { string name = ((Object)netTrigger).name; TriggerMessage triggerMessage = netTrigger._triggerMessage; if (!string.IsNullOrEmpty(triggerMessage._singleMessage)) { LanguageManager.RegisterKey(KeyUtil.GetForAsset(netTrigger).SingleMessage, triggerMessage._singleMessage); } if (triggerMessage._triggerMessageArray.Length != 0) { triggerMessage._triggerMessageArray.Select(delegate(string msg, int idx) { if (!string.IsNullOrEmpty(triggerMessage._triggerMessageArray[idx])) { LanguageManager.RegisterKey(KeyUtil.GetForAsset(netTrigger).MessageArray(idx), triggerMessage._triggerMessageArray[idx]); } return true; }).All((bool o) => o); } }); } } public static class MemberAccessor { public static FieldInfo GetFieldInfo(Expression> expr) { if (expr.Body is MemberExpression memberExpression) { return (FieldInfo)memberExpression.Member; } if (expr.Body is UnaryExpression { Operand: MemberExpression operand }) { return (FieldInfo)operand.Member; } throw new ArgumentException($"Expression {expr} is not a member access expression.", "expr"); } } public class TargetInnerMethod { public string InnerMethodName { get; set; } public string ParentMethodName { get; set; } public bool MatchParameters { get; set; } = false; public List ParametersTypes { get; set; } = new List(); public bool MatchReturnType { get; set; } = false; public Type ReturnType { get; set; } public Type Type { get; set; } public bool IsMatch(MethodInfo method) { if (!CheckNamePattern(method.Name)) { return false; } if (MatchReturnType && !CheckReturnType(method)) { return false; } if (MatchParameters && !CheckParameters(method)) { return false; } return true; } private bool CheckNamePattern(string methodName) { bool flag = string.IsNullOrEmpty(ParentMethodName) || methodName.Contains(ParentMethodName); bool flag2 = string.IsNullOrEmpty(InnerMethodName) || methodName.Contains(InnerMethodName); bool flag3 = methodName.Contains("g__") || methodName.Contains("|") || methodName.Contains("_"); return flag && flag2 && flag3; } private bool CheckReturnType(MethodInfo method) { return method.ReturnType == ReturnType; } private bool CheckParameters(MethodInfo method) { ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length != ParametersTypes.Count) { return false; } for (int i = 0; i < parameters.Length; i++) { if (ParametersTypes[i] != null && !ParametersTypes[i].IsAssignableFrom(parameters[i].ParameterType)) { return false; } } return true; } public MethodInfo LocateOne(BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic) { IEnumerable source = FindAll(bindingFlags); if (source.Count() > 1) { throw new ArgumentOutOfRangeException("More than 1 method is found. Type=" + Type.Name + ", InnerMethodName=" + InnerMethodName + ", ParentMethodName=" + ParentMethodName); } if (source.Count() == 0) { throw new ArgumentOutOfRangeException("No method is found. Type=" + Type.Name + ", InnerMethodName=" + InnerMethodName + ", ParentMethodName=" + ParentMethodName); } return source.First(); } public MethodInfo LocateOneOrNull(BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic) { IEnumerable source = FindAll(bindingFlags); if (source.Count() > 1 || source.Count() == 0) { return null; } return source.First(); } public IEnumerable FindAll(BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic) { return Type.GetMethods(bindingFlags).Where(IsMatch); } public MethodInfo GetParentMethodInfo(BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic) { return (from m in Type.GetMethods(bindingFlags) where m.Name == ParentMethodName select m).DefaultIfEmpty(null).FirstOrDefault(); } } public static class TranspilerHelper { public static readonly CodeMatch STRING_CONCAT = new CodeMatch((Func)((CodeInstruction instr) => instr.opcode == OpCodes.Call && instr.operand is MethodInfo methodInfo && methodInfo.DeclaringType == typeof(string) && methodInfo.Name == "Concat"), (string)null); public static MethodInfo GenerateTargetMethod(TargetInnerMethod target) { try { return target.LocateOne(); } catch (Exception ex) { Localyssation.logger.LogError((object)ex.Message); Localyssation.logger.LogError((object)ex.StackTrace); } return target.GetParentMethodInfo(); } public static IEnumerable MatchAndReplace(IEnumerable instructions, CodeMatch[] matches, CodeInstruction[] replacement) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, matches).RemoveInstructions(matches.Length).Insert(replacement) .Instructions(); } public static CodeMatch MatchMethodCall(MethodInfo method, OpCode? opcode = null) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown return new CodeMatch((OpCode?)(opcode ?? (method.IsStatic ? OpCodes.Call : OpCodes.Callvirt)), (object)method, (string)null); } public static CodeMatcher ReplaceParamsStack(CodeMatcher matcher, int length) { return matcher.Advance(-length).RemoveInstructions(length); } public static CodeMatcher RemoveMethodCallParamsStackForward(CodeMatcher matcher, MethodInfo method, int _ILCodeLength, OpCode? opcode = null) { return ReplaceParamsStack(matcher.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { MatchMethodCall(method, opcode) }), _ILCodeLength); } public static CodeMatch LdfldMatch(this MemberInfo fieldInfo) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown return new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null); } public static CodeInstruction LdfldInstruction(this MemberInfo fieldInfo) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown return new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo); } } internal struct ILCodeReplacement { public readonly CodeMatch[] matches; public readonly CodeInstruction[] replacement; public ILCodeReplacement(CodeMatch[] matches, CodeInstruction[] replacement) { this.matches = matches; this.replacement = replacement; } } } namespace Localyssation.Patches.ReplaceText { internal static class MessageCallbacks { public static readonly MethodInfo Start_QuickSentence = AccessTools.Method(typeof(DialogManager), "Start_QuickSentence", new Type[1] { typeof(string) }, (Type[])null); public static readonly MethodInfo Init_GameLogicMessage = AccessTools.Method(typeof(ChatBehaviour), "Init_GameLogicMessage", new Type[1] { typeof(string) }, (Type[])null); public static readonly MethodInfo New_ChatMessage = AccessTools.Method(typeof(ChatBehaviour), "New_ChatMessage", new Type[1] { typeof(string) }, (Type[])null); } internal static class RTReplacer { internal static Dictionary dialogManagerQuickSentencesHack = new Dictionary(); private static readonly List consumableEffectDescKeys = new List { I18nKeys.Item.TOOLTIP_CONSUMABLE_DESCRIPTION_HEALTH_APPLY, I18nKeys.Item.TOOLTIP_CONSUMABLE_DESCRIPTION_MANA_APPLY, I18nKeys.Item.TOOLTIP_CONSUMABLE_DESCRIPTION_STAMINA_APPLY, I18nKeys.Item.TOOLTIP_CONSUMABLE_DESCRIPTION_EXP_GAIN }; private static Text cachedStorageHeader; private static ScriptableQuest cachedQuest; private static QuestMenuCell cachedQuestCell; private static List cachedQuestTrackElements = new List(); private static List USED_FONT_NAME = new List(); [HarmonyPatch(typeof(DeathPromptManager), "Handle_DeathPromptWindow")] [HarmonyTranspiler] private static IEnumerable DeathPromptManager__Handle_DeathPromptWindow__Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceStrings(new TranslationKey[1] { I18nKeys.DeathPrompt.USER_TIER_PROMPT_FORMAT }).Unwrap(); } [HarmonyPatch(typeof(DeathPromptManager), "Start")] [HarmonyPostfix] private static void DeathPromptManager__Start__Postfix(DeathPromptManager __instance) { RTUtil.RemapChildTextsByPath(((Component)__instance).transform, new Dictionary { { "Canvas_DeathPrompt/Dolly_deathPromptWindow/_deathPromptHeader", I18nKeys.DeathPrompt.DEATH_PROMPT_HEADER }, { "Canvas_DeathPrompt/Dolly_deathPromptWindow/_deathPromptBackdrop/_button_releaseDeathPrompt/_text_releaseSoul", I18nKeys.DeathPrompt.DEATH_PROMPT_RELEASE_SOUL_BUTTON } }); } [HarmonyPatch(typeof(DialogManager), "Start_Dialog")] [HarmonyTranspiler] public static IEnumerable DialogManager_Start_Dialog_Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(Dialog), "_dialogInput"), (string)null) }).MatchBack(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((Func)((CodeInstruction x) => CodeInstructionExtensions.IsLdloc(x, (LocalBuilder)null)), (string)null) }); int intOperand = RTUtil.GetIntOperand(val); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(DialogManager), "_dialogSentences"), (string)null) }).MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((Func)((CodeInstruction x) => (x.opcode == OpCodes.Call || x.opcode == OpCodes.Callvirt) && ((MethodInfo)x.operand).Name == "Enqueue"), (string)null) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Ldloc, (object)intOperand), Transpilers.EmitDelegate>((Func)delegate(string oldString, DialogManager __instance, DialogBranch dialogBranch, Dialog dialog) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) TranslationKey key; if (Object.op_Implicit((Object)(object)__instance._scriptableDialog)) { key = KeyUtil.GetForAsset(__instance._scriptableDialog); DialogTrigger currentDialogTrigger = __instance._currentDialogTrigger; if (Object.op_Implicit((Object)(object)currentDialogTrigger) && currentDialogTrigger._useLocalDialogBranch) { Scene scene = ((Component)currentDialogTrigger).gameObject.scene; return Localyssation.GetString(GetInputKey(KeyUtil.Normalize("LOCAL_BRANCH_" + ((Scene)(ref scene)).name + "_" + PathUtil.GetChildTransformPath(((Component)currentDialogTrigger).transform, 2))), oldString); } Dictionary dictionary = new Dictionary { { __instance._scriptableDialog._dialogBranches, "BRANCH" }, { __instance._scriptableDialog._introductionBranches, "INTRODUCTION_BRANCH" } }; foreach (KeyValuePair item in dictionary) { DialogBranch[] key2 = item.Key; string value = item.Value; if (key2.Contains(dialogBranch)) { int num = Array.IndexOf(key2, dialogBranch); return Localyssation.GetString(GetInputKey($"{value}_{num}"), oldString); } } } return oldString; string GetInputKey(string keySuffixBranch) { int num2 = Array.IndexOf(dialogBranch.dialogs, dialog); string text = $"{key}_{keySuffixBranch}_DIALOG_{num2}_INPUT"; if (dialog._altInputs != null && dialog._altInputs.Length != 0) { text += $"_ALT_{Random.Range(0, dialog._altInputs.Length)}"; } return text; } }) }); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(DialogManager), "Display_NextSentence")] [HarmonyPostfix] public static void DialogManager_Display_NextSentence(DialogManager __instance) { if (Object.op_Implicit((Object)(object)__instance._scriptableDialog)) { TranslationKey forAsset = KeyUtil.GetForAsset(__instance._scriptableDialog); if (((UIBehaviour)__instance._characterNameText).IsActive()) { __instance._characterNameText.text = Localyssation.GetString($"{forAsset}_NAME_TAG", __instance._characterNameText.text, __instance._characterNameText.fontSize); } } } [HarmonyPatch(typeof(DialogManager), "Create_DialogSelectionButton")] [HarmonyPostfix] public static void DialogManager_Create_DialogSelectionButton(DialogManager __instance, DialogSelection _dialogSelection) { //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) if (__instance._selectionButtons.Count <= 0 || !Object.op_Implicit((Object)(object)__instance._scriptableDialog)) { return; } TranslationKey forAsset = KeyUtil.GetForAsset(__instance._scriptableDialog); Button val = __instance._selectionButtons[__instance._selectionButtons.Count - 1]; Text componentInChildren = ((Component)val).GetComponentInChildren(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return; } Dictionary dictionary = new Dictionary { { __instance._scriptableDialog._dialogBranches, "BRANCH" }, { __instance._scriptableDialog._introductionBranches, "INTRODUCTION_BRANCH" } }; bool flag = false; foreach (KeyValuePair item in dictionary) { DialogBranch[] key = item.Key; string value = item.Value; int num = 0; while (num < key.Length) { DialogBranch val2 = key[num]; int num2 = 0; while (true) { if (num2 < val2.dialogs.Length) { Dialog val3 = val2.dialogs[num2]; int num3 = 0; while (true) { if (num3 < val3._dialogSelections.Length) { DialogSelection val4 = val3._dialogSelections[num3]; if (val4 == _dialogSelection) { componentInChildren.text = Localyssation.GetString($"{forAsset}_{value}_{num}_DIALOG_{num2}_SELECTION_{num3}", componentInChildren.text, componentInChildren.fontSize); flag = true; goto end_IL_01b2; } num3++; continue; } num2++; break; } continue; } num++; break; } } continue; end_IL_01b2: break; } if (flag || !((Object)(object)__instance._currentDialogTrigger != (Object)null) || !__instance._currentDialogTrigger._useLocalDialogBranch) { return; } forAsset = KeyUtil.GetForAsset(__instance._scriptableDialog); DialogTrigger currentDialogTrigger = __instance._currentDialogTrigger; DialogBranch localDialogBranch = __instance._currentDialogTrigger._localDialogBranch; Scene scene = ((Component)currentDialogTrigger).gameObject.scene; string name = ((Scene)(ref scene)).name; string text = KeyUtil.Normalize("LOCAL_BRANCH_" + name + "_" + PathUtil.GetChildTransformPath(((Component)currentDialogTrigger).transform, 2)); for (int i = 0; i < localDialogBranch.dialogs.Length; i++) { Dialog val5 = localDialogBranch.dialogs[i]; for (int j = 0; j < val5._dialogSelections.Length; j++) { DialogSelection val6 = val5._dialogSelections[j]; if (val6 == _dialogSelection) { string text2 = $"{forAsset}_{text}_DIALOG_{i}_SELECTION_{j}"; Localyssation.logger.LogInfo((object)text2); componentInChildren.text = Localyssation.GetString(text2, componentInChildren.text, componentInChildren.fontSize); flag = true; return; } } } } [HarmonyPatch(typeof(DialogManager), "Start_QuickSentence")] [HarmonyPrefix] public static void DialogManager_Start_QuickSentence(DialogManager __instance, ref string _sentence) { if (dialogManagerQuickSentencesHack.TryGetValue(_sentence, out var value)) { _sentence = Localyssation.GetString(value, _sentence); } } [HarmonyPatch(typeof(DungeonPortalManager), "Update")] [HarmonyTranspiler] public static IEnumerable DungeonPortalManager__Update__Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[1] { I18nKeys.Lore.DUNGEON_PORTAL_ENTER_LEVELED_FORMAT }, allowRepeat: true); } [HarmonyPatch(typeof(DungeonPortalManager), "Update")] [HarmonyPostfix] public static void DungeonPortalManager__Update__Postfix(DungeonPortalManager __instance) { __instance._dungeonNameHeaderText.text = "- " + Localyssation.GetString(KeyUtil.GetForMapName(__instance._scenePortal._portalCaptionTitle)) + " -"; } [HarmonyPatch(typeof(EnchanterManager), "Awake")] [HarmonyPostfix] public static void EnchanterManager_Awake_Postfix(EnchanterManager __instance) { RTUtil.RemapAllTextUnderObject(((Component)__instance).gameObject, new Dictionary()); } [HarmonyPatch(typeof(EnchanterManager), "Handle_EnchanterBehavior")] [HarmonyTranspiler] public static IEnumerable EnchanterManager_Handle_EnchanterBehavior_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[6] { I18nKeys.Enchanter.BUTTON_ENCHANT_ENCHANT, I18nKeys.Enchanter.BUTTON_ENCHANT_REROLL, I18nKeys.Enchanter.BUTTON_ENCHANT_UNABLE, I18nKeys.Enchanter.STATUS_NO_ENCHANT, I18nKeys.Enchanter.STATUS_UNABLE_TO_ENCHANT, I18nKeys.Enchanter.BUTTON_ENCHANT_INSERT_ITEM }.Concat(I18nKeys.Enchanter.BUTTON_TRANSMUTE), allowRepeat: true); } [HarmonyPatch(typeof(EnchanterManager), "Handle_EnchanterBehavior")] [HarmonyPostfix] public static void EnchanterManager_Handle_EnchanterBehavior_Postfix(EnchanterManager __instance) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Invalid comparison between Unknown and I4 if (!__instance._isOpen || !Object.op_Implicit((Object)(object)__instance._scriptEquipment)) { return; } ScriptableEquipment _scriptEquipment = __instance._scriptEquipment; bool flag = Object.op_Implicit((Object)(object)_scriptEquipment) && _scriptEquipment._statModifierCost != null && Object.op_Implicit((Object)(object)_scriptEquipment._statModifierCost._scriptItem); if ((int)((ScriptableItem)_scriptEquipment)._itemRarity < 2 && Object.op_Implicit((Object)(object)_scriptEquipment._statModifierTable)) { int num = ((ScriptableItem)_scriptEquipment)._vendorCost * 3; __instance._currencyPriceText.text = $"{num} {Localyssation.GetString(I18nKeys.Lore.CROWN_PLURAL)}"; if (flag) { int num2 = Player._mainPlayer._pInventory._heldItems.Where((ItemData item) => item._itemName == _scriptEquipment._statModifierCost._scriptItem._itemName).Aggregate(0, (int sum, ItemData itemdata) => sum + itemdata._quantity); __instance._tradeItemPriceText.text = $"{num2}/{_scriptEquipment._statModifierCost._scriptItemQuantity} " + Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(_scriptEquipment._statModifierCost._scriptItem), "_NAME")); } } if (__instance._setItemData._modifierID > 0) { ScriptableStatModifier asset = GameManager._current.Locate_StatModifier(__instance._setItemData._modifierID); __instance._currentEnchantmentText.text = Localyssation.GetString(I18nKeys.Enchanter.STATUS_CURRENT_ENCHANTMENT) + Localyssation.GetString(KeyUtil.GetForAsset(asset)); } } [HarmonyPatch(typeof(TooltipElement), "Awake")] [HarmonyPostfix] public static void EquipToolTip__Awake__Postfix(TooltipElement __instance) { EquipToolTip val = (EquipToolTip)(object)((__instance is EquipToolTip) ? __instance : null); if (val == null) { return; } Dictionary dictionary = new Dictionary(); Text[] componentsInChildren = ((Component)val).GetComponentsInChildren(); foreach (Text val2 in componentsInChildren) { Match match = Regex.Match(((Object)val2).name, "_statCell_(\\w*)Tag"); if (!match.Success) { continue; } string value = match.Groups[1].Value; string key = "_statCell_" + value + "/_statCell_" + value + "Tag"; if (Regex.IsMatch(value, "resist[A-Z][a-z]*")) { key = "_statCell_" + Regex.Replace(value, "[A-Z]", (Match s) => "_" + s.Value.ToLower()) + "/_statCell_" + value + "Tag"; } string value2 = I18nKeys.Equipment.statDisplayKey(value); dictionary[key] = value2; } RTUtil.RemapChildTextsByPath(((Component)val._attackPowerTag).transform.parent.parent, dictionary); } [HarmonyPatch(typeof(EquipToolTip), "Apply_EquipStats")] [HarmonyPostfix] public static void EquipToolTip_Apply_EquipStats(EquipToolTip __instance, ScriptableEquipment _scriptEquip, ItemData _itemData) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_scriptEquip) || __instance._isGambleItem) { return; } TranslationKey forAsset = KeyUtil.GetForAsset((ScriptableItem)(object)_scriptEquip); ItemRarity val = ((ScriptableItem)_scriptEquip)._itemRarity; 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.text, ((TooltipElement)__instance)._toolTipName.fontSize)); } if (_itemData._modifierID != 0 && Object.op_Implicit((Object)(object)GameManager._current.Locate_StatModifier(_itemData._modifierID))) { val = (ItemRarity)(byte)(val + 1); ScriptableStatModifier val2 = GameManager._current.Locate_StatModifier(_itemData._modifierID); ((TooltipElement)__instance)._toolTipName.text = ((TooltipElement)__instance)._toolTipName.text.Replace(val2._modifierTag, Localyssation.GetString(KeyUtil.GetForAsset(val2))); } ((TooltipElement)__instance)._toolTipSubName.text = string.Format(Localyssation.GetString(I18nKeys.Item.FORMAT_ITEM_RARITY, ((TooltipElement)__instance)._toolTipSubName.text, ((TooltipElement)__instance)._toolTipSubName.fontSize), Localyssation.GetString(KeyUtil.GetForAsset(val), ((object)Unsafe.As(ref ((ScriptableItem)_scriptEquip)._itemRarity)/*cast due to .constrained prefix*/).ToString(), ((TooltipElement)__instance)._toolTipSubName.fontSize)); ((TooltipElement)__instance)._toolTipDescription.text = ""; if (!string.IsNullOrEmpty(((ScriptableItem)_scriptEquip)._itemDescription)) { ((TooltipElement)__instance)._toolTipDescription.text = Localyssation.GetString($"{forAsset}_DESCRIPTION", ((TooltipElement)__instance)._toolTipDescription.text, ((TooltipElement)__instance)._toolTipDescription.fontSize); } if (Object.op_Implicit((Object)(object)_scriptEquip._classRequirement)) { __instance._equipClassRequirement.text = string.Format(Localyssation.GetString(I18nKeys.Equipment.FORMAT_CLASS_REQUIREMENT, __instance._equipClassRequirement.text, __instance._equipClassRequirement.fontSize), Localyssation.GetString($"{KeyUtil.GetForAsset(_scriptEquip._classRequirement)}_NAME", __instance._equipClassRequirement.text, __instance._equipClassRequirement.fontSize)); } if (!(((object)_scriptEquip).GetType() == typeof(ScriptableWeapon))) { return; } ScriptableWeapon val3 = (ScriptableWeapon)_scriptEquip; ScriptableCondition scriptableCondition = ((ScriptableEquipment)val3)._equipConditionActivation._equipConditionSlot._scriptableCondition; if (Object.op_Implicit((Object)(object)scriptableCondition)) { Text toolTipDescription = ((TooltipElement)__instance)._toolTipDescription; toolTipDescription.text += string.Format(Localyssation.GetString(I18nKeys.Equipment.FORMAT_WEAPON_CONDITION, ((TooltipElement)__instance)._toolTipDescription.text, ((TooltipElement)__instance)._toolTipDescription.fontSize), ((ScriptableEquipment)val3)._equipConditionActivation._equipConditionSlot._chance * 100f, Localyssation.GetString($"{KeyUtil.GetForAsset(scriptableCondition)}_NAME", scriptableCondition._conditionName, ((TooltipElement)__instance)._toolTipDescription.fontSize)); } DamageType combatType = val3.weaponType._combatType; string text = string.Format(Localyssation.GetString(I18nKeys.Equipment.FORMAT_WEAPON_DAMAGE_TYPE), Localyssation.GetString(KeyUtil.GetForAsset(combatType))); DamageType asset = val3.weaponType._combatType; PlayerCombat pCombat = Player._mainPlayer._pCombat; if (pCombat._useDamageTypeOverride && _itemData._isEquipped && ((pCombat._isUsingAltWeapon && _itemData._isAltWeapon) || (!pCombat._isUsingAltWeapon && !_itemData._isAltWeapon))) { asset = pCombat._damageTypeOverride; } if (_itemData._useDamageTypeOverride) { asset = _itemData._damageTypeOverride; } __instance._weaponDamageTransmuteText.text = string.Format(Localyssation.GetString(I18nKeys.Equipment.FORMAT_WEAPON_TRANSMUTE_TYPE), Localyssation.GetString(KeyUtil.GetForAsset(asset))); string text2 = string.Format(Localyssation.GetString(I18nKeys.Equipment.FORMAT_TOOLTIP_TYPE_WEAPON), Localyssation.GetString(KeyUtil.GetForAsset(val3.weaponType))); __instance._equipToolTipType.text = text2 + " " + text; if (Object.op_Implicit((Object)(object)val3._combatElement)) { if (!string.IsNullOrEmpty(val3._combatElement._elementName)) { __instance._equipStatsDisplay.text = __instance._equipStatsDisplay.text.Replace(val3._combatElement._elementName, Localyssation.GetString($"{KeyUtil.GetForAsset(val3._combatElement)}_NAME", val3._combatElement._elementName, __instance._equipStatsDisplay.fontSize)).Replace("Base Damage", Localyssation.GetString(I18nKeys.Equipment.STATS_BASE_DAMAGE)).Replace("Damage", Localyssation.GetString(I18nKeys.Equipment.STATS_DAMAGE)); } } else { __instance._equipStatsDisplay.text = __instance._equipStatsDisplay.text.Replace("Base Damage", Localyssation.GetString(I18nKeys.Equipment.STATS_BASE_DAMAGE)).Replace("Damage", Localyssation.GetString(I18nKeys.Equipment.STATS_DAMAGE)); } } [HarmonyPatch(typeof(EquipToolTip), "Update")] [HarmonyPostfix] public static void EquipToolTip_Update_Postfix(EquipToolTip __instance) { if (!Object.op_Implicit((Object)(object)TabMenu._current) || !TabMenu._current._isOpen) { return; } if (TabMenu._current._itemTradeMode) { if (Object.op_Implicit((Object)(object)__instance._specialCurrencyItem)) { __instance._vendorValueCounter.text = string.Format("{0} {1}", __instance._vendorValue, Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(__instance._specialCurrencyItem), "_NAME"))); } else if (__instance._vendorValue > 1) { __instance._vendorValueCounter.text = $"{__instance._vendorValue} {Localyssation.GetString(I18nKeys.Lore.CROWN_PLURAL)}"; } else { __instance._vendorValueCounter.text = $"{__instance._vendorValue} {Localyssation.GetString(I18nKeys.Lore.CROWN)}"; } } __instance._compareDisplayText.text = __instance._compareDisplayText.text.Replace("Compare Gear", Localyssation.GetString(I18nKeys.Equipment.COMPARE)); } [HarmonyPatch(typeof(EquipToolTip), "Apply_EquipStats")] [HarmonyTranspiler] public static IEnumerable EquipToolTip_Apply_EquipStats_Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceStrings(new string[7] { I18nKeys.Equipment.FORMAT_LEVEL_REQUIREMENT, I18nKeys.Equipment.TOOLTIP_TYPE_HELM, I18nKeys.Equipment.TOOLTIP_TYPE_CHESTPIECE, I18nKeys.Equipment.TOOLTIP_TYPE_LEGGINGS, I18nKeys.Equipment.TOOLTIP_TYPE_CAPE, I18nKeys.Equipment.TOOLTIP_TYPE_RING, I18nKeys.Equipment.TOOLTIP_TYPE_TRINKET }, allowRepeat: false, supressNotfoundWarnings: true).Unwrap(); } [HarmonyPatch(typeof(PlayerInventory), "UserCode_Cmd_DropItem__ItemData__Int32")] [HarmonyTranspiler] public static IEnumerable PlayerDropItem_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[1] { I18nKeys.Feedback.DROP_ITEM_FORMAT }); } [HarmonyPatch(typeof(PlayerInventory), "Add_Currency")] [HarmonyPatch(typeof(PlayerInventory), "Add_Item")] [HarmonyTranspiler] public static IEnumerable PlayerPickupItem_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[1] { I18nKeys.Feedback.PICKUP_ITEM_FORMAT }); } [HarmonyPatch(typeof(PlayerStats), "Server_ResetAttributePoints")] [HarmonyPatch(typeof(PlayerStats), "OnLevelUp")] [HarmonyTranspiler] public static IEnumerable PlayerStatsLevelUp_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[3] { I18nKeys.Feedback.OBTAINED_ATTRIBUTE_POINTS, I18nKeys.Feedback.CHAT_LEVELED_UP_PEER, I18nKeys.Feedback.CHAT_LEVELED_UP_LOCAL }, allowRepeat: false, supressNotfoundWarnings: true); } [HarmonyPatch(typeof(PlayerStats), "UserCode_Cmd_GainProfessionExp__ResourceEntity__Int32")] [HarmonyTranspiler] public static IEnumerable PlayerProfessionLevelUp_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[3] { I18nKeys.Feedback.CHAT_PROFESSION_LEVELED_UP_PEER, I18nKeys.Feedback.CHAT_PROFESSION_LEVELED_UP_LOCAL, I18nKeys.Feedback.EXPERIENCE_GAINED_FORMAT }, allowRepeat: false, supressNotfoundWarnings: true); } [HarmonyPatch(typeof(HostConsole), "Init_NetworkStatusMessage")] [HarmonyPrefix] public static void HostConsole_Init_NetworkStatusMessage_Prefix(HostConsole __instance, ref string _msg) { _msg = _msg.Replace("Character file saved...", Localyssation.GetString(I18nKeys.HostConsole.CHARACTER_FILE_SAVED)).Replace("Settings Profile Saved...", Localyssation.GetString(I18nKeys.HostConsole.SETTINGS_PROFILE_SAVED)); } private static IDictionary WeaponSlotReplacer(string basePathFormat, string pParent1, string pParent2, string pChild1, string pChild2) { return new Dictionary { { string.Format(basePathFormat, pParent1, pChild1), "I" }, { string.Format(basePathFormat, pParent1, pChild2), "II" }, { string.Format(basePathFormat, pParent2, pChild1), "I" }, { string.Format(basePathFormat, pParent2, pChild2), "II" } }; } [HarmonyPatch(typeof(InGameUI), "Awake")] [HarmonyPostfix] public static void InGameUI__Awake__Postfix(InGameUI __instance) { RTUtil.RemapChildTextsByPath(((Component)__instance).transform, WeaponSlotReplacer("Canvas_InGameUI/dolly_bottomBar/_cell_weaponSwapper/{0}/{1}/Text (Legacy)", "_altWeaponQuickSlot", "_weaponQuickSlot", "_quickWepSlot_numIco_01", "_quickWepSlot_numIco"), null, supressNotfoundWarnings: true, rawText: true); } [HarmonyPatch(typeof(SkillListDataEntry), "Start")] [HarmonyPostfix] public static void SkillListDataEntry__Start__Postfix(SkillListDataEntry __instance) { if (Object.op_Implicit((Object)(object)__instance._primaryLoadoutIcon)) { RTUtil.RemapChildTextsByPath(__instance._primaryLoadoutIcon.transform, new Dictionary { { "Text (Legacy)", "I" } }, null, supressNotfoundWarnings: false, rawText: true); } if (Object.op_Implicit((Object)(object)__instance._altLoadoutIcon)) { RTUtil.RemapChildTextsByPath(__instance._altLoadoutIcon.transform, new Dictionary { { "Text (Legacy)", "II" } }, null, supressNotfoundWarnings: false, rawText: true); } } [HarmonyPatch(typeof(ItemMenuCell), "Start")] [HarmonyPostfix] public static void ItemMenuCell__Start__Postfix(ItemMenuCell __instance) { RTUtil.RemapChildTextsByPath(((Component)__instance).transform, WeaponSlotReplacer("_equipmentTab/_dolly_equipCells/_dolly_lowerColumn/GameObject/_equipcell_{0}eapon/_quickWepSlot_numIco_{1}/Text (Legacy)", "w", "altW", "01", "02"), null, supressNotfoundWarnings: true, rawText: true); } [HarmonyPatch(typeof(ActionBarManager), "Handle_CastBar")] [HarmonyPostfix] public static void ActionBarManager__Handle_CastBar__Postfix(ActionBarManager __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 if ((int)__instance._player._currentPlayerAction == 3 && Object.op_Implicit((Object)(object)__instance._pCast) && Object.op_Implicit((Object)(object)__instance._pCast._currentCastSkill)) { __instance._castBarTag.text = Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(__instance._pCast._currentCastSkill), "_NAME")); } } private static string GenerateConsumableDescString(ScriptableStatusConsumable consumable) { int[] array = new int[4] { consumable._healthApply, consumable._healthApply, consumable._staminaApply, consumable._expGain }; List list = new List(); for (int i = 0; i < array.Length; i++) { if (array[i] > 0) { list.Add(string.Format(Localyssation.GetString(consumableEffectDescKeys[i]), array[i])); } } return "" + string.Join("\n", list) + ""; } [HarmonyPatch(typeof(ItemToolTip), "Apply_ItemStats")] [HarmonyPostfix] public static void ItemToolTip_Apply_ItemStats(ItemToolTip __instance) { //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Invalid comparison between Unknown and I4 //IL_01d0: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)__instance._scriptItem)) { return; } if (TabMenu._current._itemTradeMode) { if (__instance._setItemQuantity <= 1) { __instance._vendorValueCounter.text = string.Format(Localyssation.GetString(I18nKeys.Item.FORMAT_ITEM_TOOLTIP_VENDOR_VALUE_COUNTER, __instance._vendorValueCounter.text, __instance._vendorValueCounter.fontSize), __instance._vendorValue); } else { __instance._vendorValueCounter.text = string.Format(Localyssation.GetString(I18nKeys.Item.FORMAT_ITEM_TOOLTIP_VENDOR_VALUE_COUNTER_MULTIPLE, __instance._vendorValueCounter.text, __instance._vendorValueCounter.fontSize), __instance._vendorValue, __instance._vendorValue * __instance._setItemQuantity); } } TranslationKey forAsset = KeyUtil.GetForAsset(__instance._scriptItem); ((TooltipElement)__instance)._toolTipName.text = ((TooltipElement)__instance)._toolTipName.text.Replace(__instance._scriptItem._itemName, Localyssation.GetString($"{forAsset}_NAME")); ((TooltipElement)__instance)._toolTipDescription.text = ((TooltipElement)__instance)._toolTipDescription.text.Replace(__instance._scriptItem._itemDescription, Localyssation.GetString($"{forAsset}_DESCRIPTION")); ((TooltipElement)__instance)._toolTipSubName.text = string.Format(Localyssation.GetString(I18nKeys.Item.FORMAT_ITEM_RARITY, ((TooltipElement)__instance)._toolTipSubName.text, ((TooltipElement)__instance)._toolTipSubName.fontSize), Localyssation.GetString(KeyUtil.GetForAsset(__instance._scriptItem._itemRarity), ((object)Unsafe.As(ref __instance._scriptItem._itemRarity)/*cast due to .constrained prefix*/).ToString(), ((TooltipElement)__instance)._toolTipSubName.fontSize)); if ((int)__instance._scriptItem._itemType > 0) { __instance._itemToolTipType.text = Localyssation.GetString(KeyUtil.GetForAsset(__instance._scriptItem._itemType)); } } [HarmonyPatch(typeof(ItemToolTip), "Apply_ItemStats")] [HarmonyTranspiler] public static IEnumerable ItemToolTip_Apply_ItemStats_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new Dictionary { { "Mystery Item", "ITEM_TOOLTIP_GAMBLE_ITEM_NAME" }, { "[Unknown]", "ITEM_TOOLTIP_GAMBLE_ITEM_RARITY" }, { "You can't really see what this is until you buy it.", "ITEM_TOOLTIP_GAMBLE_ITEM_DESCRIPTION" }, { "Recovers {0} Health.", "ITEM_TOOLTIP_CONSUMABLE_DESCRIPTION_HEALTH_APPLY" }, { "Recovers {0} Mana.", "ITEM_TOOLTIP_CONSUMABLE_DESCRIPTION_MANA_APPLY" }, { "Recovers {0} Stamina.", "ITEM_TOOLTIP_CONSUMABLE_DESCRIPTION_STAMINA_APPLY" }, { "Gain {0} Experience on use.", "ITEM_TOOLTIP_CONSUMABLE_DESCRIPTION_EXP_GAIN" }, { "Consumable", "ITEM_TOOLTIP_TYPE_CONSUMABLE" }, { "Trade Item", "ITEM_TOOLTIP_TYPE_TRADE" } }); } [HarmonyPatch(typeof(ItemObjectVisual), "Apply_ItemObjectVisual")] [HarmonyPostfix] public static void ItemObjectVisual_Apply_ItemObjectVisual(ItemObjectVisual __instance) { if (__instance._itemObject._currencyDropAmount > 0) { Apply_CurrencyVisual(); } else { Apply_ItemVisual(); } void Apply_CurrencyVisual() { int currencyDropAmount = __instance._itemObject._currencyDropAmount; ((TMP_Text)__instance._itemNametagTextMesh).text = $"{currencyDropAmount:n0} " + Localyssation.GetString((currencyDropAmount > 1) ? I18nKeys.Lore.CROWN_PLURAL : I18nKeys.Lore.CROWN); } void Apply_ItemVisual() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_0064: Unknown result type (might be due to invalid IL or missing references) string text = ""; if (Object.op_Implicit((Object)(object)__instance._itemObject._foundItem)) { if ((int)__instance._itemObject._foundItem._itemType == 0) { ((Component)__instance._itemVisualErrorSpriteRend).gameObject.SetActive(!((ScriptableEquipment)__instance._itemObject._foundItem).CanEquipItem(Player._mainPlayer._pStats, false)); if (__instance._itemObject._local_itemData._modifierID > 0) { text = Localyssation.GetString(KeyUtil.GetForAsset(GameManager._current.Locate_StatModifier(__instance._itemObject._local_itemData._modifierID))) + " "; } } ((TMP_Text)__instance._itemNametagTextMesh).text = text + Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(__instance._itemObject._foundItem), "_NAME")); } } } [HarmonyPatch(typeof(TooltipElement), "Awake")] [HarmonyPostfix] public static void ItemToolTip_Awake_Postfix(TooltipElement __instance) { ItemToolTip val = (ItemToolTip)(object)((__instance is ItemToolTip) ? __instance : null); if (val == null) { return; } Transform val2 = ((Component)val).transform.Find("_itemToolTipBase/equipToolTip_Interface/_dolly_equipHeader/_text_itemRarity"); Transform val3 = ((Component)val).transform.Find("_itemToolTipBase/equipToolTip_Interface/_dolly_equipHeader/_text_raritySpacer"); if ((Object)(object)val2 != (Object)null && (Object)(object)val3 == (Object)null) { GameObject val4 = Object.Instantiate(((Component)val2).gameObject, val2.parent); ((Object)val4).name = "_text_raritySpacer"; TextMeshProUGUI[] componentsInChildren = val4.GetComponentsInChildren(); foreach (TextMeshProUGUI val5 in componentsInChildren) { ((TMP_Text)val5).text = " "; } Text[] componentsInChildren2 = val4.GetComponentsInChildren(); foreach (Text val6 in componentsInChildren2) { val6.text = " "; } val4.transform.SetSiblingIndex(val2.GetSiblingIndex()); } } [HarmonyPatch(typeof(ItemStorageManager), "Update")] [HarmonyPostfix] public static void ItemStorageManager_Update_Postfix(ItemStorageManager __instance) { if (__instance._isOpen) { if ((Object)(object)cachedStorageHeader == (Object)null) { GameObject val = GameObject.Find("_GameUI_InGame/Canvas_DialogSystem/_dolly_storageBox/_header_backdrop/_header_storeNameText"); if ((Object)(object)val != (Object)null) { cachedStorageHeader = val.GetComponent(); } } if ((Object)(object)cachedStorageHeader != (Object)null) { cachedStorageHeader.text = Localyssation.GetString(I18nKeys.Storage.HEADER); } Text[] componentsInChildren = ((Component)__instance).GetComponentsInChildren(true); foreach (Text val2 in componentsInChildren) { string text = val2.text.Trim(); if (text.Equals("Clean-up", StringComparison.OrdinalIgnoreCase) || text.Equals("Cleanup", StringComparison.OrdinalIgnoreCase) || text.Equals("Clean", StringComparison.OrdinalIgnoreCase)) { val2.text = Localyssation.GetString("INVENTORY_BUTTON_CLEANUP", "Clean-up"); } else if (text.Equals("Sort Items", StringComparison.OrdinalIgnoreCase) || text.Equals("Sort", StringComparison.OrdinalIgnoreCase)) { val2.text = Localyssation.GetString("INVENTORY_SORT_ITEMS", "Sort Items"); } } } else { cachedStorageHeader = null; } } [HarmonyPatch(typeof(ItemStorageManager), "Handle_TabVisibility")] [HarmonyPostfix] public static void ItemStorageManager_Handle_TabVisibility_Postfix(ItemStorageManager __instance) { __instance._itemTabHeaderText.text = __instance._itemTabHeaderText.text.Replace("Equipment", Localyssation.GetString(KeyUtil.GetForAsset((ItemType)0))).Replace("Consumables", Localyssation.GetString(KeyUtil.GetForAsset((ItemType)1))).Replace("Trade Items", Localyssation.GetString(KeyUtil.GetForAsset((ItemType)2))); } [HarmonyPatch(typeof(ItemStorageManager), "Init_InventoryTooltip")] [HarmonyPrefix] public static bool ItemStorageManager_Init_InventoryTooltip_Prefix(ItemStorageManager __instance, int _tabValue) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) ToolTipManager._current._genericToolTip.Set_TooltipAnchorPos(Vector2.op_Implicit(new Vector2(100f, 0f))); if (0 > _tabValue || _tabValue > 2) { return false; } ItemType asset = (ItemType)(byte)_tabValue; ToolTipManager._current.Apply_GenericToolTip(Localyssation.GetString(KeyUtil.GetForAsset(asset))); ToolTipManager._current._genericToolTip.Enable_ToolTip(); return false; } [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)) { RTUtil.RemapAllTextUnderObject(((Component)val2).gameObject, new Dictionary { { "_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_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)obj_text_toolTipHelp)) { Text tooltipText = ((Component)obj_text_toolTipHelp).GetComponent(); EventTrigger component = ((Component)textParent).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { for (int i = 0; i < component.triggers.Count; i++) { Entry val10 = component.triggers[i]; object obj = typeof(UnityEventBase).GetField("m_PersistentCalls", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(val10.callback); if (obj != null && obj.GetType().GetField("m_Calls", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(obj) is IList list) { foreach (object item in list) { if (item != null) { Type type = item.GetType(); string text = type.GetProperty("methodName", BindingFlags.Instance | BindingFlags.Public)?.GetValue(item) as string; object obj2 = type.GetProperty("target", BindingFlags.Instance | BindingFlags.Public)?.GetValue(item); object obj3 = type.GetProperty("arguments", BindingFlags.Instance | BindingFlags.Public)?.GetValue(item); string stringArgument = (obj3?.GetType().GetProperty("stringArgument", BindingFlags.Instance | BindingFlags.Public))?.GetValue(obj3) as string; if (text == "set_text" && stringArgument != null && stringArgument != "" && obj2 == tooltipText) { Entry val11 = new Entry { eventID = val10.eventID }; ((UnityEvent)(object)val11.callback).AddListener((UnityAction)delegate { tooltipText.text = Localyssation.GetString(key + "_TOOLTIP", stringArgument, tooltipText.fontSize); }); component.triggers.Add(val11); return; } } } } } } } }); } Transform val3 = parent.Find("_gameStartMenu/Canvas_gameStart/_dolly_multiplayerMenu/_menuBackdrop"); if ((Object)(object)val3 != (Object)null) { RTUtil.RemapAllTextUnderObject(((Component)val3).gameObject, new Dictionary { { "_button_joinServer", I18nKeys.MainMenu.BUTTON_JOIN_SERVER }, { "_button_hostServer", I18nKeys.MainMenu.BUTTON_HOST_SERVER }, { "_button_return", I18nKeys.MainMenu.BUTTON_RETURN } }); } } Transform val4 = parent.Find("_characterSelectMenu/Canvas_characterSelect"); if (Object.op_Implicit((Object)(object)val4)) { RTUtil.RemapAllTextUnderObject(((Component)val4).gameObject, new Dictionary { { "_text_header", "CHARACTER_SELECT_HEADER" }, { "_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" } }); RTUtil.RemapAllInputPlaceholderTextUnderObject(((Component)val4).gameObject, new Dictionary { { "_input_characterDeleteConfirm", "CHARACTER_SELECT_CHARACTER_DELETE_PROMPT_PLACEHOLDER_TEXT" } }); } Transform val5 = parent.Find("_characterSelectMenu/Canvas_characterCreation"); if (Object.op_Implicit((Object)(object)val5)) { RTUtil.RemapAllTextUnderObject(((Component)val5).gameObject, new Dictionary { { "_text_header", "CHARACTER_CREATION_HEADER" }, { "_header_raceSelect", "CHARACTER_CREATION_HEADER_RACE_NAME" }, { "_header_initialSkill", "CHARACTER_CREATION_RACE_DESCRIPTOR_HEADER_INITIAL_SKILL" }, { "_button_createCharacter", "CHARACTER_CREATION_BUTTON_CREATE_CHARACTER" }, { "_button_return", "CHARACTER_CREATION_BUTTON_RETURN" } }); RTUtil.RemapAllInputPlaceholderTextUnderObject(((Component)val5).gameObject, new Dictionary { { "_input_characterName", "CHARACTER_CREATION_CHARACTER_NAME_PLACEHOLDER_TEXT" } }); Transform val6 = ((Component)val5).transform.Find("_dolly_customizer/_customizer_color"); Transform val7 = ((Component)val5).transform.Find("_dolly_customizer/_customizer_head"); Transform val8 = ((Component)val5).transform.Find("_dolly_customizer/_customizer_body"); Transform val9 = ((Component)val5).transform.Find("_dolly_customizer/_customizer_trait"); if (Object.op_Implicit((Object)(object)val6)) { RTUtil.RemapAllTextUnderObject(((Component)val6).gameObject, new Dictionary { { "_customizer_header", "CHARACTER_CREATION_CUSTOMIZER_HEADER_COLOR" }, { "_text_bodyColor", "CHARACTER_CREATION_CUSTOMIZER_COLOR_BODY_HEADER" }, { "_characterButtonSelector", "CHARACTER_CREATION_CUSTOMIZER_COLOR_BODY_TEXTURE" }, { "_text_hairColor", "CHARACTER_CREATION_CUSTOMIZER_COLOR_HAIR_HEADER" }, { "Toggle_lockColor", "CHARACTER_CREATION_CUSTOMIZER_COLOR_HAIR_LOCK_COLOR" } }); } RTUtil.RemapChildTextsByPath(val6, new Dictionary { { "_dolly_bodyColor/_characterSlider_bodyHue/Text (Legacy)", "CHARACTER_CREATION_CUSTOMIZER_COLOR_HUE" }, { "_dolly_bodyColor/_characterSlider_bodyBrightness/Text (Legacy)_01", "CHARACTER_CREATION_CUSTOMIZER_COLOR_BRIGHTNESS" }, { "_dolly_bodyColor/_characterSlider_bodyContrast/Text (Legacy)_02", "CHARACTER_CREATION_CUSTOMIZER_COLOR_CONTRAST" }, { "_dolly_bodyColor/_characterSlider_bodySaturation/Text (Legacy)_03", "CHARACTER_CREATION_CUSTOMIZER_COLOR_SATURATION" }, { "_dolly_bodyColor/_characterSlider_hairHue/Text (Legacy)_01", "CHARACTER_CREATION_CUSTOMIZER_COLOR_HUE" }, { "_dolly_bodyColor/_characterSlider_hairBrightness/Text (Legacy)_02", "CHARACTER_CREATION_CUSTOMIZER_COLOR_BRIGHTNESS" }, { "_dolly_bodyColor/_characterSlider_hairContrast/Text (Legacy)_03", "CHARACTER_CREATION_CUSTOMIZER_COLOR_CONTRAST" }, { "_dolly_bodyColor/_characterSlider_hairSaturation/Text (Legacy)_04", "CHARACTER_CREATION_CUSTOMIZER_COLOR_SATURATION" }, { "_dolly_bodyColor/_characterSlider_miscHue/Text (Legacy)_05", "CHARACTER_CREATION_CUSTOMIZER_COLOR_HUE" }, { "_dolly_bodyColor/_characterSlider_miscBrightness/Text (Legacy)_06", "CHARACTER_CREATION_CUSTOMIZER_COLOR_BRIGHTNESS" }, { "_dolly_bodyColor/_characterSlider_miscContrast/Text (Legacy)_07", "CHARACTER_CREATION_CUSTOMIZER_COLOR_CONTRAST" }, { "_dolly_bodyColor/_characterSlider_miscSaturation/Text (Legacy)_08", "CHARACTER_CREATION_CUSTOMIZER_COLOR_SATURATION" } }); if (Object.op_Implicit((Object)(object)val7)) { RTUtil.RemapAllTextUnderObject(((Component)val7).gameObject, new Dictionary { { "_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)val8)) { RTUtil.RemapAllTextUnderObject(((Component)val8).gameObject, new Dictionary { { "_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" } }); } if (Object.op_Implicit((Object)(object)val9)) { RTUtil.RemapAllTextUnderObject(((Component)val9).gameObject, new Dictionary { { "_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" }, { "_text_atbHeader", "CHARACTER_CREATION_CUSTOMIZER_TRAIT_UNSPENT_POINTS" }, { "_button_resetAtbPoints", "CHARACTER_CREATION_CUSTOMIZER_TRAIT_RESET_ATTRIBUTE_POINTS" } }); } } } [HarmonyPatch(typeof(CharacterSelectManager), "Handle_HeaderText")] [HarmonyTranspiler] public static IEnumerable CharacterSelectManager_Handle_HeaderText_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new Dictionary { { "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 Connect", "CHARACTER_SELECT_HEADER_GAME_MODE_LOBBY_QUERY" } }); } [HarmonyPatch(typeof(CharacterSelectManager), "Update")] [HarmonyTranspiler] public static IEnumerable CharacterSelectManager_Update_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[1] { I18nKeys.MainMenu.PAGER }); } [HarmonyPatch(typeof(CharacterSelectListDataEntry), "Update")] [HarmonyPostfix] public static void CharacterSelectListDataEntry_Update(CharacterSelectListDataEntry __instance) { if (__instance._characterFileData._isEmptySlot) { ((TMP_Text)__instance._characterNicknameText).text = Localyssation.GetString("CHARACTER_SELECT_DATA_ENTRY_EMPTY_SLOT", ((TMP_Text)__instance._characterNicknameText).text, (int)((TMP_Text)__instance._characterNicknameText).fontSize); return; } string arg = ""; string arg2 = Localyssation.GetString("PLAYER_CLASS_EMPTY_NAME", GameManager._current._statLogics._emptyClassName); ScriptablePlayerRace val = GameManager._current.Locate_PlayerRace(__instance._characterFileData._appearanceProfile._setRaceTag); if (Object.op_Implicit((Object)(object)val)) { arg = KeyUtil.GetForAsset(val).Name.Localize(); } if (!string.IsNullOrEmpty(__instance._characterFileData._statsProfile._classID)) { PlayerStats_Profile statsProfile = __instance._characterFileData._statsProfile; ScriptablePlayerBaseClass val2 = GameManager._current.Locate_PlayerClass(statsProfile._classID); if (Object.op_Implicit((Object)(object)val2)) { arg2 = KeyUtil.GetForAsset(val2).Name.Localize(); if (statsProfile._classTier > 0) { arg2 = KeyUtil.GetForAsset(val2._playerClassTiers[statsProfile._classTier - 1]).Name.Localize(); } } } ((TMP_Text)__instance._characterInfoText).text = string.Format(Localyssation.GetString(I18nKeys.CharacterSelect.FORMAT_DATA_ENTRY_INFO, ((TMP_Text)__instance._characterInfoText).text), __instance._characterFileData._statsProfile._currentLevel, arg, arg2); } [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)) { TranslationKey forAsset = KeyUtil.GetForAsset(val); __instance._raceDescriptionHeader.text = Localyssation.GetString($"{forAsset}_NAME", __instance._raceDescriptionHeader.text, __instance._raceDescriptionHeader.fontSize) ?? ""; __instance._raceDescriptorField.text = Localyssation.GetString($"{forAsset}_DESCRIPTION", __instance._raceDescriptorField.text, __instance._raceDescriptorField.fontSize) ?? ""; __instance._colorMiscTag.text = Localyssation.GetString($"{forAsset}_MISC", __instance._colorMiscTag.text, __instance._colorMiscTag.fontSize) ?? ""; __instance._miscTag.text = Localyssation.GetString($"{forAsset}_MISC", __instance._miscTag.text, __instance._miscTag.fontSize) ?? ""; TranslationKey forAsset2 = KeyUtil.GetForAsset(val._racialSkill); __instance._raceInitialSkillTag.text = Localyssation.GetString($"{forAsset2}_NAME", __instance._raceInitialSkillTag.text, __instance._raceInitialSkillTag.fontSize) ?? ""; __instance._raceInitialSkillDescriptor.text = Localyssation.GetString($"{forAsset2}_DESCRIPTION", __instance._raceInitialSkillDescriptor.text, __instance._raceInitialSkillDescriptor.fontSize) ?? ""; } } [HarmonyPatch(typeof(CharacterSelectManager), "Initalize_CharacterFiles")] [HarmonyTranspiler] public static IEnumerable CharacterSelectManager_Initalize_CharacterFiles_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[1] { I18nKeys.CharacterSelect.FILE_NUMBER_FORMAT }); } [HarmonyPatch(typeof(InGameUI), "Handle_InGameUI")] [HarmonyPostfix] private static void InGameUI__Handle_InGameUI__Postfix(InGameUI __instance) { if (!Player._mainPlayer._bufferingStatus) { if (!string.IsNullOrWhiteSpace(__instance._reigonTitle)) { ((TMP_Text)__instance._text_sceneCardName).text = KeyUtil.GetForMapRegionTag(__instance._reigonTitle).Localize(); } else { ((TMP_Text)__instance._text_sceneCardName).text = KeyUtil.GetForMapName(Player._mainPlayer.Network_playerMapInstance._mapName).Localize() ?? ""; } } } [HarmonyPatch(typeof(NetTrigger), "Init_SendTriggerMessage")] [HarmonyPrefix] private static bool NetTrigger__Init_SendTriggerMessage__Postfix(NetTrigger __instance) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) NetTriggerTranslationKey forAsset = KeyUtil.GetForAsset(__instance); if (!NetworkServer.active) { return false; } string text = forAsset.SingleMessage.Localize(); if (forAsset.MessageArrayLength != 0) { text = forAsset.MessageArray(Random.Range(0, forAsset.MessageArrayLength)).Localize(); } if (string.IsNullOrEmpty(text)) { return false; } ChatBehaviour[] array = Object.FindObjectsOfType(); foreach (ChatBehaviour val in array) { if ((Object)(object)val != (Object)null && ((Component)val).gameObject.scene == ((Component)__instance).gameObject.scene) { if (__instance._triggerMessage._sentMsg) { break; } val.Target_RecieveTriggerMessage(text); } } __instance._triggerMessage._sentMsg = true; return false; } [HarmonyPatch(typeof(OptionsMenuCell), "Cell_OnAwake")] [HarmonyPostfix] public static void OptionsMenuCell_Cell_OnAwake(OptionsMenuCell __instance) { RTUtil.RemapChildTextsByPath(((Component)__instance).transform, new Dictionary { { "_headerIcon/_text_skillsHeader", I18nKeys.TabMenu.CELL_OPTIONS_HEADER }, { buttonPath("settings"), I18nKeys.TabMenu.CELL_OPTIONS_BUTTON_SETTINGS }, { buttonPath("saveFile"), I18nKeys.TabMenu.CELL_OPTIONS_BUTTON_SAVE_FILE }, { buttonPath("invite"), I18nKeys.TabMenu.CELL_OPTIONS_BUTTON_INVITE_TO_LOBBY }, { buttonPath("hostConsole"), I18nKeys.TabMenu.CELL_OPTIONS_BUTTON_HOST_CONSOLE }, { buttonPath("quitGame"), I18nKeys.TabMenu.CELL_OPTIONS_BUTTON_SAVE_AND_QUIT }, { "_dolly_confirmQuit/_backdrop_confirmQuit/_confirmQuit_header", I18nKeys.TabMenu.CELL_OPTIONS_CONFIRM_QUIT_HEADER }, { "_dolly_confirmQuit/_backdrop_confirmQuit/_button_confirmSaveQuit/Text", I18nKeys.TabMenu.CELL_OPTIONS_CONFIRM_QUIT_CONFIRM }, { "_dolly_confirmQuit/_backdrop_confirmQuit/_button_cancelSaveQuit/Text", I18nKeys.TabMenu.CELL_OPTIONS_CONFIRM_QUIT_CANCEL } }); static string buttonPath(string name) { return "_dolly_escapeMenu/_backdrop_escapeMenu/_button_" + name + "/Text"; } } [HarmonyPatch(typeof(OptionsMenuCell), "Handle_CellUpdate")] [HarmonyPostfix] public static void OptionsMenuCell_Handle_CellUpdate_Postfix(OptionsMenuCell __instance) { __instance._quitGameButtonText.text = Localyssation.GetString(I18nKeys.TabMenu.CELL_OPTIONS_BUTTON_SAVE_AND_QUIT); } [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_Portal")] [HarmonyPostfix] public static void PlayerInteract__InteractQueue_Portal__Postfix(PlayerInteract __instance, Portal _foundPortal) { if (NetworkClient.active) { string text = ""; if ((Object)(object)_foundPortal != (Object)null && _foundPortal._scenePortal != null && _foundPortal._scenePortal._portalCaptionTitle != null) { text = _foundPortal._scenePortal._portalCaptionTitle; } InGameUI._current.PortalCaptionPrompt((!string.IsNullOrEmpty(text)) ? Localyssation.GetString(KeyUtil.GetForMapName(text)) : ""); } } [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_RecallPortal")] [HarmonyPostfix] public static void PlayerInteract__InteractQueue_RecallPortal__Postfix(PlayerInteract __instance, RecallPortal _foundPortal) { if (NetworkClient.active) { string text = ""; if ((Object)(object)_foundPortal != (Object)null && _foundPortal._scenePortal != null && _foundPortal._scenePortal._portalCaptionTitle != null) { text = _foundPortal._scenePortal._portalCaptionTitle; } InGameUI._current.PortalCaptionPrompt((!string.IsNullOrEmpty(text)) ? Localyssation.GetString(KeyUtil.GetForMapName(text)) : ""); } } [HarmonyPatch(typeof(PlayerInteract), "Handle_InteractControl")] [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_RevivePlayer")] [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_DialogTrigger")] [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_QuestTrigger")] [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_Pushblock")] [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_NetTrigger")] [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_Portal")] [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_RecallPortal")] [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_ItemChestEntity")] [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_ItemObject")] [HarmonyTranspiler] public static IEnumerable PlayerInteract_General__Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[9] { I18nKeys.Lore.INTERACT_CANCEL, I18nKeys.Lore.INTERACT_FISH, I18nKeys.Lore.INTERACT_REEL, I18nKeys.Lore.INTERACT_REVIVE, I18nKeys.Lore.INTERACT_INTERACT, I18nKeys.Lore.INTERACT_HOLD, I18nKeys.Lore.INTERACT_TELEPORT, I18nKeys.Lore.INTERACT_OPEN, I18nKeys.Lore.INTERACT_PICK_UP }, allowRepeat: false, supressNotfoundWarnings: true); } [HarmonyPatch(typeof(PlayerInteract), "InteractQueue_ResourceEntity")] [HarmonyTranspiler] public static IEnumerable PlayerInteract_InteractQueue_ResourceEntity_Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ScriptableProfession), "_interactionTag"), (string)null) }); if (val.IsValid) { val.Advance(1); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate>((Func)((string tag) => string.IsNullOrEmpty(tag) ? tag : Localyssation.GetString("INTERACT_" + KeyUtil.Normalize(tag), tag))) }); } return val.InstructionEnumeration(); } [HarmonyPatch(typeof(QuestMenuCell), "Cell_OnAwake")] [HarmonyPostfix] public static void QuestMenu_Cell_OnAwake_Postfix(QuestMenuCell __instance) { RTUtil.RemapChildTextsByPath(((Component)__instance).transform, new Dictionary { { "_text_questsHeader", I18nKeys.TabMenu.CELL_QUESTS_HEADER }, { "_questListPanel/_dolly_questCellList/_abandonQuestPanel/_button_abandonQuest/_buttonText_abandonQuest", I18nKeys.TabMenu.CELL_QUESTS_BUTTON_ABANDON } }); if ((Object)(object)__instance._shareQuestButtonText != (Object)null) { __instance._shareQuestButtonText.text = Localyssation.GetString("QUEST_MENU_BUTTON_SHARE_QUEST", "Share Quest"); } } [HarmonyPatch(typeof(QuestListDataEntry), "Update")] [HarmonyPostfix] public static void QuestListDataEntry_Update(QuestListDataEntry __instance) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Invalid comparison between Unknown and I4 //IL_0124: Unknown result type (might be due to invalid IL or missing references) QuestTranslationKey forAsset = KeyUtil.GetForAsset(__instance._scriptableQuest); string text = Localyssation.GetString($"{forAsset}_NAME", __instance._scriptableQuest._questName, ((ListDataEntry)__instance)._dataNameText.fontSize); if ((int)__instance._scriptableQuest._questSubType == 0 || (int)__instance._scriptableQuest._questSubType == 1) { text = text + " " + string.Format(Localyssation.GetString("FORMAT_QUEST_REQUIRED_LEVEL", "SAME_AS_KEY", ((ListDataEntry)__instance)._dataNameText.fontSize), __instance._scriptableQuest._questLevel); Match match = Regex.Match(((ListDataEntry)__instance)._dataNameText.text, "<(\\w*)=([^>]*)>"); if (match.Success) { ((ListDataEntry)__instance)._dataNameText.text = $"<{match.Groups[1]}={match.Groups[2]}>" + text + $""; } else { ((ListDataEntry)__instance)._dataNameText.text = text; } } else { text = text + " " + Localyssation.GetString(KeyUtil.GetForAsset(__instance._scriptableQuest._questSubType), "SAME_AS_KEY", ((ListDataEntry)__instance)._dataNameText.fontSize); ((ListDataEntry)__instance)._dataNameText.text = "" + text + ""; } } [HarmonyPatch(typeof(QuestMenuCell), "Handle_CellUpdate")] [HarmonyPostfix] public static void QuestMenuCell_Handle_CellUpdate(QuestMenuCell __instance) { if (!Object.op_Implicit((Object)(object)Player._mainPlayer)) { return; } PlayerQuesting pQuest = Player._mainPlayer._pQuest; __instance._questLogCounterText.text = string.Format(Localyssation.GetString("FORMAT_QUEST_MENU_CELL_QUEST_LOG_COUNTER", __instance._questLogCounterText.text, __instance._questLogCounterText.fontSize), pQuest._questProgressData.Count, pQuest._questLogLimit); int num = 0; if (ProfileDataManager._current._characterFile._questProgressProfile._finishedQuests != null) { num = ProfileDataManager._current._characterFile._questProgressProfile._finishedQuests.Length; } __instance._finishedQuestCounterText.text = string.Format(Localyssation.GetString("FORMAT_QUEST_MENU_CELL_FINISHED_QUEST_COUNTER", __instance._finishedQuestCounterText.text, __instance._finishedQuestCounterText.fontSize), num); string text = ""; if (pQuest._questProgressData.Count > 0 && Object.op_Implicit((Object)(object)__instance._selectedQuest)) { for (int i = 0; i < pQuest._questProgressData.Count; i++) { if (QuestTrackerManager._current._refreshingElements) { break; } QuestProgressStruct val = pQuest._questProgressData[i]; if (val._questTag == __instance._selectedQuest._questName) { if (val._questComplete) { QuestTranslationKey forAsset = KeyUtil.GetForAsset(__instance._selectedQuest); string text2 = Localyssation.GetString($"{forAsset}_COMPLETE_RETURN_MESSAGE", __instance._selectedQuest._questCompleteReturnMessage, __instance._questErrandsText.fontSize); text = text.Insert(0, "" + text2 + "\n\n"); } text += QuestTrackerManager._current._questTrackElements[i]._trackElementText.text; } } } __instance._questErrandsText.text = text; } [HarmonyPatch(typeof(QuestMenuCell), "Apply_QuestInfo")] [HarmonyPostfix] public static void QuestMenuCell_Select_QuestSlot(QuestMenuCell __instance, ScriptableQuest _scriptQuest) { QuestTranslationKey forAsset = KeyUtil.GetForAsset(_scriptQuest); cachedQuest = _scriptQuest; cachedQuestCell = __instance; __instance._questHeaderText.text = Localyssation.GetString($"{forAsset}_NAME", __instance._questHeaderText.text, __instance._questHeaderText.fontSize) + " " + string.Format(Localyssation.GetString("FORMAT_QUEST_REQUIRED_LEVEL", "SAME_AS_KEY", __instance._questHeaderText.fontSize), _scriptQuest._questLevel); __instance._questSummaryText.text = Localyssation.GetString($"{forAsset}_DESCRIPTION", __instance._questSummaryText.text, __instance._questSummaryText.fontSize); int num = (int)((float)(int)GameManager._current._statLogics._experienceCurve.Evaluate((float)_scriptQuest._questLevel) * _scriptQuest._questExperiencePercentage); if (num > 0) { __instance._rewardsPanelText_experience.text = string.Format(Localyssation.GetString("FORMAT_QUEST_MENU_CELL_REWARD_EXP", __instance._rewardsPanelText_experience.text, __instance._rewardsPanelText_experience.fontSize), num); } if (_scriptQuest._questCurrencyReward > 0) { __instance._rewardsPanelText_currency.text = string.Format(Localyssation.GetString("FORMAT_QUEST_MENU_CELL_REWARD_CURRENCY", __instance._rewardsPanelText_currency.text, __instance._rewardsPanelText_currency.fontSize), num); } Text val = FindGameObjectTextChild(__instance._rewardsPanelObject, "_text_questRewardHeader"); val.text = Localyssation.GetString("QUEST_MENU_CELL_REWARD_HEADER", val.text, val.fontSize); Text val2 = FindGameObjectTextChild(__instance._objectiveItemPanel, "_text_objectiveItemHeader"); val2.text = Localyssation.GetString("QUEST_MENU_CELL_OBJECTIVE_ITEM_HEADER", val2.text, val2.fontSize); } public static void RefreshQuestInfo() { if ((Object)(object)cachedQuestCell != (Object)null && (Object)(object)cachedQuest != (Object)null) { cachedQuestCell.Apply_QuestInfo(cachedQuest); } } public static void RefreshQuestTrack() { for (int num = cachedQuestTrackElements.Count - 1; num >= 0; num--) { if ((Object)(object)cachedQuestTrackElements[num] != (Object)null && (Object)(object)cachedQuestTrackElements[num]._scriptQuest != (Object)null) { cachedQuestTrackElements[num].Update_QuestTrackElement(); } else { cachedQuestTrackElements.RemoveAt(num); } } } private static Text FindGameObjectTextChild(GameObject obj, string componentName) { Transform val = obj.transform.Find(componentName); if ((Object)(object)val != (Object)null) { return ((Component)val).GetComponent(); } Debug.LogError((object)("找不到对象: " + componentName)); return null; } [HarmonyPatch(typeof(QuestMenuCellSlot), "Update")] [HarmonyPostfix] public static void QuestMenuCellSlot_Update(QuestMenuCellSlot __instance) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Invalid comparison between Unknown and I4 //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)__instance._scriptQuest)) { int fontSize = __instance._slotTag.fontSize; string text = Localyssation.GetString($"{KeyUtil.GetForAsset(__instance._scriptQuest)}_NAME", __instance._scriptQuest._questName, fontSize); string text2 = string.Format(Localyssation.GetString("FORMAT_QUEST_REQUIRED_LEVEL", "SAME_AS_KEY", fontSize), __instance._scriptQuest._questLevel); __instance._slotTag.text = text + "\n" + text2; QuestSubType questSubType = __instance._scriptQuest._questSubType; QuestSubType val = questSubType; if ((int)val != 1) { if ((int)val == 2) { __instance._slotTag.text = "" + text + "\n" + Localyssation.GetString("QUEST_TYPE_CLASS", null, fontSize) + ""; } } else { __instance._slotTag.text = "" + text + "\n" + text2 + ""; } } else { __instance._slotTag.text = Localyssation.GetString("QUEST_MENU_CELL_SLOT_EMPTY", __instance._slotTag.text, __instance._slotTag.fontSize); } } [HarmonyPatch(typeof(QuestSelectionManager), "Handle_QuestSelector")] [HarmonyPostfix] public static void QuestSelectionManager_Handle_QuestSelector_Postfix(QuestSelectionManager __instance) { __instance._questSelectionHeader.text = Localyssation.GetString("QUEST_SELECTION_HEADER", __instance._questSelectionHeader.text, __instance._questSelectionHeader.fontSize); __instance._questAcceptButtonText.text = __instance._questAcceptButtonText.text.Replace("Accept Quest", Localyssation.GetString("QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_ACCEPT")).Replace("Quest Locked", Localyssation.GetString("QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_LOCKED")).Replace("Complete Quest", Localyssation.GetString("QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_TURN_IN")) .Replace("Quest Incomplete", Localyssation.GetString("QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_INCOMPLETE")) .Replace("Select a Quest", Localyssation.GetString("QUEST_SELECTION_MANAGER_QUEST_ACCEPT_BUTTON_UNSELECTED")); } 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 (LanguageManager.CurrentLanguage.ContainsKey($"{text2}_VARIANT_{requirement}")) { text2 = $"{text2}_VARIANT_{requirement}"; } else if (LanguageManager.CurrentLanguage.ContainsKey(text2 + "_PLURAL")) { text2 += "_PLURAL"; } if (LanguageManager.CurrentLanguage.ContainsKey($"{text}_VARIANT_{requirement}")) { text = $"{text}_VARIANT_{requirement}"; } else if (LanguageManager.CurrentLanguage.ContainsKey(text + "_PLURAL")) { text += "_PLURAL"; } } if (LanguageManager.CurrentLanguage.ContainsKey(text2 + "_VARIANT_QUEST_KILLED")) { text2 += "_VARIANT_QUEST_KILLED"; } return string.Format(Localyssation.GetString(text, "SAME_AS_KEY", fontSize), Localyssation.GetString(text2, "SAME_AS_KEY", fontSize)); } [HarmonyPatch(typeof(QuestTrackElement), "Update_QuestTrackElement")] [HarmonyPostfix] public static void QuestTrackElement_Handle_QuestTrackInfo(QuestTrackElement __instance) { if (!cachedQuestTrackElements.Contains(__instance)) { cachedQuestTrackElements.Add(__instance); } ScriptableQuest scriptQuest = __instance._scriptQuest; QuestTranslationKey forAsset = KeyUtil.GetForAsset(scriptQuest); if (!string.IsNullOrEmpty(scriptQuest._questName)) { Text trackQuestNameText = __instance._trackQuestNameText; trackQuestNameText.text = trackQuestNameText.text.Replace(scriptQuest._questName, Localyssation.GetString($"{forAsset}_NAME", scriptQuest._questName, trackQuestNameText.fontSize)); } PlayerQuesting component = ((Component)Player._mainPlayer).GetComponent(); 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; QuestObjective questObjective = scriptQuest._questObjective; for (int i = 0; i < questObjective._questItemRequirements.Length; i++) { QuestItemRequirement val2 = questObjective._questItemRequirements[i]; string key = $"{KeyUtil.GetForAsset(val2._questItem)}_NAME"; ReplaceTrackElementText(Localyssation.GetString(key, val2._questItem._itemName, fontSize), val._itemProgressValues[i], val2._itemsNeeded); } for (int j = 0; j < questObjective._questCreepRequirements.Length; j++) { QuestCreepRequirement val3 = questObjective._questCreepRequirements[j]; ReplaceTrackElementText(GetCreepKillRequirementText(val3._questCreep, val3._creepsKilled, fontSize), val._creepKillProgressValues[j], val3._creepsKilled); } for (int k = 0; k < questObjective._questTriggerRequirements.Length; k++) { QuestTriggerRequirement val4 = questObjective._questTriggerRequirements[k]; string text = Localyssation.GetString($"{KeyUtil.GetForAsset(val4)}_PREFIX", val4._prefix, fontSize); string text2 = Localyssation.GetString($"{KeyUtil.GetForAsset(val4)}_SUFFIX", val4._suffix, fontSize); ReplaceTrackElementText(text + " " + text2, val._triggerProgressValues[k], val4._triggerEmitsNeeded); } if (scriptQuest._questCompleteReturnMessage != null && scriptQuest._questCompleteReturnMessage.Length > 0) { string key2 = $"{forAsset}_COMPLETE_RETURN_MESSAGE_TRACK"; int num = trackElementText.Length - 1; trackElementText[num] = trackElementText[num].Replace(scriptQuest._questCompleteReturnMessage, Localyssation.GetString(key2, scriptQuest._questCompleteReturnMessage, fontSize)); } __instance._trackElementText.text = string.Join("\n", trackElementText); } void ReplaceTrackElementText(string newText, int progressCurrent, int progressMax) { string text3 = trackElementText[c].Substring(0, trackElementText[c].IndexOf(">") + 1); string text4 = string.Format(Localyssation.GetString("FORMAT_QUEST_PROGRESS", "SAME_AS_KEY", fontSize), newText, progressCurrent, progressMax); trackElementText[c] = text3 + text4 + ""; c++; } } [HarmonyPatch(typeof(QuestSelectionManager), "OnClick_QuestAcceptButton")] [HarmonyTranspiler] public static IEnumerable QuestSelectionManager__OnClick_QuestAcceptButton__Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceStrings(new TranslationKey[1] { I18nKeys.ErrorMessages.QUEST_LOG_FULL }).Unwrap(); } [HarmonyPatch(typeof(SettingsManager), "Start")] [HarmonyPostfix] public static void SettingsManager_Start(SettingsManager __instance) { RTUtil.RemapAllTextUnderObject(((Component)__instance).gameObject, new Dictionary { { "Button_videoTab", I18nKeys.Settings.BUTTON_VIDEO }, { "_header_displaySettings", I18nKeys.Settings.Video.HEADER_VIDEO_SETTINGS }, { "_cell_screenMode", I18nKeys.Settings.Video.CELL_SCREEN_MODE }, { "_cell_screenResolution", I18nKeys.Settings.Video.CELL_SCREEN_RESOLUTION }, { "_cell_verticalSync", I18nKeys.Settings.Video.CELL_VERTICAL_SYNC }, { "_cell_anisotropicFiltering", I18nKeys.Settings.Video.CELL_ANISOTROPIC_FILTERING }, { "_cell_antiAliasing", I18nKeys.Settings.Video.CELL_ANTI_ALIASING }, { "_cell_textureQuality", I18nKeys.Settings.Video.CELL_TEXTURE_QUALITY }, { "_cell_textureFiltering", I18nKeys.Settings.Video.CELL_TEXTURE_FILTERING }, { "_header_CameraSettings", I18nKeys.Settings.Video.HEADER_CAMERA_SETTINGS }, { "_cell_fieldOfView", I18nKeys.Settings.Video.CELL_FIELD_OF_VIEW }, { "_cell_cameraSmoothing", I18nKeys.Settings.Video.CELL_CAMERA_SMOOTHING }, { "_cell_cameraHoriz", I18nKeys.Settings.Video.CELL_CAMERA_HORIZ }, { "_cell_cameraVert", I18nKeys.Settings.Video.CELL_CAMERA_VERT }, { "_cell_cameraRenderDistance", I18nKeys.Settings.Video.CELL_CAMERA_RENDER_DISTANCE }, { "_header_cursorSettings", I18nKeys.Settings.Video.HEADER_CURSOR_SETTINGS }, { "_cell_setCursor", I18nKeys.Settings.Video.CELL_CURSOR_GRAPHIC }, { "_cell_useHardwareCursor", I18nKeys.Settings.Video.CELL_HARDWARE_CURSOR }, { "_header_accessibilitySettings", I18nKeys.Settings.Video.HEADER_ACCESSIBILITY_SETTINGS }, { "_cell_jiggleBonesToggle", I18nKeys.Settings.Video.CELL_JIGGLE_BONES_TOGGLE }, { "_cell_clearUnderclothesToggle", I18nKeys.Settings.Video.CELL_CLEAR_UNDERCLOTHES_TOGGLE }, { "_cell_weaponGlow", I18nKeys.Settings.Video.CELL_WEAPON_GLOW }, { "_cell_disableGibs", I18nKeys.Settings.Video.CELL_DISABLE_GIB_EFFECT }, { "_cell_cameraShake", I18nKeys.Settings.Video.CELL_CAMERA_SHAKE }, { "_header_PostProcessing", I18nKeys.Settings.Video.HEADER_POST_PROCESSING }, { "_cell_cameraBitcrushShader", I18nKeys.Settings.Video.CELL_CAMERA_BITCRUSH_SHADER }, { "_cell_cameraWaterEffect", I18nKeys.Settings.Video.CELL_CAMERA_WATER_EFFECT }, { "Button_audioTab", I18nKeys.Settings.BUTTON_AUDIO }, { "_header_audioSettings", I18nKeys.Settings.Audio.HEADER_AUDIO_SETTINGS }, { "_cell_masterVolume", I18nKeys.Settings.Audio.CELL_MASTER_VOLUME }, { "_cell_muteApplication", I18nKeys.Settings.Audio.CELL_MUTE_APPLICATION }, { "_cell_muteMusic", I18nKeys.Settings.Audio.CELL_MUTE_MUSIC }, { "_header_audioChannelSettings_01", I18nKeys.Settings.Audio.HEADER_AUDIO_CHANNEL_SETTINGS }, { "_cell_gameVolume", I18nKeys.Settings.Audio.CELL_GAME_VOLUME }, { "_cell_guiVolume", I18nKeys.Settings.Audio.CELL_GUI_VOLUME }, { "_cell_ambienceVolume", I18nKeys.Settings.Audio.CELL_AMBIENCE_VOLUME }, { "_cell_musicVolume", I18nKeys.Settings.Audio.CELL_MUSIC_VOLUME }, { "_cell_voiceVolume", I18nKeys.Settings.Audio.CELL_VOICE_VOLUME }, { "Button_controlTab", I18nKeys.Settings.BUTTON_INPUT }, { "_header_inputSettings", I18nKeys.Settings.Input.HEADER_INPUT_SETTINGS }, { "_cell_axisType", I18nKeys.Settings.Input.CELL_AXIS_TYPE }, { "Image_06", I18nKeys.Settings.Input.GAME_PAD_WIP }, { "Image_07", I18nKeys.Settings.Input.CELL_RESET_BINDINGS }, { "InputDefaults_button", I18nKeys.Settings.Input.CELL_RESET_BINDINGS }, { "_header_cameraControl", I18nKeys.Settings.Input.HEADER_CAMERA_CONTROL }, { "_cell_cameraSensitivity", I18nKeys.Settings.Input.CELL_CAMERA_SENSITIVITY }, { "_cell_invertXCameraAxis", I18nKeys.Settings.Input.CELL_INVERT_X_CAMERA_AXIS }, { "_cell_invertYCameraAxis", I18nKeys.Settings.Input.CELL_INVERT_Y_CAMERA_AXIS }, { "_cell_keybinding_37", I18nKeys.Settings.Input.CELL_KEYBINDING_RESET_CAMERA }, { "Header_Movement", I18nKeys.Settings.Input.HEADER_MOVEMENT }, { "_cell_keybinding_up", I18nKeys.Settings.Input.CELL_KEYBINDING_UP }, { "_cell_keybinding_down", I18nKeys.Settings.Input.CELL_KEYBINDING_DOWN }, { "_cell_keybinding_left", I18nKeys.Settings.Input.CELL_KEYBINDING_LEFT }, { "_cell_keybinding_right", I18nKeys.Settings.Input.CELL_KEYBINDING_RIGHT }, { "_cell_keybinding_jump", I18nKeys.Settings.Input.CELL_KEYBINDING_JUMP }, { "_cell_keybinding_dash", I18nKeys.Settings.Input.CELL_KEYBINDING_DASH }, { "_cell_analogDirectionMode", I18nKeys.Settings.Input.CELL_ANALOG_DIRECTION_MODE }, { "Header_Strafing", I18nKeys.Settings.Input.HEADER_STRAFING }, { "_cell_keybinding_lockDirection", I18nKeys.Settings.Input.CELL_KEYBINDING_LOCK_DIRECTION }, { "_cell_strafeMode", I18nKeys.Settings.Input.CELL_KEYBINDING_STRAFE_MODE }, { "_cell_strafeWeapon", I18nKeys.Settings.Input.CELL_KEYBINDING_STRAFE_WEAPON }, { "_cell_strafeWeaponMoveAttack", I18nKeys.Settings.Input.CELL_STRAFE_WEAPON_MOVE_ATTACK }, { "_cell_strafeCasting", I18nKeys.Settings.Input.CELL_KEYBINDING_STRAFE_CASTING }, { "Header_Action", I18nKeys.Settings.Input.HEADER_ACTION }, { "_cell_keybinding_attack", I18nKeys.Settings.Input.CELL_KEYBINDING_ATTACK }, { "_cell_keybinding_chargeAttack", I18nKeys.Settings.Input.CELL_KEYBINDING_CHARGE_ATTACK }, { "_cell_keybinding_block", I18nKeys.Settings.Input.CELL_KEYBINDING_BLOCK }, { "_cell_keybinding_target", I18nKeys.Settings.Input.CELL_KEYBINDING_TARGET }, { "_cell_keybinding_interact", I18nKeys.Settings.Input.CELL_KEYBINDING_INTERACT }, { "_cell_keybinding_pvpFlag", I18nKeys.Settings.Input.CELL_KEYBINDING_PVP_FLAG }, { "_cell_keybinding_skillSlot01", I18nKeys.Settings.Input.CELL_KEYBINDING_SKILL_SLOT_01 }, { "_cell_keybinding_skillSlot02", I18nKeys.Settings.Input.CELL_KEYBINDING_SKILL_SLOT_02 }, { "_cell_keybinding_skillSlot03", I18nKeys.Settings.Input.CELL_KEYBINDING_SKILL_SLOT_03 }, { "_cell_keybinding_skillSlot04", I18nKeys.Settings.Input.CELL_KEYBINDING_SKILL_SLOT_04 }, { "_cell_keybinding_skillSlot05", I18nKeys.Settings.Input.CELL_KEYBINDING_SKILL_SLOT_05 }, { "_cell_keybinding_skillSlot06", I18nKeys.Settings.Input.CELL_KEYBINDING_SKILL_SLOT_06 }, { "_cell_keybinding_recall", I18nKeys.Settings.Input.CELL_KEYBINDING_RECALL }, { "_cell_keybinding_quickswapWeapon", I18nKeys.Settings.Input.CELL_KEYBINDING_QUICKSWAP_WEAPON }, { "_cell_keybinding_sheatheWeapon", I18nKeys.Settings.Input.CELL_KEYBINDING_SHEATHE_WEAPON }, { "_cell_keybinding_sit", I18nKeys.Settings.Input.CELL_KEYBINDING_SIT }, { "Header_ConsumableSlots", I18nKeys.Settings.Input.HEADER_CONSUMABLE_SLOTS }, { "_cell_keybinding_quickSlot01", I18nKeys.Settings.Input.CELL_KEYBINDING_QUICK_SLOT_01 }, { "_cell_keybinding_quickSlot02", I18nKeys.Settings.Input.CELL_KEYBINDING_QUICK_SLOT_02 }, { "_cell_keybinding_quickSlot03", I18nKeys.Settings.Input.CELL_KEYBINDING_QUICK_SLOT_03 }, { "_cell_keybinding_quickSlot04", I18nKeys.Settings.Input.CELL_KEYBINDING_QUICK_SLOT_04 }, { "Header_Interface", I18nKeys.Settings.Input.HEADER_INTERFACE }, { "_cell_keybinding_38", I18nKeys.Settings.Input.CELL_KEYBINDING_HOST_CONSOLE }, { "_cell_keybinding_lexicon", I18nKeys.Settings.Input.CELL_KEYBINDING_LEXICON }, { "_cell_keybinding_tabMenu", I18nKeys.Settings.Input.CELL_KEYBINDING_TAB_MENU }, { "_cell_keybinding_statsTab", I18nKeys.Settings.Input.CELL_KEYBINDING_STATS_TAB }, { "_cell_keybinding_skillsTab", I18nKeys.Settings.Input.CELL_KEYBINDING_SKILLS_TAB }, { "_cell_keybinding_itemTab", I18nKeys.Settings.Input.CELL_KEYBINDING_ITEM_TAB }, { "_cell_keybinding_questTab", I18nKeys.Settings.Input.CELL_KEYBINDING_QUEST_TAB }, { "_cell_keybinding_whoTab", I18nKeys.Settings.Input.CELL_KEYBINDING_WHO_TAB }, { "_cell_keybinding_hideUI", I18nKeys.Settings.Input.CELL_KEYBINDING_HIDE_UI }, { "_header_resetBindings", I18nKeys.Settings.Input.HEADER_RESET_BINDINGS }, { "Button_gameTab", I18nKeys.Settings.BUTTON_NETWORK }, { "_header_gameSettings", I18nKeys.Settings.Network.HEADER_GAME_SETTINGS }, { "_cell_enablePvPOnMapEnter", I18nKeys.Settings.Network.CELL_ENABLE_PVP_ON_MAP_ENTER }, { "_cell_persistDisconnectHotkey", I18nKeys.Settings.Network.CELL_PERSIST_DISCONNECT_HOTKEY }, { "_cell_enableUnicode", I18nKeys.Settings.Network.CELL_ENABLE_UNICODE }, { "_header_nametagSettings", I18nKeys.Settings.Network.HEADER_NAMETAG_SETTINGS }, { "_cell_displayGlobalNicknameTags", I18nKeys.Settings.Network.CELL_DISPLAY_GLOBAL_NICKNAME_TAGS }, { "_cell_displayLocalNametag", I18nKeys.Settings.Network.CELL_DISPLAY_LOCAL_NAMETAG }, { "_cell_displayHostTag", I18nKeys.Settings.Network.CELL_DISPLAY_HOST_TAG }, { "_header_uiSettings", I18nKeys.Settings.Network.HEADER_UI_SETTINGS }, { "_cell_hideFPSCounter", I18nKeys.Settings.Network.CELL_HIDE_FPS_COUNTER }, { "_cell_hidePingCounter", I18nKeys.Settings.Network.CELL_HIDE_PING_COUNTER }, { "_cell_hideStatPointCounter", I18nKeys.Settings.Network.CELL_HIDE_STAT_POINT_COUNTER }, { "_cell_hideSkillPointCounter", I18nKeys.Settings.Network.CELL_HIDE_SKILL_POINT_COUNTER }, { "_cell_hideQuestTracker", I18nKeys.Settings.Network.CELL_HIDE_QUEST_TRACKER }, { "_cell_hideMinimap", I18nKeys.Settings.Network.CELL_HIDE_MINIMAP }, { "_cell_hideDamageIcons", I18nKeys.Settings.Network.CELL_HIDE_DAMAGE_VALUE_NUMBER_ICONS }, { "_cell_hidePeerCounter", I18nKeys.Settings.Network.CELL_HIDE_PEER_COUNTER }, { "_cell_hideNpcHeadIcons", I18nKeys.Settings.Network.CELL_HIDE_NPC_HEAD_ICONS }, { "_cell_displaySkillSlotCooldownCounters", I18nKeys.Settings.Network.CELL_DISPLAY_SKILL_SLOT_COOLDOWN_COUNTERS }, { "_header_chatboxSettings", I18nKeys.Settings.Network.HEADER_CHATBOX_SETTINGS }, { "_cell_defaultChatRoom", I18nKeys.Settings.Network.CELL_DEFAULT_CHANNEL }, { "_cell_fadeChatText", I18nKeys.Settings.Network.CELL_FADE_CHAT_TEXT }, { "_cell_fadeGameFeed", I18nKeys.Settings.Network.CELL_FADE_GAME_FEED_TEXT }, { "Button_cancelSettings", I18nKeys.Settings.BUTTON_CANCEL }, { "Button_applySettings", I18nKeys.Settings.BUTTON_APPLY } }, delegate(Transform textParent, string key) { Dropdown componentInChildren = ((Component)textParent).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { List> list = new List>(); for (int i = 0; i < componentInChildren.options.Count; i++) { OptionData val3 = componentInChildren.options[i]; string key2 = $"{key}_OPTION_{i + 1}"; if (LanguageManager.DefaultLanguage.TryGetString(key2, out var _)) { list.Add(LangAdjustables.GetStringFunc(key2, val3.text)); } } if (list.Count == componentInChildren.options.Count) { LangAdjustables.RegisterDropdown(componentInChildren, list); } } }); RTUtil.RemapChildTextsByPath(((Component)__instance).transform, new Dictionary { { "Canvas_SettingsMenu/_dolly_settingsMenu/_dolly_videoSettingsTab/_backdrop_videoTab/Scroll View_videoTab/Viewport_videoTab/Content_videoTab/_cell_fieldOfView/Button/Text", "SETTINGS_BUTTON_RESET" }, { "Canvas_SettingsMenu/_dolly_settingsMenu/_dolly_videoSettingsTab/_backdrop_videoTab/Scroll View_videoTab/Viewport_videoTab/Content_videoTab/_cell_cameraSmoothing/Button_01/Text", "SETTINGS_BUTTON_RESET" }, { "Canvas_SettingsMenu/_dolly_settingsMenu/_dolly_videoSettingsTab/_backdrop_videoTab/Scroll View_videoTab/Viewport_videoTab/Content_videoTab/_cell_cameraHoriz/_button_resetCameraHoriz/Text", "SETTINGS_BUTTON_RESET" }, { "Canvas_SettingsMenu/_dolly_settingsMenu/_dolly_videoSettingsTab/_backdrop_videoTab/Scroll View_videoTab/Viewport_videoTab/Content_videoTab/_cell_cameraVert/_button_resetCameraVert/Text", "SETTINGS_BUTTON_RESET" }, { "Canvas_SettingsMenu/_dolly_settingsMenu/_dolly_inputSettingsTab/_backdrop/Scroll View_inputTab/Viewport_inputTab/Content_inputTab/_cell_cameraSensitivity/_button_resetCameraSensitivity/Text", "SETTINGS_BUTTON_RESET" }, { "Canvas_SettingsMenu/_dolly_settingsMenu/_dolly_videoSettingsTab(Clone)/_backdrop_videoTab/Scroll View_videoTab/Viewport_videoTab/Content_videoTab/EasySettings TabSelector(Clone)/Label", "SETTINGS_MOD_HEADER_GENERAL" } }); if (!((Object)(object)__instance._gamepadInputDollyObject != (Object)null)) { return; } Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "Gamepad Layout", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_HEADER }, { "Zoom in camera\nItem Quickslot", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_DPAD_UP }, { "Zoom out camera\nItem Quickslot", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_DPAD_DOWN }, { "Recall\nItem Quickslot", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_DPAD_LEFT }, { "Sit down\nItem Quickslot", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_DPAD_RIGHT }, { "Confirm / Jump", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_SOUTH }, { "Cancel / Dash\nSkill Slot", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_EAST }, { "Interact\nSkill Slot", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_WEST }, { "Swap Loadout\nSkill Slot", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_NORTH }, { "Block (Hold)\nUI Select -", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_LT }, { "Attack (Hold)\nUI Select +", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_RT }, { "Tab Menu", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_START }, { "Open Chat", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_SELECT }, { "Skill / Item Slot Selection (Hold)\nUI Navigation", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_SHOULDERS }, { "Reposition Camera\nLock on (Press)", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_RIGHT_STICK }, { "Movement\nSheathe Weapon (Press)", I18nKeys.IntroAndTags.GAMEPAD_LAYOUT_LEFT_STICK } }; Text[] componentsInChildren = __instance._gamepadInputDollyObject.GetComponentsInChildren(true); foreach (Text val in componentsInChildren) { string text = val.text.Trim(); string text2 = ((Object)val).name; Transform parent = ((Component)val).transform.parent; while ((Object)(object)parent != (Object)null) { text2 = ((Object)parent).name + "/" + text2; parent = parent.parent; } Localyssation.logger.LogInfo((object)("[GAMEPAD_UI_TEXT] " + text2 + " : \"" + text + "\"")); if (dictionary.TryGetValue(text, out var value)) { val.text = Localyssation.GetString(value, val.text); } } TMP_Text[] componentsInChildren2 = __instance._gamepadInputDollyObject.GetComponentsInChildren(true); foreach (TMP_Text val2 in componentsInChildren2) { string text3 = val2.text.Trim(); string text4 = ((Object)val2).name; Transform parent2 = val2.transform.parent; while ((Object)(object)parent2 != (Object)null) { text4 = ((Object)parent2).name + "/" + text4; parent2 = parent2.parent; } Localyssation.logger.LogInfo((object)("[GAMEPAD_UI_TMP] " + text4 + " : \"" + text3 + "\"")); if (dictionary.TryGetValue(text3, out var value2)) { val2.text = Localyssation.GetString(value2, val2.text); } } } [HarmonyPatch(typeof(ShopkeepManager), "Handle_ShopkeepUIBehavior")] [HarmonyPostfix] public static void ShopkeepManager_Handle_ShopkeepUIBehavior_Postfix(ShopkeepManager __instance) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance._scriptShopkeep != (Object)null) { __instance._shopkeepHeaderText.text = "- " + Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(__instance._scriptShopkeep), "_SHOP_NAME")) + " -"; __instance._shopkeepTabHeaderText.text = Localyssation.GetString(KeyUtil.GetForAsset(__instance._currentShopTab)); ((Component)__instance._rerollGambleButton).GetComponentInChildren().text = Localyssation.GetString(I18nKeys.Shop.BUTTON_REROLL); ((Component)__instance._sellQuantityOneButton).GetComponentInChildren().text = Localyssation.GetString(I18nKeys.Shop.BUTTON_SELL_SINGLE); ((Component)__instance._sellQuantityButton).GetComponentInChildren().text = Localyssation.GetString(I18nKeys.Shop.BUTTON_SELL_QUANTITY); ((Component)__instance._cancelSellPromptButton).GetComponentInChildren().text = Localyssation.GetString(I18nKeys.Shop.BUTTON_CANCEL_SELL); ((Component)__instance._purchaseButton).GetComponentInChildren().text = Localyssation.GetString(I18nKeys.Shop.BUTTON_PURCHASE_SINGLE); ((Component)__instance._purchaseQuantityButton).GetComponentInChildren().text = Localyssation.GetString(I18nKeys.Shop.BUTTON_PURCHASE_QUANTITY); ((Component)__instance._cancelPromptButton).GetComponentInChildren().text = Localyssation.GetString(I18nKeys.Shop.BUTTON_CANCEL_PURCHASE); } } [HarmonyPatch(typeof(ShopkeepManager), "Init_ShopTooltip")] [HarmonyPrefix] public static bool ShopkeepManager_Init_ShopTooltip_Prefix(ShopkeepManager __instance, int _tabValue) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) ToolTipManager._current._genericToolTip.Set_TooltipAnchorPos(Vector2.op_Implicit(new Vector2(100f, 0f))); if (0 > _tabValue || _tabValue > 3) { return false; } ShopTab shopTab = (ShopTab)(byte)_tabValue; ToolTipManager._current.Apply_GenericToolTip(Localyssation.GetString(KeyUtil.GetForAsset(shopTab))); ToolTipManager._current._genericToolTip.Enable_ToolTip(); return false; } [HarmonyPatch(typeof(ShopkeepManager), "Init_SellItem")] [HarmonyTranspiler] public static IEnumerable ShopkeepManager_Init_SellItem_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[3] { I18nKeys.Shop.ERROR_VENDOR_DOESNT_BUY, I18nKeys.Shop.ERROR_VENDOR_DOESNT_WANT, I18nKeys.Shop.ERROR_NO_VALUE }); } [HarmonyPatch(typeof(SkillsMenuCell), "Cell_OnAwake")] [HarmonyPostfix] public static void SkillsMenuCell_Cell_OnAwake(SkillsMenuCell __instance) { RTUtil.RemapAllTextUnderObject(((Component)__instance).gameObject, new Dictionary { { "_text_skillsHeader", "TAB_MENU_CELL_SKILLS_HEADER" } }); RTUtil.RemapChildTextsByPath(((Component)__instance).transform, new Dictionary { { "_backdrop_skillPoints/_text_skillPointsTag", "TAB_MENU_CELL_SKILLS_SKILL_POINT_COUNTER" }, { "_skillContentGroups/Content_generalSkills/_skillsCell_skillListObject_recall/_text_skillRank", "SKILL_RANK_SOULBOUND" } }, delegate(Transform transform, string key) { if (key == "TAB_MENU_CELL_SKILLS_SKILL_POINT_COUNTER") { Text component = ((Component)transform).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.alignment = (TextAnchor)3; } } }); } [HarmonyPatch(typeof(SkillsMenuCell), "Init_ClassTabTooltip")] [HarmonyPostfix] public static void SkillsMenuCell_Init_ClassTabTooltip(SkillsMenuCell __instance, int _tabValue) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected I4, but got Unknown PlayerStats pStats = Player._mainPlayer._pStats; SkillTier val = (SkillTier)(byte)_tabValue; SkillTier val2 = val; switch ((int)val2) { case 0: ToolTipManager._current.Apply_GenericToolTip(Localyssation.GetString("TAB_MENU_CELL_SKILLS_CLASS_TAB_TOOLTIP_NOVICE")); break; case 1: { ScriptablePlayerBaseClass val3 = Player._mainPlayer._pStats._class; if (Object.op_Implicit((Object)(object)val3)) { string text = $"{KeyUtil.GetForAsset(val3)}_NAME"; if (LanguageManager.CurrentLanguage.ContainsKey(text + "_VARIANT_OF")) { text += "_VARIANT_OF"; } ToolTipManager._current.Apply_GenericToolTip(string.Format(Localyssation.GetString("TAB_MENU_CELL_SKILLS_CLASS_TAB_TOOLTIP"), Localyssation.GetString(text, val3._className))); } break; } case 2: if (Object.op_Implicit((Object)(object)pStats._class) && pStats._syncClassTier > 0) { ToolTipManager._current.Apply_GenericToolTip(string.Format(Localyssation.GetString("TAB_MENU_CELL_SKILLS_CLASS_TAB_TOOLTIP"), KeyUtil.GetForAsset(pStats._class._playerClassTiers[pStats._syncClassTier - 1]).Name.Localize())); } break; } } [HarmonyPatch(typeof(SkillsMenuCell), "Handle_CellUpdate")] [HarmonyTranspiler] public static IEnumerable SkillsMenuCell_Handle_CellUpdate_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new TranslationKey[2] { I18nKeys.TabMenu.PAGER_1_PAGE, I18nKeys.TabMenu.PAGER_FORMAT }); } [HarmonyPatch(typeof(SkillsMenuCell), "Handle_CellUpdate")] [HarmonyPostfix] public static void SkillsMenuCell_Handle_CellUpdate(SkillsMenuCell __instance) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected I4, but got Unknown if (!TabMenu._current._isOpen || !Object.op_Implicit((Object)(object)Player._mainPlayer)) { return; } PlayerStats pStats = Player._mainPlayer._pStats; string text = __instance._skillsCell_classHeader.text; int fontSize = __instance._skillsCell_classHeader.fontSize; SkillTier currentSkillTab = __instance._currentSkillTab; SkillTier val = currentSkillTab; switch ((int)val) { case 0: text = Localyssation.GetString("TAB_MENU_CELL_SKILLS_CLASS_HEADER_NOVICE", text, fontSize); break; case 1: { string text2 = $"{KeyUtil.GetForAsset(Player._mainPlayer._pStats._class)}_NAME"; if (LanguageManager.CurrentLanguage.ContainsKey(text2 + "_VARIANT_OF")) { text2 += "_VARIANT_OF"; } text = string.Format(Localyssation.GetString("TAB_MENU_CELL_SKILLS_CLASS_HEADER", "SAME_AS_KEY", fontSize), Localyssation.GetString(text2, Player._mainPlayer._pStats._class._className, fontSize)); break; } case 2: if (!Object.op_Implicit((Object)(object)pStats._class) || pStats._syncClassTier <= 0) { return; } text = I18nKeys.TabMenu.CELL_SKILLS_CLASS_HEADER_FORMAT.Format(KeyUtil.GetForAsset(pStats._class._playerClassTiers[pStats._syncClassTier - 1]).Name); break; } __instance._skillsCell_classHeader.text = text; } [HarmonyPatch(typeof(SkillListDataEntry), "Update")] [HarmonyPostfix] public static void SkillListDataEntry_Handle_SkillData(SkillListDataEntry __instance) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)Player._mainPlayer) || Player._mainPlayer._bufferingStatus || !Object.op_Implicit((Object)(object)__instance._scriptSkill)) { return; } ScriptableSkill scriptSkill = __instance._scriptSkill; ((TMP_Text)__instance._skillNameText).text = Localyssation.GetString($"{KeyUtil.GetForAsset(scriptSkill)}_NAME", ((TMP_Text)__instance._skillNameText).text, (int)((TMP_Text)__instance._skillNameText).fontSize); SkillStruct skillStruct = __instance._skillStruct; if (skillStruct._skillUnlocked) { if (Object.op_Implicit((Object)(object)__instance._skillRankText)) { if ((int)scriptSkill._skillControlType == 3) { ((TMP_Text)__instance._skillRankText).text = Localyssation.GetString(KeyUtil.GetForAsset(scriptSkill._skillControlType)); } else { ((TMP_Text)__instance._skillRankText).text = Localyssation.GetString(KeyUtil.GetForAsset(scriptSkill._skillUtilityType)); } } } else if (Object.op_Implicit((Object)(object)__instance._skillRankText)) { ((TMP_Text)__instance._skillRankText).text = string.Format(Localyssation.GetString(I18nKeys.SkillMenu.SKILL_POINT_COST_FORMAT), scriptSkill._skillRankParams._skillPointCost); } } [HarmonyPatch(typeof(SkillToolTip), "Apply_SkillStats")] [HarmonyPostfix] public static void SkillToolTip_Apply_SkillStats(SkillToolTip __instance) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Invalid comparison between Unknown and I4 ScriptableSkill skill; if (Object.op_Implicit((Object)(object)Player._mainPlayer) && Object.op_Implicit((Object)(object)__instance._scriptSkill)) { skill = __instance._scriptSkill; TranslationKey forAsset = KeyUtil.GetForAsset(__instance._scriptSkill); ((TooltipElement)__instance)._toolTipName.text = Localyssation.GetString($"{forAsset}_NAME", "SAME_AS_KEY", ((TooltipElement)__instance)._toolTipName.fontSize); if ((int)skill._skillControlType != 3) { NonPassiveSkillsTooltip(); } else { ((TooltipElement)__instance)._toolTipSubName.text = Localyssation.GetString(KeyUtil.GetForAsset((SkillControlType)3)); } } void NonPassiveSkillsTooltip() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) ((TooltipElement)__instance)._toolTipSubName.text = Localyssation.GetString(KeyUtil.GetForAsset(skill._skillUtilityType)); __instance._scaleTypeText.text = Localyssation.GetString(KeyUtil.GetForAsset(skill._skillDamageType)); } } [HarmonyPatch(typeof(SkillToolTip), "Apply_SkillStats")] [HarmonyTranspiler] public static IEnumerable SkillToolTip_Apply_SkillStats_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new TranslationKey[7] { I18nKeys.SkillMenu.TOOLTIP_MANA_COST, I18nKeys.SkillMenu.TOOLTIP_HEALTH_COST, I18nKeys.SkillMenu.TOOLTIP_STAMINA_COST, I18nKeys.SkillMenu.TOOLTIP_CAST_TIME, I18nKeys.SkillMenu.TOOLTIP_ITEM_COST, I18nKeys.SkillMenu.TOOLTIP_CAST_TIME_INSTANT, I18nKeys.SkillMenu.TOOLTIP_COOLDOWN }); } [HarmonyPatch(typeof(ScriptableStatusCondition), "Generate_ConditionDescriptor")] [HarmonyTranspiler] public static IEnumerable ScriptableStatusCondition__Generate_ConditionDescriptor__Transpiler(IEnumerable instructions) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(ScriptableCondition), "_conditionDescription"); CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_0, (object)null, (string)null) }).Advance(1); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), Transpilers.EmitDelegate>((Func)((string src, ScriptableStatusCondition instance) => Localyssation.GetString(string.Concat(KeyUtil.GetForAsset((ScriptableCondition)(object)instance), "_DESCRIPTION")))) }); return RTUtil.SimpleStringReplaceTranspiler(val.InstructionEnumeration(), new Dictionary { { "every {0} sec.", I18nKeys.ScriptableStatusCondition.RATE_FORMAT }, { " Lasts for {0} sec.", I18nKeys.ScriptableStatusCondition.DURATION_FORMAT } }); } [HarmonyPatch(typeof(SkillToolTip), "Apply_ConditionRankInfo")] [HarmonyTranspiler] public static IEnumerable SkillToolTip__Apply_ConditionRankInfo__Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ScriptableCondition), "_conditionName"), (string)null) }).Advance(1); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldloc_0, (object)null), Transpilers.EmitDelegate>((Func)((string src, ScriptableCondition condition) => Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(condition), "_NAME")))) }); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ScriptableConditionGroup), "_conditionGroupTag"), (string)null) }).Advance(1); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldloc_0, (object)null), Transpilers.EmitDelegate>((Func)((string src, ScriptableCondition condition) => Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(condition._conditionGroup), "_NAME")))) }); return RTUtil.SimpleStringReplaceTranspiler(val.InstructionEnumeration(), new TranslationKey[1] { I18nKeys.SkillMenu.TOOLTIP_DESCRIPTOR_CONDITION_CANCEL_ON_HIT }); } [HarmonyPatch(typeof(StatsMenuCell), "Cell_OnAwake")] [HarmonyPostfix] public static void StatsMenuCell_Cell_OnAwake(StatsMenuCell __instance) { RTUtil.RemapAllTextUnderObject(((Component)__instance).gameObject, new Dictionary { { "_text_statsHeader", "TAB_MENU_CELL_STATS_HEADER" }, { "_tag_attributePoints", "TAB_MENU_CELL_STATS_ATTRIBUTE_POINT_COUNTER" }, { "_text_attributePointCounter", "TAB_MENU_CELL_STATS_BUTTON_APPLY_ATTRIBUTE_POINTS" } }); RTUtil.RemapChildTextsByPath(((Component)__instance).transform, new Dictionary { { "_statsCell_infoStatPanel/_statInfoCell_nickName/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_NICK_NAME" }, { "_statsCell_infoStatPanel/_statInfoCell_raceName/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_RACE_NAME" }, { "_statsCell_infoStatPanel/_statInfoCell_className/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_CLASS_NAME" }, { "_statsCell_infoStatPanel/_statInfoCell_levelCounter/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_LEVEL_COUNTER" }, { "_statsCell_infoStatPanel/_statInfoCell_experience/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_EXPERIENCE" }, { "_statsCell_infoStatPanel/_statInfoCell_maxHealth/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAX_HEALTH" }, { "_statsCell_infoStatPanel/_statInfoCell_maxMana/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAX_MANA" }, { "_statsCell_infoStatPanel/_statInfoCell_maxStamina/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAX_STAMINA" }, { "_statsCell_infoStatPanel/_statInfoCell_attack/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_ATTACK" }, { "_statsCell_infoStatPanel/_statInfoCell_rangedPower/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_RANGED_POWER" }, { "_statsCell_infoStatPanel/_statInfoCell_physCritical/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_PHYS_CRITICAL" }, { "_statsCell_infoStatPanel/_statInfoCell_magicPow/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_POW" }, { "_statsCell_infoStatPanel/_statInfoCell_magicCrit/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_CRIT" }, { "_statsCell_infoStatPanel/_statInfoCell_defense/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_DEFENSE" }, { "_statsCell_infoStatPanel/_statInfoCell_magicDef/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_MAGIC_DEF" }, { "_statsCell_infoStatPanel/_statInfoCell_evasion/Image_01/Text", "TAB_MENU_CELL_STATS_INFO_CELL_EVASION" }, { "_statsCell_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.Locate_PlayerRace(((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.text, __instance._statsCell_raceTag.fontSize); } } if (((TabMenuCell)__instance)._mainPlayer._pStats._currentLevel >= GameManager._current._statLogics._maxMainLevel) { __instance._statsCell_experience.text = Localyssation.GetString("EXP_COUNTER_MAX", __instance._statsCell_experience.text, __instance._statsCell_experience.fontSize); } int fontSize = __instance._statsCell_baseClassTag.fontSize; string text = ((!Object.op_Implicit((Object)(object)((TabMenuCell)__instance)._mainPlayer._pStats._class)) ? Localyssation.GetString("PLAYER_CLASS_EMPTY_NAME", GameManager._current._statLogics._emptyClassName, fontSize) : Localyssation.GetString($"{KeyUtil.GetForAsset(((TabMenuCell)__instance)._mainPlayer._pStats._class)}_NAME", ((TabMenuCell)__instance)._mainPlayer._pStats._class._className, fontSize)); __instance._statsCell_baseClassTag.text = text; } [HarmonyPatch(typeof(StatsMenuCell), "ToolTip_DisplayBaseStat")] [HarmonyTranspiler] public static IEnumerable StatsMenuCell_ToolTip_DisplayBaseStat_Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new Dictionary { { "Base Stat: ", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_BEGIN" }, { "% (Critical %)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_CRIT" }, { "% (Evasion %)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_EVASION" }, { "{0} (Attack Power)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_ATTACK_POW" }, { "{0} (Max Mana)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_MP" }, { "{0} (Max Health)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAX_HP" }, { "{0} (Dex Power)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_RANGE_POW" }, { "% (Magic Critical %)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_END_MAGIC_CRIT" }, { "{0} (Magic Defense)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAGIC_DEF" }, { "{0} (Defense)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_DEFENSE" }, { "{0} (Magic Power)", "TAB_MENU_CELL_STATS_TOOLTIP_BASE_STAT_FORMAT_MAGIC_POW" }, { "{0} (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)) { TranslationKey forAsset = KeyUtil.GetForAsset(__instance._gm._statLogics._statAttributes[((ListDataEntry)__instance)._dataID]); ((ListDataEntry)__instance)._dataNameText.text = Localyssation.GetString($"{forAsset}_NAME", ((ListDataEntry)__instance)._dataNameText.text, ((ListDataEntry)__instance)._dataNameText.fontSize); } } [HarmonyPatch(typeof(AttributeListDataEntry), "Init_TooltipInfo")] [HarmonyPostfix] public static void AttributeListDataEntry_Init_TooltipInfo(AttributeListDataEntry __instance) { if (!string.IsNullOrEmpty(__instance._scriptableAttribute._attributeDescriptor)) { TranslationKey forAsset = KeyUtil.GetForAsset(__instance._scriptableAttribute); ToolTipManager._current.Apply_GenericToolTip(Localyssation.GetString($"{forAsset}_DESCRIPTOR", __instance._scriptableAttribute._attributeDescriptor)); } } [HarmonyPatch(typeof(SteamManager), "Awake")] [HarmonyPostfix] private static void SteamManager__Awake__Postfix(SteamManager __instance) { RTUtil.RemapChildTextsByPath(((Component)__instance).transform, new Dictionary { { LobbyTag("_tag_lobbyName"), I18nKeys.SteamLobby.TAG_LOBBY_NAME }, { LobbyTag("_tag_password"), I18nKeys.SteamLobby.TAG_LOBBY_PASSWORD }, { LobbyTag("_tag_motd"), I18nKeys.SteamLobby.TAG_MOTD }, { LobbyTag("_tag_lobbyType"), I18nKeys.SteamLobby.TAG_LOBBY_TYPE }, { LobbyTag("_tag_maxPlayers"), I18nKeys.SteamLobby.TAG_MAX_PLAYERS }, { LobbyTag("_tag_streamMode"), I18nKeys.SteamLobby.TAG_STREAM_MODE }, { LobbyTag("_tag_lobbyFocusType"), I18nKeys.SteamLobby.TAG_LOBBY_REALM }, { "Canvas_SteamLobbyHost/_dolly_hostWindow/_dolly_serverSettings/_backdrop_hostLobbyButtons/_button_cancelHostLobby/Text (Legacy)", I18nKeys.SteamLobby.BUTTON_RETURN }, { "Canvas_SteamLobbyHost/_dolly_hostWindow/_dolly_serverSettings/_backdrop_hostLobbyButtons/_button_hostLobby/Text (Legacy)", I18nKeys.SteamLobby.BUTTON_HOST_LOBBY }, { "Canvas_SteamLobbyHost/_dolly_hostWindow/_dolly_serverSettings/_backdrop_hostLobbySettings/_dolly_hostLobbySettings/_input_lobbyName/Placeholder", I18nKeys.SteamLobby.PLACEHOLDER_LOBBY_NAME }, { "Canvas_SteamLobbyHost/_dolly_hostWindow/_dolly_serverSettings/_backdrop_hostLobbySettings/_dolly_hostLobbySettings/_input_lobbyPassword/Placeholder", I18nKeys.SteamLobby.PLACEHOLDER_LOBBY_PASSWORD }, { "Canvas_SteamLobbyHost/_dolly_hostWindow/_dolly_serverSettings/_backdrop_hostLobbySettings/_dolly_hostLobbySettings/_input_motd/Placeholder", I18nKeys.SteamLobby.PLACEHOLDER_MOTD }, { "Canvas_SteamLobbyFinder/_dolly_lobbyFinderWindow/_dolly_finderOptions/_cancelLobbyFinderButton", I18nKeys.SteamLobby.BUTTON_RETURN }, { "Canvas_SteamLobbyFinder/_dolly_lobbyFinderWindow/_hiddenLobbyPanel/_dolly_hiddenLobbyPanel/_clearHiddenLobbiesButton/Text (Legacy)", I18nKeys.SteamLobby.CLEAR_HIDDEN_LOBBY_BUTTON } }); static string LobbyTag(string name) { return "Canvas_SteamLobbyHost/_dolly_hostWindow/_dolly_serverSettings/_backdrop_hostLobbySettings/_dolly_hostLobbyTags/" + name; } } [HarmonyPatch(typeof(LobbyListManager), "Awake")] [HarmonyPostfix] private static void LobbyListManager__Awake__Postfix(LobbyListManager __instance) { LangAdjustables.RegisterDropdown(__instance.dropDown_lobbyListFilter, I18nKeys.SteamLobby.LOBBY_LIST_FILTER_BASE); LangAdjustables.RegisterDropdown(__instance._lobbyTypeDropdown, I18nKeys.SteamLobby.LOBBY_TYPE_BASE); RTUtil.RemapAllInputPlaceholderTextUnderObject(((Component)__instance._input_lobbyNameSearch).gameObject, new Dictionary { { "Placeholder", I18nKeys.SteamLobby.PLACEHOLDER_LOBBY_NAME_SEARCH } }); RTUtil.RemapAllTextUnderObject(((Component)__instance._cancelButton).gameObject, new Dictionary { { "Text (Legacy)", I18nKeys.SteamLobby.BUTTON_RETURN } }); } [HarmonyPatch(typeof(LobbyListManager), "Init_ClearHiddenLobbyCache")] [HarmonyPatch(typeof(LobbyListManager), "Update")] [HarmonyPatch(typeof(LobbyListManager), "Handle_HostingParameters")] [HarmonyPatch(typeof(LobbyListManager), "Init_RefreshLobbyList")] [HarmonyPatch(typeof(LobbyListManager), "RefreshButtonBuffer")] [HarmonyPatch(typeof(LobbyListManager), "Iterate_SteamLobbies")] [HarmonyTranspiler] private static IEnumerable LobbyListManager__ALL__Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceStrings(new TranslationKey[12] { I18nKeys.SteamLobby.CLEARED_HIDDEN_LOBBY_CACHE, I18nKeys.SteamLobby.HIDDEN_LOBBY_COUNT_FORMAT, I18nKeys.SteamLobby.LOBBY_HOST_HEADER, I18nKeys.SteamLobby.LOBBY_HOST_HEADER_STEAM_UNAVAILABLE, I18nKeys.SteamLobby.LOBBY_TYPE_DESCRIPTION_FRIENDS, I18nKeys.SteamLobby.LOBBY_TYPE_DESCRIPTION_PUBLIC, I18nKeys.SteamLobby.LOBBY_TYPE_DESCRIPTION_PRIVATE, I18nKeys.SteamLobby.STEAM_NOT_INITIALIZED, I18nKeys.SteamLobby.SEARCHING_FOR_LOBBIES, I18nKeys.SteamLobby.NO_LOBBIES_FOUND, I18nKeys.SteamLobby.LOBBY_FOUNDED_COUNT_FORMAT_1, I18nKeys.SteamLobby.LOBBY_FOUNDED_COUNT_FORMAT_PLURAL }, allowRepeat: true, supressNotfoundWarnings: true).Unwrap(); } [HarmonyPatch(typeof(LobbyDataEntry), "SetLobbyData")] [HarmonyTranspiler] private static IEnumerable LobbyDataEntry__SetLobbyData__Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceStrings(new TranslationKey[3] { I18nKeys.SteamLobby.UNTITLED_LOBBY, I18nKeys.SteamLobby.LOBBY_PLAYER_COUNT, I18nKeys.SteamLobby.LOBBY_PING_FORMAT }).Unwrap(); } [HarmonyPatch(typeof(LobbyDataEntry), "SetLobbyData")] [HarmonyPostfix] private static void LobbyDataEntry__SetLobbyData__Postfix(LobbyDataEntry __instance) { __instance._joinLobbyButtonText.text = I18nKeys.SteamLobby.JOIN_LOBBY.Localize(); RTUtil.RemapChildTextsByPath(__instance._moddedLobbyTag.transform, new Dictionary { { "_text_moddedLobby", I18nKeys.SteamLobby.MODDED_LOBBY } }); } [HarmonyPatch(typeof(TabMenu), "Handle_TabMenuControl")] [HarmonyPostfix] public static void TabMenu__Handle_TabMenuControl__Postfix(TabMenu __instance) { if (__instance._currentCellSelection > 0) { string menuCell_tag = __instance._menuCells[__instance._currentCellSelection - 1]._menuCell_tag; string key = "TAB_MENU_CELL_" + KeyUtil.Normalize(menuCell_tag) + "_HEADER"; ((Component)__instance._button_previousCell).GetComponentInChildren().text = "<< " + Localyssation.GetString(key, I18nKeys.TR_KEYS[key]); } if (__instance._currentCellSelection < __instance._menuCells.Length - 1) { string menuCell_tag2 = __instance._menuCells[__instance._currentCellSelection + 1]._menuCell_tag; string key2 = "TAB_MENU_CELL_" + KeyUtil.Normalize(menuCell_tag2) + "_HEADER"; ((Component)__instance._button_nextCell).GetComponentInChildren().text = Localyssation.GetString(key2, I18nKeys.TR_KEYS[key2]) + " >>"; } } [HarmonyPatch(typeof(TabMenu), "Awake")] [HarmonyPostfix] public static void TabMenu__Awake__Postfix(TabMenu __instance) { RTUtil.RemapAllTextUnderObject(__instance._pointsAvailDolly_L, new Dictionary { { "Text", I18nKeys.TabMenu.POINTS_AVAILABLE } }); RTUtil.RemapAllTextUnderObject(__instance._pointsAvailDolly_R, new Dictionary { { "Text", I18nKeys.TabMenu.POINTS_AVAILABLE } }); } [HarmonyPatch(typeof(ItemMenuCell), "Cell_OnAwake")] [HarmonyPostfix] public static void ItemsMenu__Cell_OnAwake__Postfix(ItemMenuCell __instance) { RTUtil.RemapChildTextsByPath(((Component)__instance).transform, new Dictionary { { "_text_itemHeader", I18nKeys.TabMenu.CELL_ITEMS_HEADER } }); Text[] componentsInChildren = ((Component)__instance).GetComponentsInChildren(true); foreach (Text val in componentsInChildren) { string text = val.text.Trim(); if (text.Equals("Clean-up", StringComparison.OrdinalIgnoreCase) || text.Equals("Cleanup", StringComparison.OrdinalIgnoreCase) || text.Equals("Clean", StringComparison.OrdinalIgnoreCase)) { val.text = Localyssation.GetString("INVENTORY_BUTTON_CLEANUP", "Clean-up"); } else if (text.Equals("Sort Items", StringComparison.OrdinalIgnoreCase) || text.Equals("Sort", StringComparison.OrdinalIgnoreCase)) { val.text = Localyssation.GetString("INVENTORY_SORT_ITEMS", "Sort Items"); } } } [HarmonyPatch(typeof(ItemMenuCell), "Init_ItemPromptWindow")] [HarmonyPostfix] public static void ItemMenuCell__Init_ItemPromptWindow__Postfix(ItemMenuCell __instance, ItemListDataEntry _listEntry) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown foreach (KeyValuePair cELL_ITEMS_PROMPT_BUTTON in I18nKeys.TabMenu.CELL_ITEMS_PROMPT_BUTTONS) { string text = "_" + cELL_ITEMS_PROMPT_BUTTON.Key + "Button"; Localyssation.LogDebug(text); text = text.Replace("transmogrify", "transmog"); FieldInfo field = typeof(ItemMenuCell).GetField(text, BindingFlags.Instance | BindingFlags.NonPublic); Button val = (Button)field.GetValue(__instance); ((Component)val).GetComponentInChildren().text = Localyssation.GetString(cELL_ITEMS_PROMPT_BUTTON.Value); } } [HarmonyPatch(typeof(ItemMenuCell), "Handle_CellUpdate")] [HarmonyTranspiler] public static IEnumerable ItemMenuCell__Handle_CellUpdate__Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new List { I18nKeys.TabMenu.CELL_ITEMS_EQUIP_TAB_HEADER_EQUIPMENT, I18nKeys.TabMenu.CELL_ITEMS_EQUIP_TAB_HEADER_VANITY }); } [HarmonyPatch(typeof(ItemMenuCell), "Init_ItemTabToolTip")] [HarmonyTranspiler] public static IEnumerable ItemMenuCell__Init_ItemTabToolTip__Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new List { I18nKeys.TabMenu.CELL_ITEMS_EQUIP_TAB_HEADER_EQUIPMENT, I18nKeys.TabMenu.CELL_ITEMS_EQUIP_TAB_HEADER_VANITY, I18nKeys.TabMenu.CELL_ITEMS_EQUIP_TAB_HEADER_STAT }); } [HarmonyPatch(typeof(ItemMenuCell), "Init_InventoryTooltip")] [HarmonyTranspiler] public static IEnumerable ItemMenuCell__Init_InventoryTooltip__Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new List { I18nKeys.TabMenu.CELL_ITEMS_INVENTORY_SORT_ITEMS, I18nKeys.TabMenu.CELL_ITEMS_INVENTORY_TYPE_CONSUMABLE, I18nKeys.TabMenu.CELL_ITEMS_INVENTORY_TYPE_EQUIPMENT, I18nKeys.TabMenu.CELL_ITEMS_INVENTORY_TYPE_TRADE_ITEM }); } [HarmonyPatch(typeof(TargetInfoDisplayManager), "Handle_TargetInfoDisplay")] [HarmonyPostfix] public static void TargetInfoDisplayManager_Handle_TargetInfoDisplay_Postfix(TargetInfoDisplayManager __instance) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)Player._mainPlayer) && Object.op_Implicit((Object)(object)__instance._setStatusEntityTarget) && (int)Player._mainPlayer._currentPlayerCondition == 2 && Object.op_Implicit((Object)(object)__instance._setStatusEntityTarget._isCreep)) { Creep isCreep = __instance._setStatusEntityTarget._isCreep; if (Object.op_Implicit((Object)(object)isCreep._scriptStatModifier)) { __instance._targetNameField.text = Localyssation.GetString(KeyUtil.GetForAsset(isCreep._scriptStatModifier)) + " " + Localyssation.GetString(KeyUtil.GetForAsset(isCreep._scriptCreep).Name); } else { __instance._targetNameField.text = Localyssation.GetString(KeyUtil.GetForAsset(isCreep._scriptCreep).Name); } } } [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, RTUtil.GetFallbackTextEditTags()); } } [HarmonyPatch(typeof(Text), "OnEnable")] [HarmonyPostfix] public static void Text_OnEnable(Text __instance) { if (LanguageManager.CurrentLanguage != null && (Object)(object)__instance != (Object)null && (Object)(object)__instance.font != (Object)null) { LangAdjustables.RegisterText(__instance); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static void TMP_Text_set_font(TMP_Text __instance, TMP_FontAsset value) { AddUnifontFallback(value); } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static void TMP_Text_set_text(TMP_Text __instance) { AddUnifontFallback(__instance.font); } private static void AddUnifontFallback(TMP_FontAsset value) { if (FontManager.UnifontLoaded && value != null && (Object)(object)value != (Object)null) { if (value.fallbackFontAssetTable == null || value.fallbackFontAssetTable == null) { value.fallbackFontAssetTable = new List(); } if (!value.fallbackFontAssetTable.Contains(FontManager.UNIFONT_SDF)) { value.fallbackFontAssetTable.Add(FontManager.UNIFONT_SDF); } } } [HarmonyPatch(typeof(TextMeshProUGUI), "OnEnable")] [HarmonyPostfix] public static void TextMeshProUGUI__OnEnable__Postfix(TextMeshProUGUI __instance) { if (LanguageManager.CurrentLanguage != null && (Object)(object)__instance != (Object)null && (Object)(object)((TMP_Text)__instance).font != (Object)null) { LangAdjustables.RegisterText(__instance); } } [HarmonyPatch(typeof(WhoMenuCell), "Cell_OnAwake")] [HarmonyPostfix] public static void WhoMenu_Cell_OnAwake_Postfix(WhoMenuCell __instance) { RTUtil.RemapChildTextsByPath(((Component)__instance).transform, new Dictionary { { "_text_whoHeader", I18nKeys.TabMenu.CELL_WHO_HEADER }, { actionPath("inviteToParty"), I18nKeys.TabMenu.CELL_WHO_BUTTON_INVITE_TO_PARTY }, { actionPath("leaveParty"), I18nKeys.TabMenu.CELL_WHO_BUTTON_LEAVE_PARTY }, { actionPath("mutePeer"), I18nKeys.TabMenu.CELL_WHO_BUTTON_MUTE_PEER }, { actionPath("refreshList"), I18nKeys.TabMenu.CELL_WHO_BUTTON_REFRESH_LIST } }); static string actionPath(string action) { return "_panel_actionList/_button_" + action + "/_text_" + action + "Button"; } } [HarmonyPatch(typeof(WorldPortalManager), "Update")] [HarmonyPostfix] public static void WorldPortalManager__Update__Postfix(WorldPortalManager __instance) { if (Object.op_Implicit((Object)(object)__instance._selectedWorldPortalEntry)) { __instance._mapEntryHeaderText.text = " - " + Localyssation.GetString(KeyUtil.GetForMapName(__instance._selectedWorldPortalEntry._scriptMapData._mapCaptionTitle)) + " -"; } else { __instance._mapEntryHeaderText.text = Localyssation.GetString(I18nKeys.Lore.WORLDPORTAL_SELECT_WAYPOINT); } } [HarmonyPatch(typeof(WorldPortalManager), "Awake")] [HarmonyPostfix] public static void WorldPortalManager__Awake__Postfix(WorldPortalManager __instance) { RTUtil.RemapAllTextUnderObject(((Component)__instance).gameObject, new Dictionary { { "_text_worldPortal_header", I18nKeys.Lore.WORLDPORTAL_TITLE }, { "_button_teleportWorldPortal", I18nKeys.Lore.WORLDPORTAL_TELEPORT } }); } [HarmonyPatch(typeof(PatternInstanceManager), "On_DungeonKeyChange")] [HarmonyTranspiler] public static IEnumerable PatternInstanceManager__On_DungeonKeyChange__Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceStrings(new TranslationKey[2] { I18nKeys.ChatMessage.DUNGEON_KEY_DISSIPATES, I18nKeys.ChatMessage.RECIEVE_DUNGEON_KEY }).Unwrap(); } [HarmonyPatch(typeof(ChatBehaviour), "OnClick_GlobalChannel")] [HarmonyTranspiler] private static IEnumerable ChatBehaviour__OnClick_GlobalChannel__Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceStrings(new TranslationKey[2] { I18nKeys.ChatBehaviour.DISABLE_GLOBAL_CHANNEL_MESSAGE, I18nKeys.ChatBehaviour.ENABLE_GLOBAL_CHANNEL_MESSAGE }).Unwrap(); } [HarmonyPatch(typeof(ChatBehaviour), "OnClick_PartyChannel")] [HarmonyTranspiler] private static IEnumerable ChatBehaviour__OnClick_PartyChannel__Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceStrings(new TranslationKey[2] { I18nKeys.ChatBehaviour.DISABLE_PARTY_CHANNEL_MESSAGE, I18nKeys.ChatBehaviour.ENABLE_PARTY_CHANNEL_MESSAGE }).Unwrap(); } [HarmonyPatch(typeof(ChatBehaviour), "Send_ChatMessage")] [HarmonyTranspiler] private static IEnumerable ChatBehaviour__Send_ChatMessage__Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceStrings(new TranslationKey[4] { I18nKeys.ChatBehaviour.GLOBAL_CHANNEL_DISABLED, I18nKeys.ChatBehaviour.PARTY_CHANNEL_DISABLED, I18nKeys.ChatBehaviour.ROOM_CHANNEL_DISABLED, I18nKeys.ChatBehaviour.ENTER_A_ROOM_HINT }, allowRepeat: false, supressNotfoundWarnings: true).Unwrap(); } [HarmonyPatch(typeof(ChatBehaviour), "UserCode_Cmd_SendChatMessage__String__ChatChannel")] [HarmonyTranspiler] private static IEnumerable Cmd_SendChatMessage__String__ChatChannel_Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[6] { new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(GameManager), "_current"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(GameManager), "ContainsUnicodeCharacter", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(string), "Empty"), (string)null), new CodeMatch((OpCode?)OpCodes.Starg_S, (object)null, (string)null) }).RemoveInstructions(6); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(ItemMenuCell), "PromptCmd_DropItem")] [HarmonyTranspiler] public static IEnumerable ItemMenuCell__PromptCmd_DropItem__Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); TranspilerHelper.RemoveMethodCallParamsStackForward(val, MessageCallbacks.New_ChatMessage, 5); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldloc_0, (object)null), Transpilers.EmitDelegate>((Func)delegate(ScriptableItem item) { QuestTranslationKey forAsset = KeyUtil.GetForAsset(item._scriptableQuest); return I18nKeys.TabMenu.DROP_ITEM_ABANDON_QUEST_FORMAT.Format(forAsset.Localize()); }) }); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(WhoMenuCell), "Init_MutePeer")] [HarmonyTranspiler] private static IEnumerable WhoMenuCell__Init_MutePeer__Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); TranspilerHelper.RemoveMethodCallParamsStackForward(val, MessageCallbacks.New_ChatMessage, 7); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), Transpilers.EmitDelegate>((Func)((WhoMenuCell cell) => I18nKeys.ChatMessage.UNMUTE_PLAYER_FORMAT.Format(cell._selectedDataEntry._player._nickname))) }); val.Advance(1); TranspilerHelper.RemoveMethodCallParamsStackForward(val, MessageCallbacks.New_ChatMessage, 7); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), Transpilers.EmitDelegate>((Func)((WhoMenuCell cell) => I18nKeys.ChatMessage.MUTE_PLAYER_FORMAT.Format(cell._selectedDataEntry._player._nickname))) }); return val.InstructionEnumeration(); } } [HarmonyPatch(typeof(DialogTrigger), "Start")] public static class RTDialogTriggerPatch { [HarmonyPostfix] public static void Postfix(DialogTrigger __instance) { if (!Object.op_Implicit((Object)(object)__instance._scriptDialogData)) { return; } TranslationKey forAsset = KeyUtil.GetForAsset(__instance._scriptDialogData); if ((Object)(object)__instance._nameTagRenderer != (Object)null) { TextMesh component = ((Component)__instance._nameTagRenderer).GetComponent(); if ((Object)(object)component != (Object)null) { component.text = Localyssation.GetString($"{forAsset}_NAME_TAG", component.text); } TMP_Text component2 = ((Component)__instance._nameTagRenderer).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.text = Localyssation.GetString($"{forAsset}_NAME_TAG", component2.text); } } if ((Object)(object)__instance._subNameTagRenderer != (Object)null) { TextMesh component3 = ((Component)__instance._subNameTagRenderer).GetComponent(); if ((Object)(object)component3 != (Object)null) { string text = component3.text.Trim('<', '>', ' '); string key = "NPC_TITLE_" + KeyUtil.Normalize(text); component3.text = "<" + Localyssation.GetString(key, text) + ">"; } TMP_Text component4 = ((Component)__instance._subNameTagRenderer).GetComponent(); if ((Object)(object)component4 != (Object)null) { string text2 = component4.text.Trim('<', '>', ' '); string key2 = "NPC_TITLE_" + KeyUtil.Normalize(text2); component4.text = "<" + Localyssation.GetString(key2, text2) + ">"; } } } } [HarmonyPatch] public class EnchantmentMessagePatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(EnchanterManager), "Init_PurchaseEnchant", (Type[])null, (Type[])null); } private static IEnumerable Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[5] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"You got the ", (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_2, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ScriptableStatModifier), "_modifierTag"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldstr, (object)" enchantment!", (string)null), TranspilerHelper.STRING_CONCAT }); if (val.IsInvalid) { Localyssation.logger.LogError((object)"未找到目标IL序列,注入失败"); return instructions; } List list = new List(); list.Add(new CodeInstruction(OpCodes.Ldloc_2, (object)null)); list.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(EnchantmentMessagePatch), "GetCustomEnchantmentMessage", (Type[])null, (Type[])null))); List list2 = list; val.RemoveInstructions(5).Insert((IEnumerable)list2); Localyssation.LogDebug("成功注入自定义装备消息转换"); return val.InstructionEnumeration(); } public static string GetCustomEnchantmentMessage(ScriptableStatModifier modifier) { return Localyssation.Format(I18nKeys.Enchanter.GET_NEW_ENCHANTMENT_FORMAT, KeyUtil.GetForAsset(modifier).Localize()); } } [HarmonyPatch] internal class EnchanterTransmuteMessage { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(EnchanterManager), "Init_StoneEnchant", (Type[])null, (Type[])null); } private static CodeMatch[] GenerateCodeMatchForTransmuteMessage(DamageType type) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown return (CodeMatch[])(object)new CodeMatch[6] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"Your ", (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnchanterManager), "_scriptEquipment"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ScriptableItem), "_itemName"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldstr, (object)$" now scale off {type}!", (string)null), TranspilerHelper.STRING_CONCAT }; } private static CodeInstruction[] GenerateCodeInstructionsForTransmuteMessage(DamageType type) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown return (CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnchanterManager), "_scriptEquipment")), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(EnchanterTransmuteMessage), $"GetTransmuteMessage{type}", (Type[])null, (Type[])null)) }; } private static IEnumerable Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceInstructions(GenerateCodeMatchForTransmuteMessage((DamageType)0), GenerateCodeInstructionsForTransmuteMessage((DamageType)0)).ReplaceInstructions(GenerateCodeMatchForTransmuteMessage((DamageType)1), GenerateCodeInstructionsForTransmuteMessage((DamageType)1)) .ReplaceInstructions(GenerateCodeMatchForTransmuteMessage((DamageType)2), GenerateCodeInstructionsForTransmuteMessage((DamageType)2)) .ReplaceStrings(new TranslationKey[4] { I18nKeys.Enchanter.NOT_ENOUGH_TRANSMUTE_STONES_DEXTERITY, I18nKeys.Enchanter.NOT_ENOUGH_TRANSMUTE_STONES_MIND, I18nKeys.Enchanter.NOT_ENOUGH_TRANSMUTE_STONES_STRENGTH, I18nKeys.Enchanter.CANNOT_TRANSMUTE_WEAPON }) .Unwrap(); } public static string GetTransmuteMessageStrength(ScriptableItem item) { return Localyssation.Format(I18nKeys.Enchanter.TRANSMUTE_TO_STRENGTH_FORMAT, KeyUtil.GetForAsset(item).Name); } public static string GetTransmuteMessageDexterity(ScriptableItem item) { return Localyssation.Format(I18nKeys.Enchanter.TRANSMUTE_TO_DEXTERITY_FORMAT, KeyUtil.GetForAsset(item).Name); } public static string GetTransmuteMessageMind(ScriptableItem item) { return Localyssation.Format(I18nKeys.Enchanter.TRANSMUTE_TO_MIND_FORMAT, KeyUtil.GetForAsset(item).Name); } } [HarmonyPatch(typeof(EquipToolTip))] internal class EquipToolTip__Apply_EquipStats__Display_GambleEquipTooltip { private static readonly TargetInnerMethod __CONDITION = new TargetInnerMethod { InnerMethodName = "Display_GambleEquipTooltip", ParentMethodName = "Apply_EquipStats", Type = typeof(EquipToolTip) }; public static string[] REPLACEMENT = new string[4] { I18nKeys.Equipment.TOOLTIP_GAMBLE_ITEM_NAME, I18nKeys.Equipment.TOOLTIP_GAMBLE_ITEM_DESCRIPTION, I18nKeys.Equipment.TOOLTIP_GAMBLE_ITEM_TYPE, I18nKeys.Equipment.TOOLTIP_GAMBLE_ITEM_RARITY }; public static MethodBase TargetMethod() { return TranspilerHelper.GenerateTargetMethod(__CONDITION); } public static IEnumerable Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, REPLACEMENT); } } [HarmonyPatch(typeof(EquipToolTip))] internal class EquipToolTip__Apply_EquipStats__Init_ShieldToolTip { private static readonly TargetInnerMethod __CONDITION = new TargetInnerMethod { InnerMethodName = "Init_ShieldToolTip", ParentMethodName = "Apply_EquipStats", Type = typeof(EquipToolTip) }; public static readonly string[] REPLACEMENT = new string[1] { I18nKeys.Equipment.TOOLTIP_TYPE_SHIELD }; public static MethodBase TargetMethod() { return TranspilerHelper.GenerateTargetMethod(__CONDITION); } public static IEnumerable Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, REPLACEMENT); } } [HarmonyPatch(typeof(PlayerEquipment), "UserCode_Cmd_RemoveVanity__String")] public static class RTPlayerEquipmentRemoveVanityPatch { [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new string[5] { I18nKeys.Equipment.VANITY_DISSIPATE_HELMET, I18nKeys.Equipment.VANITY_DISSIPATE_CHEST, I18nKeys.Equipment.VANITY_DISSIPATE_LEGGINGS, I18nKeys.Equipment.VANITY_DISSIPATE_CAPE, I18nKeys.Equipment.VANITY_DISSIPATE_SHIELD }); } } [HarmonyPatch(typeof(ToolTipManager), "Apply_GenericToolTip")] public static class RTToolTipManagerPatch { [HarmonyPrefix] public static void Prefix(ToolTipManager __instance, ref string _message) { if (!string.IsNullOrEmpty(_message)) { if (_message.StartsWith("Illusion: ")) { string text = _message.Substring("Illusion: ".Length); _message = Localyssation.GetString(I18nKeys.IntroAndTags.TOOLTIP_ILLUSION_PREFIX) + text; } else { string key = "TOOLTIP_GENERIC_" + KeyUtil.Normalize(_message); _message = Localyssation.GetString(key, _message); } } } } [HarmonyPatch(typeof(ErrorPromptTextManager), "Init_ErrorPrompt")] public static class RTErrorPromptTextManagerPatch { [HarmonyPrefix] public static void Prefix(ErrorPromptTextManager __instance, ref string text) { if (string.IsNullOrEmpty(text)) { return; } if (text.StartsWith("Level Required - ")) { string text2 = text.Substring("Level Required - ".Length); text = Localyssation.GetString(I18nKeys.ErrorMessages.LEVEL_REQUIRED) + text2; return; } if (text.StartsWith("Unable to upgrade to ")) { int num = text.IndexOf(". Level Req: "); if (num != -1) { string arg = text.Substring("Unable to upgrade to ".Length, num - "Unable to upgrade to ".Length); string arg2 = text.Substring(num + ". Level Req: ".Length); string format = Localyssation.GetString(I18nKeys.ErrorMessages.UNABLE_TO_UPGRADE_FORMAT); text = string.Format(format, arg, arg2); return; } } string key = "ERROR_MESSAGE_" + KeyUtil.Normalize(text); text = Localyssation.GetString(key, text); } } [HarmonyPatch] public static class RTIntroDialogPatch { [HarmonyTargetMethod] public static MethodBase TargetMethod() { Type type = typeof(LoadSceneManager).GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((Type t) => t.Name.StartsWith("")); return AccessTools.Method(type, "MoveNext", (Type[])null, (Type[])null); } [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new Dictionary { { "Your time is not over yet, little one...", I18nKeys.IntroAndTags.INTRO_DIALOG_LINE_1 }, { "This world is broken, in need of your help.", I18nKeys.IntroAndTags.INTRO_DIALOG_LINE_2 }, { "I plea for your soul, and your strength...", I18nKeys.IntroAndTags.INTRO_DIALOG_LINE_3 }, { "For centuries, the world was blanketed in a thick, toxic fog, forcing all life to retreat deep underground...", I18nKeys.IntroAndTags.INTRO_DIALOG_LINE_4 }, { "After generations of darkness, the fog has finally receded, revealing a world reclaimed by nature—and overrun by ancient, hostile forces.", I18nKeys.IntroAndTags.INTRO_DIALOG_LINE_5 }, { "Now, the surface beckons once more.", I18nKeys.IntroAndTags.INTRO_DIALOG_LINE_6 }, { "As a Dauntless, you must venture into the wild ruins of ATLYSS, face the dangers that await, and carve out a new path for your people.", I18nKeys.IntroAndTags.INTRO_DIALOG_LINE_7 }, { "Your journey begins now...", I18nKeys.IntroAndTags.INTRO_DIALOG_LINE_8 } }); } } [HarmonyPatch(typeof(CharacterCreationManager), "Awake")] public static class RTCharacterCreationManagerPatch { [HarmonyPostfix] public static void Postfix(CharacterCreationManager __instance) { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "Color", I18nKeys.CharacterCreation.CUSTOMIZER_HEADER_COLOR }, { "Body", I18nKeys.CharacterCreation.CUSTOMIZER_COLOR_BODY_HEADER }, { "Texture", I18nKeys.CharacterCreation.CUSTOMIZER_COLOR_BODY_TEXTURE }, { "Hair", I18nKeys.CharacterCreation.CUSTOMIZER_COLOR_HAIR_HEADER }, { "Lock Color", I18nKeys.CharacterCreation.CUSTOMIZER_COLOR_HAIR_LOCK_COLOR }, { "Hue", I18nKeys.CharacterCreation.CUSTOMIZER_COLOR_HUE }, { "Brightness", I18nKeys.CharacterCreation.CUSTOMIZER_COLOR_BRIGHTNESS }, { "Contrast", I18nKeys.CharacterCreation.CUSTOMIZER_COLOR_CONTRAST }, { "Saturation", I18nKeys.CharacterCreation.CUSTOMIZER_COLOR_SATURATION }, { "Head", I18nKeys.CharacterCreation.CUSTOMIZER_HEADER_HEAD }, { "Head Width", I18nKeys.CharacterCreation.CUSTOMIZER_HEAD_HEAD_WIDTH }, { "Modify", I18nKeys.CharacterCreation.CUSTOMIZER_HEAD_HEAD_MOD }, { "Voice Pitch", I18nKeys.CharacterCreation.CUSTOMIZER_HEAD_VOICE_PITCH }, { "Ears", I18nKeys.CharacterCreation.CUSTOMIZER_HEAD_EARS }, { "Eyes", I18nKeys.CharacterCreation.CUSTOMIZER_HEAD_EYES }, { "Mouth", I18nKeys.CharacterCreation.CUSTOMIZER_HEAD_MOUTH }, { "Height", I18nKeys.CharacterCreation.CUSTOMIZER_BODY_HEIGHT }, { "Width", I18nKeys.CharacterCreation.CUSTOMIZER_BODY_WIDTH }, { "Chest", I18nKeys.CharacterCreation.CUSTOMIZER_BODY_CHEST }, { "Arms", I18nKeys.CharacterCreation.CUSTOMIZER_BODY_ARMS }, { "Belly", I18nKeys.CharacterCreation.CUSTOMIZER_BODY_BELLY }, { "Bottom", I18nKeys.CharacterCreation.CUSTOMIZER_BODY_BOTTOM }, { "Tail", I18nKeys.CharacterCreation.CUSTOMIZER_BODY_TAIL }, { "Mirror Body", I18nKeys.CharacterCreation.CUSTOMIZER_BODY_TOGGLE_LEFT_HANDED }, { "Left Handed", I18nKeys.CharacterCreation.CUSTOMIZER_BODY_TOGGLE_LEFT_HANDED }, { "Trait", I18nKeys.CharacterCreation.CUSTOMIZER_HEADER_TRAIT }, { "Equipment", I18nKeys.CharacterCreation.CUSTOMIZER_TRAIT_EQUIPMENT }, { "Weapon", I18nKeys.CharacterCreation.CUSTOMIZER_TRAIT_WEAPON_LOADOUT }, { "Dye", I18nKeys.CharacterCreation.CUSTOMIZER_TRAIT_GEAR_DYE }, { "Attributes", I18nKeys.CharacterCreation.CUSTOMIZER_TRAIT_ATTRIBUTES }, { "Unspent Points", I18nKeys.CharacterCreation.CUSTOMIZER_TRAIT_UNSPENT_POINTS }, { "Reset Points", I18nKeys.CharacterCreation.CUSTOMIZER_TRAIT_RESET_ATTRIBUTE_POINTS }, { "Strength", "STAT_ATTRIBUTE_STRENGTH_NAME" }, { "Mind", "STAT_ATTRIBUTE_MIND_NAME" }, { "Dexterity", "STAT_ATTRIBUTE_DEXTERITY_NAME" }, { "Vitality", "STAT_ATTRIBUTE_VITALITY_NAME" } }; Text[] componentsInChildren = ((Component)__instance).GetComponentsInChildren(true); foreach (Text val in componentsInChildren) { string key = val.text.Trim(); if (dictionary.TryGetValue(key, out var value)) { val.text = Localyssation.GetString(value, val.text); } } TMP_Text[] componentsInChildren2 = ((Component)__instance).GetComponentsInChildren(true); foreach (TMP_Text val2 in componentsInChildren2) { string key2 = val2.text.Trim(); if (dictionary.TryGetValue(key2, out var value2)) { val2.text = Localyssation.GetString(value2, val2.text); } } } } [HarmonyPatch] internal class CharacterSelectManager__Handle_CharacterSelectControl__Transpiler { private static readonly TargetInnerMethod TARGET = new TargetInnerMethod { Type = typeof(CharacterSelectManager), ParentMethodName = "Handle_CharacterSelectControl", InnerMethodName = "Handle_ButtonControl" }; private static MethodBase TargetMethod() { return TranspilerHelper.GenerateTargetMethod(TARGET); } private static IEnumerable Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new List { I18nKeys.CharacterSelect.BUTTON_SELECT_CHARACTER, I18nKeys.CharacterSelect.BUTTON_CREATE_CHARACTER }); } } [HarmonyPatch(typeof(InGameUI))] [HarmonyPatch("MapTitleDisplay")] public class InGameUI_MapTitleDisplay_Patch { public static bool Prefix(InGameUI __instance, string _reigonTag, ref IEnumerator __result) { _reigonTag = Localyssation.GetString(KeyUtil.GetForMapRegionTag(_reigonTag)); __result = InGameUI_MapTitleDisplay_CustomIEnumerator(__instance, _reigonTag); return false; } private static IEnumerator InGameUI_MapTitleDisplay_CustomIEnumerator(InGameUI __instance, string _reigonTag) { __instance._reigonTitle = _reigonTag; do { yield return null; } while ((int)Player._mainPlayer._currentGameCondition == 0 || (int)Player._mainPlayer._currentPlayerCondition != 2 || Player._mainPlayer._bufferingStatus); if (!string.IsNullOrWhiteSpace(_reigonTag)) { __instance._mapNameText.text = _reigonTag ?? ""; } else { __instance._mapNameText.text = Localyssation.GetString(KeyUtil.GetForMapName(Player._mainPlayer.Network_playerMapInstance._mapName)) ?? ""; } __instance._mapZoneTypeText.text = string.Format(Localyssation.GetString(I18nKeys.Lore.FORMAT_MAP_ZONE), Localyssation.GetString(KeyUtil.GetForAsset(Player._mainPlayer._playerZoneType))); yield return (object)new WaitForSeconds(1.5f); do { if (TabMenu._current._isOpen) { yield break; } CanvasGroup mapInstanceTitleGroup = __instance._mapInstanceTitleGroup; mapInstanceTitleGroup.alpha += Time.deltaTime * 0.85f; yield return null; } while (__instance._mapInstanceTitleGroup.alpha < 1f); yield return (object)new WaitForSeconds(2.35f); while (!TabMenu._current._isOpen) { CanvasGroup mapInstanceTitleGroup2 = __instance._mapInstanceTitleGroup; mapInstanceTitleGroup2.alpha -= Time.deltaTime * 0.85f; yield return null; if (!(__instance._mapInstanceTitleGroup.alpha > 0f)) { break; } } } } [HarmonyPatch] public static class RTPlayerNameTagPatch { [HarmonyTargetMethod] public static MethodBase TargetMethod() { return AccessTools.DeclaredMethod(typeof(Player), "g__Handle_NameTagDisplay|81_0", (Type[])null, (Type[])null); } [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new Dictionary { { "[HOST] ", I18nKeys.IntroAndTags.PLAYER_NAMETAG_PREFIX_HOST }, { " (AFK)", I18nKeys.IntroAndTags.PLAYER_NAMETAG_SUFFIX_AFK } }); } } [HarmonyPatch(typeof(WhoListDataEntry), "Handle_WhoDataEntry")] public static class RTWhoListDataEntryPatch { [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, new Dictionary { { "Host", I18nKeys.IntroAndTags.WHO_LIST_HOST } }); } } [HarmonyPatch] internal class PlayerQuestingPatch_Apply_QuestItemProgress { [HarmonyTargetMethod] public static MethodBase TargetMethod() { return (from methodInfo in AccessTools.GetDeclaredMethods(typeof(PlayerQuesting)) where methodInfo.Name.Contains("g__") select methodInfo).Cast().FirstOrDefault(); } [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Newarr, (object)null, (string)null), new CodeMatch((Func)((CodeInstruction x) => CodeInstructionExtensions.IsStloc(x, (LocalBuilder)null)), (string)null) }); int intOperand = RTUtil.GetIntOperand(val); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[5] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ScriptableQuest), "_questObjective"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(QuestObjective), "_questItemRequirements"), (string)null), new CodeMatch((OpCode?)null, (object)null, (string)null), new CodeMatch((OpCode?)null, (object)null, (string)null), new CodeMatch((Func)((CodeInstruction x) => CodeInstructionExtensions.IsStloc(x, (LocalBuilder)null)), (string)null) }); int intOperand2 = RTUtil.GetIntOperand(val); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldarg_2, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(PlayerQuesting), "Apply_QuestProgressNote", (Type[])null, (Type[])null), (string)null) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[6] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Ldarg_2, (object)null), new CodeInstruction(OpCodes.Ldloc, (object)intOperand2), new CodeInstruction(OpCodes.Ldloc, (object)intOperand), Transpilers.EmitDelegate>((Func)delegate(string oldString, PlayerQuesting __instance, ScriptableQuest quest, int questIndex, QuestItemRequirement questItemRequirement, int[] acquiredItemsArray) { int num = Array.IndexOf(quest._questObjective._questItemRequirements, questItemRequirement); string text = Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(questItemRequirement._questItem), "_NAME")); return string.Format(Localyssation.GetString(I18nKeys.Quest.FORMAT_PROGRESS, text), text, acquiredItemsArray[num], questItemRequirement._itemsNeeded); }) }); return val.InstructionEnumeration(); } } [HarmonyPatch] internal class PlayerQuestingPatch_Apply_QuestTriggerProgress { [HarmonyTargetMethod] public static MethodBase TargetMethod() { return (from methodInfo in AccessTools.GetDeclaredMethods(typeof(PlayerQuesting)) where methodInfo.Name.Contains("g__") select methodInfo).Cast().FirstOrDefault(); } [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[5] { MemberAccessor.GetFieldInfo((Expression>)((ScriptableQuest x) => x._questObjective)).LdfldMatch(), MemberAccessor.GetFieldInfo((Expression>)((QuestObjective x) => x._questTriggerRequirements)).LdfldMatch(), new CodeMatch((OpCode?)null, (object)null, (string)null), new CodeMatch((OpCode?)null, (object)null, (string)null), new CodeMatch((Func)((CodeInstruction x) => CodeInstructionExtensions.IsStloc(x, (LocalBuilder)null)), (string)null) }); int intOperand = RTUtil.GetIntOperand(val); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldarg_2, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(PlayerQuesting), "Apply_QuestProgressNote", (Type[])null, (Type[])null), (string)null) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Ldarg_2, (object)null), new CodeInstruction(OpCodes.Ldloc, (object)intOperand), Transpilers.EmitDelegate>((Func)delegate(string oldString, PlayerQuesting __instance, ScriptableQuest quest, int questIndex, QuestTriggerRequirement triggerRequirement) { int num = Array.IndexOf(quest._questObjective._questTriggerRequirements, triggerRequirement); return string.Format(Localyssation.GetString(I18nKeys.Quest.FORMAT_PROGRESS, triggerRequirement._prefix + " " + triggerRequirement._suffix), triggerRequirement._prefix + " " + triggerRequirement._suffix, __instance._questProgressData[questIndex]._triggerProgressValues[num], triggerRequirement._triggerEmitsNeeded); }) }); return val.InstructionEnumeration(); } } [HarmonyPatch] internal class PlayerQuestingPatch_Target_Query_CreepKillProgress { [HarmonyTargetMethod] public static MethodBase TargetMethod() { return (from methodInfo in AccessTools.GetDeclaredMethods(typeof(PlayerQuesting)) where methodInfo.Name.Contains("g__") select methodInfo).Cast().FirstOrDefault(); } [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[5] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ScriptableQuest), "_questObjective"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(QuestObjective), "_questCreepRequirements"), (string)null), new CodeMatch((OpCode?)null, (object)null, (string)null), new CodeMatch((OpCode?)null, (object)null, (string)null), new CodeMatch((Func)((CodeInstruction x) => CodeInstructionExtensions.IsStloc(x, (LocalBuilder)null)), (string)null) }); int intOperand = RTUtil.GetIntOperand(val); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldarg_2, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(PlayerQuesting), "Apply_QuestProgressNote", (Type[])null, (Type[])null), (string)null) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Ldarg_2, (object)null), new CodeInstruction(OpCodes.Ldloc, (object)intOperand), Transpilers.EmitDelegate>((Func)delegate(string oldString, PlayerQuesting __instance, ScriptableQuest quest, int questIndex, QuestCreepRequirement questCreepRequirement) { int num = Array.IndexOf(quest._questObjective._questCreepRequirements, questCreepRequirement); return string.Format(Localyssation.GetString(I18nKeys.Quest.FORMAT_PROGRESS, RTReplacer.GetCreepKillRequirementText(questCreepRequirement._questCreep, questCreepRequirement._creepsKilled)), Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(questCreepRequirement._questCreep), "_NAME")), Math.Min(__instance._questProgressData[questIndex]._creepKillProgressValues[num] + 1, questCreepRequirement._creepsKilled), questCreepRequirement._creepsKilled); }) }); return val.InstructionEnumeration(); } } [HarmonyPatch] internal class QuestSelectionManager__Update { private static readonly TargetInnerMethod __TARGET = new TargetInnerMethod { Type = typeof(QuestSelectionManager), ParentMethodName = "Handle_QuestSelector", InnerMethodName = "Handle_Expbar" }; private static readonly string[] REPLACEMENT = new string[1] { I18nKeys.Lore.EXP_COUNTER_MAX }; public static MethodBase TargetMethod() { return TranspilerHelper.GenerateTargetMethod(__TARGET); } public static IEnumerable Transpiler(IEnumerable instructions) { return RTUtil.SimpleStringReplaceTranspiler(instructions, REPLACEMENT); } } [HarmonyPatch] internal class PlayerQuesting__Client_CompleteQuest__Transpiler { private static readonly TargetInnerMethod __TARGET = new TargetInnerMethod { Type = typeof(PlayerQuesting), ParentMethodName = "Client_CompleteQuest", InnerMethodName = "Finish_Quest" }; public static MethodBase TargetMethod() { return TranspilerHelper.GenerateTargetMethod(__TARGET); } public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); TranspilerHelper.RemoveMethodCallParamsStackForward(val, MessageCallbacks.Start_QuickSentence, 11); val.Insert((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate>((Func)delegate { TranslationKey forAsset = KeyUtil.GetForAsset(DialogManager._current._scriptableDialog); int num = Random.Range(0, DialogManager._current._scriptableDialog._questCompleteResponses.Length); return Localyssation.GetString($"{forAsset}_QUEST_COMPLETE_RESPONSE_{num}", DialogManager._current._scriptableDialog._questCompleteResponses[num]); }) }); return val.Instructions(); } } [HarmonyPatch] internal class PlayerQuesting__Accept_Quest__Transpiler { public static MethodBase TargetMethod() { return typeof(PlayerQuesting).GetMethod("Accept_Quest", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown CodeMatcher val = RTUtil.Wrap(instructions).ReplaceStrings(new TranslationKey[2] { I18nKeys.ErrorMessages.QUEST_LOG_FULL, I18nKeys.ErrorMessages.QUEST_ALREADY_IN_LOG }, allowRepeat: false, supressNotfoundWarnings: true).Matcher() .MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"Retrieved Quest Objective Item: ", (string)null) }); TranspilerHelper.RemoveMethodCallParamsStackForward(val, MessageCallbacks.New_ChatMessage, 7).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_1, (object)null), Transpilers.EmitDelegate>((Func)delegate(ScriptableQuest quest) { string key = string.Concat(KeyUtil.GetForAsset(quest._questObjectiveItem._scriptItem), "_NAME"); return I18nKeys.Quest.RETRIEVED_QUEST_OBJECTIVE_ITEM_FORMAT.Format(Localyssation.GetString(key)); }) }); TranspilerHelper.RemoveMethodCallParamsStackForward(val, MessageCallbacks.Init_GameLogicMessage, 5).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_1, (object)null), Transpilers.EmitDelegate>((Func)((ScriptableQuest quest) => I18nKeys.Quest.RETRIEVED_QUEST_OBJECTIVE_ITEM_FORMAT.Format(KeyUtil.GetForAsset(quest).Name.Localize()))) }); TranspilerHelper.RemoveMethodCallParamsStackForward(val, MessageCallbacks.Start_QuickSentence, 11).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate>((Func)delegate { TranslationKey forAsset = KeyUtil.GetForAsset(DialogManager._current._scriptableDialog); int num = Random.Range(0, DialogManager._current._scriptableDialog._questCompleteResponses.Length); return Localyssation.GetString($"{forAsset}_QUEST_ACCEPT_RESPONSE_{num}", DialogManager._current._scriptableDialog._questCompleteResponses[num]); }) }); return val.InstructionEnumeration(); } } [HarmonyPatch] internal class LobbyListManager__Iterate_SteamLobbies__Iterate_LobbyEntry__Transpiler { private static readonly TargetInnerMethod TARGET = new TargetInnerMethod { Type = typeof(LobbyListManager), ParentMethodName = "Iterate_SteamLobbies", InnerMethodName = "Iterate_LobbyEntry" }; private static MethodBase TargetMethod() { return TranspilerHelper.GenerateTargetMethod(TARGET); } private static IEnumerable Transpiler(IEnumerable instructions) { return RTUtil.Wrap(instructions).ReplaceStrings(new TranslationKey[5] { I18nKeys.SteamLobby.LOBBY_FULL, I18nKeys.SteamLobby.LOBBY_PASSWORD_LOBBY, I18nKeys.SteamLobby.LOBBY_JOIN_FRIEND, I18nKeys.SteamLobby.LOBBY_DIFFERENT_VERSION, I18nKeys.SteamLobby.LOBBY_INVALID }).Unwrap(); } } internal static class RTUtil { private static readonly List fallbackTextEditTags = new List { "scalefallback" }; private static readonly List PATCH_CLASSES = new List { typeof(RTReplacer) }; internal static IEnumerable SimpleStringReplaceTranspiler(IEnumerable instructions, IDictionary stringReplacements, bool allowRepeat = false, bool supressNotfoundWarnings = false) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown List replacedStrings = new List(); IEnumerable result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((Func)((CodeInstruction instr) => instr.opcode == OpCodes.Ldstr && stringReplacements.ContainsKey((string)instr.operand) && (allowRepeat || !replacedStrings.Contains((string)instr.operand))), (string)null) }).Repeat((Action)delegate(CodeMatcher matcher) { string key = (string)matcher.Instruction.operand; matcher.Advance(1); matcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate>((Func)((string origString) => Localyssation.GetString(stringReplacements[key], key))) }); replacedStrings.Add(key); }, (Action)null).InstructionEnumeration(); List list = stringReplacements.Keys.Cast().Except(replacedStrings).ToList(); if (list.Count > 0 && !supressNotfoundWarnings) { Localyssation.logger.LogWarning((object)("Some strings are not found during transpiler replacing:\n\t" + string.Join("\n\t", list))); } return result; } internal static IEnumerable SimpleStringReplaceTranspiler(IEnumerable instructions, IEnumerable keyReplacement, bool allowRepeat = false, bool supressNotfoundWarnings = false) { Dictionary dictionary = new Dictionary(); foreach (string item in keyReplacement) { dictionary.Add(I18nKeys.GetDefaulted(item), item); } return SimpleStringReplaceTranspiler(instructions, dictionary, allowRepeat, supressNotfoundWarnings); } internal static IEnumerable SimpleStringReplaceTranspiler(IEnumerable instructions, IEnumerable keyReplacement, bool allowRepeat = false, bool supressNotfoundWarnings = false) { Dictionary dictionary = new Dictionary(); foreach (TranslationKey item in keyReplacement) { dictionary.Add(I18nKeys.GetDefaulted(item), item); } return SimpleStringReplaceTranspiler(instructions, dictionary, allowRepeat, supressNotfoundWarnings); } internal static int GetIntOperand(CodeMatcher matcher) { object obj = matcher.Operand ?? ((object)int.Parse(matcher.Opcode.Name.Substring(matcher.Opcode.Name.Length - 1))); return (int)obj; } public static void RemapAllTextUnderObject(GameObject gameObject, Dictionary textRemaps, Action onRemap = null) { HashSet remappedString = new HashSet(); Localyssation.LogDebug("Remapping for " + ((Object)gameObject).name); Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); foreach (KeyValuePair tR_KEY in I18nKeys.TR_KEYS) { if (!string.IsNullOrEmpty(tR_KEY.Value) && !dictionary.ContainsKey(tR_KEY.Value)) { dictionary[tR_KEY.Value] = tR_KEY.Key; } } Text[] componentsInChildren = gameObject.GetComponentsInChildren(true); foreach (Text val in componentsInChildren) { if (TryRemapSingle(((Component)val).transform, val)) { continue; } Transform parent = ((Component)val).transform.parent; if (!Object.op_Implicit((Object)(object)parent) || !TryRemapSingle(parent, val)) { string key = val.text.Trim(); if (dictionary.TryGetValue(key, out var value)) { LangAdjustables.RegisterText(val, LangAdjustables.GetStringFunc(value, val.text)); remappedString.Add(((Object)((Component)val).transform).name); } } } TextMeshProUGUI[] componentsInChildren2 = gameObject.GetComponentsInChildren(true); foreach (TextMeshProUGUI val2 in componentsInChildren2) { if (TryRemapSingleTMP(((TMP_Text)val2).transform, val2)) { continue; } Transform parent2 = ((TMP_Text)val2).transform.parent; if (!Object.op_Implicit((Object)(object)parent2) || !TryRemapSingleTMP(parent2, val2)) { string key2 = ((TMP_Text)val2).text.Trim(); if (dictionary.TryGetValue(key2, out var value2)) { LangAdjustables.RegisterText(val2, LangAdjustables.GetStringFunc(value2, ((TMP_Text)val2).text)); remappedString.Add(((Object)((TMP_Text)val2).transform).name); } } } bool TryRemapSingle(Transform lookupNameTransform, Text text) { if (textRemaps.TryGetValue(((Object)lookupNameTransform).name, out var value3)) { LangAdjustables.RegisterText(text, LangAdjustables.GetStringFunc(value3, text.text)); remappedString.Add(((Object)lookupNameTransform).name); onRemap?.Invoke(lookupNameTransform, value3); return true; } return false; } bool TryRemapSingleTMP(Transform lookupNameTransform, TextMeshProUGUI text) { if (textRemaps.TryGetValue(((Object)lookupNameTransform).name, out var value3)) { LangAdjustables.RegisterText(text, LangAdjustables.GetStringFunc(value3, ((TMP_Text)text).text)); remappedString.Add(((Object)lookupNameTransform).name); onRemap?.Invoke(lookupNameTransform, value3); return true; } return false; } } public static void RemapChildTextsByPath(Transform parentTransform, IDictionary textRemaps, Action onRemap = null, bool supressNotfoundWarnings = false, bool rawText = false) { foreach (KeyValuePair textRemap in textRemaps) { Transform val = parentTransform.Find(textRemap.Key); if (Object.op_Implicit((Object)(object)val)) { Text component = ((Component)val).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { if (!rawText) { LangAdjustables.RegisterText(component, LangAdjustables.GetStringFunc(textRemap.Value, component.text)); } else { component.text = textRemap.Value; } onRemap?.Invoke(val, textRemap.Value); } else if (!supressNotfoundWarnings) { Localyssation.logger.LogWarning((object)("[RemapChildTextsByPath] Found path `" + textRemap.Key + "` but no Text component is found.")); } } else if (!supressNotfoundWarnings) { Localyssation.logger.LogWarning((object)("[RemapChildTextsByPath] Cannot find path `" + textRemap.Key + "` in `" + GetPath(parentTransform) + "`.")); } } } public static void RemapChildTextsByPath(Transform parentTransform, IDictionary textRemaps, Action onRemap = null, bool supressNotfoundWarnings = false, bool rawText = false) { RemapChildTextsByPath(parentTransform, textRemaps.ToDictionary((KeyValuePair kv) => kv.Key, (KeyValuePair kv) => kv.Value.ToString()), onRemap, supressNotfoundWarnings, rawText); } public static string GetPath(Transform transform) { return PathUtil.GetPath(transform); } public static void RemapAllInputPlaceholderTextUnderObject(GameObject gameObject, Dictionary textRemaps, Action onRemap = null) { InputField[] componentsInChildren = gameObject.GetComponentsInChildren(); foreach (InputField val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val.placeholder)) { Text component = ((Component)val.placeholder).GetComponent(); 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); } } } } public static List GetFallbackTextEditTags() { return fallbackTextEditTags; } public static void PatchAll(Harmony harmony) { foreach (Type pATCH_CLASS in PATCH_CLASSES) { harmony.PatchAll(pATCH_CLASS); } } public static string Capitalize(string text) { return text[0].ToString().ToUpper() + text.Substring(1); } public static RTTransplierCodeInstructionsWrapper Wrap(IEnumerable instructions) { return new RTTransplierCodeInstructionsWrapper(instructions); } } internal class RTTransplierCodeInstructionsWrapper { private IEnumerable __instructions; public RTTransplierCodeInstructionsWrapper(IEnumerable instructions) { __instructions = instructions; } public RTTransplierCodeInstructionsWrapper ReplaceStrings(IDictionary stringReplacements, bool allowRepeat = false, bool supressNotfoundWarnings = false) { __instructions = RTUtil.SimpleStringReplaceTranspiler(__instructions, stringReplacements, allowRepeat, supressNotfoundWarnings); return this; } public RTTransplierCodeInstructionsWrapper ReplaceStrings(IEnumerable stringReplacements, bool allowRepeat = false, bool supressNotfoundWarnings = false) { __instructions = RTUtil.SimpleStringReplaceTranspiler(__instructions, stringReplacements, allowRepeat, supressNotfoundWarnings); return this; } public RTTransplierCodeInstructionsWrapper ReplaceStrings(IEnumerable stringReplacements, bool allowRepeat = false, bool supressNotfoundWarnings = false) { __instructions = RTUtil.SimpleStringReplaceTranspiler(__instructions, stringReplacements, allowRepeat, supressNotfoundWarnings); return this; } public RTTransplierCodeInstructionsWrapper ReplaceInstructions(CodeMatch[] matches, CodeInstruction[] replacements) { __instructions = TranspilerHelper.MatchAndReplace(__instructions, matches, replacements); return this; } public RTTransplierCodeInstructionsWrapper ReplaceInstructions(params ILCodeReplacement[] replacements) { for (int i = 0; i < replacements.Length; i++) { ILCodeReplacement iLCodeReplacement = replacements[i]; if (iLCodeReplacement.matches != null && iLCodeReplacement.replacement != null && iLCodeReplacement.matches.Length != 0) { ReplaceInstructions(iLCodeReplacement.matches, iLCodeReplacement.replacement); } } return this; } public CodeMatcher Matcher() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return new CodeMatcher(__instructions, (ILGenerator)null); } public IEnumerable Unwrap() { return __instructions; } } [HarmonyPatch] public sealed class SkillToolTip_Apply_SkillDescriptorInfo { [HarmonyTargetMethod] public static MethodBase TargetMethod() { return (from methodInfo in AccessTools.GetDeclaredMethods(typeof(SkillToolTip)) where methodInfo.Name.Contains("g__Init_TermMacros") select methodInfo).Cast().FirstOrDefault(); } [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_0, (object)null, (string)null) }).Advance(1).RemoveInstruction() .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate>((Func)((ScriptableSkill skill) => Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(skill), "_DESCRIPTION")))) }); val.Start(); PatchStringReplace(val); val.Start(); PatchWeaponRequirement(val); val.Start(); PatchConditionName(val); val.Start(); PatchConditionGroupTag(val); val.InstructionEnumeration().LogInstructions("Apply_SkillDescriptorInfo:"); return val.InstructionEnumeration(); } private static void PatchStringReplace(CodeMatcher matcher) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown Localyssation.LogDebug("Patching string.Replace"); matcher.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(string), "Replace", new Type[2] { typeof(string), typeof(string) }, (Type[])null), (string)null) }).Repeat((Action)delegate(CodeMatcher cm) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown cm.MatchBack(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldstr, (object)null, (string)null) }); string text = cm.Operand.ToString(); Localyssation.LogDebug("Replace(" + text + ", %) matched"); cm.Advance(2).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldstr, (object)text), Transpilers.EmitDelegate>((Func)AlterSkillDescription) }); }, (Action)null); } private static string AlterSkillDescription(string original, string variableName) { return variableName switch { "$SKP" => "{0}", "$DMG" => "({0} - {1})", "$COOLDWN" => Localyssation.GetString(I18nKeys.SkillMenu.TOOLTIP_DESCRIPTOR_COOLDOWN), "$MANACOST" => Localyssation.GetString(I18nKeys.SkillMenu.TOOLTIP_DESCRIPTOR_MANACOST), "$HEALTHCOST" => Localyssation.GetString(I18nKeys.SkillMenu.TOOLTIP_HEALTH_COST), "$STAMINACOST" => Localyssation.GetString(I18nKeys.SkillMenu.TOOLTIP_STAMINA_COST), "$CASTTIME" => Localyssation.GetString(I18nKeys.SkillMenu.TOOLTIP_DESCRIPTOR_CAST_TIME), "$CASTTIME_INSTANT" => Localyssation.GetString(I18nKeys.SkillMenu.TOOLTIP_DESCRIPTOR_CAST_TIME_INSTANT), _ => original, }; } private static void PatchWeaponRequirement(CodeMatcher matcher) { //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown Localyssation.LogDebug("Patching weapon requirement"); Dictionary> dictionary = new Dictionary> { { Format("shield"), () => Localyssation.GetString(I18nKeys.SkillMenu.TOOLTIP_REQUIRE_SHIELD) }, { Format("melee weapon"), () => Localize((SkillToolTipRequirement)1) }, { Format("heavy melee weapon"), () => Localize((SkillToolTipRequirement)2) }, { Format("ranged weapon"), () => Localize((SkillToolTipRequirement)3) }, { Format("heavy ranged weapon"), () => Localize((SkillToolTipRequirement)4) }, { Format("magic weapon"), () => Localize((SkillToolTipRequirement)5) }, { Format("heavy magic weapon"), () => Localize((SkillToolTipRequirement)6) }, { "\n\n{0} - ({1}) ({2}% Chance)", () => Localyssation.GetString(I18nKeys.SkillMenu.TOOLTIP_DESCRIPTOR_CONDITION_CHANCE) } }; foreach (KeyValuePair> replacement in dictionary) { matcher.Start(); matcher.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)replacement.Key, (string)null) }).Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate>((Func)((string original) => replacement.Value())) }); } static string Format(string weaponTypeName) { return " Requires a " + weaponTypeName + "."; } static string Localize(SkillToolTipRequirement requirement) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return string.Format(Localyssation.GetString(I18nKeys.SkillMenu.TOOLTIP_REQUIEMENT_FORMAT), Localyssation.GetString(KeyUtil.GetForAsset(requirement))); } } private static void PatchConditionName(CodeMatcher matcher) { Localyssation.LogDebug("Patching conditionName"); matcher.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { MemberAccessor.GetFieldInfo((Expression>)((ScriptableCondition x) => x._conditionName)).LdfldMatch() }).Repeat((Action)delegate(CodeMatcher cm) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown Localyssation.LogDebug("conditionName matched"); cm.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldloc_1, (object)null), EmitConditionNameLocalization() }); }, (Action)null); } private static CodeInstruction EmitConditionNameLocalization() { return Transpilers.EmitDelegate>((Func)((string src, ScriptableCondition condition) => Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(condition), "_NAME")))); } private static void PatchConditionGroupTag(CodeMatcher matcher) { Localyssation.LogDebug("Patching conditionGroupTag"); matcher.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1] { MemberAccessor.GetFieldInfo((Expression>)((ScriptableConditionGroup x) => x._conditionGroupTag)).LdfldMatch() }).Repeat((Action)delegate(CodeMatcher cm) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown Localyssation.LogDebug("conditionGroupTag matched"); cm.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloc_1, (object)null), MemberAccessor.GetFieldInfo((Expression>)((ScriptableCondition x) => x._conditionGroup)).LdfldInstruction(), EmitConditionGroupLocalization() }); }, (Action)null); } private static CodeInstruction EmitConditionGroupLocalization() { return Transpilers.EmitDelegate>((Func)((string src, ScriptableConditionGroup group) => Localyssation.GetString(string.Concat(KeyUtil.GetForAsset(group), "_NAME")))); } } } namespace Localyssation.Patches.ReplaceFont { internal static class FRChat { [HarmonyPatch(typeof(ChatBehaviour), "UserCode_Rpc_RecieveChatMessage__String__Boolean__ChatChannel")] [HarmonyPostfix] public static void FixChatFont(ChatBehaviour __instance, string message, bool _isEmoteMessage, ChatChannel _chatChannel) { TextMeshPro chatTextMesh = __instance._chatTextMesh; Language.BundledFontLookupInfo chatFont = LanguageManager.CurrentLanguage.info.chatFont; FRUtil.ReplaceTmpFont((TMP_Text)(object)chatTextMesh, chatFont); } [HarmonyPatch(typeof(ChatBehaviourAssets), "Start")] [HarmonyPostfix] public static void FixChatBoxFont(ChatBehaviourAssets __instance) { FRUtil.ReplaceTmpFont((TMP_Text)(object)__instance._chatText, LanguageManager.CurrentLanguage.info.chatFont); } } internal static class FRItemObjectVisual { [HarmonyPatch(typeof(ItemObjectVisual), "OnEnable")] [HarmonyPostfix] public static void ItemObjectVisual__OnEnable__Postfix(ItemObjectVisual __instance) { if ((Object)(object)__instance != (Object)null && Object.op_Implicit((Object)(object)__instance._itemNametagTextMesh)) { FRUtil.ReplaceTmpFont((TMP_Text)(object)__instance._itemNametagTextMesh, LanguageManager.CurrentLanguage.info.chatFont); } } } internal static class FRPlayerNickname { [HarmonyPatch(typeof(Player), "Handle_ClientParameters")] [HarmonyPostfix] public static void Player_Handle_ClientParameter_Postfix(Player __instance) { if (((Behaviour)__instance._nicknameTextMesh).enabled) { FRUtil.ReplaceTmpFont((TMP_Text)(object)__instance._nicknameTextMesh, LanguageManager.CurrentLanguage.info.chatFont); } if (((Behaviour)__instance._globalNicknameTextMesh).enabled) { FRUtil.ReplaceTmpFont((TMP_Text)(object)__instance._globalNicknameTextMesh, LanguageManager.CurrentLanguage.info.chatFont); } } } internal static class FRUtil { private static readonly List PATCH_CLASSES = new List { typeof(FRChat), typeof(FRItemObjectVisual), typeof(FRPlayerNickname) }; public static void ReplaceTmpFont(TMP_Text text, Language.BundledFontLookupInfo replacementFontLookupInfo) { if (replacementFontLookupInfo != null && FontManager.TMPfonts.TryGetValue(replacementFontLookupInfo.fontName, out var value) && (Object)(object)text.font != (Object)(object)value) { float fontSize = text.fontSize; float lineSpacing = text.lineSpacing; text.font = value; text.fontSize = (int)(fontSize * replacementFontLookupInfo.fontScale); text.lineSpacing = lineSpacing * replacementFontLookupInfo.fontScale; } } public static void PatchAll(Harmony harmony) { foreach (Type pATCH_CLASS in PATCH_CLASSES) { harmony.PatchAll(pATCH_CLASS); } } } } namespace Localyssation.LanguageModule { public class Language { public class LanguageInfo { public string code = ""; public string name = ""; public bool autoShrinkOverflowingText = false; public BundledFontLookupInfo chatFont = new BundledFontLookupInfo(); public Dictionary fontReplacement = Enum.GetValues(typeof(VanillaFonts)).Cast().ToDictionary((VanillaFonts vanillaFont) => vanillaFont.GetDescription(), (VanillaFonts vanillaFont) => new BundledFontLookupInfo()); public Dictionary componentSpecifiedFontReplacement = new Dictionary { { "__some___example/_gameobject/_path", new BundledFontLookupInfo() } }; } public class BundledFontLookupInfo { public string fontName = ""; public float fontScale = 1f; } private static readonly ISerializer YAML_SERIALIZER = new SerializerBuilder().WithDefaultScalarStyle((ScalarStyle)3).Build(); private static readonly IDeserializer YAML_DESERIALIZER = new DeserializerBuilder().Build(); public LanguageInfo info = new LanguageInfo(); public string fileSystemPath; private readonly ConcurrentDictionary strings = new ConcurrentDictionary(); public IDictionary GetStrings() { return strings; } public void RegisterKey(string key, string defaultValue) { if (strings.ContainsKey(key)) { if (defaultValue != strings[key]) { Localyssation.logger.LogWarning((object)("Duplicate localisation key `" + key + "` in language `" + info.name + "`(" + info.code + ")")); } } else { strings[key] = defaultValue; } } public bool TryGetString(string key, out string value) { return strings.TryGetValue(key, out value); } public bool ContainsKey(string key) { return strings.ContainsKey(key); } public bool LoadFromFileSystem(bool forceOverwrite = false) { if (string.IsNullOrEmpty(fileSystemPath)) { return false; } if (!LoadJsonDescriptor()) { return false; } if (info.code == LanguageManager.DefaultLanguage.info.code) { return false; } if (TryLoadYMLFiles(forceOverwrite)) { return true; } return TryLoadTSVFiles(forceOverwrite); } private bool LoadJsonDescriptor() { string path = Path.Combine(fileSystemPath, "localyssationLanguage.json"); try { info = JsonConvert.DeserializeObject(File.ReadAllText(path)); Localyssation.logger.LogMessage((object)("Loading language name=" + info.name + ", id=" + info.code)); return true; } catch (Exception ex) { Localyssation.logger.LogError((object)ex); return false; } } private bool TryLoadYMLFiles(bool forceOverwrite) { try { bool foundYML = false; Action> registerAction; if (!forceOverwrite) { registerAction = delegate(KeyValuePair kv) { RegisterKey(kv.Key, kv.Value); }; } else { registerAction = delegate(KeyValuePair kv) { strings[kv.Key] = kv.Value; }; } CollectionExtensions.Do((IEnumerable)(from x in Directory.GetFiles(Paths.PluginPath, "*." + info.code + ".yml", SearchOption.AllDirectories) orderby Path.GetFileNameWithoutExtension(x) select x), (Action)delegate(string stringsFilePath) { Localyssation.logger.LogMessage((object)("Found translation file " + stringsFilePath)); StreamReader streamReader = File.OpenText(stringsFilePath); Parallel.ForEach(YAML_DESERIALIZER.Deserialize>((TextReader)streamReader), registerAction); streamReader.Close(); foundYML = true; }); if (foundYML) { return true; } } catch (Exception ex) { Localyssation.logger.LogError((object)ex); } return false; } private bool TryLoadTSVFiles(bool forceOverwrite) { string text = Path.Combine(fileSystemPath, "strings.tsv"); try { Localyssation.logger.LogMessage((object)("Parsing legacy file " + text)); foreach (Dictionary item in TSVUtil.parseTsvWithHeaders(File.ReadAllText(text))) { 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(string fileName, bool noLangCode = false) { 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, noLangCode ? (fileName + ".yml") : (fileName + "." + info.code + ".yml")); StreamWriter streamWriter = new StreamWriter(path2); YAML_SERIALIZER.Serialize((TextWriter)streamWriter, (object)strings, typeof(Dictionary)); streamWriter.Close(); return true; } catch (Exception ex) { Localyssation.logger.LogError((object)ex); return false; } } } public static class LanguageManager { public static readonly Dictionary languages = new Dictionary(); public static Language DefaultLanguage { get; private set; } public static Language CurrentLanguage { get; private set; } public static List LanguagesList => languages.Values.ToList(); public static void Init() { DefaultLanguage = CreateDefaultLanguage(); RegisterLanguage(DefaultLanguage); ChangeLanguage(DefaultLanguage); LoadLanguagesFromFileSystem(); } public static void ChangeLanguage(string key) { ChangeLanguage(languages[key]); } public static void ChangeLanguage(Language newLanguage, bool forced = false) { if (CurrentLanguage != newLanguage || forced) { CurrentLanguage = newLanguage; Localyssation.instance.CallOnLanguageChanged(newLanguage); } } internal static Language CreateDefaultLanguage() { Language language = new Language { info = new Language.LanguageInfo { code = "en-US", name = "English (US)" }, fileSystemPath = Path.Combine(Path.GetDirectoryName(Localyssation.dllPath), "defaultLanguage") }; I18nKeys.Init(); Extensions.AddRange(language.GetStrings(), (IDictionary)I18nKeys.TR_KEYS); return language; } public static bool GetLanguage(string languageCode, out Language language) { return languages.TryGetValue(languageCode, out language); } public static void RegisterKey(string key, string defaultValue) { DefaultLanguage.RegisterKey(key, defaultValue); } public static void RegisterKey(TranslationKey key, string defaultValue) { DefaultLanguage.RegisterKey(key.key, defaultValue); } public static void LoadLanguagesFromFileSystem() { string[] files = Directory.GetFiles(Paths.PluginPath, "localyssationLanguage.json", SearchOption.AllDirectories); CollectionExtensions.Do((IEnumerable)files, (Action)delegate(string filePath) { string directoryName = Path.GetDirectoryName(filePath); Language language = new Language { fileSystemPath = directoryName }; if (language.LoadFromFileSystem()) { RegisterLanguage(language); } }); } private static void RegisterLanguage(Language language) { if (!languages.ContainsKey(language.info.code)) { languages[language.info.code] = language; } } public static void UpdateDefaultLanguageFile() { Directory.CreateDirectory(DefaultLanguage.fileSystemPath); DefaultLanguage.WriteToFileSystem("default_language_12026.a3", noLangCode: true); } public static string GetDefaultString(string key) { if (DefaultLanguage.TryGetString(key, out var value)) { return value; } return key; } public static string GetString(string key, string defaultString = "") { if (LocalyssationConfig.ShowTranslationKeyEnabled) { return key; } if (CurrentLanguage.TryGetString(key, out var value)) { return value; } if (DefaultLanguage.TryGetString(key, out value)) { return value; } return defaultString; } } } namespace Localyssation.LangAdjutable { public interface ILangAdjustable { void AdjustToLanguage(Language newLanguage); } public static class LangAdjustables { public static List nonMonoBehaviourAdjustables = new List(); public static Dictionary registeredTexts = new Dictionary(); public static Dictionary registeredTMProUGUITexts = new Dictionary(); public static Dictionary registeredDropdowns = new Dictionary(); public static Dictionary registeredTextMeshPro = new Dictionary(); public static void Init() { Localyssation.instance.OnLanguageChanged += delegate(Language newLanguage) { List list = new List(nonMonoBehaviourAdjustables); foreach (ILangAdjustable item in list) { item.AdjustToLanguage(newLanguage); } }; } public static Func GetStringFunc(string key, string defaultValue = "SAME_AS_KEY") { return (int fontSize) => Localyssation.GetString(key, defaultValue, fontSize); } public static Func GetStringFunc(TranslationKey key, string defaultValue = "SAME_AS_KEY") { return (int fontSize) => Localyssation.GetString(key, defaultValue, fontSize); } public static void RegisterText(Text text, Func newTextFunc = null) { if (!registeredTexts.TryGetValue(text, out var value)) { LangAdjustableUIText langAdjustableUIText = (registeredTexts[text] = ((Component)text).gameObject.AddComponent()); value = langAdjustableUIText; } if (newTextFunc != null) { value.newTextFunc = newTextFunc; } } public static void RegisterText(Text text, TranslationKey key) { RegisterText(text, GetStringFunc(key)); } public static void RegisterText(TextMeshProUGUI text, Func newTextFunc = null) { if (!registeredTMProUGUITexts.TryGetValue(text, out var value)) { LangAdjustableTMProUGUIText langAdjustableTMProUGUIText = (registeredTMProUGUITexts[text] = ((Component)text).gameObject.AddComponent()); value = langAdjustableTMProUGUIText; } if (newTextFunc != null) { value.newTextFunc = newTextFunc; } } public static void RegisterDropdown(Dropdown dropdown, List> newTextFuncs = null) { if (!registeredDropdowns.TryGetValue(dropdown, out var value)) { LangAdjustableUIDropdown langAdjustableUIDropdown = (registeredDropdowns[dropdown] = ((Component)dropdown).gameObject.AddComponent()); value = langAdjustableUIDropdown; } if (newTextFuncs != null) { value.newTextFuncs = newTextFuncs; } } public static void RegisterDropdown(Dropdown dropdown, TranslationKey keyBase) { RegisterDropdown(dropdown, (from i in Enumerable.Range(0, dropdown.options.Count) select GetStringFunc(keyBase.Option[i])).ToList()); } public static void RegisterTextMeshPro(TextMeshPro textMeshPro, Func newTextFunc = null) { if (!registeredTextMeshPro.TryGetValue(textMeshPro, out var value)) { LangAdjustableTextMeshPro langAdjustableTextMeshPro = (registeredTextMeshPro[textMeshPro] = ((Component)textMeshPro).gameObject.AddComponent()); value = langAdjustableTextMeshPro; } if (newTextFunc != null) { value.newTextFunc = newTextFunc; } } } public class LangAdjustableTextMeshPro : MonoBehaviour, ILangAdjustable { public Func newTextFunc; public bool fontReplaced = false; public float orig_fontSize; public float orig_lineSpacing; public TMP_FontAsset orig_font; public bool textAutoShrinkable = true; public bool textAutoShrunk = false; public bool orig_resizeTextForBestFit = false; public float orig_resizeTextMaxSize; public float orig_resizeTextMinSize; public TextMeshPro text { get; private set; } private void onLanguageChanged(Language newLanguage) { AdjustToLanguage(newLanguage); } public void Awake() { text = ((Component)this).GetComponent(); Localyssation.instance.OnLanguageChanged += onLanguageChanged; } public void Start() { AdjustToLanguage(LanguageManager.CurrentLanguage); } private bool ReplaceFontIfMatch(string originalFontName, Language.BundledFontLookupInfo replacementFontLookupInfo) { if (GetLoadedFont(replacementFontLookupInfo, out var loadedFont)) { if ((Object)(object)((TMP_Text)text).font == (Object)(object)loadedFont) { return true; } if (Regex.IsMatch(((Object)((TMP_Text)text).font).name, originalFontName + "\\s*SDF\\w*")) { ReplaceFont(loadedFont); return true; } } return false; } private bool ReplaceFontForPath(string path, Language.BundledFontLookupInfo replacementFontLookupInfo) { if (PathUtil.GetPath(text.transform) == path && GetLoadedFont(replacementFontLookupInfo, out var loadedFont)) { if ((Object)(object)((TMP_Text)text).font != (Object)(object)loadedFont) { ReplaceFont(loadedFont); } return true; } return false; } private bool ReplaceFontAlways(Language.BundledFontLookupInfo replacementFontLookupInfo) { if (GetLoadedFont(replacementFontLookupInfo, out var loadedFont)) { if ((Object)(object)((TMP_Text)text).font != (Object)(object)loadedFont) { ReplaceFont(loadedFont); } return true; } return false; } private static bool GetLoadedFont(Language.BundledFontLookupInfo replacementFontLookupInfo, out TMP_FontAsset loadedFont) { if (replacementFontLookupInfo != null) { return FontManager.TMPfonts.TryGetValue(replacementFontLookupInfo.fontName, out loadedFont); } loadedFont = null; return false; } private void ReplaceFont(TMP_FontAsset loadedFont) { ((TMP_Text)text).font = loadedFont; ((TMP_Text)text).fontSize = (int)orig_fontSize; ((TMP_Text)text).lineSpacing = orig_lineSpacing; fontReplaced = true; } public void AdjustToLanguage(Language newLanguage) { bool flag = false; if (!fontReplaced) { orig_font = ((TMP_Text)text).font; orig_fontSize = ((TMP_Text)text).fontSize; orig_lineSpacing = ((TMP_Text)text).lineSpacing; } if (TryReplaceFont()) { flag = true; } if (!flag && fontReplaced) { fontReplaced = false; ((TMP_Text)text).font = orig_font; ((TMP_Text)text).fontSize = orig_fontSize * newLanguage.info.chatFont.fontScale; ((TMP_Text)text).lineSpacing = orig_lineSpacing * newLanguage.info.chatFont.fontScale; } if (newLanguage.info.autoShrinkOverflowingText != textAutoShrunk) { if (newLanguage.info.autoShrinkOverflowingText) { if (textAutoShrinkable) { orig_resizeTextForBestFit = ((TMP_Text)text).enableAutoSizing; orig_resizeTextMaxSize = ((TMP_Text)text).fontSizeMax; orig_resizeTextMinSize = ((TMP_Text)text).fontSizeMin; ((TMP_Text)text).fontSizeMax = ((TMP_Text)text).fontSize; ((TMP_Text)text).fontSizeMin = Math.Min(2f, ((TMP_Text)text).fontSizeMin); ((TMP_Text)text).enableAutoSizing = true; textAutoShrunk = true; } } else { ((TMP_Text)text).enableAutoSizing = orig_resizeTextForBestFit; ((TMP_Text)text).fontSizeMax = orig_resizeTextMaxSize; ((TMP_Text)text).fontSizeMin = orig_resizeTextMinSize; textAutoShrunk = false; } } if (newTextFunc != null) { ((TMP_Text)text).text = newTextFunc((int)((TMP_Text)text).fontSize); } bool TryReplaceFont() { return ReplaceFontAlways(newLanguage.info.chatFont); } } public void OnDestory() { Localyssation.instance.OnLanguageChanged -= onLanguageChanged; LangAdjustables.registeredTextMeshPro.Remove(text); } } public class LangAdjustableTMProUGUIText : MonoBehaviour, ILangAdjustable { public TextMeshProUGUI text; public Func newTextFunc; public bool fontReplaced = false; public float orig_fontSize; public float orig_lineSpacing; public TMP_FontAsset orig_font; public bool textAutoShrinkable = true; public bool textAutoShrunk = false; public bool orig_resizeTextForBestFit = false; public float orig_resizeTextMaxSize; public float orig_resizeTextMinSize; public void Awake() { text = ((Component)this).GetComponent(); Localyssation.instance.OnLanguageChanged += onLanguageChanged; } public void Start() { AdjustToLanguage(LanguageManager.CurrentLanguage); } private void onLanguageChanged(Language newLanguage) { AdjustToLanguage(newLanguage); } private bool ReplaceFontIfMatch(string originalFontName, Language.BundledFontLookupInfo replacementFontLookupInfo) { if (replacementFontLookupInfo != null && FontManager.TMPfonts.TryGetValue(replacementFontLookupInfo.fontName, out var value)) { if ((Object)(object)((TMP_Text)text).font == (Object)(object)value) { return true; } if (Regex.IsMatch(((Object)((TMP_Text)text).font).name, originalFontName)) { ((TMP_Text)text).font = value; ((TMP_Text)text).fontSize = (int)orig_fontSize; ((TMP_Text)text).lineSpacing = orig_lineSpacing; fontReplaced = true; return true; } } return false; } private bool ReplaceFontForPath(string path, Language.BundledFontLookupInfo replacementFontLookupInfo) { if (PathUtil.GetPath(((TMP_Text)text).transform) == path && replacementFontLookupInfo != null && !string.IsNullOrEmpty(replacementFontLookupInfo.fontName)) { if (FontManager.TMPfonts.TryGetValue(replacementFontLookupInfo.fontName, out var value)) { if ((Object)(object)((TMP_Text)text).font == (Object)(object)value) { return true; } ((TMP_Text)text).font = value; ((TMP_Text)text).fontSize = (int)orig_fontSize; ((TMP_Text)text).lineSpacing = orig_lineSpacing; fontReplaced = true; return true; } Localyssation.logger.LogWarning((object)("Cannot find font `" + replacementFontLookupInfo.fontName + "` in loaded fonts.")); } return false; } public void AdjustToLanguage(Language newLanguage) { bool flag = false; if (!fontReplaced) { orig_font = ((TMP_Text)text).font; orig_fontSize = ((TMP_Text)text).fontSize; orig_lineSpacing = ((TMP_Text)text).lineSpacing; } if (TryReplaceFont()) { flag = true; } if (!flag && fontReplaced) { fontReplaced = false; ((TMP_Text)text).font = orig_font; ((TMP_Text)text).fontSize = orig_fontSize; ((TMP_Text)text).lineSpacing = orig_lineSpacing; } if (newLanguage.info.autoShrinkOverflowingText != textAutoShrunk) { if (newLanguage.info.autoShrinkOverflowingText) { if (textAutoShrinkable) { orig_resizeTextForBestFit = ((TMP_Text)text).enableAutoSizing; orig_resizeTextMaxSize = ((TMP_Text)text).fontSizeMax; orig_resizeTextMinSize = ((TMP_Text)text).fontSizeMin; ((TMP_Text)text).fontSizeMax = ((TMP_Text)text).fontSize; ((TMP_Text)text).fontSizeMin = Math.Min(2f, ((TMP_Text)text).fontSizeMin); ((TMP_Text)text).enableAutoSizing = true; textAutoShrunk = true; } } else { ((TMP_Text)text).enableAutoSizing = orig_resizeTextForBestFit; ((TMP_Text)text).fontSizeMax = orig_resizeTextMaxSize; ((TMP_Text)text).fontSizeMin = orig_resizeTextMinSize; textAutoShrunk = false; } } if (newTextFunc != null) { ((TMP_Text)text).text = newTextFunc((int)((TMP_Text)text).fontSize); } bool TryReplaceFont() { return newLanguage.info.fontReplacement.Select(delegate(KeyValuePair kvPair) { string key = kvPair.Key; Language.BundledFontLookupInfo value = kvPair.Value; return ReplaceFontIfMatch(key, value); }).Concat(newLanguage.info.componentSpecifiedFontReplacement.Select(delegate(KeyValuePair kvPair) { string key = kvPair.Key; Language.BundledFontLookupInfo value = kvPair.Value; return ReplaceFontForPath(key, value); })).Any((bool b) => b); } } public void OnDestroy() { Localyssation.instance.OnLanguageChanged -= onLanguageChanged; LangAdjustables.registeredTMProUGUITexts.Remove(text); } } public class LangAdjustableUIDropdown : MonoBehaviour, ILangAdjustable { public Dropdown dropdown; public List> newTextFuncs; public void Awake() { dropdown = ((Component)this).GetComponent(); Localyssation.instance.OnLanguageChanged += onLanguageChanged; if (Object.op_Implicit((Object)(object)dropdown.itemText)) { ((Component)dropdown.itemText).gameObject.AddComponent(); } if (Object.op_Implicit((Object)(object)dropdown.captionText)) { ((Component)dropdown.captionText).gameObject.AddComponent(); } } public void Start() { AdjustToLanguage(LanguageManager.CurrentLanguage); } private void onLanguageChanged(Language newLanguage) { AdjustToLanguage(newLanguage); } public void AdjustToLanguage(Language newLanguage) { if (newTextFuncs != null && 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; LangAdjustables.registeredDropdowns.Remove(dropdown); } } public class LangAdjustableUIText : MonoBehaviour, ILangAdjustable { public Text text; public Func newTextFunc; public bool fontReplaced = false; public int orig_fontSize; public float orig_lineSpacing; public Font orig_font; 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.verticalOverflow = (VerticalWrapMode)1; Localyssation.instance.OnLanguageChanged += onLanguageChanged; } public void Start() { AdjustToLanguage(LanguageManager.CurrentLanguage); } private void onLanguageChanged(Language newLanguage) { AdjustToLanguage(newLanguage); } private bool ReplaceFontIfMatch(string originalFontName, Language.BundledFontLookupInfo replacementFontLookupInfo) { if (replacementFontLookupInfo != null && FontManager.Fonts.TryGetValue(replacementFontLookupInfo.fontName, out var value)) { if ((Object)(object)text.font == (Object)(object)value) { return true; } if (((Object)text.font).name == originalFontName) { text.font = value; text.fontSize = (int)((float)orig_fontSize * replacementFontLookupInfo.fontScale); text.lineSpacing = orig_lineSpacing * replacementFontLookupInfo.fontScale; fontReplaced = true; return true; } } return false; } private bool ReplaceFontForPath(string path, Language.BundledFontLookupInfo replacementFontLookupInfo) { if (PathUtil.GetPath(((Component)text).transform) == path && replacementFontLookupInfo != null && FontManager.Fonts.TryGetValue(replacementFontLookupInfo.fontName, out var value)) { if ((Object)(object)text.font == (Object)(object)value) { return true; } text.font = value; text.fontSize = (int)((float)orig_fontSize * replacementFontLookupInfo.fontScale); text.lineSpacing = orig_lineSpacing * replacementFontLookupInfo.fontScale; fontReplaced = true; return true; } return false; } public void AdjustToLanguage(Language newLanguage) { bool flag = false; if (!fontReplaced) { orig_font = text.font; orig_fontSize = text.fontSize; orig_lineSpacing = text.lineSpacing; } if (TryReplaceFont()) { flag = true; } if (!flag && fontReplaced) { fontReplaced = false; text.font = orig_font; text.fontSize = (int)((float)orig_fontSize * newLanguage.info.chatFont.fontScale); text.lineSpacing = orig_lineSpacing * newLanguage.info.chatFont.fontScale; } if (newLanguage.info.autoShrinkOverflowingText != textAutoShrunk) { 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 = (int)((float)orig_resizeTextMaxSize * newLanguage.info.chatFont.fontScale); text.resizeTextMinSize = (int)((float)orig_resizeTextMinSize * newLanguage.info.chatFont.fontScale); textAutoShrunk = false; } } if (newTextFunc != null) { text.text = newTextFunc(text.fontSize); } bool TryReplaceFont() { return newLanguage.info.fontReplacement.Select(delegate(KeyValuePair kvPair) { string key = kvPair.Key; Language.BundledFontLookupInfo value = kvPair.Value; return ReplaceFontIfMatch(key, value); }).Concat(newLanguage.info.componentSpecifiedFontReplacement.Select(delegate(KeyValuePair kvPair) { string key = kvPair.Key; Language.BundledFontLookupInfo value = kvPair.Value; return ReplaceFontForPath(key, value); })).Any((bool b) => b); } } public void OnDestroy() { Localyssation.instance.OnLanguageChanged -= onLanguageChanged; LangAdjustables.registeredTexts.Remove(text); } } } namespace Localyssation.Exporter { internal abstract class Exporter : MonoBehaviour where T : ScriptableObject { public abstract string Name(); public string GetExportMarkdownFile() { return Path.Combine(ExportUtil.EXPORT_FOLDER, Name() + ".md"); } public string GetExportAssetFolder() { return Path.Combine(ExportUtil.EXPORT_FOLDER, "asset", Name()); } public string GetExportAssetPath(string assetName) { return Path.Combine(GetExportAssetFolder(), assetName); } public string CreateAndInsertImageAsset(string name, Sprite sp) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!File.Exists(GetExportAssetPath(name))) { RenderTexture temporary = RenderTexture.GetTemporary(((Texture)sp.texture).width, ((Texture)sp.texture).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1); Graphics.Blit((Texture)(object)sp.texture, temporary); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; Texture2D val = new Texture2D(((Texture)sp.texture).width, ((Texture)sp.texture).height); val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); File.WriteAllBytes(GetExportAssetPath(name + ".png"), ImageConversion.EncodeToPNG(val)); } string text = new Uri(Path.Combine("asset", Name(), name + ".png")).ToString(); return "![" + name + "](" + text + ")"; } public Exporter() { Directory.CreateDirectory(GetExportAssetFolder()); } public void Export(IEnumerable data) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(CreateHeader()); foreach (T datum in data) { stringBuilder.AppendLine(Serialize(datum)); } stringBuilder.AppendLine(CreateEnding()); File.AppendAllText(GetExportMarkdownFile(), stringBuilder.ToString()); } public abstract string Serialize(T data); protected abstract string CreateHeader(); protected abstract string CreateEnding(); } internal static class ExportUtil { public static readonly string EXPORT_FOLDER = GenerateExportFolder(); private static string GenerateExportFolder() { string[] files = Directory.GetFiles(Paths.PluginPath, "Localyssation.dll", SearchOption.AllDirectories); string path = files[0]; path = Path.GetDirectoryName(path); if (string.IsNullOrWhiteSpace(path)) { path = Paths.PluginPath; } path = Path.Combine(path, "LocalyssationExtraInfoExport"); Localyssation.logger.LogInfo((object)path); return path; } public static void InitExports() { if (LocalyssationConfig.ExportExtra) { Directory.CreateDirectory(EXPORT_FOLDER); Directory.Delete(EXPORT_FOLDER, recursive: true); Directory.CreateDirectory(EXPORT_FOLDER); } } } internal class ScriptableItemExporter : Exporter { protected override string CreateEnding() { return ""; } public override string Name() { return "ScriptableItem"; } protected override string CreateHeader() { return "|Icon|Key|Name|\n|---|---|---|"; } public override string Serialize(ScriptableItem data) { return $"|{CreateAndInsertImageAsset(data._itemName, data._itemIcon)}|{KeyUtil.GetForAsset(data)}|{data._itemName}|"; } } internal class ScriptableQuestExporter : Exporter { public readonly string _questGiverName; public ScriptableQuestExporter(string questGiverName) { _questGiverName = questGiverName; } protected override string CreateEnding() { return ""; } public override string Name() { return "ScriptableQuest"; } protected override string CreateHeader() { return new StringBuilder().AppendLine("# " + _questGiverName).AppendLine("|Quest Name|Quest Type|Quest Subtype|Quest Level|").Append("|----------|----------|-------------|-----------|") .ToString(); } public override string Serialize(ScriptableQuest data) { return $"|{data._questName}|{((object)Unsafe.As(ref data._questType)/*cast due to .constrained prefix*/).ToString()}|{((object)Unsafe.As(ref data._questSubType)/*cast due to .constrained prefix*/).ToString()}|{data._questLevel}|"; } } }