using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCKR.Patches; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("RadiationIsCool")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RadiationIsCool")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [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; } } } public static class Const { public const int ImageDiv = 16; public const int ImageCompareSize = 64; } namespace LCKR { [BepInPlugin("Piggy.LCKR", "LCKR", "2.1.1")] public class Plugin : BaseUnityPlugin { private const string modGUID = "Piggy.LCKR"; private const string modName = "LCKR"; public const string modVersion = "2.1.1"; public static string modVerType = "b"; private readonly Harmony harmony = new Harmony("Piggy.LCKR"); private static Plugin Instance; public static ManualLogSource mls; public static AssetBundle Bundle; public static TMP_FontAsset font3270_HUDIngame; public static TMP_FontAsset font3270_HUDIngame_Variant; public static TMP_FontAsset font3270_HUDIngameB; public static TMP_FontAsset font3270_Regular_SDF; public static TMP_FontAsset font3270_b; public static TMP_FontAsset font3270_DialogueText; public static TMP_FontAsset fontEdunline; public static TMP_FontAsset fontAds; public static VideoClip snareKorean; public static bool fullyKoreanMoons; public static GameObject resetPanel; public static bool patchFont; public static bool toKG; public static bool toCelsius; public static bool showVersion; public static bool versionChanged; public static string deathText; public static string quotaReached; public static string firedText; public static string sellText; public static string injuryText; public static string systemOnlineText; public static string allDead1; public static string allDead2; public static string autoTakeoff1; public static string autoTakeoff2; public static string midnightWarning; public static string PluginDirectory; public static string TranslationFilePath; public static string DefTranslationFilePath; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } PluginDirectory = ((BaseUnityPlugin)this).Info.Location; TranslationFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath.Replace("Piggy.LCKR.cfg", "") + "\\LCKR_Translation"; DefTranslationFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath.Replace("Piggy.LCKR.cfg", "") + "LCKR_Translation\\Default"; mls = Logger.CreateLogSource("Piggy.LCKR"); LoadAssets(); TextureReplacer.Setup(); TranslationManager.Setup(); patchFont = ((BaseUnityPlugin)this).Config.Bind("폰트", "폰트 변경", true, "기본값은 true입니다.\nFontPatcher 등 외부 폰트 모드를 사용하려면 이 값을 false로 설정하세요. false로 설정하면 본 모드에서 폰트를 변경하지 않습니다.").Value; showVersion = ((BaseUnityPlugin)this).Config.Bind("일반", "버전 표시", true, "기본값은 true입니다.\ntrue로 설정하면 메인 화면에 모드의 버전을 표시합니다..").Value; toKG = ((BaseUnityPlugin)this).Config.Bind("번역", "KG으로 표기", true, "기본값은 true입니다.\ntrue로 설정하면 무게 수치를 kg으로 변환/표기합니다.").Value; toCelsius = ((BaseUnityPlugin)this).Config.Bind("번역", "섭씨로 표기", true, "기본값은 true입니다.\ntrue로 설정하면 온도를 섭씨로 변환/표기합니다.").Value; string path = Path.Combine(Paths.ConfigPath, "lckrVersion.txt"); if (File.Exists(path)) { string text = File.ReadAllText(path); if (text != "2.1.1") { ((BaseUnityPlugin)this).Logger.LogInfo((object)("버전 변경됨: " + text + " -> 2.1.1")); versionChanged = true; } } else { versionChanged = true; } File.WriteAllText(path, "2.1.1"); mls.LogInfo((object)"LCKR is loaded"); mls.LogInfo((object)("base.Config.ConfigFilePath: " + ((BaseUnityPlugin)this).Config.ConfigFilePath)); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } private void LoadAssets() { try { Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "lckorean")); } catch (Exception ex) { mls.LogError((object)("Couldn't load asset bundle: " + ex.Message)); return; } try { font3270_HUDIngame = Bundle.LoadAsset("3270-HUDIngame.asset"); font3270_HUDIngame_Variant = Bundle.LoadAsset("3270-HUDIngame - Variant.asset"); font3270_HUDIngameB = Bundle.LoadAsset("3270-HUDIngameB.asset"); font3270_Regular_SDF = Bundle.LoadAsset("3270-Regular SDF.asset"); font3270_b = Bundle.LoadAsset("b.asset"); font3270_DialogueText = Bundle.LoadAsset("DialogueText.asset"); fontEdunline = Bundle.LoadAsset("edunline SDF.asset"); fontAds = Bundle.LoadAsset("HakgyoansimMalgeunnalB SDF.asset"); snareKorean = Bundle.LoadAsset("SnareFleaTipChannel2.m4v"); resetPanel = Bundle.LoadAsset("LCKRComponent.prefab"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded assets!"); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)("Couldn't load assets: " + ex2.Message)); } } private void ReplaceImageFile() { string location = Assembly.GetExecutingAssembly().Location; string directoryName = Path.GetDirectoryName(location); string text = "example.png"; string text2 = Path.Combine(directoryName, text); if (!File.Exists(text2)) { ((BaseUnityPlugin)this).Logger.LogError((object)("이미지 파일이 " + text2 + "에 없습니다.")); return; } string text3 = Path.Combine("게임_이미지_파일_경로", text); if (!File.Exists(text3)) { ((BaseUnityPlugin)this).Logger.LogError((object)("게임 내 이미지 파일이 " + text3 + "에 없습니다.")); return; } try { File.Copy(text2, text3, overwrite: true); ((BaseUnityPlugin)this).Logger.LogInfo((object)("이미지 파일 " + text + "이 " + text3 + "에 성공적으로 덮어쓰기되었습니다.")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("이미지 파일 덮어쓰기 중 오류 발생: " + ex.Message)); } } } } namespace LCKR.Patches { [HarmonyPatch(typeof(IngamePlayerSettings))] internal class IngamePlayerSettingsPatch { [HarmonyPrefix] [HarmonyPatch("SetSettingsOptionsText")] private static void SetSettingsOptionsText_Prefix(SettingsOptionType optionType, string setToText) { setToText = setToText.Replace("Current input device:", "현재 입력 장치:"); setToText = setToText.Replace("No device found \n (click to refresh)", "장치 발견되지 않음 \n (클릭하여 새로고침)"); setToText = setToText.Replace("MODE: Push to talk", "모드: 눌러서 말하기"); setToText = setToText.Replace("MODE: Voice activation", "모드: 음성 감지"); } } [HarmonyPatch(typeof(EntranceTeleport))] internal class EntranceTeleportPatch { } [HarmonyPatch(typeof(QuickMenuManager))] internal class QuickMenuManagerPatch { [HarmonyPrefix] [HarmonyPatch("Update")] private static void Update_Prefix(ref TextMeshProUGUI ___settingsBackButton) { if ((Object)(object)___settingsBackButton != (Object)null) { ((TMP_Text)___settingsBackButton).text = ((TMP_Text)___settingsBackButton).text.Replace("Discard changes", "변경 사항 취소"); ((TMP_Text)___settingsBackButton).text = ((TMP_Text)___settingsBackButton).text.Replace("Back", "뒤로"); } } } [HarmonyPatch(typeof(ShotgunItem))] internal class ShotgunItemPatch { } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { public static string cursorTip; [HarmonyPostfix] [HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")] private static void SetHoverTipAndCurrentInteractTrigger_Postfix(ref TextMeshProUGUI ___cursorTip) { string text = ((TMP_Text)___cursorTip).text; if (text != cursorTip) { cursorTip = TranslationManager.ReplaceArrayTextAll(text, "CursorTip"); ((TMP_Text)___cursorTip).text = cursorTip; } } [HarmonyPostfix] [HarmonyPatch("SpawnDeadBody")] private static void SpawnDeadBody_Postfix() { DeadBodyInfo[] array = Object.FindObjectsOfType(); DeadBodyInfo[] array2 = array; foreach (DeadBodyInfo val in array2) { ScanNodeProperties componentInChildren = ((Component)val).gameObject.GetComponentInChildren(); if (!componentInChildren.headerText.Contains(TranslationManager.GetArrayTranslation("DeathReasons", "PlayerBody"))) { componentInChildren.headerText = componentInChildren.headerText.Replace("Body of ", ""); componentInChildren.headerText += TranslationManager.GetArrayTranslation("DeathReasons", "PlayerBody"); } string[] array3 = componentInChildren.subText.Split(':'); string key = array3[0].Trim(); string key2 = array3[1].Trim(); componentInChildren.subText = TranslationManager.ReplaceArrayText(componentInChildren.subText, "DeathReasons", key); componentInChildren.subText = TranslationManager.ReplaceArrayText(componentInChildren.subText, "DeathReasons", key2); } } } [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch { } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { private static TextMeshProUGUI _loadingText; [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix() { if (GameNetworkManager.Instance.gameVersionNum >= 80 && (Object)(object)_loadingText == (Object)null) { _loadingText = GameObject.Find("LoadText").GetComponent(); ((TMP_Text)_loadingText).text = TranslationManager.GetArrayTranslation("HUD", "LoadText"); } } [HarmonyPostfix] [HarmonyPatch("GenerateNewLevelClientRpc")] private static void GenerateNewLevelClientRpc_Postfix() { if (((TMP_Text)HUDManager.Instance.loadingText).text.Contains("Random seed")) { ((TMP_Text)HUDManager.Instance.loadingText).text = ((TMP_Text)HUDManager.Instance.loadingText).text.Replace("Random seed", "무작위 시드"); } } } [HarmonyPatch(typeof(ShipBuildModeManager))] internal class ShipBuildModeManagerPatch { [HarmonyPostfix] [HarmonyPatch("CreateGhostObjectAndHighlight")] private static void CreateGhostObjectAndHighlight_Postfix() { string text = ((TMP_Text)HUDManager.Instance.buildModeControlTip).text.Replace("Confirm", "배치"); text = text.Replace("Rotate", "회전"); text = text.Replace("Store", "보관"); ((TMP_Text)HUDManager.Instance.buildModeControlTip).text = text; } } [HarmonyPatch(typeof(ManualCameraRenderer))] internal class ManualCameraRendererPatch { [HarmonyPostfix] [HarmonyPatch("Update")] private static void Update_Postfix(UnlockableSuit __instance) { TextMeshProUGUI mapScreenPlayerName = StartOfRound.Instance.mapScreenPlayerName; ((TMP_Text)mapScreenPlayerName).text = TranslationManager.ReplaceArrayText(((TMP_Text)mapScreenPlayerName).text, "Ingame", "MONITORING"); } } [HarmonyPatch(typeof(TVScript))] internal class TVScriptPatch { [HarmonyPostfix] [HarmonyPatch("SetTVScreenMaterial")] private static void SetTVScreenMaterial_Postfix(ref VideoClip[] ___tvClips) { for (int i = 0; i < ___tvClips.Length; i++) { if (((Object)___tvClips[i]).name == "SnareFleaTipChannel2") { ___tvClips[i] = Plugin.snareKorean; } } } } [HarmonyPatch(typeof(UnlockableSuit))] internal class UnlockableSuitPatch { } [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatch { [HarmonyPostfix] [HarmonyPatch("UpdateProfitQuotaCurrentTime")] private static void UpdateProfitQuotaCurrentTime_Postfix(ref int ___daysUntilDeadline, ref float ___timeUntilDeadline, ref float ___totalTime, ref int ___hoursUntilDeadline, ref float ___lengthOfHours, ref int ___numberOfHours, ref int ___quotaFulfilled, ref int ___profitQuota) { if (StartOfRound.Instance.isChallengeFile) { ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = TranslationManager.GetArrayTranslation("Ingame", "CH_DeadlineMonitor") + "\n" + TranslationManager.GetArrayTranslation("Ingame", "CH_DeadlineMonitor", 1) + "\n" + TranslationManager.GetArrayTranslation("Ingame", "CH_DeadlineMonitor", 2); ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = TranslationManager.GetArrayTranslation("Ingame", "CH_QuotaMonitor") + "\n" + TranslationManager.GetArrayTranslation("Ingame", "CH_QuotaMonitor", 1) + "\n" + GameNetworkManager.Instance.GetNameForWeekNumber(-1); } else { ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = TranslationManager.ReplaceArrayText(((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text, "Ingame", "Days"); ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = TranslationManager.ReplaceArrayText(((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text, "Ingame", "DEADLINE"); if (___timeUntilDeadline <= 0f) { ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = TranslationManager.ReplaceArrayText(((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text, "Ingame", "Now"); } else { ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = TranslationManager.ReplaceArrayText(((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text, "Ingame", "CL_DeadlineMonitor"); } ((TMP_Text)StartOfRound.Instance.profitQuotaMonitorText).text = string.Format("{0}:\n${1} / ${2}", TranslationManager.GetArrayTranslation("Ingame", "QuotaMonitor"), ___quotaFulfilled, ___profitQuota); } } [HarmonyPostfix] [HarmonyPatch("Update")] private static void Update_Postfix() { TextMeshProUGUI clockNumber = HUDManager.Instance.clockNumber; ((TMP_Text)clockNumber).text = TranslationManager.ReplaceArrayText(((TMP_Text)clockNumber).text, "Ingame", "AM"); ((TMP_Text)clockNumber).text = TranslationManager.ReplaceArrayText(((TMP_Text)clockNumber).text, "Ingame", "PM"); } [HarmonyPostfix] [HarmonyPatch("VoteShipToLeaveEarly")] private static void VoteShipToLeaveEarly_Postfix(ref DialogueSegment[] ___shipLeavingEarlyDialogue) { ___shipLeavingEarlyDialogue[0].bodyText = TranslationManager.ReplaceArrayText(___shipLeavingEarlyDialogue[0].bodyText, "Ingame", "AM"); ___shipLeavingEarlyDialogue[0].bodyText = TranslationManager.ReplaceArrayText(___shipLeavingEarlyDialogue[0].bodyText, "Ingame", "AM"); } } [HarmonyPatch(typeof(InteractTrigger))] internal class InteractTriggerPatch { } [HarmonyPatch(typeof(SaveFileUISlot))] internal class SaveFileUISlotPatch { [HarmonyPostfix] [HarmonyPatch("OnEnable")] private static void OnEnable_Postfix(SaveFileUISlot __instance, ref string ___fileString) { if (__instance.fileNum == -1) { ((TMP_Text)__instance.fileNameText).text = GameNetworkManager.Instance.GetNameForWeekNumber(-1); } if (ES3.FileExists(___fileString) && __instance.fileNum != -1) { int num = ES3.Load("GroupCredits", ___fileString, 0); int num2 = ES3.Load("Stats_DaysSpent", ___fileString, 0); ((TMP_Text)__instance.fileStatsText).text = $"${num}\n{num2}일차"; } } [HarmonyPostfix] [HarmonyPatch("SetFileToThis")] private static void SetFileToThis_Postfix(ref TextMeshProUGUI ___specialTipText) { if ((Object)(object)___specialTipText != (Object)null && ((Behaviour)___specialTipText).enabled) { ((TMP_Text)___specialTipText).text = ((TMP_Text)___specialTipText).text.Replace("This is the weekly challenge moon. You have one day to make as much profit as possible.", "주간 챌린지 위성입니다. 하루 안에 가능한 한 많은 수익을 획득하세요."); } } } [HarmonyPatch(typeof(PreInitSceneScript))] internal class PreInitSceneScriptPatch { [HarmonyPostfix] [HarmonyPatch("PressContinueButton")] private static void PressContinueButton_Postfix(ref int ___currentLaunchSettingPanel, ref GameObject[] ___LaunchSettingsPanels, ref Animator ___blackTransition, ref GameObject ___continueButton, ref TextMeshProUGUI ___headerText) { if (((TMP_Text)___headerText).text == "LAUNCH MODE") { ((TMP_Text)___headerText).text = "실행 모드"; } } [HarmonyPostfix] [HarmonyPatch("SkipToFinalSetting")] private static void SkipToFinalSetting_Postfix(PreInitSceneScript __instance, ref TextMeshProUGUI ___headerText) { LoadingManager loadingManager = ((Component)__instance).gameObject.AddComponent(); loadingManager.text = (TMP_Text)(object)___headerText; loadingManager.buttons = GameObject.Find("LANOrOnline"); ((TMP_Text)___headerText).text = "실행 모드"; } } [HarmonyPatch(typeof(MenuManager))] internal class MenuManagerPatch { [HarmonyPostfix] [HarmonyPatch("DisplayMenuNotification")] private static void DisplayMenuNotification_Prefix(string notificationText, string buttonText, ref GameObject ___menuNotification, ref TextMeshProUGUI ___menuNotificationText, ref TextMeshProUGUI ___menuNotificationButtonText) { if (notificationText.Contains("Some of your save files may not be compatible")) { ((TMP_Text)___menuNotificationText).text = $"일부 저장 파일은 버전 {GameNetworkManager.Instance.compatibleFileCutoffVersion}과 호환되지 않을 수 있으며, 플레이할 경우 손상될 수 있습니다."; ((TMP_Text)___menuNotificationButtonText).text = "[ 닫기 ]"; ___menuNotification.SetActive(true); EventSystem.current.SetSelectedGameObject(((Component)___menuNotification.GetComponentInChildren