Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LCKP v1.0.1
BepInEx/plugins/TheGreatestMilk-LCKP/LCKP.dll
Decompiled 4 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("0.0.0.0")] namespace LCKP; [BepInIncompatibility("wesley.korean.scrapdisplay")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("thegreatestmilk.lckp", "LCKP", "1.0.1")] public sealed class ScrapDisplayPlugin : BaseUnityPlugin { internal sealed class TerminalLoreEntry { internal readonly string Title; internal readonly string Text; internal TerminalLoreEntry(string title, string text) { Title = title; Text = text; } } internal sealed class RenderFontSizeState { internal float[] Sizes; } private const float GeneralTextScale = 0.8f; internal static readonly Dictionary<string, string> HudNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); internal static Regex hudPattern; internal static readonly Dictionary<string, string> MoonDescriptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); internal static readonly Dictionary<string, string> MoonInfoDescriptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); internal static readonly Regex MoonNumber = new Regex("^\\s*[-–]?\\d+(?:[-–]\\d+)*(?:\\s*[-–]\\s*|\\s+)"); internal static ScrapDisplayPlugin instance; internal static readonly Dictionary<string, string> StoreNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Walkie-talkie", "무전기" }, { "Flashlight", "손전등" }, { "Shovel", "철제 삽" }, { "Lockpicker", "자물쇠 따개" }, { "Pro-flashlight", "프로 손전등" }, { "Stun grenade", "기절 수류탄" }, { "Boombox", "붐박스" }, { "TZP-Inhalant", "TZP 흡입제" }, { "Zap gun", "잽건" }, { "Jetpack", "제트팩" }, { "Extension ladder", "연장 사다리" }, { "Radar-booster", "레이더 부스터" }, { "Spray paint", "스프레이 페인트" }, { "Weed killer", "제초제" }, { "Belt bag", "벨트 가방" }, { "Cruiser", "크루저" }, { "Teleporter", "순간이동기" }, { "Inverse Teleporter", "역방향 순간이동기" }, { "Loud horn", "대형 경적" }, { "Signal translator", "신호 해석기" }, { "Disco Ball", "디스코 볼" }, { "Dog house", "개집" }, { "Record player", "레코드 플레이어" }, { "Sofa chair", "소파 의자" }, { "Cozy lights", "아늑한 조명" }, { "Romantic table", "낭만적인 테이블" }, { "Shower", "샤워기" }, { "Table", "테이블" }, { "Television", "텔레비전" }, { "Toilet", "변기" }, { "Jack-o'-lantern", "호박등" }, { "Welcome mat", "현관 매트" }, { "Goldfish", "금붕어" }, { "Plushie pajama man", "잠옷 인형" }, { "Mapper tool", "지도 작성기" }, { "Survival kit", "생존 키트" }, { "Bee suit", "벌 의상" }, { "Bunny suit", "토끼 의상" }, { "Bunkbeds", "이층 침대" }, { "Cupboard", "찬장" }, { "File cabinet", "파일 캐비닛" }, { "Classic painting", "고전 회화" }, { "Electric chair", "전기의자" }, { "Fridge", "냉장고" }, { "Green suit", "초록색 작업복" }, { "Orange suit", "주황색 작업복" }, { "Hazard suit", "방호복" }, { "Microwave", "전자레인지" }, { "Pajama suit", "잠옷" }, { "Purple suit", "보라색 작업복" } }; internal static readonly HashSet<string> MissingNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); internal static readonly Dictionary<string, string> Names = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); internal static readonly Regex ProductCommand = new Regex("^\\s*(?:(?<verb>buy|info|route|view)\\s+)?(?<name>.+?)(?:\\s+(?<amount>[0-9]+))?\\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); internal static readonly Regex ProductKey = new Regex("[^\\p{L}\\p{N}]"); internal static readonly Dictionary<string, string> StoreHeadings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "COMPANY STORE", "회사 상점" }, { "[ITEMS]", "[장비]" }, { "[VEHICLES]", "[차량]" }, { "[UNLOCKABLES]", "[함선 설비]" }, { "[DECORATIONS]", "[장식품]" }, { "[SUITS]", "[의상]" }, { "SUITS", "의상" } }; internal static readonly Dictionary<string, string> ScanLabels = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Light Switch", "조명 스위치" }, { "Terminal", "단말기" }, { "Brake lever", "브레이크 레버" }, { "Coil", "충전 코일" }, { "Training manual", "교육 지침서" }, { "Door control", "출입문 제어 장치" }, { "Quota", "할당량" }, { "Ship", "함선" }, { "Clear skies", "맑은 하늘" }, { "Main entrance", "정문" }, { "Key", "열쇠" }, { "Apparatice", "장치" } }; internal static readonly Regex StoreLine = new Regex("(?m)^(?<prefix>[ \\t]*(?:\\* )?(?:<[^>\\r\\n]+>[ \\t]*)*)(?<name>[^<\\r\\n]+?)(?=[ \\t]*(?:<[^>\\r\\n]+>[ \\t]*)*(?:\\(?-?\\d+%|\\$\\d|\\r?$))"); internal static readonly Regex VanillaStoreRow = new Regex("(?m)^(?<prefix>[ \\t]*(?:\\* )?)(?<name>[^\\r\\n]+?)[ \\t]+//[ \\t]+Price:[ \\t]*(?<price>\\$[\\d,.]+)(?<discount>[ \\t]*\\(\\d+% OFF!\\))?[ \\t]*(?=\\r?$)"); internal static readonly Regex VanillaStoreDiscount = new Regex("(\\(\\d+)% OFF!\\)"); internal static readonly Dictionary<string, string> StoreProductKeys = CreateStoreProductKeys(); internal static readonly Dictionary<string, string> CustomSuitNames = new Dictionary<string, string>(ReadTerminalTable("SuitNames.tsv"), StringComparer.OrdinalIgnoreCase); internal static readonly Dictionary<string, string> TerminalResponses = new Dictionary<string, string> { { "Welcome to the FORTUNE-9 OS", "FORTUNE-9 OS에 오신 것을 환영합니다." }, { "Courtesy of the Company", "회사 제공" }, { "Type \"Help\" for a list of commands.", "명령어 목록을 보려면 HELP를 입력하세요." }, { "To see the list of moons the autopilot can route to.", "항로를 설정할 수 있는 행성 목록을 표시합니다." }, { "To see the company store's selection of useful items.", "회사 상점에서 판매하는 상품을 표시합니다." }, { "To see the list of wildlife on record.", "기록된 생물 목록을 표시합니다." }, { "To access objects placed into storage.", "보관함에 넣은 물품을 확인합니다." }, { "To see the list of other commands", "기타 명령어 목록을 표시합니다." }, { "Other commands:", "기타 명령어:" }, { ">SWITCH [Player name]", ">SWITCH [플레이어 이름]" }, { ">PING [Radar booster name]", ">PING [레이더 부스터 이름]" }, { ">TRANSMIT [message]", ">TRANSMIT [메시지]" }, { "To toggle on AND off the main monitor's map cam", "메인 모니터의 지도 카메라를 켜거나 끕니다." }, { "To switch view to a player on the main monitor", "메인 모니터에서 지정한 플레이어의 화면으로 전환합니다." }, { "To make a radar booster play a noise.", "지정한 레이더 부스터에서 소리를 냅니다." }, { "To transmit a message with the signal translator", "신호 해석기로 메시지를 전송합니다." }, { "To scan for the number of items left on the current planet.", "현재 행성에 남아 있는 물품 수를 확인합니다." }, { "Welcome to the exomoons catalogue.", "행성 목록입니다." }, { "To route the autopilot to a moon, use the word ROUTE.", "항로를 설정하려면 ROUTE와 행성 이름을 입력하세요." }, { "To learn about any moon, use INFO.", "행성 정보를 보려면 INFO와 행성 이름을 입력하세요." }, { "Unable to route the ship currently. It must be in orbit around a moon to route the autopilot.", "지금은 항로를 설정할 수 없습니다. 함선이 행성 궤도에 있어야 합니다." }, { "Use the main lever at the front desk to enter orbit.", "전방 조종석의 레버를 당겨 궤도로 올라가세요." }, { "The autopilot ship is already orbiting this moon!", "이미 이 행성의 궤도를 돌고 있습니다!" }, { "You can't route to another moon during the challenge.", "도전 중에는 다른 행성으로 이동할 수 없습니다." }, { "Do you want to route the autopilot to 회사 건물?", "회사 건물로 항로를 설정하시겠습니까?" }, { "Do you want to route the autopilot to the Company building?", "The Company building(으)로 항로를 설정하시겠습니까?" }, { "Do you want to eject all crew members, including yourself? You must be in orbit around a moon.", "본인을 포함한 모든 승무원을 방출하시겠습니까? 함선이 행성 궤도에 있어야 합니다." }, { "Please CONFIRM or DENY.", "CONFIRM 또는 DENY를 입력하세요." }, { "Please enjoy your flight.", "편안한 비행 되십시오." }, { "Good luck.", "행운을 빕니다." }, { "This item is not in stock!", "이 상품은 현재 재고가 없습니다!" }, { "There was no action supplied with the word.", "실행할 명령어가 입력되지 않았습니다." }, { "There was no object supplied with the action, or your word was typed incorrectly or does not exist.", "명령 대상이 없거나 입력한 이름을 찾을 수 없습니다." }, { "You cannot purchase items until it arrives.", "배송이 완료된 뒤에 상품을 구매할 수 있습니다." }, { "Our contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.", "근무 중에는 빠른 무료 배송이 제공됩니다! 구매한 물품은 매시간 현재 위치 부근으로 배송됩니다." }, { "SHIP UPGRADES:", "함선 설비:" }, { "The selection of ship decor rotates per-quota. Be sure to check back next week:", "할당량 갱신 때마다 판매 장식품이 바뀝니다. 다음 주에 다시 확인하세요." } }; internal static readonly Dictionary<string, string> StatusText = new Dictionary<string, string>(StringComparer.Ordinal) { { "AVERAGE SCRAP:", "일평균 스크랩:" }, { "COMPANY RATE:", "회사 매입률:" }, { "LANDED ON", "착륙 중" }, { "ORBITING", "궤도 비행 중" }, { "SHIP SCRAP:", "함선 스크랩:" }, { "${0}\n({1} ITEMS)", "${0}\n({1}개)" }, { "{0} ITEMS\n{1}", "{0}개\n{1}" }, { "(PENDING)", "(대기 중)" }, { "SCRAP LEFT:", "남은 스크랩:" }, { "NO EXTERNAL SCRAP DETECTED", "함선 밖\n스크랩 없음" }, { "OVERTIME ESTIMATE:", "예상 초과 달성 보너스:" }, { "SOLD SCRAP:", "판매한 스크랩:" }, { "DAY'S PROFIT:\n${0}", "오늘 수익:\n${0}" }, { "TIME:", "시간:" }, { "TIME:\n(PENDING)", "시간:\n(대기 중)" }, { "WEATHER:", "날씨:" }, { "{0}% OFF {1}", "{1} {0}% 할인" }, { "NO SALES TODAY", "오늘 할인 없음" }, { "{0} SALE{1}:\n{2}", "할인 상품 {0}개:\n{2}" }, { "CREDITS:", "크레딧:" }, { "DOOR POWER:", "출입문 전력:" }, { "DAY {0}", "{0}일차" }, { "QUOTA {0}", "할당량 {0}회차" }, { "TOTAL DEATHS:", "누적 사망:" }, { "{0} DAY{1} WITHOUT DEATHS", "무사망 {0}일" }, { "ZERO DEATHS (YET)", "현재까지 사망 없음" }, { "SAFE", "안전" }, { "WARNING", "주의" }, { "HAZARDOUS", "위험" }, { "DANGEROUS", "매우 위험" }, { "LETHAL", "치명적" }, { "DANGER LEVEL:", "위험도:" }, { "PLAYER HEALTH:", "팀원 체력:" }, { "\n\n{0}PAGE {1} OF {2}", "\n\n{0}{1}/{2} 페이지" }, { "PLAYERS ALIVE:", "생존자:" }, { "{0} Day Left", "{0}일 남음" }, { "{0} Days Left", "{0}일 남음" }, { "{0} lb", "{0} 파운드" }, { "Ship leaving in one hour", "1시간 후 함선 이륙" }, { "({0}/{1} Votes)", "(투표 {0}/{1})" }, { "(Spectating: ", "(관전: " }, { "Overtime bonus: ${0}", "초과 달성 보너스: ${0}" }, { "WARNING! Please return by ", "경고! 다음 시각까지 복귀하세요: " }, { ". A vote has been cast, and the autopilot ship will leave early.", ". 투표 결과에 따라 함선이 자동으로 조기 이륙합니다." }, { "ALERT! The ship has reached full carrying capacity and cannot leave until items are removed!", "경고! 함선이 가득 찼습니다. 물건을 내려야 이륙할 수 있습니다." }, { "Tell autopilot ship to leave early : [R-trigger] (Hold)", "조기 이륙 투표: [R-trigger] 길게 누르기" }, { "TIP!: Hold [R-Trigger] to vote for the autopilot ship to leave early.", "팁! [R-Trigger]을 길게 눌러 조기 이륙에 투표하세요." }, { "Tell autopilot ship to leave early : [RMB] (Hold)", "조기 이륙 투표: [RMB] 길게 누르기" }, { "TIP!: Hold [RMB] to vote for the autopilot ship to leave early.", "팁! [RMB]을 길게 눌러 조기 이륙에 투표하세요." } }; internal static readonly Dictionary<string, string> WeatherNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Earthquakes", "지진" }, { "None", "맑음" }, { "Clear", "맑음" }, { "DustClouds", "먼지 구름" }, { "Dust Clouds", "먼지 구름" }, { "Foggy", "안개" }, { "Rainy", "비" }, { "Flooded", "침수" }, { "Stormy", "폭풍" }, { "Eclipsed", "일식" }, { "Hurricane", "허리케인" }, { "Forsaken", "버려짐" }, { "Hallowed", "성화" }, { "Minefield", "지뢰밭" } }; internal static readonly Regex MonitorMoonHeading = new Regex("\\A(?<heading>[ \\t]*(?:Orbiting|Landed on|궤도 비행 중|착륙 중):[ \\t]*(?:\\r?\\n[ \\t]*)?)(?<name>[^\\r\\n]+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); internal static readonly Dictionary<string, string> LandingRiskNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Safe", "안전" }, { "I see you", "네가 보인다" }, { "QUACK", "꽥" }, { "B.. for Bees", "B… 벌의 B" } }; internal static readonly Dictionary<string, string> ReportLabels = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Performance Report", "성과 보고서" }, { "Notes", "특이 사항" }, { "Notes:", "특이 사항:" }, { "Deceased", "사망자" }, { "Missing", "실종자" }, { "Collected:", "회수량:" }, { "Grade:", "등급:" }, { "Scrap Lost", "잃어버린 스크랩" }, { "All Dead", "전원 사망" } }; internal static ConfigEntry<bool> translateMoonNames; internal static ConfigEntry<bool> translateTerminalCommands; internal static Dictionary<string, string> terminalMoonNames; internal static Dictionary<string, string> terminalPhrases; internal static Dictionary<string, string> terminalPages; internal static Regex moonDisplayPattern; internal static readonly Dictionary<string, string> TerminalCommands = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "help", "도움말" }, { "moons", "위성" }, { "store", "상점" }, { "bestiary", "생물도감" }, { "storage", "보관함" }, { "other", "기타" }, { "sigurd", "시거드" }, { "view monitor", "모니터 보기" }, { "view", "보기" }, { "scan", "스캔" }, { "switch", "전환" }, { "ping", "핑" }, { "flash", "섬광" }, { "transmit", "전송" }, { "route", "항로" }, { "info", "정보" }, { "buy", "구매" }, { "confirm", "확인" }, { "deny", "취소" }, { "eject", "방출" }, { "preview", "미리보기" }, { "sort", "정렬" }, { "filter", "필터" } }; internal static readonly Regex CommandLabels = new Regex("(?<![A-Za-z0-9])(?:VIEW MONITOR|HELP|MOONS|STORE|BESTIARY|STORAGE|OTHER|SIGURD|VIEW|SCAN|SWITCH|PING|FLASH|TRANSMIT|ROUTE|INFO|BUY|CONFIRM|DENY|EJECT|PREVIEW|SORT|FILTER)(?![A-Za-z0-9])"); internal static readonly Regex CommandInQuotes = new Regex("\"(?<command>transmit|switch|ping|flash|view|info|help|confirm|deny)\"", RegexOptions.IgnoreCase); internal static readonly Regex MoonPage = new Regex("exomoons catalogue|MOONS CATALOGUE|The cost to route to |Routing autopilot to |CONFIRM ROUTE|currently headed to:|Route to .+ is currently locked\\.|Do you want to route the autopilot|^\\s*PLANET:", RegexOptions.IgnoreCase | RegexOptions.Multiline); internal static readonly Regex MoonWeather = new Regex("(?<=\\()(?:mild weather|none|clear|rainy|stormy|foggy|flooded|eclipsed|dust ?clouds|locked)(?=\\))|(?<=currently )(?:mild weather|none|clear|rainy|stormy|foggy|flooded|eclipsed|dust ?clouds)(?= on this moon)|(?<=WEATHER:[ \\t]{1,32})(?:mild weather|none|clear|rainy|stormy|foggy|flooded|eclipsed|dust ?clouds)\\b", RegexOptions.IgnoreCase); internal static readonly Dictionary<string, string> WeatherLabels = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "mild weather", "맑음" }, { "none", "맑음" }, { "clear", "맑음" }, { "rainy", "비" }, { "stormy", "폭풍" }, { "foggy", "안개" }, { "flooded", "침수" }, { "eclipsed", "일식" }, { "dust clouds", "먼지 구름" }, { "dustclouds", "먼지 구름" }, { "locked", "잠김" }, { "earthquake", "지진" }, { "earthquakes", "지진" }, { "minefield", "지뢰밭" }, { "hurricane", "허리케인" } }; internal static readonly Dictionary<string, string> TerminalUtilsOptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "name", "이름" }, { "namenumbered", "번호와 이름" }, { "price", "가격" }, { "weather", "날씨" }, { "difficulty", "난이도" }, { "constellation", "별자리" }, { "none", "없음" }, { "lunar", "루나" } }; internal static readonly Dictionary<string, TerminalLoreEntry> LoreByAsset = new Dictionary<string, TerminalLoreEntry>(StringComparer.OrdinalIgnoreCase); internal static readonly Dictionary<string, TerminalLoreEntry> LoreByEnglishTitle = new Dictionary<string, TerminalLoreEntry>(StringComparer.OrdinalIgnoreCase); internal static readonly ConditionalWeakTable<TerminalNode, TerminalLoreEntry> RegisteredLore = new ConditionalWeakTable<TerminalNode, TerminalLoreEntry>(); internal static readonly Regex LoreListLine = new Regex("^(?<lead>[ \\t]*(?:\\*[ \\t]+|scanID #[ \\t]*\\d+:[ \\t]*)?)(?<title>[^;\\r\\n]+?)(?<tail>(?:[ \\t]+\\((?:NEW|새 기록)\\))?(?:;[^\\r\\n]*)?[ \\t]*)(?=\\r?$)", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant); internal static readonly Dictionary<string, string> WesleyStoryLogTitles = new Dictionary<string, string>(); internal static readonly Dictionary<string, string> VanillaMenuLabels = new Dictionary<string, string>(ReadTerminalTable("VanillaMenuText.tsv"), StringComparer.OrdinalIgnoreCase); internal static readonly Regex MenuDecoratedLabel = new Regex("\\A(?<lead>>[ \\t]*|\\[[ \\t]*)(?<label>[^]\\r\\n]+?)(?<tail>[ \\t]*\\]?)\\z"); internal static readonly Regex MenuVersionMismatch = new Regex("\\AThe server host is playing on version (.+?) while you are on version (.+?)\\.\\z"); internal static readonly Regex MenuPlayerCount = new Regex("\\APlayers:[ \\t]*(\\d+[ \\t]*/[ \\t]*\\d+)\\z"); internal static readonly Regex MenuCollectedScore = new Regex("\\A(\\$[\\d,.]+) Collected\\z"); internal static readonly Regex MenuDeleteFile = new Regex("\\ADo you want to delete File (\\d+)\\?\\z"); internal static readonly HashSet<string> VanillaSettingsDropdowns = new HashSet<string>(StringComparer.Ordinal) { "FullscreenMode", "FramerateCap", "TerrainDetail", "MotionBlur", "PixelRes" }; internal static readonly Dictionary<string, string> VanillaGameplayLabels = new Dictionary<string, string>(ReadTerminalTable("VanillaGameplayText.tsv"), StringComparer.OrdinalIgnoreCase); internal static readonly Dictionary<string, string> DeathReasons = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Unknown", "불명" }, { "Bludgeoning", "둔기 타격" }, { "Gravity", "추락" }, { "Blast", "폭발" }, { "Strangulation", "목 졸림" }, { "Suffocation", "질식" }, { "Mauling", "생물의 공격" }, { "Gunshots", "총상" }, { "Crushing", "압사" }, { "Drowning", "익사" }, { "Abandoned", "버려짐" }, { "Electrocution", "감전" }, { "Kicking", "발길질" }, { "Burning", "화상" }, { "Stabbing", "자상" }, { "Fan", "환풍기" }, { "Inertia", "충돌" }, { "Snipping", "절단" }, { "Scratching", "할퀴임" } }; internal static readonly Dictionary<string, string> GameplayRankNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Intern", "인턴" }, { "Part-timer", "시간제 직원" }, { "Employee", "직원" }, { "Leader", "팀장" }, { "Boss", "관리자" } }; internal static readonly Regex NewJournalNotice = new Regex("\\AFound journal entry: '(.+)'\\z"); internal static readonly Regex GameplayReportLine = new Regex("(?m)^(?<lead>[ \\t]*(?:\\*[ \\t]+)?)(?<body>[^\\r\\n]+)"); internal static readonly Regex FeverStatus = new Regex("\\AHIGH FEVER DETECTED!\\nREACHING (.+?)°F\\z"); internal static readonly Regex FilterStatus = new Regex("\\AHEALTH RISK!\\nAir filter overwhelmed by particulates;\\n\\nFilter quality: (\\d+)%\\z"); internal static readonly Regex WesleyFilterBlockage = new Regex("\\AHEALTH RISK!\\n\\nForeign matter in the air filter\\n\\nFilter blockage: (\\d+)%\\z"); internal static readonly Regex WesleyItemUses = new Regex("\\A(\\d+) uses left\\z"); internal static readonly Regex DisplayedSeed = new Regex("\\ARandom seed: (-?\\d+)\\z"); internal static readonly FieldInfo[] RenderFontSizeFields = new FieldInfo[4] { AccessTools.Field(typeof(TMP_Text), "m_fontSize"), AccessTools.Field(typeof(TMP_Text), "m_fontSizeBase"), AccessTools.Field(typeof(TMP_Text), "m_fontSizeMin"), AccessTools.Field(typeof(TMP_Text), "m_fontSizeMax") }; internal static readonly HashSet<TMP_Text> ReducedFontRenders = new HashSet<TMP_Text>(); internal static readonly Regex FormatterStoreCell = new Regex("^(?<prefix>(?:\\* )?(?:<[^>]+>[ \\t]*)*)(?<name>.*?)(?<discount>[ \\t]+(?:<[^>]+>[ \\t]*)*\\(?-\\d+%.*)?$"); internal static readonly Regex FormatterTags = new Regex("<[^>\\r\\n]+>"); internal static readonly Regex FormatterDivider = new Regex("^[-─═]+$"); internal static string TranslateHud(string value) { if (string.IsNullOrEmpty(value)) { return value; } return hudPattern.Replace(value, (Match match) => HudNames[match.Value]); } internal static void TranslateCursor(PlayerControllerB __instance) { if ((Object)(object)__instance.cursorTip != (Object)null) { string text = ((TMP_Text)__instance.cursorTip).text; if (LocalizationApi.Cursor != null) { text = LocalizationApi.Cursor(__instance.hoveringOverTrigger, text); } ((TMP_Text)__instance.cursorTip).text = TranslateHud(TranslateSuitCursor(text)); } } internal static void TranslateControls(HUDManager __instance) { TextMeshProUGUI[] controlTipLines = __instance.controlTipLines; foreach (TextMeshProUGUI val in controlTipLines) { if ((Object)(object)val != (Object)null) { ((TMP_Text)val).text = TranslateHud(TranslateVanillaGameplayText(((TMP_Text)val).text)); } } } internal static void TranslateScanTotal(HUDManager __instance) { if ((Object)(object)__instance.totalValueText != (Object)null) { ((TMP_Text)__instance.totalValueText).text = TranslateHud(((TMP_Text)__instance.totalValueText).text); } } private void Patch(Harmony harmony, MethodInfo target, string transpiler) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (target == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Display method not found for " + transpiler)); return; } try { harmony.Patch((MethodBase)target, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), transpiler, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not patch " + target.Name + ": " + ex)); } } internal static void CheckRegisteredScrap(StartOfRound __instance) { ((MonoBehaviour)instance).StartCoroutine(instance.ReportRegisteredScrap(__instance)); } private IEnumerator ReportRegisteredScrap(StartOfRound round) { yield return (object)new WaitForSecondsRealtime(10f); if ((Object)(object)round == (Object)null || (Object)(object)round.allItemsList == (Object)null) { yield break; } foreach (Item items in round.allItemsList.itemsList) { if (!((Object)(object)items == (Object)null)) { TranslatedName(items); } } GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(true); foreach (GrabbableObject obj in array) { if (LocalizationApi.ItemSpawned != null) { LocalizationApi.ItemSpawned(obj); } } } internal static string TranslatedName(Item item) { if ((Object)(object)item == (Object)null || string.IsNullOrWhiteSpace(item.itemName)) { return null; } if (item.itemName == "Key") { return "열쇠"; } if (Names.TryGetValue(item.itemName, out var value) || StoreNames.TryGetValue(item.itemName, out value)) { return value; } if (MissingNames.Add(item.itemName)) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)("Untranslated item: " + item.itemName)); } return null; } internal static string ItemName(Item item) { if ((Object)(object)item != (Object)null && item.itemName == "Key") { return "열쇠"; } object obj = TranslatedName(item); if (obj == null) { if (!((Object)(object)item == (Object)null)) { return item.itemName; } obj = null; } return (string)obj; } internal static string ScanName(ScanNodeProperties node) { string text = ((LocalizationApi.ScanNodeText == null) ? null : LocalizationApi.ScanNodeText(node, arg2: true)); if (text != null) { return text; } GrabbableObject componentInParent = ((Component)node).GetComponentInParent<GrabbableObject>(); Item item = (((Object)(object)componentInParent == (Object)null) ? null : componentInParent.itemProperties); string value = TranslatedName(item); if (value != null) { return value; } if (StoreNames.TryGetValue(node.headerText ?? "", out value)) { return value; } if (ScanLabels.TryGetValue(node.headerText ?? "", out value) || LocalizationApi.ExtraScanNames.TryGetValue(node.headerText ?? "", out value)) { return value; } if (node.nodeType == 2 && Names.TryGetValue(node.headerText ?? "", out value)) { return value; } if (node.nodeType != 1) { return node.headerText; } return TranslateScanEntityName(node.headerText); } internal static IEnumerable<CodeInstruction> TerminalTextTranspiler(IEnumerable<CodeInstruction> instructions) { MethodInfo postProcess = AccessTools.Method(typeof(Terminal), "TextPostProcess", new Type[2] { typeof(string), typeof(TerminalNode) }, (Type[])null); FieldInfo displayText = AccessTools.Field(typeof(TerminalNode), "displayText"); MethodInfo readLoreText = AccessTools.Method(typeof(ScrapDisplayPlugin), "GetTerminalLoreText", (Type[])null, (Type[])null); foreach (CodeInstruction instruction in instructions) { if (instruction.opcode == OpCodes.Ldfld && object.Equals(instruction.operand, displayText)) { instruction.opcode = OpCodes.Call; instruction.operand = readLoreText; } yield return instruction; if ((instruction.opcode == OpCodes.Call || instruction.opcode == OpCodes.Callvirt) && object.Equals(instruction.operand, postProcess)) { yield return new CodeInstruction(OpCodes.Ldarg_1, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ScrapDisplayPlugin), "TranslateTerminalText", (Type[])null, (Type[])null)); } } } internal static IEnumerable<CodeInstruction> TerminalInputTranspiler(IEnumerable<CodeInstruction> instructions) { MethodInfo removePunctuation = AccessTools.Method(typeof(Terminal), "RemovePunctuation", new Type[1] { typeof(string) }, (Type[])null); foreach (CodeInstruction instruction in instructions) { if ((instruction.opcode == OpCodes.Call || instruction.opcode == OpCodes.Callvirt) && object.Equals(instruction.operand, removePunctuation)) { CodeInstruction loadTerminal = new CodeInstruction(OpCodes.Ldarg_0, (object)null); loadTerminal.labels.AddRange(instruction.labels); instruction.labels.Clear(); yield return loadTerminal; yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ScrapDisplayPlugin), "TranslateTerminalInput", (Type[])null, (Type[])null)); } yield return instruction; } } internal static Dictionary<string, string> CreateStoreProductKeys() { Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); foreach (KeyValuePair<string, string> storeName in StoreNames) { dictionary[ProductKey.Replace(storeName.Key, "")] = storeName.Value; } Dictionary<string, string> dictionary2 = new Dictionary<string, string>(); dictionary2.Add("pro", "Pro-flashlight"); dictionary2.Add("tzp", "TZP-Inhalant"); dictionary2.Add("boost", "Radar-booster"); dictionary2.Add("mapper", "Mapper tool"); dictionary2.Add("lockpick", "Lockpicker"); dictionary2.Add("tacticalbeltbag", "Belt bag"); dictionary2.Add("companycruiser", "Cruiser"); dictionary2.Add("spraypaintcan", "Spray paint"); dictionary2.Add("weedkillerspraybottle", "Weed killer"); dictionary2.Add("jackolantern", "Jack-o'-lantern"); dictionary2.Add("cam", "Polaroid"); dictionary2.Add("bee", "Bee suit"); dictionary2.Add("bunny", "Bunny suit"); foreach (KeyValuePair<string, string> item in dictionary2) { if (StoreNames.ContainsKey(item.Value)) { dictionary[item.Key] = StoreNames[item.Value]; } } return dictionary; } internal static string TranslateSuitCursor(string tip) { if (string.IsNullOrEmpty(tip) || !tip.StartsWith("Change: ", StringComparison.OrdinalIgnoreCase)) { return tip; } string text = tip.Substring("Change: ".Length); Match match = Regex.Match(text, "[ \\t]*(?::[ \\t]*)?\\[[^\\]\\r\\n]+\\][ \\t]*\\z"); string text2 = (match.Success ? text.Substring(0, match.Index) : text); return "의상 교체: " + TranslateProductLabel(text2.Trim()) + match.Value; } internal static string TranslateProductLabel(string label) { string text = ProductKey.Replace(Regex.Replace(label.Trim(), "^(?:an?|the)\\s+|\\s+ship upgrade$|, which comes with .*$", "", RegexOptions.IgnoreCase), ""); if (StoreProductKeys.TryGetValue(text, out var value) || (text.EndsWith("s", StringComparison.OrdinalIgnoreCase) && StoreProductKeys.TryGetValue(text.Substring(0, text.Length - 1), out value))) { return value; } string key = Regex.Replace(text, "suits?$", "", RegexOptions.IgnoreCase); if (!CustomSuitNames.TryGetValue(key, out value)) { return label; } return value; } internal static string TranslateTerminalResponses(string text) { text = Regex.Replace(text, "(?m)^([ \\t]*)The cost to route to (.+?) is ([^\\r\\n.]+)\\. It is\\s+currently (.+?) on this moon\\.", (Match match) => match.Groups[1].Value + match.Groups[2].Value + " 항로 설정 비용: " + match.Groups[3].Value + ". 현지 날씨: " + match.Groups[4].Value + "."); text = Regex.Replace(text, "(?m)^([ \\t]*)Routing autopilot to (.+?)\\.", (Match match) => match.Groups[1].Value + ((translateMoonNames.Value && match.Groups[2].Value == "the Company building") ? "회사 건물" : match.Groups[2].Value) + "(으)로 항로를 설정합니다."); text = Regex.Replace(text, "(?m)^([ \\t]*)You have requested to order (.+?)(?:\\.|:)(?=\\s|$)", (Match match) => match.Groups[1].Value + "주문 요청: " + TranslateProductLabel(match.Groups[2].Value) + ((match.Groups[2].Value.IndexOf("which comes with a complementary glass bowl", StringComparison.Ordinal) >= 0) ? " (유리 어항 포함)" : "")); text = Regex.Replace(text, "(?m)^([ \\t]*)Ordered (?:(\\d+) )?(.+?)[.!](?=\\s|$)", (Match match) => match.Groups[1].Value + "주문 완료: " + TranslateProductLabel(match.Groups[3].Value) + (match.Groups[2].Success ? (" " + match.Groups[2].Value + "개") : "")); text = Regex.Replace(text, "(?m)^([ \\t]*\\*\\s+)(.+?)(\\s+x\\d+[ \\t]*)$", (Match match) => match.Groups[1].Value + TranslateProductLabel(match.Groups[2].Value) + match.Groups[3].Value); text = Regex.Replace(text, "\\b(\\d+) purchased items on route\\.", "배송 중인 상품: $1개"); text = Regex.Replace(text, "The Company is buying at ([^\\r\\n.]+)\\.", "현재 회사 매입률: $1"); text = text.Replace("Your new balance is ", "남은 크레딧: ").Replace("Total cost of items:", "총 주문 금액:").Replace("Total cost of item:", "총 주문 금액:") .Replace("Amount:", "수량:"); foreach (KeyValuePair<string, string> terminalResponse in TerminalResponses) { text = text.Replace(terminalResponse.Key, terminalResponse.Value); } return text; } internal static string TranslateVanillaStore(string text) { if (string.IsNullOrEmpty(text) || (!Regex.IsMatch(text, "Welcome to the Company store\\.|COMPANY STORE", RegexOptions.IgnoreCase) && !VanillaStoreRow.IsMatch(text))) { return text; } text = VanillaStoreRow.Replace(text, delegate(Match match) { string value = match.Groups["name"].Value; if (!StoreNames.TryGetValue(value, out var value2) && !Names.TryGetValue(value, out value2)) { value2 = TranslateProductLabel(value); } StringBuilder stringBuilder = new StringBuilder(); AppendTerminalCell(stringBuilder, match.Groups["prefix"].Value.TrimStart(new char[0]) + value2, 2, 57); AppendTerminalCell(stringBuilder, "가격: " + match.Groups["price"].Value, 57, 78); if (match.Groups["discount"].Success) { AppendTerminalCell(stringBuilder, VanillaStoreDiscount.Replace(match.Groups["discount"].Value.Trim(), "$1% 할인!)"), 78, 100); } return stringBuilder.ToString(); }); text = VanillaStoreDiscount.Replace(text, "$1% 할인!)").Replace("Welcome to the Company store.", "회사 상점에 오신 것을 환영합니다.").Replace("Use words BUY and INFO on any item.", "구매는 BUY, 상품 정보는 INFO와 함께 상품명을 입력하세요. 한글 상품명도 사용할 수 있습니다.") .Replace("Order items in bulk by typing a number.", "여러 개를 주문하려면 수량을 입력하세요.") .Replace("Order tools in bulk by typing a number.", "여러 개를 주문하려면 수량을 입력하세요.") .Replace("[No items in stock!]", "[재고 없음!]") .Replace("[No items available]", "[구매 가능한 상품 없음]"); TranslateStore(ref text); return text; } internal static void TranslateStore(ref string __result) { if (!string.IsNullOrEmpty(__result)) { __result = StoreLine.Replace(__result, delegate(Match match) { string value = match.Groups["name"].Value; string key = value.TrimEnd(new char[0]); string value2; return (!StoreHeadings.TryGetValue(key, out value2) && !StoreNames.TryGetValue(key, out value2) && !Names.TryGetValue(key, out value2)) ? match.Value : (match.Groups["prefix"].Value + value2.PadRight(value.Length)); }); } } internal static IEnumerable<CodeInstruction> ScanTranspiler(IEnumerable<CodeInstruction> instructions) { return ReplaceRead(ReplaceRead(instructions, AccessTools.Field(typeof(ScanNodeProperties), "headerText"), "ScanName"), AccessTools.Field(typeof(ScanNodeProperties), "subText"), "ScanDescription"); } internal static IEnumerable<CodeInstruction> StatusTextTranspiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { string original = instruction.operand as string; if (instruction.opcode == OpCodes.Ldstr && original != null) { string text = original.Replace("\\n", "\n"); string text2 = text.TrimEnd('\n'); if (StatusText.TryGetValue(text, out var translated) || (text2 != text && StatusText.TryGetValue(text2, out translated))) { if (!StatusText.ContainsKey(text)) { translated += text.Substring(text2.Length); } instruction.operand = (original.Contains("\\n") ? translated.Replace("\n", "\\n") : translated); } } yield return instruction; } } internal static string TranslateWeatherLine(string text) { if (string.IsNullOrEmpty(text)) { return text; } return Regex.Replace(text, "(?im)^(?<label>WEATHER:|날씨:)(?<space>[ \\t]*(?:\\\\n|\\r?\\n)?[ \\t]*)(?<open><color=[^>]+>)?(?<name>[A-Za-z ]+?)(?=[ \\t]*(?:</color>)?(?:\\r?$|\\\\n))", delegate(Match match) { if (!WeatherNames.TryGetValue(match.Groups["name"].Value, out var value)) { value = match.Groups["name"].Value; } return "날씨:" + match.Groups["space"].Value + match.Groups["open"].Value + value; }); } internal static string TranslateMonitorMoonName(string text, string planetName) { return MonitorMoonHeading.Replace(text, (Match match) => match.Groups["heading"].Value + BilingualMoonName(match.Groups["name"].Value, planetName), 1); } internal static string BilingualMoonName(string displayedName, string planetName) { if (!translateMoonNames.Value) { return displayedName; } string moonName = GetMoonName(planetName); if (moonName.Length == 0 || !string.Equals(GetMoonName(displayedName), moonName, StringComparison.OrdinalIgnoreCase)) { return displayedName; } string text = MoonNounLabel(moonName); if (text == moonName) { return displayedName; } Match match = MoonNumber.Match(planetName); string text2 = (string.Equals(moonName, "ResearcherxB", StringComparison.OrdinalIgnoreCase) ? "ResearcherxB" : planetName.Substring(match.Length).Trim()); return match.Value + text + " (" + text2 + ")"; } internal static IEnumerable<CodeInstruction> MoonDescriptionTranspiler(IEnumerable<CodeInstruction> instructions) { return ReplaceRead(instructions, AccessTools.Field(typeof(SelectableLevel), "LevelDescription"), "GetMoonDescription"); } internal static string GetMoonDescription(SelectableLevel level) { if (!MoonDescriptions.TryGetValue(GetMoonName(level.PlanetName), out var value)) { return level.LevelDescription; } return value; } internal static string GetMoonName(string planetName) { string text = MoonNumber.Replace(planetName ?? "", "").Trim(); if (string.Equals(text, "Researcher_6_x1753B", StringComparison.OrdinalIgnoreCase)) { return "ResearcherxB"; } return text; } internal static string TranslateMoonInfo(string text, SelectableLevel level) { if (MoonInfoDescriptions.TryGetValue(GetMoonName(level.PlanetName), out var value)) { Match match = Regex.Match(text, "\\A\\s*[^\\r\\n]+\\r?\\n-{5,}[^\\S\\r\\n]*\\r?\\n"); if (match.Success) { return match.Value + "\n" + value + "\n\n"; } } return ReplaceMoonDescription(text, level.LevelDescription, GetMoonDescription(level)); } internal static string ReplaceMoonDescription(string text, string original, string translated) { if (string.IsNullOrWhiteSpace(original) || original == translated) { return text; } string[] array = Regex.Split(original.Trim(), "\\s+"); string pattern = string.Join("\\s+", Array.ConvertAll(array, Regex.Escape)); return new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).Replace(text, (Match match) => translated, 1); } internal static void TranslateMapScreen(StartOfRound __instance) { TMP_Text screenLevelDescription = (TMP_Text)(object)__instance.screenLevelDescription; if ((Object)(object)screenLevelDescription == (Object)null || string.IsNullOrEmpty(screenLevelDescription.text)) { return; } string text = screenLevelDescription.text; SelectableLevel currentLevel = __instance.currentLevel; if ((Object)(object)currentLevel != (Object)null) { text = TranslateMonitorMoonName(text, currentLevel.PlanetName); if (MoonDescriptions.TryGetValue(GetMoonName(currentLevel.PlanetName), out var description)) { string text2 = ReplaceMoonDescription(text, currentLevel.LevelDescription, description); if (text2 == text && !text.Contains(description) && Regex.IsMatch(text, "(?i)^\\s*(?:Orbiting|궤도 비행 중):")) { text2 = Regex.Replace(text, "(?ims)^(?:POPULATION|인구):[^\\r\\n]*\\r?\\n(?=\\s*(?:CONDITIONS|환경):).*?(?=^\\s*(?:WEATHER|날씨):|\\z)", (Match match) => description + "\n"); } text = text2; } } screenLevelDescription.text = TranslateWeatherLine(text).Replace("Orbiting:", "궤도 비행 중:").Replace("ORBITING:", "궤도 비행 중:").Replace("POPULATION:", "인구:") .Replace("CONDITIONS:", "환경:") .Replace("FAUNA:", "동물상:") .Replace("인구: Abandoned", "인구: 버려짐") .Replace("Arid. Thick haze, worsened by industrial artifacts.", "건조함. 산업 시설의 잔해로 짙은 연무가 더 심해졌습니다.") .Replace("Dominated by a few species.", "소수 종이 우세합니다."); } internal static void TranslateLandingInfo() { HUDManager val = HUDManager.Instance; if ((Object)(object)val == (Object)null || (Object)(object)val.planetInfoHeaderText == (Object)null || (Object)(object)val.planetInfoSummaryText == (Object)null || !((TMP_Text)val.planetInfoHeaderText).text.StartsWith("CELESTIAL BODY: ", StringComparison.Ordinal)) { return; } StartOfRound val2 = StartOfRound.Instance; SelectableLevel val3 = (((Object)(object)val2 == (Object)null) ? null : val2.currentLevel); if (!((Object)(object)val3 == (Object)null)) { string moonName = GetMoonName(val3.PlanetName); string text = (string.Equals(moonName, "ResearcherxB", StringComparison.OrdinalIgnoreCase) ? "" : "행성: "); ((TMP_Text)val.planetInfoHeaderText).text = text + BilingualMoonName(((TMP_Text)val.planetInfoHeaderText).text.Substring("CELESTIAL BODY: ".Length), val3.PlanetName); if (LocalizationApi.Landing != null) { LocalizationApi.Landing(val, moonName); } string text2 = ReplaceMoonDescription(((TMP_Text)val.planetInfoSummaryText).text, val3.LevelDescription, GetMoonDescription(val3)); ((TMP_Text)val.planetInfoSummaryText).text = TranslateWeatherLine(text2).Replace("POPULATION:", "인구:").Replace("CONDITIONS:", "환경:").Replace("FAUNA:", "동물상:"); TranslateLandingRisk(val); } } internal static void TranslateLandingRisk(HUDManager hud) { TMP_Text planetRiskLevelText = (TMP_Text)(object)hud.planetRiskLevelText; if ((Object)(object)planetRiskLevelText == (Object)null) { return; } if (LandingRiskNames.TryGetValue((planetRiskLevelText.text ?? "").Trim(), out var value)) { planetRiskLevelText.text = value; } if ((Object)(object)hud.planetIntroAnimator == (Object)null) { return; } TMP_Text[] componentsInChildren = ((Component)hud.planetIntroAnimator).GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val in componentsInChildren) { string text = (val.text ?? "").Trim(); if (string.Equals(text.TrimEnd(':'), "HAZARD LEVEL", StringComparison.OrdinalIgnoreCase)) { val.text = "위험도" + (text.EndsWith(":", StringComparison.Ordinal) ? ":" : ""); } } } internal static void TranslateClock(HUDManager __instance) { TMP_Text clockNumber = (TMP_Text)(object)__instance.clockNumber; if ((Object)(object)clockNumber != (Object)null && clockNumber.text != null) { clockNumber.text = Regex.Replace(clockNumber.text, "\\b(?:AM|PM)\\b", (Match match) => (!(match.Value == "AM")) ? "오후" : "오전"); } } internal static void TranslateQuotaWarning(HUDManager __instance) { if ((Object)(object)__instance.reachedProfitQuotaAnimator == (Object)null) { return; } TMP_Text[] componentsInChildren = ((Component)__instance.reachedProfitQuotaAnimator).GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val in componentsInChildren) { if (Regex.Replace(val.text ?? "", "\\s+", " ").Trim() == "TO MEET PROFIT QUOTA") { val.text = "수익 할당량 달성까지"; } } } internal static string TranslateQuotaText(string value) { return Regex.Replace(value.Replace("PROFIT\nQUOTA:", "수익 할당량:").Replace("PROFIT QUOTA:", "수익 할당량:").Replace("DEADLINE:", "마감:") .Replace("AS MUCH PROFIT AS POSSIBLE", "최대한 많은 수익을 올리세요") .Replace("\n NOW", "\n지금"), "(\\d+) DAYS?\\b", "$1일", RegexOptions.IgnoreCase); } internal static void TranslateQuotaMonitors() { StartOfRound val = StartOfRound.Instance; if ((Object)(object)val == (Object)null) { return; } TextMeshProUGUI[] array = (TextMeshProUGUI[])(object)new TextMeshProUGUI[2] { val.profitQuotaMonitorText, val.deadlineMonitorText }; for (int i = 0; i < array.Length; i++) { TMP_Text val2 = (TMP_Text)(object)array[i]; if ((Object)(object)val2 != (Object)null && val2.text != null) { val2.text = TranslateQuotaText(val2.text); } } } internal static void TranslateFiredScreen(HUDManager __instance) { if ((Object)(object)__instance.playersFiredAnimator == (Object)null) { return; } TMP_Text[] componentsInChildren = ((Component)__instance.playersFiredAnimator).GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val in componentsInChildren) { string a = Regex.Replace((val.text ?? "").Trim(), "\\s+", " "); if (string.Equals(a, "YOU ARE FIRED.", StringComparison.OrdinalIgnoreCase)) { val.text = "해고되었습니다."; } else if (string.Equals(a, "You did not meet the profit quota before the deadline.", StringComparison.OrdinalIgnoreCase)) { val.text = "기한 내에 수익 할당량을 달성하지 못했습니다."; } } } internal static void TranslateSalesReceipt(HUDManager __instance) { TMP_Text moneyRewardsTotalText = (TMP_Text)(object)__instance.moneyRewardsTotalText; if ((Object)(object)moneyRewardsTotalText != (Object)null) { moneyRewardsTotalText.text = TranslateHud(moneyRewardsTotalText.text); } if ((Object)(object)__instance.moneyRewardsAnimator == (Object)null) { return; } TMP_Text[] componentsInChildren = ((Component)__instance.moneyRewardsAnimator).GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val in componentsInChildren) { if (string.Equals((val.text == null) ? null : val.text.Trim(), "Paycheck!", StringComparison.OrdinalIgnoreCase)) { val.text = "판매 정산"; } } } internal static void TranslateVanillaReport(HUDManager __instance) { if (!((Object)(object)__instance.endgameStatsAnimator != (Object)null)) { return; } GameObject gameObject = ((Component)__instance.endgameStatsAnimator).gameObject; TranslateReportLabels(gameObject); TMP_Text[] componentsInChildren = gameObject.GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val in componentsInChildren) { string text = TranslateGameplayReport(val.text); if (val.text != text) { val.text = text; } } } internal static void TranslateReportLabels(GameObject report) { if ((Object)(object)report == (Object)null) { return; } TMP_Text[] componentsInChildren = report.GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val in componentsInChildren) { string text = ((val.text == null) ? null : val.text.Trim()); if (text != null && (ReportLabels.TryGetValue(text, out var value) || ReportLabels.TryGetValue(text.TrimEnd(':'), out value))) { val.text = value; } } } internal static void TranslateBuildControls() { HUDManager val = HUDManager.Instance; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.buildModeControlTip == (Object)null)) { ((TMP_Text)val.buildModeControlTip).text = ((TMP_Text)val.buildModeControlTip).text.Replace("Free Rotate: Hold ", "자유 회전: 길게 ").Replace("CCW: Hold ", "반시계 방향: 길게 ").Replace("Confirm:", "배치:") .Replace("Rotate:", "회전:") .Replace("Store:", "보관:"); } } internal static string ScanDescription(ScanNodeProperties node) { string text = ((LocalizationApi.ScanNodeText == null) ? null : LocalizationApi.ScanNodeText(node, arg2: false)); if (text != null) { return text; } switch (node.subText) { case "Home base": return "작전 거점"; case "Useful info!": return "유용한 정보!"; case "Usable": return "사용 가능"; case "Pushable": return "밀 수 있음"; default: if (node.headerText == "Brake lever" && string.Equals(node.subText, "Lands the ship.", StringComparison.OrdinalIgnoreCase)) { return "함선을 착륙시킵니다."; } if (node.headerText == "Terminal" && string.Equals(node.subText, "Buy flashlights and travel to new planets!", StringComparison.OrdinalIgnoreCase)) { return "손전등을 사고 새로운 행성으로 떠나세요!"; } return TranslateHud((LocalizationApi.ScanDetail == null) ? node.subText : LocalizationApi.ScanDetail(node.subText, node.nodeType == 1)); } } internal static IEnumerable<CodeInstruction> ItemTranspiler(IEnumerable<CodeInstruction> instructions) { return ReplaceRead(instructions, AccessTools.Field(typeof(Item), "itemName"), "ItemName"); } internal static IEnumerable<CodeInstruction> ReplaceRead(IEnumerable<CodeInstruction> instructions, FieldInfo field, string replacement) { MethodInfo method = AccessTools.Method(typeof(ScrapDisplayPlugin), replacement, (Type[])null, (Type[])null); foreach (CodeInstruction instruction in instructions) { if (instruction.opcode == OpCodes.Ldfld && object.Equals(instruction.operand, field)) { instruction.opcode = OpCodes.Call; instruction.operand = method; } yield return instruction; } } internal static string TranslateScanEntityName(string name) { if (LocalizationApi.ScanEntity != null) { return LocalizationApi.ScanEntity(name); } if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("Body of ", StringComparison.OrdinalIgnoreCase)) { return "시신: " + name.Substring(8); } TerminalLoreEntry terminalLoreEntry = FindLoreEntry(null, name); if (terminalLoreEntry != null) { return terminalLoreEntry.Title; } return name; } internal static void LoadBaseTranslationData() { using (Stream stream = typeof(ScrapDisplayPlugin).Assembly.GetManifestResourceStream("MoonDescriptions.tsv")) { using StreamReader streamReader = new StreamReader(stream); string text; while ((text = streamReader.ReadLine()) != null) { string[] array = text.Split(new char[1] { '\t' }, 3); if (array.Length >= 2) { MoonDescriptions.Add(array[0], array[1].Replace(';', '\n')); } if (array.Length == 3) { MoonInfoDescriptions.Add(array[0], array[2].Replace(" | ", "\n\n")); } } } using (Stream stream2 = typeof(ScrapDisplayPlugin).Assembly.GetManifestResourceStream("HudText.tsv")) { using StreamReader streamReader2 = new StreamReader(stream2); string text2; while ((text2 = streamReader2.ReadLine()) != null) { string[] array2 = text2.Split(new char[1] { '\t' }); if (array2.Length == 2) { HudNames[array2[0]] = array2[1]; } } } List<string> list = new List<string>(HudNames.Keys); list.Sort((string left, string right) => right.Length.CompareTo(left.Length)); hudPattern = new Regex("(?<![A-Za-z])(?:" + string.Join("|", list.ConvertAll<string>(Regex.Escape).ToArray()) + ")(?![A-Za-z])", RegexOptions.IgnoreCase); using Stream stream3 = typeof(ScrapDisplayPlugin).Assembly.GetManifestResourceStream("ScrapNames.tsv"); using StreamReader streamReader3 = new StreamReader(stream3); string text3; while ((text3 = streamReader3.ReadLine()) != null) { string[] array3 = text3.Split(new char[1] { '\t' }); Names.Add(array3[0], array3[1]); } } private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Expected O, but got Unknown //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Expected O, but got Unknown //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Expected O, but got Unknown //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Expected O, but got Unknown //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Expected O, but got Unknown //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Expected O, but got Unknown //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Expected O, but got Unknown //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Expected O, but got Unknown instance = this; LoadBaseTranslationData(); Harmony val = new Harmony("thegreatestmilk.lckp"); Patch(val, AccessTools.Method(typeof(StartOfRound), "SetMapScreenInfoToCurrentLevel", (Type[])null, (Type[])null), "MoonDescriptionTranspiler"); val.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), "FillEndGameStats", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateVanillaReport", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo = AccessTools.Method(typeof(HUDManager), "ShowPlayersFiredScreen", (Type[])null, (Type[])null); HarmonyMethod val2 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateFiredScreen", (Type[])null); val2.priority = 0; val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo2 = AccessTools.Method(typeof(StartOfRound), "SetMapScreenInfoToCurrentLevel", (Type[])null, (Type[])null); HarmonyMethod val3 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateMapScreen", (Type[])null); val3.priority = 0; val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo3 = AccessTools.EnumeratorMoveNext((MethodBase)AccessTools.Method(typeof(StartOfRound), "openingDoorsSequence", (Type[])null, (Type[])null)); if (methodInfo3 != null) { HarmonyMethod val4 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateLandingInfo", (Type[])null); val4.priority = 0; val.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, val4, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } string[] array = new string[7] { "Update", "SetShipLeaveEarlyVotesText", "DisplayNewDeadline", "DisplayDaysLeft", "DisplaySpectatorVoteTip", "SetSpectatingTextToPlayer", "UpdateWeightCounter" }; foreach (string text in array) { Patch(val, AccessTools.Method(typeof(HUDManager), text, (Type[])null, (Type[])null), "StatusTextTranspiler"); } val.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), "DisplayDaysLeft", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateQuotaWarning", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); string[] array2 = new string[2] { "SetShipLeaveEarlyClientRpc", "ShipFullCapacityMidnightClientRpc" }; foreach (string text2 in array2) { Patch(val, AccessTools.Method(typeof(TimeOfDay), text2, (Type[])null, (Type[])null), "StatusTextTranspiler"); } MethodInfo methodInfo4 = AccessTools.Method(typeof(TimeOfDay), "UpdateProfitQuotaCurrentTime", (Type[])null, (Type[])null); HarmonyMethod val5 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateQuotaMonitors", (Type[])null); val5.priority = 0; val.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, val5, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo5 = AccessTools.Method(typeof(HUDManager), "SetClock", (Type[])null, (Type[])null); HarmonyMethod val6 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateClock", (Type[])null); val6.priority = 0; val.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, val6, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo6 = AccessTools.Method(typeof(ShipBuildModeManager), "CreateGhostObjectAndHighlight", (Type[])null, (Type[])null); HarmonyMethod val7 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateBuildControls", (Type[])null); val7.priority = 0; val.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, val7, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateScanTotal", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(PlayerControllerB), "SetHoverTipAndCurrentInteractTrigger", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateCursor", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); string[] array3 = new string[2] { "ChangeControlTip", "ChangeControlTipMultiple" }; foreach (string text3 in array3) { val.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), text3, (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateControls", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } Patch(val, AccessTools.Method(typeof(HUDManager), "UpdateScanNodes", (Type[])null, (Type[])null), "ScanTranspiler"); Patch(val, AccessTools.Method(typeof(HUDManager), "ChangeControlTipMultiple", (Type[])null, (Type[])null), "ItemTranspiler"); MethodInfo methodInfo7 = AccessTools.Method(typeof(HUDManager), "DisplayCreditsEarning", (Type[])null, (Type[])null); Patch(val, methodInfo7, "ItemTranspiler"); HarmonyMethod val8 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateSalesReceipt", (Type[])null); val8.priority = 0; val.Patch((MethodBase)methodInfo7, (HarmonyMethod)null, val8, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); PatchTerminal(val); PatchVanillaMenus(val); PatchVanillaGameplay(val); MethodInfo methodInfo8 = AccessTools.Method(typeof(StartOfRound), "Start", (Type[])null, (Type[])null); if (methodInfo8 != null) { val.Patch((MethodBase)methodInfo8, (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "CheckRegisteredScrap", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } InitializeFontRendering(val); ((BaseUnityPlugin)this).Logger.LogInfo((object)"LCKP 1.0.1: vanilla localization, fonts and TerminalFormatter compatibility."); } private void PatchTerminal(Harmony harmony) { translateMoonNames = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "TranslateMoonNames", true, "터미널에는 위성명을 한글로, 함선 모니터와 착륙 안내에는 한글과 영문으로 표시합니다. 끄면 세 화면 모두 영문 이름을 표시합니다."); translateTerminalCommands = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "TranslateCommandLabels", true, "터미널에서 Moons, Confirm 등 명령어를 한글로 표시합니다. 한글과 영문 명령어는 항상 사용할 수 있습니다."); LoadTerminalTranslations(); Patch(harmony, AccessTools.Method(typeof(Terminal), "LoadNewNode", new Type[1] { typeof(TerminalNode) }, (Type[])null), "TerminalTextTranspiler"); Patch(harmony, AccessTools.Method(typeof(Terminal), "ParsePlayerSentence", (Type[])null, (Type[])null), "TerminalInputTranspiler"); Patch(harmony, AccessTools.Method(typeof(Terminal), "BeginUsingTerminal", (Type[])null, (Type[])null), "TerminalPromptTranspiler"); PatchTerminalFormatter(harmony); } internal static void LoadTerminalTranslations() { terminalMoonNames = new Dictionary<string, string>(ReadTerminalTable("TerminalMoonNames.tsv"), StringComparer.OrdinalIgnoreCase); terminalPhrases = ReadTerminalTable("TerminalText.tsv"); terminalPages = ReadTerminalTable("TerminalPages.tsv"); LoadTerminalLore(); Dictionary<string, string> dictionary = new Dictionary<string, string>(terminalMoonNames, StringComparer.OrdinalIgnoreCase); if (terminalMoonNames.ContainsKey("ResearcherxB")) { dictionary["Researcher_6_x1753B"] = terminalMoonNames["ResearcherxB"]; } dictionary.Add("the Company building", terminalMoonNames["Company building"]); moonDisplayPattern = new Regex("(?<![A-Za-z0-9_])(?:" + string.Join("|", dictionary.Keys.OrderByDescending((string name) => name.Length).Select(Regex.Escape).ToArray()) + ")(?![A-Za-z0-9_])", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); } internal static Dictionary<string, string> ReadTerminalTable(string resource) { Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.Ordinal); using Stream stream = typeof(ScrapDisplayPlugin).Assembly.GetManifestResourceStream(resource); using StreamReader streamReader = new StreamReader(stream); string text; while ((text = streamReader.ReadLine()) != null) { if (text.Length != 0 && text[0] != '#') { string[] array = text.Split(new char[1] { '\t' }, 2); dictionary.Add(array[0].Replace("\\n", "\n"), array[1].Replace("\\n", "\n")); } } return dictionary; } internal static IEnumerable<CodeInstruction> TerminalPromptTranspiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { string text = instruction.operand as string; if (instruction.opcode == OpCodes.Ldstr && terminalPhrases.TryGetValue(text, out var korean)) { instruction.operand = korean; } yield return instruction; } } internal static string TranslateTerminalInput(string input, Terminal terminal) { if (string.IsNullOrEmpty(input)) { return input; } if (LocalizationApi.Input != null) { input = LocalizationApi.Input(input); } string text = input.Trim().Normalize(); switch (text.Normalize(NormalizationForm.FormKC)) { case "확": case "ᄋᄋ": case "ᄀᄀ": return "confirm"; case "ᄂᄂ": return "deny"; default: { if (!Regex.IsMatch(text, "[가-힣]") || (Object)(object)terminal.terminalNodes == (Object)null || terminal.terminalNodes.allKeywords == null) { return input; } foreach (KeyValuePair<string, string> terminalCommand in TerminalCommands) { if (text == terminalCommand.Value) { return terminalCommand.Key; } if (text.StartsWith(terminalCommand.Value + " ", StringComparison.Ordinal)) { text = terminalCommand.Key + " " + text.Substring(terminalCommand.Value.Length).TrimStart(new char[0]); break; } } if (Regex.IsMatch(text, "^(?:switch|ping|flash|transmit|sort|filter|preview)\\s", RegexOptions.IgnoreCase)) { return text; } text = Regex.Replace(text, "^(.+?)\\s+(?:정보|info)$", "info $1", RegexOptions.IgnoreCase); Match match = ProductCommand.Match(text); if (!match.Success) { return text; } string text2 = match.Groups["name"].Value; string value = match.Groups["amount"].Value; string text3 = match.Groups["verb"].Value.ToLowerInvariant(); switch (text3) { case "route": case "info": case "view": if (value.Length != 0) { text2 = text2 + " " + value; } break; } TerminalKeyword[] allKeywords = terminal.terminalNodes.allKeywords; string text4; if (text3 == "route" || text3 == "info" || (text3.Length == 0 && value.Length == 0)) { text4 = ResolveTerminalNoun(allKeywords, "route", GetMoonName(text2), moon: true); if (text4 != null) { return ((text3.Length == 0) ? "route" : text3) + " " + text4; } } if (text3 == "view" || text3 == "info") { text4 = ResolveLoreNoun(allKeywords, text3, text2); if (text4 != null) { return text3 + " " + text4; } } if (text3 == "route" || text3 == "view") { return text; } if (text3.Length == 0) { text3 = "buy"; } text4 = ResolveTerminalNoun(allKeywords, text3, text2, moon: false); if (text4 != null) { return text3 + " " + text4 + ((value.Length == 0) ? "" : (" " + value)); } return text; } } } internal static string ResolveTerminalNoun(TerminalKeyword[] keywords, string verb, string noun, bool moon) { string text = ProductKey.Replace(noun, ""); int count = Regex.Matches(text, "[가-힣]").Count; if (count < (moon ? 1 : 2)) { return null; } TerminalKeyword val = Array.Find(keywords, (TerminalKeyword keyword) => (Object)(object)keyword != (Object)null && keyword.isVerb && string.Equals(keyword.word, verb, StringComparison.OrdinalIgnoreCase)); if ((Object)(object)val == (Object)null || val.compatibleNouns == null) { return null; } string text2 = null; bool flag = false; CompatibleNoun[] compatibleNouns = val.compatibleNouns; foreach (CompatibleNoun val2 in compatibleNouns) { if ((Object)(object)val2.noun == (Object)null || (Object)(object)val2.result == (Object)null || string.IsNullOrWhiteSpace(val2.noun.word)) { continue; } string word = val2.noun.word; string input = (moon ? MoonNounLabel(word) : TranslateProductLabel(word)); string text3 = ProductKey.Replace(input, ""); if (string.Equals(text3, text, StringComparison.OrdinalIgnoreCase)) { return word; } if (count >= 2 && text3.StartsWith(text, StringComparison.OrdinalIgnoreCase)) { if (text2 != null && !string.Equals(text2, word, StringComparison.OrdinalIgnoreCase)) { flag = true; } text2 = word; } } if (!flag) { return text2; } return null; } internal static string MoonNounLabel(string english) { string text = GetMoonName(english); if (string.Equals(text, "company", StringComparison.OrdinalIgnoreCase) || string.Equals(text, "the company building", StringComparison.OrdinalIgnoreCase)) { text = "Company building"; } if (terminalMoonNames.TryGetValue(text, out var value)) { return value; } string b = ProductKey.Replace(text, ""); foreach (KeyValuePair<string, string> terminalMoonName in terminalMoonNames) { if (string.Equals(ProductKey.Replace(terminalMoonName.Key, ""), b, StringComparison.OrdinalIgnoreCase)) { return terminalMoonName.Value; } } return english; } internal static string TranslateMoonLabel(string text) { return moonDisplayPattern.Replace(text, (Match match) => MoonNounLabel(match.Value)); } internal static string TranslateTerminalText(string text, TerminalNode node) { return LocalizeTerminalPage(text, node, null); } internal static string LocalizeTerminalPage(string text, TerminalNode node, string formatter) { if (LocalizationApi.TerminalPage != null) { return LocalizationApi.TerminalPage(text, node, formatter); } return LocalizeTerminalPageCore(text, node, formatter); } internal static string LocalizeTerminalPageCore(string text, TerminalNode node, string formatter) { if (string.IsNullOrEmpty(text)) { return text; } if ((Object)(object)node != (Object)null && !string.IsNullOrEmpty(node.displayText) && terminalPages.TryGetValue(((Object)node).name, out var value)) { return TranslateCommandLabels(text.Replace(node.displayText, value + "\n\n")); } if (MoonPage.IsMatch(text)) { goto IL_0092; } switch (formatter) { case "Moons": case "Route": case "RouteAfter": goto IL_0092; } int num = ((formatter == "RouteLocked") ? 1 : 0); goto IL_0093; IL_0092: num = 1; goto IL_0093; IL_0093: bool flag = (byte)num != 0; if (flag) { text = MoonWeather.Replace(text, (Match weather) => WeatherLabels[weather.Value]); } bool flag2 = false; Match match = Regex.Match(text, "\\A\\s*(?<name>[^\\r\\n]+)\\r?\\n-{5,}[^\\S\\r\\n]*\\r?\\n"); if ((Object)(object)node != (Object)null) { if (LocalizationApi.MoonInfo != null) { string text2 = LocalizationApi.MoonInfo(text, node); flag2 = text2 != text; text = text2; } if (!flag2 && match.Success && MoonInfoDescriptions.TryGetValue(GetMoonName(match.Groups["name"].Value), out value)) { text = match.Value + "\n" + value + "\n\n"; flag2 = true; } if (!flag2 && (node.storyLogFileID >= 0 || node.creatureFileID >= 0)) { return text; } } if (translateMoonNames.Value) { if (flag) { text = TranslateMoonLabel(text); } else if (flag2) { text = TranslateMoonLabel(text); } } if (formatter == "Bestiary" || ((Object)(object)node != (Object)null && (((Object)node).name == "0_Bestiary" || ((Object)node).name == "0_LogsHub"))) { text = TranslateLoreList(text); } text = TranslateVanillaStore(text); switch (formatter) { default: if (!((Object)(object)node != (Object)null) || !(((Object)node).name == "ItemsInStorage")) { break; } goto case "Buy"; case "Buy": case "BuyAfter": case "Storage": text = TranslateFormatterProducts(text); break; } if (LocalizationApi.TerminalPost != null) { text = LocalizationApi.TerminalPost(text); } text = TranslateTerminalResponses(text); if (formatter == "Scan") { text = TranslateUtilsScan(text); } foreach (KeyValuePair<string, string> terminalPhrase in terminalPhrases) { text = text.Replace(terminalPhrase.Key, terminalPhrase.Value); } text = TranslateTerminalValues(text); if (formatter == "Moons" || formatter == "Scan") { text = Regex.Replace(text, "\\b(Name|Price|Weather|Difficulty|DustClouds|Rainy|Stormy|Foggy|Flooded|Eclipsed|Clear)\\b", delegate(Match match2) { if (WeatherLabels.TryGetValue(match2.Value, out var value2)) { return value2; } return (!(match2.Value == "Name")) ? ((!(match2.Value == "Price")) ? ((!(match2.Value == "Weather")) ? "난이도" : "날씨") : "가격") : "이름"; }); } return TranslateCommandLabels(text); } internal static string TranslateFormatterProducts(string text) { return Regex.Replace(text, "(?<![A-Za-z0-9])(?:" + string.Join("|", StoreNames.Keys.OrderByDescending((string name) => name.Length).Select(Regex.Escape).ToArray()) + ")(?![A-Za-z0-9])", (Match match) => StoreNames[match.Value], RegexOptions.IgnoreCase); } internal static string TranslateTerminalValues(string text) { text = Regex.Replace(text, "Happy (Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)\\.", (Match match) => new Dictionary<string, string> { { "Monday", "월" }, { "Tuesday", "화" }, { "Wednesday", "수" }, { "Thursday", "목" }, { "Friday", "금" }, { "Saturday", "토" }, { "Sunday", "일" } }[match.Groups[1].Value] + "요일입니다."); text = Regex.Replace(text, "There are (\\d+) objects in the ship, totalling at (\\$[\\d,]+)\\.", "함선 내부 물품 $1개 (총 $2)."); text = Regex.Replace(text, "There are (\\d+) objects outside the ship, totalling at an approximate value of (\\$[\\d,]+)\\.", "함선 외부 물품 $1개 (예상 금액 $2)."); text = Regex.Replace(text, "The Company\\s*//\\s*Buying at ([\\d.]+%)", "회사 // 매입률 $1"); text = Regex.Replace(text, "Route to ([^\\r\\n]+?) is currently locked\\.", "$1 항로는 현재 잠겨 있습니다."); text = Regex.Replace(text, "(?<=//)[ \\t]*Buying at ([\\d.]+%)", " 매입률 $1"); text = Regex.Replace(text, "The Company is buying your goods at ([\\d.]+%)", "현재 회사 매입률은 $1입니다"); text = Regex.Replace(text, "\\((\\$-?[\\d,.]+) after purchase\\)", "(구매 후 $1)"); text = Regex.Replace(text, "\\((\\$-?[\\d,.]+) after routing\\)", "(항로 설정 후 $1)"); return Regex.Replace(text, "Your (.+?) \\((\\d+) x (.+?)\\) (?:is|are) on (?:its|their) way!", (Match match) => "배송 중인 상품: " + TranslateProductLabel(match.Groups[3].Value) + " " + match.Groups[2].Value + "개"); } internal static string TranslateCommandLabels(string text) { if (!translateTerminalCommands.Value) { return text; } text = CommandInQuotes.Replace(text, (Match match) => "\"" + TerminalCommandLabel(match.Groups["command"].Value) + "\""); return CommandLabels.Replace(text, (Match match) => TerminalCommandLabel(match.Value)); } internal static string TerminalCommandLabel(string command) { string text = TerminalCommands[command]; if (string.Equals(command, "confirm", StringComparison.OrdinalIgnoreCase)) { return text + "[C]"; } if (string.Equals(command, "deny", StringComparison.OrdinalIgnoreCase)) { return text + "[D]"; } return text; } internal static string FormatterPageName(string name) { if (!(name == "MoonCatalogue")) { if (!(name == "StoreCatalogue")) { return name; } return "Store"; } return "Moons"; } internal static string TranslateUtilsScan(string text) { text = text.Replace("Scanning all scrap:", "전체 스크랩을 스캔합니다."); text = text.Replace("Scanning scrap on the moon:", "위성의 스크랩을 스캔합니다."); text = text.Replace("Scanning scrap in the ship:", "함선의 스크랩을 스캔합니다."); text = text.Replace("SCANNING MOON", "위성 스캔 중"); text = text.Replace("SCANNING SHIP", "함선 스캔 중"); return Regex.Replace(text, "Found (\\d+) scrap items?, worth (about )?(\\$[\\d,.]+)\\.", (Match match) => "스크랩 " + match.Groups[1].Value + "개 발견 (" + (match.Groups[2].Success ? "약 " : "") + match.Groups[3].Value + ")."); } internal static string TranslateTerminalUtilsInput(string input) { Match match = Regex.Match(input, "^\\s*(?<verb>정렬|필터|미리보기|sort|filter|preview)(?=\\s|$)(?<args>.*)$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); if (!match.Success) { return input; } string value = match.Groups["verb"].Value; string text = value switch { "미리보기" => "preview", "필터" => "filter", "정렬" => "sort", _ => value, }; string text2 = match.Groups["args"].Value; foreach (KeyValuePair<string, string> terminalUtilsOption in TerminalUtilsOptions) { text2 = Regex.Replace(text2, "(?<!\\S)" + Regex.Escape(terminalUtilsOption.Value) + "(?!\\S)", terminalUtilsOption.Key); } return text + text2; } internal static IEnumerable<CodeInstruction> TerminalUtilsInputTranspiler(IEnumerable<CodeInstruction> instructions) { MethodInfo removePunctuation = AccessTools.Method(typeof(Terminal), "RemovePunctuation", new Type[1] { typeof(string) }, (Type[])null); MethodInfo translate = AccessTools.Method(typeof(ScrapDisplayPlugin), "TranslateTerminalUtilsInput", (Type[])null, (Type[])null); foreach (CodeInstruction instruction in instructions) { if (object.Equals(instruction.operand, removePunctuation)) { CodeInstruction normalize = new CodeInstruction(OpCodes.Call, (object)translate); normalize.labels.AddRange(instruction.labels); instruction.labels.Clear(); yield return normalize; } yield return instruction; } } internal static IEnumerable<CodeInstruction> TerminalUtilsScrollTranspiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { string pattern = ((instruction.opcode == OpCodes.Ldstr) ? (instruction.operand as string) : null); if (pattern != null && pattern.StartsWith("(?>\\n{1,2}|)[A-Za-z0-9", StringComparison.Ordinal)) { instruction.operand = pattern.Replace("A-Za-z0-9", "\\p{L}\\p{N}"); } yield return instruction; } } internal static void LoadTerminalLore() { using Stream stream = typeof(ScrapDisplayPlugin).Assembly.GetManifestResourceStream("TerminalLore.tsv"); using StreamReader streamReader = new StreamReader(stream); string text; while ((text = streamReader.ReadLine()) != null) { if (text.Length == 0 || text[0] == '#') { continue; } string[] array = text.Split(new char[1] { '\t' }, 4); string text2 = array[3].Replace("\\n", "\n"); if (array[3].StartsWith("@", StringComparison.Ordinal)) { TerminalLoreEntry terminalLoreEntry = LoreByAsset[array[3].Substring(1)]; text2 = terminalLoreEntry.Text; if (text2.StartsWith(terminalLoreEntry.Title, StringComparison.Ordinal)) { text2 = array[2] + text2.Substring(terminalLoreEntry.Title.Length); } } TerminalLoreEntry value = new TerminalLoreEntry(array[2], text2); LoreByAsset.Add(array[0], value); string[] array2 = array[1].Split(new char[1] { '/' }); foreach (string key in array2) { LoreByEnglishTitle[key] = value; } } } internal static TerminalLoreEntry FindLoreEntry(string assetName, string englishTitle) { if (!string.IsNullOrEmpty(assetName) && LoreByAsset.TryGetValue(assetName, out var value)) { return value; } if (string.IsNullOrWhiteSpace(englishTitle) || !LoreByEnglishTitle.TryGetValue(englishTitle.Trim(), out value)) { return null; } return value; } internal static TerminalLoreEntry FindNodeLore(TerminalNode node) { if ((Object)(object)node == (Object)null || (node.creatureFileID < 0 && node.storyLogFileID < 0)) { return null; } if (RegisteredLore.TryGetValue(node, out var value)) { return value; } return FindLoreEntry(((Object)node).name, node.creatureName); } internal static string GetTerminalLoreText(TerminalNode node) { TerminalLoreEntry terminalLoreEntry = FindNodeLore(node); if (terminalLoreEntry != null) { return terminalLoreEntry.Text + "\n\n"; } return node.displayText; } internal static string TranslateLoreList(string text) { return LoreListLine.Replace(text, delegate(Match match) { TerminalLoreEntry terminalLoreEntry = FindLoreEntry(null, match.Groups["title"].Value); if (terminalLoreEntry == null) { return match.Value; } string text2 = match.Groups["lead"].Value.Replace("scanID #", "스캔 #"); return text2 + terminalLoreEntry.Title + match.Groups["tail"].Value; }); } internal static string ResolveLoreNoun(TerminalKeyword[] keywords, string verb, string name) { TerminalKeyword val = Array.Find(keywords, (TerminalKeyword keyword) => (Object)(object)keyword != (Object)null && keyword.isVerb && string.Equals(keyword.word, verb, StringComparison.OrdinalIgnoreCase)); if ((Object)(object)val == (Object)null || val.compatibleNouns == null) { return null; } string a = ProductKey.Replace(name, ""); string text = null; CompatibleNoun[] compatibleNouns = val.compatibleNouns; foreach (CompatibleNoun val2 in compatibleNouns) { if ((Object)(object)val2.noun == (Object)null || (Object)(object)val2.result == (Object)null) { continue; } string word = val2.noun.word; string value = FindNodeLore(val2.result)?.Title; if (verb == "view" && value == null && !string.IsNullOrEmpty(((Object)val2.result).name)) { WesleyStoryLogTitles.TryGetValue(((Object)val2.result).name, out value); } if (value == null || string.IsNullOrWhiteSpace(word)) { continue; } int num2 = value.IndexOf(" - ", StringComparison.Ordinal); string input = ((num2 < 0) ? value : value.Substring(0, num2)); if (string.Equals(a, ProductKey.Replace(input, ""), StringComparison.OrdinalIgnoreCase) || string.Equals(a, ProductKey.Replace(value, ""), StringComparison.OrdinalIgnoreCase)) { if (text != null && !string.Equals(text, word, StringComparison.OrdinalIgnoreCase)) { return null; } text = word; } } return text; } internal static void FormatSaveFileSlot(SaveFileUISlot __instance) { if ((Object)(object)__instance.fileStatsText != (Object)null) { ((TMP_Text)__instance.fileStatsText).text = Regex.Replace(((TMP_Text)__instance.fileStatsText).text ?? "", "\\bDays:[ \\t]*(\\d+)", "$1일"); } } private void PatchVanillaMenus(Harmony harmony) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Expected O, but got Unknown string[] array = new string[2] { "OnEnable", "SetChallengeFileSettings" }; foreach (string text in array) { MethodInfo methodInfo = AccessTools.Method(typeof(SaveFileUISlot), text, (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(ScrapDisplayPlugin), "FormatSaveFileSlot", (Type[])null); val.priority = 0; harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo2 = AccessTools.Method(typeof(PreInitSceneScript), "Start", (Type[])null, (Type[])null); HarmonyMethod val2 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateLaunchMenu", (Type[])null); val2.priority = 0; harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo3 = AccessTools.Method(typeof(MenuManager), "Start", (Type[])null, (Type[])null); HarmonyMethod val3 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateMainMenu", (Type[])null); val3.priority = 0; harmony.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo4 = AccessTools.Method(typeof(QuickMenuManager), "Start", (Type[])null, (Type[])null); HarmonyMethod val4 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslatePauseMenu", (Type[])null); val4.priority = 0; harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, val4, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(MenuManager), "DisplayMenuNotification", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateMenuNotification", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo5 = AccessTools.Method(typeof(LobbySlot), "Awake", (Type[])null, (Type[])null); HarmonyMethod val5 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateLobbySlot", (Type[])null); val5.priority = 0; harmony.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, val5, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo6 = AccessTools.Method(typeof(LobbySlot), "OnLobbyDataRefresh", (Type[])null, (Type[])null); HarmonyMethod val6 = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateLobbyPlayerCount", (Type[])null); val6.priority = 0; harmony.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, val6, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(IngamePlayerSettings), "SetSettingsOptionsText", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateMenuSettingValue", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); string[] array2 = new string[2] { "PressContinueButton", "SkipToFinalSetting" }; foreach (string text2 in array2) { Patch(harmony, AccessTools.Method(typeof(PreInitSceneScript), text2, (Type[])null, (Type[])null), "VanillaMenuLiteralTranspiler"); } string[] array3 = new string[4] { "StartAClient", "StartHosting", "HostSetLobbyPublic", "DisplayLeaderboardSlots" }; foreach (string text3 in array3) { Patch(harmony, AccessTools.Method(typeof(MenuManager), text3, (Type[])null, (Type[])null), "VanillaMenuLiteralTranspiler"); } string[] array4 = new string[5] { "RefreshAndDisplayCurrentMicrophone", "SwitchMicrophoneSetting", "SetMicPushToTalk", "UpdateMicPushToTalkButton", "SetChangesNotAppliedTextVisible" }; foreach (string text4 in array4) { Patch(harmony, AccessTools.Method(typeof(IngamePlayerSettings), text4, (Type[])null, (Type[])null), "VanillaMenuLiteralTranspiler"); } Patch(harmony, AccessTools.Method(typeof(SettingsOption), "ToggleEnabledImage", (Type[])null, (Type[])null), "VanillaMenuLiteralTranspiler"); Patch(harmony, AccessTools.Method(typeof(QuickMenuManager), "KickUserFromServer", (Type[])null, (Type[])null), "VanillaMenuLiteralTranspiler"); Patch(harmony, AccessTools.Method(typeof(KepRemapPanel), "LoadKeybindsUI", (Type[])null, (Type[])null), "MenuKeybindTranspiler"); PatchStateMachine(harmony, typeof(SteamLobbyManager), "LoadServerList", "VanillaMenuLiteralTranspiler"); PatchStateMachine(harmony, typeof(MenuManager), "GetLeaderboardForChallenge", "VanillaMenuLiteralTranspiler"); PatchStateMachine(harmony, typeof(MenuManager), "delayedStartScene", "VanillaMenuLiteralTranspiler"); } private void PatchStateMachine(Harmony harmony, Type type, string method, string transpiler) { Type[] nestedTypes = type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic); foreach (Type type2 in nestedTypes) { if (type2.Name.StartsWith("<" + method + ">", StringComparison.Ordinal)) { Patch(harmony, AccessTools.Method(type2, "MoveNext", (Type[])null, (Type[])null), transpiler); } } } internal static string TranslateVanillaMenuText(string text) { if (string.IsNullOrWhiteSpace(text)) { return text; } if (VanillaMenuLabels.TryGetValue(text, out var value)) { return value; } string text2 = text.Replace("\\n", "\n").Replace("\r\n", "\n").Trim(); if (VanillaMenuLabels.TryGetValue(text2, out value)) { int length = text.Length - text.TrimStart(new char[0]).Length; int num = text.Length - text.TrimEnd(new char[0]).Length; return text.Substring(0, length) + value + text.Substring(text.Length - num); } Match match = MenuDecoratedLabel.Match(text2); if (match.Success && VanillaMenuLabels.TryGetValue(match.Groups["label"].Value.Trim(), out value)) { return match.Groups["lead"].Value + value + match.Groups["tail"].Value; } match = MenuVersionMismatch.Match(text2); if (match.Success) { return "방장은 버전 " + match.Groups[1].Value + "을 사용 중입니다. 내 버전은 " + match.Groups[2].Value + "입니다."; } match = MenuPlayerCount.Match(text2); if (match.Success) { return "인원: " + match.Groups[1].Value; } match = MenuCollectedScore.Match(text2); if (match.Success) { return "수집액: " + match.Groups[1].Value; } match = MenuDeleteFile.Match(text2); if (match.Success) { return "저장 파일 " + match.Groups[1].Value + "을 삭제하시겠습니까?"; } return text; } internal static void TranslateMenuNotification(ref string __0, ref string __1) { __0 = TranslateVanillaMenuText(__0); __1 = TranslateVanillaMenuText(__1); } internal static void TranslateMenuSettingValue(ref string __1) { __1 = TranslateVanillaMenuText(__1); } internal static void TranslateLaunchMenu(PreInitSceneScript __instance) { TranslateMenuScene((MonoBehaviour)(object)__instance); } internal static void TranslateMainMenu(MenuManager __instance) { TranslateMenuScene((MonoBehaviour)(object)__instance); } internal static void TranslateMenuScene(MonoBehaviour controller) { //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)controller).gameObject.scene; GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject root in rootGameObjects) { TranslateMenuTree(root, null); } } internal static void TranslatePauseMenu(QuickMenuManager __instance) { GameObject[] array = (GameObject[])(object)new GameObject[3] { __instance.menuContainer, __instance.settingsPanel, __instance.KeybindsPanel }; foreach (GameObject root in array) { TranslateMenuTree(root, __instance.playerListPanel); } } internal static void TranslateLobbySlot(LobbySlot __instance) { TranslateMenuTree(((Component)__instance).gameObject, null); } internal static void TranslateLobbyPlayerCount(LobbySlot __instance) { if ((Object)(object)__instance.playerCount != (Object)null) { ((TMP_Text)__instance.playerCount).text = TranslateVanillaMenuText(((TMP_Text)__instance.playerCount).text); } } internal static void TranslateMenuTree(GameObject root, GameObject playerList) { if ((Object)(object)root == (Object)null) { return; } HashSet<TMP_Text> hashSet = new HashSet<TMP_Text>(); TMP_InputField[] componentsInChildren = root.GetComponentsInChildren<TMP_InputField>(true); foreach (TMP_InputField val in componentsInChildren) { hashSet.Add(val.textComponent); } TMP_Text[] componentsInChildren2 = root.GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val2 in componentsInChildren2) { if (hashSet.Contains(val2)) { continue; } LobbySlot componentInParent = ((Component)val2).GetComponentInParent<LobbySlot>(); if ((!((Object)(object)componentInParent != (Object)null) || !((Object)(object)componentInParent.LobbyName == (Object)(object)val2)) && (!((Object)(object)playerList != (Object)null) || !val2.transform.IsChildOf(playerList.transform) || string.Equals((val2.text ?? "").Trim(), "CREW:", StringComparison.OrdinalIgnoreCase))) { string text = val2.text; string text2 = ((((Object)((Component)val2).gameObject).name == "CreditsText" && text != null) ? Regex.Replace(text, "(?m)^[^\\r\\n]+", (Match match) => TranslateVanillaMenuText(match.Value)) : TranslateVanillaMenuText(text)); if (text != text2) { val2.text = text2; } } } TMP_Dropdown[] componentsInChildren3 = root.GetComponentsInChildren<TMP_Dropdown>(true); foreach (TMP_Dropdown val3 in componentsInChildren3) { if (!VanillaSettingsDropdowns.Contains(((Object)val3).name) && (((Object)val3).name != "Dropdown" || !val3.options.Exists((OptionData option) => option.text == "Sort: Friends" || option.text == "Sort: near"))) { continue; } foreach (OptionData option in val3.options) { option.text = TranslateVanillaMenuText(option.text); } val3.RefreshShownValue(); } } internal static IEnumerable<CodeInstruction> VanillaMenuLiteralTranspiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { if (instruction.opcode == OpCodes.Ldstr) { instruction.operand = TranslateVanillaMenuText((string)instruction.operand); } yield return instruction; } } internal static IEnumerable<CodeInstruction> MenuKeybindTranspiler(IEnumerable<CodeInstruction> instructions) { FieldInfo controlName = AccessTools.Field(typeof(RemappableKey), "ControlName"); MethodInfo translate = AccessTools.Method(typeof(ScrapDisplayPlugin), "TranslateVanillaMenuText", (Type[])null, (Type[])null); bool localizedAction = false; foreach (CodeInstruction instruction in VanillaMenuLiteralTranspiler(instructions)) { yield return instruction; if (!localizedAction && instruction.opcode == OpCodes.Ldfld && object.Equals(instruction.operand, controlName)) { yield return new CodeInstruction(OpCodes.Call, (object)translate); localizedAction = true; } } } internal static string TranslateGameplayRankName(string name) { if (name == null || !GameplayRankNames.TryGetValue(name, out var value)) { return name; } return value; } private void PatchVanillaGameplay(Harmony harmony) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(HUDManager), "Start", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateGameplayHud", (Type[])null); val.priority = 0; harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), "DisplayTip", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateGameplayTip", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), "DisplayGlobalNotification", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateGameplayNotice", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(HUDManager), "DisplayStatusEffect", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ScrapDisplayPlugin), "TranslateGameplayNotice", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); string[] array = new string[3] { "OnDeviceChange", "FillChallengeResultsStats", "ApplyPenalty" }; foreach (string text in array) { Patch(harmony, AccessTools.Method(typeof(HUDManager), text, (Type[])null, (Type[])null), "GameplayLiteralTranspiler"); } string[] array2 = new string[4] { "SceneManager_OnLoad", "SceneManager_OnLoadComplete1", "FirePlayersAfterDeadlineClientRpc", "SetShipReadyToLand" }; foreach (string text2 in array2) { Patch(harmony, AccessTools.Method(typeof(StartOfRound), text2, (Type[])null, (Type[])null), "GameplayLiteralTranspiler"); } Patch(harmony, AccessTools.Method(typeof(HUDManager), "DisplayNewScrapFound", (Type[])null, (Type[])null), "GameplayScrapTranspiler"); Patch(harmony, AccessTools.Method(typeof(HUDManager), "SetPlayerLevel", (Type[])null, (Type[])null), "GameplayRankTranspiler"); PatchStateMachine(harmony, typeof(HUDManager), "SetPlayerLevelSmoothly", "GameplayRankTranspiler"); PatchStateMachine(harmony, typeof(StartOfRound), "waitingForOtherPlayersToRevive", "GameplayLiteralTranspiler"); } internal static string TranslateVanillaGameplayText(string text) { if (string.IsNullOrWhiteSpace(text)) { return text; } if (VanillaGameplayLabels.TryGetValue(text, out var value)) { return value; } string text2 = text.Replace("\\n", "\n").Replace("\r\n", "\n").Trim(); if (VanillaGameplayLabels.TryGetValue(text2, out value)) { return value; } Match match = NewJournalNotice.Match(text2); if (match.Success) { string value2 = match.Groups[1].Value; TerminalLoreEntry terminalLoreEntry = FindLoreEntry(null, value2); return "기록 발견: '" + ((terminalLoreEntry == null) ? value2 : terminalLoreEntry.Title) + "'"; } match = FeverStatus.Match(text2); if (match.Success) { return "고열 감지!\n체온 " + match.Groups[1].Value + "°F에 도달"; } match = FilterStatus.Match(text2); if (match.Success) { return "건강 위험!\n공기 필터가 미립자를 감당하지 못합니다.\n\n필터 상태: " + match.Groups[1].Value + "%"; } if (LocalizationApi.Gameplay != null) { string text3 = LocalizationApi.Gameplay(text2); if (text3 != text2) { return text3; } } match = DisplayedSeed.Match(text2); if (match.Success) { return "랜덤 시드: " + match.Groups[1].Value; } return text; } internal static string TranslateGameplayReport(string text) { if (string.IsNullOrEmpty(text) || !Regex.IsMatch(text, "\\A\\s*(?:Notes:|특이 사항:|\\*)")) { return text; } return GameplayReportLine.Replace(text, (Match match) => match.Groups["lead"].Value + TranslateVanillaGameplayText(match.Groups["body"].Value)); } internal static string TranslateDeathReason(string reason) { if (string.IsNullOrWhiteSpace(reason) || !DeathReasons.TryGetValue(reason.Trim(), out var value)) { return reason; } return " " + value; } internal static void TranslateGameplayTip(ref string __0, ref string __1) { __0 = TranslateVanillaGameplayText(__0); __1 = TranslateVanillaGameplayText(__1); } internal static void TranslateGameplayNotice(ref string __0) { __0 = TranslateVanillaGameplayText(__0); } internal static void TranslateGameplayHud(HUDManager __instance) { if (__instance.controlTipLines != null) { TranslateControls(__instance); } Animator[] array = (Animator[])(object)new Animator[9] { __instance.HUDAnimator, __instance.LoadingScreen, __instance.gameOverAnimator, __instance.endgameStatsAnimator, __instance.playersFiredAnimator, __instance.playerLevelBoxAnimator, __instance.reachedProfitQuotaAnimator, __instance.meteorShowerGraphicAnimator, __instance.radiationGraphicAnimator }; foreach (Animator val in array) { if ((Object)(object)val == (Object)null) { continue; } TMP_Text[] componentsInChildren = ((Component)val).GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)(object)__instance.chatText) && (!((Object)(object)__instance.chatTextField != (Object)null) || !((Object)(object)val2 == (Object)(object)__instance.chatTextField.textComponent))) { string text = (((Object)(object)val2 == (Object)(object)__instance.playerLevelText) ? TranslateGameplayRankName(val2.text) : TranslateVanillaGameplayText(val2.text)); if (val2.text != text) { val2.text = text; } } } } } internal static IEnumerable<CodeInstruction> GameplayLiteralTranspiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { if (instruction.opcode == OpCodes.Ldstr) { instruction.operand = TranslateVanillaGameplayText((string)instruction.operand); } yield return instruction; } } internal static IEnumerable<CodeInstruction> GameplayScrapTranspiler(IEnumerable<CodeInstruction> instructions) { return ItemTranspiler(GameplayLiteralTranspiler(instructions)); } internal static IEnumerable<CodeInstruction> GameplayRankTranspiler(IEnumerable<CodeInstruction> instructions) { FieldInfo levelName = AccessTools.Field(typeof(PlayerLevel), "levelName"); MethodInfo translate = AccessTools.Method(typeof(ScrapDisplayPlugin), "TranslateGameplayRankName", (Type[])null, (Type[])null); foreach (CodeInstruction instruction in GameplayLiteralTranspiler(instructions)) { yield return instruction; if (instruction.opcode == OpCodes.Ldfld && object.Equals(instruction.operand, levelName)) { yield return new CodeInstruction(OpCodes.Call, (object)translate); } } } private void InitializeFontRendering(Harmony harmony) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_00aa: 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) //IL_00cc: Expected O, but got Unknown //IL_00cc: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0123: Expected O, but got Unknown string path = Path.Combine(Paths.ConfigPath, "lekakid.lcfontpatcher.cfg"); if (File.Exists(path) && Regex.IsMatch(File.ReadAllText(path), "(?im)^FontAssetsPath\\s*=\\s*FontPatcher[\\\\/]MaruBuri\\s*$")) { harmony.Patch((MethodBase)AccessTools.PropertyGetter(typeof(TMP_Settings), "matchMaterialPreset"), (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapDisplayPlugin), "UseMaruBuriMaterial", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Type[] array = new Type[2] { typeof(TextMeshProUGUI), typeof(TextMeshPro) }; foreach (Type type in array) { harmony.Patch((MethodBase)AccessTools.Method(type, "GenerateTextMesh", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ScrapDisplayPlugin), "BeginReducedFontRender", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new