using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("LethalLibKR")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("LethalThingsKR")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("LethalLibKR")]
[assembly: AssemblyTitle("LethalLibKR")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace LethalLibKR
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("LethalLibKR", "LethalLibKR", "1.0.1")]
public class LethalLibKR : BaseUnityPlugin
{
public static LethalLibKR instance = null;
public ConfigFile config;
private static Dictionary<string, string> _defaultItemLocalization = new Dictionary<string, string>
{
{ "Dead Hoarder Bug", "비축 벌레 사체" },
{ "Dead Bunker Spider", "벙커 거미 사체" },
{ "Dead Thumper", "덤퍼 사체" },
{ "Dead Snare Flea", "올가미 벼룩 사체" },
{ "Bracken Remains", "브래켄 잔여물" },
{ "Dead Baboon Hawk", "개코 매 사체" },
{ "Dead Eyeless Dog", "눈 없는 개 사체" },
{ "Dead Nutcracker", "호두까기 사체" },
{ "Dart", "다트" }
};
private static Dictionary<string, string> _ScrapLocalization = new Dictionary<string, string>
{
{ "Weezer Guitar", "전자 기타" },
{ "Fire Axe", "소방도끼" }
};
private static Dictionary<string, string> _StoreLocalization = new Dictionary<string, string>
{
{ "Rocket Launcher", "로켓런처" },
{ "Flaregun", "플레어 건" },
{ "Emergency Flare (ammo)", "조명탄 탄약" },
{ "Toy Hammer", "뿅망치" },
{ "Remote Radar", "휴대용 레이더" },
{ "Utility Belt", "짐꾼용 벨트" },
{ "Hacking Tool", "해킹용 툴" },
{ "Pinger", "핑송신기" },
{ "Geiger Counter", "방사능 측정기" }
};
private static Dictionary<string, string> _UnlockableLocalization = new Dictionary<string, string>
{
{ "Small Rug", "소박한 러그" },
{ "Large Rug", "거대한 러그" },
{ "Fatalities Sign", "무사고 표지" },
{ "Dartboard", "다트판" }
};
private static Dictionary<string, string> itemLocalization = new Dictionary<string, string>();
public void Awake()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
instance = this;
config = ((BaseUnityPlugin)this).Config;
Harmony val = new Harmony("LethalLibKR");
val.PatchAll(typeof(LethalLibKR));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalLibKR is loaded!");
}
private static char CheckEeulReul(char ch)
{
int num = Convert.ToInt32(ch);
if (num < 44032 || num > 55203 || (num - 44032) % 28 > 0)
{
return '을';
}
return '를';
}
[HarmonyPatch(typeof(Items), "Terminal_Awake")]
[HarmonyPrefix]
public static void Terminal_Awake_Items()
{
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_031e: Unknown result type (might be due to invalid IL or missing references)
ConfigEntry<bool> val = ((BaseUnityPlugin)instance).Config.Bind<bool>("Normal Item Localization Setting", "Allow naming override?", false, "You can change the name at alert on ship enter with it.\n But overriding item name may break mod functionalities based on it's name.");
foreach (PlainItem plainItem in Items.plainItems)
{
if (!itemLocalization.ContainsValue(plainItem.item.itemName))
{
string text = (_defaultItemLocalization.ContainsKey(plainItem.item.itemName) ? _defaultItemLocalization[plainItem.item.itemName] : plainItem.item.itemName);
ConfigEntry<string> val2 = ((BaseUnityPlugin)instance).Config.Bind<string>("Normal Item Localization", plainItem.item.itemName, text, "Override scan result");
string value = val2.Value;
itemLocalization.Add(plainItem.item.itemName, value);
GameObject spawnPrefab = plainItem.item.spawnPrefab;
ScanNodeProperties val3 = ((spawnPrefab != null) ? spawnPrefab.GetComponentInChildren<ScanNodeProperties>() : null);
if ((Object)(object)val3 == (Object)null)
{
GameObject val4 = Object.Instantiate<GameObject>(Items.scanNodePrefab, plainItem.item.spawnPrefab.transform);
((Object)val4).name = "ScanNode";
val4.transform.localPosition = new Vector3(0f, 0f, 0f);
}
val3.headerText = value;
((BaseUnityPlugin)instance).Logger.LogDebug((object)("PlainItem '" + plainItem.item.itemName + "` is localized to " + value));
if (val.Value)
{
plainItem.item.itemName = value;
}
}
}
ConfigEntry<bool> val5 = ((BaseUnityPlugin)instance).Config.Bind<bool>("Scrap Item Localization Setting", "Allow naming override?", false, "You can change the name at alert on ship enter with it.\n But overriding item name may break mod functionalities based on it's name.");
foreach (ScrapItem scrapItem in Items.scrapItems)
{
((BaseUnityPlugin)instance).Logger.LogDebug((object)("ScrapItem '" + scrapItem.item.itemName));
if (!_ScrapLocalization.ContainsValue(scrapItem.item.itemName))
{
string text2 = (_ScrapLocalization.ContainsKey(scrapItem.item.itemName) ? _ScrapLocalization[scrapItem.item.itemName] : scrapItem.item.itemName);
ConfigEntry<string> val6 = ((BaseUnityPlugin)instance).Config.Bind<string>("Scrap Item Localization", scrapItem.item.itemName, text2, "Override scan result");
string value2 = val6.Value;
GameObject spawnPrefab2 = scrapItem.item.spawnPrefab;
ScanNodeProperties val7 = ((spawnPrefab2 != null) ? spawnPrefab2.GetComponentInChildren<ScanNodeProperties>() : null);
if ((Object)(object)val7 == (Object)null)
{
GameObject val8 = Object.Instantiate<GameObject>(Items.scanNodePrefab, scrapItem.item.spawnPrefab.transform);
((Object)val8).name = "ScanNode";
val8.transform.localPosition = new Vector3(0f, 0f, 0f);
val7 = val8.GetComponent<ScanNodeProperties>();
}
val7.headerText = value2;
((BaseUnityPlugin)instance).Logger.LogDebug((object)("ScrapItem '" + scrapItem.item.itemName + "` is localized to " + value2));
if (val5.Value)
{
scrapItem.item.itemName = value2;
}
}
}
foreach (ShopItem shopItem in Items.shopItems)
{
if (!((Object)(object)shopItem.buyNode1 != (Object)null))
{
string text3 = (_StoreLocalization.ContainsKey(shopItem.item.itemName) ? _StoreLocalization[shopItem.item.itemName] : shopItem.item.itemName);
ConfigEntry<string> val9 = instance.config.Bind<string>("Store Item", shopItem.item.itemName, text3, "Override original store Name. Do not change if functionalities of item is not working by changing it");
if (val9.Value.Length > 0)
{
string value3 = val9.Value;
((BaseUnityPlugin)instance).Logger.LogDebug((object)("ShopItem '" + shopItem.item.itemName + "' is localized to " + value3));
shopItem.item.itemName = value3;
TerminalNode val10 = ScriptableObject.CreateInstance<TerminalNode>();
((Object)val10).name = value3.Replace(" ", "-") + "BuyNode1";
val10.displayText = $"{value3}{CheckEeulReul(value3[value3.Length - 1])} 주문하려고 합니다. 수량: [variableAmount]개.\n아이템의 총 가격: [totalCost].\n\nCONFIRM 혹은 DENY를 입력하세요.\r\n\r\n";
val10.clearPreviousText = true;
val10.maxCharactersToType = 35;
TerminalNode val11 = ScriptableObject.CreateInstance<TerminalNode>();
((Object)val11).name = value3.Replace(" ", "-") + "BuyNode2";
val11.displayText = $"[variableAmount]개의 {value3}{CheckEeulReul(value3[value3.Length - 1])} 주문했습니다. 당신의 현재 소지금은 [playerCredits]입니다.\n\n우리의 계약자는 작업 중에도 빠른 무료 배송 혜택을 누릴 수 있습니다! 구매한 모든 상품은 1시간마다 대략적인 위치에 도달합니다.\r\n\r\n";
val11.clearPreviousText = true;
val11.maxCharactersToType = 15;
shopItem.buyNode1 = val10;
shopItem.buyNode2 = val11;
}
}
}
}
[HarmonyPatch(typeof(Unlockables), "Terminal_Awake")]
[HarmonyPrefix]
public static void Terminal_Awake_Unlockables()
{
foreach (RegisteredUnlockable registeredUnlockable in Unlockables.registeredUnlockables)
{
if (!((Object)(object)registeredUnlockable.buyNode1 != (Object)null))
{
string text = (_UnlockableLocalization.ContainsKey(registeredUnlockable.unlockable.unlockableName) ? _UnlockableLocalization[registeredUnlockable.unlockable.unlockableName] : registeredUnlockable.unlockable.unlockableName);
ConfigEntry<string> val = instance.config.Bind<string>("Unlockable Item", registeredUnlockable.unlockable.unlockableName, text, (ConfigDescription)null);
if (val.Value.Length > 0)
{
string value = val.Value;
((BaseUnityPlugin)instance).Logger.LogDebug((object)("ShopItem '" + registeredUnlockable.unlockable.unlockableName + "' is localized to " + value));
registeredUnlockable.unlockable.unlockableName = value;
TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>();
((Object)val2).name = value.Replace(" ", "-") + "BuyNode1";
val2.displayText = $"{value}{CheckEeulReul(value[value.Length - 1])} 주문하려고 합니다.\n아이템의 총 가격: [totalCost].\n\nCONFIRM 혹은 DENY를 입력하세요.\r\n\r\n";
val2.clearPreviousText = true;
val2.maxCharactersToType = 35;
TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>();
((Object)val3).name = value.Replace(" ", "-") + "BuyNode2";
val3.displayText = $"[variableAmount]개의 {value}{CheckEeulReul(value[value.Length - 1])} 주문했습니다. 당신의 현재 소지금은 [playerCredits]입니다.\n\n우리의 계약자는 작업 중에도 빠른 무료 배송 혜택을 누릴 수 있습니다! 구매한 모든 상품은 1시간마다 대략적인 위치에 도달합니다.\r\n\r\n";
val3.clearPreviousText = true;
val3.maxCharactersToType = 15;
registeredUnlockable.buyNode1 = val2;
registeredUnlockable.buyNode2 = val3;
}
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LethalLibKR";
public const string PLUGIN_NAME = "LethalLibKR";
public const string PLUGIN_VERSION = "1.0.1";
}
}