using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using On.RoR2.UI;
using ProperKorean.Properties;
using R2API.Utils;
using RoR2;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.TextCore;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ProperKorean")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ProperKorean")]
[assembly: AssemblyTitle("ProperKorean")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ProperKorean
{
internal static class Log
{
internal static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void LogDebug(object data)
{
_logSource.LogDebug(data);
}
internal static void LogError(object data)
{
_logSource.LogError(data);
}
internal static void LogFatal(object data)
{
_logSource.LogFatal(data);
}
internal static void LogInfo(object data)
{
_logSource.LogInfo(data);
}
internal static void LogMessage(object data)
{
_logSource.LogMessage(data);
}
internal static void LogWarning(object data)
{
_logSource.LogWarning(data);
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("DVRP.ProperKorean", "ProperKorean", "1.2.3")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class ProperKorean : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static hook_OnCurrentLanguageChanged <0>__HGTextMeshProUGUI_OnCurrentLanguageChanged;
}
public const string PluginGUID = "DVRP.ProperKorean";
public const string PluginAuthor = "DVRP";
public const string PluginName = "ProperKorean";
public const string PluginVersion = "1.2.3";
private static AssetBundle properBundle = AssetBundle.LoadFromMemory(Resources.properkorean);
private static TMP_FontAsset properFont;
private void Awake()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
properFont = properBundle.LoadAsset<TMP_FontAsset>("Assets/properkorean/NotoSansCJKsc-Regular SDF (Korean).asset");
object obj = <>O.<0>__HGTextMeshProUGUI_OnCurrentLanguageChanged;
if (obj == null)
{
hook_OnCurrentLanguageChanged val = HGTextMeshProUGUI_OnCurrentLanguageChanged;
<>O.<0>__HGTextMeshProUGUI_OnCurrentLanguageChanged = val;
obj = (object)val;
}
HGTextMeshProUGUI.OnCurrentLanguageChanged += (hook_OnCurrentLanguageChanged)obj;
ImproveSeekerTooltips();
}
private static void FixLocalization()
{
JObject val = JObject.Parse(Encoding.UTF8.GetString(Resources.output_korean));
Dictionary<string, string> dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(((object)val["strings"]).ToString());
foreach (KeyValuePair<string, string> item in dictionary)
{
if (Language.currentLanguage.GetLocalizedStringByToken(item.Key) != item.Value)
{
Language.currentLanguage.SetStringByToken(item.Key, item.Value);
}
}
Log.LogInfo("ProperKorean :: Fixed localization");
}
private static void FixFont()
{
//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)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
TMP_FontAsset val = LegacyResourcesAPI.LoadAsync<TMP_FontAsset>("TmpFonts/Bombardier/tmpBombDropshadow").WaitForCompletion();
Glyph val2 = val.glyphTable.Find((Glyph x) => x.index == 95);
GlyphMetrics metrics = val2.metrics;
((GlyphMetrics)(ref metrics)).horizontalBearingY = 40f;
val2.metrics = metrics;
properFont.fallbackFontAssets.Add(val);
if (((Object)TMP_Settings.fallbackFontAssets[0]).name != "tmpBombDropshadow")
{
TMP_Settings.fallbackFontAssets.Insert(0, val);
}
HGTextMeshProUGUI.defaultLanguageFont = properFont;
Log.LogInfo("ProperKorean :: Fixed font");
}
private static void HGTextMeshProUGUI_OnCurrentLanguageChanged(orig_OnCurrentLanguageChanged orig)
{
orig.Invoke();
if (Language.currentLanguageName == "ko")
{
FixFont();
FixLocalization();
}
}
private static void ImproveSeekerTooltips()
{
//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)
GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SeekerBody.prefab").WaitForCompletion();
GenericSkill[] components = val.GetComponents<GenericSkill>();
foreach (GenericSkill val2 in components)
{
switch (val2.skillName)
{
case "SpiritPunch":
val2.skillFamily.variants[0].skillDef.keywordTokens = new string[1] { "SEEKER_PRIMARY_UPGRADE_TOOLTIP" };
break;
case "UnseenHand":
val2.skillFamily.variants[0].skillDef.keywordTokens = new string[1] { "SEEKER_SECONDARY_UPGRADE_TOOLTIP" };
val2.skillFamily.variants[1].skillDef.keywordTokens = new string[1] { "SEEKER_SECONDARY_ALT1_UPGRADE_TOOLTIP" };
break;
case "Sojourn":
val2.skillFamily.variants[0].skillDef.keywordTokens = new string[1] { "SEEKER_UTILITY_UPGRADE_TOOLTIP" };
break;
case "MeditateUI":
val2.skillFamily.variants[0].skillDef.keywordTokens[0] = "SEEKER_SPECIAL_UPGRADE_TOOLTIP";
break;
}
}
}
}
}
namespace ProperKorean.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("ProperKorean.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static byte[] output_korean
{
get
{
object @object = ResourceManager.GetObject("output_korean", resourceCulture);
return (byte[])@object;
}
}
internal static byte[] properkorean
{
get
{
object @object = ResourceManager.GetObject("properkorean", resourceCulture);
return (byte[])@object;
}
}
internal Resources()
{
}
}
}